Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge remote-tracking branches 'asoc/topic/tlv', 'asoc/topic/tlv320aic23', 'asoc/topic/tlv320aic31xx' and 'asoc/topic/tlv320aic32x4' into asoc-next

+73 -31
+6 -1
include/sound/control.h
··· 31 31 typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); 32 32 typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); 33 33 typedef int (snd_kcontrol_tlv_rw_t)(struct snd_kcontrol *kcontrol, 34 - int op_flag, /* 0=read,1=write,-1=command */ 34 + int op_flag, /* SNDRV_CTL_TLV_OP_XXX */ 35 35 unsigned int size, 36 36 unsigned int __user *tlv); 37 37 38 + enum { 39 + SNDRV_CTL_TLV_OP_READ = 0, 40 + SNDRV_CTL_TLV_OP_WRITE = 1, 41 + SNDRV_CTL_TLV_OP_CMD = -1, 42 + }; 38 43 39 44 struct snd_kcontrol_new { 40 45 snd_ctl_elem_iface_t iface; /* interface identifier */
+13 -1
include/sound/soc.h
··· 272 272 .get = xhandler_get, .put = xhandler_put, \ 273 273 .private_value = (unsigned long)&(struct soc_bytes_ext) \ 274 274 {.max = xcount} } 275 - 275 + #define SND_SOC_BYTES_TLV(xname, xcount, xhandler_get, xhandler_put) \ 276 + { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 277 + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \ 278 + SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ 279 + .tlv.c = (snd_soc_bytes_tlv_callback), \ 280 + .info = snd_soc_info_bytes_ext, \ 281 + .private_value = (unsigned long)&(struct soc_bytes_ext) \ 282 + {.max = xcount, .get = xhandler_get, .put = xhandler_put, } } 276 283 #define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ 277 284 xmin, xmax, xinvert) \ 278 285 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ ··· 567 560 struct snd_ctl_elem_value *ucontrol); 568 561 int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol, 569 562 struct snd_ctl_elem_info *ucontrol); 563 + int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag, 564 + unsigned int size, unsigned int __user *tlv); 570 565 int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol, 571 566 struct snd_ctl_elem_info *uinfo); 572 567 int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, ··· 1141 1132 1142 1133 struct soc_bytes_ext { 1143 1134 int max; 1135 + /* used for TLV byte control */ 1136 + int (*get)(unsigned int __user *bytes, unsigned int size); 1137 + int (*put)(const unsigned int __user *bytes, unsigned int size); 1144 1138 }; 1145 1139 1146 1140 /* multi register control */
+3 -3
sound/core/control.c
··· 1406 1406 case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS: 1407 1407 return snd_ctl_subscribe_events(ctl, ip); 1408 1408 case SNDRV_CTL_IOCTL_TLV_READ: 1409 - return snd_ctl_tlv_ioctl(ctl, argp, 0); 1409 + return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_READ); 1410 1410 case SNDRV_CTL_IOCTL_TLV_WRITE: 1411 - return snd_ctl_tlv_ioctl(ctl, argp, 1); 1411 + return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_WRITE); 1412 1412 case SNDRV_CTL_IOCTL_TLV_COMMAND: 1413 - return snd_ctl_tlv_ioctl(ctl, argp, -1); 1413 + return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_CMD); 1414 1414 case SNDRV_CTL_IOCTL_POWER: 1415 1415 return -ENOPROTOOPT; 1416 1416 case SNDRV_CTL_IOCTL_POWER_STATE:
+3 -1
sound/soc/codecs/Kconfig
··· 564 564 depends on SPI 565 565 566 566 config SND_SOC_TLV320AIC31XX 567 - tristate 567 + tristate "Texas Instruments TLV320AIC31xx CODECs" 568 + depends on I2C 569 + select REGMAP_I2C 568 570 569 571 config SND_SOC_TLV320AIC32X4 570 572 tristate
+5 -5
sound/soc/codecs/tlv320aic23.c
··· 364 364 365 365 iface_reg = snd_soc_read(codec, TLV320AIC23_DIGT_FMT) & ~(0x03 << 2); 366 366 367 - switch (params_format(params)) { 368 - case SNDRV_PCM_FORMAT_S16_LE: 367 + switch (params_width(params)) { 368 + case 16: 369 369 break; 370 - case SNDRV_PCM_FORMAT_S20_3LE: 370 + case 20: 371 371 iface_reg |= (0x01 << 2); 372 372 break; 373 - case SNDRV_PCM_FORMAT_S24_LE: 373 + case 24: 374 374 iface_reg |= (0x02 << 2); 375 375 break; 376 - case SNDRV_PCM_FORMAT_S32_LE: 376 + case 32: 377 377 iface_reg |= (0x03 << 2); 378 378 break; 379 379 }
+11 -10
sound/soc/codecs/tlv320aic31xx.c
··· 249 249 "Off", "FFR 10 Ohm", "FFR 20 Ohm", "FFR 40 Ohm" 250 250 }; 251 251 252 - static const 253 - SOC_ENUM_SINGLE_DECL(mic1lp_p_enum, AIC31XX_MICPGAPI, 6, mic_select_text); 254 - static const 255 - SOC_ENUM_SINGLE_DECL(mic1rp_p_enum, AIC31XX_MICPGAPI, 4, mic_select_text); 256 - static const 257 - SOC_ENUM_SINGLE_DECL(mic1lm_p_enum, AIC31XX_MICPGAPI, 2, mic_select_text); 252 + static SOC_ENUM_SINGLE_DECL(mic1lp_p_enum, AIC31XX_MICPGAPI, 6, 253 + mic_select_text); 254 + static SOC_ENUM_SINGLE_DECL(mic1rp_p_enum, AIC31XX_MICPGAPI, 4, 255 + mic_select_text); 256 + static SOC_ENUM_SINGLE_DECL(mic1lm_p_enum, AIC31XX_MICPGAPI, 2, 257 + mic_select_text); 258 258 259 - static const 260 - SOC_ENUM_SINGLE_DECL(cm_m_enum, AIC31XX_MICPGAMI, 6, mic_select_text); 261 - static const 262 - SOC_ENUM_SINGLE_DECL(mic1lm_m_enum, AIC31XX_MICPGAMI, 4, mic_select_text); 259 + static SOC_ENUM_SINGLE_DECL(cm_m_enum, AIC31XX_MICPGAMI, 6, mic_select_text); 260 + static SOC_ENUM_SINGLE_DECL(mic1lm_m_enum, AIC31XX_MICPGAMI, 4, 261 + mic_select_text); 263 262 264 263 static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6350, 50, 0); 265 264 static const DECLARE_TLV_DB_SCALE(adc_fgain_tlv, 0, 10, 0); ··· 328 329 unsigned int bits; 329 330 int counter = count; 330 331 int ret = regmap_read(aic31xx->regmap, reg, &bits); 332 + 331 333 while ((bits & mask) != wbits && counter && !ret) { 332 334 usleep_range(sleep, sleep * 2); 333 335 ret = regmap_read(aic31xx->regmap, reg, &bits); ··· 435 435 { 436 436 struct snd_soc_codec *codec = w->codec; 437 437 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); 438 + 438 439 switch (event) { 439 440 case SND_SOC_DAPM_POST_PMU: 440 441 /* change mic bias voltage to user defined */
+11 -10
sound/soc/codecs/tlv320aic32x4.c
··· 626 626 snd_soc_write(codec, AIC32X4_MICBIAS, AIC32X4_MICBIAS_LDOIN | 627 627 AIC32X4_MICBIAS_2075V); 628 628 } 629 - if (aic32x4->power_cfg & AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE) { 629 + if (aic32x4->power_cfg & AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE) 630 630 snd_soc_write(codec, AIC32X4_PWRCFG, AIC32X4_AVDDWEAKDISABLE); 631 - } 632 631 633 632 tmp_reg = (aic32x4->power_cfg & AIC32X4_PWR_AIC32X4_LDO_ENABLE) ? 634 633 AIC32X4_LDOCTLEN : 0; 635 634 snd_soc_write(codec, AIC32X4_LDOCTL, tmp_reg); 636 635 637 636 tmp_reg = snd_soc_read(codec, AIC32X4_CMMODE); 638 - if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36) { 637 + if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36) 639 638 tmp_reg |= AIC32X4_LDOIN_18_36; 640 - } 641 - if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED) { 639 + if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED) 642 640 tmp_reg |= AIC32X4_LDOIN2HP; 643 - } 644 641 snd_soc_write(codec, AIC32X4_CMMODE, tmp_reg); 645 642 646 643 /* Mic PGA routing */ 647 644 if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K) 648 - snd_soc_write(codec, AIC32X4_LMICPGANIN, AIC32X4_LMICPGANIN_IN2R_10K); 645 + snd_soc_write(codec, AIC32X4_LMICPGANIN, 646 + AIC32X4_LMICPGANIN_IN2R_10K); 649 647 else 650 - snd_soc_write(codec, AIC32X4_LMICPGANIN, AIC32X4_LMICPGANIN_CM1L_10K); 648 + snd_soc_write(codec, AIC32X4_LMICPGANIN, 649 + AIC32X4_LMICPGANIN_CM1L_10K); 651 650 if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K) 652 - snd_soc_write(codec, AIC32X4_RMICPGANIN, AIC32X4_RMICPGANIN_IN1L_10K); 651 + snd_soc_write(codec, AIC32X4_RMICPGANIN, 652 + AIC32X4_RMICPGANIN_IN1L_10K); 653 653 else 654 - snd_soc_write(codec, AIC32X4_RMICPGANIN, AIC32X4_RMICPGANIN_CM1R_10K); 654 + snd_soc_write(codec, AIC32X4_RMICPGANIN, 655 + AIC32X4_RMICPGANIN_CM1R_10K); 655 656 656 657 aic32x4_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 657 658
+21
sound/soc/soc-core.c
··· 3289 3289 } 3290 3290 EXPORT_SYMBOL_GPL(snd_soc_bytes_info_ext); 3291 3291 3292 + int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag, 3293 + unsigned int size, unsigned int __user *tlv) 3294 + { 3295 + struct soc_bytes_ext *params = (void *)kcontrol->private_value; 3296 + unsigned int count = size < params->max ? size : params->max; 3297 + int ret = -ENXIO; 3298 + 3299 + switch (op_flag) { 3300 + case SNDRV_CTL_TLV_OP_READ: 3301 + if (params->get) 3302 + ret = params->get(tlv, count); 3303 + break; 3304 + case SNDRV_CTL_TLV_OP_WRITE: 3305 + if (params->put) 3306 + ret = params->put(tlv, count); 3307 + break; 3308 + } 3309 + return ret; 3310 + } 3311 + EXPORT_SYMBOL_GPL(snd_soc_bytes_tlv_callback); 3312 + 3292 3313 /** 3293 3314 * snd_soc_info_xr_sx - signed multi register info callback 3294 3315 * @kcontrol: mreg control