Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0c041cb authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda/ca0132 - Use snd_hda_set_pin_ctl() helper again



The recent update of ca0132 driver replaced the pinctl setup to the
direct write via snd_hda_codec_write() again.  This should be covered
by snd_hda_set_pin_ctl() to be safer.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 15e4ba66
Loading
Loading
Loading
Loading
+10 −16
Original line number Original line Diff line number Diff line
@@ -3158,15 +3158,13 @@ static int ca0132_select_out(struct hda_codec *codec)
		/* disable headphone node */
		/* disable headphone node */
		pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0,
		pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0,
					AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
					AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
		snd_hda_codec_write(codec, spec->out_pins[1], 0,
		snd_hda_set_pin_ctl(codec, spec->out_pins[1],
				    AC_VERB_SET_PIN_WIDGET_CONTROL,
				    pin_ctl & ~PIN_HP);
				    pin_ctl & 0xBF);
		/* enable speaker node */
		/* enable speaker node */
		pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0,
		pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0,
					     AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
					     AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
		snd_hda_codec_write(codec, spec->out_pins[0], 0,
		snd_hda_set_pin_ctl(codec, spec->out_pins[0],
				    AC_VERB_SET_PIN_WIDGET_CONTROL,
				    pin_ctl | PIN_OUT);
				    pin_ctl | 0x40);
	} else {
	} else {
		snd_printdd(KERN_INFO "ca0132_select_out hp\n");
		snd_printdd(KERN_INFO "ca0132_select_out hp\n");
		/*headphone out config*/
		/*headphone out config*/
@@ -3193,15 +3191,13 @@ static int ca0132_select_out(struct hda_codec *codec)
		/* disable speaker*/
		/* disable speaker*/
		pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0,
		pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0,
					AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
					AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
		snd_hda_codec_write(codec, spec->out_pins[0], 0,
		snd_hda_set_pin_ctl(codec, spec->out_pins[0],
				    AC_VERB_SET_PIN_WIDGET_CONTROL,
				    pin_ctl & ~PIN_HP);
				    pin_ctl & 0xBF);
		/* enable headphone*/
		/* enable headphone*/
		pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0,
		pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0,
					AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
					AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
		snd_hda_codec_write(codec, spec->out_pins[1], 0,
		snd_hda_set_pin_ctl(codec, spec->out_pins[1],
				    AC_VERB_SET_PIN_WIDGET_CONTROL,
				    pin_ctl | PIN_HP);
				    pin_ctl | 0x40);
	}
	}


exit:
exit:
@@ -4065,8 +4061,7 @@ static int ca0132_build_pcms(struct hda_codec *codec)
static void init_output(struct hda_codec *codec, hda_nid_t pin, hda_nid_t dac)
static void init_output(struct hda_codec *codec, hda_nid_t pin, hda_nid_t dac)
{
{
	if (pin) {
	if (pin) {
		snd_hda_codec_write(codec, pin, 0,
		snd_hda_set_pin_ctl(codec, pin, PIN_HP);
				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
		if (get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)
		if (get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)
			snd_hda_codec_write(codec, pin, 0,
			snd_hda_codec_write(codec, pin, 0,
					    AC_VERB_SET_AMP_GAIN_MUTE,
					    AC_VERB_SET_AMP_GAIN_MUTE,
@@ -4080,8 +4075,7 @@ static void init_output(struct hda_codec *codec, hda_nid_t pin, hda_nid_t dac)
static void init_input(struct hda_codec *codec, hda_nid_t pin, hda_nid_t adc)
static void init_input(struct hda_codec *codec, hda_nid_t pin, hda_nid_t adc)
{
{
	if (pin) {
	if (pin) {
		snd_hda_codec_write(codec, pin, 0,
		snd_hda_set_pin_ctl(codec, pin, PIN_VREF80);
				    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80);
		if (get_wcaps(codec, pin) & AC_WCAP_IN_AMP)
		if (get_wcaps(codec, pin) & AC_WCAP_IN_AMP)
			snd_hda_codec_write(codec, pin, 0,
			snd_hda_codec_write(codec, pin, 0,
					    AC_VERB_SET_AMP_GAIN_MUTE,
					    AC_VERB_SET_AMP_GAIN_MUTE,