Skip to content

Commit

Permalink
Merge remote-tracking branches 'asoc/topic/cs42l56', 'asoc/topic/cs42…
Browse files Browse the repository at this point in the history
…l73', 'asoc/topic/cs47l24', 'asoc/topic/cx20442' and 'asoc/topic/da7213' into asoc-next
  • Loading branch information
Mark Brown committed Jan 12, 2018
6 parents 5c81e9b + e8d8b98 + 68fa08c + ba8dd49 + 39b5a0f + 8080699 commit c966b3c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 63 deletions.
13 changes: 4 additions & 9 deletions sound/soc/codecs/cs42l56.c
Original file line number Diff line number Diff line change
Expand Up @@ -1190,9 +1190,7 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client,
unsigned int alpha_rev, metal_rev;
unsigned int reg;

cs42l56 = devm_kzalloc(&i2c_client->dev,
sizeof(struct cs42l56_private),
GFP_KERNEL);
cs42l56 = devm_kzalloc(&i2c_client->dev, sizeof(*cs42l56), GFP_KERNEL);
if (cs42l56 == NULL)
return -ENOMEM;
cs42l56->dev = &i2c_client->dev;
Expand All @@ -1207,14 +1205,11 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client,
if (pdata) {
cs42l56->pdata = *pdata;
} else {
pdata = devm_kzalloc(&i2c_client->dev,
sizeof(struct cs42l56_platform_data),
pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata),
GFP_KERNEL);
if (!pdata) {
dev_err(&i2c_client->dev,
"could not allocate pdata\n");
if (!pdata)
return -ENOMEM;
}

if (i2c_client->dev.of_node) {
ret = cs42l56_handle_of_data(i2c_client,
&cs42l56->pdata);
Expand Down
13 changes: 5 additions & 8 deletions sound/soc/codecs/cs42l73.c
Original file line number Diff line number Diff line change
Expand Up @@ -1289,8 +1289,7 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
unsigned int reg;
u32 val32;

cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private),
GFP_KERNEL);
cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(*cs42l73), GFP_KERNEL);
if (!cs42l73)
return -ENOMEM;

Expand All @@ -1304,13 +1303,11 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
if (pdata) {
cs42l73->pdata = *pdata;
} else {
pdata = devm_kzalloc(&i2c_client->dev,
sizeof(struct cs42l73_platform_data),
GFP_KERNEL);
if (!pdata) {
dev_err(&i2c_client->dev, "could not allocate pdata\n");
pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata),
GFP_KERNEL);
if (!pdata)
return -ENOMEM;
}

if (i2c_client->dev.of_node) {
if (of_property_read_u32(i2c_client->dev.of_node,
"chgfreq", &val32) >= 0)
Expand Down
12 changes: 3 additions & 9 deletions sound/soc/codecs/cs47l24.c
Original file line number Diff line number Diff line change
Expand Up @@ -1120,9 +1120,11 @@ static int cs47l24_codec_probe(struct snd_soc_codec *codec)
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec);
struct arizona *arizona = priv->core.arizona;
int ret;

priv->core.arizona->dapm = dapm;
arizona->dapm = dapm;
snd_soc_codec_init_regmap(codec, arizona->regmap);

ret = arizona_init_spk(codec);
if (ret < 0)
Expand Down Expand Up @@ -1175,17 +1177,9 @@ static unsigned int cs47l24_digital_vu[] = {
ARIZONA_DAC_DIGITAL_VOLUME_4L,
};

static struct regmap *cs47l24_get_regmap(struct device *dev)
{
struct cs47l24_priv *priv = dev_get_drvdata(dev);

return priv->core.arizona->regmap;
}

