Skip to content

Commit 5347a02

Browse files
marexhorms
authored andcommitted
ARM: shmobile: Fix R-Car Gen2 regulator quirk
The quirk code currently detects all compatible I2C chips with a shared IRQ line on all I2C busses, adds them into a list, and registers a bus notifier. For every chip for which the bus notifier triggers, the quirk code performs I2C transfer on that I2C bus for all addresses in the list. The problem is that this may generate transfers to non-existing chips on systems with multiple I2C busses. This patch adds a check to verify that the I2C bus to which the chip with shared IRQ is attached to matches the I2C bus of the chip which triggered the bus notifier and only starts the I2C transfer if they match. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Tested-by: Nguyen Viet Dung <dung.nguyen.aj@renesas.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
1 parent 8d22020 commit 5347a02

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
struct regulator_quirk {
4141
struct list_head list;
4242
const struct of_device_id *id;
43+
struct device_node *np;
4344
struct of_phandle_args irq_args;
4445
struct i2c_msg i2c_msg;
4546
bool shared; /* IRQ line is shared */
@@ -101,6 +102,9 @@ static int regulator_quirk_notify(struct notifier_block *nb,
101102
if (!pos->shared)
102103
continue;
103104

105+
if (pos->np->parent != client->dev.parent->of_node)
106+
continue;
107+
104108
dev_info(&client->dev, "clearing %s@0x%02x interrupts\n",
105109
pos->id->compatible, pos->i2c_msg.addr);
106110

@@ -165,6 +169,7 @@ static int __init rcar_gen2_regulator_quirk(void)
165169
memcpy(&quirk->i2c_msg, id->data, sizeof(quirk->i2c_msg));
166170

167171
quirk->id = id;
172+
quirk->np = np;
168173
quirk->i2c_msg.addr = addr;
169174

170175
ret = of_irq_parse_one(np, 0, argsa);

0 commit comments

Comments
 (0)