From patchwork Mon Feb 19 13:11:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 13562676 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8ED6A2EB1D for ; Mon, 19 Feb 2024 13:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708348289; cv=none; b=L052BDQBKFyehEUgMkDmt3GDOQKrwafc6inZlPclkgC/jirchzEki4c+alZofAIzzXjNGB3eaD5EkkUFZvcZqO2tZrzUedY3TZn924s47/wWSHXnIEJ/lUrEziNBFbgv+yIinDBo7mEUGrMUmjOJhqvTwWdix3AA+viiToSl4ZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708348289; c=relaxed/simple; bh=TvR5U9f4990NVUGBUfBdVxKWjB8M/3nA9XEJ9d2pcvg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Bj/0eIsgg1dVHGm4ReWOXuaedBI004mOhAGtWl8650k4eOINRIh+inW0Q+mT6aQh1+Ej+bKCHtn4r+trA1rJVhK94FlChpPAawNXnMS+/PLF/pPbp+ADDGssq5qLE/ZEjDejUGGacDsjJthtAHge6SlE2PsX0NvCDJN7f4EHiAM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1rc3QT-0005bN-Lc; Mon, 19 Feb 2024 14:11:17 +0100 From: Marco Felsch To: puranjay12@gmail.com, jic23@kernel.org, lars@metafoo.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v2 1/2] dt-bindings: iio: ti,tmp117: add vcc supply binding Date: Mon, 19 Feb 2024 14:11:13 +0100 Message-Id: <20240219131114.134607-1-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: m.felsch@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-iio@vger.kernel.org From: Thomas Haemmerle Add the binding to specify the vcc supply. We can't make it required since this would break the backward compatibility. Reviewed-by: Conor Dooley Signed-off-by: Thomas Haemmerle Signed-off-by: Marco Felsch --- v2: - mark vcc-supply as required .../devicetree/bindings/iio/temperature/ti,tmp117.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml b/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml index 8c6d7735e875..33f2e9c5bd81 100644 --- a/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml +++ b/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml @@ -24,9 +24,13 @@ properties: reg: maxItems: 1 + vcc-supply: + description: provide VCC power to the sensor. + required: - compatible - reg + - vcc-supply additionalProperties: false @@ -39,5 +43,6 @@ examples: tmp117@48 { compatible = "ti,tmp117"; reg = <0x48>; + vcc-supply = <&pmic_reg_3v3>; }; }; From patchwork Mon Feb 19 13:11:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 13562677 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0BCB33CCF for ; Mon, 19 Feb 2024 13:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708348289; cv=none; b=NjgxpnHOMAnQXhhXb3q47/AMKZl28IKYOOjw3zDIUhjl/x28AiZT7BY0DR1NZQvgU1Qp+GvLqRbZ4Fs1Evdw83YlXHmR2nXKHHOnLjA37DVl6bJi5Blk5UaoV87MZiDydzO0j1qCM98EPIJHRMFzAmKkxvUzxsK8nfg2lz6/Hjc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708348289; c=relaxed/simple; bh=UGeUyFN19bQZCVUzkNSWfD9kVi6j0pXHg2utyZmuIao=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=E3dchBZe76lQ9awBgzBxIVRcd3QHPr+UrP4Ow1oPx1XyGWTChu35HjiGtcveaLzvslKfZe3eWEoCtpNTkirxUxO8ZrVI5otiBseRv2h73m3fZ3MNOy5W0fw98mi2CHiXRW9/ng0gIIK1B5SLH/4fPeK0fPpX2KUwkfUV4FsIZ98= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1rc3QT-0005bN-NU; Mon, 19 Feb 2024 14:11:17 +0100 From: Marco Felsch To: puranjay12@gmail.com, jic23@kernel.org, lars@metafoo.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v2 2/2] iio: temperature: tmp117: add support for vcc-supply Date: Mon, 19 Feb 2024 14:11:14 +0100 Message-Id: <20240219131114.134607-2-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240219131114.134607-1-m.felsch@pengutronix.de> References: <20240219131114.134607-1-m.felsch@pengutronix.de> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: m.felsch@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-iio@vger.kernel.org From: Thomas Haemmerle Add support to specify the VCC supply which is required to power the device. According the datasheet 7.3.1 Power Up, the device needs 1.5ms after the supply voltage reaches the operating range before the communcation can begin. Signed-off-by: Thomas Haemmerle Signed-off-by: Marco Felsch --- v2: - add fsleep() after powering the device drivers/iio/temperature/tmp117.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iio/temperature/tmp117.c b/drivers/iio/temperature/tmp117.c index 059953015ae7..8972083d903a 100644 --- a/drivers/iio/temperature/tmp117.c +++ b/drivers/iio/temperature/tmp117.c @@ -9,6 +9,7 @@ * Note: This driver assumes that the sensor has been calibrated beforehand. */ +#include #include #include #include @@ -17,6 +18,7 @@ #include #include #include +#include #include @@ -148,10 +150,17 @@ static int tmp117_probe(struct i2c_client *client) struct tmp117_data *data; struct iio_dev *indio_dev; int dev_id; + int ret; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) return -EOPNOTSUPP; + ret = devm_regulator_get_enable(&client->dev, "vcc"); + if (ret) + return ret; + + fsleep(1500); + dev_id = i2c_smbus_read_word_swapped(client, TMP117_REG_DEVICE_ID); if (dev_id < 0) return dev_id;