linux 4.1.36 中变化
1
ret = request_irq(IRQ_DMA2, s3c2440_dma2_irq, IRQF_DISABLED, "myalsa for playback", substream);
IRQF_DISABLED 换为 IRQF_TRIGGER_NONE
2
snd_soc_register_dai(&pdev->dev, &s3c2440_i2s_dai);
换为
static const struct snd_soc_component_driver s3c2440_i2s_component = {
.name = "s3c2440-iis",
};
ret = devm_snd_soc_register_component(&pdev->dev, &s3c2440_i2s_component, &s3c2440_i2s_dai, 1);
3
struct snd_soc_pcm_runtime *rtd
中没有 rtd->codec 成员。
4
snd_soc_dapm_new_widgets(dapm) 改为 dapm->card
5 devs.c 中没有 i2s 的配置 从 网上找到补丁, 结果还是不能使用。 先使用 ko 加载吧,也能使用,以后有空在编进内核。
#ifdef CONFIG_PLAT_S3C24XX
static struct resource s3c_iis_resource[] = {
[0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS),
};
static struct s3c_audio_pdata s3c_iis_platdata = {
.dma_playback = (void *)DMACH_I2S_OUT,
.dma_capture = (void *)DMACH_I2S_IN,
};
struct platform_device s3c_device_iis = {
.name = "s3c24xx-iis",
.id = -1,
.num_resources = ARRAY_SIZE(s3c_iis_resource),
.resource = s3c_iis_resource,
.dev = {
.dma_mask = &samsung_device_dma_mask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &s3c_iis_platdata,
}
};
s3c24xx-i2s.c
添加头文件
//new add
#include <linux/platform_data/asoc-s3c.h>
static struct s3c_dma_params s3c24xx_i2s_pcm_stereo_out = {
//.slave = (void *)(uintptr_t)DMACH_I2S_OUT,
.ch_name = "tx",
.dma_size = 2,
};
static struct s3c_dma_params s3c24xx_i2s_pcm_stereo_in = {
//.slave = (void *)(uintptr_t)DMACH_I2S_IN,
.ch_name = "rx",
.dma_size = 2,
};
static int s3c24xx_iis_dev_probe(struct platform_device *pdev)
{
int ret = 0;
struct resource *res;
//new add
struct s3c_audio_pdata *pdata = dev_get_platdata(&pdev->dev);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "Can't get IO resource.
");
return -ENOENT;
}
s3c24xx_i2s.regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(s3c24xx_i2s.regs))
return PTR_ERR(s3c24xx_i2s.regs);
s3c24xx_i2s_pcm_stereo_out.dma_addr = res->start + S3C2410_IISFIFO;
s3c24xx_i2s_pcm_stereo_out.slave = pdata->dma_playback;
s3c24xx_i2s_pcm_stereo_in.dma_addr = res->start + S3C2410_IISFIFO;
s3c24xx_i2s_pcm_stereo_in.slave = pdata->dma_capture;
ret = devm_snd_soc_register_component(&pdev->dev,
&s3c24xx_i2s_component, &s3c24xx_i2s_dai, 1);
if (ret) {
pr_err("failed to register the dai
");
return ret;
}
ret = samsung_asoc_dma_platform_register(&pdev->dev);
if (ret)
pr_err("failed to register the dma: %d
", ret);
return ret;
}
如果不配置就会出错
S3C24XX_UDA134X SoC Audio driver
soc-audio soc-audio: ASoC: machine S3C24XX_UDA134X should use snd_soc_register_card()
s3c24xx-iis s3c24xx-iis: Missing dma channel for stream: 0
s3c24xx-iis s3c24xx-iis: ASoC: pcm constructor failed: -22
soc-audio soc-audio: ASoC: can't create pcm UDA134X :-22
soc-audio soc-audio: ASoC: failed to instantiate card -22
soc-audio: probe of soc-audio failed with error -22
附上驱动成功的图