From nobody Wed Nov 27 21:25:34 2024 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C77E61D95A3 for ; Mon, 7 Oct 2024 15:45:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315948; cv=none; b=gPerJ1xZszCyzTvQc1GCIPDUnrCXKSLdGpvWEsPOQhURuiP4Y0gtcxKDCyCqq/d6Es8h83KjXaiKQ8arF7kHcVaoAUiZ9RNp1s8C9w6d5Qei855fFaTE9qq0tGze4YcXVakrImURsvZjNJTlQ2Lq3NskeHtGFe8eaYJtwPTw04M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315948; c=relaxed/simple; bh=rg89aYnjskRblLkaWHAx7yUxNX2UOdUO/BrbnwFj+/s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HwdqsCJtn7+bYADrzrl2bLZc1LtklqkmdHvYODNlEtCybsolrHYgxTPqLhPzrHYo2isyTdC/PT/WDUCtTX5EZBtpZ8z4cYlyzBq5Yvz7ZYb1Ya5pK7OCylK/gIyUico1yJCOO2vTaNa2LTQW7fv0/H5cvvSWDkEn2Q9y+TYtxA8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=OgI6OA5u; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="OgI6OA5u" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-42f6bec84b5so47756635e9.1 for ; Mon, 07 Oct 2024 08:45:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728315945; x=1728920745; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=MmGBhvpiUt0ysoyCWioVypN2QdKwvc+Q4vGDC3NYxco=; b=OgI6OA5uk4JacegvrhmegUeRw/5nhINtZmRSE3QjWA5KaduJKtwAs/dLKLex0R7oOp qldDI6K5E9N/BQm52AHLRsY6L7IP33L+f4Wjbjl33U/BwbOCFT69iXoTx7nAZplS1/Om 5vb5V/VC64lvifE15oP2KwP5uzp48k5HRme/qwFVBRIsW08pCd9/kr7BL38yxCEN+r1S zCmyIfEtlIEqUENdxpFbDDhYIqSPV5bjzJb8cAgp/cf8yK2ZyiWV5lJDVtK6uf1UI5FI hn4msotgr0y4PYCEklDLYPkCUzZQe52YwjX+bRYX4U2MwadfB8gQxxEPOTIDMk94gJVJ hjpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728315945; x=1728920745; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MmGBhvpiUt0ysoyCWioVypN2QdKwvc+Q4vGDC3NYxco=; b=eG/XTvrGqT1xmg6lxVJ9vFkoXJeMznWpCQF7ahwVw04M+T3hLv7Um7rsO2H57/DFU+ G4THRuw3daiT5l8ckMBXI7NCCBOKmGi+D4fIwd4953VZ94illDtM1CvzbQsM1N8blrcs DDpQlrGP8dcdu5fAnxFmqQ72GN3fh75V+xJxf07k+1Wm/IMccJW6EIRkxLljtDkZgpri SiaajTQjU6oxlConU1zSlA6kQGtTDF/SEBWoL823bdwTp/ke11V8aTUFdwJscsgdlokK EMVOl0UJH/2yZnb0sJCR7s+cd4T74Q68+4q946gTsG3CX9d+90/QFerLrACvQBkblmyY b8dg== X-Forwarded-Encrypted: i=1; AJvYcCVFoshNjN716EDFeznxf95A4gqLOAEecsbNU686DgIFNJohYxyMsaPhHz48eRqjTPpWCZLjZrkj68md0j4=@vger.kernel.org X-Gm-Message-State: AOJu0Yzp5zb6q9RqgwVFa3G9Y5VvBy9kk+9vUWGPhapjz6l+78i31lmg Tz8I3n7qFXK90BimCkM9bM55yX+FUFmtrlUN0shzcmAmjfZl+4tzOS/0qeEukJY= X-Google-Smtp-Source: AGHT+IEpbrR/lL3jrtHbnvPjM/a+YxVcE22pFcjH4V0hGT0JBxqNv/8vtmxPzywnVZWvQ1VZDd5VLA== X-Received: by 2002:a05:600c:4f02:b0:42c:ba1f:5482 with SMTP id 5b1f17b1804b1-42f85aef888mr75203235e9.35.1728315945049; Mon, 07 Oct 2024 08:45:45 -0700 (PDT) Received: from [192.168.1.64] (2a02-842a-d52e-6101-6fd0-06c4-5d68-f0a5.rev.sfr.net. [2a02:842a:d52e:6101:6fd0:6c4:5d68:f0a5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f9384f648sm17645555e9.20.2024.10.07.08.45.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 08:45:44 -0700 (PDT) From: Julien Stephan Date: Mon, 07 Oct 2024 17:45:44 +0200 Subject: [PATCH 1/6] dt-bindings: iio: adc: ad7380: remove voltage reference for supplies Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241007-ad7380-fix-supplies-v1-1-badcf813c9b9@baylibre.com> References: <20241007-ad7380-fix-supplies-v1-0-badcf813c9b9@baylibre.com> In-Reply-To: <20241007-ad7380-fix-supplies-v1-0-badcf813c9b9@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , David Lechner , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Jonathan Corbet Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Conor Dooley , Jonathan Cameron , linux-doc@vger.kernel.org, Julien Stephan X-Mailer: b4 0.14.1 Voltages may not bo valid for future compatible parts, so remove them and remove useless description Signed-off-by: Julien Stephan --- Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml | 14 +++--------= --- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Do= cumentation/devicetree/bindings/iio/adc/adi,ad7380.yaml index bd19abb867d9..72c51b3de97b 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml @@ -55,17 +55,9 @@ properties: spi-cpol: true spi-cpha: true =20 - vcc-supply: - description: A 3V to 3.6V supply that powers the chip. - - vlogic-supply: - description: - A 1.65V to 3.6V supply for the logic pins. - - refio-supply: - description: - A 2.5V to 3.3V supply for the external reference voltage. When omitt= ed, - the internal 2.5V reference is used. + vcc-supply: true + vlogic-supply: true + refio-supply: true =20 aina-supply: description: --=20 2.46.0 From nobody Wed Nov 27 21:25:34 2024 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A2651D9678 for ; Mon, 7 Oct 2024 15:45:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315949; cv=none; b=tRWTi+WWqafFrBt6nZL6S2uSuFVQpunOr7GQwm+IcLn82r2yVOeURPvy3yg04Fg/PufPqK1KeDtyo89wRmltbPjrGRb59eQISdawMmiH/k4O54jLthty5Nvh2h0Z9Igt5O+m9pBaqLMrekrlqL1FC9Ok7YFlnUAoXUT+SZSIJtA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315949; c=relaxed/simple; bh=+4xKkJnQqVu7uiiyn2Kxt0tvZkLS+cNdyJZUR5y0ym0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ckOKrmfeO3/IR4QdCBoqHCMWgusflIn5FTuef079KNzHx4zw6sAO0EDLihHq8tOLZMI5EW+LxLGXdn0/Hp7onEzQJvWVNx4iGd+J5NRbVIH5t1raqRX5J5MPp9JeqhiJlK/TjAdzBNMlIZW9jeYVp+GBNbabzRJBYWmrs9d2mkg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=KDOt4GXg; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="KDOt4GXg" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-42cde6b5094so46548675e9.3 for ; Mon, 07 Oct 2024 08:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728315946; x=1728920746; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2N3r/AZHZIBAky01wN9j8Ij5Fk065LyhFYbUy+uaF2c=; b=KDOt4GXgmNLILzBh1cFROmBEVG9oAAMjjZK+f0JDkzsPDoBJDzRNvg40zhWtYQsIzP 5+WFjMb/Wy5h5+hid0D1saH0bmtub0PJtYBwTQtCS1ND+dYfvRwftff0kds/cKnsaYiQ xBlPPv2y46M213YLK9fKLlljUCEdzG9t2DGg+ftWxBqiyjdn7DOTicV7lird1mNBYrhR 3wIYX8bi19QcqZi2mDSI1onnZ/pTdxSGY8FUuCscse6GMkuLvpyfDPLF4Iu2trbzDAsf +/FzKRq0SWd4PQtWdxc3bnF/QR7UvgW5zUGWRHyOAU8yAimxVhZRCcsR0Ol7iCRiwakN c6Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728315946; x=1728920746; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2N3r/AZHZIBAky01wN9j8Ij5Fk065LyhFYbUy+uaF2c=; b=RsrBDEQIUhkw+qJMqOzwjelRYyLbqlQ/7lrjQsHQZM7sf/VedrP887aOb9tBLtY/Xf jVpO9n6ncfYYAb6vHNXX5AgEHGaTJ3CcSWqg0AcdedbeLL8szmUoddht/v3RBAieYCWX 0gVTfa0MtZg6C1X47h6lxGPQgwBUckVlJbYh+gDMjcWy/k6X64lk5ECk9WRqJ4I82xB7 5C1Y9FssdY3Z8e4FE0SjT05yXQQG9PoFQI4GuWwHRAkLrPUDZ9c9FSz9b4PhKp0TEwVo yq+LqDA0kfRiBLidA23NEzfs7kdhzsUE1Eo7A11q3vHluNmWx71kUs3cvdccwbZ9N3QL w8rQ== X-Forwarded-Encrypted: i=1; AJvYcCUZuHQEMQjaW6DJscJb/yVmzglnUQ/fEJiw/muOBHiDUVMnbL6a/4MxmWK6LK5oGVvdjhVRJurwJFJKAl0=@vger.kernel.org X-Gm-Message-State: AOJu0YzC1sdnJw+7tyXobVxsRPr8ubfXGI7WYgxCGTOU0rH5tVocwwzW //V8fZrFr6ELHT5Mpqvh6j4msMEaYFJAV/XTi7vUV9YEIOOm+0F521qu3xOOXDs= X-Google-Smtp-Source: AGHT+IEDWpQdUChMZda2za516f28LSsRDgkuitm2dp+DyXfGHYdrbMiUC8uCMuYFEG24q7l2cl7vCQ== X-Received: by 2002:a05:600c:468f:b0:42c:af06:718 with SMTP id 5b1f17b1804b1-42f85aea086mr90117135e9.28.1728315945926; Mon, 07 Oct 2024 08:45:45 -0700 (PDT) Received: from [192.168.1.64] (2a02-842a-d52e-6101-6fd0-06c4-5d68-f0a5.rev.sfr.net. [2a02:842a:d52e:6101:6fd0:6c4:5d68:f0a5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f9384f648sm17645555e9.20.2024.10.07.08.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 08:45:45 -0700 (PDT) From: Julien Stephan Date: Mon, 07 Oct 2024 17:45:45 +0200 Subject: [PATCH 2/6] dt-bindings: iio: adc: ad7380: fix ad7380-4 reference supply Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241007-ad7380-fix-supplies-v1-2-badcf813c9b9@baylibre.com> References: <20241007-ad7380-fix-supplies-v1-0-badcf813c9b9@baylibre.com> In-Reply-To: <20241007-ad7380-fix-supplies-v1-0-badcf813c9b9@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , David Lechner , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Jonathan Corbet Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Conor Dooley , Jonathan Cameron , linux-doc@vger.kernel.org, Julien Stephan X-Mailer: b4 0.14.1 ad7380-4 is the only device from ad738x family that doesn't have an internal reference. Moreover its external reference is called REFIN in the datasheet while all other use REFIO as an optional external reference. If refio-supply is omitted the internal reference is used. Fix the binding by adding refin-supply and makes it required for ad7380-4 only. Fixes: 1a291cc8ee17 ("dt-bindings: iio: adc: ad7380: add support for ad738x= -4 4 channels variants") Signed-off-by: Julien Stephan --- .../devicetree/bindings/iio/adc/adi,ad7380.yaml | 18 ++++++++++++++= ++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Do= cumentation/devicetree/bindings/iio/adc/adi,ad7380.yaml index 72c51b3de97b..74d82721637c 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml @@ -58,6 +58,7 @@ properties: vcc-supply: true vlogic-supply: true refio-supply: true + refin-supply: true =20 aina-supply: description: @@ -127,6 +128,23 @@ allOf: ainc-supply: false aind-supply: false =20 + # ad7380-4 uses refin-supply as external reference. + # All other chips from ad738x family use refio as optional external refe= rence. + # When refio-supply is omitted, internal reference is used. + - if: + properties: + compatible: + enum: + - adi,ad7380-4 + then: + properties: + refio-supply: false + required: + - refin-supply + else: + properties: + refin-supply: false + examples: - | #include --=20 2.46.0 From nobody Wed Nov 27 21:25:34 2024 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 164171D9A41 for ; Mon, 7 Oct 2024 15:45:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315951; cv=none; b=r5UP7LX0X4PH34KWsEtZ4nJoBn9DDh9tdzkMyKdWTlias01Fte6Co7FX1mwZIdOiZ8hcUVnfMG5uh4mmAe82dvlMkHHsFCJgvN3qQRv1uDNZbzW6Se3FZcaLZWSIyp1sQCcFGMQMTHuJGkIGfheBLrzr0NfeFzutx8JGtI/cuvY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315951; c=relaxed/simple; bh=/xxwZo5C8/nVz11iyUg86EeL3sGiVKVX2JIuqDL31Jw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f/7NgC+3kf40bptRYGGy1d+CwJKQ4e59I8fECQF60/zwarspyfTZmxnA64v7GN6CnbgGNgS72cr/IvQwoy02yXYQwZT1GMIvqfnfHRahLHXL8VSJa+JtxOzE6kdFBnuUOLs8QDz9AQbszlikJGoxbr5S3UcOhNfneZjYvt+BmF0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=SA5fZRQ2; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="SA5fZRQ2" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-37cdbdbbb1cso2204764f8f.3 for ; Mon, 07 Oct 2024 08:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728315947; x=1728920747; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+J8/8VA7c7eBg0Ye/jffG94ic0MjnIN71uk3VMwhqv4=; b=SA5fZRQ2KX4s+RiSL5+PVxI9XNuxug3mvplaQtp1i/07JCRBxIusq/itLorJ+rrmm8 Jcj3sSuClBo62+pJMwJ1I5JWnl30k8iH88eV1jdyfCRMedBeag4UooUNfufJtC5UGJjY PVh14lwrkE7rdIMXtxNyikOv/9bEX46H+sSW9joH5dOPGayXHeokuO2uaeQr6r6eLs9l Mx7v9FZT0orZVKhUI/VB+ySO3wMvU4sdmzMF9P3ONW8SyRVBr51LDz/eR2bpBvGoD54X t4j+kP97TlaX65977XNEzrso8vIIqfNO5gpR0Xqz9/BVRQM15Kb3zSXr9UasEg3y1IZs zXaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728315947; x=1728920747; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+J8/8VA7c7eBg0Ye/jffG94ic0MjnIN71uk3VMwhqv4=; b=Eb3RNtGiWKZ8OmCVa8GY5zhcOTfm9v0Ae48R3zZi/YbjdgUxG73YjITDWMLjJ/iLWI LILJPBXBaEPJKSUpIL8xf5v7/Q0Xe1WjrqVXWYqXsEjraKjWyANNqRbESeUP13JKvGtc K+46D9uZxN90X4+9pnlFrOTzG5q+dh2s3UJ60+MiTxRj6LXThm4D42itOBmprIaw1eYh ekZbI+onkt9yZG0/TTe4fbzgLAXTuGMpsSLgB0ERECr+ZWfUwbBixlABowPytMBDOSuz 6DyfotnTC8fy84bA5bSXpzNyME0sNpRjD4YjB6J8sf/0b0FvxH6KVuBG0doCtKOt2hi8 qBig== X-Forwarded-Encrypted: i=1; AJvYcCVCB3ILDjrT317RWpDcqOTa45BVSwuRMvMzGbXbeJFH13KvgSxOTD+q+W8Jn0ETjcA+K5Fk9el/cqh8crI=@vger.kernel.org X-Gm-Message-State: AOJu0YzykTzcMZKryRQVHo4k5QkByL/GY1Ew5rSG9lXlKFDAgTdam8/O 9k5dHiQ7SOcvs+0wU1atdvpO+yZcqms6qUmfcEVbEL26Sb79jYTuJo9B9GvxxR0= X-Google-Smtp-Source: AGHT+IHcMijELPdRgJ4lenJP6V++xHnlGtHjjqK7+ZVhhmdKm/XvBxcuF4H9F3gGxbl2pQan2F6DJA== X-Received: by 2002:a5d:6e53:0:b0:37c:cd59:5a6b with SMTP id ffacd0b85a97d-37d0e73670bmr6997259f8f.27.1728315946749; Mon, 07 Oct 2024 08:45:46 -0700 (PDT) Received: from [192.168.1.64] (2a02-842a-d52e-6101-6fd0-06c4-5d68-f0a5.rev.sfr.net. [2a02:842a:d52e:6101:6fd0:6c4:5d68:f0a5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f9384f648sm17645555e9.20.2024.10.07.08.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 08:45:46 -0700 (PDT) From: Julien Stephan Date: Mon, 07 Oct 2024 17:45:46 +0200 Subject: [PATCH 3/6] iio: adc: ad7380: use devm_regulator_get_enable_read_voltage() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241007-ad7380-fix-supplies-v1-3-badcf813c9b9@baylibre.com> References: <20241007-ad7380-fix-supplies-v1-0-badcf813c9b9@baylibre.com> In-Reply-To: <20241007-ad7380-fix-supplies-v1-0-badcf813c9b9@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , David Lechner , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Jonathan Corbet Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Conor Dooley , Jonathan Cameron , linux-doc@vger.kernel.org, Julien Stephan X-Mailer: b4 0.14.1 Use devm_regulator_get_enable_read_voltage() to simplify the code. Signed-off-by: Julien Stephan --- drivers/iio/adc/ad7380.c | 81 +++++++++++++-------------------------------= ---- 1 file changed, 21 insertions(+), 60 deletions(-) diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c index e8bddfb0d07d..e033c7341911 100644 --- a/drivers/iio/adc/ad7380.c +++ b/drivers/iio/adc/ad7380.c @@ -956,7 +956,7 @@ static const struct iio_info ad7380_info =3D { .debugfs_reg_access =3D &ad7380_debugfs_reg_access, }; =20 -static int ad7380_init(struct ad7380_state *st, struct regulator *vref) +static int ad7380_init(struct ad7380_state *st, bool external_ref_en) { int ret; =20 @@ -968,13 +968,13 @@ static int ad7380_init(struct ad7380_state *st, struc= t regulator *vref) if (ret < 0) return ret; =20 - /* select internal or external reference voltage */ - ret =3D regmap_update_bits(st->regmap, AD7380_REG_ADDR_CONFIG1, - AD7380_CONFIG1_REFSEL, - FIELD_PREP(AD7380_CONFIG1_REFSEL, - vref ? 1 : 0)); - if (ret < 0) - return ret; + if (external_ref_en) { + /* select external reference voltage */ + ret =3D regmap_set_bits(st->regmap, AD7380_REG_ADDR_CONFIG1, + AD7380_CONFIG1_REFSEL); + if (ret < 0) + return ret; + } =20 /* This is the default value after reset. */ st->oversampling_ratio =3D 1; @@ -987,16 +987,11 @@ static int ad7380_init(struct ad7380_state *st, struc= t regulator *vref) FIELD_PREP(AD7380_CONFIG2_SDO, 1)); } =20 -static void ad7380_regulator_disable(void *p) -{ - regulator_disable(p); -} - static int ad7380_probe(struct spi_device *spi) { struct iio_dev *indio_dev; struct ad7380_state *st; - struct regulator *vref; + bool external_ref_en; int ret, i; =20 indio_dev =3D devm_iio_device_alloc(&spi->dev, sizeof(*st)); @@ -1009,37 +1004,17 @@ static int ad7380_probe(struct spi_device *spi) if (!st->chip_info) return dev_err_probe(&spi->dev, -EINVAL, "missing match data\n"); =20 - vref =3D devm_regulator_get_optional(&spi->dev, "refio"); - if (IS_ERR(vref)) { - if (PTR_ERR(vref) !=3D -ENODEV) - return dev_err_probe(&spi->dev, PTR_ERR(vref), - "Failed to get refio regulator\n"); - - vref =3D NULL; - } - /* * If there is no REFIO supply, then it means that we are using * the internal 2.5V reference, otherwise REFIO is reference voltage. */ - if (vref) { - ret =3D regulator_enable(vref); - if (ret) - return ret; + ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "refio"); + if (ret < 0 && ret !=3D -ENODEV) + return dev_err_probe(&spi->dev, ret, + "Failed to get refio regulator\n"); =20 - ret =3D devm_add_action_or_reset(&spi->dev, - ad7380_regulator_disable, vref); - if (ret) - return ret; - - ret =3D regulator_get_voltage(vref); - if (ret < 0) - return ret; - - st->vref_mv =3D ret / 1000; - } else { - st->vref_mv =3D AD7380_INTERNAL_REF_MV; - } + external_ref_en =3D ret !=3D -ENODEV; + st->vref_mv =3D external_ref_en ? ret / 1000 : AD7380_INTERNAL_REF_MV; =20 if (st->chip_info->num_vcm_supplies > ARRAY_SIZE(st->vcm_mv)) return dev_err_probe(&spi->dev, -EINVAL, @@ -1050,27 +1025,13 @@ static int ad7380_probe(struct spi_device *spi) * input pin. */ for (i =3D 0; i < st->chip_info->num_vcm_supplies; i++) { - struct regulator *vcm; - - vcm =3D devm_regulator_get(&spi->dev, - st->chip_info->vcm_supplies[i]); - if (IS_ERR(vcm)) - return dev_err_probe(&spi->dev, PTR_ERR(vcm), - "Failed to get %s regulator\n", - st->chip_info->vcm_supplies[i]); + const char *vcm =3D st->chip_info->vcm_supplies[i]; =20 - ret =3D regulator_enable(vcm); - if (ret) - return ret; - - ret =3D devm_add_action_or_reset(&spi->dev, - ad7380_regulator_disable, vcm); - if (ret) - return ret; - - ret =3D regulator_get_voltage(vcm); + ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, vcm); if (ret < 0) - return ret; + return dev_err_probe(&spi->dev, ret, + "Failed to get %s regulator\n", + vcm); =20 st->vcm_mv[i] =3D ret / 1000; } @@ -1135,7 +1096,7 @@ static int ad7380_probe(struct spi_device *spi) if (ret) return ret; =20 - ret =3D ad7380_init(st, vref); + ret =3D ad7380_init(st, external_ref_en); if (ret) return ret; =20 --=20 2.46.0 From nobody Wed Nov 27 21:25:34 2024 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7081A1DA0EF for ; Mon, 7 Oct 2024 15:45:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315952; cv=none; b=rUkatU3W1g/qGtqzTYi8VzpWSG/MF3OUHw7KWII/X/0q8IDWHssugWJ6sdJJSkRpCZzXs/zyytEl5NX1tx3FRq0QKm/qZTxebvD2MglhSd2n0kfuld8YHfvVmU1vH69/2nQQIYPZG24nFPj+l6rA7zVYvgkS0EmJEnxk7XVJFmQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315952; c=relaxed/simple; bh=2IxdougJyqNRz74S7DpsCNl1pnl2tsBFx1nzEHz/Xiw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M9Z4oq0jAMHhJHyz/9lujdtJpKLW7XJpCmyBw2MgTqN6OWe07a4OEyUlO3OE2LRYw8+DRXG9FKhTNKrcv1pGAGHHuvQkyx+mk/PIXTI1LiiIPzBtKjJRGmjoGJ2puskqJmbZFcbA8e+EEhQsr+4lXCPIBpowplma4rq4VowcZQY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=Afbj57m8; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="Afbj57m8" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-42cb1e623d1so47372915e9.0 for ; Mon, 07 Oct 2024 08:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728315947; x=1728920747; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3xerIRuBcdPIcjxkDvRuqy8DYlqfSAe4ihD2g3Fjids=; b=Afbj57m8kXm9AeRZPN7jeVUnETkA8Ur1vBOdgdqKTuuHgI2XOBCFdDMORHmw1SwMo9 c4XlC/MtNZp3EsTMKB7xOiwe9UZeVvaN14OMlkzcT++VcbP3tJiQHRmphgJhiHH0FT2r lM2mgNUmLb2I8x3HKJaOjbOSpKpXpAfGeXYHJb2aChWofZtGwSaQJV7nFT9uXW8hDZAF gECUyV+4Zs2pXv1fI2ywSFZBbfcEY99S8O/YZ1wbCo1CIyGEX5DzN/25fDH0y9ihXrtS Y/2bhBhpL61MvHVIz+TdlzWt+VtdVXNnGKQRDwRljIYmLK0ZjkL9zR/HsZJ+gp4F3ibl 7NqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728315947; x=1728920747; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3xerIRuBcdPIcjxkDvRuqy8DYlqfSAe4ihD2g3Fjids=; b=v/hDRhQom5f7r8SMYjrMxj0noFKJUgkJwjSOgGNiLyDJJGL+3wpz5cYFrRlzHtbP0D Y0HT/qMT0peI7ZkgT/VZp2QVobLaYT0crbxsRiLNPklB/FtLJohBwUkc/T3EIXb3TGr4 Y2dqqWtoZK0MNR5RpFcm49MOK3ZCXnBBde8gHc8/39Gw0LxvXqHnp/Evq+zY/bGh0VUS 5DnO1BbeuK9C4RihkeGxWzBZB6TE9NS4x57niNLBv/q/jU/BYz6aoGxZFMc+l+VeUdA/ jBiLTRDbSoP6YxSCAp7KwodJytfAKBY3XgBW4KfBJnimUSA6ve9QtC3WQhk6UCSAMBln KyBQ== X-Forwarded-Encrypted: i=1; AJvYcCU0jpuMPumI61CnrkdhaVjeuobmuVdcJLauNc9O+iCHfJhLHfpzZobHfMvNeixoEP+nmhPy0ZYCLtJ4IPY=@vger.kernel.org X-Gm-Message-State: AOJu0YxT+Sy9aOHjxyhh6eJFP9DCpB9punh1mf9Y33q9EBeIyRLK1VuT VPNE+lhUBFTqycVI/h6qEfVgJBZIvQYykiXDO3kgTZ9ILowpmUD9zxK4d6eFYag= X-Google-Smtp-Source: AGHT+IFmckd0DUvY5nrWyEn/6hzLuORieedAjB/Bvo2/O+xUmyY96AmtbwXlCI6qQBy/zXyXN9lM/Q== X-Received: by 2002:a05:600c:1ca5:b0:42c:b3e5:f688 with SMTP id 5b1f17b1804b1-42f85a6c5bfmr85650685e9.4.1728315947438; Mon, 07 Oct 2024 08:45:47 -0700 (PDT) Received: from [192.168.1.64] (2a02-842a-d52e-6101-6fd0-06c4-5d68-f0a5.rev.sfr.net. [2a02:842a:d52e:6101:6fd0:6c4:5d68:f0a5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f9384f648sm17645555e9.20.2024.10.07.08.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 08:45:47 -0700 (PDT) From: Julien Stephan Date: Mon, 07 Oct 2024 17:45:47 +0200 Subject: [PATCH 4/6] iio: adc: ad7380: add missing supplies Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241007-ad7380-fix-supplies-v1-4-badcf813c9b9@baylibre.com> References: <20241007-ad7380-fix-supplies-v1-0-badcf813c9b9@baylibre.com> In-Reply-To: <20241007-ad7380-fix-supplies-v1-0-badcf813c9b9@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , David Lechner , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Jonathan Corbet Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Conor Dooley , Jonathan Cameron , linux-doc@vger.kernel.org, Julien Stephan X-Mailer: b4 0.14.1 vcc and vlogic are required but are not retrieved and enabled in the probe. Add them. In order to prepare support for additional parts requiring different supplies, add vcc and vlogic to the platform specific structures Signed-off-by: Julien Stephan --- drivers/iio/adc/ad7380.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c index e033c7341911..9ef44b605144 100644 --- a/drivers/iio/adc/ad7380.c +++ b/drivers/iio/adc/ad7380.c @@ -75,6 +75,7 @@ #define T_CONVERT_NS 190 /* conversion time */ #define T_CONVERT_0_NS 10 /* 1st conversion start time (oversampling) */ #define T_CONVERT_X_NS 500 /* xth conversion start time (oversampling) */ +#define T_POWERUP_MS 5 /* Power up */ =20 struct ad7380_timing_specs { const unsigned int t_csh_ns; /* CS minimum high time */ @@ -86,6 +87,8 @@ struct ad7380_chip_info { unsigned int num_channels; unsigned int num_simult_channels; bool has_mux; + const char * const *supplies; + unsigned int num_supplies; const char * const *vcm_supplies; unsigned int num_vcm_supplies; const unsigned long *available_scan_masks; @@ -243,6 +246,10 @@ DEFINE_AD7380_8_CHANNEL(ad7386_4_channels, 16, 0, u); DEFINE_AD7380_8_CHANNEL(ad7387_4_channels, 14, 0, u); DEFINE_AD7380_8_CHANNEL(ad7388_4_channels, 12, 0, u); =20 +static const char * const ad7380_supplies[] =3D { + "vcc", "vlogic", +}; + static const char * const ad7380_2_channel_vcm_supplies[] =3D { "aina", "ainb", }; @@ -338,6 +345,8 @@ static const struct ad7380_chip_info ad7380_chip_info = =3D { .channels =3D ad7380_channels, .num_channels =3D ARRAY_SIZE(ad7380_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .available_scan_masks =3D ad7380_2_channel_scan_masks, .timing_specs =3D &ad7380_timing, }; @@ -347,6 +356,8 @@ static const struct ad7380_chip_info ad7381_chip_info = =3D { .channels =3D ad7381_channels, .num_channels =3D ARRAY_SIZE(ad7381_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .available_scan_masks =3D ad7380_2_channel_scan_masks, .timing_specs =3D &ad7380_timing, }; @@ -356,6 +367,8 @@ static const struct ad7380_chip_info ad7383_chip_info = =3D { .channels =3D ad7383_channels, .num_channels =3D ARRAY_SIZE(ad7383_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .vcm_supplies =3D ad7380_2_channel_vcm_supplies, .num_vcm_supplies =3D ARRAY_SIZE(ad7380_2_channel_vcm_supplies), .available_scan_masks =3D ad7380_2_channel_scan_masks, @@ -367,6 +380,8 @@ static const struct ad7380_chip_info ad7384_chip_info = =3D { .channels =3D ad7384_channels, .num_channels =3D ARRAY_SIZE(ad7384_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .vcm_supplies =3D ad7380_2_channel_vcm_supplies, .num_vcm_supplies =3D ARRAY_SIZE(ad7380_2_channel_vcm_supplies), .available_scan_masks =3D ad7380_2_channel_scan_masks, @@ -378,6 +393,8 @@ static const struct ad7380_chip_info ad7386_chip_info = =3D { .channels =3D ad7386_channels, .num_channels =3D ARRAY_SIZE(ad7386_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .has_mux =3D true, .available_scan_masks =3D ad7380_2x2_channel_scan_masks, .timing_specs =3D &ad7380_timing, @@ -388,6 +405,8 @@ static const struct ad7380_chip_info ad7387_chip_info = =3D { .channels =3D ad7387_channels, .num_channels =3D ARRAY_SIZE(ad7387_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .has_mux =3D true, .available_scan_masks =3D ad7380_2x2_channel_scan_masks, .timing_specs =3D &ad7380_timing, @@ -398,6 +417,8 @@ static const struct ad7380_chip_info ad7388_chip_info = =3D { .channels =3D ad7388_channels, .num_channels =3D ARRAY_SIZE(ad7388_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .has_mux =3D true, .available_scan_masks =3D ad7380_2x2_channel_scan_masks, .timing_specs =3D &ad7380_timing, @@ -408,6 +429,8 @@ static const struct ad7380_chip_info ad7380_4_chip_info= =3D { .channels =3D ad7380_4_channels, .num_channels =3D ARRAY_SIZE(ad7380_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .available_scan_masks =3D ad7380_4_channel_scan_masks, .timing_specs =3D &ad7380_4_timing, }; @@ -417,6 +440,8 @@ static const struct ad7380_chip_info ad7381_4_chip_info= =3D { .channels =3D ad7381_4_channels, .num_channels =3D ARRAY_SIZE(ad7381_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .available_scan_masks =3D ad7380_4_channel_scan_masks, .timing_specs =3D &ad7380_4_timing, }; @@ -426,6 +451,8 @@ static const struct ad7380_chip_info ad7383_4_chip_info= =3D { .channels =3D ad7383_4_channels, .num_channels =3D ARRAY_SIZE(ad7383_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .vcm_supplies =3D ad7380_4_channel_vcm_supplies, .num_vcm_supplies =3D ARRAY_SIZE(ad7380_4_channel_vcm_supplies), .available_scan_masks =3D ad7380_4_channel_scan_masks, @@ -437,6 +464,8 @@ static const struct ad7380_chip_info ad7384_4_chip_info= =3D { .channels =3D ad7384_4_channels, .num_channels =3D ARRAY_SIZE(ad7384_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .vcm_supplies =3D ad7380_4_channel_vcm_supplies, .num_vcm_supplies =3D ARRAY_SIZE(ad7380_4_channel_vcm_supplies), .available_scan_masks =3D ad7380_4_channel_scan_masks, @@ -448,6 +477,8 @@ static const struct ad7380_chip_info ad7386_4_chip_info= =3D { .channels =3D ad7386_4_channels, .num_channels =3D ARRAY_SIZE(ad7386_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .has_mux =3D true, .available_scan_masks =3D ad7380_2x4_channel_scan_masks, .timing_specs =3D &ad7380_4_timing, @@ -458,6 +489,8 @@ static const struct ad7380_chip_info ad7387_4_chip_info= =3D { .channels =3D ad7387_4_channels, .num_channels =3D ARRAY_SIZE(ad7387_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .has_mux =3D true, .available_scan_masks =3D ad7380_2x4_channel_scan_masks, .timing_specs =3D &ad7380_4_timing, @@ -468,6 +501,8 @@ static const struct ad7380_chip_info ad7388_4_chip_info= =3D { .channels =3D ad7388_4_channels, .num_channels =3D ARRAY_SIZE(ad7388_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .has_mux =3D true, .available_scan_masks =3D ad7380_2x4_channel_scan_masks, .timing_specs =3D &ad7380_4_timing, @@ -1004,6 +1039,14 @@ static int ad7380_probe(struct spi_device *spi) if (!st->chip_info) return dev_err_probe(&spi->dev, -EINVAL, "missing match data\n"); =20 + devm_regulator_bulk_get_enable(&spi->dev, st->chip_info->num_supplies, + st->chip_info->supplies); + + if (ret) + return dev_err_probe(&spi->dev, ret, + "Failed to enable power supplies\n"); + msleep(T_POWERUP_MS); + /* * If there is no REFIO supply, then it means that we are using * the internal 2.5V reference, otherwise REFIO is reference voltage. --=20 2.46.0 From nobody Wed Nov 27 21:25:34 2024 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25BF71DA2EC for ; Mon, 7 Oct 2024 15:45:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315952; cv=none; b=BsHGZYPyEE055YA1iGv0MiOy1FHR7j2T1XidAJjHwHp8Oyj2PmyoqpxNNPlmCBJeE3N5E6F8yD4GYLiLn1bLt4TVMJqTffXsxGb3IpKyZC8pnSk37B7e4hTbcVLKjY4b2ehk3P3/4Rsj4kG6ORXUKSuqWkTXBWFYDez6tdn1ISM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315952; c=relaxed/simple; bh=q8KqD3xvy2JB31/JkGiCsf/G4hyDPCkvTc5DXzMR1io=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kv7DKQE7bCPa97i4MKIfQwQ5aP++CpowJsJ6RnZcghLmG1Rsej/JoZ9fXII4+acJW/ZuRd+Gy3dRAErxJ5s0XfE1hGeLakZhUmwosEdRuhg/jwRMACS/GMVdw4liW0Z65bldleuSvzz8f9vcQJZZN0+WuGUoM3ae/AvSDYwxhjk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=eJaEAqQx; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="eJaEAqQx" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-42cc8782869so47206575e9.2 for ; Mon, 07 Oct 2024 08:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728315948; x=1728920748; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=oBooASvX/VhONc8SVPbZTST7U3LP08CxQ9THiZxZyXI=; b=eJaEAqQx9B+3wkIQFSHkrviad+CedfXa5/DdpivmhV29roXUa+8iBGef4HGIVWj1QN ZW3GGN/xR3Q27/97+UW8sxJVag1AZfLy0iC/0/P72qIJxLKNqhrBVEGvuUaVgIHGNyyU wwThv2F9oKGcwYCfMmVbV10FyjwssdEyLnXhprjvkX3dstgd2E9ZiUlfKQuyjRwcsG3V q0+nyJ+mF9G1DdwBlULkhnrbpV4bCJYxGK70I+b9pA1prH9Z+G6OFMbmfWbdDLsuxaWV 7/cIMdnDi34Xug2dY9V0WQvW61z8apqy20vrfXkyBhw4bZPtJMvheHE/XaaWEU/QrJkV syLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728315948; x=1728920748; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oBooASvX/VhONc8SVPbZTST7U3LP08CxQ9THiZxZyXI=; b=dr3lt38CAJQjLq4eS04gfduGvFA7Jx4auFx1HJUJCqqmSkATFvYUPEVbqHTa71z3y7 Plry29ndNVO8p//gje2Zfq3KW7KFPf4SzNMp2mVNQfQS++LX66XVhMCnhgULj+rsf01e pKEm7EGPNS7RE5ytYzTn+MWoaZ+y3mIsc0C4BXtZGrMTXRsdFgOEFPBn/dlcYrxbGkWV /CE54oW1kGeoZn2Rmgll3n7uLbHgYX1ig/E6rRgrv0MVaxyPSGU6MBs42gzLGeESWlh9 EtP76gvDHowQXSwglF8maLXp+lMZHhquM8zQXrU8NRdtF4C6itrpSp8nj6dnM9gPy/ML gwuQ== X-Forwarded-Encrypted: i=1; AJvYcCXH7yBxmCUa1F1Vp8qTm68NmClix3zjarcaTJg4IFHFRqhugsFgIJlFBmLXym9RXA+wrThH0WDABGhlju0=@vger.kernel.org X-Gm-Message-State: AOJu0YxmLSLd2oD7qiQhL/2iXBlAk/ucR+YjqcwlWiLz5JHwoy4IjBSC Mv3jI2gVmKdlQXH7oE6+ffNbVqxfd5VAU9glzdCu1Fu87mrYgg7IOyUiF0r6/Fc= X-Google-Smtp-Source: AGHT+IGzR/XAzO+8nh4PcjEIF8gxwoLfd/vK0h/EkHNVg0wwMym23yIX71BMk+Xqn5FNmz5gdvvAXg== X-Received: by 2002:a05:600c:19d2:b0:42c:bae0:f066 with SMTP id 5b1f17b1804b1-42f85aa72f6mr91413065e9.13.1728315948108; Mon, 07 Oct 2024 08:45:48 -0700 (PDT) Received: from [192.168.1.64] (2a02-842a-d52e-6101-6fd0-06c4-5d68-f0a5.rev.sfr.net. [2a02:842a:d52e:6101:6fd0:6c4:5d68:f0a5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f9384f648sm17645555e9.20.2024.10.07.08.45.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 08:45:47 -0700 (PDT) From: Julien Stephan Date: Mon, 07 Oct 2024 17:45:48 +0200 Subject: [PATCH 5/6] iio: adc: ad7380: fix supplies for ad7380-4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241007-ad7380-fix-supplies-v1-5-badcf813c9b9@baylibre.com> References: <20241007-ad7380-fix-supplies-v1-0-badcf813c9b9@baylibre.com> In-Reply-To: <20241007-ad7380-fix-supplies-v1-0-badcf813c9b9@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , David Lechner , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Jonathan Corbet Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Conor Dooley , Jonathan Cameron , linux-doc@vger.kernel.org, Julien Stephan X-Mailer: b4 0.14.1 ad7380-4 is the only device in the family that does not have an internal reference. It uses "refin" as a required external reference. All other devices in the family use "refio"" as an optional external reference. Fixes: 737413da8704 ("iio: adc: ad7380: add support for ad738x-4 4 channels= variants") Signed-off-by: Julien Stephan --- drivers/iio/adc/ad7380.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c index 9ef44b605144..e9784769baa9 100644 --- a/drivers/iio/adc/ad7380.c +++ b/drivers/iio/adc/ad7380.c @@ -89,6 +89,7 @@ struct ad7380_chip_info { bool has_mux; const char * const *supplies; unsigned int num_supplies; + bool external_ref_only; const char * const *vcm_supplies; unsigned int num_vcm_supplies; const unsigned long *available_scan_masks; @@ -431,6 +432,7 @@ static const struct ad7380_chip_info ad7380_4_chip_info= =3D { .num_simult_channels =3D 4, .supplies =3D ad7380_supplies, .num_supplies =3D ARRAY_SIZE(ad7380_supplies), + .external_ref_only =3D true, .available_scan_masks =3D ad7380_4_channel_scan_masks, .timing_specs =3D &ad7380_4_timing, }; @@ -1047,17 +1049,31 @@ static int ad7380_probe(struct spi_device *spi) "Failed to enable power supplies\n"); msleep(T_POWERUP_MS); =20 - /* - * If there is no REFIO supply, then it means that we are using - * the internal 2.5V reference, otherwise REFIO is reference voltage. - */ - ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "refio"); - if (ret < 0 && ret !=3D -ENODEV) - return dev_err_probe(&spi->dev, ret, - "Failed to get refio regulator\n"); + if (st->chip_info->external_ref_only) { + ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, + "refin"); + if (ret < 0) + return dev_err_probe(&spi->dev, ret, + "Failed to get refin regulator\n"); + + st->vref_mv =3D ret / 1000; =20 - external_ref_en =3D ret !=3D -ENODEV; - st->vref_mv =3D external_ref_en ? ret / 1000 : AD7380_INTERNAL_REF_MV; + /* these chips don't have a register bit for this */ + external_ref_en =3D false; + } else { + /* + * If there is no REFIO supply, then it means that we are using + * the internal reference, otherwise REFIO is reference voltage. + */ + ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, + "refio"); + if (ret < 0 && ret !=3D -ENODEV) + return dev_err_probe(&spi->dev, ret, + "Failed to get refio regulator\n"); + + external_ref_en =3D ret !=3D -ENODEV; + st->vref_mv =3D external_ref_en ? ret / 1000 : AD7380_INTERNAL_REF_MV; + } =20 if (st->chip_info->num_vcm_supplies > ARRAY_SIZE(st->vcm_mv)) return dev_err_probe(&spi->dev, -EINVAL, --=20 2.46.0 From nobody Wed Nov 27 21:25:34 2024 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 140C71D9661 for ; Mon, 7 Oct 2024 15:45:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315953; cv=none; b=MrNPd/wS1bYNinregVLLKivlzN5MSpnpe7YC7yxe6GdczxzvK8PsqL5pLfZlvk0GZqFflqeLiW6c0WkCVFMni7/23LpsbfutkeujN6dYav4iSJLhEgIQ9fM3IrzNnUNWYZZ8M+o5igjIRBqNoozBs4SIe0ylOztVCWxlajE0f8o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315953; c=relaxed/simple; bh=ZXp2MaLpZvcOm5A1oxJOmpktuau4lw5UjykBgfjJO8w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jH0kTUPw9Z5+1FGUmwPYPp15COte6WgXB3aUIkqOrn7bXISJPNrdFgtHLTs3zAupxeJOVXxUp581vjouhHpcg/O9AgB2AtXBDuAllXv/yGbKbUscbv/jcidoT+1+hNT017dlHxJ/ZFhhX6zGI+lCBErBBig4pO30wMggjJbHtNU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=Wjync4DH; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="Wjync4DH" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-42cba6cdf32so46639675e9.1 for ; Mon, 07 Oct 2024 08:45:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728315949; x=1728920749; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ojstTyg1pnZB23KdDSwZrfNu+xTBHe5+8ZL6KQWO5vU=; b=Wjync4DH/EE9HWUf5DMYu/ZeMs889KqFHCkqFGyxL3DeQE1FthjiSymS4G92anPZHS cybMUQj5p8YELZ8b3eehV+RNMiTFQHdMf2LmzFiZ1c/LYYKIh3BNu0raPgYATb3jW5DA peO9WwpFL2QJGGIwoic5BeYBlcEGMUNUloUqsX0/0/XnVlUf+hneqOUTc/m76zRem3Vb vrWWfnC/BArXSUF2H4CKu1KevpJVs231g02aXOdkY7UeIGp1UyoJg64zvcApzb72m4sP C1II73DJyyamgfpC+nAOdWV0zAdG06urJXGlVMbmx/hWr8pWxAVYeEslX0LcMsrCrhru DbTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728315949; x=1728920749; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ojstTyg1pnZB23KdDSwZrfNu+xTBHe5+8ZL6KQWO5vU=; b=si8Q6jU4U9y8IA8MptocviFeorUSZXPZIWHN/5sm+rEDYYvozDoEBs0vVl02AG5vCb +/yhg8/3d9DTLxbbRH8VEkWl4s4MVS0A3LQtaktSqoOQnh8KK0iDUO1NGZsXikXX976n gY1h9ciHqHhHsh6O7cuoZJRGSu10fRu9H5w0xYhTan9pw8TVs91D8TRB3862tB9hRc8I jvU3d3kY5ew+LmdTT7k5v1dDs8tR+53Xvs+xw8m1JkC9lhJ9LjX3ZxNO5F8kC902fos0 rWGkEpFNUb3ksmFc0rON4bG+zYCWQ9A1cCDKSo3Zx7d5cIqssiIbsSPr7U2n8rWb1BPc od2g== X-Forwarded-Encrypted: i=1; AJvYcCW23JGR6QM0CxduntY3M0YKAf8z57wbHNzTN3Xv9ENpcNwt8pnv5BEET6mm/nGuKFvoDTAoUoG340RNk8Q=@vger.kernel.org X-Gm-Message-State: AOJu0YxGXNz+wHviaqb6hrKZQhLJOVGJN8uyNsN648RYYPrxmAiT1XyY UfTVgtpK41/E33MvK1gNaw6ihzOAWGQj1epirVq24LOUCo3n6ICUfgwGJkzYv6w= X-Google-Smtp-Source: AGHT+IFkaUFrNKgpEhRj9y7Z751fJZyDqB9TXK6VMlRQ+6Ipso8Gpm2aKBbAueSQ7imOULbXRTfOOg== X-Received: by 2002:a05:600c:4f14:b0:42c:b5f1:4508 with SMTP id 5b1f17b1804b1-42f85aea060mr88251595e9.23.1728315948973; Mon, 07 Oct 2024 08:45:48 -0700 (PDT) Received: from [192.168.1.64] (2a02-842a-d52e-6101-6fd0-06c4-5d68-f0a5.rev.sfr.net. [2a02:842a:d52e:6101:6fd0:6c4:5d68:f0a5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f9384f648sm17645555e9.20.2024.10.07.08.45.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 08:45:48 -0700 (PDT) From: Julien Stephan Date: Mon, 07 Oct 2024 17:45:49 +0200 Subject: [PATCH 6/6] docs: iio: ad7380: fix supply for ad7380-4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241007-ad7380-fix-supplies-v1-6-badcf813c9b9@baylibre.com> References: <20241007-ad7380-fix-supplies-v1-0-badcf813c9b9@baylibre.com> In-Reply-To: <20241007-ad7380-fix-supplies-v1-0-badcf813c9b9@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , David Lechner , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Jonathan Corbet Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Conor Dooley , Jonathan Cameron , linux-doc@vger.kernel.org, Julien Stephan X-Mailer: b4 0.14.1 ad7380-4 is the only device from ad738x family that doesn't have an internal reference. Moreover it's external reference is called REFIN in the datasheet while all other use REFIO as an optional external reference. Update documentation to highlight this. Fixes: 3e82dfc82f38 ("docs: iio: new docs for ad7380 driver") Signed-off-by: Julien Stephan --- Documentation/iio/ad7380.rst | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Documentation/iio/ad7380.rst b/Documentation/iio/ad7380.rst index 9c784c1e652e..6f70b49b9ef2 100644 --- a/Documentation/iio/ad7380.rst +++ b/Documentation/iio/ad7380.rst @@ -41,13 +41,22 @@ supports only 1 SDO line. Reference voltage ----------------- =20 -2 possible reference voltage sources are supported: +ad7380-4 +~~~~~~~~ + +ad7380-4 supports only an external reference voltage (2.5V to 3.3V). It mu= st be +declared in the device tree as ``refin-supply``. + +All other devices from ad738x family +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +All other devices from ad738x support 2 possible reference voltage sources: =20 - Internal reference (2.5V) - External reference (2.5V to 3.3V) =20 The source is determined by the device tree. If ``refio-supply`` is presen= t, -then the external reference is used, else the internal reference is used. +then it is used as external reference, else the internal reference is used. =20 Oversampling and resolution boost --------------------------------- --=20 2.46.0