Skip to content

Commit

Permalink
[ALSA] powermac - Add AUTO_DRC config
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tiwai authored and Jaroslav Kysela committed Sep 12, 2005
1 parent a28f1cd commit f328385
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
14 changes: 13 additions & 1 deletion sound/ppc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,17 @@ config SND_POWERMAC
To compile this driver as a module, choose M here: the module
will be called snd-powermac.

endmenu
config SND_POWERMAC_AUTO_DRC
bool "Toggle DRC automatically at headphone/line plug-in"
depends on SND_POWERMAC
default y
help
Say Y here to enable the automatic toggle of DRC (dynamic
range compression) on Tumbler/Snapper.
If this feature is enabled, DRC is turned off when the
headphone/line jack is plugged, and turned on when unplugged.

Note that you can turn on/off DRC manually even without this
option.

endmenu
23 changes: 17 additions & 6 deletions sound/ppc/tumbler.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,6 @@ static void device_change_handler(void *self)
msleep(10);
check_mute(chip, &mix->amp_mute, 1, mix->auto_mute_notify,
chip->speaker_sw_ctl);
mix->drc_enable = 0;
} else {
/* unmute speaker, mute others */
check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify,
Expand All @@ -960,20 +959,21 @@ static void device_change_handler(void *self)
if (mix->line_mute.addr != 0)
check_mute(chip, &mix->line_mute, 1, mix->auto_mute_notify,
chip->lineout_sw_ctl);
mix->drc_enable = 1;
}
if (mix->auto_mute_notify) {
if (mix->auto_mute_notify)
snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
&chip->hp_detect_ctl->id);

#ifdef CONFIG_SND_POWERMAC_AUTO_DRC
mix->drc_enable = ! (headphone || lineout);
if (mix->auto_mute_notify)
snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
&chip->drc_sw_ctl->id);
}

/* first set the DRC so the speaker do not explode -ReneR */
if (chip->model == PMAC_TUMBLER)
tumbler_set_drc(mix);
else
snapper_set_drc(mix);
#endif

/* reset the master volume so the correct amplification is applied */
tumbler_set_master_volume(mix);
Expand Down Expand Up @@ -1370,6 +1370,17 @@ int __init snd_pmac_tumbler_init(pmac_t *chip)
if ((err = snd_ctl_add(chip->card, chip->drc_sw_ctl)) < 0)
return err;

/* set initial DRC range to 60% */
if (chip->model == PMAC_TUMBLER)
mix->drc_range = (TAS3001_DRC_MAX * 6) / 10;
else
mix->drc_range = (TAS3004_DRC_MAX * 6) / 10;
mix->drc_enable = 1; /* will be changed later if AUTO_DRC is set */
if (chip->model == PMAC_TUMBLER)
tumbler_set_drc(mix);
else
snapper_set_drc(mix);

#ifdef CONFIG_PM
chip->suspend = tumbler_suspend;
chip->resume = tumbler_resume;
Expand Down

0 comments on commit f328385

Please sign in to comment.