From patchwork Sat Nov 2 19:50:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aren X-Patchwork-Id: 13860229 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7F030E67808 for ; Sat, 2 Nov 2024 19:58:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6wjZ1pTHZq/+k3MCnSbbzmSo0hoqjpDUYVU+ZZfLBNM=; b=t+KT/9pJc0ywpOQF7Xclt71UCU o0qlcisr3in8XOTD+RfkKUnKLbebm4jz7oDpVQJXKWi4xT4NPnnkSNcRdP4Vk/Pnj2pCz2jU4BlEW J2FbC4nGJtc7o5vKmg+kMgsz0e5sZuMhiViW2UWTtFcVR4bOAi84mPK/6eIvRFAbWavNykeyQrViy 2VGc1ppAAep6BFl/lZRBD3VDY/cuX+Thxx295+jeJDf+LK9mlSo6Uo/OlwgWgKVjzKMm8uWJA3YsC Q5AJNaRn2OqEIZwYxnduksOjAxb/+xz6RUq4R6EF2MbqjiU8XBf9WLIOibFEaAiRfxCseG2lrbaEZ SKM/Us1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t7KG1-0000000AJj5-10x4; Sat, 02 Nov 2024 19:58:01 +0000 Received: from a.peacevolution.org ([206.189.193.133]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t7KCn-0000000AJ68-1EAq for linux-arm-kernel@lists.infradead.org; Sat, 02 Nov 2024 19:54:42 +0000 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by a.peacevolution.org (Postfix) with ESMTPA id 307724C845; Sat, 2 Nov 2024 19:54:39 +0000 (UTC) From: Aren Moynihan To: Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Aren Moynihan , Kaustabh Chakraborty , =?utf-8?b?QmFybmFiw6FzIEN6?= =?utf-8?b?w6ltw6Fu?= , Ondrej Jirman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Dragan Simic , phone-devel@vger.kernel.org, Krzysztof Kozlowski Subject: [PATCH v4 1/6] dt-bindings: iio: light: stk33xx: add vdd and leda regulators Date: Sat, 2 Nov 2024 15:50:35 -0400 Message-ID: <20241102195037.3013934-5-aren@peacevolution.org> In-Reply-To: <20241102195037.3013934-3-aren@peacevolution.org> References: <20241102195037.3013934-3-aren@peacevolution.org> MIME-Version: 1.0 Authentication-Results: auth=pass smtp.auth=aren@peacevolution.org smtp.mailfrom=aren@peacevolution.org X-Spamd-Bar: ++++++ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peacevolution.org; s=dkim; t=1730577280; h=from:subject:date:message-id:to:cc:mime-version:content-transfer-encoding:in-reply-to:references; bh=6wjZ1pTHZq/+k3MCnSbbzmSo0hoqjpDUYVU+ZZfLBNM=; b=VAUl+C68ru76ec7Nb1Mb9ewjMuuI0BS5yVVgiZzYbG1egtlzzsh+ja7Si9tRUCmfImF0EN mgJfFaitBAaR2zB3PqoQZVBgsVfbO5iyyCQHBC0Ux6Y/CrbqRpTNKsBhNqKA3kDTsjFB52 olPU/ef1KtJVkPoyexcTUwmxVvoQ40s= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241102_125441_416712_89D3032A X-CRM114-Status: UNSURE ( 8.19 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org stk3310 and stk3311 are typically connected to power supplies for the chip (vdd) and the infrared LED (leda). Add properties so we can power these up / down appropriately. Signed-off-by: Aren Moynihan Reviewed-by: Krzysztof Kozlowski --- Notes: Changes in v2: - add leda-supply - add supplies to examples Documentation/devicetree/bindings/iio/light/stk33xx.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/light/stk33xx.yaml b/Documentation/devicetree/bindings/iio/light/stk33xx.yaml index e4341fdced98..96ee8ec16463 100644 --- a/Documentation/devicetree/bindings/iio/light/stk33xx.yaml +++ b/Documentation/devicetree/bindings/iio/light/stk33xx.yaml @@ -34,6 +34,8 @@ properties: interrupts: maxItems: 1 + vdd-supply: true + leda-supply: true proximity-near-level: true required: @@ -57,6 +59,8 @@ examples: proximity-near-level = <25>; interrupt-parent = <&gpio1>; interrupts = <5 IRQ_TYPE_LEVEL_LOW>; + vdd-supply = <&vdd_regulator>; + leda-supply = <&led_regulator>; }; }; ... From patchwork Sat Nov 2 19:50:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aren X-Patchwork-Id: 13860230 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4906E67808 for ; Sat, 2 Nov 2024 19:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=muOFYNTzaO2s6LuQjYw2jR7V/iVjO+R6V5aOyyeC/fE=; b=COztBZU7q82jZRP4lgHX52IjoB XYU1DkFmO7ykHK0BDzkV7WAiUzZyhFctwwmYiOs9cEYrGHu40ZEqOCiH6MzB7AkS9fE0MhMhcz05q LVFi/zKE+AU5GVw0Fbim2xUQz1afUsWQhsGdrXL10kLGoR3itbYNYQbh22EVq2I+xdJe/P047BG5K hxmuQ+C0vaetwXEj93R+UTyi+82gzDbbrMW2tOdMQ8uifO4ORHCP7/QL1pw3+R8HK2wqCJ+Tq0TV7 BOEm0unRuNTCXTCuKDjn0i66zis/oViHX9kgg3jtyTQSCpJDU5gWAnK5UxY00UCZJ1zJhEImkOp3U dHkupY1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t7KHh-0000000AK4m-14rD; Sat, 02 Nov 2024 19:59:45 +0000 Received: from a.peacevolution.org ([206.189.193.133]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t7KD6-0000000AJ9r-0qMx for linux-arm-kernel@lists.infradead.org; Sat, 02 Nov 2024 19:55:02 +0000 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by a.peacevolution.org (Postfix) with ESMTPA id 519BC4C832; Sat, 2 Nov 2024 19:54:58 +0000 (UTC) From: Aren Moynihan To: Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Aren Moynihan , Kaustabh Chakraborty , =?utf-8?b?QmFybmFiw6FzIEN6?= =?utf-8?b?w6ltw6Fu?= , Ondrej Jirman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Dragan Simic , phone-devel@vger.kernel.org Subject: [PATCH v4 2/6] iio: light: stk3310: handle all remove logic with devm callbacks Date: Sat, 2 Nov 2024 15:50:37 -0400 Message-ID: <20241102195037.3013934-7-aren@peacevolution.org> In-Reply-To: <20241102195037.3013934-3-aren@peacevolution.org> References: <20241102195037.3013934-3-aren@peacevolution.org> MIME-Version: 1.0 Authentication-Results: auth=pass smtp.auth=aren@peacevolution.org smtp.mailfrom=aren@peacevolution.org X-Spamd-Bar: +++++ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peacevolution.org; s=dkim; t=1730577299; h=from:subject:date:message-id:to:cc:mime-version:content-transfer-encoding:in-reply-to:references; bh=muOFYNTzaO2s6LuQjYw2jR7V/iVjO+R6V5aOyyeC/fE=; b=N7FNSpabyT6u3ukvz2bGjgD3Kioi/Imge8JRYxQFCk/rPJ43by7Uq54vvUM7JGmALM8AbD TtrYr8kRff/oSFO2M9ES5MPF1Bxlnzy1RgeNDHDPq9FjiiwFM7AAqCQF/MAl4DGeztFM2n i+adxee2o+IWMf48clpCf+XkW19ahIw= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241102_125500_389463_ACA08A6D X-CRM114-Status: GOOD ( 12.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Using devm callbacks helps to make the ordering of probe / remove operations easier to reason about and removes some duplicate code between the probe error path and driver remove. --- Notes: Changes in v4: - also replace mutex_init with devm_mutex_init Added in v3 drivers/iio/light/stk3310.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c index ed20b6714546..181b7acb3f96 100644 --- a/drivers/iio/light/stk3310.c +++ b/drivers/iio/light/stk3310.c @@ -484,6 +484,17 @@ static int stk3310_set_state(struct stk3310_data *data, u8 state) return ret; } +static void stk3310_set_state_disable(void *private) +{ + int ret; + struct stk3310_data *data = private; + struct device *dev = &data->client->dev; + + ret = stk3310_set_state(data, STK3310_STATE_STANDBY); + if (ret) + dev_err(dev, "failed to set state to standby: %d\n", ret); +} + static int stk3310_init(struct iio_dev *indio_dev) { int ret; @@ -491,6 +502,7 @@ static int stk3310_init(struct iio_dev *indio_dev) u8 state; struct stk3310_data *data = iio_priv(indio_dev); struct i2c_client *client = data->client; + struct device *dev = &client->dev; ret = regmap_read(data->regmap, STK3310_REG_ID, &chipid); if (ret < 0) @@ -507,6 +519,10 @@ static int stk3310_init(struct iio_dev *indio_dev) return ret; } + ret = devm_add_action_or_reset(&client->dev, stk3310_set_state_disable, data); + if (ret) + return dev_err_probe(dev, ret, "failed to register cleanup function\n"); + /* Enable PS interrupts */ ret = regmap_field_write(data->reg_int_ps, STK3310_PSINT_EN); if (ret < 0) @@ -624,7 +640,7 @@ static int stk3310_probe(struct i2c_client *client) device_property_read_u32(&client->dev, "proximity-near-level", &data->ps_near_level); - mutex_init(&data->lock); + devm_mutex_init(&client->dev, &data->lock); ret = stk3310_regmap_init(data); if (ret < 0) @@ -650,29 +666,17 @@ static int stk3310_probe(struct i2c_client *client) if (ret < 0) { dev_err(&client->dev, "request irq %d failed\n", client->irq); - goto err_standby; + return ret; } } - ret = iio_device_register(indio_dev); + ret = devm_iio_device_register(&client->dev, indio_dev); if (ret < 0) { dev_err(&client->dev, "device_register failed\n"); - goto err_standby; + return ret; } return 0; - -err_standby: - stk3310_set_state(data, STK3310_STATE_STANDBY); - return ret; -} - -static void stk3310_remove(struct i2c_client *client) -{ - struct iio_dev *indio_dev = i2c_get_clientdata(client); - - iio_device_unregister(indio_dev); - stk3310_set_state(iio_priv(indio_dev), STK3310_STATE_STANDBY); } static int stk3310_suspend(struct device *dev) @@ -736,7 +740,6 @@ static struct i2c_driver stk3310_driver = { .acpi_match_table = stk3310_acpi_id, }, .probe = stk3310_probe, - .remove = stk3310_remove, .id_table = stk3310_i2c_id, }; From patchwork Sat Nov 2 19:50:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aren X-Patchwork-Id: 13860231 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EFC6DE677FD for ; Sat, 2 Nov 2024 20:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bZ4cqFntykXHpbFFV4ZfGRHhWWvK0O7Az93eNAhN7Dc=; b=eC2pMytuqmeVtUOZugvhIe1dxw 1Q9nZ8Reo2jBtcm5bmW+Ina1fDIH2Sx3GmbGXz7QD1N23hU+6BHbCUJB6A2SEv1Rxv6fbq65SFStY 4K93vbXAaiXIUfSfIJxG/GKQoDFwjPWMjoT2YkDn60Y6CKsgcymErdxxJ16uEQjZ7RXSM7FPWibsJ EMWO2saTt5ObiHctF/faUIXIkGgwYHWln2fNDZ8x/FAQRKE2nDRmR3p6p8F5xICN3UE+K3WH2QDxT VeMnnPRk4wHt6ZLuHHZKfPwv3Oqs9dxdKyuAanbalpQPJS5PA7bdm8TwKbxi/h3rkFYKbtOgnNNBW 3MjSP3Nw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t7KJJ-0000000AKEK-2t92; Sat, 02 Nov 2024 20:01:25 +0000 Received: from a.peacevolution.org ([206.189.193.133]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t7KDl-0000000AJHI-1Kkz for linux-arm-kernel@lists.infradead.org; Sat, 02 Nov 2024 19:55:42 +0000 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by a.peacevolution.org (Postfix) with ESMTPA id 61D1C4C832; Sat, 2 Nov 2024 19:55:39 +0000 (UTC) From: Aren Moynihan To: Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Aren Moynihan , Kaustabh Chakraborty , =?utf-8?b?QmFybmFiw6FzIEN6?= =?utf-8?b?w6ltw6Fu?= , Ondrej Jirman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Dragan Simic , phone-devel@vger.kernel.org Subject: [PATCH v4 3/6] iio: light: stk3310: Implement vdd and leda supplies Date: Sat, 2 Nov 2024 15:50:39 -0400 Message-ID: <20241102195037.3013934-9-aren@peacevolution.org> In-Reply-To: <20241102195037.3013934-3-aren@peacevolution.org> References: <20241102195037.3013934-3-aren@peacevolution.org> MIME-Version: 1.0 Authentication-Results: auth=pass smtp.auth=aren@peacevolution.org smtp.mailfrom=aren@peacevolution.org X-Spamd-Bar: ++++++ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peacevolution.org; s=dkim; t=1730577340; h=from:subject:date:message-id:to:cc:mime-version:content-transfer-encoding:in-reply-to:references; bh=bZ4cqFntykXHpbFFV4ZfGRHhWWvK0O7Az93eNAhN7Dc=; b=OW4ekAto3UFMKXXS3S0cDNzAePkehJMi1jH2TlRvY/Fy2fyyCuWKyfKeXbKV6yFTFk/riD /XXAgwAbUG7sYkXkMd+CcaRmJZ/uFTMefVd6Eo3Tyhkq4c6eKktdx2YajP4A5ULvl/1t45 yVIE9EZPVPuSD3UAEHmroZ4HUASpkIw= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241102_125541_514803_4A26F0EA X-CRM114-Status: GOOD ( 20.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The vdd and leda supplies must be powered on for the chip to function and can be powered off during system suspend. This was originally based on a patch by Ondrej Jirman[1], but has been rewritten since. 1: https://codeberg.org/megi/linux/commit/a933aff8b7a0e6e3c9cf1d832dcba07022bbfa82 Signed-off-by: Aren Moynihan --- Notes: Changes in v4: - fix variable declaration order in stk3310_resume to match the rest of the driver Changes in v3: - use bulk regulators instead of two individual ones - handle cleanup using devm callbacks instead of the remove function Changes in v2: - always enable / disable regulators and rely on a dummy regulator if one isn't specified - replace usleep_range with fsleep - reorder includes so iio headers are last - add missing error handling to resume drivers/iio/light/stk3310.c | 76 ++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 2 deletions(-) diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c index 181b7acb3f96..f93689c61f44 100644 --- a/drivers/iio/light/stk3310.c +++ b/drivers/iio/light/stk3310.c @@ -13,6 +13,8 @@ #include #include #include +#include + #include #include #include @@ -130,6 +132,7 @@ struct stk3310_data { struct regmap_field *reg_int_ps; struct regmap_field *reg_flag_psint; struct regmap_field *reg_flag_nf; + struct regulator_bulk_data supplies[2]; }; static const struct iio_event_spec stk3310_events[] = { @@ -621,6 +624,31 @@ static irqreturn_t stk3310_irq_event_handler(int irq, void *private) return IRQ_HANDLED; } +static int stk3310_regulators_enable(struct stk3310_data *data) +{ + int ret; + + ret = regulator_bulk_enable(ARRAY_SIZE(data->supplies), data->supplies); + if (ret) + return ret; + + /* we need a short delay to allow the chip time to power on */ + fsleep(1000); + + return 0; +} + +static void stk3310_regulators_disable(void *private) +{ + int ret; + struct stk3310_data *data = private; + struct device *dev = &data->client->dev; + + ret = regulator_bulk_disable(ARRAY_SIZE(data->supplies), data->supplies); + if (ret) + dev_err(dev, "failed to disable regulators: %d\n", ret); +} + static int stk3310_probe(struct i2c_client *client) { int ret; @@ -642,6 +670,13 @@ static int stk3310_probe(struct i2c_client *client) devm_mutex_init(&client->dev, &data->lock); + data->supplies[0].supply = "vdd"; + data->supplies[1].supply = "leda"; + ret = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(data->supplies), + data->supplies); + if (ret) + return dev_err_probe(&client->dev, ret, "get regulators failed\n"); + ret = stk3310_regmap_init(data); if (ret < 0) return ret; @@ -652,6 +687,16 @@ static int stk3310_probe(struct i2c_client *client) indio_dev->channels = stk3310_channels; indio_dev->num_channels = ARRAY_SIZE(stk3310_channels); + ret = stk3310_regulators_enable(data); + if (ret) + return dev_err_probe(&client->dev, ret, + "regulator enable failed\n"); + + ret = devm_add_action_or_reset(&client->dev, stk3310_regulators_disable, data); + if (ret) + return dev_err_probe(&client->dev, ret, + "failed to register regulator cleanup\n"); + ret = stk3310_init(indio_dev); if (ret < 0) return ret; @@ -682,18 +727,45 @@ static int stk3310_probe(struct i2c_client *client) static int stk3310_suspend(struct device *dev) { struct stk3310_data *data; + int ret; data = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); - return stk3310_set_state(data, STK3310_STATE_STANDBY); + ret = stk3310_set_state(data, STK3310_STATE_STANDBY); + if (ret) + return ret; + + regcache_mark_dirty(data->regmap); + + ret = regulator_bulk_disable(ARRAY_SIZE(data->supplies), data->supplies); + if (ret) { + dev_err(dev, "failed to disable regulators: %d\n", ret); + return ret; + } + + return 0; } static int stk3310_resume(struct device *dev) { - u8 state = 0; + int ret; struct stk3310_data *data; + u8 state = 0; data = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); + + ret = stk3310_regulators_enable(data); + if (ret) { + dev_err(dev, "Failed to re-enable regulators: %d", ret); + return ret; + } + + ret = regcache_sync(data->regmap); + if (ret) { + dev_err(dev, "Failed to restore registers: %d\n", ret); + return ret; + } + if (data->ps_enabled) state |= STK3310_STATE_EN_PS; if (data->als_enabled) From patchwork Sat Nov 2 19:50:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aren X-Patchwork-Id: 13860232 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93B53E67808 for ; Sat, 2 Nov 2024 20:03:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EOQ+icUlK1H5YL/QrrfHa7ZgZuPTLdaho4son5PhToI=; b=mKMYjrrcrqiOiJGh2t8qrfEQGE tGqHwMx/zV+Eu7xvnQNJvQH2hyIY6i5MdRIAlkzXDUUB/9P+fGVDoLcexLYJ01XULhUTwiTnEtzEP pcLam1kctdayNJhgcX1viPwtAOe0Pq9CuTitI2Hu3aSAUrYUGuqLq4P5oPkN3ZmGjYHqZL6x28JTp XU072A3kiO4CGWwDin/wSYhg1+rVMFIHzxRmEMcPxWhVlT3hg6ktn3gtVmC/UAcGH5UV7OgoDiMah diyLH3CmvzkD0DKI8QGG1ilul/nZmQbwfLeNI+X35EydpZ/z8yGOdr7AXpIzRIKR2lhIpAXs/UNo1 +mnLNDnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t7KKz-0000000AKPm-0fCk; Sat, 02 Nov 2024 20:03:09 +0000 Received: from a.peacevolution.org ([206.189.193.133]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t7KE9-0000000AJLm-3N30 for linux-arm-kernel@lists.infradead.org; Sat, 02 Nov 2024 19:56:07 +0000 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by a.peacevolution.org (Postfix) with ESMTPA id 605304C847; Sat, 2 Nov 2024 19:56:03 +0000 (UTC) From: Aren Moynihan To: Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Aren Moynihan , Kaustabh Chakraborty , =?utf-8?b?QmFybmFiw6FzIEN6?= =?utf-8?b?w6ltw6Fu?= , Ondrej Jirman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Dragan Simic , phone-devel@vger.kernel.org Subject: [PATCH v4 4/6] iio: light: stk3310: use dev_err_probe where possible Date: Sat, 2 Nov 2024 15:50:41 -0400 Message-ID: <20241102195037.3013934-11-aren@peacevolution.org> In-Reply-To: <20241102195037.3013934-3-aren@peacevolution.org> References: <20241102195037.3013934-3-aren@peacevolution.org> MIME-Version: 1.0 Authentication-Results: auth=pass smtp.auth=aren@peacevolution.org smtp.mailfrom=aren@peacevolution.org X-Spamd-Bar: +++ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peacevolution.org; s=dkim; t=1730577364; h=from:subject:date:message-id:to:cc:mime-version:content-transfer-encoding:in-reply-to:references; bh=EOQ+icUlK1H5YL/QrrfHa7ZgZuPTLdaho4son5PhToI=; b=ZBbr8wfwo3qQ6VZx2PM+mCKxgFgJ/XzgEIbWYqxxV53kdJtu1IBxYs/14HzjzlLCmsI4jP h0+CYKNKBlldsH12AbP+Fb/Fi3RtW5SWO0+akM3HX4gLAKYE1ihUITbcPR4JxGcegEhi5O WVHfe7SmFGbvI01CTC/SvMfZUL4D0qI= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241102_125605_995669_CD7A0FE5 X-CRM114-Status: GOOD ( 15.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Using dev_err_probe instead of dev_err and return makes the errors easier to understand by including the error name, and saves a little code. Signed-off-by: Aren Moynihan --- Notes: Changes in v4: - Get a struct device ahead of time so it can be passed as "dev" instead of "&client->dev" No changes in v3 Added in v2 drivers/iio/light/stk3310.c | 61 ++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c index f93689c61f44..c9a3f02bdd80 100644 --- a/drivers/iio/light/stk3310.c +++ b/drivers/iio/light/stk3310.c @@ -61,12 +61,12 @@ #define STK3310_REGFIELD(name) \ do { \ data->reg_##name = \ - devm_regmap_field_alloc(&client->dev, regmap, \ + devm_regmap_field_alloc(dev, regmap, \ stk3310_reg_field_##name); \ - if (IS_ERR(data->reg_##name)) { \ - dev_err(&client->dev, "reg field alloc failed.\n"); \ - return PTR_ERR(data->reg_##name); \ - } \ + if (IS_ERR(data->reg_##name)) \ + return dev_err_probe(dev, \ + PTR_ERR(data->reg_##name), \ + "reg field alloc failed.\n"); \ } while (0) static const struct reg_field stk3310_reg_field_state = @@ -517,10 +517,8 @@ static int stk3310_init(struct iio_dev *indio_dev) state = STK3310_STATE_EN_ALS | STK3310_STATE_EN_PS; ret = stk3310_set_state(data, state); - if (ret < 0) { - dev_err(&client->dev, "failed to enable sensor"); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "failed to enable sensor\n"); ret = devm_add_action_or_reset(&client->dev, stk3310_set_state_disable, data); if (ret) @@ -529,9 +527,9 @@ static int stk3310_init(struct iio_dev *indio_dev) /* Enable PS interrupts */ ret = regmap_field_write(data->reg_int_ps, STK3310_PSINT_EN); if (ret < 0) - dev_err(&client->dev, "failed to enable interrupts!\n"); + return dev_err_probe(dev, ret, "failed to enable interrupts!\n"); - return ret; + return 0; } static bool stk3310_is_volatile_reg(struct device *dev, unsigned int reg) @@ -560,14 +558,14 @@ static const struct regmap_config stk3310_regmap_config = { static int stk3310_regmap_init(struct stk3310_data *data) { struct regmap *regmap; - struct i2c_client *client; + struct i2c_client *client = data->client; + struct device *dev = &client->dev; - client = data->client; regmap = devm_regmap_init_i2c(client, &stk3310_regmap_config); - if (IS_ERR(regmap)) { - dev_err(&client->dev, "regmap initialization failed.\n"); - return PTR_ERR(regmap); - } + if (IS_ERR(regmap)) + return dev_err_probe(dev, PTR_ERR(regmap), + "regmap initialization failed.\n"); + data->regmap = regmap; STK3310_REGFIELD(state); @@ -654,12 +652,11 @@ static int stk3310_probe(struct i2c_client *client) int ret; struct iio_dev *indio_dev; struct stk3310_data *data; + struct device *dev = &client->dev; indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); - if (!indio_dev) { - dev_err(&client->dev, "iio allocation failed!\n"); - return -ENOMEM; - } + if (!indio_dev) + return dev_err_probe(dev, -ENOMEM, "iio allocation failed!\n"); data = iio_priv(indio_dev); data->client = client; @@ -675,7 +672,7 @@ static int stk3310_probe(struct i2c_client *client) ret = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(data->supplies), data->supplies); if (ret) - return dev_err_probe(&client->dev, ret, "get regulators failed\n"); + return dev_err_probe(dev, ret, "get regulators failed\n"); ret = stk3310_regmap_init(data); if (ret < 0) @@ -689,13 +686,11 @@ static int stk3310_probe(struct i2c_client *client) ret = stk3310_regulators_enable(data); if (ret) - return dev_err_probe(&client->dev, ret, - "regulator enable failed\n"); + return dev_err_probe(dev, ret, "regulator enable failed\n"); ret = devm_add_action_or_reset(&client->dev, stk3310_regulators_disable, data); if (ret) - return dev_err_probe(&client->dev, ret, - "failed to register regulator cleanup\n"); + return dev_err_probe(dev, ret, "failed to register regulator cleanup\n"); ret = stk3310_init(indio_dev); if (ret < 0) @@ -708,18 +703,14 @@ static int stk3310_probe(struct i2c_client *client) IRQF_TRIGGER_FALLING | IRQF_ONESHOT, STK3310_EVENT, indio_dev); - if (ret < 0) { - dev_err(&client->dev, "request irq %d failed\n", - client->irq); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "request irq %d failed\n", + client->irq); } ret = devm_iio_device_register(&client->dev, indio_dev); - if (ret < 0) { - dev_err(&client->dev, "device_register failed\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "device_register failed\n"); return 0; } From patchwork Sat Nov 2 19:50:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aren X-Patchwork-Id: 13860233 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A1FB9E67809 for ; Sat, 2 Nov 2024 20:04:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uvvNhj8Jh93zpagJdBLhHBNGJCsGSzK4C5YOxnQO53E=; b=T5bDcjeKjKkGlIC2w/WROnNs4l rpRbUKfZSJezKBsuV2vYt6O8x0C7kbkFraDdp9ztpuERzSfi67YPu/cvGcfQTbjvzFAWpNvw/b1GB v0JodbYifN6Dldqq5Vdii4FQK19/8u2DQ9mzrFMcFQIGQ60bpFJghn+lkzO+Z3Iquel1hiLaNB/TD oPd+CbRzD+iYE+gaRL5MsWaAalwluuASJONxpJso7uQp5jz9mD/3DOh9GSXNHTNqCPcRQqxvEiYW+ 0+a6aJQukykEULlGhB8jVUHgTSNGY856YFhYf9zWd2wU1PRXDbSDj4MbkJnJbPZjQilF1U1ko10Po LIVTCtlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t7KMc-0000000AKZC-3gpP; Sat, 02 Nov 2024 20:04:50 +0000 Received: from a.peacevolution.org ([206.189.193.133]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t7KER-0000000AJQr-1Qdp for linux-arm-kernel@lists.infradead.org; Sat, 02 Nov 2024 19:56:24 +0000 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by a.peacevolution.org (Postfix) with ESMTPA id 69A2B4C84C; Sat, 2 Nov 2024 19:56:21 +0000 (UTC) From: Aren Moynihan To: Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Aren Moynihan , Kaustabh Chakraborty , =?utf-8?b?QmFybmFiw6FzIEN6?= =?utf-8?b?w6ltw6Fu?= , Ondrej Jirman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Dragan Simic , phone-devel@vger.kernel.org Subject: [PATCH v4 5/6] iio: light: stk3310: log error if reading the chip id fails Date: Sat, 2 Nov 2024 15:50:43 -0400 Message-ID: <20241102195037.3013934-13-aren@peacevolution.org> In-Reply-To: <20241102195037.3013934-3-aren@peacevolution.org> References: <20241102195037.3013934-3-aren@peacevolution.org> MIME-Version: 1.0 Authentication-Results: auth=pass smtp.auth=aren@peacevolution.org smtp.mailfrom=aren@peacevolution.org X-Spamd-Bar: ++ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peacevolution.org; s=dkim; t=1730577382; h=from:subject:date:message-id:to:cc:mime-version:content-transfer-encoding:in-reply-to:references; bh=uvvNhj8Jh93zpagJdBLhHBNGJCsGSzK4C5YOxnQO53E=; b=iKg1Bs5ez3k57s5TX8B2KsJGqvkshKKwCERTQrh5gkSzMVC+c1ahFcgX9DDVEtcz8uswXR CQ73g9pKzfXbtlIPoTpg53k6VMYFigxLTGRewaGMfCZfXj+vXRY4NBSDCmwxoZkJtUhqZr u3lpZEO0IZNZsuJa/CQw3I5UB/Jg0VY= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241102_125623_471385_E4E2565F X-CRM114-Status: GOOD ( 12.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If the chip isn't powered, this call is likely to return an error. Without a log here the driver will silently fail to probe. Potential errors include ENXIO (when the chip isn't powered) and ETIMEDOUT (when the i2c bus isn't powered). This function is only called from stk3310_probe, and this condition should return an error, which fits what dev_err_probe is designed for. Signed-off-by: Aren Moynihan --- Notes: Changes in v4: - get a struct device ahead of time so it can be passed as "dev" instead of "&client->dev" Changes in v2: - use dev_err_probe drivers/iio/light/stk3310.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c index c9a3f02bdd80..becd6901dfef 100644 --- a/drivers/iio/light/stk3310.c +++ b/drivers/iio/light/stk3310.c @@ -509,7 +509,7 @@ static int stk3310_init(struct iio_dev *indio_dev) ret = regmap_read(data->regmap, STK3310_REG_ID, &chipid); if (ret < 0) - return ret; + return dev_err_probe(dev, ret, "failed to read chip id\n"); ret = stk3310_check_chip_id(chipid); if (ret < 0) From patchwork Sat Nov 2 19:50:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aren X-Patchwork-Id: 13860234 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B81A7E67809 for ; Sat, 2 Nov 2024 20:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1Fb34FGXqzMNx+nxE4qoPozuG7GAzwlPuHgHmRcGRGE=; b=aGRwyYMoCS5IkXlWdOLQMWPCPn NcOtD5SMkVa0ugVfs7nv68YLaV8lsLt5RnGnSaBbPeIZW8H7iEVzc3LKESWmhKEOwdCjMD1t8FkjP w57Me0O2d5EztCYPnKPQuQV3Goo5hLOj8n6jtsusmX+6a6OTQkK7/doGKahflPuXBkGtEQ5RfUj7r nkNyxXlZ43rEef5Hxf4TURP0Vr9Wzc6gcpJkAMnnJGlQO7GmcIru2V20ZckjSqCIy1O3h+Crl3ps+ v390wS0pSQglZDr/cr4dJQafyRsc1orzJqlmzkL4bzUEO7ixyogSvDx5J88KdKhEcsUoCrZxj82NX 6Cwtgjag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t7KOH-0000000AKqC-191b; Sat, 02 Nov 2024 20:06:33 +0000 Received: from a.peacevolution.org ([206.189.193.133]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t7KEW-0000000AJRu-2AoE for linux-arm-kernel@lists.infradead.org; Sat, 02 Nov 2024 19:56:29 +0000 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by a.peacevolution.org (Postfix) with ESMTPA id ACC684C854; Sat, 2 Nov 2024 19:56:26 +0000 (UTC) From: Aren Moynihan To: Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Aren Moynihan , Kaustabh Chakraborty , =?utf-8?b?QmFybmFiw6FzIEN6?= =?utf-8?b?w6ltw6Fu?= , Ondrej Jirman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Dragan Simic , phone-devel@vger.kernel.org Subject: [PATCH v4 6/6] arm64: dts: allwinner: pinephone: Add power supplies to stk3311 Date: Sat, 2 Nov 2024 15:50:45 -0400 Message-ID: <20241102195037.3013934-15-aren@peacevolution.org> In-Reply-To: <20241102195037.3013934-3-aren@peacevolution.org> References: <20241102195037.3013934-3-aren@peacevolution.org> MIME-Version: 1.0 Authentication-Results: auth=pass smtp.auth=aren@peacevolution.org smtp.mailfrom=aren@peacevolution.org X-Spamd-Bar: ++++ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peacevolution.org; s=dkim; t=1730577387; h=from:subject:date:message-id:to:cc:mime-version:content-transfer-encoding:in-reply-to:references; bh=1Fb34FGXqzMNx+nxE4qoPozuG7GAzwlPuHgHmRcGRGE=; b=Pjp06f/LQfljxy4nUX7anE7BKppC4jnYqRqIDe1m7j06931HUoyxpBYZ6g1MUUe0uReAXB 89CSOhXwYBG+oYdlidrjtzcCkFSUADPTFl3zAgUDxisOqeX11FOGMjeZExcKpc9yHtVrk+ ivqT/Kd9YSRMrm65fNEpQdifcsk3ZAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241102_125628_653675_F3B9EAC5 X-CRM114-Status: UNSURE ( 8.33 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ondrej Jirman This allows the driver to properly handle powering this device, and disable power during suspend. Signed-off-by: Ondrej Jirman Signed-off-by: Aren Moynihan --- Notes: Changes in v2: - add leda-supply arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi index 6d152066a59a..618341b63db2 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi @@ -260,6 +260,8 @@ light-sensor@48 { reg = <0x48>; interrupt-parent = <&pio>; interrupts = <1 0 IRQ_TYPE_EDGE_FALLING>; /* PB0 */ + vdd-supply = <®_ldo_io0>; + leda-supply = <®_dldo1>; }; /* Accelerometer/gyroscope */