aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-08-30 12:52:52 -0400
committerLee Jones <lee.jones@linaro.org>2018-10-23 03:58:34 -0400
commit9f8ddee1dab836ca758ca8fc555ab5a3aaa5d3fd (patch)
tree33b4938f3b2b195a80db74bb4a88bbaafd893974
parent8bd2d03e54bbe2c75802c81f5635ebb4c36f7a2c (diff)
mfd: intel_soc_pmic_bxtwc: Chain power button IRQs as well
Power button IRQ actually has a second level of interrupts to distinguish between UI and POWER buttons. Moreover, current implementation looks awkward in approach to handle second level IRQs by first level related IRQ chip. To address above issues, split power button IRQ to be chained as well. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r--drivers/mfd/intel_soc_pmic_bxtwc.c41
-rw-r--r--include/linux/mfd/intel_soc_pmic.h1
2 files changed, 32 insertions, 10 deletions
diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c
index 15bc052704a6..9ca1f8c015de 100644
--- a/drivers/mfd/intel_soc_pmic_bxtwc.c
+++ b/drivers/mfd/intel_soc_pmic_bxtwc.c
@@ -31,8 +31,8 @@
31 31
32/* Interrupt Status Registers */ 32/* Interrupt Status Registers */
33#define BXTWC_IRQLVL1 0x4E02 33#define BXTWC_IRQLVL1 0x4E02
34#define BXTWC_PWRBTNIRQ 0x4E03
35 34
35#define BXTWC_PWRBTNIRQ 0x4E03
36#define BXTWC_THRM0IRQ 0x4E04 36#define BXTWC_THRM0IRQ 0x4E04
37#define BXTWC_THRM1IRQ 0x4E05 37#define BXTWC_THRM1IRQ 0x4E05
38#define BXTWC_THRM2IRQ 0x4E06 38#define BXTWC_THRM2IRQ 0x4E06
@@ -47,10 +47,9 @@
47 47
48/* Interrupt MASK Registers */ 48/* Interrupt MASK Registers */
49#define BXTWC_MIRQLVL1 0x4E0E 49#define BXTWC_MIRQLVL1 0x4E0E
50#define BXTWC_MPWRTNIRQ 0x4E0F
51
52#define BXTWC_MIRQLVL1_MCHGR BIT(5) 50#define BXTWC_MIRQLVL1_MCHGR BIT(5)
53 51
52#define BXTWC_MPWRBTNIRQ 0x4E0F
54#define BXTWC_MTHRM0IRQ 0x4E12 53#define BXTWC_MTHRM0IRQ 0x4E12
55#define BXTWC_MTHRM1IRQ 0x4E13 54#define BXTWC_MTHRM1IRQ 0x4E13
56#define BXTWC_MTHRM2IRQ 0x4E14 55#define BXTWC_MTHRM2IRQ 0x4E14
@@ -66,9 +65,7 @@
66/* Whiskey Cove PMIC share same ACPI ID between different platforms */ 65/* Whiskey Cove PMIC share same ACPI ID between different platforms */
67#define BROXTON_PMIC_WC_HRV 4 66#define BROXTON_PMIC_WC_HRV 4
68 67
69/* Manage in two IRQ chips since mask registers are not consecutive */
70enum bxtwc_irqs { 68enum bxtwc_irqs {
71 /* Level 1 */
72 BXTWC_PWRBTN_LVL1_IRQ = 0, 69 BXTWC_PWRBTN_LVL1_IRQ = 0,
73 BXTWC_TMU_LVL1_IRQ, 70 BXTWC_TMU_LVL1_IRQ,
74 BXTWC_THRM_LVL1_IRQ, 71 BXTWC_THRM_LVL1_IRQ,
@@ -77,9 +74,11 @@ enum bxtwc_irqs {
77 BXTWC_CHGR_LVL1_IRQ, 74 BXTWC_CHGR_LVL1_IRQ,
78 BXTWC_GPIO_LVL1_IRQ, 75 BXTWC_GPIO_LVL1_IRQ,
79 BXTWC_CRIT_LVL1_IRQ, 76 BXTWC_CRIT_LVL1_IRQ,
77};
80 78
81 /* Level 2 */ 79enum bxtwc_irqs_pwrbtn {
82 BXTWC_PWRBTN_IRQ, 80 BXTWC_PWRBTN_IRQ = 0,
81 BXTWC_UIBTN_IRQ,
83}; 82};
84 83
85enum bxtwc_irqs_bcu { 84enum bxtwc_irqs_bcu {
@@ -113,7 +112,10 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = {
113 REGMAP_IRQ_REG(BXTWC_CHGR_LVL1_IRQ, 0, BIT(5)), 112 REGMAP_IRQ_REG(BXTWC_CHGR_LVL1_IRQ, 0, BIT(5)),
114 REGMAP_IRQ_REG(BXTWC_GPIO_LVL1_IRQ, 0, BIT(6)), 113 REGMAP_IRQ_REG(BXTWC_GPIO_LVL1_IRQ, 0, BIT(6)),
115 REGMAP_IRQ_REG(BXTWC_CRIT_LVL1_IRQ, 0, BIT(7)), 114 REGMAP_IRQ_REG(BXTWC_CRIT_LVL1_IRQ, 0, BIT(7)),
116 REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 1, 0x03), 115};
116
117static const struct regmap_irq bxtwc_regmap_irqs_pwrbtn[] = {
118 REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 0, 0x01),
117}; 119};
118 120
119static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = { 121static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = {
@@ -125,7 +127,7 @@ static const struct regmap_irq bxtwc_regmap_irqs_adc[] = {
125}; 127};
126 128
127static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = { 129static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = {
128 REGMAP_IRQ_REG(BXTWC_USBC_IRQ, 0, BIT(5)), 130 REGMAP_IRQ_REG(BXTWC_USBC_IRQ, 0, 0x20),
129 REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 0, 0x1f), 131 REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 0, 0x1f),
130 REGMAP_IRQ_REG(BXTWC_CHGR1_IRQ, 1, 0x1f), 132 REGMAP_IRQ_REG(BXTWC_CHGR1_IRQ, 1, 0x1f),
131}; 133};
@@ -144,7 +146,16 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = {
144 .mask_base = BXTWC_MIRQLVL1, 146 .mask_base = BXTWC_MIRQLVL1,
145 .irqs = bxtwc_regmap_irqs, 147 .irqs = bxtwc_regmap_irqs,
146 .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs), 148 .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs),
147 .num_regs = 2, 149 .num_regs = 1,
150};
151
152static struct regmap_irq_chip bxtwc_regmap_irq_chip_pwrbtn = {
153 .name = "bxtwc_irq_chip_pwrbtn",
154 .status_base = BXTWC_PWRBTNIRQ,
155 .mask_base = BXTWC_MPWRBTNIRQ,
156 .irqs = bxtwc_regmap_irqs_pwrbtn,
157 .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs_pwrbtn),
158 .num_regs = 1,
148}; 159};
149 160
150static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { 161static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = {
@@ -473,6 +484,16 @@ static int bxtwc_probe(struct platform_device *pdev)
473 } 484 }
474 485
475 ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data, 486 ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data,
487 BXTWC_PWRBTN_LVL1_IRQ,
488 IRQF_ONESHOT,
489 &bxtwc_regmap_irq_chip_pwrbtn,
490 &pmic->irq_chip_data_pwrbtn);
491 if (ret) {
492 dev_err(&pdev->dev, "Failed to add PWRBTN IRQ chip\n");
493 return ret;
494 }
495
496 ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data,
476 BXTWC_TMU_LVL1_IRQ, 497 BXTWC_TMU_LVL1_IRQ,
477 IRQF_ONESHOT, 498 IRQF_ONESHOT,
478 &bxtwc_regmap_irq_chip_tmu, 499 &bxtwc_regmap_irq_chip_tmu,
diff --git a/include/linux/mfd/intel_soc_pmic.h b/include/linux/mfd/intel_soc_pmic.h
index 5aacdb017a9f..806a4f095312 100644
--- a/include/linux/mfd/intel_soc_pmic.h
+++ b/include/linux/mfd/intel_soc_pmic.h
@@ -25,6 +25,7 @@ struct intel_soc_pmic {
25 int irq; 25 int irq;
26 struct regmap *regmap; 26 struct regmap *regmap;
27 struct regmap_irq_chip_data *irq_chip_data; 27 struct regmap_irq_chip_data *irq_chip_data;
28 struct regmap_irq_chip_data *irq_chip_data_pwrbtn;
28 struct regmap_irq_chip_data *irq_chip_data_tmu; 29 struct regmap_irq_chip_data *irq_chip_data_tmu;
29 struct regmap_irq_chip_data *irq_chip_data_bcu; 30 struct regmap_irq_chip_data *irq_chip_data_bcu;
30 struct regmap_irq_chip_data *irq_chip_data_adc; 31 struct regmap_irq_chip_data *irq_chip_data_adc;