Loading Documentation/devicetree/bindings/sound/gtm601.txt 0 → 100644 +13 −0 Original line number Diff line number Diff line GTM601 UMTS modem audio interface CODEC This device has no configuration interface. Sample rate is fixed - 8kHz. Required properties: - compatible : "option,gtm601" Example: codec: gtm601_codec { compatible = "option,gtm601"; }; Documentation/devicetree/bindings/sound/max98090.txt +6 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,12 @@ Optional properties: - maxim,dmic-freq: Frequency at which to clock DMIC - maxim,micbias: Micbias voltage applies to the analog mic, valid voltages value are: 0 - 2.2v 1 - 2.55v 2 - 2.4v 3 - 2.8v Pins on the device (for linking into audio routes): * MIC1 Loading sound/soc/codecs/lm4857.c +29 −83 Original line number Diff line number Diff line Loading @@ -23,11 +23,6 @@ #include <sound/soc.h> #include <sound/tlv.h> struct lm4857 { struct regmap *regmap; uint8_t mode; }; static const struct reg_default lm4857_default_regs[] = { { 0x0, 0x00 }, { 0x1, 0x00 }, Loading @@ -46,64 +41,33 @@ static const struct reg_default lm4857_default_regs[] = { #define LM4857_WAKEUP 5 #define LM4857_EPGAIN 4 static int lm4857_get_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec); ucontrol->value.integer.value[0] = lm4857->mode; return 0; } static int lm4857_set_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec); uint8_t value = ucontrol->value.integer.value[0]; lm4857->mode = value; if (codec->dapm.bias_level == SND_SOC_BIAS_ON) regmap_update_bits(lm4857->regmap, LM4857_CTRL, 0x0F, value + 6); return 1; } static int lm4857_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec); switch (level) { case SND_SOC_BIAS_ON: regmap_update_bits(lm4857->regmap, LM4857_CTRL, 0x0F, lm4857->mode + 6); break; case SND_SOC_BIAS_STANDBY: regmap_update_bits(lm4857->regmap, LM4857_CTRL, 0x0F, 0); break; default: break; } return 0; } static const unsigned int lm4857_mode_values[] = { 0, 6, 7, 8, 9, }; static const char *lm4857_mode[] = { static const char * const lm4857_mode_texts[] = { "Off", "Earpiece", "Loudspeaker", "Loudspeaker + Headphone", "Headphone", }; static SOC_ENUM_SINGLE_EXT_DECL(lm4857_mode_enum, lm4857_mode); static SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(lm4857_mode_enum, LM4857_CTRL, 0, 0xf, lm4857_mode_texts, lm4857_mode_values); static const struct snd_kcontrol_new lm4857_mode_ctrl = SOC_DAPM_ENUM("Mode", lm4857_mode_enum); static const struct snd_soc_dapm_widget lm4857_dapm_widgets[] = { SND_SOC_DAPM_INPUT("IN"), SND_SOC_DAPM_DEMUX("Mode", SND_SOC_NOPM, 0, 0, &lm4857_mode_ctrl), SND_SOC_DAPM_OUTPUT("LS"), SND_SOC_DAPM_OUTPUT("HP"), SND_SOC_DAPM_OUTPUT("EP"), Loading @@ -125,24 +89,18 @@ static const struct snd_kcontrol_new lm4857_controls[] = { LM4857_WAKEUP, 1, 0), SOC_SINGLE("Earpiece 6dB Playback Switch", LM4857_CTRL, LM4857_EPGAIN, 1, 0), SOC_ENUM_EXT("Mode", lm4857_mode_enum, lm4857_get_mode, lm4857_set_mode), }; /* There is a demux between the input signal and the output signals. * Currently there is no easy way to model it in ASoC and since it does not make * much of a difference in practice simply connect the input direclty to the * outputs. */ static const struct snd_soc_dapm_route lm4857_routes[] = { {"LS", NULL, "IN"}, {"HP", NULL, "IN"}, {"EP", NULL, "IN"}, { "Mode", NULL, "IN" }, { "LS", "Loudspeaker", "Mode" }, { "LS", "Loudspeaker + Headphone", "Mode" }, { "HP", "Headphone", "Mode" }, { "HP", "Loudspeaker + Headphone", "Mode" }, { "EP", "Earpiece", "Mode" }, }; static struct snd_soc_codec_driver soc_codec_dev_lm4857 = { .set_bias_level = lm4857_set_bias_level, static struct snd_soc_component_driver lm4857_component_driver = { .controls = lm4857_controls, .num_controls = ARRAY_SIZE(lm4857_controls), .dapm_widgets = lm4857_dapm_widgets, Loading @@ -165,25 +123,14 @@ static const struct regmap_config lm4857_regmap_config = { static int lm4857_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct lm4857 *lm4857; lm4857 = devm_kzalloc(&i2c->dev, sizeof(*lm4857), GFP_KERNEL); if (!lm4857) return -ENOMEM; i2c_set_clientdata(i2c, lm4857); lm4857->regmap = devm_regmap_init_i2c(i2c, &lm4857_regmap_config); if (IS_ERR(lm4857->regmap)) return PTR_ERR(lm4857->regmap); struct regmap *regmap; return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_lm4857, NULL, 0); } regmap = devm_regmap_init_i2c(i2c, &lm4857_regmap_config); if (IS_ERR(regmap)) return PTR_ERR(regmap); static int lm4857_i2c_remove(struct i2c_client *i2c) { snd_soc_unregister_codec(&i2c->dev); return 0; return devm_snd_soc_register_component(&i2c->dev, &lm4857_component_driver, NULL, 0); } static const struct i2c_device_id lm4857_i2c_id[] = { Loading @@ -198,7 +145,6 @@ static struct i2c_driver lm4857_i2c_driver = { .owner = THIS_MODULE, }, .probe = lm4857_i2c_probe, .remove = lm4857_i2c_remove, .id_table = lm4857_i2c_id, }; Loading sound/soc/codecs/max98090.c +12 −1 Original line number Diff line number Diff line Loading @@ -2419,6 +2419,8 @@ static int max98090_probe(struct snd_soc_codec *codec) struct max98090_cdata *cdata; enum max98090_type devtype; int ret = 0; int err; unsigned int micbias; dev_dbg(codec->dev, "max98090_probe\n"); Loading Loading @@ -2503,8 +2505,17 @@ static int max98090_probe(struct snd_soc_codec *codec) snd_soc_write(codec, M98090_REG_BIAS_CONTROL, M98090_VCM_MODE_MASK); err = device_property_read_u32(codec->dev, "maxim,micbias", &micbias); if (err) { micbias = M98090_MBVSEL_2V8; dev_info(codec->dev, "use default 2.8v micbias\n"); } else if (micbias < M98090_MBVSEL_2V2 || micbias > M98090_MBVSEL_2V8) { dev_err(codec->dev, "micbias out of range 0x%x\n", micbias); micbias = M98090_MBVSEL_2V8; } snd_soc_update_bits(codec, M98090_REG_MIC_BIAS_VOLTAGE, M98090_MBVSEL_MASK, M98090_MBVSEL_2V8); M98090_MBVSEL_MASK, micbias); max98090_add_widgets(codec); Loading sound/soc/codecs/max98357a.c +1 −2 Original line number Diff line number Diff line Loading @@ -60,13 +60,12 @@ static int max98357a_codec_probe(struct snd_soc_codec *codec) { struct gpio_desc *sdmode; sdmode = devm_gpiod_get(codec->dev, "sdmode"); sdmode = devm_gpiod_get(codec->dev, "sdmode", GPIOD_OUT_LOW); if (IS_ERR(sdmode)) { dev_err(codec->dev, "%s() unable to get sdmode GPIO: %ld\n", __func__, PTR_ERR(sdmode)); return PTR_ERR(sdmode); } gpiod_direction_output(sdmode, 0); snd_soc_codec_set_drvdata(codec, sdmode); return 0; Loading Loading
Documentation/devicetree/bindings/sound/gtm601.txt 0 → 100644 +13 −0 Original line number Diff line number Diff line GTM601 UMTS modem audio interface CODEC This device has no configuration interface. Sample rate is fixed - 8kHz. Required properties: - compatible : "option,gtm601" Example: codec: gtm601_codec { compatible = "option,gtm601"; };
Documentation/devicetree/bindings/sound/max98090.txt +6 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,12 @@ Optional properties: - maxim,dmic-freq: Frequency at which to clock DMIC - maxim,micbias: Micbias voltage applies to the analog mic, valid voltages value are: 0 - 2.2v 1 - 2.55v 2 - 2.4v 3 - 2.8v Pins on the device (for linking into audio routes): * MIC1 Loading
sound/soc/codecs/lm4857.c +29 −83 Original line number Diff line number Diff line Loading @@ -23,11 +23,6 @@ #include <sound/soc.h> #include <sound/tlv.h> struct lm4857 { struct regmap *regmap; uint8_t mode; }; static const struct reg_default lm4857_default_regs[] = { { 0x0, 0x00 }, { 0x1, 0x00 }, Loading @@ -46,64 +41,33 @@ static const struct reg_default lm4857_default_regs[] = { #define LM4857_WAKEUP 5 #define LM4857_EPGAIN 4 static int lm4857_get_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec); ucontrol->value.integer.value[0] = lm4857->mode; return 0; } static int lm4857_set_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec); uint8_t value = ucontrol->value.integer.value[0]; lm4857->mode = value; if (codec->dapm.bias_level == SND_SOC_BIAS_ON) regmap_update_bits(lm4857->regmap, LM4857_CTRL, 0x0F, value + 6); return 1; } static int lm4857_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec); switch (level) { case SND_SOC_BIAS_ON: regmap_update_bits(lm4857->regmap, LM4857_CTRL, 0x0F, lm4857->mode + 6); break; case SND_SOC_BIAS_STANDBY: regmap_update_bits(lm4857->regmap, LM4857_CTRL, 0x0F, 0); break; default: break; } return 0; } static const unsigned int lm4857_mode_values[] = { 0, 6, 7, 8, 9, }; static const char *lm4857_mode[] = { static const char * const lm4857_mode_texts[] = { "Off", "Earpiece", "Loudspeaker", "Loudspeaker + Headphone", "Headphone", }; static SOC_ENUM_SINGLE_EXT_DECL(lm4857_mode_enum, lm4857_mode); static SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(lm4857_mode_enum, LM4857_CTRL, 0, 0xf, lm4857_mode_texts, lm4857_mode_values); static const struct snd_kcontrol_new lm4857_mode_ctrl = SOC_DAPM_ENUM("Mode", lm4857_mode_enum); static const struct snd_soc_dapm_widget lm4857_dapm_widgets[] = { SND_SOC_DAPM_INPUT("IN"), SND_SOC_DAPM_DEMUX("Mode", SND_SOC_NOPM, 0, 0, &lm4857_mode_ctrl), SND_SOC_DAPM_OUTPUT("LS"), SND_SOC_DAPM_OUTPUT("HP"), SND_SOC_DAPM_OUTPUT("EP"), Loading @@ -125,24 +89,18 @@ static const struct snd_kcontrol_new lm4857_controls[] = { LM4857_WAKEUP, 1, 0), SOC_SINGLE("Earpiece 6dB Playback Switch", LM4857_CTRL, LM4857_EPGAIN, 1, 0), SOC_ENUM_EXT("Mode", lm4857_mode_enum, lm4857_get_mode, lm4857_set_mode), }; /* There is a demux between the input signal and the output signals. * Currently there is no easy way to model it in ASoC and since it does not make * much of a difference in practice simply connect the input direclty to the * outputs. */ static const struct snd_soc_dapm_route lm4857_routes[] = { {"LS", NULL, "IN"}, {"HP", NULL, "IN"}, {"EP", NULL, "IN"}, { "Mode", NULL, "IN" }, { "LS", "Loudspeaker", "Mode" }, { "LS", "Loudspeaker + Headphone", "Mode" }, { "HP", "Headphone", "Mode" }, { "HP", "Loudspeaker + Headphone", "Mode" }, { "EP", "Earpiece", "Mode" }, }; static struct snd_soc_codec_driver soc_codec_dev_lm4857 = { .set_bias_level = lm4857_set_bias_level, static struct snd_soc_component_driver lm4857_component_driver = { .controls = lm4857_controls, .num_controls = ARRAY_SIZE(lm4857_controls), .dapm_widgets = lm4857_dapm_widgets, Loading @@ -165,25 +123,14 @@ static const struct regmap_config lm4857_regmap_config = { static int lm4857_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct lm4857 *lm4857; lm4857 = devm_kzalloc(&i2c->dev, sizeof(*lm4857), GFP_KERNEL); if (!lm4857) return -ENOMEM; i2c_set_clientdata(i2c, lm4857); lm4857->regmap = devm_regmap_init_i2c(i2c, &lm4857_regmap_config); if (IS_ERR(lm4857->regmap)) return PTR_ERR(lm4857->regmap); struct regmap *regmap; return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_lm4857, NULL, 0); } regmap = devm_regmap_init_i2c(i2c, &lm4857_regmap_config); if (IS_ERR(regmap)) return PTR_ERR(regmap); static int lm4857_i2c_remove(struct i2c_client *i2c) { snd_soc_unregister_codec(&i2c->dev); return 0; return devm_snd_soc_register_component(&i2c->dev, &lm4857_component_driver, NULL, 0); } static const struct i2c_device_id lm4857_i2c_id[] = { Loading @@ -198,7 +145,6 @@ static struct i2c_driver lm4857_i2c_driver = { .owner = THIS_MODULE, }, .probe = lm4857_i2c_probe, .remove = lm4857_i2c_remove, .id_table = lm4857_i2c_id, }; Loading
sound/soc/codecs/max98090.c +12 −1 Original line number Diff line number Diff line Loading @@ -2419,6 +2419,8 @@ static int max98090_probe(struct snd_soc_codec *codec) struct max98090_cdata *cdata; enum max98090_type devtype; int ret = 0; int err; unsigned int micbias; dev_dbg(codec->dev, "max98090_probe\n"); Loading Loading @@ -2503,8 +2505,17 @@ static int max98090_probe(struct snd_soc_codec *codec) snd_soc_write(codec, M98090_REG_BIAS_CONTROL, M98090_VCM_MODE_MASK); err = device_property_read_u32(codec->dev, "maxim,micbias", &micbias); if (err) { micbias = M98090_MBVSEL_2V8; dev_info(codec->dev, "use default 2.8v micbias\n"); } else if (micbias < M98090_MBVSEL_2V2 || micbias > M98090_MBVSEL_2V8) { dev_err(codec->dev, "micbias out of range 0x%x\n", micbias); micbias = M98090_MBVSEL_2V8; } snd_soc_update_bits(codec, M98090_REG_MIC_BIAS_VOLTAGE, M98090_MBVSEL_MASK, M98090_MBVSEL_2V8); M98090_MBVSEL_MASK, micbias); max98090_add_widgets(codec); Loading
sound/soc/codecs/max98357a.c +1 −2 Original line number Diff line number Diff line Loading @@ -60,13 +60,12 @@ static int max98357a_codec_probe(struct snd_soc_codec *codec) { struct gpio_desc *sdmode; sdmode = devm_gpiod_get(codec->dev, "sdmode"); sdmode = devm_gpiod_get(codec->dev, "sdmode", GPIOD_OUT_LOW); if (IS_ERR(sdmode)) { dev_err(codec->dev, "%s() unable to get sdmode GPIO: %ld\n", __func__, PTR_ERR(sdmode)); return PTR_ERR(sdmode); } gpiod_direction_output(sdmode, 0); snd_soc_codec_set_drvdata(codec, sdmode); return 0; Loading