mfd: intel_soc_pmic_bxtwc: fix TMU interrupt index
Subsystems (9)
[email protected]
maintainerPATCH v2 1/8 mfd: intel_soc_pmic_bxtwc: fix TMU interrupt index
From: Kuppuswamy Sathyanarayanan <[email protected]>
TMU interrupts are registered as a separate interrupt chip, and hence it should start its interrupt index(BXTWC_TMU_IRQ) number from 0. But currently, BXTWC_TMU_IRQ is defined as part of enum bxtwc_irqs_level2 and its index value is 11. Since this index value is used when calculating .num_irqs of regmap_irq_chip_tmu, it incorrectly reports number of irqs as 12 instead of actual value of 1.
This patch fixes this issue by creating new enum of tmu irqs and resetting its starting index to 0.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Changes since v1:
* Removed code from commit message.
drivers/mfd/intel_soc_pmic_bxtwc.c +4 -1
@@ -94,7 +94,10 @@ enum bxtwc_irqs_level2 {BXTWC_GPIO0_IRQ ,BXTWC_GPIO1_IRQ , BXTWC_CRIT_IRQ, - BXTWC_TMU_IRQ, +}; + +enum bxtwc_irqs_tmu { +BXTWC_TMU_IRQ =0 , }; static const struct regmap_irq bxtwc_regmap_irqs[] = {
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v2 2/8 mfd: intel_soc_pmic_bxtwc: remove thermal second level irqs
From: Kuppuswamy Sathyanarayanan <[email protected]>
Since all second level thermal irqs are consumed by the same device(bxt_wcove_thermal), there is no need to expose them as separate interrupts. We can just export only the first level irqs for thermal and let the device(bxt_wcove_thermal) driver handle the second level irqs based on thermal interrupt status register. Also, just using only the first level irq will eliminate the bug involved in requesting only the second level irq and not explicitly enable the first level irq. For more info on this issue please read the details at,
https://lkml.org/lkml/2017/2/27/148
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-)
Changes since v1:
* None
drivers/mfd/intel_soc_pmic_bxtwc.c +12 -20
@@ -83,10 +83,7 @@ enum bxtwc_irqs {enum bxtwc_irqs_level2 {/* Level 2 */ -BXTWC_THRM0_IRQ =0 , -BXTWC_THRM1_IRQ , -BXTWC_THRM2_IRQ , -BXTWC_BCU_IRQ , +BXTWC_BCU_IRQ =0 ,BXTWC_ADC_IRQ ,BXTWC_USBC_IRQ ,BXTWC_CHGR0_IRQ ,
@@ -113,17 +110,14 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = { };static const struct regmap_irq bxtwc_regmap_irqs_level2[] = { -REGMAP_IRQ_REG (BXTWC_THRM0_IRQ ,0 ,0xff ), -REGMAP_IRQ_REG (BXTWC_THRM1_IRQ ,1 ,0xbf ), -REGMAP_IRQ_REG (BXTWC_THRM2_IRQ ,2 ,0xff ), -REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,4 ,0xff ), -REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,5 ,BIT (5 )), -REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,5 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,6 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_GPIO0_IRQ ,7 ,0xff ), -REGMAP_IRQ_REG (BXTWC_GPIO1_IRQ ,8 ,0x3f ), -REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,9 ,0x03 ), +REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,0 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,1 ,0xff ), +REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )), +REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_GPIO0_IRQ ,4 ,0xff ), +REGMAP_IRQ_REG (BXTWC_GPIO1_IRQ ,5 ,0x3f ), +REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,6 ,0x03 ), };static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = {
@@ -141,8 +135,8 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = {static struct regmap_irq_chip bxtwc_regmap_irq_chip_level2 = { .name ="bxtwc_irq_chip_level2" , - .status_base =BXTWC_THRM0IRQ , - .mask_base =BXTWC_MTHRM0IRQ , + .status_base =BXTWC_BCUIRQ , + .mask_base =BXTWC_MBCUIRQ , .irqs = bxtwc_regmap_irqs_level2, .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_level2), .num_regs =10 ,
@@ -176,9 +170,7 @@ static struct resource charger_resources[] = { };static struct resource thermal_resources[] = { -DEFINE_RES_IRQ (BXTWC_THRM0_IRQ ), -DEFINE_RES_IRQ (BXTWC_THRM1_IRQ ), -DEFINE_RES_IRQ (BXTWC_THRM2_IRQ ), +DEFINE_RES_IRQ (BXTWC_THRM_LVL1_IRQ ), };static struct resource bcu_resources[] = {
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v2 3/8 thermal: intel_bxt_pmic_thermal: use first level PMIC thermal irq
In reply to [email protected]From: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for thermal device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC thermal irq.
--- drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Changes since v1:
* None
drivers/thermal/intel_bxt_pmic_thermal.c +1 -1
@@ -241,7 +241,7 @@ static int pmic_thermal_probe(struct platform_device *pdev) } regmap = pmic->regmap; - regmap_irq_chip = pmic->irq_chip_data_level2; + regmap_irq_chip = pmic->irq_chip_data; pmic_irq_count =0 ;while ((irq =platform_get_irq (pdev, pmic_irq_count)) != -ENXIO ) {
Signature · 1 line
2.7.4
Re: [PATCH v2 3/8] thermal: intel_bxt_pmic_thermal: use first level PMIC thermal irq
Quoted 8 lines · On Fri, 14 Apr 2017, [email protected] wrote:
From: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for thermal device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC thermal irq.
Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>
This still needs a Maintainer Ack.
Quoted 20 lines
--- drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Changes since v1:
* Nonedrivers/thermal/intel_bxt_pmic_thermal.c +1
-1@@ -241,7 +241,7 @@ static int pmic_thermal_probe(struct platform_device *pdev) } regmap = pmic->regmap; - regmap_irq_chip = pmic->irq_chip_data_level2; + regmap_irq_chip = pmic->irq_chip_data; pmic_irq_count =0 ;while ((irq =platform_get_irq (pdev, pmic_irq_count)) != -ENXIO ) {
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
sathyanarayanan kuppuswamy
maintainerRe: [PATCH v2 3/8] thermal: intel_bxt_pmic_thermal: use first level PMIC thermal irq
Hi Rui/Valentin,
Do you have any comments on this patch ? If you agree with this patch, Can you please Ack it ?
Quoted 32 lines · Lee Jones
Quoted 8 lines · On Fri, 14 Apr 2017, [email protected] wrote:
From: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for thermal device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC thermal irq.
Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>This still needs a Maintainer Ack.
Quoted 20 lines
--- drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Changes since v1:
* Nonedrivers/thermal/intel_bxt_pmic_thermal.c +1
-1@@ -241,7 +241,7 @@ static int pmic_thermal_probe(struct platform_device *pdev) } regmap = pmic->regmap; - regmap_irq_chip = pmic->irq_chip_data_level2; + regmap_irq_chip = pmic->irq_chip_data; pmic_irq_count =0 ;while ((irq =platform_get_irq (pdev, pmic_irq_count)) != -ENXIO ) {
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux kernel developer
Re: [PATCH v2 3/8] thermal: intel_bxt_pmic_thermal: use first level PMIC thermal irq
In reply to [email protected]Quoted 10 lines · On Fri, 2017-04-14 at 16:25 -0700, [email protected]…
From: Kuppuswamy Sathyanarayanan <[email protected] tel.com>
PMIC mfd driver only exports first level irq for thermal device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC thermal irq.
Signed-off-by: Kuppuswamy Sathyanarayanan
<[email protected]>
-rui
Quoted 23 lines
---
drivers/thermal/intel_bxt_pmic_thermal.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Changes since v1:
* Nonedrivers/thermal/intel_bxt_pmic_thermal.c +0
-0@@ -241,7 +241,7 @@ static int pmic_thermal_probe(struct platform_device *pdev) }
regmap =pmic->regmap;drivers/thermal/intel_bxt_pmic_thermal.c +1
-1- regmap_irq_chip = pmic->irq_chip_data_level2; + regmap_irq_chip = pmic->irq_chip_data;
pmic_irq_count= 0;
while ((irq =platform_get_irq(pdev, pmic_irq_count)) !=-ENXIO) {
Re: [PATCH v2 3/8] thermal: intel_bxt_pmic_thermal: use first level PMIC thermal irq
Quoted 10 lines · Zhang Rui
Quoted 8 lines · On Fri, 2017-04-14 at 16:25 -0700, [email protected]…
From: Kuppuswamy Sathyanarayanan <[email protected] tel.com>
PMIC mfd driver only exports first level irq for thermal device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC thermal irq.
Quoted 4 lines
Quoted 2 lines
Signed-off-by: Kuppuswamy Sathyanarayanan
<[email protected]>Acked-by Zhang Rui <[email protected]>
I think this is the last Ack.
Please collect them all and re-submit the set so I can pick it up.
Quoted 23 lines
Quoted 23 lines
---
drivers/thermal/intel_bxt_pmic_thermal.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Changes since v1:
* Nonedrivers/thermal/intel_bxt_pmic_thermal.c +0
-0@@ -241,7 +241,7 @@ static int pmic_thermal_probe(struct platform_device *pdev) }
regmap =pmic->regmap;drivers/thermal/intel_bxt_pmic_thermal.c +1
-1- regmap_irq_chip = pmic->irq_chip_data_level2; + regmap_irq_chip = pmic->irq_chip_data;
pmic_irq_count= 0;
while ((irq =platform_get_irq(pdev, pmic_irq_count)) !=-ENXIO) {
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
[email protected]
maintainerPATCH v3 1/8 mfd: intel_soc_pmic_bxtwc: fix TMU interrupt index
From: Kuppuswamy Sathyanarayanan <[email protected]>
TMU interrupts are registered as a separate interrupt chip, and hence it should start its interrupt index(BXTWC_TMU_IRQ) number from 0. But currently, BXTWC_TMU_IRQ is defined as part of enum bxtwc_irqs_level2 and its index value is 11. Since this index value is used when calculating .num_irqs of regmap_irq_chip_tmu, it incorrectly reports number of irqs as 12 instead of actual value of 1.
This patch fixes this issue by creating new enum of tmu irqs and resetting its starting index to 0.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Changes since v1:
* Removed code from commit message.
Changes since v2:
* Rebased on top of latest release.
drivers/mfd/intel_soc_pmic_bxtwc.c +4 -1
@@ -95,7 +95,10 @@ enum bxtwc_irqs_level2 {BXTWC_GPIO0_IRQ ,BXTWC_GPIO1_IRQ , BXTWC_CRIT_IRQ, - BXTWC_TMU_IRQ, +}; + +enum bxtwc_irqs_tmu { +BXTWC_TMU_IRQ =0 , }; static const struct regmap_irq bxtwc_regmap_irqs[] = {
Signature · 1 line
2.7.4
[GIT PULL] Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window
Dear fellow Maintainers,
Enjoy!
The following changes since commit 2ea659a9ef488125eb46da6eb571de5eae5c43f6:
Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git tags/ib-mfd-gpio-thermal-x86-v4.13
for you to fetch changes up to 6aa60f67c11c10540e43bbe5a6377f7a0231501e:
platform: x86: intel_bxtwc_tmu: remove first level irq unmask (2017-05-30 09:34:08 +0100)
----------------------------------------------------------------
Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window
----------------------------------------------------------------
Kuppuswamy Sathyanarayanan (8):
mfd: intel_soc_pmic_bxtwc: Fix TMU interrupt index
mfd: intel_soc_pmic_bxtwc: Remove thermal second level irqs
thermal: intel_bxt_pmic_thermal: use first level PMIC thermal irq
mfd: intel_soc_pmic_bxtwc: Remove second level irq for gpio device
gpio: gpio-wcove: use first level PMIC GPIO irq
mfd: intel_soc_pmic_bxtwc: Utilize devm_* functions in driver probe
mfd: intel_soc_pmic_bxtwc: Use chained irqs for second level irq chips
platform: x86: intel_bxtwc_tmu: remove first level irq unmask
drivers/gpio/gpio-wcove.c | 14 +- drivers/mfd/intel_soc_pmic_bxtwc.c | 234 ++++++++++++++++++++----------- drivers/platform/x86/intel_bxtwc_tmu.c | 4 - drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- include/linux/mfd/intel_soc_pmic.h | 5 +- 5 files changed, 174 insertions(+), 85 deletions(-)
Kind regards,
Lee
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [GIT PULL] Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window
Hi all,
Quoted 15 lines · On Tue, 30 May 2017 09:53:06 +0100 Lee Jones <[email protected]> wrote:
Dear fellow Maintainers,
Enjoy!
The following changes since commit
2ea659a9ef488125eb46da6eb571de5eae5c43f6:Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.gittags/ib-mfd-gpio-thermal-x86-v4.13for you to fetch changes up to
6aa60f67c11c10540e43bbe5a6377f7a0231501e:
Quoted 8 lines
platform: x86:
intel_bxtwc_tmu: remove first level irq unmask (2017-05-30 09:34:08 +0100)----------------------------------------------------------------
Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window----------------------------------------------------------------
Kuppuswamy Sathyanarayanan (8):
mfd:intel_soc_pmic_bxtwc: Use chained irqs for second level irq chips
See my other bug report on this commit ...
Signature · 2 lines
Cheers, Stephen Rothwell
Re: [GIT PULL] Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window
Sorry, its a mistake from my end. It looks like typec wcove driver got merged recently and I missed to add it to my cleanup patch set.
Lee,
I have created a patch to fix this issue.
Do you want me to send the entire series again with this fix or just send the fix alone.
Quoted 32 lines · Stephen Rothwell
Hi all,
Quoted 15 lines · On Tue, 30 May 2017 09:53:06 +0100 Lee Jones <[email protected]> wrote:
Dear fellow Maintainers,
Enjoy!
The following changes since commit
2ea659a9ef488125eb46da6eb571de5eae5c43f6:Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.gittags/ib-mfd-gpio-thermal-x86-v4.13for you to fetch changes up to
6aa60f67c11c10540e43bbe5a6377f7a0231501e:Quoted 8 lines
platform: x86:
intel_bxtwc_tmu: remove first level irq unmask (2017-05-30 09:34:08 +0100)----------------------------------------------------------------
Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window----------------------------------------------------------------
Kuppuswamy Sathyanarayanan (8):
mfd:intel_soc_pmic_bxtwc: Use chained irqs for second level irq chipsSee my other bug report on this commit ...
--
Cheers,
Stephen Rothwell
Signature · 1 line
Sathya
Re: [GIT PULL] Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window
In reply to Stephen RothwellHi All,
Quoted 20 lines · Stephen Rothwell
Hi all,
Quoted 17 lines · On Tue, 30 May 2017 09:53:06 +0100 Lee Jones <[email protected]> wrote:
Dear fellow Maintainers,
Enjoy!
The following changes since commit
2ea659a9ef488125eb46da6eb571de5eae5c43f6:Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.gittags/ib-mfd-gpio-thermal-x86-v4.13for you to fetch changes up to
6aa60f67c11c10540e43bbe5a6377f7a0231501e:platform: x86:
intel_bxtwc_tmu: remove first level irq unmask (2017-05-30 09:34:08 +0100)
Quoted 8 lines
Quoted 6 lines
----------------------------------------------------------------
Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window----------------------------------------------------------------
Kuppuswamy Sathyanarayanan (8):
mfd:intel_soc_pmic_bxtwc: Use chained irqs for second level irq chipsSee my other bug report on this commit ...
Sorry, its a mistake from my end. It looks like typec wcove driver got merged recently and I missed to add it to my cleanup patch set.
Lee,
I have created a patch to fix this issue.
Do you want me to send the entire series again with this fix or just send the fix alone.
Quoted 4 lines
--
Cheers,
Stephen Rothwell
Signature · 1 line
Sathya
Re: [GIT PULL] Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window
Quoted 35 lines · Sathyanarayanan Kuppuswamy Natarajan
Hi All,
Quoted 20 lines · Stephen Rothwell
Hi all,
Quoted 17 lines · On Tue, 30 May 2017 09:53:06 +0100 Lee Jones <[email protected]> wrote:
Dear fellow Maintainers,
Enjoy!
The following changes since commit
2ea659a9ef488125eb46da6eb571de5eae5c43f6:Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.gittags/ib-mfd-gpio-thermal-x86-v4.13for you to fetch changes up to
6aa60f67c11c10540e43bbe5a6377f7a0231501e:platform: x86:
intel_bxtwc_tmu: remove first level irq unmask (2017-05-30 09:34:08 +0100)Quoted 8 lines
Quoted 6 lines
----------------------------------------------------------------
Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window----------------------------------------------------------------
Kuppuswamy Sathyanarayanan (8):
mfd:intel_soc_pmic_bxtwc: Use chained irqs for second level irq chipsSee my other bug report on this commit ...
Sorry, its a mistake from my end. It looks like typec wcove driver got merged recently and I missed to add it to my cleanup patch set.
Quoted 6 lines
Lee,
I have created a patch to fix this issue.
Do you want me to send the entire series again with this fix or just send the fix alone.
This highlights the fact that this patch-set is not actually bisectable. To say that, when bisecting if we landed somewhere in the middle of this set, we would receive build errors.
Ergo, this set is not actually acceptable in its current state. Please squash all patches where you are a) changing the API (in the MFD header), then b) transitioning users (child devices) over to it.
Ensure that you do not make any code changes and remember to move all of the Acks you collected into the squashed patch. Also, please use the $SUBJECT lines commonly used by particular subsystems. For MFD the format is thus:
mfd: <device>: Patch description starting with an uppercase character
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
sathyanarayanan kuppuswamy
maintainerRe: [GIT PULL] Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window
Hi Lee,
Quoted 34 lines · Lee Jones
Quoted 32 lines · Sathyanarayanan Kuppuswamy Natarajan
Hi All,
Quoted 19 lines · Stephen Rothwell
Hi all,
Quoted 16 lines · On Tue, 30 May 2017 09:53:06 +0100 Lee Jones <[email protected]> wrote:
Dear fellow Maintainers,
Enjoy!
The following changes since commit
2ea659a9ef488125eb46da6eb571de5eae5c43f6:Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git tags/ib-mfd-gpio-thermal-x86-v4.13for you to fetch changes up to
6aa60f67c11c10540e43bbe5a6377f7a0231501e:platform: x86: intel_bxtwc_tmu: remove first level irq unmask (2017-05-30 09:34:08 +0100)Quoted 7 lines
Quoted 6 lines
----------------------------------------------------------------
Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window----------------------------------------------------------------
Kuppuswamy Sathyanarayanan (8):
mfd:intel_soc_pmic_bxtwc: Use chained irqs for second level irq chipsSee my other bug report on this commit ...
Sorry, its a mistake from my end. It looks like typec wcove driver got merged recently and I missed to add it to my cleanup patch set.
Quoted 8 lines
Quoted 6 lines
Lee,
I have created a patch to fix this issue.
Do you want me to send the entire series again with this fix or just send the fix alone.
This highlights the fact that this patch-set is not actually bisectable.
Except for the last patch set ( which has fix for typec driver compilation issue) that I sent yesterday, all other patch set versions are bisectable.
The problem was when I first created this patch set, typec wcove driver was not merged upstream. After creating the initial set, I was just improving the patch set and forgot to re-check for child devices that depend of PMIC MFD driver. Thats why we came across this compilation issue.
In future, I will try to avoid these kind of issues. I think adding "allyesconfig" and "allmodconfig" compilation tests to my patch submit criteria should prevent these kind of issues.
Quoted 7 lines
To say that, when bisecting if we landed somewhere in the middle of this set, we would receive build errors.
Ergo, this set is not actually acceptable in its current state. Please squash all patches where you are a) changing the API (in the MFD header), then b) transitioning users (child devices) over to it.
Quoted 6 lines
Ensure that you do not make any code changes and remember to move all of the Acks you collected into the squashed patch. Also, please use the $SUBJECT lines commonly used by particular subsystems. For MFD the format is thus:
mfd: <device>: Patch description starting with an uppercase character
yes, will include it in next update.
Quoted 1 line
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux kernel developer
Re: [GIT PULL] Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window
Quoted 57 lines · sathyanarayanan kuppuswamy
Hi Lee,
Quoted 34 lines · Lee Jones
Quoted 32 lines · Sathyanarayanan Kuppuswamy Natarajan
Hi All,
Quoted 19 lines · Stephen Rothwell
Hi all,
Quoted 16 lines · On Tue, 30 May 2017 09:53:06 +0100 Lee Jones <[email protected]> wrote:
Dear fellow Maintainers,
Enjoy!
The following changes since commit
2ea659a9ef488125eb46da6eb571de5eae5c43f6:Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git tags/ib-mfd-gpio-thermal-x86-v4.13for you to fetch changes up to
6aa60f67c11c10540e43bbe5a6377f7a0231501e:platform: x86: intel_bxtwc_tmu: remove first level irq unmask (2017-05-30 09:34:08 +0100)Quoted 7 lines
Quoted 6 lines
----------------------------------------------------------------
Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window----------------------------------------------------------------
Kuppuswamy Sathyanarayanan (8):
mfd:intel_soc_pmic_bxtwc: Use chained irqs for second level irq chipsSee my other bug report on this commit ...
Sorry, its a mistake from my end. It looks like typec wcove driver got merged recently and I missed to add it to my cleanup patch set.
Quoted 8 lines
Quoted 6 lines
Lee,
I have created a patch to fix this issue.
Do you want me to send the entire series again with this fix or just send the fix alone.
This highlights the fact that this patch-set is not actually bisectable.
Except for the last patch set ( which has fix for typec driver compilation issue) that I sent yesterday,
all other patch set versions are bisectable.The problem was when I first created this patch set, typec wcove driver was not merged upstream.
After creating the initial set, I was just improving the patch set and forgot to re-check for
child devices that depend of PMIC MFD driver. Thats why we came across this compilation issue.
Quoted 4 lines
In future, I will try to avoid these kind of issues. I think adding "allyesconfig" and "allmodconfig"
compilation tests to my patch submit criteria should prevent these kind of issues.
We do this as well as 32 and 64b for the platform driver tree, I have found it to be a reasonable sanity test.
Signature · 2 lines
Darren Hart VMware Open Source Technology Center
Re: [GIT PULL] Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window
In reply to Stephen RothwellQuoted 20 lines · Stephen Rothwell
Hi all,
Quoted 17 lines · On Tue, 30 May 2017 09:53:06 +0100 Lee Jones <[email protected]> wrote:
Dear fellow Maintainers,
Enjoy!
The following changes since commit
2ea659a9ef488125eb46da6eb571de5eae5c43f6:Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.gittags/ib-mfd-gpio-thermal-x86-v4.13for you to fetch changes up to
6aa60f67c11c10540e43bbe5a6377f7a0231501e:platform: x86:
intel_bxtwc_tmu: remove first level irq unmask (2017-05-30 09:34:08 +0100)
Quoted 8 lines
Quoted 6 lines
----------------------------------------------------------------
Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window----------------------------------------------------------------
Kuppuswamy Sathyanarayanan (8):
mfd:intel_soc_pmic_bxtwc: Use chained irqs for second level irq chipsSee my other bug report on this commit ...
Thanks Stephen.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [GIT PULL] Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window
In reply to Lee JonesQuoted 3 lines
Dear fellow Maintainers,
Enjoy!
... or not!
Please remove these patches from your tree, since they cause build problems in the USB subsystem.
I have asked Kuppuswamy to squash all un-bisectable patches and re-submit. Once in my possession, the plan is to push out another pull-request.
Quoted 36 lines
The following changes since commit
2ea659a9ef488125eb46da6eb571de5eae5c43f6:Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.gittags/ib-mfd-gpio-thermal-x86-v4.13for you to fetch changes up to
6aa60f67c11c10540e43bbe5a6377f7a0231501e:platform: x86:
intel_bxtwc_tmu: remove first level irq unmask (2017-05-30 09:34:08 +0100)----------------------------------------------------------------
Immutable branch between MFD, GPIO, Thermal and X86 due for the v4.13 merge window----------------------------------------------------------------
Kuppuswamy Sathyanarayanan (8):
mfd:intel_soc_pmic_bxtwc: Fix TMU interrupt index
mfd:intel_soc_pmic_bxtwc: Remove thermal second level irqs
thermal:intel_bxt_pmic_thermal: use first level PMIC thermal irq
mfd:intel_soc_pmic_bxtwc: Remove second level irq for gpio device
gpio: gpio-wcove: use first level PMIC GPIO irq
mfd:intel_soc_pmic_bxtwc: Utilize devm_* functions in driver probe
mfd:intel_soc_pmic_bxtwc: Use chained irqs for second level irq chips
platform: x86:intel_bxtwc_tmu: remove first level irq unmaskdrivers/gpio/gpio-wcove.c | 14 +- drivers/mfd/intel_soc_pmic_bxtwc.c | 234 ++++++++++++++++++++----------- drivers/platform/x86/intel_bxtwc_tmu.c | 4 - drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- include/linux/mfd/intel_soc_pmic.h | 5 +- 5 files changed, 174 insertions(+), 85 deletions(-)Kind regards,
Lee
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
[email protected]
maintainerv5 cover mfd: intel_soc_pmic_bxtwc: Add chained IRQ support
From: Kuppuswamy Sathyanarayanan <[email protected]>
Following patch set adds chained IRQ support to WCOVE PMIC driver.
Changes since v3:
* Added fix for typec wcove driver.
Changes since v4:
* Squashed following two commits, to keep the patch set bisectable.
usb: typec: typec_wcove: Use charger irq chip to get usbc virq
mfd: intel_soc_pmic_bxtwc: use chained irqs for second level irq chips
Kuppuswamy Sathyanarayanan (8):
mfd: intel_soc_pmic_bxtwc: Fix TMU interrupt index
mfd: intel_soc_pmic_bxtwc: Remove thermal second level irqs
thermal: intel_bxt_pmic_thermal: Use first level PMIC thermal irq
mfd: intel_soc_pmic_bxtwc: Remove second level irq for gpio device
gpio: gpio-wcove: Use first level PMIC GPIO irq
mfd: intel_soc_pmic_bxtwc: Utilize devm_* functions in driver probe
mfd: intel_soc_pmic_bxtwc: Use chained irqs for second level irq chips platform/x86: intel_bxtwc_tmu: Remove first level irq unmask
drivers/gpio/gpio-wcove.c | 14 +- drivers/mfd/intel_soc_pmic_bxtwc.c | 234 ++++++++++++++++++++----------- drivers/platform/x86/intel_bxtwc_tmu.c | 4 - drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- drivers/usb/typec/typec_wcove.c | 2 +- include/linux/mfd/intel_soc_pmic.h | 5 +- 6 files changed, 175 insertions(+), 86 deletions(-)
Signature · 1 line
2.7.4
Re: [PATCH v5 0/8] mfd: intel_soc_pmic_bxtwc: Add chained IRQ support
Quoted 3 lines · On Thu, Jun 1, 2017 at 1:37 AM, <[email protected]>…
From: Kuppuswamy Sathyanarayanan <[email protected]>
Following patch set adds chained IRQ support to WCOVE PMIC driver.
I commented some patches, the rest looks okay.
Please, address and send new version.
Signature · 2 lines
With Best Regards, Andy Shevchenko
[email protected]
maintainerPATCH v5 1/8 mfd: intel_soc_pmic_bxtwc: Fix TMU interrupt index
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
TMU interrupts are registered as a separate interrupt chip, and hence it should start its interrupt index(BXTWC_TMU_IRQ) number from 0. But currently, BXTWC_TMU_IRQ is defined as part of enum bxtwc_irqs_level2 and its index value is 11. Since this index value is used when calculating .num_irqs of regmap_irq_chip_tmu, it incorrectly reports number of irqs as 12 instead of actual value of 1.
This patch fixes this issue by creating new enum of tmu irqs and resetting its starting index to 0.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Changes since v1:
* Removed code from commit message.
Changes since v2:
* Rebased on top of latest release.
Changes sinve v3:
* Rebased on top of latest release.
drivers/mfd/intel_soc_pmic_bxtwc.c +4 -1
@@ -95,7 +95,10 @@ enum bxtwc_irqs_level2 {BXTWC_GPIO0_IRQ ,BXTWC_GPIO1_IRQ , BXTWC_CRIT_IRQ, - BXTWC_TMU_IRQ, +}; + +enum bxtwc_irqs_tmu { +BXTWC_TMU_IRQ =0 , }; static const struct regmap_irq bxtwc_regmap_irqs[] = {
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v5 2/8 mfd: intel_soc_pmic_bxtwc: Remove thermal second level irqs
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Since all second level thermal irqs are consumed by the same device(bxt_wcove_thermal), there is no need to expose them as separate interrupts. We can just export only the first level irqs for thermal and let the device(bxt_wcove_thermal) driver handle the second level irqs based on thermal interrupt status register. Also, just using only the first level irq will eliminate the bug involved in requesting only the second level irq and not explicitly enable the first level irq. For more info on this issue please read the details at,
https://lkml.org/lkml/2017/2/27/148
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
Changes since v3:
* Rebased on top of latest release.
drivers/mfd/intel_soc_pmic_bxtwc.c +12 -20
@@ -84,10 +84,7 @@ enum bxtwc_irqs {enum bxtwc_irqs_level2 {/* Level 2 */ -BXTWC_THRM0_IRQ =0 , -BXTWC_THRM1_IRQ , -BXTWC_THRM2_IRQ , -BXTWC_BCU_IRQ , +BXTWC_BCU_IRQ =0 ,BXTWC_ADC_IRQ ,BXTWC_USBC_IRQ ,BXTWC_CHGR0_IRQ ,
@@ -114,17 +111,14 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = { };static const struct regmap_irq bxtwc_regmap_irqs_level2[] = { -REGMAP_IRQ_REG (BXTWC_THRM0_IRQ ,0 ,0xff ), -REGMAP_IRQ_REG (BXTWC_THRM1_IRQ ,1 ,0xbf ), -REGMAP_IRQ_REG (BXTWC_THRM2_IRQ ,2 ,0xff ), -REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,4 ,0xff ), -REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,5 ,BIT (5 )), -REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,5 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,6 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_GPIO0_IRQ ,7 ,0xff ), -REGMAP_IRQ_REG (BXTWC_GPIO1_IRQ ,8 ,0x3f ), -REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,9 ,0x03 ), +REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,0 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,1 ,0xff ), +REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )), +REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_GPIO0_IRQ ,4 ,0xff ), +REGMAP_IRQ_REG (BXTWC_GPIO1_IRQ ,5 ,0x3f ), +REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,6 ,0x03 ), };static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = {
@@ -142,8 +136,8 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = {static struct regmap_irq_chip bxtwc_regmap_irq_chip_level2 = { .name ="bxtwc_irq_chip_level2" , - .status_base =BXTWC_THRM0IRQ , - .mask_base =BXTWC_MTHRM0IRQ , + .status_base =BXTWC_BCUIRQ , + .mask_base =BXTWC_MBCUIRQ , .irqs = bxtwc_regmap_irqs_level2, .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_level2), .num_regs =10 ,
@@ -177,9 +171,7 @@ static struct resource charger_resources[] = { };static struct resource thermal_resources[] = { -DEFINE_RES_IRQ (BXTWC_THRM0_IRQ ), -DEFINE_RES_IRQ (BXTWC_THRM1_IRQ ), -DEFINE_RES_IRQ (BXTWC_THRM2_IRQ ), +DEFINE_RES_IRQ (BXTWC_THRM_LVL1_IRQ ), };static struct resource bcu_resources[] = {
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v5 3/8 thermal: intel_bxt_pmic_thermal: Use first level PMIC thermal irq
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for thermal device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC thermal irq.
--- drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
Changes since v3:
* Rebased on top of latest release.
drivers/thermal/intel_bxt_pmic_thermal.c +1 -1
@@ -241,7 +241,7 @@ static int pmic_thermal_probe(struct platform_device *pdev) } regmap = pmic->regmap; - regmap_irq_chip = pmic->irq_chip_data_level2; + regmap_irq_chip = pmic->irq_chip_data; pmic_irq_count =0 ;while ((irq =platform_get_irq (pdev, pmic_irq_count)) != -ENXIO ) {
Signature · 1 line
2.7.4
Re: [PATCH v5 3/8] thermal: intel_bxt_pmic_thermal: Use first level PMIC thermal irq
Quoted 7 lines · On Thu, Jun 1, 2017 at 1:37 AM, <[email protected]>…
From: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for thermal device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC thermal irq.
Shouldn't be this squashed to patch 2?
Quoted 31 lines
Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>Acked-by Zhang Rui <[email protected]>--- drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Changes since v1:
* NoneChanges since v2:
* Rebased on top of latest release.Changes since v3:
* Rebased on top of latest release.drivers/thermal/intel_bxt_pmic_thermal.c +1
-2@@ -241,7 +241,7 @@ static int pmic_thermal_probe(struct platform_device *pdev) } regmap = pmic->regmap; - regmap_irq_chip = pmic->irq_chip_data_level2; + regmap_irq_chip = pmic->irq_chip_data; pmic_irq_count =0 ;while ((irq =platform_get_irq (pdev, pmic_irq_count)) != -ENXIO ) { --2.7.4
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v5 3/8] thermal: intel_bxt_pmic_thermal: Use first level PMIC thermal irq
Hi,
Quoted 11 lines · Andy Shevchenko
Quoted 7 lines · On Thu, Jun 1, 2017 at 1:37 AM, <[email protected]>…
From: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for thermal device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC thermal irq.
Shouldn't be this squashed to patch 2?
There is no compilation dependency between patch 2 and 3. But they are functionally dependent.
Should we squash functionally dependent patches too ?
Quoted 38 lines
Quoted 30 lines
Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>Acked-by Zhang Rui <[email protected]>--- drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Changes since v1:
* NoneChanges since v2:
* Rebased on top of latest release.Changes since v3:
* Rebased on top of latest release.drivers/thermal/intel_bxt_pmic_thermal.c +1
-2@@ -241,7 +241,7 @@ static int pmic_thermal_probe(struct platform_device *pdev) } regmap = pmic->regmap; - regmap_irq_chip = pmic->irq_chip_data_level2; + regmap_irq_chip = pmic->irq_chip_data; pmic_irq_count =0 ;while ((irq =platform_get_irq (pdev, pmic_irq_count)) != -ENXIO ) { --Quoted 2 lines
2.7.4
--
With Best Regards,
Andy Shevchenko
Signature · 1 line
Sathya
Re: [PATCH v5 3/8] thermal: intel_bxt_pmic_thermal: Use first level PMIC thermal irq
Quoted 14 lines · Sathyanarayanan Kuppuswamy Natarajan
Hi,
Quoted 10 lines · Andy Shevchenko
Quoted 7 lines · On Thu, Jun 1, 2017 at 1:37 AM, <[email protected]>…
From: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for thermal device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC thermal irq.
Quoted 6 lines
Quoted 1 line
Shouldn't be this squashed to patch 2?
There is no compilation dependency between patch 2 and 3. But they are functionally dependent.
Should we squash functionally dependent patches too ?
Let's assume we applied patches 1 and 2, does it mean the regression to the existing behaviour?
(For example, device worked improperly in some cases -> stopped working completely)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v5 3/8] thermal: intel_bxt_pmic_thermal: Use first level PMIC thermal irq
Hi,
Quoted 18 lines · Andy Shevchenko
Quoted 16 lines · Sathyanarayanan Kuppuswamy Natarajan
Hi,
Quoted 11 lines · Andy Shevchenko
Quoted 7 lines · On Thu, Jun 1, 2017 at 1:37 AM, <[email protected]>…
From: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for thermal device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC thermal irq.
Shouldn't be this squashed to patch 2?
Quoted 7 lines
Quoted 4 lines
There is no compilation dependency between patch 2 and 3. But they are functionally dependent.
Should we squash functionally dependent patches too ?
Let's assume we applied patches 1 and 2, does it mean the regression to the existing behaviour?
Yes, Just applying patch 1 & 2 and not apply patch 3 will create regression in thermal driver.
Since there is no compilation dependency between patch 2 & 3 and they are from two different domains, I submitted them separately to make it easier for review.
Quoted 7 lines
(For example, device worked improperly in some cases -> stopped working completely)
--
With Best Regards,
Andy Shevchenko
Signature · 1 line
Sathya
Re: [PATCH v5 3/8] thermal: intel_bxt_pmic_thermal: Use first level PMIC thermal irq
Quoted 8 lines · Sathyanarayanan Kuppuswamy Natarajan
Quoted 5 lines · Andy Shevchenko
On Sat, Jun 3, 2017 at 8:28 PM, Sathyanarayanan Kuppuswamy Natarajan <[email protected]> wrote:
Let's assume we applied patches 1 and 2, does it mean the regression to the existing behaviour?
Quoted 6 lines
Yes, Just applying patch 1 & 2 and not apply patch 3 will create regression in thermal driver.
Since there is no compilation dependency between patch 2 & 3 and they are from two different domains, I submitted them separately to make it easier for review.
And this is exactly bisectability (level 2 :-) ) issue. Basically you confirmed you need to squash them like I said.
Quoted 2 lines
Quoted 2 lines
(For example, device worked improperly in some cases -> stopped working completely)
Signature · 2 lines
With Best Regards, Andy Shevchenko
[email protected]
maintainerv6 cover mfd: intel_soc_pmic_bxtwc: Add chained IRQ support
From: Kuppuswamy Sathyanarayanan <[email protected]>
Following patch set adds chained IRQ support to WCOVE PMIC driver.
Changes since v3:
* Added fix for typec wcove driver.
Changes since v4:
* Squashed following two commits, to keep the patch set bisectable.
usb: typec: typec_wcove: Use charger irq chip to get usbc virq
mfd: intel_soc_pmic_bxtwc: use chained irqs for second level irq chips
Changes since v5:
* Changed irq->IRQ, pmic->PMIC in all commit messages.
* Squashed following two thermal driver related commits.
mfd: intel_soc_pmic_bxtwc: Remove thermal second level irqs
thermal: intel_bxt_pmic_thermal: Use first level PMIC thermal irq
* Squashed following two GPIO driver related commits.
mfd: intel_soc_pmic_bxtwc: Remove second level irq for gpio device
gpio: gpio-wcove: Use first level PMIC GPIO irq
Kuppuswamy Sathyanarayanan (6):
mfd: intel_soc_pmic_bxtwc: Fix TMU interrupt index
mfd: intel_soc_pmic_bxtwc: Remove thermal second level IRQs
mfd: intel_soc_pmic_bxtwc: Remove second level IRQ for gpio device
mfd: intel_soc_pmic_bxtwc: Utilize devm_* functions in driver probe
mfd: intel_soc_pmic_bxtwc: Use chained IRQs for second level IRQ chips platform/x86: intel_bxtwc_tmu: Remove first level IRQ unmask
drivers/gpio/gpio-wcove.c | 14 +- drivers/mfd/intel_soc_pmic_bxtwc.c | 232 +++++++++++++++++++++---------- drivers/platform/x86/intel_bxtwc_tmu.c | 4 - drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- drivers/usb/typec/typec_wcove.c | 2 +- include/linux/mfd/intel_soc_pmic.h | 5 +- 6 files changed, 175 insertions(+), 84 deletions(-)
Signature · 1 line
2.7.4
Re: [PATCH v6 0/6] mfd: intel_soc_pmic_bxtwc: Add chained IRQ support
Quoted 3 lines · On Mon, Jun 5, 2017 at 10:08 PM, <[email protected]>…
From: Kuppuswamy Sathyanarayanan <[email protected]>
Following patch set adds chained IRQ support to WCOVE PMIC driver.
Assuming it has been tested,
to the patches which do not have it yet.
Quoted 36 lines
Changes since v3:
* Added fix for typec wcove driver.Changes since v4:
* Squashed following two commits, to keep the patch set bisectable.
usb: typec:typec_wcove: Use charger irq chip to get usbc virq
mfd:intel_soc_pmic_bxtwc: use chained irqs for second level irq chipsChanges since v5:
* Changedirq->IRQ,pmic->PMICin all commit messages.
* Squashed following two thermal driver related commits.
mfd:intel_soc_pmic_bxtwc: Remove thermal second level irqs
thermal:intel_bxt_pmic_thermal: Use first level PMIC thermal irq
* Squashed following two GPIO driver related commits.
mfd:intel_soc_pmic_bxtwc: Remove second level irq for gpio device
gpio: gpio-wcove: Use first level PMIC GPIO irqKuppuswamy Sathyanarayanan (6):
mfd:intel_soc_pmic_bxtwc: Fix TMU interrupt index
mfd:intel_soc_pmic_bxtwc: Remove thermal second level IRQs
mfd:intel_soc_pmic_bxtwc: Remove second level IRQ for gpio device
mfd:intel_soc_pmic_bxtwc: Utilize devm_* functions in driver probe
mfd:intel_soc_pmic_bxtwc: Use chained IRQs for second level IRQ chips platform/x86:intel_bxtwc_tmu: Remove first level IRQ unmaskdrivers/gpio/gpio-wcove.c | 14 +- drivers/mfd/intel_soc_pmic_bxtwc.c | 232 +++++++++++++++++++++---------- drivers/platform/x86/intel_bxtwc_tmu.c | 4 - drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- drivers/usb/typec/typec_wcove.c | 2 +- include/linux/mfd/intel_soc_pmic.h | 5 +- 6 files changed, 175 insertions(+), 84 deletions(-)--
2.7.4
Signature · 2 lines
With Best Regards, Andy Shevchenko
[GIT PULL] Immutable branch between MFD and X86 due for the v4.13 merge window
In reply to [email protected]Enjoy!
The following changes since commit 2ea659a9ef488125eb46da6eb571de5eae5c43f6:
Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git ib-mfd-x86-v4.13
for you to fetch changes up to 94d68594a7b4fd2eec457f22110de644e1c4ee57:
platform/x86: intel_bxtwc_tmu: Remove first level IRQ unmask (2017-06-19 15:45:30 +0100)
----------------------------------------------------------------
Immutable branch between MFD and X86 due for the v4.13 merge window
----------------------------------------------------------------
Kuppuswamy Sathyanarayanan (6):
mfd: intel_soc_pmic_bxtwc: Fix TMU interrupt index
mfd: intel_soc_pmic_bxtwc: Remove thermal second level IRQs
mfd: intel_soc_pmic_bxtwc: Remove second level IRQ for gpio device
mfd: intel_soc_pmic_bxtwc: Utilize devm_* functions in driver probe
mfd: intel_soc_pmic_bxtwc: Use chained IRQs for second level IRQ chips platform/x86: intel_bxtwc_tmu: Remove first level IRQ unmask
drivers/gpio/gpio-wcove.c | 14 +- drivers/mfd/intel_soc_pmic_bxtwc.c | 232 +++++++++++++++++++++---------- drivers/platform/x86/intel_bxtwc_tmu.c | 4 - drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- drivers/usb/typec/typec_wcove.c | 2 +- include/linux/mfd/intel_soc_pmic.h | 5 +- 6 files changed, 175 insertions(+), 84 deletions(-)
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [GIT PULL] Immutable branch between MFD and X86 due for the v4.13 merge window
Quoted 1 line · Lee Jones
Enjoy!
Thanks!
I suppose this one kbuild bot doesn't complain about :-)
Darren, do we need it or we can survive until v4.13-rc1?
Quoted 38 lines
The following changes since commit
2ea659a9ef488125eb46da6eb571de5eae5c43f6:Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.gitib-mfd-x86-v4.13for you to fetch changes up to
94d68594a7b4fd2eec457f22110de644e1c4ee57:platform/x86:
intel_bxtwc_tmu: Remove first level IRQ unmask (2017-06-19 15:45:30 +0100)----------------------------------------------------------------
Immutable branch between MFD and X86 due for the v4.13 merge window----------------------------------------------------------------
Kuppuswamy Sathyanarayanan (6):
mfd:intel_soc_pmic_bxtwc: Fix TMU interrupt index
mfd:intel_soc_pmic_bxtwc: Remove thermal second level IRQs
mfd:intel_soc_pmic_bxtwc: Remove second level IRQ for gpio device
mfd:intel_soc_pmic_bxtwc: Utilize devm_* functions in driver probe
mfd:intel_soc_pmic_bxtwc: Use chained IRQs for second level IRQ chips platform/x86:intel_bxtwc_tmu: Remove first level IRQ unmaskdrivers/gpio/gpio-wcove.c | 14 +- drivers/mfd/intel_soc_pmic_bxtwc.c | 232 +++++++++++++++++++++---------- drivers/platform/x86/intel_bxtwc_tmu.c | 4 - drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- drivers/usb/typec/typec_wcove.c | 2 +- include/linux/mfd/intel_soc_pmic.h | 5 +- 6 files changed, 175 insertions(+), 84 deletions(-)--
Lee Jones
Linaro STMicroelectronics Landing Team LeadLinaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [GIT PULL] Immutable branch between MFD and X86 due for the v4.13 merge window
Quoted 8 lines · Andy Shevchenko
Quoted 1 line · Lee Jones
Enjoy!
Thanks!
I suppose this one kbuild bot doesn't complain about :-)
Darren, do we need it or we can survive until v4.13-rc1?
I suggest merging it to a local branch for safe keeping and if we see conflicts in subsequent patches, we can apply it. I doubt it will be a problem.
Signature · 2 lines
Darren Hart VMware Open Source Technology Center
[email protected]
maintainerPATCH v6 1/6 mfd: intel_soc_pmic_bxtwc: Fix TMU interrupt index
In reply to Andy ShevchenkoFrom: Kuppuswamy Sathyanarayanan <[email protected]>
TMU interrupts are registered as a separate interrupt chip, and hence it should start its interrupt index(BXTWC_TMU_IRQ) number from 0. But currently, BXTWC_TMU_IRQ is defined as part of enum bxtwc_irqs_level2 and its index value is 11. Since this index value is used when calculating .num_irqs of regmap_irq_chip_tmu, it incorrectly reports number of IRQs as 12 instead of actual value of 1.
This patch fixes this issue by creating new enum of tmu IRQs and resetting its starting index to 0.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Changes since v1:
* Removed code from commit message.
Changes since v2:
* Rebased on top of latest release.
Changes sinve v3:
* Rebased on top of latest release.
Changes sinve v5:
* Changed irq to IRQ.
drivers/mfd/intel_soc_pmic_bxtwc.c +4 -1
@@ -95,7 +95,10 @@ enum bxtwc_irqs_level2 {BXTWC_GPIO0_IRQ ,BXTWC_GPIO1_IRQ , BXTWC_CRIT_IRQ, - BXTWC_TMU_IRQ, +}; + +enum bxtwc_irqs_tmu { +BXTWC_TMU_IRQ =0 , }; static const struct regmap_irq bxtwc_regmap_irqs[] = {
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v6 2/6 mfd: intel_soc_pmic_bxtwc: Remove thermal second level IRQs
In reply to Andy ShevchenkoFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Since all second level thermal IRQs are consumed by the same device(bxt_wcove_thermal), there is no need to expose them as separate interrupts. We can just export only the first level IRQs for thermal and let the device(bxt_wcove_thermal) driver handle the second level IRQs based on thermal interrupt status register. Also, just using only the first level IRQ will eliminate the bug involved in requesting only the second level IRQ and not explicitly enable the first level IRQ. For more info on this issue please read the details at,
https://lkml.org/lkml/2017/2/27/148
This patch also makes relevant change in bxt_wcove_thermal driver to use only first level PMIC thermal IRQ.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 32 ++++++++++++-------------------- drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- 2 files changed, 13 insertions(+), 21 deletions(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
Changes since v3:
* Rebased on top of latest release.
Changes since v5:
* Squashed intel_bxt_pmic_thermal driver patch.
* Changed irq -> IRQ
drivers/mfd/intel_soc_pmic_bxtwc.c +12 -20
@@ -84,10 +84,7 @@ enum bxtwc_irqs {enum bxtwc_irqs_level2 {/* Level 2 */ -BXTWC_THRM0_IRQ =0 , -BXTWC_THRM1_IRQ , -BXTWC_THRM2_IRQ , -BXTWC_BCU_IRQ , +BXTWC_BCU_IRQ =0 ,BXTWC_ADC_IRQ ,BXTWC_USBC_IRQ ,BXTWC_CHGR0_IRQ ,
@@ -114,17 +111,14 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = { };static const struct regmap_irq bxtwc_regmap_irqs_level2[] = { -REGMAP_IRQ_REG (BXTWC_THRM0_IRQ ,0 ,0xff ), -REGMAP_IRQ_REG (BXTWC_THRM1_IRQ ,1 ,0xbf ), -REGMAP_IRQ_REG (BXTWC_THRM2_IRQ ,2 ,0xff ), -REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,4 ,0xff ), -REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,5 ,BIT (5 )), -REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,5 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,6 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_GPIO0_IRQ ,7 ,0xff ), -REGMAP_IRQ_REG (BXTWC_GPIO1_IRQ ,8 ,0x3f ), -REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,9 ,0x03 ), +REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,0 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,1 ,0xff ), +REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )), +REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_GPIO0_IRQ ,4 ,0xff ), +REGMAP_IRQ_REG (BXTWC_GPIO1_IRQ ,5 ,0x3f ), +REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,6 ,0x03 ), };static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = {
@@ -142,8 +136,8 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = {static struct regmap_irq_chip bxtwc_regmap_irq_chip_level2 = { .name ="bxtwc_irq_chip_level2" , - .status_base =BXTWC_THRM0IRQ , - .mask_base =BXTWC_MTHRM0IRQ , + .status_base =BXTWC_BCUIRQ , + .mask_base =BXTWC_MBCUIRQ , .irqs = bxtwc_regmap_irqs_level2, .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_level2), .num_regs =10 ,
@@ -177,9 +171,7 @@ static struct resource charger_resources[] = { };static struct resource thermal_resources[] = { -DEFINE_RES_IRQ (BXTWC_THRM0_IRQ ), -DEFINE_RES_IRQ (BXTWC_THRM1_IRQ ), -DEFINE_RES_IRQ (BXTWC_THRM2_IRQ ), +DEFINE_RES_IRQ (BXTWC_THRM_LVL1_IRQ ), };static struct resource bcu_resources[] = {
drivers/thermal/intel_bxt_pmic_thermal.c +1 -1
@@ -241,7 +241,7 @@ static int pmic_thermal_probe(struct platform_device *pdev) } regmap = pmic->regmap; - regmap_irq_chip = pmic->irq_chip_data_level2; + regmap_irq_chip = pmic->irq_chip_data; pmic_irq_count =0 ;while ((irq =platform_get_irq (pdev, pmic_irq_count)) != -ENXIO ) {
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v6 3/6 mfd: intel_soc_pmic_bxtwc: Remove second level IRQ for gpio device
In reply to Andy ShevchenkoFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Currently all PMIC GPIO domain IRQs are consumed by the same device(bxt_wcove_gpio), so there is no need to export them as separate interrupts. We can just export only the first level GPIO IRQ(BXTWC_GPIO_LVL1_IRQ) as an IRQ resource and let the GPIO device driver(bxt_wcove_gpio) handle the GPIO sub domain IRQs based on status value of GPIO level2 interrupt status register. Also, just using only the first level IRQ will eliminate the bug involved in requesting only the second level IRQ and not explicitly enable the first level IRQ. For more info on this issue please read the details at,
https://lkml.org/lkml/2017/2/27/148
This patch also makes relevant change in Whiskey cove GPIO driver to use only first level PMIC GPIO IRQ.
--- drivers/gpio/gpio-wcove.c | 14 +++++++++++++- drivers/mfd/intel_soc_pmic_bxtwc.c | 7 +------ 2 files changed, 14 insertions(+), 7 deletions(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
Changes since v3:
* None
Changes since v5:
* Squashed gpio driver patch.
* Changes irq -> IRQ.
drivers/gpio/gpio-wcove.c +13 -1
@@ -401,7 +401,7 @@ static int wcove_gpio_probe(struct platform_device *pdev)if (!wg)return -ENOMEM ; - wg->regmap_irq_chip = pmic->irq_chip_data_level2; + wg->regmap_irq_chip = pmic->irq_chip_data;platform_set_drvdata (pdev, wg);
@@ -449,6 +449,18 @@ static int wcove_gpio_probe(struct platform_device *pdev)gpiochip_set_nested_irqchip (&wg->chip, &wcove_irqchip, virq); +/* Enable GPIO0 interrupts */ + ret =regmap_update_bits (wg->regmap,IRQ_MASK_BASE ,GPIO_IRQ0_MASK , +0x00 ); +if (ret) +return ret; + +/* Enable GPIO1 interrupts */ + ret =regmap_update_bits (wg->regmap,IRQ_MASK_BASE +1 ,GPIO_IRQ1_MASK , +0x00 ); +if (ret) +return ret; +return 0 ; }
drivers/mfd/intel_soc_pmic_bxtwc.c +1 -6
@@ -89,8 +89,6 @@ enum bxtwc_irqs_level2 {BXTWC_USBC_IRQ ,BXTWC_CHGR0_IRQ ,BXTWC_CHGR1_IRQ , -BXTWC_GPIO0_IRQ , -BXTWC_GPIO1_IRQ , BXTWC_CRIT_IRQ, };
@@ -116,8 +114,6 @@ static const struct regmap_irq bxtwc_regmap_irqs_level2[] = {REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )),REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ),REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_GPIO0_IRQ ,4 ,0xff ), -REGMAP_IRQ_REG (BXTWC_GPIO1_IRQ ,5 ,0x3f ), REGMAP_IRQ_REG(BXTWC_CRIT_IRQ, 6, 0x03), };
@@ -153,8 +149,7 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { };static struct resource gpio_resources[] = { -DEFINE_RES_IRQ_NAMED (BXTWC_GPIO0_IRQ ,"GPIO0" ), -DEFINE_RES_IRQ_NAMED (BXTWC_GPIO1_IRQ ,"GPIO1" ), +DEFINE_RES_IRQ_NAMED (BXTWC_GPIO_LVL1_IRQ ,"GPIO" ), };static struct resource adc_resources[] = {
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v6 4/6 mfd: intel_soc_pmic_bxtwc: Utilize devm_* functions in driver probe
In reply to Andy ShevchenkoFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Cleanup the resource allocation/free code in probe function by using devm_* calls.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 54 +++++++++++++------------------------- 1 file changed, 18 insertions(+), 36 deletions(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
Changes since v3:
* None
Changes since v5:
* None
drivers/mfd/intel_soc_pmic_bxtwc.c +18 -36
@@ -399,45 +399,44 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip, - &pmic->irq_chip_data); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip, + &pmic->irq_chip_data);if (ret) {dev_err (&pdev->dev,"Failed to add IRQ chip\n" );return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_level2, - &pmic->irq_chip_data_level2); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip_level2, + &pmic->irq_chip_data_level2);if (ret) {dev_err (&pdev->dev,"Failed to add secondary IRQ chip\n" ); - goto err_irq_chip_level2; +return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_tmu, - &pmic->irq_chip_data_tmu); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip_tmu, + &pmic->irq_chip_data_tmu);if (ret) {dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" ); - goto err_irq_chip_tmu; +return ret; } - ret =mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , bxt_wc_dev, -ARRAY_SIZE (bxt_wc_dev),NULL ,0 , -NULL ); + ret =devm_mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , bxt_wc_dev, +ARRAY_SIZE (bxt_wc_dev),NULL ,0 ,NULL );if (ret) {dev_err (&pdev->dev,"Failed to add devices\n" ); - goto err_mfd; +return ret; } ret =sysfs_create_group (&pdev->dev.kobj, &bxtwc_group);if (ret) {dev_err (&pdev->dev,"Failed to create sysfs group %d\n" , ret); - goto err_sysfs; +return ret; }/*
@@ -451,28 +450,11 @@ static int bxtwc_probe(struct platform_device *pdev) BXTWC_MIRQLVL1_MCHGR, 0);return 0 ; - -err_sysfs: -mfd_remove_devices (&pdev->dev); -err_mfd: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_tmu); -err_irq_chip_tmu: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_level2); -err_irq_chip_level2: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data); - -return ret; }static int bxtwc_remove (struct platform_device *pdev) { -struct intel_soc_pmic *pmic =dev_get_drvdata (&pdev->dev); -sysfs_remove_group (&pdev->dev.kobj, &bxtwc_group); -mfd_remove_devices (&pdev->dev); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_level2); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_tmu);return 0 ; }
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v6 5/6 mfd: intel_soc_pmic_bxtwc: Use chained IRQs for second level IRQ chips
In reply to Andy ShevchenkoFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Whishkey cove PMIC has support to mask/unmask interrupts at two levels. At first level we can mask/unmask interrupt domains like TMU, GPIO, ADC, CHGR, BCU THERMAL and PWRBTN and at second level, it provides facility to mask/unmask individual interrupts belong each of this domain. For example, in case of TMU, at first level we have TMU interrupt domain, and at second level we have two interrupts, wake alarm, system alarm that belong to the TMU interrupt domain.
Currently, in this driver all first level IRQs are registered as part of IRQ chip(bxtwc_regmap_irq_chip). By default, after you register the IRQ chip from your driver, all IRQs in that chip will masked and can only be enabled if that IRQ is requested using request_irq() call. This is the default Linux IRQ behavior model. And whenever a dependent device that belongs to PMIC requests only the second level IRQ and not explicitly unmask the first level IRQ, then in essence the second level IRQ will still be disabled. For example, if TMU device driver request wake_alarm IRQ and not explicitly unmask TMU level 1 IRQ then according to the default Linux IRQ model, wake_alarm IRQ will still be disabled. So the proper solution to fix this issue is to use the chained IRQ chip concept. We should chain all the second level chip IRQs to the corresponding first level IRQ. To do this, we need to create separate IRQ chips for every group of second level IRQs.
In case of TMU, when adding second level IRQ chip, instead of using PMIC IRQ we should use the corresponding first level IRQ. So the following code will change from
ret = regmap_add_irq_chip(pmic->regmap, pmic->irq, ...)
to,
virq = regmap_irq_get_virq(&pmic->irq_chip_data, BXTWC_TMU_LVL1_IRQ);
ret = regmap_add_irq_chip(pmic->regmap, virq, ...)
In case of Whiskey Cove Type-C driver, Since USBC IRQ is moved under charger level2 IRQ chip. We should use charger IRQ chip(irq_chip_data_chgr) to get the USBC virtual IRQ number.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 168 ++++++++++++++++++++++++++++++------- drivers/usb/typec/typec_wcove.c | 2 +- include/linux/mfd/intel_soc_pmic.h | 5 +- 3 files changed, 143 insertions(+), 32 deletions(-)
Changes since v1:
* Rebased on top of dev_* cleanup patch.
* Fixed style & grammer issues reported by Lee Jones
Changes since v2:
* Rebased on top of latest release.
Changes since v3:
* None
Changes since v4:
* Merged typec driver fix to this patch to prevent branch bisect issue.
Changes since v5:
* Changed irq->IRQ and pmic -> PMIC.
* Rearranged tmu related changes to make the patch more readable.
* Modfied the virq request failure message to include chip name and pirq.
drivers/mfd/intel_soc_pmic_bxtwc.c +138 -30
@@ -82,20 +82,28 @@ enum bxtwc_irqs { BXTWC_PWRBTN_IRQ, }; -enum bxtwc_irqs_level2 { -/* Level 2 */ +enum bxtwc_irqs_bcu {BXTWC_BCU_IRQ =0 , -BXTWC_ADC_IRQ , -BXTWC_USBC_IRQ , +}; + +enum bxtwc_irqs_adc { +BXTWC_ADC_IRQ =0 , +}; + +enum bxtwc_irqs_chgr { +BXTWC_USBC_IRQ =0 ,BXTWC_CHGR0_IRQ ,BXTWC_CHGR1_IRQ , -BXTWC_CRIT_IRQ , };enum bxtwc_irqs_tmu {BXTWC_TMU_IRQ =0 , }; +enum bxtwc_irqs_crit { +BXTWC_CRIT_IRQ =0 , +}; +static const struct regmap_irq bxtwc_regmap_irqs[] = {REGMAP_IRQ_REG (BXTWC_PWRBTN_LVL1_IRQ ,0 ,BIT (0 )),REGMAP_IRQ_REG (BXTWC_TMU_LVL1_IRQ ,0 ,BIT (1 )),
@@ -108,19 +116,28 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = { REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 1, 0x03), }; -static const struct regmap_irq bxtwc_regmap_irqs_level2[] = { +static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = {REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,0 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,1 ,0xff ), -REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )), -REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,6 ,0x03 ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_adc[] = { +REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,0 ,0xff ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = { +REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,0 ,BIT (5 )), +REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,0 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,1 ,0x1f ), };static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = {REGMAP_IRQ_REG (BXTWC_TMU_IRQ ,0 ,0x06 ), }; +static const struct regmap_irq bxtwc_regmap_irqs_crit[] = { +REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,0 ,0x03 ), +}; +static struct regmap_irq_chip bxtwc_regmap_irq_chip = { .name ="bxtwc_irq_chip" , .status_base =BXTWC_IRQLVL1 ,
@@ -130,15 +147,6 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = { .num_regs = 2, }; -static struct regmap_irq_chip bxtwc_regmap_irq_chip_level2 = { - .name ="bxtwc_irq_chip_level2" , - .status_base =BXTWC_BCUIRQ , - .mask_base =BXTWC_MBCUIRQ , - .irqs = bxtwc_regmap_irqs_level2, - .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_level2), - .num_regs =10 , -}; -static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { .name ="bxtwc_irq_chip_tmu" , .status_base =BXTWC_TMUIRQ ,
@@ -148,6 +156,42 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { .num_regs = 1, }; +static struct regmap_irq_chip bxtwc_regmap_irq_chip_bcu = { + .name ="bxtwc_irq_chip_bcu" , + .status_base =BXTWC_BCUIRQ , + .mask_base =BXTWC_MBCUIRQ , + .irqs = bxtwc_regmap_irqs_bcu, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_bcu), + .num_regs =1 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_adc = { + .name ="bxtwc_irq_chip_adc" , + .status_base =BXTWC_ADCIRQ , + .mask_base =BXTWC_MADCIRQ , + .irqs = bxtwc_regmap_irqs_adc, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_adc), + .num_regs =1 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_chgr = { + .name ="bxtwc_irq_chip_chgr" , + .status_base =BXTWC_CHGR0IRQ , + .mask_base =BXTWC_MCHGR0IRQ , + .irqs = bxtwc_regmap_irqs_chgr, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_chgr), + .num_regs =2 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_crit = { + .name ="bxtwc_irq_chip_crit" , + .status_base =BXTWC_CRITIRQ , + .mask_base =BXTWC_MCRITIRQ , + .irqs = bxtwc_regmap_irqs_crit, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_crit), + .num_regs =1 , +}; +static struct resource gpio_resources[] = {DEFINE_RES_IRQ_NAMED (BXTWC_GPIO_LVL1_IRQ ,"GPIO" ), };
@@ -357,6 +401,26 @@ static const struct regmap_config bxtwc_regmap_config = { .reg_read = regmap_ipc_byte_reg_read, }; +static int bxtwc_add_chained_irq_chip (struct intel_soc_pmic *pmic, +struct regmap_irq_chip_data *pdata, +int pirq,int irq_flags, +const struct regmap_irq_chip *chip, +struct regmap_irq_chip_data **data) +{ +int irq; + + irq =regmap_irq_get_virq (pdata, pirq); +if (irq <0 ) { +dev_err (pmic->dev, +"Failed to get parent vIRQ(%d) for chip %s, ret:%d\n" , + pirq, chip->name, irq); +return irq; + } + +return devm_regmap_add_irq_chip (pmic->dev, pmic->regmap, irq, irq_flags, +0 , chip, data); +} +static int bxtwc_probe (struct platform_device *pdev) {int ret;
@@ -408,21 +472,65 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } - ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_level2, - &pmic->irq_chip_data_level2); + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_TMU_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_tmu, + &pmic->irq_chip_data_tmu);if (ret) { -dev_err (&pdev->dev,"Failed to add secondary IRQ chip\n" ); +dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" );return ret; } - ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_tmu, - &pmic->irq_chip_data_tmu); +/* Add chained IRQ handler for BCU IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_BCU_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_bcu, + &pmic->irq_chip_data_bcu); + +if (ret) { -dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" ); +dev_err (&pdev->dev,"Failed to add BUC IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for ADC IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_ADC_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_adc, + &pmic->irq_chip_data_adc); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add ADC IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for CHGR IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_CHGR_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_chgr, + &pmic->irq_chip_data_chgr); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add CHGR IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for CRIT IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_CRIT_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_crit, + &pmic->irq_chip_data_crit); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add CRIT IRQ chip\n" );return ret; }
drivers/usb/typec/typec_wcove.c +1 -1
@@ -303,7 +303,7 @@ static int wcove_typec_probe(struct platform_device *pdev) wcove->dev = &pdev->dev; wcove->regmap = pmic->regmap; - ret =regmap_irq_get_virq (pmic->irq_chip_data_level2, + ret =regmap_irq_get_virq (pmic->irq_chip_data_chgr,platform_get_irq (pdev,0 ));if (ret <0 )return ret;
include/linux/mfd/intel_soc_pmic.h +4 -1
@@ -25,8 +25,11 @@ struct intel_soc_pmic {int irq;struct regmap *regmap;struct regmap_irq_chip_data *irq_chip_data; -struct regmap_irq_chip_data *irq_chip_data_level2;struct regmap_irq_chip_data *irq_chip_data_tmu; +struct regmap_irq_chip_data *irq_chip_data_bcu; +struct regmap_irq_chip_data *irq_chip_data_adc; +struct regmap_irq_chip_data *irq_chip_data_chgr; +struct regmap_irq_chip_data *irq_chip_data_crit;struct device *dev; };
Signature · 1 line
2.7.4
Heikki Krogerus
maintainerRe: [PATCH v6 5/6] mfd: intel_soc_pmic_bxtwc: Use chained IRQs for second level IRQ chips
Quoted 35 lines · On Mon, Jun 05, 2017 at 12:08:05PM -0700…
From: Kuppuswamy Sathyanarayanan <[email protected]>
Whishkey cove PMIC has support to mask/unmask interrupts at two levels. At first level we can mask/unmask interrupt domains like TMU, GPIO, ADC, CHGR, BCU THERMAL and PWRBTN and at second level, it provides facility to mask/unmask individual interrupts belong each of this domain. For example, in case of TMU, at first level we have TMU interrupt domain, and at second level we have two interrupts, wake alarm, system alarm that belong to the TMU interrupt domain.
Currently, in this driver all first level IRQs are registered as part of IRQ
chip(bxtwc_regmap_irq_chip). By default, after you register the IRQ chip from your driver, all IRQs in that chip will masked and can only be enabled if that IRQ is requested usingrequest_irq()call. This is the default Linux IRQ behavior model. And whenever a dependent device that belongs to PMIC requests only the second level IRQ and not explicitly unmask the first level IRQ, then in essence the second level IRQ will still be disabled. For example, if TMU device driver requestwake_alarmIRQ and not explicitly unmask TMU level 1 IRQ then according to the default Linux IRQ model,wake_alarmIRQ will still be disabled. So the proper solution to fix this issue is to use the chained IRQ chip concept. We should chain all the second level chip IRQs to the corresponding first level IRQ. To do this, we need to create separate IRQ chips for every group of second level IRQs.In case of TMU, when adding second level IRQ chip, instead of using PMIC IRQ we should use the corresponding first level IRQ. So the following code will change from
ret =
regmap_add_irq_chip(pmic->regmap, pmic->irq, ...)to,
virq =
regmap_irq_get_virq(&pmic->irq_chip_data, BXTWC_TMU_LVL1_IRQ);
Quoted 8 lines
ret =
regmap_add_irq_chip(pmic->regmap, virq, ...)In case of Whiskey Cove Type-C driver, Since USBC IRQ is moved under charger level2 IRQ chip. We should use charger IRQ
chip(irq_chip_data_chgr)to get the USBC virtual IRQ number.Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>
For the typec_wcove.c part:
Thanks,
Signature · 1 line
heikki
[email protected]
maintainerPATCH v6 6/6 platform/x86: intel_bxtwc_tmu: Remove first level IRQ unmask
In reply to Andy ShevchenkoFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Currently in WCOVE PMIC MFD driver, all second level IRQ chips are chained to the respective first level IRQs. So there is no need for explicitly unmasking the first level IRQ in this driver. This patches removes this level 1 IRQ unmask support.
--- drivers/platform/x86/intel_bxtwc_tmu.c | 4 ---- 1 file changed, 4 deletions(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
Changes since v3:
* None
Changes since v4:
* Changed commit subject from "platform: x86:" "to platform/x86:"
Changes since v5:
* Changed irq->IRQ, mfd->MFD.
drivers/platform/x86/intel_bxtwc_tmu.c +0 -4
@@ -92,10 +92,6 @@ static int bxt_wcove_tmu_probe(struct platform_device *pdev) } wctmu->irq = virq; -/* Enable TMU interrupts */ -regmap_update_bits (wctmu->regmap,BXTWC_MIRQLVL1 , -BXTWC_MIRQLVL1_MTMU ,0 ); -/* Unmask TMU second level Wake & System alarm */ regmap_update_bits (wctmu->regmap,BXTWC_MTMUIRQ_REG ,BXTWC_TMU_ALRM_MASK ,0 );
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v5 4/8 mfd: intel_soc_pmic_bxtwc: Remove second level irq for gpio device
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Currently all PMIC GPIO domain irqs are consumed by the same device(bxt_wcove_gpio), so there is no need to export them as separate interrupts. We can just export only the first level GPIO irq(BXTWC_GPIO_LVL1_IRQ) as an irq resource and let the GPIO device driver(bxt_wcove_gpio) handle the GPIO sub domain irqs based on status value of GPIO level2 interrupt status register. Also, just using only the first level irq will eliminate the bug involved in requesting only the second level irq and not explicitly enable the first level irq. For more info on this issue please read the details at,
https://lkml.org/lkml/2017/2/27/148
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
Changes since v3:
* None
drivers/mfd/intel_soc_pmic_bxtwc.c +1 -6
@@ -89,8 +89,6 @@ enum bxtwc_irqs_level2 {BXTWC_USBC_IRQ ,BXTWC_CHGR0_IRQ ,BXTWC_CHGR1_IRQ , -BXTWC_GPIO0_IRQ , -BXTWC_GPIO1_IRQ , BXTWC_CRIT_IRQ, };
@@ -116,8 +114,6 @@ static const struct regmap_irq bxtwc_regmap_irqs_level2[] = {REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )),REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ),REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_GPIO0_IRQ ,4 ,0xff ), -REGMAP_IRQ_REG (BXTWC_GPIO1_IRQ ,5 ,0x3f ), REGMAP_IRQ_REG(BXTWC_CRIT_IRQ, 6, 0x03), };
@@ -153,8 +149,7 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { };static struct resource gpio_resources[] = { -DEFINE_RES_IRQ_NAMED (BXTWC_GPIO0_IRQ ,"GPIO0" ), -DEFINE_RES_IRQ_NAMED (BXTWC_GPIO1_IRQ ,"GPIO1" ), +DEFINE_RES_IRQ_NAMED (BXTWC_GPIO_LVL1_IRQ ,"GPIO" ), };static struct resource adc_resources[] = {
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v5 5/8 gpio: gpio-wcove: Use first level PMIC GPIO irq
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for GPIO device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC GPIO irq.
--- drivers/gpio/gpio-wcove.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
Changes since v1:
* used correct mask for GPIO0 and GPIO1 interrupts
Changes since v2:
* Rebased on top of latest release.
* Removed IRQ0 and IRQ1 mask defines.
Changes since v3:
* None
drivers/gpio/gpio-wcove.c +13 -1
@@ -401,7 +401,7 @@ static int wcove_gpio_probe(struct platform_device *pdev)if (!wg)return -ENOMEM ; - wg->regmap_irq_chip = pmic->irq_chip_data_level2; + wg->regmap_irq_chip = pmic->irq_chip_data;platform_set_drvdata (pdev, wg);
@@ -449,6 +449,18 @@ static int wcove_gpio_probe(struct platform_device *pdev)gpiochip_set_nested_irqchip (&wg->chip, &wcove_irqchip, virq); +/* Enable GPIO0 interrupts */ + ret =regmap_update_bits (wg->regmap,IRQ_MASK_BASE ,GPIO_IRQ0_MASK , +0x00 ); +if (ret) +return ret; + +/* Enable GPIO1 interrupts */ + ret =regmap_update_bits (wg->regmap,IRQ_MASK_BASE +1 ,GPIO_IRQ1_MASK , +0x00 ); +if (ret) +return ret; +return 0 ; }
Signature · 1 line
2.7.4
Re: [PATCH v5 5/8] gpio: gpio-wcove: Use first level PMIC GPIO irq
Quoted 7 lines · On Thu, Jun 1, 2017 at 1:37 AM, <[email protected]>…
From: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for GPIO device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC GPIO irq.
Shouldn't be this squashed to patch 4?
Quoted 51 lines
Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>Acked-by Linus Walleij <[email protected]>--- drivers/gpio/gpio-wcove.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)Changes since v1:
* used correct mask for GPIO0 and GPIO1 interruptsChanges since v2:
* Rebased on top of latest release.
* Removed IRQ0 and IRQ1 mask defines.Changes since v3:
* Nonedrivers/gpio/gpio-wcove.c +13
-2@@ -401,7 +401,7 @@ static int wcove_gpio_probe(struct platform_device *pdev)if (!wg)return -ENOMEM ; - wg->regmap_irq_chip = pmic->irq_chip_data_level2; + wg->regmap_irq_chip = pmic->irq_chip_data;platform_set_drvdata (pdev, wg);@@ -449,6 +449,18 @@ static int wcove_gpio_probe(struct platform_device *pdev)gpiochip_set_nested_irqchip (&wg->chip, &wcove_irqchip, virq); +/* Enable GPIO0 interrupts */ + ret =regmap_update_bits (wg->regmap,IRQ_MASK_BASE ,GPIO_IRQ0_MASK , +0x00 ); +if (ret) +return ret; + +/* Enable GPIO1 interrupts */ + ret =regmap_update_bits (wg->regmap,IRQ_MASK_BASE +1 ,GPIO_IRQ1_MASK , +0x00 ); +if (ret) +return ret; +return 0 ; } --2.7.4
Signature · 2 lines
With Best Regards, Andy Shevchenko
[email protected]
maintainerPATCH v5 6/8 mfd: intel_soc_pmic_bxtwc: Utilize devm_* functions in driver probe
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy-VuQAYsv1563Yd54FQh9/[email protected]>
Cleanup the resource allocation/free code in probe function by using devm_* calls.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 54 +++++++++++++------------------------- 1 file changed, 18 insertions(+), 36 deletions(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
Changes since v3:
* None
drivers/mfd/intel_soc_pmic_bxtwc.c +18 -31
@@ -399,45 +399,44 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip, - &pmic->irq_chip_data); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip, + &pmic->irq_chip_data);if (ret) {dev_err (&pdev->dev,"Failed to add IRQ chip\n" );return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_level2, - &pmic->irq_chip_data_level2); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip_level2, + &pmic->irq_chip_data_level2);if (ret) {dev_err (&pdev->dev,"Failed to add secondary IRQ chip\n" ); - goto err_irq_chip_level2; +return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_tmu, - &pmic->irq_chip_data_tmu); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip_tmu, + &pmic->irq_chip_data_tmu);if (ret) {dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" ); - goto err_irq_chip_tmu; +return ret; } - ret =mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , bxt_wc_dev, -ARRAY_SIZE (bxt_wc_dev),NULL ,0 , -NULL ); + ret =devm_mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , bxt_wc_dev, +ARRAY_SIZE (bxt_wc_dev),NULL ,0 ,NULL );if (ret) {dev_err (&pdev->dev,"Failed to add devices\n" ); - goto err_mfd; +return ret; } ret =sysfs_create_group (&pdev->dev.kobj, &bxtwc_group);if (ret) {dev_err (&pdev->dev,"Failed to create sysfs group %d\n" , ret); - goto err_sysfs; +return ret; }/*
@@ -451,28 +450,11 @@ static int bxtwc_probe(struct platform_device *pdev) BXTWC_MIRQLVL1_MCHGR, 0);return 0 ; - -err_sysfs: -mfd_remove_devices (&pdev->dev); -err_mfd: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_tmu); -err_irq_chip_tmu: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_level2); -err_irq_chip_level2: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data); - -return ret; }static int bxtwc_remove (struct platform_device *pdev) { -struct intel_soc_pmic *pmic =dev_get_drvdata (&pdev->dev);
Re: [PATCH v5 6/8] mfd: intel_soc_pmic_bxtwc: Utilize devm_* functions in driver probe
Quoted 2 lines · On Thu, Jun 1, 2017 at 1:37 AM, <[email protected]>…
Cleanup the resource allocation/free code in probe function by using devm_* calls.
This change is okay.
Quoted 115 lines
Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>--- drivers/mfd/intel_soc_pmic_bxtwc.c | 54 +++++++++++++------------------------- 1 file changed, 18 insertions(+), 36 deletions(-)Changes since v1:
* NoneChanges since v2:
* Rebased on top of latest release.Changes since v3:
* Nonedrivers/mfd/intel_soc_pmic_bxtwc.c +18
-37@@ -399,45 +399,44 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip, - &pmic->irq_chip_data); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip, + &pmic->irq_chip_data);if (ret) {dev_err (&pdev->dev,"Failed to add IRQ chip\n" );return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_level2, - &pmic->irq_chip_data_level2); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip_level2, + &pmic->irq_chip_data_level2);if (ret) {dev_err (&pdev->dev,"Failed to add secondary IRQ chip\n" ); - goto err_irq_chip_level2; +return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_tmu, - &pmic->irq_chip_data_tmu); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip_tmu, + &pmic->irq_chip_data_tmu);if (ret) {dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" ); - goto err_irq_chip_tmu; +return ret; } - ret =mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , bxt_wc_dev, -ARRAY_SIZE (bxt_wc_dev),NULL ,0 , -NULL ); + ret =devm_mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , bxt_wc_dev, +ARRAY_SIZE (bxt_wc_dev),NULL ,0 ,NULL );if (ret) {dev_err (&pdev->dev,"Failed to add devices\n" ); - goto err_mfd; +return ret; } ret =sysfs_create_group (&pdev->dev.kobj, &bxtwc_group);if (ret) {dev_err (&pdev->dev,"Failed to create sysfs group %d\n" , ret); - goto err_sysfs; +return ret; }/* @@ -451,28 +450,11 @@ static int bxtwc_probe(struct platform_device *pdev) BXTWC_MIRQLVL1_MCHGR, 0);return 0 ; - -err_sysfs: -mfd_remove_devices (&pdev->dev); -err_mfd: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_tmu); -err_irq_chip_tmu: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_level2); -err_irq_chip_level2: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data); - -return ret; }static int bxtwc_remove (struct platform_device *pdev) { -struct intel_soc_pmic *pmic =dev_get_drvdata (&pdev->dev); -sysfs_remove_group (&pdev->dev.kobj, &bxtwc_group); -mfd_remove_devices (&pdev->dev); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_level2); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_tmu);return 0 ; } --2.7.4
Signature · 2 lines
With Best Regards, Andy Shevchenko
[email protected]
maintainerPATCH v5 7/8 mfd: intel_soc_pmic_bxtwc: Use chained irqs for second level irq chips
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Whishkey cove PMIC has support to mask/unmask interrupts at two levels. At first level we can mask/unmask interrupt domains like TMU, GPIO, ADC, CHGR, BCU THERMAL and PWRBTN and at second level, it provides facility to mask/unmask individual interrupts belong each of this domain. For example, in case of TMU, at first level we have TMU interrupt domain, and at second level we have two interrupts, wake alarm, system alarm that belong to the TMU interrupt domain.
Currently, in this driver all first level irqs are registered as part of irq chip(bxtwc_regmap_irq_chip). By default, after you register the irq chip from your driver, all irqs in that chip will masked and can only be enabled if that irq is requested using request_irq call. This is the default Linux irq behavior model. And whenever a dependent device that belongs to PMIC requests only the second level irq and not explicitly unmask the first level irq, then in essence the second level irq will still be disabled. For example, if TMU device driver request wake_alarm irq and not explicitly unmask TMU level 1 irq then according to the default Linux irq model, wake_alarm irq will still be disabled. So the proper solution to fix this issue is to use the chained irq chip concept. We should chain all the second level chip irqs to the corresponding first level irq. To do this, we need to create separate irq chips for every group of second level irqs.
In case of TMU, when adding second level irq chip, instead of using pmic irq we should use the corresponding first level irq. So the following code will change from
ret = regmap_add_irq_chip(pmic->regmap, pmic->irq, ...)
to,
virq = regmap_irq_get_virq(&pmic->irq_chip_data, BXTWC_TMU_LVL1_IRQ);
ret = regmap_add_irq_chip(pmic->regmap, virq, ...)
In case of typec wcove driver, Since USBC IRQ is moved under charger level2 irq chip. We should use charger irq chip(irq_chip_data_chgr) to get the USBC virtual IRQ number.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 174 +++++++++++++++++++++++++++++-------- drivers/usb/typec/typec_wcove.c | 2 +- include/linux/mfd/intel_soc_pmic.h | 5 +- 3 files changed, 145 insertions(+), 36 deletions(-)
Changes since v1:
* Rebased on top of dev_* cleanup patch.
* Fixed style & grammer issues reported by Lee Jones
Changes since v2:
* Rebased on top of latest release.
Changes since v3:
* None
Changes since v4:
* Merged typec driver fix to this patch to prevent branch bisect issue.
drivers/mfd/intel_soc_pmic_bxtwc.c +140 -34
@@ -82,18 +82,26 @@ enum bxtwc_irqs { BXTWC_PWRBTN_IRQ, }; -enum bxtwc_irqs_level2 { -/* Level 2 */ +enum bxtwc_irqs_tmu { +BXTWC_TMU_IRQ =0 , +}; + +enum bxtwc_irqs_bcu {BXTWC_BCU_IRQ =0 , -BXTWC_ADC_IRQ , -BXTWC_USBC_IRQ , +}; + +enum bxtwc_irqs_adc { +BXTWC_ADC_IRQ =0 , +}; + +enum bxtwc_irqs_chgr { +BXTWC_USBC_IRQ =0 ,BXTWC_CHGR0_IRQ ,BXTWC_CHGR1_IRQ , -BXTWC_CRIT_IRQ , }; -enum bxtwc_irqs_tmu { -BXTWC_TMU_IRQ =0 , +enum bxtwc_irqs_crit { +BXTWC_CRIT_IRQ =0 , };static const struct regmap_irq bxtwc_regmap_irqs[] = {
@@ -108,17 +116,26 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = { REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 1, 0x03), }; -static const struct regmap_irq bxtwc_regmap_irqs_level2[] = { +static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = { +REGMAP_IRQ_REG (BXTWC_TMU_IRQ ,0 ,0x06 ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = {REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,0 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,1 ,0xff ), -REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )), -REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,6 ,0x03 ), }; -static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = { -REGMAP_IRQ_REG (BXTWC_TMU_IRQ ,0 ,0x06 ), +static const struct regmap_irq bxtwc_regmap_irqs_adc[] = { +REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,0 ,0xff ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = { +REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,0 ,BIT (5 )), +REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,0 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,1 ,0x1f ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_crit[] = { +REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,0 ,0x03 ), };static struct regmap_irq_chip bxtwc_regmap_irq_chip = {
@@ -130,15 +147,6 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = { .num_regs = 2, }; -static struct regmap_irq_chip bxtwc_regmap_irq_chip_level2 = { - .name ="bxtwc_irq_chip_level2" , - .status_base =BXTWC_BCUIRQ , - .mask_base =BXTWC_MBCUIRQ , - .irqs = bxtwc_regmap_irqs_level2, - .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_level2), - .num_regs =10 , -}; -static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { .name ="bxtwc_irq_chip_tmu" , .status_base =BXTWC_TMUIRQ ,
@@ -148,6 +156,42 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { .num_regs = 1, }; +static struct regmap_irq_chip bxtwc_regmap_irq_chip_bcu = { + .name ="bxtwc_irq_chip_bcu" , + .status_base =BXTWC_BCUIRQ , + .mask_base =BXTWC_MBCUIRQ , + .irqs = bxtwc_regmap_irqs_bcu, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_bcu), + .num_regs =1 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_adc = { + .name ="bxtwc_irq_chip_adc" , + .status_base =BXTWC_ADCIRQ , + .mask_base =BXTWC_MADCIRQ , + .irqs = bxtwc_regmap_irqs_adc, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_adc), + .num_regs =1 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_chgr = { + .name ="bxtwc_irq_chip_chgr" , + .status_base =BXTWC_CHGR0IRQ , + .mask_base =BXTWC_MCHGR0IRQ , + .irqs = bxtwc_regmap_irqs_chgr, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_chgr), + .num_regs =2 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_crit = { + .name ="bxtwc_irq_chip_crit" , + .status_base =BXTWC_CRITIRQ , + .mask_base =BXTWC_MCRITIRQ , + .irqs = bxtwc_regmap_irqs_crit, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_crit), + .num_regs =1 , +}; +static struct resource gpio_resources[] = {DEFINE_RES_IRQ_NAMED (BXTWC_GPIO_LVL1_IRQ ,"GPIO" ), };
@@ -357,6 +401,24 @@ static const struct regmap_config bxtwc_regmap_config = { .reg_read = regmap_ipc_byte_reg_read, }; +static int bxtwc_add_chained_irq_chip (struct intel_soc_pmic *pmic, +struct regmap_irq_chip_data *pdata, +int pirq,int irq_flags, +const struct regmap_irq_chip *chip, +struct regmap_irq_chip_data **data) +{ +int irq; + + irq =regmap_irq_get_virq (pdata, pirq); +if (irq <0 ) { +dev_err (pmic->dev,"failed to get virtual interrupt:%d\n" , irq); +return irq; + } + +return devm_regmap_add_irq_chip (pmic->dev, pmic->regmap, irq, irq_flags, +0 , chip, data); +} +static int bxtwc_probe (struct platform_device *pdev) {int ret;
@@ -408,21 +470,65 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } - ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_level2, - &pmic->irq_chip_data_level2); + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_TMU_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_tmu, + &pmic->irq_chip_data_tmu);if (ret) { -dev_err (&pdev->dev,"Failed to add secondary IRQ chip\n" ); +dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" );return ret; } - ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_tmu, - &pmic->irq_chip_data_tmu); +/* Add chained IRQ handler for BCU IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_BCU_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_bcu, + &pmic->irq_chip_data_bcu); + +if (ret) { -dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" ); +dev_err (&pdev->dev,"Failed to add BUC IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for ADC IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_ADC_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_adc, + &pmic->irq_chip_data_adc); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add ADC IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for CHGR IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_CHGR_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_chgr, + &pmic->irq_chip_data_chgr); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add CHGR IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for CRIT IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_CRIT_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_crit, + &pmic->irq_chip_data_crit); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add CRIT IRQ chip\n" );return ret; }
drivers/usb/typec/typec_wcove.c +1 -1
@@ -303,7 +303,7 @@ static int wcove_typec_probe(struct platform_device *pdev) wcove->dev = &pdev->dev; wcove->regmap = pmic->regmap; - ret =regmap_irq_get_virq (pmic->irq_chip_data_level2, + ret =regmap_irq_get_virq (pmic->irq_chip_data_chgr,platform_get_irq (pdev,0 ));if (ret <0 )return ret;
include/linux/mfd/intel_soc_pmic.h +4 -1
@@ -25,8 +25,11 @@ struct intel_soc_pmic {int irq;struct regmap *regmap;struct regmap_irq_chip_data *irq_chip_data; -struct regmap_irq_chip_data *irq_chip_data_level2;struct regmap_irq_chip_data *irq_chip_data_tmu; +struct regmap_irq_chip_data *irq_chip_data_bcu; +struct regmap_irq_chip_data *irq_chip_data_adc; +struct regmap_irq_chip_data *irq_chip_data_chgr; +struct regmap_irq_chip_data *irq_chip_data_crit;struct device *dev; };
Signature · 1 line
2.7.4
Re: [PATCH v5 7/8] mfd: intel_soc_pmic_bxtwc: Use chained irqs for second level irq chips
Quoted 25 lines · On Thu, Jun 1, 2017 at 1:37 AM, <[email protected]>…
From: Kuppuswamy Sathyanarayanan <[email protected]>
Whishkey cove PMIC has support to mask/unmask interrupts at two levels. At first level we can mask/unmask interrupt domains like TMU, GPIO, ADC, CHGR, BCU THERMAL and PWRBTN and at second level, it provides facility to mask/unmask individual interrupts belong each of this domain. For example, in case of TMU, at first level we have TMU interrupt domain, and at second level we have two interrupts, wake alarm, system alarm that belong to the TMU interrupt domain.
Currently, in this driver all first level irqs are registered as part of irq
chip(bxtwc_regmap_irq_chip). By default, after you register the irq chip from your driver, all irqs in that chip will masked and can only be enabled if that irq is requested usingrequest_irqcall. This is the default Linux irq behavior model. And whenever a dependent device that belongs to PMIC requests only the second level irq and not explicitly unmask the first level irq, then in essence the second level irq will still be disabled. For example, if TMU device driver requestwake_alarmirq and not explicitly unmask TMU level 1 irq then according to the default Linux irq model,wake_alarmirq will still be disabled. So the proper solution to fix this issue is to use the chained irq chip concept. We should chain all the second level chip irqs to the corresponding first level irq. To do this, we need to create separate irq chips for every group of second level irqs.
Quoted 3 lines
In case of TMU, when adding second level irq chip, instead of using pmic irq we should use the corresponding first level irq. So the following code will change from
pmic -> PMIC
irq -> IRQ
irqs -> IRQs
These do apply to entire commit message.
Quoted 5 lines
ret =
regmap_add_irq_chip(pmic->regmap, pmic->irq, ...)to,
Quoted 7 lines
virq =
regmap_irq_get_virq(&pmic->irq_chip_data, BXTWC_TMU_LVL1_IRQ);ret =
regmap_add_irq_chip(pmic->regmap, virq, ...)In case of typec wcove driver, Since USBC IRQ is moved under charger level2 irq chip. We should use charger irq
chip(irq_chip_data_chgr)to get the USBC virtual IRQ number.
typec wcove -> Whiskey Cove Type-C
drivers/mfd/intel_soc_pmic_bxtwc.c enum bxtwc_irqs { · line 96
Quoted 6 lines
drivers/mfd/intel_soc_pmic_bxtwc.c +3
-2+enum bxtwc_irqs_tmu { +BXTWC_TMU_IRQ =0 , +}; -enum bxtwc_irqs_tmu { -BXTWC_TMU_IRQ =0 ,
Leave it on the same place it will make patch a bit more cleaner.
drivers/mfd/intel_soc_pmic_bxtwc.c static const struct regmap_irq bxtwc_regmap_irqs[] = { · line 121
Quoted 6 lines
drivers/mfd/intel_soc_pmic_bxtwc.c +3
-2+static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = { +REGMAP_IRQ_REG (BXTWC_TMU_IRQ ,0 ,0x06 ), +}; -static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = { -REGMAP_IRQ_REG (BXTWC_TMU_IRQ ,0 ,0x06 ),
Ditto.
drivers/mfd/intel_soc_pmic_bxtwc.c static const struct regmap_config bxtwc_regmap_config = { · line 414
Quoted 11 lines
drivers/mfd/intel_soc_pmic_bxtwc.c +11
-0+static int bxtwc_add_chained_irq_chip (struct intel_soc_pmic *pmic, +struct regmap_irq_chip_data *pdata, +int pirq,int irq_flags, +const struct regmap_irq_chip *chip, +struct regmap_irq_chip_data **data) +{ +int irq; + + irq =regmap_irq_get_virq (pdata, pirq); +if (irq <0 ) { +dev_err (pmic->dev,"failed to get virtual interrupt:%d\n" , irq);
Follow below pattern, i.e. "Failed to ..."
Moreover, it would be useful to see for which interrupt we are trying to get a virtual one.chip->name + pirq I guess would give us a thing.
Quoted 6 lines
drivers/mfd/intel_soc_pmic_bxtwc.c +6
-0+return irq; + } + +return devm_regmap_add_irq_chip (pmic->dev, pmic->regmap, irq, irq_flags, +0 , chip, data); +}
Signature · 2 lines
With Best Regards, Andy Shevchenko
[email protected]
maintainerPATCH v5 8/8 platform/x86: intel_bxtwc_tmu: Remove first level irq unmask
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Currently in WCOVE PMIC mfd driver, all second level irq chips are chained to the respective first level irqs. So there is no need for explicitly unmasking the first level irq in this driver. This patches removes this level 1 irq unmask support.
--- drivers/platform/x86/intel_bxtwc_tmu.c | 4 ---- 1 file changed, 4 deletions(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
Changes since v3:
* None
Changes since v4:
* Changed commit subject from "platform: x86:" "to platform/x86:"
drivers/platform/x86/intel_bxtwc_tmu.c +0 -4
@@ -92,10 +92,6 @@ static int bxt_wcove_tmu_probe(struct platform_device *pdev) } wctmu->irq = virq; -/* Enable TMU interrupts */ -regmap_update_bits (wctmu->regmap,BXTWC_MIRQLVL1 , -BXTWC_MIRQLVL1_MTMU ,0 ); -/* Unmask TMU second level Wake & System alarm */ regmap_update_bits (wctmu->regmap,BXTWC_MTMUIRQ_REG ,BXTWC_TMU_ALRM_MASK ,0 );
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v3 2/8 mfd: intel_soc_pmic_bxtwc: remove thermal second level irqs
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Since all second level thermal irqs are consumed by the same device(bxt_wcove_thermal), there is no need to expose them as separate interrupts. We can just export only the first level irqs for thermal and let the device(bxt_wcove_thermal) driver handle the second level irqs based on thermal interrupt status register. Also, just using only the first level irq will eliminate the bug involved in requesting only the second level irq and not explicitly enable the first level irq. For more info on this issue please read the details at,
https://lkml.org/lkml/2017/2/27/148
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
drivers/mfd/intel_soc_pmic_bxtwc.c +12 -20
@@ -84,10 +84,7 @@ enum bxtwc_irqs {enum bxtwc_irqs_level2 {/* Level 2 */ -BXTWC_THRM0_IRQ =0 , -BXTWC_THRM1_IRQ , -BXTWC_THRM2_IRQ , -BXTWC_BCU_IRQ , +BXTWC_BCU_IRQ =0 ,BXTWC_ADC_IRQ ,BXTWC_USBC_IRQ ,BXTWC_CHGR0_IRQ ,
@@ -114,17 +111,14 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = { };static const struct regmap_irq bxtwc_regmap_irqs_level2[] = { -REGMAP_IRQ_REG (BXTWC_THRM0_IRQ ,0 ,0xff ), -REGMAP_IRQ_REG (BXTWC_THRM1_IRQ ,1 ,0xbf ), -REGMAP_IRQ_REG (BXTWC_THRM2_IRQ ,2 ,0xff ), -REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,4 ,0xff ), -REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,5 ,BIT (5 )), -REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,5 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,6 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_GPIO0_IRQ ,7 ,0xff ), -REGMAP_IRQ_REG (BXTWC_GPIO1_IRQ ,8 ,0x3f ), -REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,9 ,0x03 ), +REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,0 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,1 ,0xff ), +REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )), +REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_GPIO0_IRQ ,4 ,0xff ), +REGMAP_IRQ_REG (BXTWC_GPIO1_IRQ ,5 ,0x3f ), +REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,6 ,0x03 ), };static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = {
@@ -142,8 +136,8 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = {static struct regmap_irq_chip bxtwc_regmap_irq_chip_level2 = { .name ="bxtwc_irq_chip_level2" , - .status_base =BXTWC_THRM0IRQ , - .mask_base =BXTWC_MTHRM0IRQ , + .status_base =BXTWC_BCUIRQ , + .mask_base =BXTWC_MBCUIRQ , .irqs = bxtwc_regmap_irqs_level2, .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_level2), .num_regs =10 ,
@@ -177,9 +171,7 @@ static struct resource charger_resources[] = { };static struct resource thermal_resources[] = { -DEFINE_RES_IRQ (BXTWC_THRM0_IRQ ), -DEFINE_RES_IRQ (BXTWC_THRM1_IRQ ), -DEFINE_RES_IRQ (BXTWC_THRM2_IRQ ), +DEFINE_RES_IRQ (BXTWC_THRM_LVL1_IRQ ), };static struct resource bcu_resources[] = {
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v3 3/8 thermal: intel_bxt_pmic_thermal: use first level PMIC thermal irq
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for thermal device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC thermal irq.
--- drivers/thermal/intel_bxt_pmic_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
drivers/thermal/intel_bxt_pmic_thermal.c +1 -1
@@ -241,7 +241,7 @@ static int pmic_thermal_probe(struct platform_device *pdev) } regmap = pmic->regmap; - regmap_irq_chip = pmic->irq_chip_data_level2; + regmap_irq_chip = pmic->irq_chip_data; pmic_irq_count =0 ;while ((irq =platform_get_irq (pdev, pmic_irq_count)) != -ENXIO ) {
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v3 4/8 mfd: intel_soc_pmic_bxtwc: remove second level irq for gpio device
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Currently all PMIC GPIO domain irqs are consumed by the same device(bxt_wcove_gpio), so there is no need to export them as separate interrupts. We can just export only the first level GPIO irq(BXTWC_GPIO_LVL1_IRQ) as an irq resource and let the GPIO device driver(bxt_wcove_gpio) handle the GPIO sub domain irqs based on status value of GPIO level2 interrupt status register. Also, just using only the first level irq will eliminate the bug involved in requesting only the second level irq and not explicitly enable the first level irq. For more info on this issue please read the details at,
https://lkml.org/lkml/2017/2/27/148
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
drivers/mfd/intel_soc_pmic_bxtwc.c +1 -6
@@ -89,8 +89,6 @@ enum bxtwc_irqs_level2 {BXTWC_USBC_IRQ ,BXTWC_CHGR0_IRQ ,BXTWC_CHGR1_IRQ , -BXTWC_GPIO0_IRQ , -BXTWC_GPIO1_IRQ , BXTWC_CRIT_IRQ, };
@@ -116,8 +114,6 @@ static const struct regmap_irq bxtwc_regmap_irqs_level2[] = {REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )),REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ),REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_GPIO0_IRQ ,4 ,0xff ), -REGMAP_IRQ_REG (BXTWC_GPIO1_IRQ ,5 ,0x3f ), REGMAP_IRQ_REG(BXTWC_CRIT_IRQ, 6, 0x03), };
@@ -153,8 +149,7 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { };static struct resource gpio_resources[] = { -DEFINE_RES_IRQ_NAMED (BXTWC_GPIO0_IRQ ,"GPIO0" ), -DEFINE_RES_IRQ_NAMED (BXTWC_GPIO1_IRQ ,"GPIO1" ), +DEFINE_RES_IRQ_NAMED (BXTWC_GPIO_LVL1_IRQ ,"GPIO" ), };static struct resource adc_resources[] = {
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v3 5/8 gpio: gpio-wcove: use first level PMIC GPIO irq
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for GPIO device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC GPIO irq.
--- drivers/gpio/gpio-wcove.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
Changes since v1:
* used correct mask for GPIO0 and GPIO1 interrupts
Changes since v2:
* Rebased on top of latest release.
* Removed IRQ0 and IRQ1 mask defines.
drivers/gpio/gpio-wcove.c +13 -1
@@ -401,7 +401,7 @@ static int wcove_gpio_probe(struct platform_device *pdev)if (!wg)return -ENOMEM ; - wg->regmap_irq_chip = pmic->irq_chip_data_level2; + wg->regmap_irq_chip = pmic->irq_chip_data;platform_set_drvdata (pdev, wg);
@@ -449,6 +449,18 @@ static int wcove_gpio_probe(struct platform_device *pdev)gpiochip_set_nested_irqchip (&wg->chip, &wcove_irqchip, virq); +/* Enable GPIO0 interrupts */ + ret =regmap_update_bits (wg->regmap,IRQ_MASK_BASE ,GPIO_IRQ0_MASK , +0x00 ); +if (ret) +return ret; + +/* Enable GPIO1 interrupts */ + ret =regmap_update_bits (wg->regmap,IRQ_MASK_BASE +1 ,GPIO_IRQ1_MASK , +0x00 ); +if (ret) +return ret; +return 0 ; }
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v3 6/8 mfd: intel_soc_pmic_bxtwc: utilize devm_* functions in driver probe
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Cleanup the resource allocation/free code in probe function by using devm_* calls.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 54 +++++++++++++------------------------- 1 file changed, 18 insertions(+), 36 deletions(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
drivers/mfd/intel_soc_pmic_bxtwc.c +18 -36
@@ -399,45 +399,44 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip, - &pmic->irq_chip_data); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip, + &pmic->irq_chip_data);if (ret) {dev_err (&pdev->dev,"Failed to add IRQ chip\n" );return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_level2, - &pmic->irq_chip_data_level2); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip_level2, + &pmic->irq_chip_data_level2);if (ret) {dev_err (&pdev->dev,"Failed to add secondary IRQ chip\n" ); - goto err_irq_chip_level2; +return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_tmu, - &pmic->irq_chip_data_tmu); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip_tmu, + &pmic->irq_chip_data_tmu);if (ret) {dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" ); - goto err_irq_chip_tmu; +return ret; } - ret =mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , bxt_wc_dev, -ARRAY_SIZE (bxt_wc_dev),NULL ,0 , -NULL ); + ret =devm_mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , bxt_wc_dev, +ARRAY_SIZE (bxt_wc_dev),NULL ,0 ,NULL );if (ret) {dev_err (&pdev->dev,"Failed to add devices\n" ); - goto err_mfd; +return ret; } ret =sysfs_create_group (&pdev->dev.kobj, &bxtwc_group);if (ret) {dev_err (&pdev->dev,"Failed to create sysfs group %d\n" , ret); - goto err_sysfs; +return ret; }/*
@@ -451,28 +450,11 @@ static int bxtwc_probe(struct platform_device *pdev) BXTWC_MIRQLVL1_MCHGR, 0);return 0 ; - -err_sysfs: -mfd_remove_devices (&pdev->dev); -err_mfd: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_tmu); -err_irq_chip_tmu: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_level2); -err_irq_chip_level2: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data); - -return ret; }static int bxtwc_remove (struct platform_device *pdev) { -struct intel_soc_pmic *pmic =dev_get_drvdata (&pdev->dev); -sysfs_remove_group (&pdev->dev.kobj, &bxtwc_group); -mfd_remove_devices (&pdev->dev); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_level2); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_tmu);return 0 ; }
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v3 7/8 mfd: intel_soc_pmic_bxtwc: use chained irqs for second level irq chips
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Whishkey cove PMIC has support to mask/unmask interrupts at two levels. At first level we can mask/unmask interrupt domains like TMU, GPIO, ADC, CHGR, BCU THERMAL and PWRBTN and at second level, it provides facility to mask/unmask individual interrupts belong each of this domain. For example, in case of TMU, at first level we have TMU interrupt domain, and at second level we have two interrupts, wake alarm, system alarm that belong to the TMU interrupt domain.
Currently, in this driver all first level irqs are registered as part of irq chip(bxtwc_regmap_irq_chip). By default, after you register the irq chip from your driver, all irqs in that chip will masked and can only be enabled if that irq is requested using request_irq call. This is the default Linux irq behavior model. And whenever a dependent device that belongs to PMIC requests only the second level irq and not explicitly unmask the first level irq, then in essence the second level irq will still be disabled. For example, if TMU device driver request wake_alarm irq and not explicitly unmask TMU level 1 irq then according to the default Linux irq model, wake_alarm irq will still be disabled. So the proper solution to fix this issue is to use the chained irq chip concept. We should chain all the second level chip irqs to the corresponding first level irq. To do this, we need to create separate irq chips for every group of second level irqs.
In case of TMU, when adding second level irq chip, instead of using pmic irq we should use the corresponding first level irq. So the following code will change from
ret = regmap_add_irq_chip(pmic->regmap, pmic->irq, ...)
to,
virq = regmap_irq_get_virq(&pmic->irq_chip_data, BXTWC_TMU_LVL1_IRQ);
ret = regmap_add_irq_chip(pmic->regmap, virq, ...)
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 174 +++++++++++++++++++++++++++++-------- include/linux/mfd/intel_soc_pmic.h | 5 +- 2 files changed, 144 insertions(+), 35 deletions(-)
Changes since v1:
* Rebased on top of dev_* cleanup patch.
* Fixed style & grammer issues reported by Lee Jones
Changes since v2:
* Rebased on top of latest release.
drivers/mfd/intel_soc_pmic_bxtwc.c +140 -34
@@ -82,18 +82,26 @@ enum bxtwc_irqs { BXTWC_PWRBTN_IRQ, }; -enum bxtwc_irqs_level2 { -/* Level 2 */ +enum bxtwc_irqs_tmu { +BXTWC_TMU_IRQ =0 , +}; + +enum bxtwc_irqs_bcu {BXTWC_BCU_IRQ =0 , -BXTWC_ADC_IRQ , -BXTWC_USBC_IRQ , +}; + +enum bxtwc_irqs_adc { +BXTWC_ADC_IRQ =0 , +}; + +enum bxtwc_irqs_chgr { +BXTWC_USBC_IRQ =0 ,BXTWC_CHGR0_IRQ ,BXTWC_CHGR1_IRQ , -BXTWC_CRIT_IRQ , }; -enum bxtwc_irqs_tmu { -BXTWC_TMU_IRQ =0 , +enum bxtwc_irqs_crit { +BXTWC_CRIT_IRQ =0 , };static const struct regmap_irq bxtwc_regmap_irqs[] = {
@@ -108,17 +116,26 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = { REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 1, 0x03), }; -static const struct regmap_irq bxtwc_regmap_irqs_level2[] = { +static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = { +REGMAP_IRQ_REG (BXTWC_TMU_IRQ ,0 ,0x06 ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = {REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,0 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,1 ,0xff ), -REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )), -REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,6 ,0x03 ), }; -static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = { -REGMAP_IRQ_REG (BXTWC_TMU_IRQ ,0 ,0x06 ), +static const struct regmap_irq bxtwc_regmap_irqs_adc[] = { +REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,0 ,0xff ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = { +REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,0 ,BIT (5 )), +REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,0 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,1 ,0x1f ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_crit[] = { +REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,0 ,0x03 ), };static struct regmap_irq_chip bxtwc_regmap_irq_chip = {
@@ -130,15 +147,6 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = { .num_regs = 2, }; -static struct regmap_irq_chip bxtwc_regmap_irq_chip_level2 = { - .name ="bxtwc_irq_chip_level2" , - .status_base =BXTWC_BCUIRQ , - .mask_base =BXTWC_MBCUIRQ , - .irqs = bxtwc_regmap_irqs_level2, - .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_level2), - .num_regs =10 , -}; -static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { .name ="bxtwc_irq_chip_tmu" , .status_base =BXTWC_TMUIRQ ,
@@ -148,6 +156,42 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { .num_regs = 1, }; +static struct regmap_irq_chip bxtwc_regmap_irq_chip_bcu = { + .name ="bxtwc_irq_chip_bcu" , + .status_base =BXTWC_BCUIRQ , + .mask_base =BXTWC_MBCUIRQ , + .irqs = bxtwc_regmap_irqs_bcu, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_bcu), + .num_regs =1 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_adc = { + .name ="bxtwc_irq_chip_adc" , + .status_base =BXTWC_ADCIRQ , + .mask_base =BXTWC_MADCIRQ , + .irqs = bxtwc_regmap_irqs_adc, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_adc), + .num_regs =1 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_chgr = { + .name ="bxtwc_irq_chip_chgr" , + .status_base =BXTWC_CHGR0IRQ , + .mask_base =BXTWC_MCHGR0IRQ , + .irqs = bxtwc_regmap_irqs_chgr, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_chgr), + .num_regs =2 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_crit = { + .name ="bxtwc_irq_chip_crit" , + .status_base =BXTWC_CRITIRQ , + .mask_base =BXTWC_MCRITIRQ , + .irqs = bxtwc_regmap_irqs_crit, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_crit), + .num_regs =1 , +}; +static struct resource gpio_resources[] = {DEFINE_RES_IRQ_NAMED (BXTWC_GPIO_LVL1_IRQ ,"GPIO" ), };
@@ -357,6 +401,24 @@ static const struct regmap_config bxtwc_regmap_config = { .reg_read = regmap_ipc_byte_reg_read, }; +static int bxtwc_add_chained_irq_chip (struct intel_soc_pmic *pmic, +struct regmap_irq_chip_data *pdata, +int pirq,int irq_flags, +const struct regmap_irq_chip *chip, +struct regmap_irq_chip_data **data) +{ +int irq; + + irq =regmap_irq_get_virq (pdata, pirq); +if (irq <0 ) { +dev_err (pmic->dev,"failed to get virtual interrupt:%d\n" , irq); +return irq; + } + +return devm_regmap_add_irq_chip (pmic->dev, pmic->regmap, irq, irq_flags, +0 , chip, data); +} +static int bxtwc_probe (struct platform_device *pdev) {int ret;
@@ -408,21 +470,65 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } - ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_level2, - &pmic->irq_chip_data_level2); + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_TMU_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_tmu, + &pmic->irq_chip_data_tmu);if (ret) { -dev_err (&pdev->dev,"Failed to add secondary IRQ chip\n" ); +dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" );return ret; } - ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_tmu, - &pmic->irq_chip_data_tmu); +/* Add chained IRQ handler for BCU IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_BCU_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_bcu, + &pmic->irq_chip_data_bcu); + +if (ret) { -dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" ); +dev_err (&pdev->dev,"Failed to add BUC IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for ADC IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_ADC_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_adc, + &pmic->irq_chip_data_adc); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add ADC IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for CHGR IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_CHGR_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_chgr, + &pmic->irq_chip_data_chgr); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add CHGR IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for CRIT IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_CRIT_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_crit, + &pmic->irq_chip_data_crit); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add CRIT IRQ chip\n" );return ret; }
include/linux/mfd/intel_soc_pmic.h +4 -1
@@ -25,8 +25,11 @@ struct intel_soc_pmic {int irq;struct regmap *regmap;struct regmap_irq_chip_data *irq_chip_data; -struct regmap_irq_chip_data *irq_chip_data_level2;struct regmap_irq_chip_data *irq_chip_data_tmu; +struct regmap_irq_chip_data *irq_chip_data_bcu; +struct regmap_irq_chip_data *irq_chip_data_adc; +struct regmap_irq_chip_data *irq_chip_data_chgr; +struct regmap_irq_chip_data *irq_chip_data_crit;struct device *dev; };
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v3 8/8 platform: x86: intel_bxtwc_tmu: remove first level irq unmask
In reply to Lee JonesFrom: Kuppuswamy Sathyanarayanan <[email protected]>
Currently in WCOVE PMIC mfd driver, all second level irq chips are chained to the respective first level irqs. So there is no need for explicitly unmasking the first level irq in this driver. This patches removes this level 1 irq unmask support.
--- drivers/platform/x86/intel_bxtwc_tmu.c | 4 ---- 1 file changed, 4 deletions(-)
Changes since v1:
* None
Changes since v2:
* Rebased on top of latest release.
drivers/platform/x86/intel_bxtwc_tmu.c +0 -4
@@ -92,10 +92,6 @@ static int bxt_wcove_tmu_probe(struct platform_device *pdev) } wctmu->irq = virq; -/* Enable TMU interrupts */ -regmap_update_bits (wctmu->regmap,BXTWC_MIRQLVL1 , -BXTWC_MIRQLVL1_MTMU ,0 ); -/* Unmask TMU second level Wake & System alarm */ regmap_update_bits (wctmu->regmap,BXTWC_MTMUIRQ_REG ,BXTWC_TMU_ALRM_MASK ,0 );
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v2 4/8 mfd: intel_soc_pmic_bxtwc: remove second level irq for gpio device
In reply to [email protected]From: Kuppuswamy Sathyanarayanan <[email protected]>
Currently all PMIC GPIO domain irqs are consumed by the same device(bxt_wcove_gpio), so there is no need to export them as separate interrupts. We can just export only the first level GPIO irq(BXTWC_GPIO_LVL1_IRQ) as an irq resource and let the GPIO device driver(bxt_wcove_gpio) handle the GPIO sub domain irqs based on status value of GPIO level2 interrupt status register. Also, just using only the first level irq will eliminate the bug involved in requesting only the second level irq and not explicitly enable the first level irq. For more info on this issue please read the details at,
https://lkml.org/lkml/2017/2/27/148
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
Changes since v1:
* None
drivers/mfd/intel_soc_pmic_bxtwc.c +1 -6
@@ -88,8 +88,6 @@ enum bxtwc_irqs_level2 {BXTWC_USBC_IRQ ,BXTWC_CHGR0_IRQ ,BXTWC_CHGR1_IRQ , -BXTWC_GPIO0_IRQ , -BXTWC_GPIO1_IRQ , BXTWC_CRIT_IRQ, };
@@ -115,8 +113,6 @@ static const struct regmap_irq bxtwc_regmap_irqs_level2[] = {REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )),REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ),REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_GPIO0_IRQ ,4 ,0xff ), -REGMAP_IRQ_REG (BXTWC_GPIO1_IRQ ,5 ,0x3f ), REGMAP_IRQ_REG(BXTWC_CRIT_IRQ, 6, 0x03), };
@@ -152,8 +148,7 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { };static struct resource gpio_resources[] = { -DEFINE_RES_IRQ_NAMED (BXTWC_GPIO0_IRQ ,"GPIO0" ), -DEFINE_RES_IRQ_NAMED (BXTWC_GPIO1_IRQ ,"GPIO1" ), +DEFINE_RES_IRQ_NAMED (BXTWC_GPIO_LVL1_IRQ ,"GPIO" ), };static struct resource adc_resources[] = {
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH v2 5/8 gpio: gpio-wcove: use first level PMIC GPIO irq
In reply to [email protected]From: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for GPIO device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC GPIO irq.
--- drivers/gpio/gpio-wcove.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
Changes since v1:
* used correct mask for GPIO0 and GPIO1 interrupts
drivers/gpio/gpio-wcove.c +15 -1
@@ -51,6 +51,8 @@#define GROUP1_NR_IRQS 6#define IRQ_MASK_BASE 0x4e19#define IRQ_STATUS_BASE 0x4e0b +#define GPIO_IRQ0_MASK 0x7f +#define GPIO_IRQ1_MASK 0x3f#define UPDATE_IRQ_TYPE BIT(0)#define UPDATE_IRQ_MASK BIT(1)
@@ -399,7 +401,7 @@ static int wcove_gpio_probe(struct platform_device *pdev)if (!wg)return -ENOMEM ; - wg->regmap_irq_chip = pmic->irq_chip_data_level2; + wg->regmap_irq_chip = pmic->irq_chip_data;platform_set_drvdata (pdev, wg);
@@ -447,6 +449,18 @@ static int wcove_gpio_probe(struct platform_device *pdev)gpiochip_set_nested_irqchip (&wg->chip, &wcove_irqchip, virq); +/* Enable GPIO0 interrupts */ + ret =regmap_update_bits (wg->regmap,IRQ_MASK_BASE ,GPIO_IRQ0_MASK , +0x00 ); +if (ret) +return ret; + +/* Enable GPIO1 interrupts */ + ret =regmap_update_bits (wg->regmap,IRQ_MASK_BASE +1 ,GPIO_IRQ1_MASK , +0x00 ); +if (ret) +return ret; +return 0 ; }
Signature · 1 line
2.7.4
Re: [PATCH v2 5/8] gpio: gpio-wcove: use first level PMIC GPIO irq
Quoted 8 lines · On Sat, Apr 15, 2017 at 1:25 AM, <[email protected]>…
From: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for GPIO device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC GPIO irq.
Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>
I guess this gets merged into MFD because of dependencies? If it compiles on its own and doesn't cause regressions I can merged it into the GPIO tree.
Yours,
Linus Walleij
Re: [PATCH v2 5/8] gpio: gpio-wcove: use first level PMIC GPIO irq
Quoted 10 lines · Linus Walleij
Quoted 7 lines · On Sat, Apr 15, 2017 at 1:25 AM, <[email protected]>…
From: Kuppuswamy Sathyanarayanan <[email protected]>
PMIC mfd driver only exports first level irq for GPIO device. But currently we are reading the irqs from the second level irq chip, So this patch fixes this issue by adding support to use first level PMIC GPIO irq.
Quoted 5 lines
Quoted 1 line
Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>Acked-by Linus Walleij <[email protected]>I guess this gets merged into MFD because of dependencies?
Yes.
Quoted 2 lines
If it compiles on its own and doesn't cause regressions I can merged it into the GPIO tree.
I guess it will break something if put it separately.
Signature · 2 lines
With Best Regards, Andy Shevchenko
[email protected]
maintainerPATCH v2 6/8 mfd: intel_soc_pmic_bxtwc: utilize devm_* functions in driver probe
In reply to [email protected]From: Kuppuswamy Sathyanarayanan <[email protected]>
Cleanup the resource allocation/free code in probe function by using devm_* calls.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 54 +++++++++++++------------------------- 1 file changed, 18 insertions(+), 36 deletions(-)
Changes since v1:
* None
drivers/mfd/intel_soc_pmic_bxtwc.c +18 -36
@@ -400,45 +400,44 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip, - &pmic->irq_chip_data); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip, + &pmic->irq_chip_data);if (ret) {dev_err (&pdev->dev,"Failed to add IRQ chip\n" );return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_level2, - &pmic->irq_chip_data_level2); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip_level2, + &pmic->irq_chip_data_level2);if (ret) {dev_err (&pdev->dev,"Failed to add secondary IRQ chip\n" ); - goto err_irq_chip_level2; +return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_tmu, - &pmic->irq_chip_data_tmu); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip_tmu, + &pmic->irq_chip_data_tmu);if (ret) {dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" ); - goto err_irq_chip_tmu; +return ret; } - ret =mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , bxt_wc_dev, -ARRAY_SIZE (bxt_wc_dev),NULL ,0 , -NULL ); + ret =devm_mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , bxt_wc_dev, +ARRAY_SIZE (bxt_wc_dev),NULL ,0 ,NULL );if (ret) {dev_err (&pdev->dev,"Failed to add devices\n" ); - goto err_mfd; +return ret; } ret =sysfs_create_group (&pdev->dev.kobj, &bxtwc_group);if (ret) {dev_err (&pdev->dev,"Failed to create sysfs group %d\n" , ret); - goto err_sysfs; +return ret; }/*
@@ -452,28 +451,11 @@ static int bxtwc_probe(struct platform_device *pdev) BXTWC_MIRQLVL1_MCHGR, 0);return 0 ; - -err_sysfs: -mfd_remove_devices (&pdev->dev); -err_mfd: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_tmu); -err_irq_chip_tmu: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_level2); -err_irq_chip_level2: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data); - -return ret; }static int bxtwc_remove (struct platform_device *pdev) { -struct intel_soc_pmic *pmic =dev_get_drvdata (&pdev->dev); -sysfs_remove_group (&pdev->dev.kobj, &bxtwc_group); -mfd_remove_devices (&pdev->dev); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_level2); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_tmu);return 0 ; }
Signature · 1 line
2.7.4
Re: [PATCH v2 6/8] mfd: intel_soc_pmic_bxtwc: utilize devm_* functions in driver probe
Quoted 9 lines · On Fri, 14 Apr 2017, [email protected] wrote:
From: Kuppuswamy Sathyanarayanan <[email protected]>
Cleanup the resource allocation/free code in probe function by using devm_* calls.
Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>--- drivers/mfd/intel_soc_pmic_bxtwc.c | 54 +++++++++++++------------------------- 1 file changed, 18 insertions(+), 36 deletions(-)
For my own reference:
Quoted 100 lines
Changes since v1:
* Nonedrivers/mfd/intel_soc_pmic_bxtwc.c +18
-36@@ -400,45 +400,44 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip, - &pmic->irq_chip_data); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip, + &pmic->irq_chip_data);if (ret) {dev_err (&pdev->dev,"Failed to add IRQ chip\n" );return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_level2, - &pmic->irq_chip_data_level2); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip_level2, + &pmic->irq_chip_data_level2);if (ret) {dev_err (&pdev->dev,"Failed to add secondary IRQ chip\n" ); - goto err_irq_chip_level2; +return ret; } - ret =regmap_add_irq_chip (pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_tmu, - &pmic->irq_chip_data_tmu); + ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, +IRQF_ONESHOT |IRQF_SHARED , +0 , &bxtwc_regmap_irq_chip_tmu, + &pmic->irq_chip_data_tmu);if (ret) {dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" ); - goto err_irq_chip_tmu; +return ret; } - ret =mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , bxt_wc_dev, -ARRAY_SIZE (bxt_wc_dev),NULL ,0 , -NULL ); + ret =devm_mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , bxt_wc_dev, +ARRAY_SIZE (bxt_wc_dev),NULL ,0 ,NULL );if (ret) {dev_err (&pdev->dev,"Failed to add devices\n" ); - goto err_mfd; +return ret; } ret =sysfs_create_group (&pdev->dev.kobj, &bxtwc_group);if (ret) {dev_err (&pdev->dev,"Failed to create sysfs group %d\n" , ret); - goto err_sysfs; +return ret; }/* @@ -452,28 +451,11 @@ static int bxtwc_probe(struct platform_device *pdev) BXTWC_MIRQLVL1_MCHGR, 0);return 0 ; - -err_sysfs: -mfd_remove_devices (&pdev->dev); -err_mfd: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_tmu); -err_irq_chip_tmu: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_level2); -err_irq_chip_level2: -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data); - -return ret; }static int bxtwc_remove (struct platform_device *pdev) { -struct intel_soc_pmic *pmic =dev_get_drvdata (&pdev->dev); -sysfs_remove_group (&pdev->dev.kobj, &bxtwc_group); -mfd_remove_devices (&pdev->dev); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_level2); -regmap_del_irq_chip (pmic->irq, pmic->irq_chip_data_tmu);return 0 ; }
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
[email protected]
maintainerPATCH v2 7/8 mfd: intel_soc_pmic_bxtwc: use chained irqs for second level irq chips
In reply to [email protected]From: Kuppuswamy Sathyanarayanan <[email protected]>
Whishkey cove PMIC has support to mask/unmask interrupts at two levels. At first level we can mask/unmask interrupt domains like TMU, GPIO, ADC, CHGR, BCU THERMAL and PWRBTN and at second level, it provides facility to mask/unmask individual interrupts belong each of this domain. For example, in case of TMU, at first level we have TMU interrupt domain, and at second level we have two interrupts, wake alarm, system alarm that belong to the TMU interrupt domain.
Currently, in this driver all first level irqs are registered as part of irq chip(bxtwc_regmap_irq_chip). By default, after you register the irq chip from your driver, all irqs in that chip will masked and can only be enabled if that irq is requested using request_irq call. This is the default Linux irq behavior model. And whenever a dependent device that belongs to PMIC requests only the second level irq and not explicitly unmask the first level irq, then in essence the second level irq will still be disabled. For example, if TMU device driver request wake_alarm irq and not explicitly unmask TMU level 1 irq then according to the default Linux irq model, wake_alarm irq will still be disabled. So the proper solution to fix this issue is to use the chained irq chip concept. We should chain all the second level chip irqs to the corresponding first level irq. To do this, we need to create separate irq chips for every group of second level irqs.
In case of TMU, when adding second level irq chip, instead of using pmic irq we should use the corresponding first level irq. So the following code will change from
ret = regmap_add_irq_chip(pmic->regmap, pmic->irq, ...)
to,
virq = regmap_irq_get_virq(&pmic->irq_chip_data, BXTWC_TMU_LVL1_IRQ);
ret = regmap_add_irq_chip(pmic->regmap, virq, ...)
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 174 +++++++++++++++++++++++++++++-------- include/linux/mfd/intel_soc_pmic.h | 5 +- 2 files changed, 144 insertions(+), 35 deletions(-)
Changes since v1:
* Rebased on top of dev_* cleanup patch.
* Fixed style & grammer issues reported by Lee Jones
drivers/mfd/intel_soc_pmic_bxtwc.c +140 -34
@@ -81,18 +81,26 @@ enum bxtwc_irqs { BXTWC_PWRBTN_IRQ, }; -enum bxtwc_irqs_level2 { -/* Level 2 */ +enum bxtwc_irqs_tmu { +BXTWC_TMU_IRQ =0 , +}; + +enum bxtwc_irqs_bcu {BXTWC_BCU_IRQ =0 , -BXTWC_ADC_IRQ , -BXTWC_USBC_IRQ , +}; + +enum bxtwc_irqs_adc { +BXTWC_ADC_IRQ =0 , +}; + +enum bxtwc_irqs_chgr { +BXTWC_USBC_IRQ =0 ,BXTWC_CHGR0_IRQ ,BXTWC_CHGR1_IRQ , -BXTWC_CRIT_IRQ , }; -enum bxtwc_irqs_tmu { -BXTWC_TMU_IRQ =0 , +enum bxtwc_irqs_crit { +BXTWC_CRIT_IRQ =0 , };static const struct regmap_irq bxtwc_regmap_irqs[] = {
@@ -107,17 +115,26 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = { REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 1, 0x03), }; -static const struct regmap_irq bxtwc_regmap_irqs_level2[] = { +static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = { +REGMAP_IRQ_REG (BXTWC_TMU_IRQ ,0 ,0x06 ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = {REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,0 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,1 ,0xff ), -REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )), -REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,6 ,0x03 ), }; -static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = { -REGMAP_IRQ_REG (BXTWC_TMU_IRQ ,0 ,0x06 ), +static const struct regmap_irq bxtwc_regmap_irqs_adc[] = { +REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,0 ,0xff ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = { +REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,0 ,BIT (5 )), +REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,0 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,1 ,0x1f ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_crit[] = { +REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,0 ,0x03 ), };static struct regmap_irq_chip bxtwc_regmap_irq_chip = {
@@ -129,15 +146,6 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = { .num_regs = 2, }; -static struct regmap_irq_chip bxtwc_regmap_irq_chip_level2 = { - .name ="bxtwc_irq_chip_level2" , - .status_base =BXTWC_BCUIRQ , - .mask_base =BXTWC_MBCUIRQ , - .irqs = bxtwc_regmap_irqs_level2, - .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_level2), - .num_regs =10 , -}; -static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { .name ="bxtwc_irq_chip_tmu" , .status_base =BXTWC_TMUIRQ ,
@@ -147,6 +155,42 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { .num_regs = 1, }; +static struct regmap_irq_chip bxtwc_regmap_irq_chip_bcu = { + .name ="bxtwc_irq_chip_bcu" , + .status_base =BXTWC_BCUIRQ , + .mask_base =BXTWC_MBCUIRQ , + .irqs = bxtwc_regmap_irqs_bcu, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_bcu), + .num_regs =1 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_adc = { + .name ="bxtwc_irq_chip_adc" , + .status_base =BXTWC_ADCIRQ , + .mask_base =BXTWC_MADCIRQ , + .irqs = bxtwc_regmap_irqs_adc, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_adc), + .num_regs =1 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_chgr = { + .name ="bxtwc_irq_chip_chgr" , + .status_base =BXTWC_CHGR0IRQ , + .mask_base =BXTWC_MCHGR0IRQ , + .irqs = bxtwc_regmap_irqs_chgr, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_chgr), + .num_regs =2 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_crit = { + .name ="bxtwc_irq_chip_crit" , + .status_base =BXTWC_CRITIRQ , + .mask_base =BXTWC_MCRITIRQ , + .irqs = bxtwc_regmap_irqs_crit, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_crit), + .num_regs =1 , +}; +static struct resource gpio_resources[] = {DEFINE_RES_IRQ_NAMED (BXTWC_GPIO_LVL1_IRQ ,"GPIO" ), };
@@ -358,6 +402,24 @@ static const struct regmap_config bxtwc_regmap_config = { .reg_read = regmap_ipc_byte_reg_read, }; +static int bxtwc_add_chained_irq_chip (struct intel_soc_pmic *pmic, +struct regmap_irq_chip_data *pdata, +int pirq,int irq_flags, +const struct regmap_irq_chip *chip, +struct regmap_irq_chip_data **data) +{ +int irq; + + irq =regmap_irq_get_virq (pdata, pirq); +if (irq <0 ) { +dev_err (pmic->dev,"failed to get virtual interrupt:%d\n" , irq); +return irq; + } + +return devm_regmap_add_irq_chip (pmic->dev, pmic->regmap, irq, irq_flags, +0 , chip, data); +} +static int bxtwc_probe (struct platform_device *pdev) {int ret;
@@ -409,21 +471,65 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } - ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_level2, - &pmic->irq_chip_data_level2); + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_TMU_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_tmu, + &pmic->irq_chip_data_tmu);if (ret) { -dev_err (&pdev->dev,"Failed to add secondary IRQ chip\n" ); +dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" );return ret; } - ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_tmu, - &pmic->irq_chip_data_tmu); +/* Add chained IRQ handler for BCU IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_BCU_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_bcu, + &pmic->irq_chip_data_bcu); + +if (ret) { -dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" ); +dev_err (&pdev->dev,"Failed to add BUC IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for ADC IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_ADC_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_adc, + &pmic->irq_chip_data_adc); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add ADC IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for CHGR IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_CHGR_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_chgr, + &pmic->irq_chip_data_chgr); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add CHGR IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for CRIT IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_CRIT_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_crit, + &pmic->irq_chip_data_crit); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add CRIT IRQ chip\n" );return ret; }
include/linux/mfd/intel_soc_pmic.h +4 -1
@@ -25,8 +25,11 @@ struct intel_soc_pmic {int irq;struct regmap *regmap;struct regmap_irq_chip_data *irq_chip_data; -struct regmap_irq_chip_data *irq_chip_data_level2;struct regmap_irq_chip_data *irq_chip_data_tmu; +struct regmap_irq_chip_data *irq_chip_data_bcu; +struct regmap_irq_chip_data *irq_chip_data_adc; +struct regmap_irq_chip_data *irq_chip_data_chgr; +struct regmap_irq_chip_data *irq_chip_data_crit;struct device *dev; };
Signature · 1 line
2.7.4
Re: [PATCH v2 7/8] mfd: intel_soc_pmic_bxtwc: use chained irqs for second level irq chips
Quoted 35 lines · On Fri, 14 Apr 2017, [email protected] wrote:
From: Kuppuswamy Sathyanarayanan <[email protected]>
Whishkey cove PMIC has support to mask/unmask interrupts at two levels. At first level we can mask/unmask interrupt domains like TMU, GPIO, ADC, CHGR, BCU THERMAL and PWRBTN and at second level, it provides facility to mask/unmask individual interrupts belong each of this domain. For example, in case of TMU, at first level we have TMU interrupt domain, and at second level we have two interrupts, wake alarm, system alarm that belong to the TMU interrupt domain.
Currently, in this driver all first level irqs are registered as part of irq
chip(bxtwc_regmap_irq_chip). By default, after you register the irq chip from your driver, all irqs in that chip will masked and can only be enabled if that irq is requested usingrequest_irqcall. This is the default Linux irq behavior model. And whenever a dependent device that belongs to PMIC requests only the second level irq and not explicitly unmask the first level irq, then in essence the second level irq will still be disabled. For example, if TMU device driver requestwake_alarmirq and not explicitly unmask TMU level 1 irq then according to the default Linux irq model,wake_alarmirq will still be disabled. So the proper solution to fix this issue is to use the chained irq chip concept. We should chain all the second level chip irqs to the corresponding first level irq. To do this, we need to create separate irq chips for every group of second level irqs.In case of TMU, when adding second level irq chip, instead of using pmic irq we should use the corresponding first level irq. So the following code will change from
ret =
regmap_add_irq_chip(pmic->regmap, pmic->irq, ...)to,
virq =
regmap_irq_get_virq(&pmic->irq_chip_data, BXTWC_TMU_LVL1_IRQ);
Quoted 7 lines
ret =
regmap_add_irq_chip(pmic->regmap, virq, ...)Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>--- drivers/mfd/intel_soc_pmic_bxtwc.c | 174 +++++++++++++++++++++++++++++-------- include/linux/mfd/intel_soc_pmic.h | 5 +- 2 files changed, 144 insertions(+), 35 deletions(-)
For my own reference:
Quoted 254 lines
Changes since v1:
* Rebased on top of dev_* cleanup patch.
* Fixed style & grammer issues reported by Lee Jonesdrivers/mfd/intel_soc_pmic_bxtwc.c +140
-34@@ -81,18 +81,26 @@ enum bxtwc_irqs { BXTWC_PWRBTN_IRQ, }; -enum bxtwc_irqs_level2 { -/* Level 2 */ +enum bxtwc_irqs_tmu { +BXTWC_TMU_IRQ =0 , +}; + +enum bxtwc_irqs_bcu {BXTWC_BCU_IRQ =0 , -BXTWC_ADC_IRQ , -BXTWC_USBC_IRQ , +}; + +enum bxtwc_irqs_adc { +BXTWC_ADC_IRQ =0 , +}; + +enum bxtwc_irqs_chgr { +BXTWC_USBC_IRQ =0 ,BXTWC_CHGR0_IRQ ,BXTWC_CHGR1_IRQ , -BXTWC_CRIT_IRQ , }; -enum bxtwc_irqs_tmu { -BXTWC_TMU_IRQ =0 , +enum bxtwc_irqs_crit { +BXTWC_CRIT_IRQ =0 , };static const struct regmap_irq bxtwc_regmap_irqs[] = {@@ -107,17 +115,26 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = { REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 1, 0x03), }; -static const struct regmap_irq bxtwc_regmap_irqs_level2[] = { +static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = { +REGMAP_IRQ_REG (BXTWC_TMU_IRQ ,0 ,0x06 ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = {REGMAP_IRQ_REG (BXTWC_BCU_IRQ ,0 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,1 ,0xff ), -REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,2 ,BIT (5 )), -REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,2 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,3 ,0x1f ), -REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,6 ,0x03 ), }; -static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = { -REGMAP_IRQ_REG (BXTWC_TMU_IRQ ,0 ,0x06 ), +static const struct regmap_irq bxtwc_regmap_irqs_adc[] = { +REGMAP_IRQ_REG (BXTWC_ADC_IRQ ,0 ,0xff ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = { +REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,0 ,BIT (5 )), +REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,0 ,0x1f ), +REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,1 ,0x1f ), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_crit[] = { +REGMAP_IRQ_REG (BXTWC_CRIT_IRQ ,0 ,0x03 ), };static struct regmap_irq_chip bxtwc_regmap_irq_chip = {@@ -129,15 +146,6 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = { .num_regs = 2, }; -static struct regmap_irq_chip bxtwc_regmap_irq_chip_level2 = { - .name ="bxtwc_irq_chip_level2" , - .status_base =BXTWC_BCUIRQ , - .mask_base =BXTWC_MBCUIRQ , - .irqs = bxtwc_regmap_irqs_level2, - .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_level2), - .num_regs =10 , -}; -static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { .name ="bxtwc_irq_chip_tmu" , .status_base =BXTWC_TMUIRQ ,@@ -147,6 +155,42 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { .num_regs = 1, }; +static struct regmap_irq_chip bxtwc_regmap_irq_chip_bcu = { + .name ="bxtwc_irq_chip_bcu" , + .status_base =BXTWC_BCUIRQ , + .mask_base =BXTWC_MBCUIRQ , + .irqs = bxtwc_regmap_irqs_bcu, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_bcu), + .num_regs =1 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_adc = { + .name ="bxtwc_irq_chip_adc" , + .status_base =BXTWC_ADCIRQ , + .mask_base =BXTWC_MADCIRQ , + .irqs = bxtwc_regmap_irqs_adc, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_adc), + .num_regs =1 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_chgr = { + .name ="bxtwc_irq_chip_chgr" , + .status_base =BXTWC_CHGR0IRQ , + .mask_base =BXTWC_MCHGR0IRQ , + .irqs = bxtwc_regmap_irqs_chgr, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_chgr), + .num_regs =2 , +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_crit = { + .name ="bxtwc_irq_chip_crit" , + .status_base =BXTWC_CRITIRQ , + .mask_base =BXTWC_MCRITIRQ , + .irqs = bxtwc_regmap_irqs_crit, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_crit), + .num_regs =1 , +}; +static struct resource gpio_resources[] = {DEFINE_RES_IRQ_NAMED (BXTWC_GPIO_LVL1_IRQ ,"GPIO" ), };@@ -358,6 +402,24 @@ static const struct regmap_config bxtwc_regmap_config = { .reg_read = regmap_ipc_byte_reg_read, }; +static int bxtwc_add_chained_irq_chip (struct intel_soc_pmic *pmic, +struct regmap_irq_chip_data *pdata, +int pirq,int irq_flags, +const struct regmap_irq_chip *chip, +struct regmap_irq_chip_data **data) +{ +int irq; + + irq =regmap_irq_get_virq (pdata, pirq); +if (irq <0 ) { +dev_err (pmic->dev,"failed to get virtual interrupt:%d\n" , irq); +return irq; + } + +return devm_regmap_add_irq_chip (pmic->dev, pmic->regmap, irq, irq_flags, +0 , chip, data); +} +static int bxtwc_probe (struct platform_device *pdev) {int ret;@@ -409,21 +471,65 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } - ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_level2, - &pmic->irq_chip_data_level2); + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_TMU_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_tmu, + &pmic->irq_chip_data_tmu);if (ret) { -dev_err (&pdev->dev,"Failed to add secondary IRQ chip\n" ); +dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" );return ret; } - ret =devm_regmap_add_irq_chip (&pdev->dev, pmic->regmap, pmic->irq, -IRQF_ONESHOT |IRQF_SHARED , -0 , &bxtwc_regmap_irq_chip_tmu, - &pmic->irq_chip_data_tmu); +/* Add chained IRQ handler for BCU IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_BCU_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_bcu, + &pmic->irq_chip_data_bcu); + +if (ret) { -dev_err (&pdev->dev,"Failed to add TMU IRQ chip\n" ); +dev_err (&pdev->dev,"Failed to add BUC IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for ADC IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_ADC_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_adc, + &pmic->irq_chip_data_adc); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add ADC IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for CHGR IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_CHGR_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_chgr, + &pmic->irq_chip_data_chgr); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add CHGR IRQ chip\n" ); +return ret; + } + +/* Add chained IRQ handler for CRIT IRQs */ + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_CRIT_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_crit, + &pmic->irq_chip_data_crit); + + +if (ret) { +dev_err (&pdev->dev,"Failed to add CRIT IRQ chip\n" );return ret; }include/linux/mfd/intel_soc_pmic.h +4
-1@@ -25,8 +25,11 @@ struct intel_soc_pmic {int irq;struct regmap *regmap;struct regmap_irq_chip_data *irq_chip_data; -struct regmap_irq_chip_data *irq_chip_data_level2;struct regmap_irq_chip_data *irq_chip_data_tmu; +struct regmap_irq_chip_data *irq_chip_data_bcu; +struct regmap_irq_chip_data *irq_chip_data_adc; +struct regmap_irq_chip_data *irq_chip_data_chgr; +struct regmap_irq_chip_data *irq_chip_data_crit;struct device *dev; };
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
[email protected]
maintainerPATCH v2 8/8 platform: x86: intel_bxtwc_tmu: remove first level irq unmask
In reply to [email protected]From: Kuppuswamy Sathyanarayanan <[email protected]>
Currently in WCOVE PMIC mfd driver, all second level irq chips are chained to the respective first level irqs. So there is no need for explicitly unmasking the first level irq in this driver. This patches removes this level 1 irq unmask support.
--- drivers/platform/x86/intel_bxtwc_tmu.c | 4 ---- 1 file changed, 4 deletions(-)
Changes since v1:
* None
drivers/platform/x86/intel_bxtwc_tmu.c +0 -4
@@ -92,10 +92,6 @@ static int bxt_wcove_tmu_probe(struct platform_device *pdev) } wctmu->irq = virq; -/* Enable TMU interrupts */ -regmap_update_bits (wctmu->regmap,BXTWC_MIRQLVL1 , -BXTWC_MIRQLVL1_MTMU ,0 ); -/* Unmask TMU second level Wake & System alarm */ regmap_update_bits (wctmu->regmap,BXTWC_MTMUIRQ_REG ,BXTWC_TMU_ALRM_MASK ,0 );
Signature · 1 line
2.7.4
Re: [PATCH v2 8/8] platform: x86: intel_bxtwc_tmu: remove first level irq unmask
Quoted 3 lines · On Fri, Apr 14, 2017 at 04:26:00PM -0700…
From: Kuppuswamy Sathyanarayanan <[email protected]>
Currently in WCOVE PMIC mfd driver, all second level irq chips
By currently I believe you mean after the earlier patch in this series is applied, correct? This one is dependent on the previous one?
Quoted 5 lines
are chained to the respective first level irqs. So there is no need for explicitly unmasking the first level irq in this driver. This patches removes this level 1 irq unmask support.
Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>
For platform drivers x86:
Are you working with a specific maintainers to pull this in as a series? With so many subsystems, we need to coordinate to make sure we don't make a mess for Linus. Given the interdependencies, I'd recommend someone pull the series in as a whole - maybe into MFD? Lee, do you have a preference?
Signature · 2 lines
Darren Hart VMware Open Source Technology Center
sathyanarayanan kuppuswamy
maintainerRe: [PATCH v2 8/8] platform: x86: intel_bxtwc_tmu: remove first level irq unmask
Hi Darren,
Thanks for the review.
Quoted 6 lines · Darren Hart
Quoted 3 lines · On Fri, Apr 14, 2017 at 04:26:00PM -0700…
From: Kuppuswamy Sathyanarayanan <[email protected]>
Currently in WCOVE PMIC mfd driver, all second level irq chips
By currently I believe you mean after the earlier patch in this series is applied, correct?
Yes.
Quoted 1 line
This one is dependent on the previous one?
Yes, one of my previous patch in this series fixes this problem in MFD driver.
Quoted 11 lines
Quoted 6 lines
are chained to the respective first level irqs. So there is no need for explicitly unmasking the first level irq in this driver. This patches removes this level 1 irq unmask support.
Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>For platform drivers x86:
Reviewed-by Darren Hart (VMware) <[email protected]>Are you working with a specific maintainers to pull this in as a series?
Thanks for brining it up. I was planning to ask either Andy or Lee regarding this issue after all patches in the series are reviewed.
Quoted 5 lines
With so
many subsystems, we need to coordinate to make sure we don't make a mess for Linus. Given the interdependencies, I'd recommend someone pull the series in as a whole - maybe into MFD? Lee, do you have a preference?
Signature · 2 lines
Sathyanarayanan Kuppuswamy Android kernel developer
Re: [PATCH v2 8/8] platform: x86: intel_bxtwc_tmu: remove first level irq unmask
Quoted 2 lines · sathyanarayanan kuppuswamy
Thanks for brining it up. I was planning to ask either Andy or Lee regarding this issue after all patches in the series are reviewed.
Darren, I'm planning to review this soon.
P.S. We have few series flying around regarding to Intel PMIC(s): my for Kconfig naming, Hans' for Crystal Cove (touches Kconfig as well), and Sathya's series. I hope Lee can collect them in proper order.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 8/8] platform: x86: intel_bxtwc_tmu: remove first level irq unmask
Quoted 11 lines · Andy Shevchenko
Quoted 2 lines · sathyanarayanan kuppuswamy
Thanks for brining it up. I was planning to ask either Andy or Lee regarding this issue after all patches in the series are reviewed.
Darren, I'm planning to review this soon.
P.S. We have few series flying around regarding to Intel PMIC(s): my forKconfignaming, Hans' for Crystal Cove (touchesKconfigas well), and Sathya's series. I hope Lee can collect them in proper order.
That could be easier said than done.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v2 8/8] platform: x86: intel_bxtwc_tmu: remove first level irq unmask
Quoted 8 lines · Lee Jones
Quoted 6 lines · Andy Shevchenko
Quoted 2 lines · sathyanarayanan kuppuswamy
Thanks for brining it up. I was planning to ask either Andy or Lee regarding this issue after all patches in the series are reviewed.
Quoted 7 lines
Quoted 5 lines
Darren, I'm planning to review this soon.
P.S. We have few series flying around regarding to Intel PMIC(s): my forKconfignaming, Hans' for Crystal Cove (touchesKconfigas well), and Sathya's series. I hope Lee can collect them in proper order.That could be easier said than done.
Some of them are already in your tree, then apply
- my Kconfig patch which makes Broxton Whiskey Cove to be built independently of Crystal Cove (I didn't notice that patch in your tree, though some of your mail told it had been applied)
- Hans' series regarding CherryTrail Whiskey Cove support (if it has all ACKs)
- this series after my review.
Does it sound doable?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 8/8] platform: x86: intel_bxtwc_tmu: remove first level irq unmask
Quoted 17 lines · Andy Shevchenko
Quoted 8 lines · Lee Jones
Quoted 6 lines · Andy Shevchenko
Quoted 2 lines · sathyanarayanan kuppuswamy
Thanks for brining it up. I was planning to ask either Andy or Lee regarding this issue after all patches in the series are reviewed.
Quoted 7 lines
Quoted 5 lines
Darren, I'm planning to review this soon.
P.S. We have few series flying around regarding to Intel PMIC(s): my forKconfignaming, Hans' for Crystal Cove (touchesKconfigas well), and Sathya's series. I hope Lee can collect them in proper order.That could be easier said than done.
Quoted 8 lines
Some of them are already in your tree, then apply
- myKconfigpatch which makes Broxton Whiskey Cove to be built independently of Crystal Cove (I didn't notice that patch in your tree, though some of your mail told it had been applied)
- Hans' series regarding CherryTrail Whiskey Cove support (if it has all ACKs)
- this series after my review.Does it sound doable?
My Inbox is now empty, so all patches are now either applied or waiting further Acks/Actions.
I'm pretty certain that this set is not going in before v4.13.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Andy Shevchenko
Reviewed-byRe: [PATCH v2 8/8] platform: x86: intel_bxtwc_tmu: remove first level irq unmask
Quoted 26 lines · Lee Jones
Quoted 24 lines · Andy Shevchenko
Quoted 8 lines · Lee Jones
Quoted 6 lines · Andy Shevchenko
Quoted 2 lines · sathyanarayanan kuppuswamy
Thanks for brining it up. I was planning to ask either Andy or Lee regarding this issue after all patches in the series are reviewed.
Quoted 7 lines
Quoted 5 lines
Darren, I'm planning to review this soon.
P.S. We have few series flying around regarding to Intel PMIC(s): my forKconfignaming, Hans' for Crystal Cove (touchesKconfigas well), and Sathya's series. I hope Lee can collect them in proper order.That could be easier said than done.
Some of them are already in your tree, then apply
- myKconfigpatch which makes Broxton Whiskey Cove to be built independently of Crystal Cove (I didn't notice that patch in your tree, though some of your mail told it had been applied)
- Hans' series regarding CherryTrail Whiskey Cove support (if it has all ACKs)
- this series after my review.
Quoted 4 lines
Quoted 1 line
Does it sound doable?
My Inbox is now empty, so all patches are now either applied or waiting further Acks/Actions.
I reviewed the series and found it suitable to apply. The GPIO Whiskey Cove patch will do a conflict (in GPIO tree is another patch that adds GPIO IRQ masks in a way by using GENMASK(), so, we might avoid this doing the same in patch 5 here).
for entire series.
Quoted 1 line
I'm pretty certain that this set is not going in before v4.13.
It is now on your side :-)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 8/8] platform: x86: intel_bxtwc_tmu: remove first level irq unmask
In reply to Darren HartQuoted 14 lines · Darren Hart
Quoted 3 lines · On Fri, Apr 14, 2017 at 04:26:00PM -0700…
From: Kuppuswamy Sathyanarayanan <[email protected]>
Currently in WCOVE PMIC mfd driver, all second level irq chips
By currently I believe you mean after the earlier patch in this series is applied, correct? This one is dependent on the previous one?
Quoted 5 lines
are chained to the respective first level irqs. So there is no need for explicitly unmasking the first level irq in this driver. This patches removes this level 1 irq unmask support.
Signed-off-by Kuppuswamy Sathyanarayanan <[email protected]>
Quoted 8 lines
For platform drivers x86:
Reviewed-by Darren Hart (VMware) <[email protected]>Are you working with a specific maintainers to pull this in as a series? With so many subsystems, we need to coordinate to make sure we don't make a mess for Linus. Given the interdependencies, I'd recommend someone pull the series in as a whole - maybe into MFD? Lee, do you have a preference?
I am happy to take the set, however I think v4.12 is an unlikely candidate, since there still have quite a few patches which are yet to receive review and the merge-window opens in 6 days.
Once we have all the required Acks, I'll push the set into -next where it can sit for a good soak test until v4.13.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
For future reference, when submitting a patch-set, you really should provide a cover letter ([PATCH 00/XX]).
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
sathyanarayanan kuppuswamy
maintainerThanks Lee.
Quoted 2 lines · Lee Jones
For future reference, when submitting a patch-set, you really should provide a cover letter ([PATCH 00/XX]).
Will do.
Quoted 1 line
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux kernel developer