Re: [PATCH 2/2] ASoC: wm9081: Use snd_soc_update_bits for read-modify-write

From: Axel Lin
Date: Mon Oct 17 2011 - 21:43:48 EST


2011/10/18 Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>:
> On Mon, Oct 17, 2011 at 12:36:52PM +0800, Axel Lin wrote:
>> Use snd_soc_update_bits for read-modify-write register access instead of
>> open-coding it using snd_soc_read and snd_soc_write
>
> Something in here is breaking audio through the WM9081 on Speyside.  I
> can't immediately spot anything wrong but the behaviour is quite obvious
> in the system.
>
hi Mark,
Thanks for testing.
I think the suspect part is here:

/* VMID 2*4k; Soft VMID ramp enable */
- reg = snd_soc_read(codec, WM9081_VMID_CONTROL);
- reg |= WM9081_VMID_RAMP | 0x6;
- snd_soc_write(codec, WM9081_VMID_CONTROL, reg);
-
+ snd_soc_update_bits(codec, WM9081_VMID_CONTROL,
+ WM9081_VMID_RAMP | 0x6,
+ WM9081_VMID_RAMP | 0x6);
mdelay(100);

/* Normal bias enable & soft start off */
- reg |= WM9081_BIAS_ENA;
- reg &= ~WM9081_VMID_RAMP;
- snd_soc_write(codec, WM9081_VMID_CONTROL, reg);
+ snd_soc_update_bits(codec, WM9081_VMID_CONTROL,
+ WM9081_VMID_RAMP | WM9081_BIAS_ENA,
+ WM9081_BIAS_ENA);

Original code does not change VMID_SEL[1:0] bits in the second write for
Normal bias enable & soft start off.

Maybe I should not convert it to snd_soc_update_bits for this case.

Regards,
Axel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/