Skip to content

Commit b82f871

Browse files
charleskeepaxchanwoochoi
authored andcommitted
extcon: arizona: Make rev A register sequences atomic
The special register sequences that are applied for rev A of wm5102 should be applied atomically with respect to any other register writes. Use regmap_multi_reg_write to ensure all writes happen under the regmap lock. Signed-off-by: Charles Keepax <[email protected]> Signed-off-by: Chanwoo Choi <[email protected]>
1 parent 9c8eaec commit b82f871

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

drivers/extcon/extcon-arizona.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,13 @@ static void arizona_start_mic(struct arizona_extcon_info *info)
310310
}
311311

312312
if (info->micd_reva) {
313-
regmap_write(arizona->regmap, 0x80, 0x3);
314-
regmap_write(arizona->regmap, 0x294, 0);
315-
regmap_write(arizona->regmap, 0x80, 0x0);
313+
const struct reg_sequence reva[] = {
314+
{ 0x80, 0x3 },
315+
{ 0x294, 0x0 },
316+
{ 0x80, 0x0 },
317+
};
318+
319+
regmap_multi_reg_write(arizona->regmap, reva, ARRAY_SIZE(reva));
316320
}
317321

318322
if (info->detecting && arizona->pdata.micd_software_compare)
@@ -361,9 +365,13 @@ static void arizona_stop_mic(struct arizona_extcon_info *info)
361365
snd_soc_dapm_sync(dapm);
362366

363367
if (info->micd_reva) {
364-
regmap_write(arizona->regmap, 0x80, 0x3);
365-
regmap_write(arizona->regmap, 0x294, 2);
366-
regmap_write(arizona->regmap, 0x80, 0x0);
368+
const struct reg_sequence reva[] = {
369+
{ 0x80, 0x3 },
370+
{ 0x294, 0x2 },
371+
{ 0x80, 0x0 },
372+
};
373+
374+
regmap_multi_reg_write(arizona->regmap, reva, ARRAY_SIZE(reva));
367375
}
368376

369377
ret = regulator_allow_bypass(info->micvdd, true);

0 commit comments

Comments
 (0)