From: John Crispin <blogic@openwrt.org> To: Lee Jones <lee.jones@linaro.org> Cc: Matthias Brugger <matthias.bgg@gmail.com>, Flora Fu <flora.fu@mediatek.com>, Sascha Hauer <s.hauer@pengutronix.de>, Henry Chen <henryc.chen@mediatek.com>, Steven Liu <steven.liu@mediatek.com>, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, John Crispin <blogic@openwrt.org> Subject: [PATCH V2 2/4] mfd: mediatek: int_con and int_status may vary in location Date: Mon, 25 Jan 2016 11:14:45 +0100 [thread overview] Message-ID: <1453716887-38442-3-git-send-email-blogic@openwrt.org> (raw) In-Reply-To: <1453716887-38442-1-git-send-email-blogic@openwrt.org> MT6323 has the INT_CON and INT_STATUS located at a different position. Make the registers locations configurable. Signed-off-by: John Crispin <blogic@openwrt.org> --- drivers/mfd/mt6397-core.c | 27 +++++++++++++++++---------- include/linux/mfd/mt6397/core.h | 2 ++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c index 1749c1c..75ad0fe 100644 --- a/drivers/mfd/mt6397-core.c +++ b/drivers/mfd/mt6397-core.c @@ -69,8 +69,10 @@ static void mt6397_irq_sync_unlock(struct irq_data *data) { struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(data); - regmap_write(mt6397->regmap, MT6397_INT_CON0, mt6397->irq_masks_cur[0]); - regmap_write(mt6397->regmap, MT6397_INT_CON1, mt6397->irq_masks_cur[1]); + regmap_write(mt6397->regmap, mt6397->int_con[0], + mt6397->irq_masks_cur[0]); + regmap_write(mt6397->regmap, mt6397->int_con[1], + mt6397->irq_masks_cur[1]); mutex_unlock(&mt6397->irqlock); } @@ -147,8 +149,8 @@ static irqreturn_t mt6397_irq_thread(int irq, void *data) { struct mt6397_chip *mt6397 = data; - mt6397_irq_handle_reg(mt6397, MT6397_INT_STATUS0, 0); - mt6397_irq_handle_reg(mt6397, MT6397_INT_STATUS1, 16); + mt6397_irq_handle_reg(mt6397, mt6397->int_status[0], 0); + mt6397_irq_handle_reg(mt6397, mt6397->int_status[1], 16); return IRQ_HANDLED; } @@ -177,8 +179,8 @@ static int mt6397_irq_init(struct mt6397_chip *mt6397) mutex_init(&mt6397->irqlock); /* Mask all interrupt sources */ - regmap_write(mt6397->regmap, MT6397_INT_CON0, 0x0); - regmap_write(mt6397->regmap, MT6397_INT_CON1, 0x0); + regmap_write(mt6397->regmap, mt6397->int_con[0], 0x0); + regmap_write(mt6397->regmap, mt6397->int_con[1], 0x0); mt6397->irq_domain = irq_domain_add_linear(mt6397->dev->of_node, MT6397_IRQ_NR, &mt6397_irq_domain_ops, mt6397); @@ -203,8 +205,8 @@ static int mt6397_irq_suspend(struct device *dev) { struct mt6397_chip *chip = dev_get_drvdata(dev); - regmap_write(chip->regmap, MT6397_INT_CON0, chip->wake_mask[0]); - regmap_write(chip->regmap, MT6397_INT_CON1, chip->wake_mask[1]); + regmap_write(chip->regmap, chip->int_con[0], chip->wake_mask[0]); + regmap_write(chip->regmap, chip->int_con[1], chip->wake_mask[1]); enable_irq_wake(chip->irq); @@ -215,8 +217,8 @@ static int mt6397_irq_resume(struct device *dev) { struct mt6397_chip *chip = dev_get_drvdata(dev); - regmap_write(chip->regmap, MT6397_INT_CON0, chip->irq_masks_cur[0]); - regmap_write(chip->regmap, MT6397_INT_CON1, chip->irq_masks_cur[1]); + regmap_write(chip->regmap, chip->int_con[0], chip->irq_masks_cur[0]); + regmap_write(chip->regmap, chip->int_con[1], chip->irq_masks_cur[1]); disable_irq_wake(chip->irq); @@ -237,6 +239,11 @@ static int mt6397_probe(struct platform_device *pdev) return -ENOMEM; mt6397->dev = &pdev->dev; + mt6397->int_con[0] = MT6397_INT_CON0; + mt6397->int_con[1] = MT6397_INT_CON1; + mt6397->int_status[0] = MT6397_INT_STATUS0; + mt6397->int_status[1] = MT6397_INT_STATUS1; + /* * mt6397 MFD is child device of soc pmic wrapper. * Regmap is set from its parent. diff --git a/include/linux/mfd/mt6397/core.h b/include/linux/mfd/mt6397/core.h index 45b8e8a..d678f52 100644 --- a/include/linux/mfd/mt6397/core.h +++ b/include/linux/mfd/mt6397/core.h @@ -60,6 +60,8 @@ struct mt6397_chip { u16 wake_mask[2]; u16 irq_masks_cur[2]; u16 irq_masks_cache[2]; + u16 int_con[2]; + u16 int_status[2]; }; #endif /* __MFD_MT6397_CORE_H__ */ -- 1.7.10.4
WARNING: multiple messages have this Message-ID (diff)
From: blogic@openwrt.org (John Crispin) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH V2 2/4] mfd: mediatek: int_con and int_status may vary in location Date: Mon, 25 Jan 2016 11:14:45 +0100 [thread overview] Message-ID: <1453716887-38442-3-git-send-email-blogic@openwrt.org> (raw) In-Reply-To: <1453716887-38442-1-git-send-email-blogic@openwrt.org> MT6323 has the INT_CON and INT_STATUS located at a different position. Make the registers locations configurable. Signed-off-by: John Crispin <blogic@openwrt.org> --- drivers/mfd/mt6397-core.c | 27 +++++++++++++++++---------- include/linux/mfd/mt6397/core.h | 2 ++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c index 1749c1c..75ad0fe 100644 --- a/drivers/mfd/mt6397-core.c +++ b/drivers/mfd/mt6397-core.c @@ -69,8 +69,10 @@ static void mt6397_irq_sync_unlock(struct irq_data *data) { struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(data); - regmap_write(mt6397->regmap, MT6397_INT_CON0, mt6397->irq_masks_cur[0]); - regmap_write(mt6397->regmap, MT6397_INT_CON1, mt6397->irq_masks_cur[1]); + regmap_write(mt6397->regmap, mt6397->int_con[0], + mt6397->irq_masks_cur[0]); + regmap_write(mt6397->regmap, mt6397->int_con[1], + mt6397->irq_masks_cur[1]); mutex_unlock(&mt6397->irqlock); } @@ -147,8 +149,8 @@ static irqreturn_t mt6397_irq_thread(int irq, void *data) { struct mt6397_chip *mt6397 = data; - mt6397_irq_handle_reg(mt6397, MT6397_INT_STATUS0, 0); - mt6397_irq_handle_reg(mt6397, MT6397_INT_STATUS1, 16); + mt6397_irq_handle_reg(mt6397, mt6397->int_status[0], 0); + mt6397_irq_handle_reg(mt6397, mt6397->int_status[1], 16); return IRQ_HANDLED; } @@ -177,8 +179,8 @@ static int mt6397_irq_init(struct mt6397_chip *mt6397) mutex_init(&mt6397->irqlock); /* Mask all interrupt sources */ - regmap_write(mt6397->regmap, MT6397_INT_CON0, 0x0); - regmap_write(mt6397->regmap, MT6397_INT_CON1, 0x0); + regmap_write(mt6397->regmap, mt6397->int_con[0], 0x0); + regmap_write(mt6397->regmap, mt6397->int_con[1], 0x0); mt6397->irq_domain = irq_domain_add_linear(mt6397->dev->of_node, MT6397_IRQ_NR, &mt6397_irq_domain_ops, mt6397); @@ -203,8 +205,8 @@ static int mt6397_irq_suspend(struct device *dev) { struct mt6397_chip *chip = dev_get_drvdata(dev); - regmap_write(chip->regmap, MT6397_INT_CON0, chip->wake_mask[0]); - regmap_write(chip->regmap, MT6397_INT_CON1, chip->wake_mask[1]); + regmap_write(chip->regmap, chip->int_con[0], chip->wake_mask[0]); + regmap_write(chip->regmap, chip->int_con[1], chip->wake_mask[1]); enable_irq_wake(chip->irq); @@ -215,8 +217,8 @@ static int mt6397_irq_resume(struct device *dev) { struct mt6397_chip *chip = dev_get_drvdata(dev); - regmap_write(chip->regmap, MT6397_INT_CON0, chip->irq_masks_cur[0]); - regmap_write(chip->regmap, MT6397_INT_CON1, chip->irq_masks_cur[1]); + regmap_write(chip->regmap, chip->int_con[0], chip->irq_masks_cur[0]); + regmap_write(chip->regmap, chip->int_con[1], chip->irq_masks_cur[1]); disable_irq_wake(chip->irq); @@ -237,6 +239,11 @@ static int mt6397_probe(struct platform_device *pdev) return -ENOMEM; mt6397->dev = &pdev->dev; + mt6397->int_con[0] = MT6397_INT_CON0; + mt6397->int_con[1] = MT6397_INT_CON1; + mt6397->int_status[0] = MT6397_INT_STATUS0; + mt6397->int_status[1] = MT6397_INT_STATUS1; + /* * mt6397 MFD is child device of soc pmic wrapper. * Regmap is set from its parent. diff --git a/include/linux/mfd/mt6397/core.h b/include/linux/mfd/mt6397/core.h index 45b8e8a..d678f52 100644 --- a/include/linux/mfd/mt6397/core.h +++ b/include/linux/mfd/mt6397/core.h @@ -60,6 +60,8 @@ struct mt6397_chip { u16 wake_mask[2]; u16 irq_masks_cur[2]; u16 irq_masks_cache[2]; + u16 int_con[2]; + u16 int_status[2]; }; #endif /* __MFD_MT6397_CORE_H__ */ -- 1.7.10.4
next prev parent reply other threads:[~2016-01-25 10:15 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-01-25 10:14 [PATCH V2 0/4] mfd: mediatek: add mt6323 support to the mt6397 driver John Crispin 2016-01-25 10:14 ` John Crispin 2016-01-25 10:14 ` [PATCH V2 1/4] dt-bindings: mfd: Add bindings for the MediaTek MT6323 PMIC John Crispin 2016-01-25 10:14 ` John Crispin 2016-01-25 10:14 ` John Crispin 2016-01-25 12:41 ` Lee Jones 2016-01-25 12:41 ` Lee Jones 2016-01-25 10:14 ` John Crispin [this message] 2016-01-25 10:14 ` [PATCH V2 2/4] mfd: mediatek: int_con and int_status may vary in location John Crispin 2016-01-25 12:33 ` Lee Jones 2016-01-25 12:33 ` Lee Jones 2016-01-25 10:14 ` [PATCH V2 3/4] mfd: mediatek: add support for different Slave types John Crispin 2016-01-25 10:14 ` John Crispin 2016-01-25 12:37 ` Lee Jones 2016-01-25 12:37 ` Lee Jones 2016-01-25 10:14 ` [PATCH V2 4/4] mfd: mediatek: add MT6323 support to MT6397 driver John Crispin 2016-01-25 10:14 ` John Crispin 2016-01-25 12:41 ` Lee Jones 2016-01-25 12:41 ` Lee Jones 2016-01-25 15:36 ` John Crispin 2016-01-25 15:36 ` John Crispin 2016-01-25 18:44 ` Matthias Brugger 2016-01-25 18:44 ` Matthias Brugger 2016-01-25 18:59 ` John Crispin 2016-01-25 18:59 ` John Crispin 2016-01-26 3:07 ` Henry Chen 2016-01-26 3:07 ` Henry Chen 2016-01-26 3:07 ` Henry Chen 2016-01-26 7:14 ` John Crispin 2016-01-26 7:14 ` John Crispin 2016-01-26 8:34 ` Lee Jones 2016-01-26 8:34 ` Lee Jones 2016-01-26 8:44 ` John Crispin 2016-01-26 8:44 ` John Crispin 2016-01-26 12:05 ` John Crispin 2016-01-26 12:05 ` John Crispin 2016-01-26 14:00 ` Lee Jones 2016-01-26 14:00 ` Lee Jones
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1453716887-38442-3-git-send-email-blogic@openwrt.org \ --to=blogic@openwrt.org \ --cc=flora.fu@mediatek.com \ --cc=henryc.chen@mediatek.com \ --cc=lee.jones@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mediatek@lists.infradead.org \ --cc=matthias.bgg@gmail.com \ --cc=s.hauer@pengutronix.de \ --cc=steven.liu@mediatek.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.