Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: mt6397: int_con and int_status may vary in location

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>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

John Crispin and committed by
Lee Jones
feec4799 daf5ae78

+19 -10
+17 -10
drivers/mfd/mt6397-core.c
··· 69 69 { 70 70 struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(data); 71 71 72 - regmap_write(mt6397->regmap, MT6397_INT_CON0, mt6397->irq_masks_cur[0]); 73 - regmap_write(mt6397->regmap, MT6397_INT_CON1, mt6397->irq_masks_cur[1]); 72 + regmap_write(mt6397->regmap, mt6397->int_con[0], 73 + mt6397->irq_masks_cur[0]); 74 + regmap_write(mt6397->regmap, mt6397->int_con[1], 75 + mt6397->irq_masks_cur[1]); 74 76 75 77 mutex_unlock(&mt6397->irqlock); 76 78 } ··· 149 147 { 150 148 struct mt6397_chip *mt6397 = data; 151 149 152 - mt6397_irq_handle_reg(mt6397, MT6397_INT_STATUS0, 0); 153 - mt6397_irq_handle_reg(mt6397, MT6397_INT_STATUS1, 16); 150 + mt6397_irq_handle_reg(mt6397, mt6397->int_status[0], 0); 151 + mt6397_irq_handle_reg(mt6397, mt6397->int_status[1], 16); 154 152 155 153 return IRQ_HANDLED; 156 154 } ··· 179 177 mutex_init(&mt6397->irqlock); 180 178 181 179 /* Mask all interrupt sources */ 182 - regmap_write(mt6397->regmap, MT6397_INT_CON0, 0x0); 183 - regmap_write(mt6397->regmap, MT6397_INT_CON1, 0x0); 180 + regmap_write(mt6397->regmap, mt6397->int_con[0], 0x0); 181 + regmap_write(mt6397->regmap, mt6397->int_con[1], 0x0); 184 182 185 183 mt6397->irq_domain = irq_domain_add_linear(mt6397->dev->of_node, 186 184 MT6397_IRQ_NR, &mt6397_irq_domain_ops, mt6397); ··· 205 203 { 206 204 struct mt6397_chip *chip = dev_get_drvdata(dev); 207 205 208 - regmap_write(chip->regmap, MT6397_INT_CON0, chip->wake_mask[0]); 209 - regmap_write(chip->regmap, MT6397_INT_CON1, chip->wake_mask[1]); 206 + regmap_write(chip->regmap, chip->int_con[0], chip->wake_mask[0]); 207 + regmap_write(chip->regmap, chip->int_con[1], chip->wake_mask[1]); 210 208 211 209 enable_irq_wake(chip->irq); 212 210 ··· 217 215 { 218 216 struct mt6397_chip *chip = dev_get_drvdata(dev); 219 217 220 - regmap_write(chip->regmap, MT6397_INT_CON0, chip->irq_masks_cur[0]); 221 - regmap_write(chip->regmap, MT6397_INT_CON1, chip->irq_masks_cur[1]); 218 + regmap_write(chip->regmap, chip->int_con[0], chip->irq_masks_cur[0]); 219 + regmap_write(chip->regmap, chip->int_con[1], chip->irq_masks_cur[1]); 222 220 223 221 disable_irq_wake(chip->irq); 224 222 ··· 239 237 return -ENOMEM; 240 238 241 239 mt6397->dev = &pdev->dev; 240 + mt6397->int_con[0] = MT6397_INT_CON0; 241 + mt6397->int_con[1] = MT6397_INT_CON1; 242 + mt6397->int_status[0] = MT6397_INT_STATUS0; 243 + mt6397->int_status[1] = MT6397_INT_STATUS1; 244 + 242 245 /* 243 246 * mt6397 MFD is child device of soc pmic wrapper. 244 247 * Regmap is set from its parent.
+2
include/linux/mfd/mt6397/core.h
··· 60 60 u16 wake_mask[2]; 61 61 u16 irq_masks_cur[2]; 62 62 u16 irq_masks_cache[2]; 63 + u16 int_con[2]; 64 + u16 int_status[2]; 63 65 }; 64 66 65 67 #endif /* __MFD_MT6397_CORE_H__ */