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, BCI
has changed remarkably and, thus, it's disabled when TWL5031
is in use.
Signed-off-by: Ilkka Koskinen ilkka.koski...@nokia.com
---
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(-)
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index 5596bb4..5dc5062 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -152,6 +152,9 @@
#define TWL4030_BASEADD_PWMB 0x00F1
#define TWL4030_BASEADD_KEYPAD 0x00D2
+#define TWL5031_BASEADD_ACCESSORY0x0074 /* Replaces Main Charge */
+#define TWL5031_BASEADD_INTERRUPTS 0x00B9 /* Different to TWL4030's one */
Should be Different than...
+
/* subchip/slave 3 - POWER ID */
#define TWL4030_BASEADD_BACKUP 0x0014
#define TWL4030_BASEADD_INT 0x002E
@@ -183,6 +186,7 @@
/* chip-specific feature flags, for i2c_device_id.driver_data */
#define TWL4030_VAUX2BIT(0) /* pre-5030 voltage ranges */
#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */
+#define TWL5031 BIT(2) /* twl5031 has different
registers */
/*--*/
@@ -235,6 +239,8 @@ static struct twl4030mapping
twl4030_map[TWL4030_MODULE_LAST + 1] = {
{ 2, TWL4030_BASEADD_PWM1 },
{ 2, TWL4030_BASEADD_PWMA },
{ 2, TWL4030_BASEADD_PWMB },
+ { 2, TWL5031_BASEADD_ACCESSORY },
+ { 2, TWL5031_BASEADD_INTERRUPTS },
{ 3, TWL4030_BASEADD_BACKUP },
{ 3, TWL4030_BASEADD_INT },
@@ -483,7 +489,8 @@ add_children(struct twl4030_platform_data *pdata,
unsigned long features)
struct device *child;
struct device *usb_transceiver = NULL;
- if (twl_has_bci() pdata-bci !(features TPS_SUBSET)) {
+ if (twl_has_bci() pdata-bci
+ !((features TPS_SUBSET) || (features TWL5031))) {
could be simpler: !((features (TPS_SUBSET | TWL5031))
child = add_child(3, twl4030_bci,
pdata-bci, sizeof(*pdata-bci),
false,
@@ -743,6 +750,7 @@ static void clocks_init(struct device *dev,
int twl_init_irq(int irq_num, unsigned irq_base, unsigned irq_end);
int twl_exit_irq(void);
+int twl_init_chip_irq(const char *chip);
static int twl4030_remove(struct i2c_client *client)
{
@@ -820,6 +828,7 @@ twl4030_probe(struct i2c_client *client, const struct
i2c_device_id *id)
if (client-irq
pdata-irq_base
pdata-irq_end pdata-irq_base) {
+ twl_init_chip_irq(id-name);
status = twl_init_irq(client-irq, pdata-irq_base,
pdata-irq_end);
if (status 0)
goto fail;
@@ -835,6 +844,7 @@ fail:
static const struct i2c_device_id twl4030_ids[] = {
{ twl4030, TWL4030_VAUX2 }, /* Triton 2 */
{ twl5030, 0 }, /* T2 updated */
+ { twl5031, TWL5031 }, /* TWL5030 updated */
{ tps65950, 0 }, /* catalog version of twl5030 */
{ tps65930, TPS_SUBSET }, /* fewer LDOs and DACs; no charger */
{ tps65920, TPS_SUBSET }, /* fewer LDOs; no codec or charger */
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index fb194fe..a64994e 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -61,6 +61,7 @@
/* Linux could (eventually) use either IRQ line */
static int irq_line;
+static int chip_is_twl5031;
struct sih {
charname[8];
@@ -82,6 +83,9 @@ struct sih {
/* + 2 bytes padding */
};
+static const struct sih *sih_modules;
+static int nr_sih_modules;
+
#define SIH_INITIALIZER(modname, nbits) \
.module = TWL4030_MODULE_ ## modname, \
.control_offset = TWL4030_ ## modname ## _SIH_CTRL, \
@@ -107,7 +111,8 @@ struct sih {
/* Order in this table matches order in PIH_ISR. That is,
* BIT(n) in PIH_ISR is sih_modules[n].
*/
-static const struct sih sih_modules[6] = {
+/* sih_modules_twl4030 is used for twl4030 and twl5030 */
+static const struct sih sih_modules_twl4030[6] = {
[0] = {
.name = gpio,
.module = TWL4030_MODULE_GPIO,
@@ -164,6 +169,84 @@ static const struct sih sih_modules[6] = {
/* there are no SIH modules #6 or #7 ... */
};
+static const struct sih sih_modules_twl5031[8] = {
+ [0] = {
+ .name = gpio,
+ .module = TWL4030_MODULE_GPIO,
+ .control_offset = REG_GPIO_SIH_CTRL,
+