i2c: designware: Keep pm_runtime_enable/_disable calls in sync
Subsystems (3)
PATCH 1/2 i2c: designware: Keep pm_runtime_enable/_disable calls in sync
On an hardware shared I2C bus (certain Intel Baytrail SoC platforms) the runtime PM disable depth keeps increasing over repeated modprobe/rmmod cycle because pm_runtime_disable() is called without checking should it be disabled already because of bus sharing.
This hasn't made any other harm than dev->power.disable_depth keeps increasing but keep it sync by calling pm_runtime_disable() only when runtime PM is not disabled.
--- drivers/i2c/busses/i2c-designware-platdrv.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-designware-platdrv.c +4 -5
@@ -240,12 +240,10 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) } r =i2c_dw_probe (dev); -if (r) { +if (r && !dev->pm_runtime_disabled)pm_runtime_disable (&pdev->dev); -return r; - } -return 0 ; +return r; }static int dw_i2c_plat_remove (struct platform_device *pdev)
@@ -260,7 +258,8 @@ static int dw_i2c_plat_remove(struct platform_device *pdev)pm_runtime_dont_use_autosuspend (&pdev->dev);pm_runtime_put_sync (&pdev->dev); -pm_runtime_disable (&pdev->dev); +if (!dev->pm_runtime_disabled) +pm_runtime_disable (&pdev->dev);return 0 ; }
Signature · 1 line
2.6.2
PATCH 2/2 i2c: designware: Allow build Baytrail semaphore support when IOSF_MBI=m
I believe i2c-designware-baytrail.c doesn't have strict dependency that Intel SoC IOSF Sideband support must be always built-in in order to be able to compile support for Intel Baytrail I2C bus sharing HW semaphore.
Redefine build dependencies so that CONFIG_IOSF_MBI=y is required only when CONFIG_I2C_DESIGNWARE_PLATFORM is built-in.
---
Hi David. Can you ack/nak this patch as I'm not fully familiar with this HW semaphore can there be problems when IOSF_MBI is built as a module. At least I'm getting similar sensible looking "punit semaphore acquired/held for x ms" debug messages when I modprobe/rmmod i2c_designware_platform independently is the CONFIG_IOSF_MBI=y or =m.
--- drivers/i2c/busses/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/i2c/busses/Kconfig +3 -1
@@ -490,7 +490,9 @@ config I2C_DESIGNWARE_PCI config I2C_DESIGNWARE_BAYTRAIL bool "Intel Baytrail I2C semaphore support" - depends on I2C_DESIGNWARE_PLATFORM && IOSF_MBI=y && ACPI + depends on ACPI + depends on (I2C_DESIGNWARE_PLATFORM=m && IOSF_MBI) || \ + (I2C_DESIGNWARE_PLATFORM=y && IOSF_MBI=y) help This driver enables managed host access to the PMIC I2C bus on select Intel BayTrail platforms using the X-Powers AXP288 PMIC. It allows
Signature · 1 line
2.6.2
Andy Shevchenko
reviewerRe: [PATCH 2/2] i2c: designware: Allow build Baytrail semaphore support when IOSF_MBI=m
Quoted 34 lines · Jarkko Nikula
I believe
i2c-designware-baytrail.cdoesn't have strict dependency that
Intel SoC IOSF Sideband support must be always built-in in order to be
able to compile support for Intel Baytrail I2C bus sharing HW semaphore.Redefine build dependencies so that
CONFIG_IOSF_MBI=yis required only
whenCONFIG_I2C_DESIGNWARE_PLATFORMis built-in.Signed-off-by Jarkko Nikula <[email protected]>---
Hi David. Can you ack/nak this patch as I'm not fully familiar with this
HW semaphore can there be problems whenIOSF_MBIis built as a module.At least I'm getting similar sensible looking "punit semaphore acquired/held for x ms" debug messages when I modprobe/rmmod
i2c_designware_platformindependently is theCONFIG_IOSF_MBI=yor =m.
---
drivers/i2c/busses/Kconfig | 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/i2c/busses/Kconfig +0
-0@@ -490,7 +490,9 @@ config I2C_DESIGNWARE_PCI
configI2C_DESIGNWARE_BAYTRAIL
bool "Intel Baytrail I2C semaphore support"
drivers/i2c/busses/Kconfig config I2C_DESIGNWARE_PCI · line 495
Quoted 4 lines
drivers/i2c/busses/Kconfig +3
-1- depends on I2C_DESIGNWARE_PLATFORM && IOSF_MBI=y && ACPI + depends on ACPI + depends on (I2C_DESIGNWARE_PLATFORM=m && IOSF_MBI) || \ + (I2C_DESIGNWARE_PLATFORM=y && IOSF_MBI=y)
Would it be more readable in the following way
depends on ACPI
depends on I2C_DESIGNWARE_PLATFORM
depends on IOSF_MBI if I2C_DESIGNWARE_PLATFORM=m depends on IOSF_MBI=y if I2C_DESIGNWARE_PLATFORM=y
Quoted 5 lines
help
This driver enables managed host access to the PMIC I2C bus on select
Intel BayTrail platforms using the X-Powers AXP288 PMIC. It allows
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Re: [PATCH 2/2] i2c: designware: Allow build Baytrail semaphore support when IOSF_MBI=m
Quoted 42 lines · Andy Shevchenko
Quoted 31 lines · Jarkko Nikula
I believe
i2c-designware-baytrail.cdoesn't have strict dependency that
Intel SoC IOSF Sideband support must be always built-in in order to be
able to compile support for Intel Baytrail I2C bus sharing HW semaphore.Redefine build dependencies so that
CONFIG_IOSF_MBI=yis required only
whenCONFIG_I2C_DESIGNWARE_PLATFORMis built-in.Signed-off-by Jarkko Nikula <[email protected]>---
Hi David. Can you ack/nak this patch as I'm not fully familiar with this
HW semaphore can there be problems whenIOSF_MBIis built as a module.At least I'm getting similar sensible looking "punit semaphore acquired/held for x ms" debug messages when I modprobe/rmmod
i2c_designware_platformindependently is theCONFIG_IOSF_MBI=yor =m.--- drivers/i2c/busses/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/i2c/busses/Kconfig +0
-0drivers/i2c/busses/Kconfig config I2C_DESIGNWARE_PCI · line 495
Quoted 7 lines
drivers/i2c/busses/Kconfig +3
-1@@ -490,7 +490,9 @@ config I2C_DESIGNWARE_PCI config I2C_DESIGNWARE_BAYTRAIL bool "Intel Baytrail I2C semaphore support" - depends on I2C_DESIGNWARE_PLATFORM && IOSF_MBI=y && ACPI + depends on ACPI + depends on (I2C_DESIGNWARE_PLATFORM=m && IOSF_MBI) || \ + (I2C_DESIGNWARE_PLATFORM=y && IOSF_MBI=y)Would it be more readable in the following way
Quoted 5 lines
depends on ACPI
depends onI2C_DESIGNWARE_PLATFORM
depends onIOSF_MBIif I2C_DESIGNWARE_PLATFORM=m depends on IOSF_MBI=y if I2C_DESIGNWARE_PLATFORM=y
For my eyes it looks a bit more complex but I think it's matter of taste. However, the syntax you are proposing is not supported for "depends on" like it is for "select" statements.
Signature · 1 line
Jarkko
Re: [PATCH 2/2] i2c: designware: Allow build Baytrail semaphore support when IOSF_MBI=m
Quoted 43 lines · Jarkko Nikula
Quoted 42 lines · Andy Shevchenko
Quoted 31 lines · Jarkko Nikula
I believe
i2c-designware-baytrail.cdoesn't have strict dependency that
Intel SoC IOSF Sideband support must be always built-in in order to be
able to compile support for Intel Baytrail I2C bus sharing HW semaphore.Redefine build dependencies so that
CONFIG_IOSF_MBI=yis required only
whenCONFIG_I2C_DESIGNWARE_PLATFORMis built-in.Signed-off-by Jarkko Nikula <[email protected]>---
Hi David. Can you ack/nak this patch as I'm not fully familiar with this
HW semaphore can there be problems whenIOSF_MBIis built as a module.At least I'm getting similar sensible looking "punit semaphore acquired/held for x ms" debug messages when I modprobe/rmmod
i2c_designware_platformindependently is theCONFIG_IOSF_MBI=yor =m.--- drivers/i2c/busses/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/i2c/busses/Kconfig +0
-0drivers/i2c/busses/Kconfig config I2C_DESIGNWARE_PCI · line 495
Quoted 7 lines
drivers/i2c/busses/Kconfig +3
-1@@ -490,7 +490,9 @@ config I2C_DESIGNWARE_PCI config I2C_DESIGNWARE_BAYTRAIL bool "Intel Baytrail I2C semaphore support" - depends on I2C_DESIGNWARE_PLATFORM && IOSF_MBI=y && ACPI + depends on ACPI + depends on (I2C_DESIGNWARE_PLATFORM=m && IOSF_MBI) || \ + (I2C_DESIGNWARE_PLATFORM=y && IOSF_MBI=y)Would it be more readable in the following way
Quoted 8 lines
Quoted 5 lines
depends on ACPI
depends onI2C_DESIGNWARE_PLATFORM
depends onIOSF_MBIif I2C_DESIGNWARE_PLATFORM=m depends on IOSF_MBI=y if I2C_DESIGNWARE_PLATFORM=yFor my eyes it looks a bit more complex but I think it's matter of taste. However, the syntax you are proposing is not supported for "depends on" like it is for "select" statements.
Any news? David?
Re: [PATCH 2/2] i2c: designware: Allow build Baytrail semaphore support when IOSF_MBI=m
In reply to Jarkko NikulaHi
Sorry I missed this discussion. I believe the following code in i2c_dw_eval_lock_support() should make it so that it doesn't matter how IOSF_MBI is built:
if (!iosf_mbi_available())
return -EPROBE_DEFER;
I added this to address i2c_designware probing before iosf_mbi. It worked but I do not recall if IOSF_MBI=m was the problem scenario. If so you can just change it to:
depends in I2C_DESIGNWARE_PLATFORM && IOSF_MBI
Give me a few days to confirm on my Baytrail device.
David
Quoted 36 lines · Jarkko Nikula
I believe
i2c-designware-baytrail.cdoesn't have strict dependency that Intel SoC IOSF Sideband support must be always built-in in order to be able to compile support for Intel Baytrail I2C bus sharing HW semaphore.Redefine build dependencies so that
CONFIG_IOSF_MBI=yis required only whenCONFIG_I2C_DESIGNWARE_PLATFORMis built-in.Signed-off-by Jarkko Nikula <[email protected]>---
Hi David. Can you ack/nak this patch as I'm not fully familiar with this HW semaphore can there be problems whenIOSF_MBIis built as a module. At least I'm getting similar sensible looking "punit semaphore acquired/held for x ms" debug messages when I modprobe/rmmodi2c_designware_platformindependently is theCONFIG_IOSF_MBI=yor =m.--- drivers/i2c/busses/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/i2c/busses/Kconfig +3
-1@@ -490,7 +490,9 @@ config I2C_DESIGNWARE_PCI config I2C_DESIGNWARE_BAYTRAIL bool "Intel Baytrail I2C semaphore support" - depends on I2C_DESIGNWARE_PLATFORM && IOSF_MBI=y && ACPI + depends on ACPI + depends on (I2C_DESIGNWARE_PLATFORM=m && IOSF_MBI) || \ + (I2C_DESIGNWARE_PLATFORM=y && IOSF_MBI=y) help This driver enables managed host access to the PMIC I2C bus on select Intel BayTrail platforms using the X-Powers AXP288 PMIC. It allowsSignature · 1 line
2.6.2
Re: [PATCH 2/2] i2c: designware: Allow build Baytrail semaphore support when IOSF_MBI=m
Quoted 9 lines · David E. Box
Hi
Sorry I missed this discussion. I believe the following code in
i2c_dw_eval_lock_support()should make it so that it doesn't matter howIOSF_MBIis built:if (!iosf_mbi_available()) return -EPROBE_DEFER;
Quoted 7 lines
I added this to address
i2c_designwareprobing beforeiosf_mbi. It worked but I do not recall if IOSF_MBI=m was the problem scenario. If so you can just change it to:depends in I2C_DESIGNWARE_PLATFORM && IOSF_MBIGive me a few days to confirm on my Baytrail device.
What is the status here?
Re: [PATCH 2/2] i2c: designware: Allow build Baytrail semaphore support when IOSF_MBI=m
In reply to Jarkko NikulaQuoted 36 lines · Jarkko Nikula
I believe
i2c-designware-baytrail.cdoesn't have strict dependency that Intel SoC IOSF Sideband support must be always built-in in order to be able to compile support for Intel Baytrail I2C bus sharing HW semaphore.Redefine build dependencies so that
CONFIG_IOSF_MBI=yis required only whenCONFIG_I2C_DESIGNWARE_PLATFORMis built-in.Signed-off-by Jarkko Nikula <[email protected]>---
Hi David. Can you ack/nak this patch as I'm not fully familiar with this HW semaphore can there be problems whenIOSF_MBIis built as a module. At least I'm getting similar sensible looking "punit semaphore acquired/held for x ms" debug messages when I modprobe/rmmodi2c_designware_platformindependently is theCONFIG_IOSF_MBI=yor =m.--- drivers/i2c/busses/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/i2c/busses/Kconfig +3
-1@@ -490,7 +490,9 @@ config I2C_DESIGNWARE_PCI config I2C_DESIGNWARE_BAYTRAIL bool "Intel Baytrail I2C semaphore support" - depends on I2C_DESIGNWARE_PLATFORM && IOSF_MBI=y && ACPI + depends on ACPI + depends on (I2C_DESIGNWARE_PLATFORM=m && IOSF_MBI) || \ + (I2C_DESIGNWARE_PLATFORM=y && IOSF_MBI=y) help This driver enables managed host access to the PMIC I2C bus on select Intel BayTrail platforms using the X-Powers AXP288 PMIC. It allowsSignature · 1 line
2.6.2
Re: [PATCH 2/2] i2c: designware: Allow build Baytrail semaphore support when IOSF_MBI=m
In reply to Jarkko NikulaQuoted 8 lines · Jarkko Nikula
I believe
i2c-designware-baytrail.cdoesn't have strict dependency that Intel SoC IOSF Sideband support must be always built-in in order to be able to compile support for Intel Baytrail I2C bus sharing HW semaphore.Redefine build dependencies so that
CONFIG_IOSF_MBI=yis required only whenCONFIG_I2C_DESIGNWARE_PLATFORMis built-in.Signed-off-by Jarkko Nikula <[email protected]>
Finally applied to for-next, thanks!
Wolfram Sang
AppliedQuoted 10 lines · Jarkko Nikula
On an hardware shared I2C bus (certain Intel Baytrail SoC platforms) the runtime PM disable depth keeps increasing over repeated modprobe/rmmod cycle because
pm_runtime_disable()is called without checking should it be disabled already because of bus sharing.This hasn't made any other harm than
dev->power.disable_depthkeeps increasing but keep it sync by callingpm_runtime_disable()only when runtime PM is not disabled.Signed-off-by Jarkko Nikula <[email protected]>
Applied to for-current, thanks!