i2c: tegra: Code cleanups and suspend/resume related changes
Laxman Dewangan
maintainercover i2c: tegra: Code cleanups and suspend/resume related changes
This patch series does:
- Code cleanups like removing unused variables, using already define function
- Use clock_disable_unprepare in place of clock_disable()
- Use dev_pm_ops for suspend/resume inplace of legacy suspend/resume callbacks.
- Convert suspend/resume to _noirq version to support late suspend/early resume.
Laxman Dewangan (5):
i2c: tegra: remove unused member variable
i2c: tegra: use clk_disable_unprepare in place of clk_disable
i2c: tegra: use of_match_ptr() for match_table initialization
i2c: tegra: Use struct dev_pm_ops for power management
i2c: tegra: convert normal suspend/resume to *_noirq
drivers/i2c/busses/i2c-tegra.c | 27 +++++++++++++++------------ 1 files changed, 15 insertions(+), 12 deletions(-)
Laxman Dewangan
maintainerPATCH 1/5 i2c: tegra: remove unused member variable
Remove unused member variable "iomem" of the
i2c device structure.
---
This patch is resend of earlier patch
i2c: tegra: remove unused member variable.
and sending it as part fo series.
drivers/i2c/busses/i2c-tegra.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-tegra.c +0 -2
@@ -119,7 +119,6 @@ enum msg_end_type {* @adapter: core i2c layer adapter information * @clk: clock reference for i2c controller * @i2c_clk: clock reference for i2c bus -* @iomem: memory resource for registers * @base: ioremapped registers cookie * @cont_id: i2c controller id, used for for packet header * @irq: irq number of transfer complete interrupt
@@ -137,7 +136,6 @@ struct tegra_i2c_dev {struct i2c_adapter adapter;struct clk *clk;struct clk *i2c_clk; -struct resource *iomem;void __iomem *base;int cont_id;int irq;
Signature · 1 line
1.7.1.1
Laxman Dewangan
maintainerPATCH 2/5 i2c: tegra: use clk_disable_unprepare in place of clk_disable
In reply to Laxman DewanganUse clk_disable_unprepare() inplace of clk_disable(). This was missed as part of moving clock enable/disable to prepare/unprepare for using the common clock framework.
---
This is already discussed in patch
[PATCH] i2c: tegra: use clk_disable_unprepare in place of clk_disable for applying in Wolfram Tree. Resending this as patch series.
drivers/i2c/busses/i2c-tegra.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-tegra.c +1 -1
@@ -696,7 +696,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev) ret =i2c_add_numbered_adapter (&i2c_dev->adapter);if (ret) {dev_err (&pdev->dev,"Failed to add I2C adapter\n" ); -clk_disable (i2c_dev->i2c_clk); +clk_disable_unprepare (i2c_dev->i2c_clk);return ret; }
Signature · 1 line
1.7.1.1
Laxman Dewangan
maintainerPATCH 3/5 i2c: tegra: use of_match_ptr() for match_table initialization
In reply to Laxman DewanganIn place of defining match_table for non-DT based as NULL, use of_match_ptr() for initialzing the of_match_table.
--- drivers/i2c/busses/i2c-tegra.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-tegra.c +1 -3
@@ -754,8 +754,6 @@ static const struct of_device_id tegra_i2c_of_match[] __devinitconst = { {}, };MODULE_DEVICE_TABLE (of, tegra_i2c_of_match); -#else -#define tegra_i2c_of_match NULL#endif static struct platform_driver tegra_i2c_driver = {
@@ -768,7 +766,7 @@ static struct platform_driver tegra_i2c_driver = { .driver = { .name = "tegra-i2c", .owner = THIS_MODULE, - .of_match_table = tegra_i2c_of_match, + .of_match_table = of_match_ptr(tegra_i2c_of_match), }, };
Signature · 1 line
1.7.1.1
Laxman Dewangan
maintainerPATCH 4/5 i2c: tegra: Use struct dev_pm_ops for power management
In reply to Laxman DewanganMake the tegra i2c driver define its PM callbacks through struct dev_pm_ops objects rather than by using legacy PM hooks in struct platform_driver.
--- drivers/i2c/busses/i2c-tegra.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-tegra.c +13 -6
@@ -713,8 +713,9 @@ static int __devexit tegra_i2c_remove(struct platform_device *pdev) }#ifdef CONFIG_PM -static int tegra_i2c_suspend (struct platform_device *pdev,pm_message_t state) +static int tegra_i2c_suspend (struct device *dev) { +struct platform_device *pdev =to_platform_device (dev);struct tegra_i2c_dev *i2c_dev =platform_get_drvdata (pdev);i2c_lock_adapter (&i2c_dev->adapter);
@@ -724,8 +725,9 @@ static int tegra_i2c_suspend(struct platform_device *pdev, pm_message_t state)return 0 ; } -static int tegra_i2c_resume (struct platform_device *pdev) +static int tegra_i2c_resume (struct device *dev) { +struct platform_device *pdev =to_platform_device (dev);struct tegra_i2c_dev *i2c_dev =platform_get_drvdata (pdev);int ret;
@@ -744,6 +746,14 @@ static int tegra_i2c_resume(struct platform_device *pdev) return 0; } + +static const struct dev_pm_ops tegra_i2c_dev_pm_ops = { + .suspend = tegra_i2c_suspend, + .resume = tegra_i2c_resume, +}; +#define TEGRA_I2C_DEV_PM_OPS (&tegra_i2c_dev_pm_ops) +#else +#define TEGRA_I2C_DEV_PM_OPS NULL#endif #if defined(CONFIG_OF )
@@ -759,14 +769,11 @@ MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);static struct platform_driver tegra_i2c_driver = { .probe = tegra_i2c_probe, .remove =__devexit_p (tegra_i2c_remove), -#ifdef CONFIG_PM - .suspend = tegra_i2c_suspend, - .resume = tegra_i2c_resume, -#endif .driver = { .name ="tegra-i2c" , .owner =THIS_MODULE , .of_match_table =of_match_ptr (tegra_i2c_of_match), + .pm =TEGRA_I2C_DEV_PM_OPS , }, };
Signature · 1 line
1.7.1.1
Laxman Dewangan
maintainerPATCH 5/5 i2c: tegra: convert normal suspend/resume to *_noirq
In reply to Laxman DewanganTo provide the late suspend and early resume for i2c driver, convert the suspend/resume as
suspend-> suspend_noirq resume -> resume_noirq
--- drivers/i2c/busses/i2c-tegra.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-tegra.c +4 -4
@@ -713,7 +713,7 @@ static int __devexit tegra_i2c_remove(struct platform_device *pdev) }#ifdef CONFIG_PM -static int tegra_i2c_suspend (struct device *dev) +static int tegra_i2c_suspend_noirq (struct device *dev) {struct platform_device *pdev =to_platform_device (dev);struct tegra_i2c_dev *i2c_dev =platform_get_drvdata (pdev);
@@ -725,7 +725,7 @@ static int tegra_i2c_suspend(struct device *dev)return 0 ; } -static int tegra_i2c_resume (struct device *dev) +static int tegra_i2c_resume_noirq (struct device *dev) {struct platform_device *pdev =to_platform_device (dev);struct tegra_i2c_dev *i2c_dev =platform_get_drvdata (pdev);
@@ -748,8 +748,8 @@ static int tegra_i2c_resume(struct device *dev) }static const struct dev_pm_ops tegra_i2c_dev_pm_ops = { - .suspend = tegra_i2c_suspend, - .resume = tegra_i2c_resume, + .suspend_noirq = tegra_i2c_suspend_noirq, + .resume_noirq = tegra_i2c_resume_noirq, };#define TEGRA_I2C_DEV_PM_OPS (&tegra_i2c_dev_pm_ops)#else
Signature · 1 line
1.7.1.1
Re: [PATCH 1/5] i2c: tegra: remove unused member variable
In reply to Laxman DewanganHi Laxman,
Quoted 2 lines · Laxman Dewangan
Remove unused member variable "iomem" of the
i2c device structure.
You might want to mention the commit which removed the last usage etc.
Quoted 7 lines
Signed-off-by Laxman Dewangan <[email protected]>---
This patch is resend of earlier patch
i2c: tegra: remove unused member variable.
and sending it as part fo series.
Re: [PATCH 2/5] i2c: tegra: use clk_disable_unprepare in place of clk_disable
In reply to Laxman DewanganQuoted 5 lines · Laxman Dewangan
Use
clk_disable_unprepare()inplace ofclk_disable(). This was missed as part of moving clock enable/disable to prepare/unprepare for using the common clock framework.Signed-off-by Laxman Dewangan <[email protected]>
OK, as per the previous discussion, I applied it to my next-branch.
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Wolfram Sang
AppliedRe: [PATCH 3/5] i2c: tegra: use of_match_ptr() for match_table initialization
In reply to Laxman DewanganQuoted 4 lines · Laxman Dewangan
In place of defining
match_tablefor non-DT based as NULL, useof_match_ptr()for initialzing theof_match_table.Signed-off-by Laxman Dewangan <[email protected]>
Applied to next, thanks.
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 4/5] i2c: tegra: Use struct dev_pm_ops for power management
In reply to Laxman DewanganQuoted 14 lines · Laxman Dewangan
Make the tegra i2c driver define its PM callbacks through struct
dev_pm_opsobjects rather than by using legacy PM hooks in structplatform_driver.Signed-off-by Laxman Dewangan <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-)drivers/i2c/busses/i2c-tegra.c +0
-0
drivers/i2c/busses/i2c-tegra.c static int __devexit tegra_i2c_remove(struct platform_device *pdev) · line 719
Quoted 8 lines
drivers/i2c/busses/i2c-tegra.c +2
-1@@ -713,8 +713,9 @@ static int __devexit tegra_i2c_remove(struct platform_device *pdev) }#ifdef CONFIG_PM -static int tegra_i2c_suspend (struct platform_device *pdev,pm_message_t state) +static int tegra_i2c_suspend (struct device *dev) { +struct platform_device *pdev =to_platform_device (dev);struct tegra_i2c_dev *i2c_dev =platform_get_drvdata (pdev);
I like Rafael's patch better because of dev_get_drvdata. I'll pick his and add your 5/5 on top of that.
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Laxman Dewangan
maintainerRe: [PATCH 5/5] i2c: tegra: convert normal suspend/resume to *_noirq
In reply to Wolfram SangQuoted 11 lines · Wolfram Sang
* PGP Signed by an unknown key
Quoted 6 lines · Laxman Dewangan
To provide the late suspend and early resume for i2c driver, convert the suspend/resume as
suspend-> suspend_noirq resume -> resume_noirqSigned-off-by Laxman Dewangan<[email protected]>Applied to next on top of Rafael's patches. Please have a look if I did the fixup right.
Thanks for taking care.
Can you please point me your git path so that I can verify it?
Thanks,
Laxman
Re: [PATCH 5/5] i2c: tegra: convert normal suspend/resume to *_noirq
In reply to Laxman DewanganQuoted 6 lines · Laxman Dewangan
To provide the late suspend and early resume for i2c driver, convert the suspend/resume as
suspend-> suspend_noirq resume -> resume_noirqSigned-off-by Laxman Dewangan <[email protected]>
Applied to next on top of Rafael's patches. Please have a look if I did the fixup right.
Thanks,
Wolfram
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Laxman Dewangan
maintainerRe: [PATCH 5/5] i2c: tegra: convert normal suspend/resume to *_noirq
In reply to Wolfram SangQuoted 10 lines · Wolfram Sang
* PGP Signed by an unknown key
Quoted 1 line
Can you please point me your git path so that I can verify it?
git://git.pengutronix.de/git/wsa/linux.giti2c-embedded/for-nextor
http://git.pengutronix.de/?p=wsa/linux.git;a=shortlog;h=refs/heads/i2c-embedded/for-next
The change is fine. No issue here.
Thanks,
Laxman
Re: [PATCH 5/5] i2c: tegra: convert normal suspend/resume to *_noirq
In reply to Laxman DewanganQuoted 2 lines
Can you please point me your git path so that I can verify it?
git://git.pengutronix.de/git/wsa/linux.git i2c-embedded/for-next
or
http://git.pengutronix.de/?p=wsa/linux.git;a=shortlog;h=refs/heads/i2c-embedded/for-next
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 5/5] i2c: tegra: convert normal suspend/resume to *_noirq
In reply to Laxman DewanganQuoted 6 lines · Laxman Dewangan
To provide the late suspend and early resume for i2c driver, convert the suspend/resume as
suspend-> suspend_noirq resume -> resume_noirqSigned-off-by Laxman Dewangan <[email protected]>
Why do we need this change?
IIRC, I proposed it before solely to solve some suspend/resume ordering issues, and Colin Cross NAKd it. These days, deferred probe should make this change unnecessary.
Unless there's a really good reason for this change, I'd tend to request reverting it.
Re: [PATCH 5/5] i2c: tegra: convert normal suspend/resume to *_noirq
Quoted 6 lines · Stephen Warren
Quoted 5 lines · Laxman Dewangan
To provide the late suspend and early resume for i2c driver, convert the suspend/resume as
suspend-> suspend_noirq resume -> resume_noirq
Quoted 8 lines
Quoted 1 line
Signed-off-by Laxman Dewangan <[email protected]>Why do we need this change?
IIRC, I proposed it before solely to solve some suspend/resume ordering issues, and Colin Cross NAKd it. These days, deferred probe should make this change unnecessary.
How does deferred probe solve this? Iirc the problem is that i2c is needed to talk to the PMIC, so we need to make sure i2c is shutdown last because drivers might want to do regulator control in the suspend function.
Cheers,
Peter.
Re: [PATCH 5/5] i2c: tegra: convert normal suspend/resume to *_noirq
Quoted 9 lines · Peter De Schrijver
Quoted 3 lines · Stephen Warren
IIRC, I proposed it before solely to solve some suspend/resume ordering issues, and Colin Cross NAKd it. These days, deferred probe should make this change unnecessary.
How does deferred probe solve this? Iirc the problem is that i2c is needed to talk to the PMIC, so we need to make sure i2c is shutdown last because drivers might want to do regulator control in the suspend function.
With probe deferral the drivers will be after the regulator driver in the DPM list and so be suspended first.
Re: [PATCH 5/5] i2c: tegra: convert normal suspend/resume to *_noirq
In reply to Stephen WarrenQuoted 8 lines · Stephen Warren
Quoted 6 lines · Laxman Dewangan
To provide the late suspend and early resume for i2c driver, convert the suspend/resume as
suspend-> suspend_noirq resume -> resume_noirqSigned-off-by Laxman Dewangan <[email protected]>
Quoted 8 lines
Why do we need this change?
IIRC, I proposed it before solely to solve some suspend/resume ordering issues, and Colin Cross NAKd it. These days, deferred probe should make this change unnecessary.
Unless there's a really good reason for this change, I'd tend to request reverting it.
I will drop it from my tree and exclude it from my pull request. Please resend if it should go in later.
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |