···18181919- maxim,dmic-freq: Frequency at which to clock DMIC20202121+- maxim,micbias: Micbias voltage applies to the analog mic, valid voltages value are:2222+ 0 - 2.2v2323+ 1 - 2.55v2424+ 2 - 2.4v2525+ 3 - 2.8v2626+2127Pins on the device (for linking into audio routes):22282329 * MIC1
+29-83
sound/soc/codecs/lm4857.c
···2323#include <sound/soc.h>2424#include <sound/tlv.h>25252626-struct lm4857 {2727- struct regmap *regmap;2828- uint8_t mode;2929-};3030-3126static const struct reg_default lm4857_default_regs[] = {3227 { 0x0, 0x00 },3328 { 0x1, 0x00 },···4146#define LM4857_WAKEUP 54247#define LM4857_EPGAIN 443484444-static int lm4857_get_mode(struct snd_kcontrol *kcontrol,4545- struct snd_ctl_elem_value *ucontrol)4646-{4747- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);4848- struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec);4949+static const unsigned int lm4857_mode_values[] = {5050+ 0,5151+ 6,5252+ 7,5353+ 8,5454+ 9,5555+};49565050- ucontrol->value.integer.value[0] = lm4857->mode;5151-5252- return 0;5353-}5454-5555-static int lm4857_set_mode(struct snd_kcontrol *kcontrol,5656- struct snd_ctl_elem_value *ucontrol)5757-{5858- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);5959- struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec);6060- uint8_t value = ucontrol->value.integer.value[0];6161-6262- lm4857->mode = value;6363-6464- if (codec->dapm.bias_level == SND_SOC_BIAS_ON)6565- regmap_update_bits(lm4857->regmap, LM4857_CTRL, 0x0F, value + 6);6666-6767- return 1;6868-}6969-7070-static int lm4857_set_bias_level(struct snd_soc_codec *codec,7171- enum snd_soc_bias_level level)7272-{7373- struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec);7474-7575- switch (level) {7676- case SND_SOC_BIAS_ON:7777- regmap_update_bits(lm4857->regmap, LM4857_CTRL, 0x0F,7878- lm4857->mode + 6);7979- break;8080- case SND_SOC_BIAS_STANDBY:8181- regmap_update_bits(lm4857->regmap, LM4857_CTRL, 0x0F, 0);8282- break;8383- default:8484- break;8585- }8686-8787- return 0;8888-}8989-9090-static const char *lm4857_mode[] = {5757+static const char * const lm4857_mode_texts[] = {5858+ "Off",9159 "Earpiece",9260 "Loudspeaker",9361 "Loudspeaker + Headphone",9462 "Headphone",9563};96649797-static SOC_ENUM_SINGLE_EXT_DECL(lm4857_mode_enum, lm4857_mode);6565+static SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(lm4857_mode_enum,6666+ LM4857_CTRL, 0, 0xf, lm4857_mode_texts, lm4857_mode_values);6767+6868+static const struct snd_kcontrol_new lm4857_mode_ctrl =6969+ SOC_DAPM_ENUM("Mode", lm4857_mode_enum);98709971static const struct snd_soc_dapm_widget lm4857_dapm_widgets[] = {10072 SND_SOC_DAPM_INPUT("IN"),7373+7474+ SND_SOC_DAPM_DEMUX("Mode", SND_SOC_NOPM, 0, 0, &lm4857_mode_ctrl),1017510276 SND_SOC_DAPM_OUTPUT("LS"),10377 SND_SOC_DAPM_OUTPUT("HP"),···89125 LM4857_WAKEUP, 1, 0),90126 SOC_SINGLE("Earpiece 6dB Playback Switch", LM4857_CTRL,91127 LM4857_EPGAIN, 1, 0),9292-9393- SOC_ENUM_EXT("Mode", lm4857_mode_enum,9494- lm4857_get_mode, lm4857_set_mode),95128};961299797-/* There is a demux between the input signal and the output signals.9898- * Currently there is no easy way to model it in ASoC and since it does not make9999- * much of a difference in practice simply connect the input direclty to the100100- * outputs. */101130static const struct snd_soc_dapm_route lm4857_routes[] = {102102- {"LS", NULL, "IN"},103103- {"HP", NULL, "IN"},104104- {"EP", NULL, "IN"},131131+ { "Mode", NULL, "IN" },132132+ { "LS", "Loudspeaker", "Mode" },133133+ { "LS", "Loudspeaker + Headphone", "Mode" },134134+ { "HP", "Headphone", "Mode" },135135+ { "HP", "Loudspeaker + Headphone", "Mode" },136136+ { "EP", "Earpiece", "Mode" },105137};106138107107-static struct snd_soc_codec_driver soc_codec_dev_lm4857 = {108108- .set_bias_level = lm4857_set_bias_level,109109-139139+static struct snd_soc_component_driver lm4857_component_driver = {110140 .controls = lm4857_controls,111141 .num_controls = ARRAY_SIZE(lm4857_controls),112142 .dapm_widgets = lm4857_dapm_widgets,···123165static int lm4857_i2c_probe(struct i2c_client *i2c,124166 const struct i2c_device_id *id)125167{126126- struct lm4857 *lm4857;168168+ struct regmap *regmap;127169128128- lm4857 = devm_kzalloc(&i2c->dev, sizeof(*lm4857), GFP_KERNEL);129129- if (!lm4857)130130- return -ENOMEM;170170+ regmap = devm_regmap_init_i2c(i2c, &lm4857_regmap_config);171171+ if (IS_ERR(regmap))172172+ return PTR_ERR(regmap);131173132132- i2c_set_clientdata(i2c, lm4857);133133-134134- lm4857->regmap = devm_regmap_init_i2c(i2c, &lm4857_regmap_config);135135- if (IS_ERR(lm4857->regmap))136136- return PTR_ERR(lm4857->regmap);137137-138138- return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_lm4857, NULL, 0);139139-}140140-141141-static int lm4857_i2c_remove(struct i2c_client *i2c)142142-{143143- snd_soc_unregister_codec(&i2c->dev);144144- return 0;174174+ return devm_snd_soc_register_component(&i2c->dev,175175+ &lm4857_component_driver, NULL, 0);145176}146177147178static const struct i2c_device_id lm4857_i2c_id[] = {···145198 .owner = THIS_MODULE,146199 },147200 .probe = lm4857_i2c_probe,148148- .remove = lm4857_i2c_remove,149201 .id_table = lm4857_i2c_id,150202};151203
+12-1
sound/soc/codecs/max98090.c
···24192419 struct max98090_cdata *cdata;24202420 enum max98090_type devtype;24212421 int ret = 0;24222422+ int err;24232423+ unsigned int micbias;2422242424232425 dev_dbg(codec->dev, "max98090_probe\n");24242426···25052503 snd_soc_write(codec, M98090_REG_BIAS_CONTROL,25062504 M98090_VCM_MODE_MASK);2507250525062506+ err = device_property_read_u32(codec->dev, "maxim,micbias", &micbias);25072507+ if (err) {25082508+ micbias = M98090_MBVSEL_2V8;25092509+ dev_info(codec->dev, "use default 2.8v micbias\n");25102510+ } else if (micbias < M98090_MBVSEL_2V2 || micbias > M98090_MBVSEL_2V8) {25112511+ dev_err(codec->dev, "micbias out of range 0x%x\n", micbias);25122512+ micbias = M98090_MBVSEL_2V8;25132513+ }25142514+25082515 snd_soc_update_bits(codec, M98090_REG_MIC_BIAS_VOLTAGE,25092509- M98090_MBVSEL_MASK, M98090_MBVSEL_2V8);25162516+ M98090_MBVSEL_MASK, micbias);2510251725112518 max98090_add_widgets(codec);25122519
···10951095#endif1096109610971097 /* GPIOs */10981098- sta32x->gpiod_nreset = devm_gpiod_get(dev, "reset");10991099- if (IS_ERR(sta32x->gpiod_nreset)) {11001100- ret = PTR_ERR(sta32x->gpiod_nreset);11011101- if (ret != -ENOENT && ret != -ENOSYS)11021102- return ret;11031103-11041104- sta32x->gpiod_nreset = NULL;11051105- } else {11061106- gpiod_direction_output(sta32x->gpiod_nreset, 0);11071107- }10981098+ sta32x->gpiod_nreset = devm_gpiod_get_optional(dev, "reset",10991099+ GPIOD_OUT_LOW);11001100+ if (IS_ERR(sta32x->gpiod_nreset))11011101+ return PTR_ERR(sta32x->gpiod_nreset);1108110211091103 /* regulators */11101104 for (i = 0; i < ARRAY_SIZE(sta32x->supplies); i++)
+14-3
sound/soc/intel/Kconfig
···7979 depends on SND_SOC_INTEL_SST && X86_INTEL_LPSS && DW_DMAC && \8080 I2C_DESIGNWARE_PLATFORM8181 select SND_SOC_INTEL_HASWELL8282- select SND_COMPRESS_OFFLOAD8382 select SND_SOC_RT2868483 help8584 This adds support for the Wilcatpoint Audio DSP on Intel(R) Broadwell···111112 If unsure select "N".112113113114config SND_SOC_INTEL_CHT_BSW_RT5645_MACH114114- tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5645 codec"115115+ tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5645/5650 codec"115116 depends on X86_INTEL_LPSS116117 select SND_SOC_RT5645117118 select SND_SST_MFLD_PLATFORM118119 select SND_SST_IPC_ACPI119120 help120121 This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell121121- platforms with RT5645 audio codec.122122+ platforms with RT5645/5650 audio codec.122123 If unsure select "N".124124+125125+config SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH126126+ tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with MAX98090 & TI codec"127127+ depends on X86_INTEL_LPSS128128+ select SND_SOC_MAX98090129129+ select SND_SOC_TS3A227E130130+ select SND_SST_MFLD_PLATFORM131131+ select SND_SST_IPC_ACPI132132+ help133133+ This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell134134+ platforms with MAX98090 audio codec it also can support TI jack chip as aux device.135135+ If unsure select "N".
···129129 return -ENOMEM;130130131131 for (i = 0; i < IPC_EMPTY_LIST_SIZE; i++) {132132+ ipc->msg[i].tx_data = kzalloc(ipc->tx_data_max_size, GFP_KERNEL);133133+ if (ipc->msg[i].tx_data == NULL)134134+ goto free_mem;135135+136136+ ipc->msg[i].rx_data = kzalloc(ipc->rx_data_max_size, GFP_KERNEL);137137+ if (ipc->msg[i].rx_data == NULL) {138138+ kfree(ipc->msg[i].tx_data);139139+ goto free_mem;140140+ }141141+132142 init_waitqueue_head(&ipc->msg[i].waitq);133143 list_add(&ipc->msg[i].list, &ipc->empty_list);134144 }135145136146 return 0;147147+148148+free_mem:149149+ while (i > 0) {150150+ kfree(ipc->msg[i-1].tx_data);151151+ kfree(ipc->msg[i-1].rx_data);152152+ --i;153153+ }154154+ kfree(ipc->msg);155155+156156+ return -ENOMEM;137157}138158139159static void ipc_tx_msgs(struct kthread_work *work)···162142 container_of(work, struct sst_generic_ipc, kwork);163143 struct ipc_message *msg;164144 unsigned long flags;165165- u64 ipcx;166145167146 spin_lock_irqsave(&ipc->dsp->spinlock, flags);168147···172153173154 /* if the DSP is busy, we will TX messages after IRQ.174155 * also postpone if we are in the middle of procesing completion irq*/175175- ipcx = sst_dsp_shim_read_unlocked(ipc->dsp, SST_IPCX);176176- if (ipcx & (SST_IPCX_BUSY | SST_IPCX_DONE)) {156156+ if (ipc->ops.is_dsp_busy && ipc->ops.is_dsp_busy(ipc->dsp)) {157157+ dev_dbg(ipc->dev, "ipc_tx_msgs dsp busy\n");177158 spin_unlock_irqrestore(&ipc->dsp->spinlock, flags);178159 return;179160 }···299280300281void sst_ipc_fini(struct sst_generic_ipc *ipc)301282{283283+ int i;284284+302285 if (ipc->tx_thread)303286 kthread_stop(ipc->tx_thread);304287305305- if (ipc->msg)288288+ if (ipc->msg) {289289+ for (i = 0; i < IPC_EMPTY_LIST_SIZE; i++) {290290+ kfree(ipc->msg[i].tx_data);291291+ kfree(ipc->msg[i].rx_data);292292+ }306293 kfree(ipc->msg);294294+ }307295}308296EXPORT_SYMBOL_GPL(sst_ipc_fini);309297