Merge branch 'asoc-5.1' into asoc-5.2
commit
072cb68a43
|
@ -642,6 +642,7 @@ static const struct regmap_config cs4270_regmap = {
|
||||||
.reg_defaults = cs4270_reg_defaults,
|
.reg_defaults = cs4270_reg_defaults,
|
||||||
.num_reg_defaults = ARRAY_SIZE(cs4270_reg_defaults),
|
.num_reg_defaults = ARRAY_SIZE(cs4270_reg_defaults),
|
||||||
.cache_type = REGCACHE_RBTREE,
|
.cache_type = REGCACHE_RBTREE,
|
||||||
|
.write_flag_mask = CS4270_I2C_INCR,
|
||||||
|
|
||||||
.readable_reg = cs4270_reg_is_readable,
|
.readable_reg = cs4270_reg_is_readable,
|
||||||
.volatile_reg = cs4270_reg_is_volatile,
|
.volatile_reg = cs4270_reg_is_volatile,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* Copyright 2011-2019 NW Digital Radio
|
* Copyright 2011-2019 NW Digital Radio
|
||||||
*
|
*
|
||||||
* Author: Jeremy McDermond <nh6z@nh6z.net>
|
* Author: Annaliese McDermond <nh6z@nh6z.net>
|
||||||
*
|
*
|
||||||
* Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27.
|
* Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27.
|
||||||
*
|
*
|
||||||
|
@ -62,5 +62,5 @@ static struct i2c_driver aic32x4_i2c_driver = {
|
||||||
module_i2c_driver(aic32x4_i2c_driver);
|
module_i2c_driver(aic32x4_i2c_driver);
|
||||||
|
|
||||||
MODULE_DESCRIPTION("ASoC TLV320AIC32x4 codec driver I2C");
|
MODULE_DESCRIPTION("ASoC TLV320AIC32x4 codec driver I2C");
|
||||||
MODULE_AUTHOR("Jeremy McDermond <nh6z@nh6z.net>");
|
MODULE_AUTHOR("Annaliese McDermond <nh6z@nh6z.net>");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* Copyright 2011-2019 NW Digital Radio
|
* Copyright 2011-2019 NW Digital Radio
|
||||||
*
|
*
|
||||||
* Author: Jeremy McDermond <nh6z@nh6z.net>
|
* Author: Annaliese McDermond <nh6z@nh6z.net>
|
||||||
*
|
*
|
||||||
* Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27.
|
* Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27.
|
||||||
*
|
*
|
||||||
|
@ -64,5 +64,5 @@ static struct spi_driver aic32x4_spi_driver = {
|
||||||
module_spi_driver(aic32x4_spi_driver);
|
module_spi_driver(aic32x4_spi_driver);
|
||||||
|
|
||||||
MODULE_DESCRIPTION("ASoC TLV320AIC32x4 codec driver SPI");
|
MODULE_DESCRIPTION("ASoC TLV320AIC32x4 codec driver SPI");
|
||||||
MODULE_AUTHOR("Jeremy McDermond <nh6z@nh6z.net>");
|
MODULE_AUTHOR("Annaliese McDermond <nh6z@nh6z.net>");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
|
@ -443,6 +443,8 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = {
|
||||||
SND_SOC_DAPM_INPUT("IN2_R"),
|
SND_SOC_DAPM_INPUT("IN2_R"),
|
||||||
SND_SOC_DAPM_INPUT("IN3_L"),
|
SND_SOC_DAPM_INPUT("IN3_L"),
|
||||||
SND_SOC_DAPM_INPUT("IN3_R"),
|
SND_SOC_DAPM_INPUT("IN3_R"),
|
||||||
|
SND_SOC_DAPM_INPUT("CM_L"),
|
||||||
|
SND_SOC_DAPM_INPUT("CM_R"),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = {
|
static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = {
|
||||||
|
|
|
@ -3951,7 +3951,8 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_TRIGGER_STOP:
|
case SNDRV_PCM_TRIGGER_STOP:
|
||||||
wm_adsp_buffer_clear(compr->buf);
|
if (wm_adsp_compr_attached(compr))
|
||||||
|
wm_adsp_buffer_clear(compr->buf);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
|
|
@ -445,6 +445,19 @@ struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(fsl_asrc_get_dma_channel);
|
EXPORT_SYMBOL_GPL(fsl_asrc_get_dma_channel);
|
||||||
|
|
||||||
|
static int fsl_asrc_dai_startup(struct snd_pcm_substream *substream,
|
||||||
|
struct snd_soc_dai *dai)
|
||||||
|
{
|
||||||
|
struct fsl_asrc *asrc_priv = snd_soc_dai_get_drvdata(dai);
|
||||||
|
|
||||||
|
/* Odd channel number is not valid for older ASRC (channel_bits==3) */
|
||||||
|
if (asrc_priv->channel_bits == 3)
|
||||||
|
snd_pcm_hw_constraint_step(substream->runtime, 0,
|
||||||
|
SNDRV_PCM_HW_PARAM_CHANNELS, 2);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
|
static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
|
||||||
struct snd_pcm_hw_params *params,
|
struct snd_pcm_hw_params *params,
|
||||||
struct snd_soc_dai *dai)
|
struct snd_soc_dai *dai)
|
||||||
|
@ -539,6 +552,7 @@ static int fsl_asrc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct snd_soc_dai_ops fsl_asrc_dai_ops = {
|
static const struct snd_soc_dai_ops fsl_asrc_dai_ops = {
|
||||||
|
.startup = fsl_asrc_dai_startup,
|
||||||
.hw_params = fsl_asrc_dai_hw_params,
|
.hw_params = fsl_asrc_dai_hw_params,
|
||||||
.hw_free = fsl_asrc_dai_hw_free,
|
.hw_free = fsl_asrc_dai_hw_free,
|
||||||
.trigger = fsl_asrc_dai_trigger,
|
.trigger = fsl_asrc_dai_trigger,
|
||||||
|
|
|
@ -54,6 +54,8 @@ struct fsl_esai {
|
||||||
u32 fifo_depth;
|
u32 fifo_depth;
|
||||||
u32 slot_width;
|
u32 slot_width;
|
||||||
u32 slots;
|
u32 slots;
|
||||||
|
u32 tx_mask;
|
||||||
|
u32 rx_mask;
|
||||||
u32 hck_rate[2];
|
u32 hck_rate[2];
|
||||||
u32 sck_rate[2];
|
u32 sck_rate[2];
|
||||||
bool hck_dir[2];
|
bool hck_dir[2];
|
||||||
|
@ -361,21 +363,13 @@ static int fsl_esai_set_dai_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask,
|
||||||
regmap_update_bits(esai_priv->regmap, REG_ESAI_TCCR,
|
regmap_update_bits(esai_priv->regmap, REG_ESAI_TCCR,
|
||||||
ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(slots));
|
ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(slots));
|
||||||
|
|
||||||
regmap_update_bits(esai_priv->regmap, REG_ESAI_TSMA,
|
|
||||||
ESAI_xSMA_xS_MASK, ESAI_xSMA_xS(tx_mask));
|
|
||||||
regmap_update_bits(esai_priv->regmap, REG_ESAI_TSMB,
|
|
||||||
ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(tx_mask));
|
|
||||||
|
|
||||||
regmap_update_bits(esai_priv->regmap, REG_ESAI_RCCR,
|
regmap_update_bits(esai_priv->regmap, REG_ESAI_RCCR,
|
||||||
ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(slots));
|
ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(slots));
|
||||||
|
|
||||||
regmap_update_bits(esai_priv->regmap, REG_ESAI_RSMA,
|
|
||||||
ESAI_xSMA_xS_MASK, ESAI_xSMA_xS(rx_mask));
|
|
||||||
regmap_update_bits(esai_priv->regmap, REG_ESAI_RSMB,
|
|
||||||
ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(rx_mask));
|
|
||||||
|
|
||||||
esai_priv->slot_width = slot_width;
|
esai_priv->slot_width = slot_width;
|
||||||
esai_priv->slots = slots;
|
esai_priv->slots = slots;
|
||||||
|
esai_priv->tx_mask = tx_mask;
|
||||||
|
esai_priv->rx_mask = rx_mask;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -596,6 +590,7 @@ static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd,
|
||||||
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
|
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
|
||||||
u8 i, channels = substream->runtime->channels;
|
u8 i, channels = substream->runtime->channels;
|
||||||
u32 pins = DIV_ROUND_UP(channels, esai_priv->slots);
|
u32 pins = DIV_ROUND_UP(channels, esai_priv->slots);
|
||||||
|
u32 mask;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case SNDRV_PCM_TRIGGER_START:
|
case SNDRV_PCM_TRIGGER_START:
|
||||||
|
@ -608,15 +603,38 @@ static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd,
|
||||||
for (i = 0; tx && i < channels; i++)
|
for (i = 0; tx && i < channels; i++)
|
||||||
regmap_write(esai_priv->regmap, REG_ESAI_ETDR, 0x0);
|
regmap_write(esai_priv->regmap, REG_ESAI_ETDR, 0x0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When set the TE/RE in the end of enablement flow, there
|
||||||
|
* will be channel swap issue for multi data line case.
|
||||||
|
* In order to workaround this issue, we switch the bit
|
||||||
|
* enablement sequence to below sequence
|
||||||
|
* 1) clear the xSMB & xSMA: which is done in probe and
|
||||||
|
* stop state.
|
||||||
|
* 2) set TE/RE
|
||||||
|
* 3) set xSMB
|
||||||
|
* 4) set xSMA: xSMA is the last one in this flow, which
|
||||||
|
* will trigger esai to start.
|
||||||
|
*/
|
||||||
regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx),
|
regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx),
|
||||||
tx ? ESAI_xCR_TE_MASK : ESAI_xCR_RE_MASK,
|
tx ? ESAI_xCR_TE_MASK : ESAI_xCR_RE_MASK,
|
||||||
tx ? ESAI_xCR_TE(pins) : ESAI_xCR_RE(pins));
|
tx ? ESAI_xCR_TE(pins) : ESAI_xCR_RE(pins));
|
||||||
|
mask = tx ? esai_priv->tx_mask : esai_priv->rx_mask;
|
||||||
|
|
||||||
|
regmap_update_bits(esai_priv->regmap, REG_ESAI_xSMB(tx),
|
||||||
|
ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(mask));
|
||||||
|
regmap_update_bits(esai_priv->regmap, REG_ESAI_xSMA(tx),
|
||||||
|
ESAI_xSMA_xS_MASK, ESAI_xSMA_xS(mask));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_TRIGGER_SUSPEND:
|
case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||||
case SNDRV_PCM_TRIGGER_STOP:
|
case SNDRV_PCM_TRIGGER_STOP:
|
||||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||||
regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx),
|
regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx),
|
||||||
tx ? ESAI_xCR_TE_MASK : ESAI_xCR_RE_MASK, 0);
|
tx ? ESAI_xCR_TE_MASK : ESAI_xCR_RE_MASK, 0);
|
||||||
|
regmap_update_bits(esai_priv->regmap, REG_ESAI_xSMA(tx),
|
||||||
|
ESAI_xSMA_xS_MASK, 0);
|
||||||
|
regmap_update_bits(esai_priv->regmap, REG_ESAI_xSMB(tx),
|
||||||
|
ESAI_xSMB_xS_MASK, 0);
|
||||||
|
|
||||||
/* Disable and reset FIFO */
|
/* Disable and reset FIFO */
|
||||||
regmap_update_bits(esai_priv->regmap, REG_ESAI_xFCR(tx),
|
regmap_update_bits(esai_priv->regmap, REG_ESAI_xFCR(tx),
|
||||||
|
@ -906,6 +924,15 @@ static int fsl_esai_probe(struct platform_device *pdev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esai_priv->tx_mask = 0xFFFFFFFF;
|
||||||
|
esai_priv->rx_mask = 0xFFFFFFFF;
|
||||||
|
|
||||||
|
/* Clear the TSMA, TSMB, RSMA, RSMB */
|
||||||
|
regmap_write(esai_priv->regmap, REG_ESAI_TSMA, 0);
|
||||||
|
regmap_write(esai_priv->regmap, REG_ESAI_TSMB, 0);
|
||||||
|
regmap_write(esai_priv->regmap, REG_ESAI_RSMA, 0);
|
||||||
|
regmap_write(esai_priv->regmap, REG_ESAI_RSMB, 0);
|
||||||
|
|
||||||
ret = devm_snd_soc_register_component(&pdev->dev, &fsl_esai_component,
|
ret = devm_snd_soc_register_component(&pdev->dev, &fsl_esai_component,
|
||||||
&fsl_esai_dai, 1);
|
&fsl_esai_dai, 1);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <linux/string.h>
|
#include <linux/string.h>
|
||||||
#include <sound/simple_card_utils.h>
|
#include <sound/simple_card_utils.h>
|
||||||
|
|
||||||
|
#define DPCM_SELECTABLE 1
|
||||||
|
|
||||||
#define PREFIX "audio-graph-card,"
|
#define PREFIX "audio-graph-card,"
|
||||||
|
|
||||||
static int graph_outdrv_event(struct snd_soc_dapm_widget *w,
|
static int graph_outdrv_event(struct snd_soc_dapm_widget *w,
|
||||||
|
@ -415,6 +417,7 @@ static int graph_for_each_link(struct asoc_simple_priv *priv,
|
||||||
struct device_node *codec_port;
|
struct device_node *codec_port;
|
||||||
struct device_node *codec_port_old = NULL;
|
struct device_node *codec_port_old = NULL;
|
||||||
struct asoc_simple_data adata;
|
struct asoc_simple_data adata;
|
||||||
|
uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev);
|
||||||
int rc, ret;
|
int rc, ret;
|
||||||
|
|
||||||
/* loop for all listed CPU port */
|
/* loop for all listed CPU port */
|
||||||
|
@ -445,8 +448,9 @@ static int graph_for_each_link(struct asoc_simple_priv *priv,
|
||||||
* if Codec port has many endpoints,
|
* if Codec port has many endpoints,
|
||||||
* or has convert-xxx property
|
* or has convert-xxx property
|
||||||
*/
|
*/
|
||||||
if ((of_get_child_count(codec_port) > 1) ||
|
if (dpcm_selectable &&
|
||||||
adata.convert_rate || adata.convert_channels)
|
((of_get_child_count(codec_port) > 1) ||
|
||||||
|
adata.convert_rate || adata.convert_channels))
|
||||||
ret = func_dpcm(priv, cpu_ep, codec_ep, li,
|
ret = func_dpcm(priv, cpu_ep, codec_ep, li,
|
||||||
(codec_port_old == codec_port));
|
(codec_port_old == codec_port));
|
||||||
/* else normal sound */
|
/* else normal sound */
|
||||||
|
@ -679,7 +683,8 @@ static int graph_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
static const struct of_device_id graph_of_match[] = {
|
static const struct of_device_id graph_of_match[] = {
|
||||||
{ .compatible = "audio-graph-card", },
|
{ .compatible = "audio-graph-card", },
|
||||||
{ .compatible = "audio-graph-scu-card", },
|
{ .compatible = "audio-graph-scu-card",
|
||||||
|
.data = (void *)DPCM_SELECTABLE },
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, graph_of_match);
|
MODULE_DEVICE_TABLE(of, graph_of_match);
|
||||||
|
|
|
@ -9,12 +9,15 @@
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
|
#include <linux/of_device.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/string.h>
|
#include <linux/string.h>
|
||||||
#include <sound/simple_card.h>
|
#include <sound/simple_card.h>
|
||||||
#include <sound/soc-dai.h>
|
#include <sound/soc-dai.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
|
|
||||||
|
#define DPCM_SELECTABLE 1
|
||||||
|
|
||||||
#define DAI "sound-dai"
|
#define DAI "sound-dai"
|
||||||
#define CELL "#sound-dai-cells"
|
#define CELL "#sound-dai-cells"
|
||||||
#define PREFIX "simple-audio-card,"
|
#define PREFIX "simple-audio-card,"
|
||||||
|
@ -349,6 +352,7 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
|
||||||
struct device *dev = simple_priv_to_dev(priv);
|
struct device *dev = simple_priv_to_dev(priv);
|
||||||
struct device_node *top = dev->of_node;
|
struct device_node *top = dev->of_node;
|
||||||
struct device_node *node;
|
struct device_node *node;
|
||||||
|
uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev);
|
||||||
bool is_top = 0;
|
bool is_top = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
@ -388,8 +392,9 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
|
||||||
* if it has many CPUs,
|
* if it has many CPUs,
|
||||||
* or has convert-xxx property
|
* or has convert-xxx property
|
||||||
*/
|
*/
|
||||||
if (num > 2 ||
|
if (dpcm_selectable &&
|
||||||
adata.convert_rate || adata.convert_channels)
|
(num > 2 ||
|
||||||
|
adata.convert_rate || adata.convert_channels))
|
||||||
ret = func_dpcm(priv, np, codec, li, is_top);
|
ret = func_dpcm(priv, np, codec, li, is_top);
|
||||||
/* else normal sound */
|
/* else normal sound */
|
||||||
else
|
else
|
||||||
|
@ -705,7 +710,8 @@ static int simple_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
static const struct of_device_id simple_of_match[] = {
|
static const struct of_device_id simple_of_match[] = {
|
||||||
{ .compatible = "simple-audio-card", },
|
{ .compatible = "simple-audio-card", },
|
||||||
{ .compatible = "simple-scu-audio-card", },
|
{ .compatible = "simple-scu-audio-card",
|
||||||
|
.data = (void *)DPCM_SELECTABLE },
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, simple_of_match);
|
MODULE_DEVICE_TABLE(of, simple_of_match);
|
||||||
|
|
|
@ -706,9 +706,17 @@ static int sst_soc_probe(struct snd_soc_component *component)
|
||||||
return sst_dsp_init_v2_dpcm(component);
|
return sst_dsp_init_v2_dpcm(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sst_soc_remove(struct snd_soc_component *component)
|
||||||
|
{
|
||||||
|
struct sst_data *drv = dev_get_drvdata(component->dev);
|
||||||
|
|
||||||
|
drv->soc_card = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct snd_soc_component_driver sst_soc_platform_drv = {
|
static const struct snd_soc_component_driver sst_soc_platform_drv = {
|
||||||
.name = DRV_NAME,
|
.name = DRV_NAME,
|
||||||
.probe = sst_soc_probe,
|
.probe = sst_soc_probe,
|
||||||
|
.remove = sst_soc_remove,
|
||||||
.ops = &sst_platform_ops,
|
.ops = &sst_platform_ops,
|
||||||
.compr_ops = &sst_platform_compr_ops,
|
.compr_ops = &sst_platform_compr_ops,
|
||||||
.pcm_new = sst_pcm_new,
|
.pcm_new = sst_pcm_new,
|
||||||
|
|
|
@ -43,6 +43,7 @@ struct cht_mc_private {
|
||||||
struct clk *mclk;
|
struct clk *mclk;
|
||||||
struct snd_soc_jack jack;
|
struct snd_soc_jack jack;
|
||||||
bool ts3a227e_present;
|
bool ts3a227e_present;
|
||||||
|
int quirks;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int platform_clock_control(struct snd_soc_dapm_widget *w,
|
static int platform_clock_control(struct snd_soc_dapm_widget *w,
|
||||||
|
@ -54,6 +55,10 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
|
||||||
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
|
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/* See the comment in snd_cht_mc_probe() */
|
||||||
|
if (ctx->quirks & QUIRK_PMC_PLT_CLK_0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
codec_dai = snd_soc_card_get_codec_dai(card, CHT_CODEC_DAI);
|
codec_dai = snd_soc_card_get_codec_dai(card, CHT_CODEC_DAI);
|
||||||
if (!codec_dai) {
|
if (!codec_dai) {
|
||||||
dev_err(card->dev, "Codec dai not found; Unable to set platform clock\n");
|
dev_err(card->dev, "Codec dai not found; Unable to set platform clock\n");
|
||||||
|
@ -223,6 +228,10 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
|
||||||
"jack detection gpios not added, error %d\n", ret);
|
"jack detection gpios not added, error %d\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See the comment in snd_cht_mc_probe() */
|
||||||
|
if (ctx->quirks & QUIRK_PMC_PLT_CLK_0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The firmware might enable the clock at
|
* The firmware might enable the clock at
|
||||||
* boot (this information may or may not
|
* boot (this information may or may not
|
||||||
|
@ -423,16 +432,15 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
|
||||||
const char *mclk_name;
|
const char *mclk_name;
|
||||||
struct snd_soc_acpi_mach *mach;
|
struct snd_soc_acpi_mach *mach;
|
||||||
const char *platform_name;
|
const char *platform_name;
|
||||||
int quirks = 0;
|
|
||||||
|
|
||||||
dmi_id = dmi_first_match(cht_max98090_quirk_table);
|
|
||||||
if (dmi_id)
|
|
||||||
quirks = (unsigned long)dmi_id->driver_data;
|
|
||||||
|
|
||||||
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
|
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
|
||||||
if (!drv)
|
if (!drv)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
dmi_id = dmi_first_match(cht_max98090_quirk_table);
|
||||||
|
if (dmi_id)
|
||||||
|
drv->quirks = (unsigned long)dmi_id->driver_data;
|
||||||
|
|
||||||
drv->ts3a227e_present = acpi_dev_found("104C227E");
|
drv->ts3a227e_present = acpi_dev_found("104C227E");
|
||||||
if (!drv->ts3a227e_present) {
|
if (!drv->ts3a227e_present) {
|
||||||
/* no need probe TI jack detection chip */
|
/* no need probe TI jack detection chip */
|
||||||
|
@ -458,7 +466,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
|
||||||
snd_soc_card_cht.dev = &pdev->dev;
|
snd_soc_card_cht.dev = &pdev->dev;
|
||||||
snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
|
snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
|
||||||
|
|
||||||
if (quirks & QUIRK_PMC_PLT_CLK_0)
|
if (drv->quirks & QUIRK_PMC_PLT_CLK_0)
|
||||||
mclk_name = "pmc_plt_clk_0";
|
mclk_name = "pmc_plt_clk_0";
|
||||||
else
|
else
|
||||||
mclk_name = "pmc_plt_clk_3";
|
mclk_name = "pmc_plt_clk_3";
|
||||||
|
@ -471,6 +479,21 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
|
||||||
return PTR_ERR(drv->mclk);
|
return PTR_ERR(drv->mclk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Boards which have the MAX98090's clk connected to clk_0 do not seem
|
||||||
|
* to like it if we muck with the clock. If we disable the clock when
|
||||||
|
* it is unused we get "max98090 i2c-193C9890:00: PLL unlocked" errors
|
||||||
|
* and the PLL never seems to lock again.
|
||||||
|
* So for these boards we enable it here once and leave it at that.
|
||||||
|
*/
|
||||||
|
if (drv->quirks & QUIRK_PMC_PLT_CLK_0) {
|
||||||
|
ret_val = clk_prepare_enable(drv->mclk);
|
||||||
|
if (ret_val < 0) {
|
||||||
|
dev_err(&pdev->dev, "MCLK enable error: %d\n", ret_val);
|
||||||
|
return ret_val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
|
ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
|
||||||
if (ret_val) {
|
if (ret_val) {
|
||||||
dev_err(&pdev->dev,
|
dev_err(&pdev->dev,
|
||||||
|
@ -481,11 +504,23 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int snd_cht_mc_remove(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct snd_soc_card *card = platform_get_drvdata(pdev);
|
||||||
|
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
|
||||||
|
|
||||||
|
if (ctx->quirks & QUIRK_PMC_PLT_CLK_0)
|
||||||
|
clk_disable_unprepare(ctx->mclk);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static struct platform_driver snd_cht_mc_driver = {
|
static struct platform_driver snd_cht_mc_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "cht-bsw-max98090",
|
.name = "cht-bsw-max98090",
|
||||||
},
|
},
|
||||||
.probe = snd_cht_mc_probe,
|
.probe = snd_cht_mc_probe,
|
||||||
|
.remove = snd_cht_mc_remove,
|
||||||
};
|
};
|
||||||
|
|
||||||
module_platform_driver(snd_cht_mc_driver)
|
module_platform_driver(snd_cht_mc_driver)
|
||||||
|
|
|
@ -483,6 +483,7 @@ static void skl_set_base_module_format(struct skl_sst *ctx,
|
||||||
base_cfg->audio_fmt.bit_depth = format->bit_depth;
|
base_cfg->audio_fmt.bit_depth = format->bit_depth;
|
||||||
base_cfg->audio_fmt.valid_bit_depth = format->valid_bit_depth;
|
base_cfg->audio_fmt.valid_bit_depth = format->valid_bit_depth;
|
||||||
base_cfg->audio_fmt.ch_cfg = format->ch_cfg;
|
base_cfg->audio_fmt.ch_cfg = format->ch_cfg;
|
||||||
|
base_cfg->audio_fmt.sample_type = format->sample_type;
|
||||||
|
|
||||||
dev_dbg(ctx->dev, "bit_depth=%x valid_bd=%x ch_config=%x\n",
|
dev_dbg(ctx->dev, "bit_depth=%x valid_bd=%x ch_config=%x\n",
|
||||||
format->bit_depth, format->valid_bit_depth,
|
format->bit_depth, format->valid_bit_depth,
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include "rockchip_pdm.h"
|
#include "rockchip_pdm.h"
|
||||||
|
|
||||||
#define PDM_DMA_BURST_SIZE (16) /* size * width: 16*4 = 64 bytes */
|
#define PDM_DMA_BURST_SIZE (8) /* size * width: 8*4 = 32 bytes */
|
||||||
|
|
||||||
struct rk_pdm_dev {
|
struct rk_pdm_dev {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
@ -206,7 +206,9 @@ static int rockchip_pdm_set_fmt(struct snd_soc_dai *cpu_dai,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pm_runtime_get_sync(cpu_dai->dev);
|
||||||
regmap_update_bits(pdm->regmap, PDM_CLK_CTRL, mask, val);
|
regmap_update_bits(pdm->regmap, PDM_CLK_CTRL, mask, val);
|
||||||
|
pm_runtime_put(cpu_dai->dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3650,6 +3650,13 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm,
|
||||||
case snd_soc_dapm_dac:
|
case snd_soc_dapm_dac:
|
||||||
case snd_soc_dapm_aif_in:
|
case snd_soc_dapm_aif_in:
|
||||||
case snd_soc_dapm_pga:
|
case snd_soc_dapm_pga:
|
||||||
|
case snd_soc_dapm_buffer:
|
||||||
|
case snd_soc_dapm_scheduler:
|
||||||
|
case snd_soc_dapm_effect:
|
||||||
|
case snd_soc_dapm_src:
|
||||||
|
case snd_soc_dapm_asrc:
|
||||||
|
case snd_soc_dapm_encoder:
|
||||||
|
case snd_soc_dapm_decoder:
|
||||||
case snd_soc_dapm_out_drv:
|
case snd_soc_dapm_out_drv:
|
||||||
case snd_soc_dapm_micbias:
|
case snd_soc_dapm_micbias:
|
||||||
case snd_soc_dapm_line:
|
case snd_soc_dapm_line:
|
||||||
|
@ -3957,6 +3964,10 @@ snd_soc_dapm_free_kcontrol(struct snd_soc_card *card,
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
devm_kfree(card->dev, (void *)*private_value);
|
devm_kfree(card->dev, (void *)*private_value);
|
||||||
|
|
||||||
|
if (!w_param_text)
|
||||||
|
return;
|
||||||
|
|
||||||
for (count = 0 ; count < num_params; count++)
|
for (count = 0 ; count < num_params; count++)
|
||||||
devm_kfree(card->dev, (void *)w_param_text[count]);
|
devm_kfree(card->dev, (void *)w_param_text[count]);
|
||||||
devm_kfree(card->dev, w_param_text);
|
devm_kfree(card->dev, w_param_text);
|
||||||
|
|
|
@ -1911,10 +1911,15 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream,
|
||||||
struct snd_soc_pcm_runtime *be = dpcm->be;
|
struct snd_soc_pcm_runtime *be = dpcm->be;
|
||||||
struct snd_pcm_substream *be_substream =
|
struct snd_pcm_substream *be_substream =
|
||||||
snd_soc_dpcm_get_substream(be, stream);
|
snd_soc_dpcm_get_substream(be, stream);
|
||||||
struct snd_soc_pcm_runtime *rtd = be_substream->private_data;
|
struct snd_soc_pcm_runtime *rtd;
|
||||||
struct snd_soc_dai *codec_dai;
|
struct snd_soc_dai *codec_dai;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* A backend may not have the requested substream */
|
||||||
|
if (!be_substream)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
rtd = be_substream->private_data;
|
||||||
if (rtd->dai_link->be_hw_params_fixup)
|
if (rtd->dai_link->be_hw_params_fixup)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
|
||||||
|
@ -37,6 +38,8 @@ struct stm32_adfsdm_priv {
|
||||||
/* PCM buffer */
|
/* PCM buffer */
|
||||||
unsigned char *pcm_buff;
|
unsigned char *pcm_buff;
|
||||||
unsigned int pos;
|
unsigned int pos;
|
||||||
|
|
||||||
|
struct mutex lock; /* protect against race condition on iio state */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct snd_pcm_hardware stm32_adfsdm_pcm_hw = {
|
static const struct snd_pcm_hardware stm32_adfsdm_pcm_hw = {
|
||||||
|
@ -62,10 +65,12 @@ static void stm32_adfsdm_shutdown(struct snd_pcm_substream *substream,
|
||||||
{
|
{
|
||||||
struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai);
|
struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai);
|
||||||
|
|
||||||
|
mutex_lock(&priv->lock);
|
||||||
if (priv->iio_active) {
|
if (priv->iio_active) {
|
||||||
iio_channel_stop_all_cb(priv->iio_cb);
|
iio_channel_stop_all_cb(priv->iio_cb);
|
||||||
priv->iio_active = false;
|
priv->iio_active = false;
|
||||||
}
|
}
|
||||||
|
mutex_unlock(&priv->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream,
|
static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream,
|
||||||
|
@ -74,13 +79,19 @@ static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream,
|
||||||
struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai);
|
struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
mutex_lock(&priv->lock);
|
||||||
|
if (priv->iio_active) {
|
||||||
|
iio_channel_stop_all_cb(priv->iio_cb);
|
||||||
|
priv->iio_active = false;
|
||||||
|
}
|
||||||
|
|
||||||
ret = iio_write_channel_attribute(priv->iio_ch,
|
ret = iio_write_channel_attribute(priv->iio_ch,
|
||||||
substream->runtime->rate, 0,
|
substream->runtime->rate, 0,
|
||||||
IIO_CHAN_INFO_SAMP_FREQ);
|
IIO_CHAN_INFO_SAMP_FREQ);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(dai->dev, "%s: Failed to set %d sampling rate\n",
|
dev_err(dai->dev, "%s: Failed to set %d sampling rate\n",
|
||||||
__func__, substream->runtime->rate);
|
__func__, substream->runtime->rate);
|
||||||
return ret;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!priv->iio_active) {
|
if (!priv->iio_active) {
|
||||||
|
@ -92,6 +103,9 @@ static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream,
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
mutex_unlock(&priv->lock);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,6 +305,7 @@ MODULE_DEVICE_TABLE(of, stm32_adfsdm_of_match);
|
||||||
static int stm32_adfsdm_probe(struct platform_device *pdev)
|
static int stm32_adfsdm_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct stm32_adfsdm_priv *priv;
|
struct stm32_adfsdm_priv *priv;
|
||||||
|
struct snd_soc_component *component;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||||
|
@ -299,6 +314,7 @@ static int stm32_adfsdm_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
priv->dev = &pdev->dev;
|
priv->dev = &pdev->dev;
|
||||||
priv->dai_drv = stm32_adfsdm_dai;
|
priv->dai_drv = stm32_adfsdm_dai;
|
||||||
|
mutex_init(&priv->lock);
|
||||||
|
|
||||||
dev_set_drvdata(&pdev->dev, priv);
|
dev_set_drvdata(&pdev->dev, priv);
|
||||||
|
|
||||||
|
@ -317,9 +333,15 @@ static int stm32_adfsdm_probe(struct platform_device *pdev)
|
||||||
if (IS_ERR(priv->iio_cb))
|
if (IS_ERR(priv->iio_cb))
|
||||||
return PTR_ERR(priv->iio_cb);
|
return PTR_ERR(priv->iio_cb);
|
||||||
|
|
||||||
ret = devm_snd_soc_register_component(&pdev->dev,
|
component = devm_kzalloc(&pdev->dev, sizeof(*component), GFP_KERNEL);
|
||||||
&stm32_adfsdm_soc_platform,
|
if (!component)
|
||||||
NULL, 0);
|
return -ENOMEM;
|
||||||
|
#ifdef CONFIG_DEBUG_FS
|
||||||
|
component->debugfs_prefix = "pcm";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ret = snd_soc_add_component(&pdev->dev, component,
|
||||||
|
&stm32_adfsdm_soc_platform, NULL, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
dev_err(&pdev->dev, "%s: Failed to register PCM platform\n",
|
dev_err(&pdev->dev, "%s: Failed to register PCM platform\n",
|
||||||
__func__);
|
__func__);
|
||||||
|
@ -327,12 +349,20 @@ static int stm32_adfsdm_probe(struct platform_device *pdev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int stm32_adfsdm_remove(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
snd_soc_unregister_component(&pdev->dev);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static struct platform_driver stm32_adfsdm_driver = {
|
static struct platform_driver stm32_adfsdm_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = STM32_ADFSDM_DRV_NAME,
|
.name = STM32_ADFSDM_DRV_NAME,
|
||||||
.of_match_table = stm32_adfsdm_of_match,
|
.of_match_table = stm32_adfsdm_of_match,
|
||||||
},
|
},
|
||||||
.probe = stm32_adfsdm_probe,
|
.probe = stm32_adfsdm_probe,
|
||||||
|
.remove = stm32_adfsdm_remove,
|
||||||
};
|
};
|
||||||
|
|
||||||
module_platform_driver(stm32_adfsdm_driver);
|
module_platform_driver(stm32_adfsdm_driver);
|
||||||
|
|
Loading…
Reference in New Issue