diff options
Diffstat (limited to 'target/linux/mediatek/patches-5.15/501-auxadc-add-auxadc-32k-clk.patch')
-rw-r--r-- | target/linux/mediatek/patches-5.15/501-auxadc-add-auxadc-32k-clk.patch | 63 |
1 files changed, 49 insertions, 14 deletions
diff --git a/target/linux/mediatek/patches-5.15/501-auxadc-add-auxadc-32k-clk.patch b/target/linux/mediatek/patches-5.15/501-auxadc-add-auxadc-32k-clk.patch index 5b98235ff4..9b7d13563c 100644 --- a/target/linux/mediatek/patches-5.15/501-auxadc-add-auxadc-32k-clk.patch +++ b/target/linux/mediatek/patches-5.15/501-auxadc-add-auxadc-32k-clk.patch @@ -1,3 +1,40 @@ +From patchwork Wed Oct 19 14:37:35 2022 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Daniel Golle <daniel@makrotopia.org> +X-Patchwork-Id: 13011901 +Date: Wed, 19 Oct 2022 15:37:35 +0100 +From: Daniel Golle <daniel@makrotopia.org> +To: Jonathan Cameron <jic23@kernel.org>, + Lars-Peter Clausen <lars@metafoo.de>, + Matthias Brugger <matthias.bgg@gmail.com>, + linux-iio@vger.kernel.org +Cc: David Bauer <mail@david-bauer.net>, + Gwendal Grignou <gwendal@chromium.org>, + AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, + linux-arm-kernel@lists.infradead.org, + linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org +Subject: [PATCH 1/2] iio: adc: mt6577_auxadc: add optional 32k clock +Message-ID: + <f98ed7f3fc15a0614443a57427d46ce17ec2e0cc.1666190235.git.daniel@makrotopia.org> +MIME-Version: 1.0 +Content-Disposition: inline +X-BeenThere: linux-mediatek@lists.infradead.org +X-Mailman-Version: 2.1.34 +Precedence: list +List-Id: <linux-mediatek.lists.infradead.org> + +MediaTek MT7986 and MT7981 require an additional clock to be brought up +for AUXADC. Add support for that in the driver, similar to how it's +done in MediaTek's SDK[1]. + +[1]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/refs/heads/master/target/linux/mediatek/patches-5.4/500-auxadc-add-auxadc-32k-clk.patch +Signed-off-by: Daniel Golle <daniel@makrotopia.org> +--- + drivers/iio/adc/mt6577_auxadc.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + --- a/drivers/iio/adc/mt6577_auxadc.c +++ b/drivers/iio/adc/mt6577_auxadc.c @@ -42,6 +42,7 @@ struct mtk_auxadc_compatible { @@ -8,16 +45,14 @@ struct mutex lock; const struct mtk_auxadc_compatible *dev_comp; }; -@@ -222,6 +223,14 @@ static int __maybe_unused mt6577_auxadc_ +@@ -222,6 +223,12 @@ static int __maybe_unused mt6577_auxadc_ return ret; } -+ if (!IS_ERR(adc_dev->adc_32k_clk)) { -+ ret = clk_prepare_enable(adc_dev->adc_32k_clk); -+ if (ret) { -+ pr_err("failed to enable auxadc clock\n"); -+ return ret; -+ } ++ ret = clk_prepare_enable(adc_dev->adc_32k_clk); ++ if (ret) { ++ pr_err("failed to enable auxadc clock\n"); ++ return ret; + } + mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC, @@ -36,15 +71,15 @@ return ret; } -+ adc_dev->adc_32k_clk = devm_clk_get(&pdev->dev, "32k"); ++ adc_dev->adc_32k_clk = devm_clk_get_optional(&pdev->dev, "32k"); + if (IS_ERR(adc_dev->adc_32k_clk)) { + dev_err(&pdev->dev, "failed to get auxadc 32k clock\n"); -+ } else { -+ ret = clk_prepare_enable(adc_dev->adc_32k_clk); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to enable auxadc 32k clock\n"); -+ return ret; -+ } ++ return PTR_ERR(adc_dev->adc_32k_clk); ++ } ++ ret = clk_prepare_enable(adc_dev->adc_32k_clk); ++ if (ret) { ++ dev_err(&pdev->dev, "failed to enable auxadc 32k clock\n"); ++ return ret; + } + adc_clk_rate = clk_get_rate(adc_dev->adc_clk); |