From 914bc160efda323347a8f6a6e2da4c0b35aeba7b Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Thu, 19 Jun 2014 09:40:27 +0200 Subject: ASoC: tlv320aic31xx: Remove duplicate const SOC_ENUM_SINGLE_DECL() already adds the const qualifier, so there is no need to manually specify it. Fixes the following warnings from sparse: sound/soc/codecs/tlv320aic31xx.c:253:1: warning: duplicate const sound/soc/codecs/tlv320aic31xx.c:255:1: warning: duplicate const sound/soc/codecs/tlv320aic31xx.c:257:1: warning: duplicate const sound/soc/codecs/tlv320aic31xx.c:260:1: warning: duplicate const sound/soc/codecs/tlv320aic31xx.c:262:1: warning: duplicate const Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320aic31xx.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index 23419109ecac..5128e6685762 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c @@ -249,17 +249,16 @@ static const char * const mic_select_text[] = { "Off", "FFR 10 Ohm", "FFR 20 Ohm", "FFR 40 Ohm" }; -static const -SOC_ENUM_SINGLE_DECL(mic1lp_p_enum, AIC31XX_MICPGAPI, 6, mic_select_text); -static const -SOC_ENUM_SINGLE_DECL(mic1rp_p_enum, AIC31XX_MICPGAPI, 4, mic_select_text); -static const -SOC_ENUM_SINGLE_DECL(mic1lm_p_enum, AIC31XX_MICPGAPI, 2, mic_select_text); - -static const -SOC_ENUM_SINGLE_DECL(cm_m_enum, AIC31XX_MICPGAMI, 6, mic_select_text); -static const -SOC_ENUM_SINGLE_DECL(mic1lm_m_enum, AIC31XX_MICPGAMI, 4, mic_select_text); +static SOC_ENUM_SINGLE_DECL(mic1lp_p_enum, AIC31XX_MICPGAPI, 6, + mic_select_text); +static SOC_ENUM_SINGLE_DECL(mic1rp_p_enum, AIC31XX_MICPGAPI, 4, + mic_select_text); +static SOC_ENUM_SINGLE_DECL(mic1lm_p_enum, AIC31XX_MICPGAPI, 2, + mic_select_text); + +static SOC_ENUM_SINGLE_DECL(cm_m_enum, AIC31XX_MICPGAMI, 6, mic_select_text); +static SOC_ENUM_SINGLE_DECL(mic1lm_m_enum, AIC31XX_MICPGAMI, 4, + mic_select_text); static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6350, 50, 0); static const DECLARE_TLV_DB_SCALE(adc_fgain_tlv, 0, 10, 0); -- cgit v1.2.3-59-g8ed1b From eb72cbdf51d0b12aa2a8169110950d163b5d693b Mon Sep 17 00:00:00 2001 From: Shahina Shaik Date: Fri, 13 Jun 2014 11:18:47 +0530 Subject: ASoC: tlv320aic32x4: Fixed Coding style Issues Fixed a brace coding style issue in the tlv320aic32x4.c Signed-off-by: Shahina Shaik Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320aic32x4.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index 1d9b117345a3..1e50f15022bc 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c @@ -626,21 +626,18 @@ static int aic32x4_probe(struct snd_soc_codec *codec) snd_soc_write(codec, AIC32X4_MICBIAS, AIC32X4_MICBIAS_LDOIN | AIC32X4_MICBIAS_2075V); } - if (aic32x4->power_cfg & AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE) { + if (aic32x4->power_cfg & AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE) snd_soc_write(codec, AIC32X4_PWRCFG, AIC32X4_AVDDWEAKDISABLE); - } tmp_reg = (aic32x4->power_cfg & AIC32X4_PWR_AIC32X4_LDO_ENABLE) ? AIC32X4_LDOCTLEN : 0; snd_soc_write(codec, AIC32X4_LDOCTL, tmp_reg); tmp_reg = snd_soc_read(codec, AIC32X4_CMMODE); - if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36) { + if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36) tmp_reg |= AIC32X4_LDOIN_18_36; - } - if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED) { + if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED) tmp_reg |= AIC32X4_LDOIN2HP; - } snd_soc_write(codec, AIC32X4_CMMODE, tmp_reg); /* Mic PGA routing */ -- cgit v1.2.3-59-g8ed1b From 43bf38ba566831867836569b3958064cd5c37eac Mon Sep 17 00:00:00 2001 From: Shahina Shaik Date: Fri, 13 Jun 2014 11:18:48 +0530 Subject: ASoC: tlv320aic32x4: Fixed Coding Style Issues Fixed Coding style issues of lines over 80 characters. Signed-off-by: Shahina Shaik Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320aic32x4.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index 1e50f15022bc..89e41d2f7586 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c @@ -642,13 +642,17 @@ static int aic32x4_probe(struct snd_soc_codec *codec) /* Mic PGA routing */ if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K) - snd_soc_write(codec, AIC32X4_LMICPGANIN, AIC32X4_LMICPGANIN_IN2R_10K); + snd_soc_write(codec, AIC32X4_LMICPGANIN, + AIC32X4_LMICPGANIN_IN2R_10K); else - snd_soc_write(codec, AIC32X4_LMICPGANIN, AIC32X4_LMICPGANIN_CM1L_10K); + snd_soc_write(codec, AIC32X4_LMICPGANIN, + AIC32X4_LMICPGANIN_CM1L_10K); if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K) - snd_soc_write(codec, AIC32X4_RMICPGANIN, AIC32X4_RMICPGANIN_IN1L_10K); + snd_soc_write(codec, AIC32X4_RMICPGANIN, + AIC32X4_RMICPGANIN_IN1L_10K); else - snd_soc_write(codec, AIC32X4_RMICPGANIN, AIC32X4_RMICPGANIN_CM1R_10K); + snd_soc_write(codec, AIC32X4_RMICPGANIN, + AIC32X4_RMICPGANIN_CM1R_10K); aic32x4_set_bias_level(codec, SND_SOC_BIAS_STANDBY); -- cgit v1.2.3-59-g8ed1b From 423ca88eb5288d3bf381bd5b4601a496ab1ae463 Mon Sep 17 00:00:00 2001 From: Shahina Shaik Date: Fri, 13 Jun 2014 11:56:54 +0530 Subject: ASoC: tlv320aic31xx: Fixed Coding Style Issues Fixed coding style issues of "Missing Blank line after declaration" Signed-off-by: Shahina Shaik Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320aic31xx.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index 23419109ecac..a9c4a8baba88 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c @@ -329,6 +329,7 @@ static int aic31xx_wait_bits(struct aic31xx_priv *aic31xx, unsigned int reg, unsigned int bits; int counter = count; int ret = regmap_read(aic31xx->regmap, reg, &bits); + while ((bits & mask) != wbits && counter && !ret) { usleep_range(sleep, sleep * 2); ret = regmap_read(aic31xx->regmap, reg, &bits); @@ -435,6 +436,7 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w, { struct snd_soc_codec *codec = w->codec; struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); + switch (event) { case SND_SOC_DAPM_POST_PMU: /* change mic bias voltage to user defined */ -- cgit v1.2.3-59-g8ed1b From 0cea76f3393782d67ccea8f07e9abf341bc4f60e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 15 Jul 2014 16:31:01 +0200 Subject: ALSA: control: Define SNDRV_CTL_TLV_OP_* constants Instead of hard-coded magic numbers, define constants for op_flag to tlv callbacks. Signed-off-by: Takashi Iwai --- include/sound/control.h | 7 ++++++- sound/core/control.c | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/include/sound/control.h b/include/sound/control.h index 5358892b1b39..042613938a1d 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -31,10 +31,15 @@ typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ct typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); typedef int (snd_kcontrol_tlv_rw_t)(struct snd_kcontrol *kcontrol, - int op_flag, /* 0=read,1=write,-1=command */ + int op_flag, /* SNDRV_CTL_TLV_OP_XXX */ unsigned int size, unsigned int __user *tlv); +enum { + SNDRV_CTL_TLV_OP_READ = 0, + SNDRV_CTL_TLV_OP_WRITE = 1, + SNDRV_CTL_TLV_OP_CMD = -1, +}; struct snd_kcontrol_new { snd_ctl_elem_iface_t iface; /* interface identifier */ diff --git a/sound/core/control.c b/sound/core/control.c index f0b0e14497a5..b9611344ff9e 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1406,11 +1406,11 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS: return snd_ctl_subscribe_events(ctl, ip); case SNDRV_CTL_IOCTL_TLV_READ: - return snd_ctl_tlv_ioctl(ctl, argp, 0); + return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_READ); case SNDRV_CTL_IOCTL_TLV_WRITE: - return snd_ctl_tlv_ioctl(ctl, argp, 1); + return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_WRITE); case SNDRV_CTL_IOCTL_TLV_COMMAND: - return snd_ctl_tlv_ioctl(ctl, argp, -1); + return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_CMD); case SNDRV_CTL_IOCTL_POWER: return -ENOPROTOOPT; case SNDRV_CTL_IOCTL_POWER_STATE: -- cgit v1.2.3-59-g8ed1b From 7523a271682fc1f35355da344249ce8f8c8b8cb9 Mon Sep 17 00:00:00 2001 From: Omair Mohammed Abdullah Date: Tue, 15 Jul 2014 21:34:48 +0530 Subject: ASoC: core: add a helper for extended byte controls using TLV ALSA supports arbitrary length TLVs for each kcontrol that can be used to pass metadata about the control (e.g. volumes, enum information). The same transport mechanism is now used for arbitrary length data by defining a new helper. Signed-off-by: Omair Mohammed Abdullah Signed-off-by: Vinod Koul Signed-off-by: Mark Brown --- include/sound/soc.h | 14 +++++++++++++- sound/soc/soc-core.c | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/include/sound/soc.h b/include/sound/soc.h index ed9e2d7e5fdc..688fa667dee5 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -270,7 +270,14 @@ .get = xhandler_get, .put = xhandler_put, \ .private_value = (unsigned long)&(struct soc_bytes_ext) \ {.max = xcount} } - +#define SND_SOC_BYTES_TLV(xname, xcount, xhandler_get, xhandler_put) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \ + SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ + .tlv.c = (snd_soc_bytes_tlv_callback), \ + .info = snd_soc_info_bytes_ext, \ + .private_value = (unsigned long)&(struct soc_bytes_ext) \ + {.max = xcount, .get = xhandler_get, .put = xhandler_put, } } #define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ xmin, xmax, xinvert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ @@ -552,6 +559,8 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *ucontrol); +int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag, + unsigned int size, unsigned int __user *tlv); int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, @@ -1119,6 +1128,9 @@ struct soc_bytes { struct soc_bytes_ext { int max; + /* used for TLV byte control */ + int (*get)(unsigned int __user *bytes, unsigned int size); + int (*put)(const unsigned int __user *bytes, unsigned int size); }; /* multi register control */ diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b87d7d882e6d..a9ce63f634b2 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3267,6 +3267,27 @@ int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol, } EXPORT_SYMBOL_GPL(snd_soc_bytes_info_ext); +int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag, + unsigned int size, unsigned int __user *tlv) +{ + struct soc_bytes_ext *params = (void *)kcontrol->private_value; + unsigned int count = size < params->max ? size : params->max; + int ret = -ENXIO; + + switch (op_flag) { + case SNDRV_CTL_TLV_OP_READ: + if (params->get) + ret = params->get(tlv, count); + break; + case SNDRV_CTL_TLV_OP_WRITE: + if (params->put) + ret = params->put(tlv, count); + break; + } + return ret; +} +EXPORT_SYMBOL_GPL(snd_soc_bytes_tlv_callback); + /** * snd_soc_info_xr_sx - signed multi register info callback * @kcontrol: mreg control -- cgit v1.2.3-59-g8ed1b From a9ef83f287b63ec8a753a3a7c6eac124f708544b Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Fri, 25 Jul 2014 15:07:47 +0300 Subject: ASoC: tlv320aic31xx: Add dependency for I2C and select REGMAP_I2C in Kconfig The codec can be configured via I2C and using regmap_i2c. Signed-off-by: Peter Ujfalusi Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index cbfa1e18f651..9115ab83c656 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -534,6 +534,8 @@ config SND_SOC_TLV320AIC26 config SND_SOC_TLV320AIC31XX tristate + depends on I2C + select REGMAP_I2C config SND_SOC_TLV320AIC32X4 tristate -- cgit v1.2.3-59-g8ed1b From 96665e312940a0915e74a98cf75938a57d12c723 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Fri, 25 Jul 2014 15:07:48 +0300 Subject: ASoC: tlv320aic31xx: Add text in Kconfig so the codec can be used with simple-card In order to show the option under 'CODEC drivers' we need to have text in Kconfig. Signed-off-by: Peter Ujfalusi Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 9115ab83c656..0ad292f41913 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -533,7 +533,7 @@ config SND_SOC_TLV320AIC26 depends on SPI config SND_SOC_TLV320AIC31XX - tristate + tristate "Texas Instruments TLV320AIC31xx CODECs" depends on I2C select REGMAP_I2C -- cgit v1.2.3-59-g8ed1b From 08074dc1ae8fe5e9b40b6dc26cbee4b04337750a Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 29 Jul 2014 20:13:00 +0100 Subject: ASoC: tlv320aic23: Convert to params_width() The CODEC doesn't care how data is laid out in memory. Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320aic23.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index 686b8b85b956..d67167920c2f 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c @@ -364,16 +364,16 @@ static int tlv320aic23_hw_params(struct snd_pcm_substream *substream, iface_reg = snd_soc_read(codec, TLV320AIC23_DIGT_FMT) & ~(0x03 << 2); - switch (params_format(params)) { - case SNDRV_PCM_FORMAT_S16_LE: + switch (params_width(params)) { + case 16: break; - case SNDRV_PCM_FORMAT_S20_3LE: + case 20: iface_reg |= (0x01 << 2); break; - case SNDRV_PCM_FORMAT_S24_LE: + case 24: iface_reg |= (0x02 << 2); break; - case SNDRV_PCM_FORMAT_S32_LE: + case 32: iface_reg |= (0x03 << 2); break; } -- cgit v1.2.3-59-g8ed1b