[alsa-devel] [PATCH 2/3] ASoC: wm8741: Set OSR mode in hw_params()

Charles Keepax ckeepax at opensource.cirrus.com
Tue Sep 19 11:47:56 CEST 2017


On Mon, Sep 18, 2017 at 09:30:36PM +0200, Sergej Sawazki wrote:
> Am 06.09.2017 um 10:20 schrieb Charles Keepax:
> > On Tue, Sep 05, 2017 at 08:36:24PM +0200, Sergej Sawazki wrote:
> > > Am 05.09.2017 um 18:12 schrieb Charles Keepax:
> > > > On Mon, Sep 04, 2017 at 09:34:12PM +0200, Sergej Sawazki wrote:
> 
> [...]
> 
> > > > > @@ -243,6 +250,7 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream,
> > > > >    		params_width(params), params_rate(params));
> > > > >    	snd_soc_write(codec, WM8741_FORMAT_CONTROL, iface);
> > > > > +	snd_soc_write(codec, WM8741_MODE_CONTROL_1, mode);
> > > > 
> > > > Better to use an update_bits rather than basically open-code it
> > > > with read and then this write.
> > > > 
> > > 
> > > I have used write() and not update_bits() here to be consistent with the way
> > > the WM8741_FORMAT_CONTROL register is written. If we change it to
> > > update_bits(), we should refactor the WM8741_FORMAT_CONTROL write to use
> > > update_bits() too, right?
> > > 
> > 
> > Yeah that should probably be an update bits too by the looks of
> > it.
> 
> Charles,
> 
> I think we should split "adding the OSR mode configuration" and
> "refactoring the code to use update_bits()" in at least two commits.
> 
> For consistency, I would keep the write() in this patch, and provide
> the update_bits() refactoring later. What do you think?
> 

Two commits seems sensible although its only a very small
refactoring so feels like we might as well get it done whilst
changing the code. I am happy to do the initial refactoring
patch, if that helps but I don't presently have hardware to test
this CODEC.

Thanks,
Charles


More information about the Alsa-devel mailing list