0043-mfd-mt6397-int_con-and-int_status-may-vary-in-locati.patch 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. From 8269ed007349714e9ef0e3408a68159d763145dd Mon Sep 17 00:00:00 2001
  2. From: John Crispin <[email protected]>
  3. Date: Fri, 8 Jan 2016 08:33:17 +0100
  4. Subject: [PATCH 043/102] mfd: mt6397: int_con and int_status may vary in
  5. location
  6. MT6323 has the INT_CON and INT_STATUS located at a different position.
  7. Make the registers locations configurable.
  8. Signed-off-by: John Crispin <[email protected]>
  9. ---
  10. drivers/mfd/mt6397-core.c | 27 +++++++++++++++++----------
  11. include/linux/mfd/mt6397/core.h | 2 ++
  12. 2 files changed, 19 insertions(+), 10 deletions(-)
  13. diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
  14. index 1749c1c..75ad0fe 100644
  15. --- a/drivers/mfd/mt6397-core.c
  16. +++ b/drivers/mfd/mt6397-core.c
  17. @@ -69,8 +69,10 @@ static void mt6397_irq_sync_unlock(struct irq_data *data)
  18. {
  19. struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(data);
  20. - regmap_write(mt6397->regmap, MT6397_INT_CON0, mt6397->irq_masks_cur[0]);
  21. - regmap_write(mt6397->regmap, MT6397_INT_CON1, mt6397->irq_masks_cur[1]);
  22. + regmap_write(mt6397->regmap, mt6397->int_con[0],
  23. + mt6397->irq_masks_cur[0]);
  24. + regmap_write(mt6397->regmap, mt6397->int_con[1],
  25. + mt6397->irq_masks_cur[1]);
  26. mutex_unlock(&mt6397->irqlock);
  27. }
  28. @@ -147,8 +149,8 @@ static irqreturn_t mt6397_irq_thread(int irq, void *data)
  29. {
  30. struct mt6397_chip *mt6397 = data;
  31. - mt6397_irq_handle_reg(mt6397, MT6397_INT_STATUS0, 0);
  32. - mt6397_irq_handle_reg(mt6397, MT6397_INT_STATUS1, 16);
  33. + mt6397_irq_handle_reg(mt6397, mt6397->int_status[0], 0);
  34. + mt6397_irq_handle_reg(mt6397, mt6397->int_status[1], 16);
  35. return IRQ_HANDLED;
  36. }
  37. @@ -177,8 +179,8 @@ static int mt6397_irq_init(struct mt6397_chip *mt6397)
  38. mutex_init(&mt6397->irqlock);
  39. /* Mask all interrupt sources */
  40. - regmap_write(mt6397->regmap, MT6397_INT_CON0, 0x0);
  41. - regmap_write(mt6397->regmap, MT6397_INT_CON1, 0x0);
  42. + regmap_write(mt6397->regmap, mt6397->int_con[0], 0x0);
  43. + regmap_write(mt6397->regmap, mt6397->int_con[1], 0x0);
  44. mt6397->irq_domain = irq_domain_add_linear(mt6397->dev->of_node,
  45. MT6397_IRQ_NR, &mt6397_irq_domain_ops, mt6397);
  46. @@ -203,8 +205,8 @@ static int mt6397_irq_suspend(struct device *dev)
  47. {
  48. struct mt6397_chip *chip = dev_get_drvdata(dev);
  49. - regmap_write(chip->regmap, MT6397_INT_CON0, chip->wake_mask[0]);
  50. - regmap_write(chip->regmap, MT6397_INT_CON1, chip->wake_mask[1]);
  51. + regmap_write(chip->regmap, chip->int_con[0], chip->wake_mask[0]);
  52. + regmap_write(chip->regmap, chip->int_con[1], chip->wake_mask[1]);
  53. enable_irq_wake(chip->irq);
  54. @@ -215,8 +217,8 @@ static int mt6397_irq_resume(struct device *dev)
  55. {
  56. struct mt6397_chip *chip = dev_get_drvdata(dev);
  57. - regmap_write(chip->regmap, MT6397_INT_CON0, chip->irq_masks_cur[0]);
  58. - regmap_write(chip->regmap, MT6397_INT_CON1, chip->irq_masks_cur[1]);
  59. + regmap_write(chip->regmap, chip->int_con[0], chip->irq_masks_cur[0]);
  60. + regmap_write(chip->regmap, chip->int_con[1], chip->irq_masks_cur[1]);
  61. disable_irq_wake(chip->irq);
  62. @@ -237,6 +239,11 @@ static int mt6397_probe(struct platform_device *pdev)
  63. return -ENOMEM;
  64. mt6397->dev = &pdev->dev;
  65. + mt6397->int_con[0] = MT6397_INT_CON0;
  66. + mt6397->int_con[1] = MT6397_INT_CON1;
  67. + mt6397->int_status[0] = MT6397_INT_STATUS0;
  68. + mt6397->int_status[1] = MT6397_INT_STATUS1;
  69. +
  70. /*
  71. * mt6397 MFD is child device of soc pmic wrapper.
  72. * Regmap is set from its parent.
  73. diff --git a/include/linux/mfd/mt6397/core.h b/include/linux/mfd/mt6397/core.h
  74. index 45b8e8a..d678f52 100644
  75. --- a/include/linux/mfd/mt6397/core.h
  76. +++ b/include/linux/mfd/mt6397/core.h
  77. @@ -60,6 +60,8 @@ struct mt6397_chip {
  78. u16 wake_mask[2];
  79. u16 irq_masks_cur[2];
  80. u16 irq_masks_cache[2];
  81. + u16 int_con[2];
  82. + u16 int_status[2];
  83. };
  84. #endif /* __MFD_MT6397_CORE_H__ */
  85. --
  86. 1.7.10.4