Commit 93f38ef6 authored by Mark Brown's avatar Mark Brown

Merge branch 'asoc-5.1' into asoc-5.2

parents 552f2d7e 780f202f
...@@ -802,8 +802,13 @@ struct snd_soc_component_driver { ...@@ -802,8 +802,13 @@ struct snd_soc_component_driver {
int probe_order; int probe_order;
int remove_order; int remove_order;
/* signal if the module handling the component cannot be removed */ /*
unsigned int ignore_module_refcount:1; * signal if the module handling the component should not be removed
* if a pcm is open. Setting this would prevent the module
* refcount being incremented in probe() but allow it be incremented
* when a pcm is opened and decremented when it is closed.
*/
unsigned int module_get_upon_open:1;
/* bits */ /* bits */
unsigned int idle_bias_on:1; unsigned int idle_bias_on:1;
......
...@@ -1635,6 +1635,16 @@ static int cs35l35_i2c_probe(struct i2c_client *i2c_client, ...@@ -1635,6 +1635,16 @@ static int cs35l35_i2c_probe(struct i2c_client *i2c_client,
return ret; return ret;
} }
static int cs35l35_i2c_remove(struct i2c_client *i2c_client)
{
struct cs35l35_private *cs35l35 = i2c_get_clientdata(i2c_client);
regulator_bulk_disable(cs35l35->num_supplies, cs35l35->supplies);
gpiod_set_value_cansleep(cs35l35->reset_gpio, 0);
return 0;
}
static const struct of_device_id cs35l35_of_match[] = { static const struct of_device_id cs35l35_of_match[] = {
{.compatible = "cirrus,cs35l35"}, {.compatible = "cirrus,cs35l35"},
{}, {},
...@@ -1655,6 +1665,7 @@ static struct i2c_driver cs35l35_i2c_driver = { ...@@ -1655,6 +1665,7 @@ static struct i2c_driver cs35l35_i2c_driver = {
}, },
.id_table = cs35l35_id, .id_table = cs35l35_id,
.probe = cs35l35_i2c_probe, .probe = cs35l35_i2c_probe,
.remove = cs35l35_i2c_remove,
}; };
module_i2c_driver(cs35l35_i2c_driver); module_i2c_driver(cs35l35_i2c_driver);
......
...@@ -1854,6 +1854,17 @@ static int hdmi_codec_probe(struct snd_soc_component *component) ...@@ -1854,6 +1854,17 @@ static int hdmi_codec_probe(struct snd_soc_component *component)
/* Imp: Store the card pointer in hda_codec */ /* Imp: Store the card pointer in hda_codec */
hdmi->card = dapm->card->snd_card; hdmi->card = dapm->card->snd_card;
/*
* Setup a device_link between card device and HDMI codec device.
* The card device is the consumer and the HDMI codec device is
* the supplier. With this setting, we can make sure that the audio
* domain in display power will be always turned on before operating
* on the HDMI audio codec registers.
* Let's use the flag DL_FLAG_AUTOREMOVE_CONSUMER. This can make
* sure the device link is freed when the machine driver is removed.
*/
device_link_add(component->card->dev, &hdev->dev, DL_FLAG_RPM_ACTIVE |
DL_FLAG_AUTOREMOVE_CONSUMER);
/* /*
* hdac_device core already sets the state to active and calls * hdac_device core already sets the state to active and calls
* get_noresume. So enable runtime and set the device to suspend. * get_noresume. So enable runtime and set the device to suspend.
......
...@@ -2588,6 +2588,7 @@ static int rt5682_i2c_probe(struct i2c_client *i2c, ...@@ -2588,6 +2588,7 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
rt5682_reset(rt5682->regmap); rt5682_reset(rt5682->regmap);
mutex_init(&rt5682->calibrate_mutex);
rt5682_calibrate(rt5682); rt5682_calibrate(rt5682);
ret = regmap_multi_reg_write(rt5682->regmap, patch_list, ret = regmap_multi_reg_write(rt5682->regmap, patch_list,
...@@ -2654,7 +2655,6 @@ static int rt5682_i2c_probe(struct i2c_client *i2c, ...@@ -2654,7 +2655,6 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
INIT_DELAYED_WORK(&rt5682->jd_check_work, INIT_DELAYED_WORK(&rt5682->jd_check_work,
rt5682_jd_check_handler); rt5682_jd_check_handler);
mutex_init(&rt5682->calibrate_mutex);
if (i2c->irq) { if (i2c->irq) {
ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL, ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL,
......
...@@ -1462,13 +1462,20 @@ static int skl_platform_soc_probe(struct snd_soc_component *component) ...@@ -1462,13 +1462,20 @@ static int skl_platform_soc_probe(struct snd_soc_component *component)
return 0; return 0;
} }
static void skl_pcm_remove(struct snd_soc_component *component)
{
/* remove topology */
snd_soc_tplg_component_remove(component, SND_SOC_TPLG_INDEX_ALL);
}
static const struct snd_soc_component_driver skl_component = { static const struct snd_soc_component_driver skl_component = {
.name = "pcm", .name = "pcm",
.probe = skl_platform_soc_probe, .probe = skl_platform_soc_probe,
.remove = skl_pcm_remove,
.ops = &skl_platform_ops, .ops = &skl_platform_ops,
.pcm_new = skl_pcm_new, .pcm_new = skl_pcm_new,
.pcm_free = skl_pcm_free, .pcm_free = skl_pcm_free,
.ignore_module_refcount = 1, /* do not increase the refcount in core */ .module_get_upon_open = 1, /* increment refcount when a pcm is opened */
}; };
int skl_platform_register(struct device *dev) int skl_platform_register(struct device *dev)
......
...@@ -193,13 +193,13 @@ static const u8 table_msbc_silence[SCO_PACKET_180] = { ...@@ -193,13 +193,13 @@ static const u8 table_msbc_silence[SCO_PACKET_180] = {
static void mtk_btcvsd_snd_irq_enable(struct mtk_btcvsd_snd *bt) static void mtk_btcvsd_snd_irq_enable(struct mtk_btcvsd_snd *bt)
{ {
regmap_update_bits(bt->infra, bt->infra_misc_offset, regmap_update_bits(bt->infra, bt->infra_misc_offset,
bt->conn_bt_cvsd_mask, bt->conn_bt_cvsd_mask); bt->conn_bt_cvsd_mask, 0);
} }
static void mtk_btcvsd_snd_irq_disable(struct mtk_btcvsd_snd *bt) static void mtk_btcvsd_snd_irq_disable(struct mtk_btcvsd_snd *bt)
{ {
regmap_update_bits(bt->infra, bt->infra_misc_offset, regmap_update_bits(bt->infra, bt->infra_misc_offset,
bt->conn_bt_cvsd_mask, 0); bt->conn_bt_cvsd_mask, bt->conn_bt_cvsd_mask);
} }
static void mtk_btcvsd_snd_set_state(struct mtk_btcvsd_snd *bt, static void mtk_btcvsd_snd_set_state(struct mtk_btcvsd_snd *bt,
......
...@@ -300,6 +300,18 @@ int rsnd_runtime_channel_after_ctu_with_params(struct rsnd_dai_stream *io, ...@@ -300,6 +300,18 @@ int rsnd_runtime_channel_after_ctu_with_params(struct rsnd_dai_stream *io,
return chan; return chan;
} }
int rsnd_channel_normalization(int chan)
{
if ((chan > 8) || (chan < 0))
return 0;
/* TDM Extend Mode needs 8ch */
if (chan == 6)
chan = 8;
return chan;
}
int rsnd_runtime_channel_for_ssi_with_params(struct rsnd_dai_stream *io, int rsnd_runtime_channel_for_ssi_with_params(struct rsnd_dai_stream *io,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
...@@ -312,11 +324,7 @@ int rsnd_runtime_channel_for_ssi_with_params(struct rsnd_dai_stream *io, ...@@ -312,11 +324,7 @@ int rsnd_runtime_channel_for_ssi_with_params(struct rsnd_dai_stream *io,
if (rsnd_runtime_is_multi_ssi(io)) if (rsnd_runtime_is_multi_ssi(io))
chan /= rsnd_rdai_ssi_lane_get(rdai); chan /= rsnd_rdai_ssi_lane_get(rdai);
/* TDM Extend Mode needs 8ch */ return rsnd_channel_normalization(chan);
if (chan == 6)
chan = 8;
return chan;
} }
int rsnd_runtime_is_multi_ssi(struct rsnd_dai_stream *io) int rsnd_runtime_is_multi_ssi(struct rsnd_dai_stream *io)
......
...@@ -446,6 +446,7 @@ void rsnd_parse_connect_common(struct rsnd_dai *rdai, ...@@ -446,6 +446,7 @@ void rsnd_parse_connect_common(struct rsnd_dai *rdai,
struct device_node *playback, struct device_node *playback,
struct device_node *capture); struct device_node *capture);
int rsnd_channel_normalization(int chan);
#define rsnd_runtime_channel_original(io) \ #define rsnd_runtime_channel_original(io) \
rsnd_runtime_channel_original_with_params(io, NULL) rsnd_runtime_channel_original_with_params(io, NULL)
int rsnd_runtime_channel_original_with_params(struct rsnd_dai_stream *io, int rsnd_runtime_channel_original_with_params(struct rsnd_dai_stream *io,
......
...@@ -303,6 +303,8 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, ...@@ -303,6 +303,8 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
if (rsnd_runtime_is_tdm_split(io)) if (rsnd_runtime_is_tdm_split(io))
chan = rsnd_io_converted_chan(io); chan = rsnd_io_converted_chan(io);
chan = rsnd_channel_normalization(chan);
main_rate = rsnd_ssi_clk_query(rdai, rate, chan, &idx); main_rate = rsnd_ssi_clk_query(rdai, rate, chan, &idx);
if (!main_rate) { if (!main_rate) {
dev_err(dev, "unsupported clock rate\n"); dev_err(dev, "unsupported clock rate\n");
......
...@@ -947,7 +947,7 @@ static void soc_cleanup_component(struct snd_soc_component *component) ...@@ -947,7 +947,7 @@ static void soc_cleanup_component(struct snd_soc_component *component)
snd_soc_dapm_free(snd_soc_component_get_dapm(component)); snd_soc_dapm_free(snd_soc_component_get_dapm(component));
soc_cleanup_component_debugfs(component); soc_cleanup_component_debugfs(component);
component->card = NULL; component->card = NULL;
if (!component->driver->ignore_module_refcount) if (!component->driver->module_get_upon_open)
module_put(component->dev->driver->owner); module_put(component->dev->driver->owner);
} }
...@@ -1381,7 +1381,7 @@ static int soc_probe_component(struct snd_soc_card *card, ...@@ -1381,7 +1381,7 @@ static int soc_probe_component(struct snd_soc_card *card,
return 0; return 0;
} }
if (!component->driver->ignore_module_refcount && if (!component->driver->module_get_upon_open &&
!try_module_get(component->dev->driver->owner)) !try_module_get(component->dev->driver->owner))
return -ENODEV; return -ENODEV;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/export.h> #include <linux/export.h>
...@@ -463,6 +464,9 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream, ...@@ -463,6 +464,9 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream,
continue; continue;
component->driver->ops->close(substream); component->driver->ops->close(substream);
if (component->driver->module_get_upon_open)
module_put(component->dev->driver->owner);
} }
return 0; return 0;
...@@ -513,6 +517,10 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -513,6 +517,10 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
!component->driver->ops->open) !component->driver->ops->open)
continue; continue;
if (component->driver->module_get_upon_open &&
!try_module_get(component->dev->driver->owner))
return -ENODEV;
ret = component->driver->ops->open(substream); ret = component->driver->ops->open(substream);
if (ret < 0) { if (ret < 0) {
dev_err(component->dev, dev_err(component->dev,
......
...@@ -484,10 +484,11 @@ static void remove_widget(struct snd_soc_component *comp, ...@@ -484,10 +484,11 @@ static void remove_widget(struct snd_soc_component *comp,
snd_ctl_remove(card, kcontrol); snd_ctl_remove(card, kcontrol);
kfree(dobj->control.dvalues); /* free enum kcontrol's dvalues and dtexts */
kfree(se->dobj.control.dvalues);
for (j = 0; j < se->items; j++) for (j = 0; j < se->items; j++)
kfree(dobj->control.dtexts[j]); kfree(se->dobj.control.dtexts[j]);
kfree(dobj->control.dtexts); kfree(se->dobj.control.dtexts);
kfree(se); kfree(se);
kfree(w->kcontrol_news[i].name); kfree(w->kcontrol_news[i].name);
......
...@@ -838,8 +838,9 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev, ...@@ -838,8 +838,9 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev,
/* Get irqs */ /* Get irqs */
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
if (irq != -EPROBE_DEFER)
dev_err(&pdev->dev, "no irq for node %s\n", pdev->name); dev_err(&pdev->dev, "no irq for node %s\n", pdev->name);
return -ENOENT; return irq;
} }
ret = devm_request_irq(&pdev->dev, irq, stm32_i2s_isr, IRQF_ONESHOT, ret = devm_request_irq(&pdev->dev, irq, stm32_i2s_isr, IRQF_ONESHOT,
......
...@@ -1420,7 +1420,6 @@ static int stm32_sai_sub_dais_init(struct platform_device *pdev, ...@@ -1420,7 +1420,6 @@ static int stm32_sai_sub_dais_init(struct platform_device *pdev,
if (!sai->cpu_dai_drv) if (!sai->cpu_dai_drv)
return -ENOMEM; return -ENOMEM;
sai->cpu_dai_drv->name = dev_name(&pdev->dev);
if (STM_SAI_IS_PLAYBACK(sai)) { if (STM_SAI_IS_PLAYBACK(sai)) {
memcpy(sai->cpu_dai_drv, &stm32_sai_playback_dai, memcpy(sai->cpu_dai_drv, &stm32_sai_playback_dai,
sizeof(stm32_sai_playback_dai)); sizeof(stm32_sai_playback_dai));
...@@ -1430,6 +1429,7 @@ static int stm32_sai_sub_dais_init(struct platform_device *pdev, ...@@ -1430,6 +1429,7 @@ static int stm32_sai_sub_dais_init(struct platform_device *pdev,
sizeof(stm32_sai_capture_dai)); sizeof(stm32_sai_capture_dai));
sai->cpu_dai_drv->capture.stream_name = sai->cpu_dai_drv->name; sai->cpu_dai_drv->capture.stream_name = sai->cpu_dai_drv->name;
} }
sai->cpu_dai_drv->name = dev_name(&pdev->dev);
return 0; return 0;
} }
......
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