From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Andi Shyti <andi.shyti@kernel.org>
Cc: Dong Aisheng <aisheng.dong@nxp.com>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>, Wolfram Sang <wsa@kernel.org>,
Alexander Sverdlin <alexander.sverdlin@siemens.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
NXP Linux Team <linux-imx@nxp.com>,
linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v7 1/1] i2c: lpi2c: use clk notifier for rate changes
Date: Wed, 08 Nov 2023 07:46:12 +0100 [thread overview]
Message-ID: <22082032.EfDdHjke4D@steina-w> (raw)
In-Reply-To: <20231107212049.csimqzzvim5uecpa@zenone.zhora.eu>
Hi Andi,
Am Dienstag, 7. November 2023, 22:20:49 CET schrieb Andi Shyti:
> Hi Alexander,
>
> is it my mail client not working or is is your patch that has
> gone through something terribly bad?
I can't see anything obviously wrong. Can you elaborate?
Thanks
Alexander
> Andi
>
> On Tue, Nov 07, 2023 at 03:12:01PM +0100, Alexander Stein wrote:
> > * CLKLO = I2C_CLK_RATIO * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI/2 */
> >
> > static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx)
> > {
> >
> > @@ -207,7 +224,7 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct
> > *lpi2c_imx)>
> > lpi2c_imx_set_mode(lpi2c_imx);
> >
> > - clk_rate = clk_get_rate(lpi2c_imx->clks[0].clk);
> > + clk_rate = atomic_read(&lpi2c_imx->rate_per);
> >
> > if (!clk_rate)
> >
> > return -EINVAL;
> >
> > @@ -590,6 +607,27 @@ static int lpi2c_imx_probe(struct platform_device
> > *pdev)>
> > if (ret)
> >
> > return ret;
> >
> > + lpi2c_imx->clk_change_nb.notifier_call = lpi2c_imx_clk_change_cb;
> > + ret = devm_clk_notifier_register(&pdev->dev, lpi2c_imx->clks[0].clk,
> > + &lpi2c_imx->clk_change_nb);
> > + if (ret)
> > + return dev_err_probe(&pdev->dev, ret,
> > + "can't register peripheral clock
notifier\n");
> > + /*
> > + * Lock the clock rate to avoid rate change between clk_get_rate()
and
> > + * atomic_set()
> > + */
> > + ret = clk_rate_exclusive_get(lpi2c_imx->clks[0].clk);
> > + if (ret)
> > + return dev_err_probe(&pdev->dev, ret,
> > + "can't lock I2C peripheral clock
rate\n");
> > +
> > + atomic_set(&lpi2c_imx->rate_per, clk_get_rate(lpi2c_imx-
>clks[0].clk));
> > + clk_rate_exclusive_put(lpi2c_imx->clks[0].clk);
> > + if (!atomic_read(&lpi2c_imx->rate_per))
> > + return dev_err_probe(&pdev->dev, -EINVAL,
> > + "can't get I2C peripheral clock
rate\n");
> > +
> >
> > pm_runtime_set_autosuspend_delay(&pdev->dev, I2C_PM_TIMEOUT);
> > pm_runtime_use_autosuspend(&pdev->dev);
> > pm_runtime_get_noresume(&pdev->dev);
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
WARNING: multiple messages have this Message-ID (diff)
From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Andi Shyti <andi.shyti@kernel.org>
Cc: Dong Aisheng <aisheng.dong@nxp.com>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>, Wolfram Sang <wsa@kernel.org>,
Alexander Sverdlin <alexander.sverdlin@siemens.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
NXP Linux Team <linux-imx@nxp.com>,
linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v7 1/1] i2c: lpi2c: use clk notifier for rate changes
Date: Wed, 08 Nov 2023 07:46:12 +0100 [thread overview]
Message-ID: <22082032.EfDdHjke4D@steina-w> (raw)
In-Reply-To: <20231107212049.csimqzzvim5uecpa@zenone.zhora.eu>
Hi Andi,
Am Dienstag, 7. November 2023, 22:20:49 CET schrieb Andi Shyti:
> Hi Alexander,
>
> is it my mail client not working or is is your patch that has
> gone through something terribly bad?
I can't see anything obviously wrong. Can you elaborate?
Thanks
Alexander
> Andi
>
> On Tue, Nov 07, 2023 at 03:12:01PM +0100, Alexander Stein wrote:
> > * CLKLO = I2C_CLK_RATIO * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI/2 */
> >
> > static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx)
> > {
> >
> > @@ -207,7 +224,7 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct
> > *lpi2c_imx)>
> > lpi2c_imx_set_mode(lpi2c_imx);
> >
> > - clk_rate = clk_get_rate(lpi2c_imx->clks[0].clk);
> > + clk_rate = atomic_read(&lpi2c_imx->rate_per);
> >
> > if (!clk_rate)
> >
> > return -EINVAL;
> >
> > @@ -590,6 +607,27 @@ static int lpi2c_imx_probe(struct platform_device
> > *pdev)>
> > if (ret)
> >
> > return ret;
> >
> > + lpi2c_imx->clk_change_nb.notifier_call = lpi2c_imx_clk_change_cb;
> > + ret = devm_clk_notifier_register(&pdev->dev, lpi2c_imx->clks[0].clk,
> > + &lpi2c_imx->clk_change_nb);
> > + if (ret)
> > + return dev_err_probe(&pdev->dev, ret,
> > + "can't register peripheral clock
notifier\n");
> > + /*
> > + * Lock the clock rate to avoid rate change between clk_get_rate()
and
> > + * atomic_set()
> > + */
> > + ret = clk_rate_exclusive_get(lpi2c_imx->clks[0].clk);
> > + if (ret)
> > + return dev_err_probe(&pdev->dev, ret,
> > + "can't lock I2C peripheral clock
rate\n");
> > +
> > + atomic_set(&lpi2c_imx->rate_per, clk_get_rate(lpi2c_imx-
>clks[0].clk));
> > + clk_rate_exclusive_put(lpi2c_imx->clks[0].clk);
> > + if (!atomic_read(&lpi2c_imx->rate_per))
> > + return dev_err_probe(&pdev->dev, -EINVAL,
> > + "can't get I2C peripheral clock
rate\n");
> > +
> >
> > pm_runtime_set_autosuspend_delay(&pdev->dev, I2C_PM_TIMEOUT);
> > pm_runtime_use_autosuspend(&pdev->dev);
> > pm_runtime_get_noresume(&pdev->dev);
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-11-08 6:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-07 14:12 [PATCH v7 1/1] i2c: lpi2c: use clk notifier for rate changes Alexander Stein
2023-11-07 14:12 ` Alexander Stein
2023-11-07 21:20 ` Andi Shyti
2023-11-07 21:20 ` Andi Shyti
2023-11-08 6:46 ` Alexander Stein [this message]
2023-11-08 6:46 ` Alexander Stein
2023-11-08 9:15 ` Andi Shyti
2023-11-08 9:15 ` Andi Shyti
2023-11-08 9:18 ` Wolfram Sang
2023-11-08 9:18 ` Wolfram Sang
2023-11-08 10:26 ` Andi Shyti
2023-11-08 10:26 ` Andi Shyti
2023-11-08 23:38 ` Andi Shyti
2023-11-08 23:38 ` Andi Shyti
2023-11-09 7:54 ` Alexander Stein
2023-11-09 7:54 ` Alexander Stein
2023-11-09 9:10 ` Andi Shyti
2023-11-09 9:10 ` Andi Shyti
2023-11-10 12:27 ` Andi Shyti
2023-11-10 12:27 ` Andi Shyti
2023-11-14 12:27 ` Alexander Stein
2023-11-14 12:27 ` Alexander Stein
2023-12-19 16:56 ` Wolfram Sang
2023-12-19 16:56 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=22082032.EfDdHjke4D@steina-w \
--to=alexander.stein@ew.tq-group.com \
--cc=aisheng.dong@nxp.com \
--cc=alexander.sverdlin@siemens.com \
--cc=andi.shyti@kernel.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.