Hi Ilkka,
Some comments below:
On Fri, Oct 16, 2009 at 05:12:40PM +0300, Ilkka Koskinen wrote:TWL5031 introduces two new interrupts in PIH. Moreover, BCIA few comments on this:
has changed remarkably and, thus, it's disabled when TWL5031
is in use.
Signed-off-by: Ilkka Koskinen <ilkka.koskinen@xxxxxxxxx>
---
drivers/mfd/twl4030-core.c | 12 ++++-
drivers/mfd/twl4030-irq.c | 127 +++++++++++++++++++++++++++++++++++++++++--
include/linux/i2c/twl4030.h | 47 ++++++++++++++--
3 files changed, 173 insertions(+), 13 deletions(-)
@@ -284,11 +367,20 @@ static int twl4030_init_sih_modules(unsigned line)
/* disable all interrupts on our line */
memset(buf, 0xff, sizeof buf);
sih = sih_modules;
- for (i = 0; i < ARRAY_SIZE(sih_modules); i++, sih++) {
+ for (i = 0; i < nr_sih_modules; i++, sih++) {
/* skip USB -- it's funky */
- if (!sih->bytes_ixr)
+ /* But don't skip TWL5031's ACI */
+ if (!sih->bytes_ixr) {
+ if (chip_is_twl5031 && !strcmp(sih->name, "aci")) {
+ twl4030_i2c_write(TWL5031_MODULE_ACCESSORY,
+ buf, TWL5031_ACIIMR_LSB, 1);
+ twl4030_i2c_write(TWL5031_MODULE_ACCESSORY,
+ buf, TWL5031_ACIIMR_MSB, 1);
+ }
+
- Why do we have to do that for the accessory ? Some comments would be
appropriate.
- You could use twl4030_i2c_write_u8(), couldnt you ?
- I'd like it to be more generic: TWL5031_MODULE_ACCESSORY should be replaced
by sih->module, and the TWL5031_ACII* register should be somehow integrated in
the sih struct. The idea is to get rid of this chip_is_twl5031.
@@ -756,3 +857,17 @@ int twl_exit_irq(void)I dont think you need nr_sih_modules at all. sih_modules is pointing to the
}
return 0;
}
+
+int twl_init_chip_irq(const char *chip)
+{
+ if (!strcmp(chip, "twl5031")) {
+ chip_is_twl5031 = 1;
+ sih_modules = sih_modules_twl5031;
+ nr_sih_modules = ARRAY_SIZE(sih_modules_twl5031);
right array, and then you can keep the ARRAY_SIZE(sih_modules) call instead of
defining yet another static variable.
Talking about static variables and such, I really think the twl driver needs
some cleanup. It should really be allocating a private device structure at
probe time containing all those static crap. As this driver is growing and
supporting more and more HW, it starts to be messy.
Cheers,
Samuel.
+ } else {
+ sih_modules = sih_modules_twl4030;
+ nr_sih_modules = ARRAY_SIZE(sih_modules_twl4030);
+ }
+
+ return 0;
+}