From 12fa032b39624a4fd9381e36c3265820af6840db Mon Sep 17 00:00:00 2001 From: Qiao Zhou Date: Mon, 9 Jul 2012 14:37:33 +0800 Subject: [PATCH] --- yaml --- r: 319748 b: refs/heads/master c: 5500e3964b8c154dc5af51ebcd7cd4df5d4abfee h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/mfd/88pm80x.c | 28 ++++++++++++++++++++++++++++ trunk/include/linux/mfd/88pm80x.h | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 91c4349d3ae8..309baeab2ed8 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 70c6cce040661204986ebbf22224cb24bd77ea71 +refs/heads/master: 5500e3964b8c154dc5af51ebcd7cd4df5d4abfee diff --git a/trunk/drivers/mfd/88pm80x.c b/trunk/drivers/mfd/88pm80x.c index 90aa18a37f79..77b865594c29 100644 --- a/trunk/drivers/mfd/88pm80x.c +++ b/trunk/drivers/mfd/88pm80x.c @@ -18,6 +18,12 @@ #include #include +/* + * workaround: some registers needed by pm805 are defined in pm800, so + * need to use this global variable to maintain the relation between + * pm800 and pm805. would remove it after HW chip fixes the issue. + */ +static struct pm80x_chip *g_pm80x_chip; const struct regmap_config pm80x_regmap_config = { .reg_bits = 8, @@ -61,6 +67,19 @@ int __devinit pm80x_init(struct i2c_client *client, device_init_wakeup(&client->dev, 1); + /* + * workaround: set g_pm80x_chip to the first probed chip. if the + * second chip is probed, just point to the companion to each + * other so that pm805 can access those specific register. would + * remove it after HW chip fixes the issue. + */ + if (!g_pm80x_chip) + g_pm80x_chip = chip; + else { + chip->companion = g_pm80x_chip->client; + g_pm80x_chip->companion = chip->client; + } + return 0; err_chip_id: @@ -75,6 +94,15 @@ int __devexit pm80x_deinit(struct i2c_client *client) { struct pm80x_chip *chip = i2c_get_clientdata(client); + /* + * workaround: clear the dependency between pm800 and pm805. + * would remove it after HW chip fixes the issue. + */ + if (g_pm80x_chip->companion) + g_pm80x_chip->companion = NULL; + else + g_pm80x_chip = NULL; + regmap_exit(chip->regmap); devm_kfree(&client->dev, chip); diff --git a/trunk/include/linux/mfd/88pm80x.h b/trunk/include/linux/mfd/88pm80x.h index 6c126e9714a3..103f06d1892d 100644 --- a/trunk/include/linux/mfd/88pm80x.h +++ b/trunk/include/linux/mfd/88pm80x.h @@ -295,6 +295,7 @@ struct pm80x_chip { struct pm80x_subchip *subchip; struct device *dev; struct i2c_client *client; + struct i2c_client *companion; struct regmap *regmap; struct regmap_irq_chip *regmap_irq_chip; struct regmap_irq_chip_data *irq_data;