Commit 9f8ddee1 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Lee Jones

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 8bd2d03e
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
/* Interrupt Status Registers */ /* Interrupt Status Registers */
#define BXTWC_IRQLVL1 0x4E02 #define BXTWC_IRQLVL1 0x4E02
#define BXTWC_PWRBTNIRQ 0x4E03
#define BXTWC_PWRBTNIRQ 0x4E03
#define BXTWC_THRM0IRQ 0x4E04 #define BXTWC_THRM0IRQ 0x4E04
#define BXTWC_THRM1IRQ 0x4E05 #define BXTWC_THRM1IRQ 0x4E05
#define BXTWC_THRM2IRQ 0x4E06 #define BXTWC_THRM2IRQ 0x4E06
...@@ -47,10 +47,9 @@ ...@@ -47,10 +47,9 @@
/* Interrupt MASK Registers */ /* Interrupt MASK Registers */
#define BXTWC_MIRQLVL1 0x4E0E #define BXTWC_MIRQLVL1 0x4E0E
#define BXTWC_MPWRTNIRQ 0x4E0F
#define BXTWC_MIRQLVL1_MCHGR BIT(5) #define BXTWC_MIRQLVL1_MCHGR BIT(5)
#define BXTWC_MPWRBTNIRQ 0x4E0F
#define BXTWC_MTHRM0IRQ 0x4E12 #define BXTWC_MTHRM0IRQ 0x4E12
#define BXTWC_MTHRM1IRQ 0x4E13 #define BXTWC_MTHRM1IRQ 0x4E13
#define BXTWC_MTHRM2IRQ 0x4E14 #define BXTWC_MTHRM2IRQ 0x4E14
...@@ -66,9 +65,7 @@ ...@@ -66,9 +65,7 @@
/* Whiskey Cove PMIC share same ACPI ID between different platforms */ /* Whiskey Cove PMIC share same ACPI ID between different platforms */
#define BROXTON_PMIC_WC_HRV 4 #define BROXTON_PMIC_WC_HRV 4
/* Manage in two IRQ chips since mask registers are not consecutive */
enum bxtwc_irqs { enum bxtwc_irqs {
/* Level 1 */
BXTWC_PWRBTN_LVL1_IRQ = 0, BXTWC_PWRBTN_LVL1_IRQ = 0,
BXTWC_TMU_LVL1_IRQ, BXTWC_TMU_LVL1_IRQ,
BXTWC_THRM_LVL1_IRQ, BXTWC_THRM_LVL1_IRQ,
...@@ -77,9 +74,11 @@ enum bxtwc_irqs { ...@@ -77,9 +74,11 @@ enum bxtwc_irqs {
BXTWC_CHGR_LVL1_IRQ, BXTWC_CHGR_LVL1_IRQ,
BXTWC_GPIO_LVL1_IRQ, BXTWC_GPIO_LVL1_IRQ,
BXTWC_CRIT_LVL1_IRQ, BXTWC_CRIT_LVL1_IRQ,
};
/* Level 2 */ enum bxtwc_irqs_pwrbtn {
BXTWC_PWRBTN_IRQ, BXTWC_PWRBTN_IRQ = 0,
BXTWC_UIBTN_IRQ,
}; };
enum bxtwc_irqs_bcu { enum bxtwc_irqs_bcu {
...@@ -113,7 +112,10 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = { ...@@ -113,7 +112,10 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = {
REGMAP_IRQ_REG(BXTWC_CHGR_LVL1_IRQ, 0, BIT(5)), REGMAP_IRQ_REG(BXTWC_CHGR_LVL1_IRQ, 0, BIT(5)),
REGMAP_IRQ_REG(BXTWC_GPIO_LVL1_IRQ, 0, BIT(6)), REGMAP_IRQ_REG(BXTWC_GPIO_LVL1_IRQ, 0, BIT(6)),
REGMAP_IRQ_REG(BXTWC_CRIT_LVL1_IRQ, 0, BIT(7)), REGMAP_IRQ_REG(BXTWC_CRIT_LVL1_IRQ, 0, BIT(7)),
REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 1, 0x03), };
static const struct regmap_irq bxtwc_regmap_irqs_pwrbtn[] = {
REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 0, 0x01),
}; };
static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = { static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = {
...@@ -125,7 +127,7 @@ static const struct regmap_irq bxtwc_regmap_irqs_adc[] = { ...@@ -125,7 +127,7 @@ static const struct regmap_irq bxtwc_regmap_irqs_adc[] = {
}; };
static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = { static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = {
REGMAP_IRQ_REG(BXTWC_USBC_IRQ, 0, BIT(5)), REGMAP_IRQ_REG(BXTWC_USBC_IRQ, 0, 0x20),
REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 0, 0x1f), REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 0, 0x1f),
REGMAP_IRQ_REG(BXTWC_CHGR1_IRQ, 1, 0x1f), REGMAP_IRQ_REG(BXTWC_CHGR1_IRQ, 1, 0x1f),
}; };
...@@ -144,7 +146,16 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = { ...@@ -144,7 +146,16 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = {
.mask_base = BXTWC_MIRQLVL1, .mask_base = BXTWC_MIRQLVL1,
.irqs = bxtwc_regmap_irqs, .irqs = bxtwc_regmap_irqs,
.num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs), .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs),
.num_regs = 2, .num_regs = 1,
};
static struct regmap_irq_chip bxtwc_regmap_irq_chip_pwrbtn = {
.name = "bxtwc_irq_chip_pwrbtn",
.status_base = BXTWC_PWRBTNIRQ,
.mask_base = BXTWC_MPWRBTNIRQ,
.irqs = bxtwc_regmap_irqs_pwrbtn,
.num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs_pwrbtn),
.num_regs = 1,
}; };
static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = {
...@@ -472,6 +483,16 @@ static int bxtwc_probe(struct platform_device *pdev) ...@@ -472,6 +483,16 @@ static int bxtwc_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data,
BXTWC_PWRBTN_LVL1_IRQ,
IRQF_ONESHOT,
&bxtwc_regmap_irq_chip_pwrbtn,
&pmic->irq_chip_data_pwrbtn);
if (ret) {
dev_err(&pdev->dev, "Failed to add PWRBTN IRQ chip\n");
return ret;
}
ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data, ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data,
BXTWC_TMU_LVL1_IRQ, BXTWC_TMU_LVL1_IRQ,
IRQF_ONESHOT, IRQF_ONESHOT,
......
...@@ -25,6 +25,7 @@ struct intel_soc_pmic { ...@@ -25,6 +25,7 @@ struct intel_soc_pmic {
int irq; int irq;
struct regmap *regmap; struct regmap *regmap;
struct regmap_irq_chip_data *irq_chip_data; struct regmap_irq_chip_data *irq_chip_data;
struct regmap_irq_chip_data *irq_chip_data_pwrbtn;
struct regmap_irq_chip_data *irq_chip_data_tmu; 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_bcu;
struct regmap_irq_chip_data *irq_chip_data_adc; struct regmap_irq_chip_data *irq_chip_data_adc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment