aboutsummaryrefslogtreecommitdiffstats
path: root/sound/aoa
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2006-07-10 07:44:39 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-10 16:24:19 -0400
commit9b8f52f5b93e08f04b08e64e62d675bc43dd618e (patch)
treefa027720f33d5c5ace2d4d915e53468a8b8b4699 /sound/aoa
parent6a4f57874538fc05b99bd3bf7106f3df9b23a4ab (diff)
[PATCH] aoa: tas: surface DRC control again
This patch makes the DRC control visible again for TAS chips. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'sound/aoa')
-rw-r--r--sound/aoa/codecs/snd-aoa-codec-tas.c95
1 files changed, 94 insertions, 1 deletions
diff --git a/sound/aoa/codecs/snd-aoa-codec-tas.c b/sound/aoa/codecs/snd-aoa-codec-tas.c
index 23643b342cb0..009f57576f9c 100644
--- a/sound/aoa/codecs/snd-aoa-codec-tas.c
+++ b/sound/aoa/codecs/snd-aoa-codec-tas.c
@@ -342,6 +342,90 @@ static struct snd_kcontrol_new n##_control = { \
342MIXER_CONTROL(pcm1, "PCM", 0); 342MIXER_CONTROL(pcm1, "PCM", 0);
343MIXER_CONTROL(monitor, "Monitor", 2); 343MIXER_CONTROL(monitor, "Monitor", 2);
344 344
345static int tas_snd_drc_range_info(struct snd_kcontrol *kcontrol,
346 struct snd_ctl_elem_info *uinfo)
347{
348 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
349 uinfo->count = 1;
350 uinfo->value.integer.min = 0;
351 uinfo->value.integer.max = TAS3004_DRC_MAX;
352 return 0;
353}
354
355static int tas_snd_drc_range_get(struct snd_kcontrol *kcontrol,
356 struct snd_ctl_elem_value *ucontrol)
357{
358 struct tas *tas = snd_kcontrol_chip(kcontrol);
359
360 ucontrol->value.integer.value[0] = tas->drc_range;
361 return 0;
362}
363
364static int tas_snd_drc_range_put(struct snd_kcontrol *kcontrol,
365 struct snd_ctl_elem_value *ucontrol)
366{
367 struct tas *tas = snd_kcontrol_chip(kcontrol);
368
369 if (tas->drc_range == ucontrol->value.integer.value[0])
370 return 0;
371
372 tas->drc_range = ucontrol->value.integer.value[0];
373 if (tas->hw_enabled)
374 tas3004_set_drc(tas);
375 return 1;
376}
377
378static struct snd_kcontrol_new drc_range_control = {
379 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
380 .name = "DRC Range",
381 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
382 .info = tas_snd_drc_range_info,
383 .get = tas_snd_drc_range_get,
384 .put = tas_snd_drc_range_put,
385};
386
387static int tas_snd_drc_switch_info(struct snd_kcontrol *kcontrol,
388 struct snd_ctl_elem_info *uinfo)
389{
390 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
391 uinfo->count = 1;
392 uinfo->value.integer.min = 0;
393 uinfo->value.integer.max = 1;
394 return 0;
395}
396
397static int tas_snd_drc_switch_get(struct snd_kcontrol *kcontrol,
398 struct snd_ctl_elem_value *ucontrol)
399{
400 struct tas *tas = snd_kcontrol_chip(kcontrol);
401
402 ucontrol->value.integer.value[0] = tas->drc_enabled;
403 return 0;
404}
405
406static int tas_snd_drc_switch_put(struct snd_kcontrol *kcontrol,
407 struct snd_ctl_elem_value *ucontrol)
408{
409 struct tas *tas = snd_kcontrol_chip(kcontrol);
410
411 if (tas->drc_enabled == ucontrol->value.integer.value[0])
412 return 0;
413
414 tas->drc_enabled = ucontrol->value.integer.value[0];
415 if (tas->hw_enabled)
416 tas3004_set_drc(tas);
417 return 1;
418}
419
420static struct snd_kcontrol_new drc_switch_control = {
421 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
422 .name = "DRC Range Switch",
423 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
424 .info = tas_snd_drc_switch_info,
425 .get = tas_snd_drc_switch_get,
426 .put = tas_snd_drc_switch_put,
427};
428
345static int tas_snd_capture_source_info(struct snd_kcontrol *kcontrol, 429static int tas_snd_capture_source_info(struct snd_kcontrol *kcontrol,
346 struct snd_ctl_elem_info *uinfo) 430 struct snd_ctl_elem_info *uinfo)
347{ 431{
@@ -590,6 +674,14 @@ static int tas_init_codec(struct aoa_codec *codec)
590 if (err) 674 if (err)
591 goto error; 675 goto error;
592 676
677 err = aoa_snd_ctl_add(snd_ctl_new1(&drc_range_control, tas));
678 if (err)
679 goto error;
680
681 err = aoa_snd_ctl_add(snd_ctl_new1(&drc_switch_control, tas));
682 if (err)
683 goto error;
684
593 return 0; 685 return 0;
594 error: 686 error:
595 tas->codec.soundbus_dev->detach_codec(tas->codec.soundbus_dev, tas); 687 tas->codec.soundbus_dev->detach_codec(tas->codec.soundbus_dev, tas);
@@ -623,7 +715,8 @@ static int tas_create(struct i2c_adapter *adapter,
623 tas->i2c.driver = &tas_driver; 715 tas->i2c.driver = &tas_driver;
624 tas->i2c.adapter = adapter; 716 tas->i2c.adapter = adapter;
625 tas->i2c.addr = addr; 717 tas->i2c.addr = addr;
626 tas->drc_range = TAS3004_DRC_MAX; 718 /* seems that half is a saner default */
719 tas->drc_range = TAS3004_DRC_MAX / 2;
627 strlcpy(tas->i2c.name, "tas audio codec", I2C_NAME_SIZE-1); 720 strlcpy(tas->i2c.name, "tas audio codec", I2C_NAME_SIZE-1);
628 721
629 if (i2c_attach_client(&tas->i2c)) { 722 if (i2c_attach_client(&tas->i2c)) {