aboutsummaryrefslogtreecommitdiffstats
path: root/sound/ppc
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-09-07 11:08:40 -0400
committerJaroslav Kysela <perex@suse.cz>2005-09-12 04:47:34 -0400
commitf328385309f310626751c54f694641459e2d4582 (patch)
tree3bc59eab971a8cc1cf6c58efc7daebcbb73d4273 /sound/ppc
parenta28f1cda0d01f6f98e3bef6a07c483a90f6a35d6 (diff)
[ALSA] powermac - Add AUTO_DRC config
PPC,PPC Tumbler driver Added AUTO_DRC kernel config to enable/disable the auto-DRC-toggle feature on tumbler/snapper. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/ppc')
-rw-r--r--sound/ppc/Kconfig14
-rw-r--r--sound/ppc/tumbler.c23
2 files changed, 30 insertions, 7 deletions
diff --git a/sound/ppc/Kconfig b/sound/ppc/Kconfig
index bda5bc4e6148..206b9333f91f 100644
--- a/sound/ppc/Kconfig
+++ b/sound/ppc/Kconfig
@@ -20,5 +20,17 @@ config SND_POWERMAC
20 To compile this driver as a module, choose M here: the module 20 To compile this driver as a module, choose M here: the module
21 will be called snd-powermac. 21 will be called snd-powermac.
22 22
23endmenu 23config SND_POWERMAC_AUTO_DRC
24 bool "Toggle DRC automatically at headphone/line plug-in"
25 depends on SND_POWERMAC
26 default y
27 help
28 Say Y here to enable the automatic toggle of DRC (dynamic
29 range compression) on Tumbler/Snapper.
30 If this feature is enabled, DRC is turned off when the
31 headphone/line jack is plugged, and turned on when unplugged.
24 32
33 Note that you can turn on/off DRC manually even without this
34 option.
35
36endmenu
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index b94437c024b1..65384afcfc3f 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -948,7 +948,6 @@ static void device_change_handler(void *self)
948 msleep(10); 948 msleep(10);
949 check_mute(chip, &mix->amp_mute, 1, mix->auto_mute_notify, 949 check_mute(chip, &mix->amp_mute, 1, mix->auto_mute_notify,
950 chip->speaker_sw_ctl); 950 chip->speaker_sw_ctl);
951 mix->drc_enable = 0;
952 } else { 951 } else {
953 /* unmute speaker, mute others */ 952 /* unmute speaker, mute others */
954 check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify, 953 check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify,
@@ -960,20 +959,21 @@ static void device_change_handler(void *self)
960 if (mix->line_mute.addr != 0) 959 if (mix->line_mute.addr != 0)
961 check_mute(chip, &mix->line_mute, 1, mix->auto_mute_notify, 960 check_mute(chip, &mix->line_mute, 1, mix->auto_mute_notify,
962 chip->lineout_sw_ctl); 961 chip->lineout_sw_ctl);
963 mix->drc_enable = 1;
964 } 962 }
965 if (mix->auto_mute_notify) { 963 if (mix->auto_mute_notify)
966 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, 964 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
967 &chip->hp_detect_ctl->id); 965 &chip->hp_detect_ctl->id);
966
967#ifdef CONFIG_SND_POWERMAC_AUTO_DRC
968 mix->drc_enable = ! (headphone || lineout);
969 if (mix->auto_mute_notify)
968 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, 970 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
969 &chip->drc_sw_ctl->id); 971 &chip->drc_sw_ctl->id);
970 }
971
972 /* first set the DRC so the speaker do not explode -ReneR */
973 if (chip->model == PMAC_TUMBLER) 972 if (chip->model == PMAC_TUMBLER)
974 tumbler_set_drc(mix); 973 tumbler_set_drc(mix);
975 else 974 else
976 snapper_set_drc(mix); 975 snapper_set_drc(mix);
976#endif
977 977
978 /* reset the master volume so the correct amplification is applied */ 978 /* reset the master volume so the correct amplification is applied */
979 tumbler_set_master_volume(mix); 979 tumbler_set_master_volume(mix);
@@ -1370,6 +1370,17 @@ int __init snd_pmac_tumbler_init(pmac_t *chip)
1370 if ((err = snd_ctl_add(chip->card, chip->drc_sw_ctl)) < 0) 1370 if ((err = snd_ctl_add(chip->card, chip->drc_sw_ctl)) < 0)
1371 return err; 1371 return err;
1372 1372
1373 /* set initial DRC range to 60% */
1374 if (chip->model == PMAC_TUMBLER)
1375 mix->drc_range = (TAS3001_DRC_MAX * 6) / 10;
1376 else
1377 mix->drc_range = (TAS3004_DRC_MAX * 6) / 10;
1378 mix->drc_enable = 1; /* will be changed later if AUTO_DRC is set */
1379 if (chip->model == PMAC_TUMBLER)
1380 tumbler_set_drc(mix);
1381 else
1382 snapper_set_drc(mix);
1383
1373#ifdef CONFIG_PM 1384#ifdef CONFIG_PM
1374 chip->suspend = tumbler_suspend; 1385 chip->suspend = tumbler_suspend;
1375 chip->resume = tumbler_resume; 1386 chip->resume = tumbler_resume;