* [PATCH] i2c: designware: Add clk_{un}prepare() support @ 2012-04-17 8:53 Viresh Kumar [not found] ` <caa4a0645f80f199b31ec16de37a5c4c9c67a6fa.1334652570.git.viresh.kumar-qxv4g6HH51o@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Viresh Kumar @ 2012-04-17 8:53 UTC (permalink / raw) To: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, ben-linux-elnMNo+KYs3YtjvyW6yDsg Cc: spear-devel-nkJGhpqTU55BDgjK7y7TUQ, viresh.linux-Re5JQEeQqe8AvxtiuMwx3w, khali-PUYAD+kWke1g9hUCZPvPmw, linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Viresh Kumar clk_{un}prepare is mandatory for platforms using common clock framework. Since this driver is used by SPEAr platform, which supports common clock framework, add clk_{un}prepare() support for designware i2c. Signed-off-by: Viresh Kumar <viresh.kumar-qxv4g6HH51o@public.gmane.org> --- drivers/i2c/busses/i2c-designware-platdrv.c | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 76bf108..7b50eec 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -97,13 +97,20 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev) platform_set_drvdata(pdev, dev); dev->clk = clk_get(&pdev->dev, NULL); - dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz; - if (IS_ERR(dev->clk)) { r = -ENODEV; goto err_free_mem; } - clk_enable(dev->clk); + + r = clk_prepare(dev->clk); + if (r) + goto err_put_clk; + + r = clk_enable(dev->clk); + if (r) + goto err_unprepare_clk; + + dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz; dev->functionality = I2C_FUNC_I2C | @@ -181,6 +188,9 @@ err_iounmap: iounmap(dev->base); err_unuse_clocks: clk_disable(dev->clk); +err_unprepare_clk: + clk_unprepare(dev->clk); +err_put_clk: clk_put(dev->clk); dev->clk = NULL; err_free_mem: @@ -203,6 +213,7 @@ static int __devexit dw_i2c_remove(struct platform_device *pdev) put_device(&pdev->dev); clk_disable(dev->clk); + clk_unprepare(dev->clk); clk_put(dev->clk); dev->clk = NULL; @@ -230,6 +241,7 @@ static int dw_i2c_suspend(struct device *dev) struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev); clk_disable(i_dev->clk); + clk_unprepare(i_dev->clk); return 0; } @@ -239,6 +251,7 @@ static int dw_i2c_resume(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev); + clk_prepare(i_dev->clk); clk_enable(i_dev->clk); i2c_dw_init(i_dev); -- 1.7.9 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <caa4a0645f80f199b31ec16de37a5c4c9c67a6fa.1334652570.git.viresh.kumar-qxv4g6HH51o@public.gmane.org>]
* [PATCH V2] i2c: designware: Add clk_{un}prepare() support [not found] ` <caa4a0645f80f199b31ec16de37a5c4c9c67a6fa.1334652570.git.viresh.kumar-qxv4g6HH51o@public.gmane.org> @ 2012-04-17 11:34 ` Viresh Kumar 2012-04-22 17:26 ` Wolfram Sang 0 siblings, 1 reply; 6+ messages in thread From: Viresh Kumar @ 2012-04-17 11:34 UTC (permalink / raw) To: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, ben-linux-elnMNo+KYs3YtjvyW6yDsg Cc: spear-devel-nkJGhpqTU55BDgjK7y7TUQ, viresh.linux-Re5JQEeQqe8AvxtiuMwx3w, khali-PUYAD+kWke1g9hUCZPvPmw, linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Viresh Kumar clk_{un}prepare is mandatory for platforms using common clock framework. Since this driver is used by SPEAr platform, which supports common clock framework, add clk_{un}prepare() support for designware i2c. Signed-off-by: Viresh Kumar <viresh.kumar-qxv4g6HH51o@public.gmane.org> --- V1->V2: - Use clk_prepare_enable and clk_disable_unprepare drivers/i2c/busses/i2c-designware-platdrv.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 76bf108..3a7a4e8 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -103,7 +103,7 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev) r = -ENODEV; goto err_free_mem; } - clk_enable(dev->clk); + clk_prepare_enable(dev->clk); dev->functionality = I2C_FUNC_I2C | @@ -180,7 +180,7 @@ err_free_irq: err_iounmap: iounmap(dev->base); err_unuse_clocks: - clk_disable(dev->clk); + clk_disable_unprepare(dev->clk); clk_put(dev->clk); dev->clk = NULL; err_free_mem: @@ -202,7 +202,7 @@ static int __devexit dw_i2c_remove(struct platform_device *pdev) i2c_del_adapter(&dev->adapter); put_device(&pdev->dev); - clk_disable(dev->clk); + clk_disable_unprepare(dev->clk); clk_put(dev->clk); dev->clk = NULL; @@ -229,7 +229,7 @@ static int dw_i2c_suspend(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev); - clk_disable(i_dev->clk); + clk_disable_unprepare(i_dev->clk); return 0; } @@ -239,7 +239,7 @@ static int dw_i2c_resume(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev); - clk_enable(i_dev->clk); + clk_prepare_enable(i_dev->clk); i2c_dw_init(i_dev); return 0; -- 1.7.9 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH V2] i2c: designware: Add clk_{un}prepare() support 2012-04-17 11:34 ` [PATCH V2] " Viresh Kumar @ 2012-04-22 17:26 ` Wolfram Sang 2012-04-22 17:38 ` viresh kumar 0 siblings, 1 reply; 6+ messages in thread From: Wolfram Sang @ 2012-04-22 17:26 UTC (permalink / raw) To: Viresh Kumar Cc: ben-linux, spear-devel, viresh.linux, khali, linux-i2c, linux-kernel [-- Attachment #1: Type: text/plain, Size: 566 bytes --] On Tue, Apr 17, 2012 at 05:04:31PM +0530, Viresh Kumar wrote: > clk_{un}prepare is mandatory for platforms using common clock framework. Since > this driver is used by SPEAr platform, which supports common clock framework, > add clk_{un}prepare() support for designware i2c. > > Signed-off-by: Viresh Kumar <viresh.kumar@st.com> ? Can't apply, which version is this against? Looks good otherwise. -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2] i2c: designware: Add clk_{un}prepare() support 2012-04-22 17:26 ` Wolfram Sang @ 2012-04-22 17:38 ` viresh kumar [not found] ` <CAOh2x=mHS9h6kHxw2of-XWTtv35-SHRRno9Jdkb_3HuDoAovAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: viresh kumar @ 2012-04-22 17:38 UTC (permalink / raw) To: Wolfram Sang Cc: Viresh Kumar, ben-linux, spear-devel, khali, linux-i2c, linux-kernel On 4/22/12, Wolfram Sang <w.sang@pengutronix.de> wrote: > On Tue, Apr 17, 2012 at 05:04:31PM +0530, Viresh Kumar wrote: >> clk_{un}prepare is mandatory for platforms using common clock framework. >> Since >> this driver is used by SPEAr platform, which supports common clock >> framework, >> add clk_{un}prepare() support for designware i2c. >> >> Signed-off-by: Viresh Kumar <viresh.kumar@st.com> > > ? Can't apply, which version is this against? Looks good otherwise. Because following is waiting in you todo list and must be applied before this one: :) Author: Deepak Sikri <deepak.sikri@st.com> Date: Mon Sep 26 18:42:10 2011 +0530 i2c/busses: Add PM support This patch adds in support for standby/S2R/hybernate for i2c-designware driver. Signed-off-by: Deepak Sikri <deepak.sikri@st.com> Signed-off-by: Rajeev Kumar <rajeev-dlh.kumar@st.com> --- drivers/i2c/busses/i2c-designware-platdrv.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) Actually suspend/resume of above are also fixed by this patch. What are your plans for following patchset: i2c/adapter: Add bus recovery infrastructure Would be good if you can apply that or ask for another version if you see some shortcomings. Otherwise this kind of issues will happen again. Please allocate some time for this, it is really important for other bus drivers. All controllers/slaves have that bug. They will be fixed only once this is applied. :) -- viresh ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAOh2x=mHS9h6kHxw2of-XWTtv35-SHRRno9Jdkb_3HuDoAovAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH V2] i2c: designware: Add clk_{un}prepare() support [not found] ` <CAOh2x=mHS9h6kHxw2of-XWTtv35-SHRRno9Jdkb_3HuDoAovAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2012-04-22 18:38 ` Wolfram Sang [not found] ` <20120422183806.GB24810-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Wolfram Sang @ 2012-04-22 18:38 UTC (permalink / raw) To: viresh kumar Cc: Viresh Kumar, ben-linux-elnMNo+KYs3YtjvyW6yDsg, spear-devel-nkJGhpqTU55BDgjK7y7TUQ, khali-PUYAD+kWke1g9hUCZPvPmw, linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 1170 bytes --] On Sun, Apr 22, 2012 at 11:08:55PM +0530, viresh kumar wrote: > On 4/22/12, Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote: > > On Tue, Apr 17, 2012 at 05:04:31PM +0530, Viresh Kumar wrote: > >> clk_{un}prepare is mandatory for platforms using common clock framework. > >> Since > >> this driver is used by SPEAr platform, which supports common clock > >> framework, > >> add clk_{un}prepare() support for designware i2c. > >> > >> Signed-off-by: Viresh Kumar <viresh.kumar-qxv4g6HH51o@public.gmane.org> > > > > ? Can't apply, which version is this against? Looks good otherwise. > > Because following is waiting in you todo list and must be applied > before this one: :) Okay, thanks, both applied to next. If you mention dependencies somewhere when submitting, that might speed things, a tiny bit at least. > What are your plans for following patchset: > i2c/adapter: Add bus recovery infrastructure My plans are to get them into 3.5. Regards, Wolfram -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20120422183806.GB24810-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH V2] i2c: designware: Add clk_{un}prepare() support [not found] ` <20120422183806.GB24810-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2012-04-24 3:31 ` Viresh Kumar 0 siblings, 0 replies; 6+ messages in thread From: Viresh Kumar @ 2012-04-24 3:31 UTC (permalink / raw) To: Wolfram Sang Cc: viresh kumar, ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, spear-devel, khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On 4/23/2012 12:08 AM, Wolfram Sang wrote: > Okay, thanks, both applied to next. If you mention dependencies somewhere > when submitting, that might speed things, a tiny bit at least. I normally do this. But forgot it this time myself too, that this patch had a dependency :( -- viresh ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-04-24 3:31 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-04-17 8:53 [PATCH] i2c: designware: Add clk_{un}prepare() support Viresh Kumar [not found] ` <caa4a0645f80f199b31ec16de37a5c4c9c67a6fa.1334652570.git.viresh.kumar-qxv4g6HH51o@public.gmane.org> 2012-04-17 11:34 ` [PATCH V2] " Viresh Kumar 2012-04-22 17:26 ` Wolfram Sang 2012-04-22 17:38 ` viresh kumar [not found] ` <CAOh2x=mHS9h6kHxw2of-XWTtv35-SHRRno9Jdkb_3HuDoAovAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2012-04-22 18:38 ` Wolfram Sang [not found] ` <20120422183806.GB24810-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2012-04-24 3:31 ` Viresh Kumar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).