Commit 6ec2c85f authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/cs47l24', 'asoc/topic/cx20442',...

Merge remote-tracking branches 'asoc/topic/cs47l24', 'asoc/topic/cx20442', 'asoc/topic/da7213', 'asoc/topic/da7218' and 'asoc/topic/dai-drv' into asoc-next
...@@ -863,12 +863,10 @@ struct snd_soc_component { ...@@ -863,12 +863,10 @@ struct snd_soc_component {
struct list_head card_aux_list; /* for auxiliary bound components */ struct list_head card_aux_list; /* for auxiliary bound components */
struct list_head card_list; struct list_head card_list;
struct snd_soc_dai_driver *dai_drv;
int num_dai;
const struct snd_soc_component_driver *driver; const struct snd_soc_component_driver *driver;
struct list_head dai_list; struct list_head dai_list;
int num_dai;
int (*read)(struct snd_soc_component *, unsigned int, unsigned int *); int (*read)(struct snd_soc_component *, unsigned int, unsigned int *);
int (*write)(struct snd_soc_component *, unsigned int, unsigned int); int (*write)(struct snd_soc_component *, unsigned int, unsigned int);
......
...@@ -1120,9 +1120,11 @@ static int cs47l24_codec_probe(struct snd_soc_codec *codec) ...@@ -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_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec); struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec);
struct arizona *arizona = priv->core.arizona;
int ret; int ret;
priv->core.arizona->dapm = dapm; arizona->dapm = dapm;
snd_soc_codec_init_regmap(codec, arizona->regmap);
ret = arizona_init_spk(codec); ret = arizona_init_spk(codec);
if (ret < 0) if (ret < 0)
...@@ -1175,17 +1177,9 @@ static unsigned int cs47l24_digital_vu[] = { ...@@ -1175,17 +1177,9 @@ static unsigned int cs47l24_digital_vu[] = {
ARIZONA_DAC_DIGITAL_VOLUME_4L, 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 = { static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = {
.probe = cs47l24_codec_probe, .probe = cs47l24_codec_probe,
.remove = cs47l24_codec_remove, .remove = cs47l24_codec_remove,
.get_regmap = cs47l24_get_regmap,
.idle_bias_off = true, .idle_bias_off = true,
......
...@@ -26,8 +26,9 @@ ...@@ -26,8 +26,9 @@
struct cx20442_priv { struct cx20442_priv {
void *control_data; struct tty_struct *tty;
struct regulator *por; struct regulator *por;
u8 reg_cache;
}; };
#define CX20442_PM 0x0 #define CX20442_PM 0x0
...@@ -91,12 +92,12 @@ static const struct snd_soc_dapm_route cx20442_audio_map[] = { ...@@ -91,12 +92,12 @@ static const struct snd_soc_dapm_route cx20442_audio_map[] = {
static unsigned int cx20442_read_reg_cache(struct snd_soc_codec *codec, static unsigned int cx20442_read_reg_cache(struct snd_soc_codec *codec,
unsigned int reg) unsigned int reg)
{ {
u8 *reg_cache = codec->reg_cache; struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec);
if (reg >= codec->driver->reg_cache_size) if (reg >= 1)
return -EINVAL; return -EINVAL;
return reg_cache[reg]; return cx20442->reg_cache;
} }
enum v253_vls { enum v253_vls {
...@@ -156,20 +157,19 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg, ...@@ -156,20 +157,19 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg,
unsigned int value) unsigned int value)
{ {
struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec); struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec);
u8 *reg_cache = codec->reg_cache;
int vls, vsp, old, len; int vls, vsp, old, len;
char buf[18]; char buf[18];
if (reg >= codec->driver->reg_cache_size) if (reg >= 1)
return -EINVAL; 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 */ * 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; return -EIO;
old = reg_cache[reg]; old = cx20442->reg_cache;
reg_cache[reg] = value; cx20442->reg_cache = value;
vls = cx20442_pm_to_v253_vls(value); vls = cx20442_pm_to_v253_vls(value);
if (vls < 0) if (vls < 0)
...@@ -194,13 +194,12 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg, ...@@ -194,13 +194,12 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg,
return -ENOMEM; return -ENOMEM;
dev_dbg(codec->dev, "%s: %s\n", __func__, buf); 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 -EIO;
return 0; return 0;
} }
/* /*
* Line discpline related code * Line discpline related code
* *
...@@ -252,8 +251,7 @@ static void v253_close(struct tty_struct *tty) ...@@ -252,8 +251,7 @@ static void v253_close(struct tty_struct *tty)
cx20442 = snd_soc_codec_get_drvdata(codec); cx20442 = snd_soc_codec_get_drvdata(codec);
/* Prevent the codec driver from further accessing the modem */ /* Prevent the codec driver from further accessing the modem */
codec->hw_write = NULL; cx20442->tty = NULL;
cx20442->control_data = NULL;
codec->component.card->pop_time = 0; codec->component.card->pop_time = 0;
} }
...@@ -276,12 +274,11 @@ static void v253_receive(struct tty_struct *tty, ...@@ -276,12 +274,11 @@ static void v253_receive(struct tty_struct *tty,
cx20442 = snd_soc_codec_get_drvdata(codec); cx20442 = snd_soc_codec_get_drvdata(codec);
if (!cx20442->control_data) { if (!cx20442->tty) {
/* First modem response, complete setup procedure */ /* First modem response, complete setup procedure */
/* Set up codec driver access to modem controls */ /* Set up codec driver access to modem controls */
cx20442->control_data = tty; cx20442->tty = tty;
codec->hw_write = (hw_write_t)tty->ops->write;
codec->component.card->pop_time = 1; codec->component.card->pop_time = 1;
} }
} }
...@@ -367,10 +364,9 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec) ...@@ -367,10 +364,9 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)
cx20442->por = regulator_get(codec->dev, "POR"); cx20442->por = regulator_get(codec->dev, "POR");
if (IS_ERR(cx20442->por)) if (IS_ERR(cx20442->por))
dev_warn(codec->dev, "failed to get the regulator"); dev_warn(codec->dev, "failed to get the regulator");
cx20442->control_data = NULL; cx20442->tty = NULL;
snd_soc_codec_set_drvdata(codec, cx20442); snd_soc_codec_set_drvdata(codec, cx20442);
codec->hw_write = NULL;
codec->component.card->pop_time = 0; codec->component.card->pop_time = 0;
return 0; return 0;
...@@ -381,8 +377,8 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec) ...@@ -381,8 +377,8 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec)
{ {
struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec); struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec);
if (cx20442->control_data) { if (cx20442->tty) {
struct tty_struct *tty = cx20442->control_data; struct tty_struct *tty = cx20442->tty;
tty_hangup(tty); tty_hangup(tty);
} }
...@@ -396,17 +392,13 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec) ...@@ -396,17 +392,13 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec)
return 0; return 0;
} }
static const u8 cx20442_reg;
static const struct snd_soc_codec_driver cx20442_codec_dev = { static const struct snd_soc_codec_driver cx20442_codec_dev = {
.probe = cx20442_codec_probe, .probe = cx20442_codec_probe,
.remove = cx20442_codec_remove, .remove = cx20442_codec_remove,
.set_bias_level = cx20442_set_bias_level, .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, .read = cx20442_read_reg_cache,
.write = cx20442_write, .write = cx20442_write,
.component_driver = { .component_driver = {
.dapm_widgets = cx20442_dapm_widgets, .dapm_widgets = cx20442_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(cx20442_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(cx20442_dapm_widgets),
......
...@@ -1654,10 +1654,8 @@ static struct da7213_platform_data ...@@ -1654,10 +1654,8 @@ static struct da7213_platform_data
u32 fw_val32; u32 fw_val32;
pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) { if (!pdata)
dev_warn(codec->dev, "Failed to allocate memory for pdata\n");
return NULL; return NULL;
}
if (device_property_read_u32(dev, "dlg,micbias1-lvl", &fw_val32) >= 0) if (device_property_read_u32(dev, "dlg,micbias1-lvl", &fw_val32) >= 0)
pdata->micbias1_lvl = da7213_of_micbias_lvl(codec, fw_val32); pdata->micbias1_lvl = da7213_of_micbias_lvl(codec, fw_val32);
...@@ -1855,8 +1853,7 @@ static int da7213_i2c_probe(struct i2c_client *i2c, ...@@ -1855,8 +1853,7 @@ static int da7213_i2c_probe(struct i2c_client *i2c,
struct da7213_priv *da7213; struct da7213_priv *da7213;
int ret; int ret;
da7213 = devm_kzalloc(&i2c->dev, sizeof(struct da7213_priv), da7213 = devm_kzalloc(&i2c->dev, sizeof(*da7213), GFP_KERNEL);
GFP_KERNEL);
if (!da7213) if (!da7213)
return -ENOMEM; return -ENOMEM;
......
...@@ -2455,10 +2455,8 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec) ...@@ -2455,10 +2455,8 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
u32 of_val32; u32 of_val32;
pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) { if (!pdata)
dev_warn(codec->dev, "Failed to allocate memory for pdata\n");
return NULL; return NULL;
}
if (of_property_read_u32(np, "dlg,micbias1-lvl-millivolt", &of_val32) >= 0) if (of_property_read_u32(np, "dlg,micbias1-lvl-millivolt", &of_val32) >= 0)
pdata->micbias1_lvl = da7218_of_micbias_lvl(codec, of_val32); pdata->micbias1_lvl = da7218_of_micbias_lvl(codec, of_val32);
...@@ -2527,8 +2525,6 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec) ...@@ -2527,8 +2525,6 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata), hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
GFP_KERNEL); GFP_KERNEL);
if (!hpldet_pdata) { if (!hpldet_pdata) {
dev_warn(codec->dev,
"Failed to allocate memory for hpldet pdata\n");
of_node_put(hpldet_np); of_node_put(hpldet_np);
return pdata; return pdata;
} }
...@@ -3273,8 +3269,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c, ...@@ -3273,8 +3269,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c,
struct da7218_priv *da7218; struct da7218_priv *da7218;
int ret; int ret;
da7218 = devm_kzalloc(&i2c->dev, sizeof(struct da7218_priv), da7218 = devm_kzalloc(&i2c->dev, sizeof(*da7218), GFP_KERNEL);
GFP_KERNEL);
if (!da7218) if (!da7218)
return -ENOMEM; return -ENOMEM;
......
...@@ -105,7 +105,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol, ...@@ -105,7 +105,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
int pin, changed = 0; int pin, changed = 0;
/* Refuse any mode changes if we are not able to control the codec. */ /* 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; return -EUNATCH;
if (ucontrol->value.enumerated.item[0] >= control->items) if (ucontrol->value.enumerated.item[0] >= control->items)
...@@ -345,7 +345,7 @@ static void cx81801_receive(struct tty_struct *tty, ...@@ -345,7 +345,7 @@ static void cx81801_receive(struct tty_struct *tty,
if (!codec) if (!codec)
return; return;
if (!codec->hw_write) { if (!codec->component.card->pop_time) {
/* First modem response, complete setup procedure */ /* First modem response, complete setup procedure */
/* Initialize timer used for config pulse generation */ /* Initialize timer used for config pulse generation */
......
...@@ -3162,7 +3162,7 @@ static struct snd_soc_dai *soc_add_dai(struct snd_soc_component *component, ...@@ -3162,7 +3162,7 @@ static struct snd_soc_dai *soc_add_dai(struct snd_soc_component *component,
if (!dai->driver->ops) if (!dai->driver->ops)
dai->driver->ops = &null_dai_ops; dai->driver->ops = &null_dai_ops;
list_add(&dai->list, &component->dai_list); list_add_tail(&dai->list, &component->dai_list);
component->num_dai++; component->num_dai++;
dev_dbg(dev, "ASoC: Registered DAI '%s'\n", dai->name); dev_dbg(dev, "ASoC: Registered DAI '%s'\n", dai->name);
...@@ -3189,8 +3189,6 @@ static int snd_soc_register_dais(struct snd_soc_component *component, ...@@ -3189,8 +3189,6 @@ static int snd_soc_register_dais(struct snd_soc_component *component,
dev_dbg(dev, "ASoC: dai register %s #%zu\n", dev_name(dev), count); dev_dbg(dev, "ASoC: dai register %s #%zu\n", dev_name(dev), count);
component->dai_drv = dai_drv;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
dai = soc_add_dai(component, dai_drv + i, dai = soc_add_dai(component, dai_drv + i,
...@@ -4367,6 +4365,7 @@ int snd_soc_get_dai_name(struct of_phandle_args *args, ...@@ -4367,6 +4365,7 @@ int snd_soc_get_dai_name(struct of_phandle_args *args,
args, args,
dai_name); dai_name);
} else { } else {
struct snd_soc_dai *dai;
int id = -1; int id = -1;
switch (args->args_count) { switch (args->args_count) {
...@@ -4388,7 +4387,14 @@ int snd_soc_get_dai_name(struct of_phandle_args *args, ...@@ -4388,7 +4387,14 @@ int snd_soc_get_dai_name(struct of_phandle_args *args,
ret = 0; ret = 0;
*dai_name = pos->dai_drv[id].name; /* find target DAI */
list_for_each_entry(dai, &pos->dai_list, list) {
if (id == 0)
break;
id--;
}
*dai_name = dai->driver->name;
if (!*dai_name) if (!*dai_name)
*dai_name = pos->name; *dai_name = pos->name;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment