Linux_SDK_V1.5.4

Signed-off-by: thead_admin <occ_thead@service.alibaba.com>
This commit is contained in:
thead_admin
2024-04-26 03:07:38 +00:00
committed by Han Gao
parent 89d6663712
commit 7563179071
105 changed files with 3730 additions and 1716 deletions

View File

@@ -1642,6 +1642,71 @@ static int es7210_i2c_probe(struct i2c_client *i2c_client,
return -ENOMEM;
es7210->i2c_client = i2c_client;
es7210->tdm_mode = ES7210_WORK_MODE; //to set tdm mode or normal mode
property = of_get_property(np, "work-mode", NULL);
if (property) {
if (!strcmp(property, "ES7210_TDM_1LRCK_DSPB")) {
es7210->tdm_mode = ES7210_TDM_1LRCK_DSPB;
} else if (!strcmp(property, "ES7210_NORMAL_I2S")) {
es7210->tdm_mode = ES7210_NORMAL_I2S;
} else {
pr_err("unsupported work mode\n");
return -EINVAL;
}
} else {
pr_warn("es7210 work-mode not defined.using ES7210_NORMAL_I2S by default\n");
es7210->tdm_mode = ES7210_NORMAL_I2S;
}
if (of_property_read_u32(np, "channels-max", &ES7210_CHANNELS_MAX) == 0) {
if (ES7210_CHANNELS_MAX == MIC_CHN_2 || ES7210_CHANNELS_MAX == MIC_CHN_4) {
ADC_DEV_MAXNUM = 1;
} else if (ES7210_CHANNELS_MAX == MIC_CHN_6 || ES7210_CHANNELS_MAX == MIC_CHN_8) {
ADC_DEV_MAXNUM = 2;
} else if (ES7210_CHANNELS_MAX == MIC_CHN_10 || ES7210_CHANNELS_MAX == MIC_CHN_12) {
ADC_DEV_MAXNUM = 3;
} else if (ES7210_CHANNELS_MAX == MIC_CHN_14 || ES7210_CHANNELS_MAX == MIC_CHN_16) {
ADC_DEV_MAXNUM = 4;
} else {
pr_err("es7210 unsupported channels-max\n");
return -EINVAL;
}
} else {
pr_warn("es7210 channels-max not defined.using MIC_CHN_2 by default\n");
ES7210_CHANNELS_MAX = MIC_CHN_2;
ADC_DEV_MAXNUM = 1;
}
pr_debug("%s es7210->tdm_mode=%d channels-max=%d ADC_DEV_MAXNUM=%d\n", __func__, es7210->tdm_mode, ES7210_CHANNELS_MAX, ADC_DEV_MAXNUM);
es7210->mvdd = devm_regulator_get(&i2c_client->dev, "MVDD");
if (IS_ERR(es7210->mvdd)) {
ret = PTR_ERR(es7210->mvdd);
dev_warn(&i2c_client->dev, "Failed to get MVDD regulator: %d\n", ret);
es7210->mvdd = NULL;
}
es7210->avdd = devm_regulator_get(&i2c_client->dev, "AVDD");
if (IS_ERR(es7210->avdd)) {
ret = PTR_ERR(es7210->avdd);
dev_warn(&i2c_client->dev, "Failed to get AVDD regulator: %d\n", ret);
es7210->avdd = NULL;
}
es7210->dvdd = devm_regulator_get(&i2c_client->dev, "DVDD");
if (IS_ERR(es7210->dvdd)) {
ret = PTR_ERR(es7210->dvdd);
dev_warn(&i2c_client->dev, "Failed to get DVDD regulator: %d\n", ret);
es7210->dvdd = NULL;
}
es7210->pvdd = devm_regulator_get(&i2c_client->dev, "PVDD");
if (IS_ERR(es7210->pvdd)) {
ret = PTR_ERR(es7210->pvdd);
dev_warn(&i2c_client->dev, "Failed to get PVDD regulator: %d\n", ret);
es7210->pvdd = NULL;
}
if (of_property_read_u32(np, "mclk-sclk-ratio", &es7210->mclk_sclk_ratio) != 0) {
es7210->mclk_sclk_ratio = 1;
}
i2c_set_clientdata(i2c_client, es7210);
if (i2c_id->driver_data < ADC_DEV_MAXNUM) {
i2c_clt1[i2c_id->driver_data] = i2c_client;

View File

@@ -478,6 +478,10 @@ static struct snd_soc_dai_driver es8156_dai = {
static int es8156_suspend(struct snd_soc_component *codec)
{
struct es8156_priv *priv = snd_soc_component_get_drvdata(codec);
pr_debug("Entered: %s\n", __func__);
es8156_set_bias_level(codec, SND_SOC_BIAS_OFF);
printk("es8156_suspend\n");
return 0;
@@ -485,6 +489,42 @@ static int es8156_suspend(struct snd_soc_component *codec)
static int es8156_resume(struct snd_soc_component *codec)
{
struct es8156_priv *priv = snd_soc_component_get_drvdata(codec);
pr_debug("Entered: %s\n", __func__);
snd_soc_component_write(codec, ES8156_RESET_REG00, priv->suspend_reg_00);
snd_soc_component_write(codec, ES8156_MAINCLOCK_CTL_REG01, priv->suspend_reg_01);
snd_soc_component_write(codec, ES8156_SCLK_MODE_REG02, priv->suspend_reg_02);
snd_soc_component_write(codec, ES8156_LRCLK_DIV_H_REG03, priv->suspend_reg_03);
snd_soc_component_write(codec, ES8156_LRCLK_DIV_L_REG04, priv->suspend_reg_04);
snd_soc_component_write(codec, ES8156_SCLK_DIV_REG05, priv->suspend_reg_05);
snd_soc_component_write(codec, ES8156_NFS_CONFIG_REG06, priv->suspend_reg_06);
snd_soc_component_write(codec, ES8156_MISC_CONTROL1_REG07, priv->suspend_reg_07);
snd_soc_component_write(codec, ES8156_CLOCK_ON_OFF_REG08, priv->suspend_reg_08);
snd_soc_component_write(codec, ES8156_MISC_CONTROL2_REG09, priv->suspend_reg_09);
snd_soc_component_write(codec, ES8156_TIME_CONTROL1_REG0A, priv->suspend_reg_0A);
snd_soc_component_write(codec, ES8156_TIME_CONTROL2_REG0B, priv->suspend_reg_0B);
snd_soc_component_write(codec, ES8156_CHIP_STATUS_REG0C, priv->suspend_reg_0C);
snd_soc_component_write(codec, ES8156_P2S_CONTROL_REG0D, priv->suspend_reg_0D);
snd_soc_component_write(codec, ES8156_DAC_OSR_COUNTER_REG10, priv->suspend_reg_10);
snd_soc_component_write(codec, ES8156_DAC_SDP_REG11, priv->suspend_reg_11);
snd_soc_component_write(codec, ES8156_AUTOMUTE_SET_REG12, priv->suspend_reg_12);
snd_soc_component_write(codec, ES8156_DAC_MUTE_REG13, priv->suspend_reg_13);
snd_soc_component_write(codec, ES8156_VOLUME_CONTROL_REG14, priv->suspend_reg_14);
snd_soc_component_write(codec, ES8156_ALC_CONFIG1_REG15, priv->suspend_reg_15);
snd_soc_component_write(codec, ES8156_ALC_CONFIG2_REG16, priv->suspend_reg_16);
snd_soc_component_write(codec, ES8156_ALC_CONFIG3_REG17, priv->suspend_reg_17);
snd_soc_component_write(codec, ES8156_MISC_CONTROL3_REG18, priv->suspend_reg_18);
snd_soc_component_write(codec, ES8156_EQ_CONTROL1_REG19, priv->suspend_reg_19);
snd_soc_component_write(codec, ES8156_EQ_CONTROL2_REG1A, priv->suspend_reg_1A);
snd_soc_component_write(codec, ES8156_ANALOG_SYS1_REG20, priv->suspend_reg_20);
snd_soc_component_write(codec, ES8156_ANALOG_SYS2_REG21, priv->suspend_reg_21);
snd_soc_component_write(codec, ES8156_ANALOG_SYS3_REG22, priv->suspend_reg_22);
snd_soc_component_write(codec, ES8156_ANALOG_SYS4_REG23, priv->suspend_reg_23);
snd_soc_component_write(codec, ES8156_ANALOG_LP_REG24, priv->suspend_reg_24);
snd_soc_component_write(codec, ES8156_ANALOG_SYS5_REG25, priv->suspend_reg_25);
return 0;
}
@@ -594,6 +634,34 @@ static struct snd_soc_component_driver soc_codec_dev_es8156 = {
.num_dapm_routes = ARRAY_SIZE(es8156_dapm_routes),
};
static ssize_t es8156_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
return 0;
}
static ssize_t es8156_show(struct device *dev, struct device_attribute *attr, char *buf)
{
int i;
for (i = 0; i < 0x26; i++) {
printk("reg 0x%x = 0x%x\n", i, snd_soc_component_read(es8156_codec, i));
}
return 0;
}
static DEVICE_ATTR(registers, 0644, es8156_show, es8156_store);
static struct attribute *es8156_debug_attrs[] = {
&dev_attr_registers.attr,
NULL,
};
static struct attribute_group es8516_debug_attr_group = {
.name = "es8156_debug",
.attrs = es8156_debug_attrs,
};
/*
*es8156 7bit i2c address:CE pin:0 0x08 / CE pin:1 0x09
*/
@@ -678,6 +746,11 @@ static int es8156_i2c_probe(struct i2c_client *i2c,
&soc_codec_dev_es8156,
&es8156_dai, 1);
ret = sysfs_create_group(&i2c->dev.kobj, &es8516_debug_attr_group);
if (ret) {
pr_err("failed to create attr group\n");
}
return ret;
}

View File

@@ -149,24 +149,52 @@ dmaengine_pcm_set_runtime_hwparams(struct snd_soc_component *component,
return snd_soc_set_runtime_hwparams(substream, &hw);
}
static int dmaengine_pcm_request_single_chan_of(struct dmaengine_pcm *pcm,
struct device *dev, const struct snd_dmaengine_pcm_config *config, unsigned int dir);
static int dmaengine_pcm_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
struct dma_chan *chan = pcm->chan[substream->stream];
struct device *dev = component->dev;
const struct snd_dmaengine_pcm_config *config = pcm->config;
int ret;
size_t prealloc_buffer_size;
size_t max_buffer_size;
unsigned int i;
ret = dmaengine_pcm_request_single_chan_of(pcm, dev, config, substream->stream);
if (ret)
return ret;
if (config && config->prealloc_buffer_size) {
prealloc_buffer_size = config->prealloc_buffer_size;
max_buffer_size = config->pcm_hardware->buffer_bytes_max;
} else {
prealloc_buffer_size = 512 * 1024;
max_buffer_size = SIZE_MAX;
}
snd_pcm_set_managed_buffer(substream,
SNDRV_DMA_TYPE_DEV_IRAM,
dmaengine_dma_dev(pcm, substream),
prealloc_buffer_size,
max_buffer_size);
ret = dmaengine_pcm_set_runtime_hwparams(component, substream);
if (ret)
return ret;
return snd_dmaengine_pcm_open(substream, chan);
return snd_dmaengine_pcm_open(substream, pcm->chan[substream->stream]);
}
static void dmaengine_pcm_release_single_chan(struct dmaengine_pcm *pcm, unsigned int dir);
static int dmaengine_pcm_close(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
dmaengine_pcm_release_single_chan(pcm, substream->stream);
return snd_dmaengine_pcm_close(substream);
}
@@ -248,29 +276,29 @@ static int dmaengine_pcm_new(struct snd_soc_component *component,
if (!substream)
continue;
if (!pcm->chan[i] && config && config->chan_names[i])
pcm->chan[i] = dma_request_slave_channel(dev,
config->chan_names[i]);
//if (!pcm->chan[i] && config && config->chan_names[i]) {
// pcm->chan[i] = dma_request_slave_channel(dev,
// config->chan_names[i]);
//}
//if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) {
// pcm->chan[i] = dmaengine_pcm_compat_request_channel(
// component, rtd, substream);
//}
if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) {
pcm->chan[i] = dmaengine_pcm_compat_request_channel(
component, rtd, substream);
}
//if (!pcm->chan[i]) {
// dev_err(component->dev,
// "Missing dma channel for stream: %d\n", i);
// return -EINVAL;
//}
if (!pcm->chan[i]) {
dev_err(component->dev,
"Missing dma channel for stream: %d\n", i);
return -EINVAL;
}
//snd_pcm_set_managed_buffer(substream,
// SNDRV_DMA_TYPE_DEV_IRAM,
// dev,
// prealloc_buffer_size,
// max_buffer_size);
snd_pcm_set_managed_buffer(substream,
SNDRV_DMA_TYPE_DEV_IRAM,
dmaengine_dma_dev(pcm, substream),
prealloc_buffer_size,
max_buffer_size);
if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i]))
pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE;
//if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i]))
// pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE;
if (rtd->pcm->streams[i].pcm->name[0] == '\0') {
strscpy_pad(rtd->pcm->streams[i].pcm->name,
@@ -354,6 +382,48 @@ static const char * const dmaengine_pcm_dma_channel_names[] = {
[SNDRV_PCM_STREAM_CAPTURE] = "rx",
};
static int dmaengine_pcm_request_single_chan_of(struct dmaengine_pcm *pcm,
struct device *dev, const struct snd_dmaengine_pcm_config *config, unsigned int dir)
{
const char *name;
struct dma_chan *chan;
if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_DT) || (!dev->of_node &&
!(config && config->dma_dev && config->dma_dev->of_node)))
return 0;
if (config && config->dma_dev) {
/*
* If this warning is seen, it probably means that your Linux
* device structure does not match your HW device structure.
* It would be best to refactor the Linux device structure to
* correctly match the HW structure.
*/
dev_warn(dev, "DMA channels sourced from device %s",
dev_name(config->dma_dev));
dev = config->dma_dev;
}
name = dmaengine_pcm_dma_channel_names[dir];
if (config && config->chan_names[dir])
name = config->chan_names[dir];
chan = dma_request_chan(dev, name);
if (IS_ERR(chan)) {
/*
* Only report probe deferral errors, channels
* might not be present for devices that
* support only TX or only RX.
*/
if (PTR_ERR(chan) == -EPROBE_DEFER)
return -EPROBE_DEFER;
pcm->chan[dir] = NULL;
} else {
pcm->chan[dir] = chan;
}
return 0;
}
static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm,
struct device *dev, const struct snd_dmaengine_pcm_config *config)
{
@@ -407,6 +477,14 @@ static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm,
return 0;
}
static void dmaengine_pcm_release_single_chan(struct dmaengine_pcm *pcm, unsigned int dir)
{
if (!pcm->chan[dir])
return;
dma_release_channel(pcm->chan[dir]);
return;
}
static void dmaengine_pcm_release_chan(struct dmaengine_pcm *pcm)
{
unsigned int i;
@@ -443,9 +521,9 @@ int snd_dmaengine_pcm_register(struct device *dev,
pcm->config = config;
pcm->flags = flags;
ret = dmaengine_pcm_request_chan_of(pcm, dev, config);
if (ret)
goto err_free_dma;
//ret = dmaengine_pcm_request_chan_of(pcm, dev, config);
//if (ret)
// goto err_free_dma;
if (config && config->process)
driver = &dmaengine_pcm_component_process;
@@ -463,7 +541,7 @@ int snd_dmaengine_pcm_register(struct device *dev,
return 0;
err_free_dma:
dmaengine_pcm_release_chan(pcm);
//dmaengine_pcm_release_chan(pcm);
kfree(pcm);
return ret;
}
@@ -488,7 +566,7 @@ void snd_dmaengine_pcm_unregister(struct device *dev)
pcm = soc_component_to_pcm(component);
snd_soc_unregister_component_by_driver(dev, component->driver);
dmaengine_pcm_release_chan(pcm);
//dmaengine_pcm_release_chan(pcm);
kfree(pcm);
}
EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_unregister);

