RE: [PATCH v3] ASoC: rt711-sdca: change capture switch controls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jaroslav, 

> > +static int rt711_sdca_set_fu0f_capture_ctl(struct rt711_sdca_priv
> > +*rt711) {
> > +	int err;
> > +
> > +	if (rt711->fu0f_dapm_mute) {
> > +		err = regmap_write(rt711->regmap,
> > +			SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> RT711_SDCA_ENT_USER_FU0F,
> > +			RT711_SDCA_CTL_FU_MUTE, CH_L), 0x01);
> > +		if (err < 0)
> > +			return err;
> > +		err = regmap_write(rt711->regmap,
> > +			SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> RT711_SDCA_ENT_USER_FU0F,
> > +			RT711_SDCA_CTL_FU_MUTE, CH_R), 0x01);
> > +		if (err < 0)
> > +			return err;
> 
> Is possible to set both channels RT711_SDCA_CTL_FU_MUTE in one write ?
> 
> Something like:
> 
>   regmap_write(rt711->regmap,
> 		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> RT711_SDCA_ENT_USER_FU0F,
> 			RT711_SDCA_CTL_FU_MUTE, CH_R|CH_L), 0x01);

No, the left/right channel setting of SDCA control are the different register addresses.

> Anyway, this function can be recoded like (far more readable):
> 
>   ch_l = (rt711->fu0f_dapm_mute || rt711->fu0f_mixer_l_mute) ? 0x01 :
> 0x00;
>   ch_r = (rt711->fu0f_dapm_mute || rt711->fu0f_mixer_r_mute) ? 0x01 :
> 0x00:
>   regmap_write(rt711->regmap,
> 		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> RT711_SDCA_ENT_USER_FU0F,
> 			RT711_SDCA_CTL_FU_MUTE, CH_L), ch_l);
>   regmap_write(rt711->regmap,
> 		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> RT711_SDCA_ENT_USER_FU0F,
> 			RT711_SDCA_CTL_FU_MUTE, CH_R), ch_r);
> 
> ... just add error checking ...

OK, will fix. Thanks.

> Or ideally, if both mute bits can be set together (one regmap_write):
> 
>   ch_l = (rt711->fu0f_dapm_mute || rt711->fu0f_mixer_l_mute) ? 0x01 :
> 0x00;
>   ch_r = (rt711->fu0f_dapm_mute || rt711->fu0f_mixer_r_mute) ? 0x01 :
> 0x00:
>   regmap_write(rt711->regmap,
> 		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> RT711_SDCA_ENT_USER_FU0F,
> 		  RT711_SDCA_CTL_FU_MUTE, CH_L|CH_R), ch_l | (ch_r << 1));
> 
> > +
> > +static int rt711_sdca_set_fu1e_capture_ctl(struct rt711_sdca_priv
> > +*rt711)
> 
> Same comments as for rt711_sdca_set_fu0f_capture_ctl().
> 
> 						Jaroslav
> 
> --
> Jaroslav Kysela <perex@xxxxxxxx>
> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
> ------Please consider the environment before printing this e-mail.




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux