From: Helen Koike <helen.koike@collabora.co.uk> To: Sebastian Reichel <sre@kernel.org> Cc: lgirdwood@gmail.com, broonie@kernel.org, peter.ujfalusi@ti.com, jarkko.nikula@bitmer.com, lars@metafoo.de, k.kozlowski@samsung.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, perex@perex.cz, tiwai@suse.com, cphealy@gmail.com, Helen Koike <helen.koike@collabora.co.uk> Subject: [PATCH v2 3/5] ASoC: tpa6130a2: Use snd soc volsw functions Date: Mon, 20 Jun 2016 14:12:31 -0300 [thread overview] Message-ID: <07133127008fa3924bd4cf7d10d42df30e4361f4.1466441036.git.helen.koike@collabora.co.uk> (raw) In-Reply-To: <cover.1466441036.git.helen.koike@collabora.co.uk> In-Reply-To: <cover.1466441036.git.helen.koike@collabora.co.uk> Use snd_soc_{info,get,put}_volsw instead of custom volume functions Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> [koike: port for upstream] Signed-off-by: Helen Koike <helen.koike@collabora.co.uk> [On N900] Tested-By: Sebastian Reichel <sre@kernel.org> --- Changes since v1: - Add tested-by from Sebastian sound/soc/codecs/tpa6130a2.c | 64 ++------------------------------------------ 1 file changed, 2 insertions(+), 62 deletions(-) diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index d90388a..81bf584 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c @@ -114,64 +114,6 @@ exit: return ret; } -static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct soc_mixer_control *mc = - (struct soc_mixer_control *)kcontrol->private_value; - struct tpa6130a2_data *data; - unsigned int reg = mc->reg; - unsigned int shift = mc->shift; - int max = mc->max, val; - unsigned int mask = (1 << fls(max)) - 1; - unsigned int invert = mc->invert; - - if (WARN_ON(!tpa6130a2_client)) - return -EINVAL; - data = i2c_get_clientdata(tpa6130a2_client); - - mutex_lock(&data->mutex); - - regmap_read(data->regmap, reg, &val); - ucontrol->value.integer.value[0] = (val >> shift) & mask; - - if (invert) - ucontrol->value.integer.value[0] = - max - ucontrol->value.integer.value[0]; - - mutex_unlock(&data->mutex); - return 0; -} - -static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct soc_mixer_control *mc = - (struct soc_mixer_control *)kcontrol->private_value; - struct tpa6130a2_data *data; - unsigned int reg = mc->reg; - unsigned int shift = mc->shift; - int max = mc->max; - unsigned int mask = (1 << fls(max)) - 1; - unsigned int invert = mc->invert; - unsigned int val = (ucontrol->value.integer.value[0] & mask); - bool change; - - if (WARN_ON(!tpa6130a2_client)) - return -EINVAL; - data = i2c_get_clientdata(tpa6130a2_client); - - if (invert) - val = max - val; - - mutex_lock(&data->mutex); - regmap_update_bits_check(data->regmap, reg, mask << shift, val << shift, - &change); - mutex_unlock(&data->mutex); - - return change; -} - /* * TPA6130 volume. From -59.5 to 4 dB with increasing step size when going * down in gain. @@ -190,9 +132,8 @@ static const DECLARE_TLV_DB_RANGE(tpa6130_tlv, ); static const struct snd_kcontrol_new tpa6130a2_controls[] = { - SOC_SINGLE_EXT_TLV("Headphone Playback Volume", + SOC_SINGLE_TLV("Headphone Playback Volume", TPA6130A2_REG_VOL_MUTE, 0, 0x3f, 0, - tpa6130a2_get_volsw, tpa6130a2_put_volsw, tpa6130_tlv), }; @@ -203,9 +144,8 @@ static const DECLARE_TLV_DB_RANGE(tpa6140_tlv, ); static const struct snd_kcontrol_new tpa6140a2_controls[] = { - SOC_SINGLE_EXT_TLV("Headphone Playback Volume", + SOC_SINGLE_TLV("Headphone Playback Volume", TPA6130A2_REG_VOL_MUTE, 1, 0x1f, 0, - tpa6130a2_get_volsw, tpa6130a2_put_volsw, tpa6140_tlv), }; -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Helen Koike <helen.koike@collabora.co.uk> To: Sebastian Reichel <sre@kernel.org> Cc: k.kozlowski@samsung.com, lars@metafoo.de, alsa-devel@alsa-project.org, tiwai@suse.com, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, peter.ujfalusi@ti.com, broonie@kernel.org, cphealy@gmail.com, Helen Koike <helen.koike@collabora.co.uk>, linux-omap@vger.kernel.org, jarkko.nikula@bitmer.com Subject: [PATCH v2 3/5] ASoC: tpa6130a2: Use snd soc volsw functions Date: Mon, 20 Jun 2016 14:12:31 -0300 [thread overview] Message-ID: <07133127008fa3924bd4cf7d10d42df30e4361f4.1466441036.git.helen.koike@collabora.co.uk> (raw) In-Reply-To: <cover.1466441036.git.helen.koike@collabora.co.uk> In-Reply-To: <cover.1466441036.git.helen.koike@collabora.co.uk> Use snd_soc_{info,get,put}_volsw instead of custom volume functions Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> [koike: port for upstream] Signed-off-by: Helen Koike <helen.koike@collabora.co.uk> [On N900] Tested-By: Sebastian Reichel <sre@kernel.org> --- Changes since v1: - Add tested-by from Sebastian sound/soc/codecs/tpa6130a2.c | 64 ++------------------------------------------ 1 file changed, 2 insertions(+), 62 deletions(-) diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index d90388a..81bf584 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c @@ -114,64 +114,6 @@ exit: return ret; } -static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct soc_mixer_control *mc = - (struct soc_mixer_control *)kcontrol->private_value; - struct tpa6130a2_data *data; - unsigned int reg = mc->reg; - unsigned int shift = mc->shift; - int max = mc->max, val; - unsigned int mask = (1 << fls(max)) - 1; - unsigned int invert = mc->invert; - - if (WARN_ON(!tpa6130a2_client)) - return -EINVAL; - data = i2c_get_clientdata(tpa6130a2_client); - - mutex_lock(&data->mutex); - - regmap_read(data->regmap, reg, &val); - ucontrol->value.integer.value[0] = (val >> shift) & mask; - - if (invert) - ucontrol->value.integer.value[0] = - max - ucontrol->value.integer.value[0]; - - mutex_unlock(&data->mutex); - return 0; -} - -static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct soc_mixer_control *mc = - (struct soc_mixer_control *)kcontrol->private_value; - struct tpa6130a2_data *data; - unsigned int reg = mc->reg; - unsigned int shift = mc->shift; - int max = mc->max; - unsigned int mask = (1 << fls(max)) - 1; - unsigned int invert = mc->invert; - unsigned int val = (ucontrol->value.integer.value[0] & mask); - bool change; - - if (WARN_ON(!tpa6130a2_client)) - return -EINVAL; - data = i2c_get_clientdata(tpa6130a2_client); - - if (invert) - val = max - val; - - mutex_lock(&data->mutex); - regmap_update_bits_check(data->regmap, reg, mask << shift, val << shift, - &change); - mutex_unlock(&data->mutex); - - return change; -} - /* * TPA6130 volume. From -59.5 to 4 dB with increasing step size when going * down in gain. @@ -190,9 +132,8 @@ static const DECLARE_TLV_DB_RANGE(tpa6130_tlv, ); static const struct snd_kcontrol_new tpa6130a2_controls[] = { - SOC_SINGLE_EXT_TLV("Headphone Playback Volume", + SOC_SINGLE_TLV("Headphone Playback Volume", TPA6130A2_REG_VOL_MUTE, 0, 0x3f, 0, - tpa6130a2_get_volsw, tpa6130a2_put_volsw, tpa6130_tlv), }; @@ -203,9 +144,8 @@ static const DECLARE_TLV_DB_RANGE(tpa6140_tlv, ); static const struct snd_kcontrol_new tpa6140a2_controls[] = { - SOC_SINGLE_EXT_TLV("Headphone Playback Volume", + SOC_SINGLE_TLV("Headphone Playback Volume", TPA6130A2_REG_VOL_MUTE, 1, 0x1f, 0, - tpa6130a2_get_volsw, tpa6130a2_put_volsw, tpa6140_tlv), }; -- 1.9.1
next prev parent reply other threads:[~2016-06-20 17:23 UTC|newest] Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-06-18 3:26 [PATCH 0/4] ASoC: tpa6130a2: Add support for multiple instances Helen Koike 2016-06-18 3:26 ` [PATCH 1/4] ASoC: tpa6130a2: Register component Helen Koike 2016-06-18 22:28 ` Sebastian Reichel 2016-06-18 3:26 ` [PATCH 2/4] ASoC: tap6130a2: Use regmap Helen Koike 2016-06-18 22:33 ` Sebastian Reichel 2016-06-23 14:38 ` Applied "ASoC: tap6130a2: Use regmap" to the asoc tree Mark Brown 2016-06-23 14:38 ` Mark Brown 2016-06-18 3:26 ` [PATCH 3/4] ASoC: tpa6130a2: Use snd soc volsw functions Helen Koike 2016-06-18 22:34 ` Sebastian Reichel 2016-06-18 3:26 ` [PATCH 4/4] ASoC: tpa6130a2: Add DAPM support Helen Koike 2016-06-18 23:21 ` Sebastian Reichel 2016-06-19 9:39 ` Lars-Peter Clausen 2016-06-19 9:39 ` Lars-Peter Clausen 2016-06-19 20:03 ` Sebastian Reichel 2016-06-20 8:34 ` Peter Ujfalusi 2016-06-20 8:34 ` Peter Ujfalusi 2016-06-18 10:40 ` [PATCH 0/4] ASoC: tpa6130a2: Add support for multiple instances Sebastian Reichel 2016-06-18 21:33 ` Sebastian Reichel 2016-06-18 21:33 ` Sebastian Reichel 2016-06-20 17:12 ` [PATCH v2 0/5] " Helen Koike 2016-06-20 17:12 ` Helen Koike 2016-06-20 17:12 ` [PATCH v2 1/5] ASoC: tpa6130a2: Register component Helen Koike 2016-06-20 17:12 ` Helen Koike 2016-06-23 14:38 ` Applied "ASoC: tpa6130a2: Register component" to the asoc tree Mark Brown 2016-06-23 14:38 ` Mark Brown 2016-06-20 17:12 ` [PATCH v2 2/5] ASoC: tap6130a2: Use regmap Helen Koike 2016-06-20 17:12 ` Helen Koike 2016-06-21 1:41 ` Sebastian Reichel 2016-06-20 17:12 ` Helen Koike [this message] 2016-06-20 17:12 ` [PATCH v2 3/5] ASoC: tpa6130a2: Use snd soc volsw functions Helen Koike 2016-06-21 1:41 ` Sebastian Reichel 2016-06-23 14:38 ` Applied "ASoC: tpa6130a2: Use snd soc volsw functions" to the asoc tree Mark Brown 2016-06-23 14:38 ` Mark Brown 2016-06-20 17:12 ` [PATCH v2 4/5] ASoC: tpa6130a2: Add DAPM support Helen Koike 2016-06-20 17:12 ` Helen Koike 2016-06-20 19:06 ` Helen Koike 2016-06-20 19:06 ` Helen Koike 2016-06-21 1:45 ` Sebastian Reichel 2016-06-21 1:45 ` Sebastian Reichel 2016-06-20 19:44 ` Lars-Peter Clausen 2016-06-20 19:44 ` Lars-Peter Clausen 2016-06-20 20:12 ` Helen Koike 2016-06-20 20:12 ` Helen Koike 2016-06-20 17:12 ` [PATCH v2 5/5] ASoC: tpa6130a2: Remove goto err_gpio Helen Koike 2016-06-20 17:12 ` Helen Koike 2016-06-21 1:42 ` Sebastian Reichel 2016-06-26 12:02 ` Applied "ASoC: tpa6130a2: Remove goto err_gpio" to the asoc tree Mark Brown 2016-06-26 12:02 ` Mark Brown 2016-06-23 19:23 ` [PATCH v3 0/2] ASoC: tpa6130a2: Add support for multiple instances Helen Koike 2016-06-23 19:23 ` Helen Koike 2016-06-23 19:23 ` [PATCH v3 1/2] ASoC: tpa6130a2: Add DAPM support Helen Koike 2016-06-26 12:02 ` Applied "ASoC: tpa6130a2: Add DAPM support" to the asoc tree Mark Brown 2016-06-26 12:02 ` Mark Brown 2016-06-23 19:23 ` [PATCH v3 2/2] ASoC: tpa6130a2: Remove goto err_gpio Helen Koike 2016-06-19 20:14 ` [PATCH 0/4] ASoC: tpa6130a2: Add support for multiple instances Sebastian Reichel 2016-06-19 20:14 ` Sebastian Reichel
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=07133127008fa3924bd4cf7d10d42df30e4361f4.1466441036.git.helen.koike@collabora.co.uk \ --to=helen.koike@collabora.co.uk \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=cphealy@gmail.com \ --cc=jarkko.nikula@bitmer.com \ --cc=k.kozlowski@samsung.com \ --cc=lars@metafoo.de \ --cc=lgirdwood@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ --cc=perex@perex.cz \ --cc=peter.ujfalusi@ti.com \ --cc=sre@kernel.org \ --cc=tiwai@suse.com \ /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: linkBe 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.