From: Johannes Berg <johannes@sipsolutions.net>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH 10/12] aoa: tas: surface DRC control again
Date: Fri, 07 Jul 2006 18:52:17 +0200 [thread overview]
Message-ID: <20060707165532.806033000@sipsolutions.net> (raw)
In-Reply-To: 20060707165207.877010000@sipsolutions.net
This patch makes the DRC control visible again for TAS chips.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- linux-2.6-fetch.orig/sound/aoa/codecs/snd-aoa-codec-tas.c 2006-07-07 15:23:20.146178326 +0200
+++ linux-2.6-fetch/sound/aoa/codecs/snd-aoa-codec-tas.c 2006-07-07 15:25:15.316178326 +0200
@@ -342,6 +342,90 @@ static struct snd_kcontrol_new n##_contr
MIXER_CONTROL(pcm1, "PCM", 0);
MIXER_CONTROL(monitor, "Monitor", 2);
+static int tas_snd_drc_range_info(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo)
+{
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+ uinfo->count = 1;
+ uinfo->value.integer.min = 0;
+ uinfo->value.integer.max = TAS3004_DRC_MAX;
+ return 0;
+}
+
+static int tas_snd_drc_range_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct tas *tas = snd_kcontrol_chip(kcontrol);
+
+ ucontrol->value.integer.value[0] = tas->drc_range;
+ return 0;
+}
+
+static int tas_snd_drc_range_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct tas *tas = snd_kcontrol_chip(kcontrol);
+
+ if (tas->drc_range == ucontrol->value.integer.value[0])
+ return 0;
+
+ tas->drc_range = ucontrol->value.integer.value[0];
+ if (tas->hw_enabled)
+ tas3004_set_drc(tas);
+ return 1;
+}
+
+static struct snd_kcontrol_new drc_range_control = {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "DRC Range",
+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
+ .info = tas_snd_drc_range_info,
+ .get = tas_snd_drc_range_get,
+ .put = tas_snd_drc_range_put,
+};
+
+static int tas_snd_drc_switch_info(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo)
+{
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+ uinfo->count = 1;
+ uinfo->value.integer.min = 0;
+ uinfo->value.integer.max = 1;
+ return 0;
+}
+
+static int tas_snd_drc_switch_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct tas *tas = snd_kcontrol_chip(kcontrol);
+
+ ucontrol->value.integer.value[0] = tas->drc_enabled;
+ return 0;
+}
+
+static int tas_snd_drc_switch_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct tas *tas = snd_kcontrol_chip(kcontrol);
+
+ if (tas->drc_enabled == ucontrol->value.integer.value[0])
+ return 0;
+
+ tas->drc_enabled = ucontrol->value.integer.value[0];
+ if (tas->hw_enabled)
+ tas3004_set_drc(tas);
+ return 1;
+}
+
+static struct snd_kcontrol_new drc_switch_control = {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "DRC Range Switch",
+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
+ .info = tas_snd_drc_switch_info,
+ .get = tas_snd_drc_switch_get,
+ .put = tas_snd_drc_switch_put,
+};
+
static int tas_snd_capture_source_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
@@ -590,6 +674,14 @@ static int tas_init_codec(struct aoa_cod
if (err)
goto error;
+ err = aoa_snd_ctl_add(snd_ctl_new1(&drc_range_control, tas));
+ if (err)
+ goto error;
+
+ err = aoa_snd_ctl_add(snd_ctl_new1(&drc_switch_control, tas));
+ if (err)
+ goto error;
+
return 0;
error:
tas->codec.soundbus_dev->detach_codec(tas->codec.soundbus_dev, tas);
@@ -623,7 +715,8 @@ static int tas_create(struct i2c_adapter
tas->i2c.driver = &tas_driver;
tas->i2c.adapter = adapter;
tas->i2c.addr = addr;
- tas->drc_range = TAS3004_DRC_MAX;
+ /* seems that half is a saner default */
+ tas->drc_range = TAS3004_DRC_MAX / 2;
strlcpy(tas->i2c.name, "tas audio codec", I2C_NAME_SIZE-1);
if (i2c_attach_client(&tas->i2c)) {
--
next prev parent reply other threads:[~2006-07-07 17:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-07 16:52 [PATCH 00/12] aoa: fix regressions over snd-powermac Johannes Berg
2006-07-07 16:52 ` [PATCH 01/12] Use proper irq mapping interface for snd-aoa-i2sbus Johannes Berg
2006-07-07 16:52 ` [PATCH 02/12] aoa: i2sbus: move module parameter declaration up Johannes Berg
2006-07-07 16:52 ` [PATCH 03/12] aoa: i2sbus: fix for PowerMac7,2 and 7,3 Johannes Berg
2006-07-07 16:52 ` [PATCH 04/12] aoa: fix when all is built into the kernel Johannes Berg
2006-07-07 16:52 ` [PATCH 05/12] aoa: i2sbus: revamp control layer Johannes Berg
2006-07-07 16:52 ` [PATCH 06/12] aoa: pmf gpio: report if function calling fails Johannes Berg
2006-07-15 17:12 ` Andreas Schwab
2006-07-16 8:43 ` Johannes Berg
2006-07-07 16:52 ` [PATCH 07/12] aoa fabric layout: clean up messages Johannes Berg
2006-07-07 16:52 ` [PATCH 08/12] aoa: tas: change PCM1 name to PCM Johannes Berg
2006-07-07 16:52 ` [PATCH 09/12] aoa: tas: fix initialisation/reset Johannes Berg
2006-07-07 16:52 ` Johannes Berg [this message]
2006-07-07 16:52 ` [PATCH 11/12] aoa: layout fabric: add missing module aliases Johannes Berg
2006-07-07 16:52 ` [PATCH 12/12] aoa: tas: add missing bass/treble controls Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060707165532.806033000@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.