static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = {
.probe = cs47l24_codec_probe,
.remove = cs47l24_codec_remove,
.get_regmap = cs47l24_get_regmap,

.idle_bias_off = true,

Expand Down
44 changes: 14 additions & 30 deletions sound/soc/codecs/cx20442.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


struct cx20442_priv {
void *control_data;
struct tty_struct *tty;
struct regulator *por;
};

Expand Down Expand Up @@ -88,17 +88,6 @@ static const struct snd_soc_dapm_route cx20442_audio_map[] = {
{"ADC", NULL, "Input Mixer"},
};

static unsigned int cx20442_read_reg_cache(struct snd_soc_codec *codec,
unsigned int reg)
{
u8 *reg_cache = codec->reg_cache;

if (reg >= codec->driver->reg_cache_size)
return -EINVAL;

return reg_cache[reg];
}

enum v253_vls {
V253_VLS_NONE = 0,
V253_VLS_T,
Expand All @@ -123,6 +112,8 @@ enum v253_vls {
V253_VLS_TEST,
};

#if 0
/* FIXME : these function will be re-used */
static int cx20442_pm_to_v253_vls(u8 value)
{
switch (value & ~(1 << CX20442_AGC)) {
Expand Down Expand Up @@ -163,9 +154,9 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg,
if (reg >= codec->driver->reg_cache_size)
return -EINVAL;

/* hw_write and control_data pointers required for talking to the modem
/* tty and write pointers required for talking to the modem
* are expected to be set by the line discipline initialization code */
if (!codec->hw_write || !cx20442->control_data)
if (!cx20442->tty || !cx20442->tty->ops->write)
return -EIO;

old = reg_cache[reg];
Expand Down Expand Up @@ -194,12 +185,12 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg,
return -ENOMEM;

dev_dbg(codec->dev, "%s: %s\n", __func__, buf);
if (codec->hw_write(cx20442->control_data, buf, len) != len)
if (cx20442->tty->ops->write(cx20442->tty, buf, len) != len)
return -EIO;

return 0;
}

#endif

/*
* Line discpline related code
Expand Down Expand Up @@ -252,8 +243,7 @@ static void v253_close(struct tty_struct *tty)
cx20442 = snd_soc_codec_get_drvdata(codec);

/* Prevent the codec driver from further accessing the modem */
codec->hw_write = NULL;
cx20442->control_data = NULL;
cx20442->tty = NULL;
codec->component.card->pop_time = 0;
}

Expand All @@ -276,12 +266,11 @@ static void v253_receive(struct tty_struct *tty,

cx20442 = snd_soc_codec_get_drvdata(codec);

if (!cx20442->control_data) {
if (!cx20442->tty) {
/* First modem response, complete setup procedure */

/* Set up codec driver access to modem controls */
cx20442->control_data = tty;
codec->hw_write = (hw_write_t)tty->ops->write;
cx20442->tty = tty;
codec->component.card->pop_time = 1;
}
}
Expand Down Expand Up @@ -367,10 +356,9 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)
cx20442->por = regulator_get(codec->dev, "POR");
if (IS_ERR(cx20442->por))
dev_warn(codec->dev, "failed to get the regulator");
cx20442->control_data = NULL;
cx20442->tty = NULL;

snd_soc_codec_set_drvdata(codec, cx20442);
codec->hw_write = NULL;
codec->component.card->pop_time = 0;

return 0;
Expand All @@ -381,8 +369,8 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec)
{
struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec);

if (cx20442->control_data) {
struct tty_struct *tty = cx20442->control_data;
if (cx20442->tty) {
struct tty_struct *tty = cx20442->tty;
tty_hangup(tty);
}

Expand All @@ -402,11 +390,7 @@ static const struct snd_soc_codec_driver cx20442_codec_dev = {
.probe = cx20442_codec_probe,
.remove = cx20442_codec_remove,
.set_bias_level = cx20442_set_bias_level,
.reg_cache_default = &cx20442_reg,
.reg_cache_size = 1,
.reg_word_size = sizeof(u8),
.read = cx20442_read_reg_cache,
.write = cx20442_write,

.component_driver = {
.dapm_widgets = cx20442_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(cx20442_dapm_widgets),
Expand Down
7 changes: 2 additions & 5 deletions sound/soc/codecs/da7213.c
Original file line number Diff line number Diff line change
Expand Up @@ -1654,10 +1654,8 @@ static struct da7213_platform_data
u32 fw_val32;

pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) {
dev_warn(codec->dev, "Failed to allocate memory for pdata\n");
if (!pdata)
return NULL;
}

if (device_property_read_u32(dev, "dlg,micbias1-lvl", &fw_val32) >= 0)
pdata->micbias1_lvl = da7213_of_micbias_lvl(codec, fw_val32);
Expand Down Expand Up @@ -1855,8 +1853,7 @@ static int da7213_i2c_probe(struct i2c_client *i2c,
struct da7213_priv *da7213;
int ret;

da7213 = devm_kzalloc(&i2c->dev, sizeof(struct da7213_priv),
GFP_KERNEL);
da7213 = devm_kzalloc(&i2c->dev, sizeof(*da7213), GFP_KERNEL);
if (!da7213)
return -ENOMEM;

Expand Down
4 changes: 2 additions & 2 deletions sound/soc/omap/ams-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
int pin, changed = 0;

/* Refuse any mode changes if we are not able to control the codec. */
if (!cx20442_codec->hw_write)
if (!cx20442_codec->component.card->pop_time)
return -EUNATCH;

if (ucontrol->value.enumerated.item[0] >= control->items)
Expand Down Expand Up @@ -345,7 +345,7 @@ static void cx81801_receive(struct tty_struct *tty,
if (!codec)
return;

if (!codec->hw_write) {
if (!codec->component.card->pop_time) {
/* First modem response, complete setup procedure */

/* Initialize timer used for config pulse generation */
Expand Down

0 comments on commit c966b3c

Please sign in to comment.