Skip to content

Commit

Permalink
Merge remote-tracking branches 'asoc/topic/gpiod-flags', 'asoc/topic/…
Browse files Browse the repository at this point in the history
…gtm601', 'asoc/topic/intel', 'asoc/topic/lm3857' and 'asoc/topic/max98090' into asoc-next
  • Loading branch information
Mark Brown committed Jun 5, 2015
6 parents eb2d8ec + 0a8ba6e + 40579e0 + 859c34b + 08a1e64 + bb13f0e commit f36795a
Show file tree
Hide file tree
Showing 21 changed files with 784 additions and 186 deletions.
13 changes: 13 additions & 0 deletions Documentation/devicetree/bindings/sound/gtm601.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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";
};
6 changes: 6 additions & 0 deletions Documentation/devicetree/bindings/sound/max98090.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
112 changes: 29 additions & 83 deletions sound/soc/codecs/lm4857.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -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"),
Expand All @@ -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,
Expand All @@ -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[] = {
Expand All @@ -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,
};

Expand Down
13 changes: 12 additions & 1 deletion sound/soc/codecs/max98090.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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);

Expand Down
3 changes: 1 addition & 2 deletions sound/soc/codecs/max98357a.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 4 additions & 10 deletions sound/soc/codecs/sta32x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,16 +1095,10 @@ static int sta32x_i2c_probe(struct i2c_client *i2c,
#endif

/* GPIOs */
sta32x->gpiod_nreset = devm_gpiod_get(dev, "reset");
if (IS_ERR(sta32x->gpiod_nreset)) {
ret = PTR_ERR(sta32x->gpiod_nreset);
if (ret != -ENOENT && ret != -ENOSYS)
return ret;

sta32x->gpiod_nreset = NULL;
} else {
gpiod_direction_output(sta32x->gpiod_nreset, 0);
}
sta32x->gpiod_nreset = devm_gpiod_get_optional(dev, "reset",
GPIOD_OUT_LOW);
if (IS_ERR(sta32x->gpiod_nreset))
return PTR_ERR(sta32x->gpiod_nreset);

/* regulators */
for (i = 0; i < ARRAY_SIZE(sta32x->supplies); i++)
Expand Down
17 changes: 14 additions & 3 deletions sound/soc/intel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ config SND_SOC_INTEL_BROADWELL_MACH
depends on SND_SOC_INTEL_SST && X86_INTEL_LPSS && DW_DMAC && \
I2C_DESIGNWARE_PLATFORM
select SND_SOC_INTEL_HASWELL
select SND_COMPRESS_OFFLOAD
select SND_SOC_RT286
help
This adds support for the Wilcatpoint Audio DSP on Intel(R) Broadwell
Expand Down Expand Up @@ -112,12 +111,24 @@ config SND_SOC_INTEL_CHT_BSW_RT5672_MACH
If unsure select "N".

config SND_SOC_INTEL_CHT_BSW_RT5645_MACH
tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5645 codec"
tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5645/5650 codec"
depends on X86_INTEL_LPSS
select SND_SOC_RT5645
select SND_SST_MFLD_PLATFORM
select SND_SST_IPC_ACPI
help
This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell
platforms with RT5645 audio codec.
platforms with RT5645/5650 audio codec.
If unsure select "N".

config SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH
tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with MAX98090 & TI codec"
depends on X86_INTEL_LPSS
select SND_SOC_MAX98090
select SND_SOC_TS3A227E
select SND_SST_MFLD_PLATFORM
select SND_SST_IPC_ACPI
help
This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell
platforms with MAX98090 audio codec it also can support TI jack chip as aux device.
If unsure select "N".
Loading

0 comments on commit f36795a

Please sign in to comment.