diff options
Diffstat (limited to 'sound/pci/hda/patch_ca0132.c')
| -rw-r--r-- | sound/pci/hda/patch_ca0132.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 35abe3c62908..21d91d580da8 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c | |||
| @@ -728,18 +728,19 @@ static int ca0132_hp_switch_put(struct snd_kcontrol *kcontrol, | |||
| 728 | 728 | ||
| 729 | err = chipio_read(codec, REG_CODEC_MUTE, &data); | 729 | err = chipio_read(codec, REG_CODEC_MUTE, &data); |
| 730 | if (err < 0) | 730 | if (err < 0) |
| 731 | return err; | 731 | goto exit; |
| 732 | 732 | ||
| 733 | /* *valp 0 is mute, 1 is unmute */ | 733 | /* *valp 0 is mute, 1 is unmute */ |
| 734 | data = (data & 0x7f) | (*valp ? 0 : 0x80); | 734 | data = (data & 0x7f) | (*valp ? 0 : 0x80); |
| 735 | chipio_write(codec, REG_CODEC_MUTE, data); | 735 | err = chipio_write(codec, REG_CODEC_MUTE, data); |
| 736 | if (err < 0) | 736 | if (err < 0) |
| 737 | return err; | 737 | goto exit; |
| 738 | 738 | ||
| 739 | spec->curr_hp_switch = *valp; | 739 | spec->curr_hp_switch = *valp; |
| 740 | 740 | ||
| 741 | exit: | ||
| 741 | snd_hda_power_down(codec); | 742 | snd_hda_power_down(codec); |
| 742 | return 1; | 743 | return err < 0 ? err : 1; |
| 743 | } | 744 | } |
| 744 | 745 | ||
| 745 | static int ca0132_speaker_switch_get(struct snd_kcontrol *kcontrol, | 746 | static int ca0132_speaker_switch_get(struct snd_kcontrol *kcontrol, |
| @@ -770,18 +771,19 @@ static int ca0132_speaker_switch_put(struct snd_kcontrol *kcontrol, | |||
| 770 | 771 | ||
| 771 | err = chipio_read(codec, REG_CODEC_MUTE, &data); | 772 | err = chipio_read(codec, REG_CODEC_MUTE, &data); |
| 772 | if (err < 0) | 773 | if (err < 0) |
| 773 | return err; | 774 | goto exit; |
| 774 | 775 | ||
| 775 | /* *valp 0 is mute, 1 is unmute */ | 776 | /* *valp 0 is mute, 1 is unmute */ |
| 776 | data = (data & 0xef) | (*valp ? 0 : 0x10); | 777 | data = (data & 0xef) | (*valp ? 0 : 0x10); |
| 777 | chipio_write(codec, REG_CODEC_MUTE, data); | 778 | err = chipio_write(codec, REG_CODEC_MUTE, data); |
| 778 | if (err < 0) | 779 | if (err < 0) |
| 779 | return err; | 780 | goto exit; |
| 780 | 781 | ||
| 781 | spec->curr_speaker_switch = *valp; | 782 | spec->curr_speaker_switch = *valp; |
| 782 | 783 | ||
| 784 | exit: | ||
| 783 | snd_hda_power_down(codec); | 785 | snd_hda_power_down(codec); |
| 784 | return 1; | 786 | return err < 0 ? err : 1; |
| 785 | } | 787 | } |
| 786 | 788 | ||
| 787 | static int ca0132_hp_volume_get(struct snd_kcontrol *kcontrol, | 789 | static int ca0132_hp_volume_get(struct snd_kcontrol *kcontrol, |
| @@ -819,25 +821,26 @@ static int ca0132_hp_volume_put(struct snd_kcontrol *kcontrol, | |||
| 819 | 821 | ||
| 820 | err = chipio_read(codec, REG_CODEC_HP_VOL_L, &data); | 822 | err = chipio_read(codec, REG_CODEC_HP_VOL_L, &data); |
| 821 | if (err < 0) | 823 | if (err < 0) |
| 822 | return err; | 824 | goto exit; |
| 823 | 825 | ||
| 824 | val = 31 - left_vol; | 826 | val = 31 - left_vol; |
| 825 | data = (data & 0xe0) | val; | 827 | data = (data & 0xe0) | val; |
| 826 | chipio_write(codec, REG_CODEC_HP_VOL_L, data); | 828 | err = chipio_write(codec, REG_CODEC_HP_VOL_L, data); |
| 827 | if (err < 0) | 829 | if (err < 0) |
| 828 | return err; | 830 | goto exit; |
| 829 | 831 | ||
| 830 | val = 31 - right_vol; | 832 | val = 31 - right_vol; |
| 831 | data = (data & 0xe0) | val; | 833 | data = (data & 0xe0) | val; |
| 832 | chipio_write(codec, REG_CODEC_HP_VOL_R, data); | 834 | err = chipio_write(codec, REG_CODEC_HP_VOL_R, data); |
| 833 | if (err < 0) | 835 | if (err < 0) |
| 834 | return err; | 836 | goto exit; |
| 835 | 837 | ||
| 836 | spec->curr_hp_volume[0] = left_vol; | 838 | spec->curr_hp_volume[0] = left_vol; |
| 837 | spec->curr_hp_volume[1] = right_vol; | 839 | spec->curr_hp_volume[1] = right_vol; |
| 838 | 840 | ||
| 841 | exit: | ||
| 839 | snd_hda_power_down(codec); | 842 | snd_hda_power_down(codec); |
| 840 | return 1; | 843 | return err < 0 ? err : 1; |
| 841 | } | 844 | } |
| 842 | 845 | ||
| 843 | static int add_hp_switch(struct hda_codec *codec, hda_nid_t nid) | 846 | static int add_hp_switch(struct hda_codec *codec, hda_nid_t nid) |
| @@ -936,6 +939,8 @@ static int ca0132_build_controls(struct hda_codec *codec) | |||
| 936 | if (err < 0) | 939 | if (err < 0) |
| 937 | return err; | 940 | return err; |
| 938 | err = add_in_volume(codec, spec->dig_in, "IEC958"); | 941 | err = add_in_volume(codec, spec->dig_in, "IEC958"); |
| 942 | if (err < 0) | ||
| 943 | return err; | ||
| 939 | } | 944 | } |
| 940 | return 0; | 945 | return 0; |
| 941 | } | 946 | } |
