aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ice1712
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:52:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:52:13 -0500
commit78f1ae193d1662c22cfebb916e788e1ca896c0fe (patch)
tree0cca2c3d68c8ea48786cd3e9912f822fee7d1e17 /sound/pci/ice1712
parentfa395aaec823b9d1a5800913a6b5d0e6d1c5ced2 (diff)
parent84194883bcf89383ea4230116bb0195af5ec5829 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: ALSA: ice1724 - aureon - modify WM8770 Master & DAC volume ALSA: hda/realtek: quirk for D945GCLF2 mainboard ALSA: hda - Terradici HDA controllers does not support 64-bit mode ALSA: document: Add direct git link to grub hda-analyzer ALSA: radio/sound/miro: fix build, cleanup depends/selects ALSA: hda - Generalize EAPD inversion check in patch_analog.c ASoC: Wrong variable returned on error ALSA: snd-usb-us122l: add product IDs of US-122MKII and US-144MKII ALSA: hda - Exclude unusable ADCs for ALC88x ALSA: hda - Add missing Line-Out and PCM switches as slave ALSA: hda - iMac 9,1 sound patch. ALSA: opti93x: set MC indirect registers base from PnP data
Diffstat (limited to 'sound/pci/ice1712')
-rw-r--r--sound/pci/ice1712/aureon.c31
1 files changed, 7 insertions, 24 deletions
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
index 110d16e52733..765d7bd4c3d4 100644
--- a/sound/pci/ice1712/aureon.c
+++ b/sound/pci/ice1712/aureon.c
@@ -689,32 +689,14 @@ static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
689 return change; 689 return change;
690} 690}
691 691
692static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1); 692static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -10000, 100, 1);
693static const DECLARE_TLV_DB_SCALE(db_scale_wm_pcm, -6400, 50, 1); 693static const DECLARE_TLV_DB_SCALE(db_scale_wm_pcm, -6400, 50, 1);
694static const DECLARE_TLV_DB_SCALE(db_scale_wm_adc, -1200, 100, 0); 694static const DECLARE_TLV_DB_SCALE(db_scale_wm_adc, -1200, 100, 0);
695static const DECLARE_TLV_DB_SCALE(db_scale_ac97_master, -4650, 150, 0); 695static const DECLARE_TLV_DB_SCALE(db_scale_ac97_master, -4650, 150, 0);
696static const DECLARE_TLV_DB_SCALE(db_scale_ac97_gain, -3450, 150, 0); 696static const DECLARE_TLV_DB_SCALE(db_scale_ac97_gain, -3450, 150, 0);
697 697
698/* 698#define WM_VOL_MAX 100
699 * Logarithmic volume values for WM8770 699#define WM_VOL_CNT 101 /* 0dB .. -100dB */
700 * Computed as 20 * Log10(255 / x)
701 */
702static const unsigned char wm_vol[256] = {
703 127, 48, 42, 39, 36, 34, 33, 31, 30, 29, 28, 27, 27, 26, 25, 25, 24, 24, 23,
704 23, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 18, 17, 17, 17,
705 17, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 13, 13, 13,
706 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11,
707 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8,
708 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6,
709 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
710 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3,
711 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
712 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
713 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
714 0, 0
715};
716
717#define WM_VOL_MAX (sizeof(wm_vol) - 1)
718#define WM_VOL_MUTE 0x8000 700#define WM_VOL_MUTE 0x8000
719 701
720static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master) 702static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master)
@@ -724,7 +706,8 @@ static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned sho
724 if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) 706 if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE))
725 nvol = 0; 707 nvol = 0;
726 else 708 else
727 nvol = 127 - wm_vol[(((vol & ~WM_VOL_MUTE) * (master & ~WM_VOL_MUTE)) / 127) & WM_VOL_MAX]; 709 nvol = ((vol % WM_VOL_CNT) * (master % WM_VOL_CNT)) /
710 WM_VOL_MAX;
728 711
729 wm_put(ice, index, nvol); 712 wm_put(ice, index, nvol);
730 wm_put_nocache(ice, index, 0x180 | nvol); 713 wm_put_nocache(ice, index, 0x180 | nvol);
@@ -820,7 +803,7 @@ static int wm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *
820 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 803 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
821 uinfo->count = voices; 804 uinfo->count = voices;
822 uinfo->value.integer.min = 0; /* mute (-101dB) */ 805 uinfo->value.integer.min = 0; /* mute (-101dB) */
823 uinfo->value.integer.max = 0x7F; /* 0dB */ 806 uinfo->value.integer.max = WM_VOL_MAX; /* 0dB */
824 return 0; 807 return 0;
825} 808}
826 809
@@ -850,7 +833,7 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *
850 snd_ice1712_save_gpio_status(ice); 833 snd_ice1712_save_gpio_status(ice);
851 for (i = 0; i < voices; i++) { 834 for (i = 0; i < voices; i++) {
852 unsigned int vol = ucontrol->value.integer.value[i]; 835 unsigned int vol = ucontrol->value.integer.value[i];
853 if (vol > 0x7f) 836 if (vol > WM_VOL_MAX)
854 continue; 837 continue;
855 vol |= spec->vol[ofs+i]; 838 vol |= spec->vol[ofs+i];
856 if (vol != spec->vol[ofs+i]) { 839 if (vol != spec->vol[ofs+i]) {