View File

@@ -680,7 +680,7 @@ static int light_audio_i2s_8ch_probe(struct platform_device *pdev)
if (!strcmp(sprop, "i2s-master"))
priv->dai_fmt = SND_SOC_DAIFMT_I2S;
else
printk("mode is not i2s-master");
pr_err("mode is not i2s-master");
}
sprop = of_get_property(np, "light,sel", NULL);
@@ -699,12 +699,10 @@ static int light_audio_i2s_8ch_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if(i2s_8ch_probe_flag) {
printk("i2s_8ch already probe\n");
priv->regs = NULL;
priv->regmap = NULL;
priv->audio_cpr_regmap = NULL;
} else {
printk("i2s_8ch probing\n");
i2s_8ch_probe_flag = 1;
host_priv = priv;

View File

@@ -119,7 +119,8 @@ static inline void light_snd_txctrl(struct light_i2s_priv *chip, bool on)
{
u32 dma_en = 0;
u32 i2s_en = 0;
u32 i2s_imr = 0;
u32 i2s_status = 0;
unsigned long flags;
/* get current dma status, save rx configuration */
dma_en = readl(chip->regs + I2S_DMACR);
@@ -130,12 +131,12 @@ static inline void light_snd_txctrl(struct light_i2s_priv *chip, bool on)
writel(i2s_en, chip->regs + I2S_IISEN);
} else {
dma_en &= ~DMACR_TDMAE_EN;
i2s_imr = readl(chip->regs + I2S_IMR);
i2s_imr &= ~(IMR_TXUIRM_INTR_MSK);
i2s_imr &= ~(IMR_TXEIM_INTR_MSK);
writel(i2s_imr, chip->regs + I2S_IMR);
local_irq_save(flags);
do {
i2s_status = readl(chip->regs + I2S_SR);
} while ((i2s_status & SR_TXBUSY_STATUS) || !(i2s_status & SR_TFNF_TX_FIFO_NOT_FULL));
writel(dma_en, chip->regs + I2S_DMACR);
local_irq_restore(flags);
if (!chip->mclk_keepon) {
/*
* The enablement of I2S can onlybe truned off when
@@ -180,7 +181,7 @@ static inline void light_snd_rxctrl(struct light_i2s_priv *chip, bool on)
static int light_i2s_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
//printk("%s: %s %s\n", __func__, substream->pcm->name, dai->name);
pr_debug("%s: %s %s\n", __func__, substream->pcm->name, dai->name);
return 0;
}
@@ -189,7 +190,7 @@ static void light_i2s_dai_shutdown(struct snd_pcm_substream *substream,
{
struct light_i2s_priv *i2s_private = snd_soc_dai_get_drvdata(dai);
//printk("%s: %s %s\n", __func__, substream->pcm->name, dai->name);
pr_debug("%s: %s %s\n", __func__, substream->pcm->name, dai->name);
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
light_snd_rxctrl(i2s_private, 0);
@@ -209,7 +210,7 @@ static int light_i2s_dai_trigger(struct snd_pcm_substream *substream, int cmd,
struct light_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
//printk("%s: %s %s cmd=%d tx=%d\n", __func__, substream->pcm->name, dai->name, cmd, tx);
pr_debug("%s: %s %s cmd=%d tx=%d\n", __func__, substream->pcm->name, dai->name, cmd, tx);
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
@@ -226,7 +227,6 @@ static int light_i2s_dai_trigger(struct snd_pcm_substream *substream, int cmd,
break;
case SNDRV_PCM_TRIGGER_STOP:
if (tx) {
dmaengine_terminate_async(snd_dmaengine_pcm_get_chan(substream)); // work around for DMAC stop issue
light_snd_txctrl(priv, 0);
priv->state &= ~I2S_STATE_TX_RUNNING;
} else {
@@ -374,7 +374,7 @@ static int light_i2s_dai_hw_params(struct snd_pcm_substream *substream, struct s
writel(funcmode, i2s_private->regs + I2S_FUNCMODE);
//printk("%s: %s %s channels=%d rate=%d fm=%x\n", __func__, substream->pcm->name, dai->name, channels, rate, funcmode);
pr_debug("%s: %s %s channels=%d rate=%d fm=%x\n", __func__, substream->pcm->name, dai->name, channels, rate, funcmode);
if (channels == MONO_SOURCE) {
iiscnf_out |= IISCNFOUT_TX_VOICE_EN_MONO;
@@ -470,7 +470,7 @@ static int light_i2s_dai_probe(struct snd_soc_dai *dai)
{
struct light_i2s_priv *i2s = snd_soc_dai_get_drvdata(dai);
//printk("%s: %p %p\n", __func__, i2s->base, i2s->regs);
pr_debug("%s: %p %p\n", __func__, i2s->base, i2s->regs);
if(i2s)
snd_soc_dai_init_dma_data(dai, &i2s->dma_params_tx,
@@ -615,7 +615,7 @@ static int light_i2s_runtime_suspend(struct device *dev)
{
struct light_i2s_priv *i2s_priv = dev_get_drvdata(dev);
//printk("%s: %s\n", __func__, i2s_priv->name);
pr_debug("%s: %s\n", __func__, i2s_priv->name);
if (!i2s_priv->mclk_keepon) {
regcache_cache_only(i2s_priv->regmap, true);
@@ -630,7 +630,7 @@ static int light_i2s_runtime_resume(struct device *dev)
struct light_i2s_priv *i2s_priv = dev_get_drvdata(dev);
int ret;
//printk("%s: %s\n", __func__, i2s_priv->name);
pr_debug("%s: %s\n", __func__, i2s_priv->name);
if (!i2s_priv->mclk_keepon) {
ret = clk_prepare_enable(i2s_priv->clk);
@@ -723,6 +723,42 @@ static const struct of_device_id light_i2s_of_match[] = {
};
MODULE_DEVICE_TABLE(of, light_i2s_of_match);
static ssize_t light_i2s_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
return 0;
}
static ssize_t light_i2s_show(struct device *dev, struct device_attribute *attr, char *buf)
{
u32 value, i;
struct light_i2s_priv *priv = dev_get_drvdata(dev);
for (i = I2S_IISEN; i <= I2S_DR4; i+=0x4) {
value = readl(priv->regs + i);
printk("i2s reg[0x%x]=0x%x\n", i, value);
}
for (i = 0; i <= 0xfc ; i+=0x4) {
regmap_read(priv->audio_cpr_regmap, i, &value);
printk("cpr reg[0x%x]=0x%x\n", i, value);
}
return 0;
}
static DEVICE_ATTR(registers, 0644, light_i2s_show, light_i2s_store);
static struct attribute *light_i2s_debug_attrs[] = {
&dev_attr_registers.attr,
NULL,
};
static struct attribute_group light_i2s_debug_attr_group = {
.name = "light_i2s_debug",
.attrs = light_i2s_debug_attrs,
};
static int light_audio_i2s_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -774,8 +810,6 @@ static int light_audio_i2s_probe(struct platform_device *pdev)
i2s_priv->regs = devm_ioremap_resource(dev, res);
//printk("%s: %p %p\n", __func__, i2s_priv->base, i2s_priv->regs);
if (IS_ERR(i2s_priv->regs))
return PTR_ERR(i2s_priv->regs);
@@ -848,6 +882,11 @@ static int light_audio_i2s_probe(struct platform_device *pdev)
goto err_pm_disable;
}
ret = sysfs_create_group(&dev->kobj, &light_i2s_debug_attr_group);
if (ret) {
pr_err("failed to create attr group\n");
}
return ret;
err_pm_disable:

View File

@@ -71,7 +71,7 @@ static void light_tdm_snd_rxctrl(struct light_tdm_priv *priv, char on)
TDMCTL_TDMEN_MSK, TDMCTL_TDMEN_SEL(on));
regmap_read(priv->regmap, TDM_DMACTL, &dmactl);
regmap_read(priv->regmap, TDM_TDMEN, &tdmen);
//printk("%s TDM_DMACTL=0x%x TDM_TDMEN=0x%x\n", __func__, dmactl, tdmen);
pr_debug("%s TDM_DMACTL=0x%x TDM_TDMEN=0x%x\n", __func__, dmactl, tdmen);
return;
}
@@ -123,7 +123,6 @@ static int light_tdm_set_fmt_dai(struct snd_soc_dai *dai, unsigned int fmt)
if (priv->slot_num != 1) {
return 0;
}
printk("%s enter\n", __func__);
pm_runtime_resume_and_get(priv->dev);
@@ -194,7 +193,7 @@ static void light_tdm_set_div(struct light_tdm_priv *priv, struct snd_pcm_hw_par
div0 = src_clk / (sample_rate * (width * priv->slots));
regmap_update_bits(priv->regmap, TDM_DIV0_LEVEL,
TDMCTL_DIV0_MASK, div0);
//printk("src_clk=%d sample_rate=%d priv->slots=%d width=%d div0=%d\n", src_clk, sample_rate, priv->slots, width, div0);
pr_debug("src_clk=%d sample_rate=%d priv->slots=%d width=%d div0=%d\n", src_clk, sample_rate, priv->slots, width, div0);
}
@@ -251,7 +250,7 @@ static int light_tdm_dai_hw_params(struct snd_pcm_substream *substream, struct s
regmap_update_bits(priv->regmap, TDM_TDMCTL,
TDMCTL_CHNUM_MSK, TDMCTL_CHNUM_SEL(chn_num));
regmap_read(priv->regmap, TDM_TDMCTL, &tdmctl);
//printk("%s TDM_TDMCTL=0x%x\n", __func__, tdmctl);
pr_debug("%s TDM_TDMCTL=0x%x\n", __func__, tdmctl);
light_tdm_set_div(priv, params);
return 0;
@@ -442,7 +441,7 @@ static int light_tdm_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
int data_register, ret = 0;
printk("%s enter\n", __func__);
tdm_priv = devm_kzalloc(&pdev->dev, sizeof(struct light_tdm_priv), GFP_KERNEL);
if (!tdm_priv) {
return -ENOMEM;