170264872SPaweł Anikiel // SPDX-License-Identifier: GPL-2.0-only
270264872SPaweł Anikiel #include <linux/module.h>
370264872SPaweł Anikiel #include <linux/of.h>
470264872SPaweł Anikiel #include <linux/platform_device.h>
570264872SPaweł Anikiel
670264872SPaweł Anikiel #include <sound/soc.h>
770264872SPaweł Anikiel
870264872SPaweł Anikiel /*
970264872SPaweł Anikiel * The I2S interface consists of two ring buffers - one for RX and one for
1070264872SPaweł Anikiel * TX. A ring buffer has a producer index and a consumer index. Depending
1170264872SPaweł Anikiel * on which way the data is flowing, either the software or the hardware
1270264872SPaweł Anikiel * writes data and updates the producer index, and the other end reads data
1370264872SPaweł Anikiel * and updates the consumer index.
1470264872SPaweł Anikiel *
1570264872SPaweł Anikiel * The pointer managed by software is updated using the .ack callback
1670264872SPaweł Anikiel * (see chv3_dma_ack). This seems to be the only way to reliably obtain
1770264872SPaweł Anikiel * the appl_ptr from within the driver and pass it to hardware.
1870264872SPaweł Anikiel *
1970264872SPaweł Anikiel * Because of the two pointer design, the ring buffer can never be full. With
2070264872SPaweł Anikiel * capture this isn't a problem, because the hardware being the producer
2170264872SPaweł Anikiel * will wait for the consumer index to move out of the way. With playback,
2270264872SPaweł Anikiel * however, this is problematic, because ALSA wants to fill up the buffer
2370264872SPaweł Anikiel * completely when waiting for hardware. In the .ack callback, the driver
2470264872SPaweł Anikiel * would have to wait for the consumer index to move out of the way by
2570264872SPaweł Anikiel * busy-waiting, which would keep stalling the kernel for quite a long time.
2670264872SPaweł Anikiel *
2770264872SPaweł Anikiel * The workaround to this problem is to "lie" to ALSA that the hw_pointer
2870264872SPaweł Anikiel * is one frame behind what it actually is (see chv3_dma_pointer). This
2970264872SPaweł Anikiel * way, ALSA will not try to fill up the entire buffer, and all callbacks
3070264872SPaweł Anikiel * are wait-free.
3170264872SPaweł Anikiel */
3270264872SPaweł Anikiel
3370264872SPaweł Anikiel #define I2S_TX_ENABLE 0x00
3470264872SPaweł Anikiel #define I2S_TX_BASE_ADDR 0x04
3570264872SPaweł Anikiel #define I2S_TX_BUFFER_SIZE 0x08
3670264872SPaweł Anikiel #define I2S_TX_PRODUCER_IDX 0x0c
3770264872SPaweł Anikiel #define I2S_TX_CONSUMER_IDX 0x10
3870264872SPaweł Anikiel #define I2S_RX_ENABLE 0x14
3970264872SPaweł Anikiel #define I2S_RX_BASE_ADDR 0x18
4070264872SPaweł Anikiel #define I2S_RX_BUFFER_SIZE 0x1c
4170264872SPaweł Anikiel #define I2S_RX_PRODUCER_IDX 0x20
4270264872SPaweł Anikiel #define I2S_RX_CONSUMER_IDX 0x24
4370264872SPaweł Anikiel
4470264872SPaweł Anikiel #define I2S_SOFT_RESET 0x2c
4570264872SPaweł Anikiel #define I2S_SOFT_RESET_RX_BIT 0x1
4670264872SPaweł Anikiel #define I2S_SOFT_RESET_TX_BIT 0x2
4770264872SPaweł Anikiel
4870264872SPaweł Anikiel #define I2S_RX_IRQ 0x4c
4970264872SPaweł Anikiel #define I2S_RX_IRQ_CONST 0x50
5070264872SPaweł Anikiel #define I2S_TX_IRQ 0x54
5170264872SPaweł Anikiel #define I2S_TX_IRQ_CONST 0x58
5270264872SPaweł Anikiel
5370264872SPaweł Anikiel #define I2S_IRQ_MASK 0x8
5470264872SPaweł Anikiel #define I2S_IRQ_CLR 0xc
5570264872SPaweł Anikiel #define I2S_IRQ_RX_BIT 0x1
5670264872SPaweł Anikiel #define I2S_IRQ_TX_BIT 0x2
5770264872SPaweł Anikiel
5870264872SPaweł Anikiel #define I2S_MAX_BUFFER_SIZE 0x200000
5970264872SPaweł Anikiel
6070264872SPaweł Anikiel struct chv3_i2s_dev {
6170264872SPaweł Anikiel struct device *dev;
6270264872SPaweł Anikiel void __iomem *iobase;
6370264872SPaweł Anikiel void __iomem *iobase_irq;
6470264872SPaweł Anikiel struct snd_pcm_substream *rx_substream;
6570264872SPaweł Anikiel struct snd_pcm_substream *tx_substream;
6670264872SPaweł Anikiel int tx_bytes_to_fetch;
6770264872SPaweł Anikiel };
6870264872SPaweł Anikiel
6970264872SPaweł Anikiel static struct snd_soc_dai_driver chv3_i2s_dai = {
7070264872SPaweł Anikiel .name = "chv3-i2s",
7170264872SPaweł Anikiel .capture = {
7270264872SPaweł Anikiel .channels_min = 1,
7370264872SPaweł Anikiel .channels_max = 128,
7470264872SPaweł Anikiel .rates = SNDRV_PCM_RATE_CONTINUOUS,
7570264872SPaweł Anikiel .rate_min = 8000,
7670264872SPaweł Anikiel .rate_max = 96000,
7770264872SPaweł Anikiel .formats = SNDRV_PCM_FMTBIT_S32_LE,
7870264872SPaweł Anikiel },
7970264872SPaweł Anikiel .playback = {
8070264872SPaweł Anikiel .channels_min = 1,
8170264872SPaweł Anikiel .channels_max = 128,
8270264872SPaweł Anikiel .rates = SNDRV_PCM_RATE_CONTINUOUS,
8370264872SPaweł Anikiel .rate_min = 8000,
8470264872SPaweł Anikiel .rate_max = 96000,
8570264872SPaweł Anikiel .formats = SNDRV_PCM_FMTBIT_S32_LE,
8670264872SPaweł Anikiel },
8770264872SPaweł Anikiel };
8870264872SPaweł Anikiel
8970264872SPaweł Anikiel static const struct snd_pcm_hardware chv3_dma_hw = {
9070264872SPaweł Anikiel .info = SNDRV_PCM_INFO_INTERLEAVED |
9170264872SPaweł Anikiel SNDRV_PCM_INFO_MMAP |
9270264872SPaweł Anikiel SNDRV_PCM_INFO_MMAP_VALID |
9370264872SPaweł Anikiel SNDRV_PCM_INFO_BLOCK_TRANSFER,
9470264872SPaweł Anikiel .buffer_bytes_max = I2S_MAX_BUFFER_SIZE,
9570264872SPaweł Anikiel .period_bytes_min = 64,
9670264872SPaweł Anikiel .period_bytes_max = 8192,
9770264872SPaweł Anikiel .periods_min = 4,
9870264872SPaweł Anikiel .periods_max = 256,
9970264872SPaweł Anikiel };
10070264872SPaweł Anikiel
chv3_i2s_wr(struct chv3_i2s_dev * i2s,int offset,u32 val)10170264872SPaweł Anikiel static inline void chv3_i2s_wr(struct chv3_i2s_dev *i2s, int offset, u32 val)
10270264872SPaweł Anikiel {
10370264872SPaweł Anikiel writel(val, i2s->iobase + offset);
10470264872SPaweł Anikiel }
10570264872SPaweł Anikiel
chv3_i2s_rd(struct chv3_i2s_dev * i2s,int offset)10670264872SPaweł Anikiel static inline u32 chv3_i2s_rd(struct chv3_i2s_dev *i2s, int offset)
10770264872SPaweł Anikiel {
10870264872SPaweł Anikiel return readl(i2s->iobase + offset);
10970264872SPaweł Anikiel }
11070264872SPaweł Anikiel
chv3_i2s_isr(int irq,void * data)11170264872SPaweł Anikiel static irqreturn_t chv3_i2s_isr(int irq, void *data)
11270264872SPaweł Anikiel {
11370264872SPaweł Anikiel struct chv3_i2s_dev *i2s = data;
11470264872SPaweł Anikiel u32 reg;
11570264872SPaweł Anikiel
11670264872SPaweł Anikiel reg = readl(i2s->iobase_irq + I2S_IRQ_CLR);
11770264872SPaweł Anikiel if (!reg)
11870264872SPaweł Anikiel return IRQ_NONE;
11970264872SPaweł Anikiel
12070264872SPaweł Anikiel if (reg & I2S_IRQ_RX_BIT)
12170264872SPaweł Anikiel snd_pcm_period_elapsed(i2s->rx_substream);
12270264872SPaweł Anikiel
12370264872SPaweł Anikiel if (reg & I2S_IRQ_TX_BIT)
12470264872SPaweł Anikiel snd_pcm_period_elapsed(i2s->tx_substream);
12570264872SPaweł Anikiel
12670264872SPaweł Anikiel writel(reg, i2s->iobase_irq + I2S_IRQ_CLR);
12770264872SPaweł Anikiel
12870264872SPaweł Anikiel return IRQ_HANDLED;
12970264872SPaweł Anikiel }
13070264872SPaweł Anikiel
chv3_dma_open(struct snd_soc_component * component,struct snd_pcm_substream * substream)13170264872SPaweł Anikiel static int chv3_dma_open(struct snd_soc_component *component,
13270264872SPaweł Anikiel struct snd_pcm_substream *substream)
13370264872SPaweł Anikiel {
13408b7174fSKuninori Morimoto struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
13508b7174fSKuninori Morimoto struct chv3_i2s_dev *i2s = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
13670264872SPaweł Anikiel int res;
13770264872SPaweł Anikiel
13870264872SPaweł Anikiel snd_soc_set_runtime_hwparams(substream, &chv3_dma_hw);
13970264872SPaweł Anikiel
14070264872SPaweł Anikiel res = snd_pcm_hw_constraint_pow2(substream->runtime, 0,
14170264872SPaweł Anikiel SNDRV_PCM_HW_PARAM_BUFFER_BYTES);
14270264872SPaweł Anikiel if (res)
14370264872SPaweł Anikiel return res;
14470264872SPaweł Anikiel
14570264872SPaweł Anikiel if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
14670264872SPaweł Anikiel i2s->rx_substream = substream;
14770264872SPaweł Anikiel else
14870264872SPaweł Anikiel i2s->tx_substream = substream;
14970264872SPaweł Anikiel
15070264872SPaweł Anikiel return 0;
15170264872SPaweł Anikiel }
chv3_dma_close(struct snd_soc_component * component,struct snd_pcm_substream * substream)15270264872SPaweł Anikiel static int chv3_dma_close(struct snd_soc_component *component,
15370264872SPaweł Anikiel struct snd_pcm_substream *substream)
15470264872SPaweł Anikiel {
15508b7174fSKuninori Morimoto struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
15608b7174fSKuninori Morimoto struct chv3_i2s_dev *i2s = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
15770264872SPaweł Anikiel
15870264872SPaweł Anikiel if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
15970264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_RX_ENABLE, 0);
16070264872SPaweł Anikiel else
16170264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_TX_ENABLE, 0);
16270264872SPaweł Anikiel
16370264872SPaweł Anikiel return 0;
16470264872SPaweł Anikiel }
16570264872SPaweł Anikiel
chv3_dma_pcm_construct(struct snd_soc_component * component,struct snd_soc_pcm_runtime * rtd)16670264872SPaweł Anikiel static int chv3_dma_pcm_construct(struct snd_soc_component *component,
16770264872SPaweł Anikiel struct snd_soc_pcm_runtime *rtd)
16870264872SPaweł Anikiel {
16908b7174fSKuninori Morimoto struct chv3_i2s_dev *i2s = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
17070264872SPaweł Anikiel struct snd_pcm_substream *substream;
17170264872SPaweł Anikiel int res;
17270264872SPaweł Anikiel
17370264872SPaweł Anikiel substream = rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
17470264872SPaweł Anikiel if (substream) {
17570264872SPaweł Anikiel res = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, i2s->dev,
17670264872SPaweł Anikiel I2S_MAX_BUFFER_SIZE, &substream->dma_buffer);
17770264872SPaweł Anikiel if (res)
17870264872SPaweł Anikiel return res;
17970264872SPaweł Anikiel }
18070264872SPaweł Anikiel
18170264872SPaweł Anikiel substream = rtd->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
18270264872SPaweł Anikiel if (substream) {
18370264872SPaweł Anikiel res = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, i2s->dev,
18470264872SPaweł Anikiel I2S_MAX_BUFFER_SIZE, &substream->dma_buffer);
18570264872SPaweł Anikiel if (res)
18670264872SPaweł Anikiel return res;
18770264872SPaweł Anikiel }
18870264872SPaweł Anikiel
18970264872SPaweł Anikiel return 0;
19070264872SPaweł Anikiel }
19170264872SPaweł Anikiel
chv3_dma_hw_params(struct snd_soc_component * component,struct snd_pcm_substream * substream,struct snd_pcm_hw_params * params)19270264872SPaweł Anikiel static int chv3_dma_hw_params(struct snd_soc_component *component,
19370264872SPaweł Anikiel struct snd_pcm_substream *substream,
19470264872SPaweł Anikiel struct snd_pcm_hw_params *params)
19570264872SPaweł Anikiel {
19670264872SPaweł Anikiel snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
19770264872SPaweł Anikiel return 0;
19870264872SPaweł Anikiel }
19970264872SPaweł Anikiel
chv3_dma_prepare(struct snd_soc_component * component,struct snd_pcm_substream * substream)20070264872SPaweł Anikiel static int chv3_dma_prepare(struct snd_soc_component *component,
20170264872SPaweł Anikiel struct snd_pcm_substream *substream)
20270264872SPaweł Anikiel {
20308b7174fSKuninori Morimoto struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
20408b7174fSKuninori Morimoto struct chv3_i2s_dev *i2s = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
20570264872SPaweł Anikiel unsigned int buffer_bytes, period_bytes, period_size;
20670264872SPaweł Anikiel
20770264872SPaweł Anikiel buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
20870264872SPaweł Anikiel period_bytes = snd_pcm_lib_period_bytes(substream);
20970264872SPaweł Anikiel period_size = substream->runtime->period_size;
21070264872SPaweł Anikiel
21170264872SPaweł Anikiel if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) {
21270264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_SOFT_RESET, I2S_SOFT_RESET_RX_BIT);
21370264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_RX_BASE_ADDR, substream->dma_buffer.addr);
21470264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_RX_BUFFER_SIZE, buffer_bytes);
21570264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_RX_IRQ, (period_size << 8) | 1);
21670264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_RX_ENABLE, 1);
21770264872SPaweł Anikiel } else {
21870264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_SOFT_RESET, I2S_SOFT_RESET_TX_BIT);
21970264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_TX_BASE_ADDR, substream->dma_buffer.addr);
22070264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_TX_BUFFER_SIZE, buffer_bytes);
22170264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_TX_IRQ, ((period_bytes / i2s->tx_bytes_to_fetch) << 8) | 1);
22270264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_TX_ENABLE, 1);
22370264872SPaweł Anikiel }
22470264872SPaweł Anikiel writel(I2S_IRQ_RX_BIT | I2S_IRQ_TX_BIT, i2s->iobase_irq + I2S_IRQ_MASK);
22570264872SPaweł Anikiel
22670264872SPaweł Anikiel return 0;
22770264872SPaweł Anikiel }
22870264872SPaweł Anikiel
chv3_dma_pointer(struct snd_soc_component * component,struct snd_pcm_substream * substream)22970264872SPaweł Anikiel static snd_pcm_uframes_t chv3_dma_pointer(struct snd_soc_component *component,
23070264872SPaweł Anikiel struct snd_pcm_substream *substream)
23170264872SPaweł Anikiel {
23208b7174fSKuninori Morimoto struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
23308b7174fSKuninori Morimoto struct chv3_i2s_dev *i2s = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
23470264872SPaweł Anikiel u32 frame_bytes, buffer_bytes;
23570264872SPaweł Anikiel u32 idx_bytes;
23670264872SPaweł Anikiel
23770264872SPaweł Anikiel frame_bytes = substream->runtime->frame_bits * 8;
23870264872SPaweł Anikiel buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
23970264872SPaweł Anikiel
24070264872SPaweł Anikiel if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) {
24170264872SPaweł Anikiel idx_bytes = chv3_i2s_rd(i2s, I2S_RX_PRODUCER_IDX);
24270264872SPaweł Anikiel } else {
24370264872SPaweł Anikiel idx_bytes = chv3_i2s_rd(i2s, I2S_TX_CONSUMER_IDX);
24470264872SPaweł Anikiel /* lag the pointer by one frame */
24570264872SPaweł Anikiel idx_bytes = (idx_bytes - frame_bytes) & (buffer_bytes - 1);
24670264872SPaweł Anikiel }
24770264872SPaweł Anikiel
24870264872SPaweł Anikiel return bytes_to_frames(substream->runtime, idx_bytes);
24970264872SPaweł Anikiel }
25070264872SPaweł Anikiel
chv3_dma_ack(struct snd_soc_component * component,struct snd_pcm_substream * substream)25170264872SPaweł Anikiel static int chv3_dma_ack(struct snd_soc_component *component,
25270264872SPaweł Anikiel struct snd_pcm_substream *substream)
25370264872SPaweł Anikiel {
25470264872SPaweł Anikiel struct snd_pcm_runtime *runtime = substream->runtime;
25508b7174fSKuninori Morimoto struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
25608b7174fSKuninori Morimoto struct chv3_i2s_dev *i2s = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
25770264872SPaweł Anikiel unsigned int bytes, idx;
25870264872SPaweł Anikiel
25970264872SPaweł Anikiel bytes = frames_to_bytes(runtime, runtime->control->appl_ptr);
26070264872SPaweł Anikiel idx = bytes & (snd_pcm_lib_buffer_bytes(substream) - 1);
26170264872SPaweł Anikiel
26270264872SPaweł Anikiel if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
26370264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_RX_CONSUMER_IDX, idx);
26470264872SPaweł Anikiel else
26570264872SPaweł Anikiel chv3_i2s_wr(i2s, I2S_TX_PRODUCER_IDX, idx);
26670264872SPaweł Anikiel
26770264872SPaweł Anikiel return 0;
26870264872SPaweł Anikiel }
26970264872SPaweł Anikiel
27070264872SPaweł Anikiel static const struct snd_soc_component_driver chv3_i2s_comp = {
27170264872SPaweł Anikiel .name = "chv3-i2s-comp",
27270264872SPaweł Anikiel .open = chv3_dma_open,
27370264872SPaweł Anikiel .close = chv3_dma_close,
27470264872SPaweł Anikiel .pcm_construct = chv3_dma_pcm_construct,
27570264872SPaweł Anikiel .hw_params = chv3_dma_hw_params,
27670264872SPaweł Anikiel .prepare = chv3_dma_prepare,
27770264872SPaweł Anikiel .pointer = chv3_dma_pointer,
27870264872SPaweł Anikiel .ack = chv3_dma_ack,
27970264872SPaweł Anikiel };
28070264872SPaweł Anikiel
chv3_i2s_probe(struct platform_device * pdev)28170264872SPaweł Anikiel static int chv3_i2s_probe(struct platform_device *pdev)
28270264872SPaweł Anikiel {
28370264872SPaweł Anikiel struct chv3_i2s_dev *i2s;
28470264872SPaweł Anikiel int res;
28570264872SPaweł Anikiel int irq;
28670264872SPaweł Anikiel
28770264872SPaweł Anikiel i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL);
28870264872SPaweł Anikiel if (!i2s)
28970264872SPaweł Anikiel return -ENOMEM;
29070264872SPaweł Anikiel
29170264872SPaweł Anikiel i2s->iobase = devm_platform_ioremap_resource(pdev, 0);
29270264872SPaweł Anikiel if (IS_ERR(i2s->iobase))
29370264872SPaweł Anikiel return PTR_ERR(i2s->iobase);
29470264872SPaweł Anikiel
29570264872SPaweł Anikiel i2s->iobase_irq = devm_platform_ioremap_resource(pdev, 1);
29670264872SPaweł Anikiel if (IS_ERR(i2s->iobase_irq))
29770264872SPaweł Anikiel return PTR_ERR(i2s->iobase_irq);
29870264872SPaweł Anikiel
29970264872SPaweł Anikiel i2s->tx_bytes_to_fetch = (chv3_i2s_rd(i2s, I2S_TX_IRQ_CONST) >> 8) & 0xffff;
30070264872SPaweł Anikiel
30170264872SPaweł Anikiel i2s->dev = &pdev->dev;
30270264872SPaweł Anikiel dev_set_drvdata(&pdev->dev, i2s);
30370264872SPaweł Anikiel
30470264872SPaweł Anikiel irq = platform_get_irq(pdev, 0);
30570264872SPaweł Anikiel if (irq < 0)
30670264872SPaweł Anikiel return -ENXIO;
30770264872SPaweł Anikiel res = devm_request_irq(i2s->dev, irq, chv3_i2s_isr, 0, "chv3-i2s", i2s);
30870264872SPaweł Anikiel if (res)
30970264872SPaweł Anikiel return res;
31070264872SPaweł Anikiel
31170264872SPaweł Anikiel res = devm_snd_soc_register_component(&pdev->dev, &chv3_i2s_comp,
31270264872SPaweł Anikiel &chv3_i2s_dai, 1);
31370264872SPaweł Anikiel if (res) {
31470264872SPaweł Anikiel dev_err(&pdev->dev, "couldn't register component: %d\n", res);
31570264872SPaweł Anikiel return res;
31670264872SPaweł Anikiel }
31770264872SPaweł Anikiel
31870264872SPaweł Anikiel return 0;
31970264872SPaweł Anikiel }
32070264872SPaweł Anikiel
32170264872SPaweł Anikiel static const struct of_device_id chv3_i2s_of_match[] = {
32270264872SPaweł Anikiel { .compatible = "google,chv3-i2s" },
32370264872SPaweł Anikiel {},
32470264872SPaweł Anikiel };
325*8e1bb4a4SLiao Chen MODULE_DEVICE_TABLE(of, chv3_i2s_of_match);
32670264872SPaweł Anikiel
32770264872SPaweł Anikiel static struct platform_driver chv3_i2s_driver = {
32870264872SPaweł Anikiel .probe = chv3_i2s_probe,
32970264872SPaweł Anikiel .driver = {
33070264872SPaweł Anikiel .name = "chv3-i2s",
33170264872SPaweł Anikiel .of_match_table = chv3_i2s_of_match,
33270264872SPaweł Anikiel },
33370264872SPaweł Anikiel };
33470264872SPaweł Anikiel
33570264872SPaweł Anikiel module_platform_driver(chv3_i2s_driver);
33670264872SPaweł Anikiel
33770264872SPaweł Anikiel MODULE_AUTHOR("Pawel Anikiel <pan@semihalf.com>");
33870264872SPaweł Anikiel MODULE_DESCRIPTION("Chameleon v3 I2S interface");
33970264872SPaweł Anikiel MODULE_LICENSE("GPL");
340