2011/10/18 Mark Brown broonie@opensource.wolfsonmicro.com:
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