Lines Matching +full:i2s +full:- +full:out

1 // SPDX-License-Identifier: GPL-2.0-only
5 * (c) 2007-2008 MSC Vertriebsges.m.b.H.,
8 * Au1xxx-PSC I2S glue.
10 * NOTE: so far only PSC slave mode (bit- and frameclock) is supported.
21 #include <asm/mach-au1x00/au1000.h>
22 #include <asm/mach-au1x00/au1xxx_psc.h>
26 /* supported I2S DAI hardware formats */
31 /* supported I2S direction */
58 ret = -EINVAL; in au1xpsc_i2s_set_fmt()
60 ct = pscdata->cfg; in au1xpsc_i2s_set_fmt()
62 ct &= ~(PSC_I2SCFG_XM | PSC_I2SCFG_MLJ); /* left-justified */ in au1xpsc_i2s_set_fmt()
65 ct |= PSC_I2SCFG_XM; /* enable I2S mode */ in au1xpsc_i2s_set_fmt()
70 ct |= PSC_I2SCFG_MLJ; /* LSB (right-) justified */ in au1xpsc_i2s_set_fmt()
73 goto out; in au1xpsc_i2s_set_fmt()
76 ct &= ~(PSC_I2SCFG_BI | PSC_I2SCFG_WI); /* IB-IF */ in au1xpsc_i2s_set_fmt()
90 goto out; in au1xpsc_i2s_set_fmt()
95 ct |= PSC_I2SCFG_MS; /* PSC I2S consumer mode */ in au1xpsc_i2s_set_fmt()
98 ct &= ~PSC_I2SCFG_MS; /* PSC I2S provider mode */ in au1xpsc_i2s_set_fmt()
101 goto out; in au1xpsc_i2s_set_fmt()
104 pscdata->cfg = ct; in au1xpsc_i2s_set_fmt()
106 out: in au1xpsc_i2s_set_fmt()
124 if ((PSC_I2SCFG_GET_LEN(cfgbits) != params->msbits) || in au1xpsc_i2s_hw_params()
125 (params_rate(params) != pscdata->rate)) in au1xpsc_i2s_hw_params()
126 return -EINVAL; in au1xpsc_i2s_hw_params()
129 pscdata->cfg &= ~(0x1f << 4); in au1xpsc_i2s_hw_params()
130 pscdata->cfg |= PSC_I2SCFG_SET_LEN(params->msbits); in au1xpsc_i2s_hw_params()
132 pscdata->rate = params_rate(params); in au1xpsc_i2s_hw_params()
137 /* Configure PSC late: on my devel systems the codec is I2S master and
148 /* bring PSC out of sleep, and configure I2S unit */ in au1xpsc_i2s_configure()
154 tmo--; in au1xpsc_i2s_configure()
161 __raw_writel(pscdata->cfg | PSC_I2SCFG_DE_ENABLE, I2S_CFG(pscdata)); in au1xpsc_i2s_configure()
164 /* wait for I2S controller to become ready */ in au1xpsc_i2s_configure()
167 tmo--; in au1xpsc_i2s_configure()
176 return -ETIMEDOUT; in au1xpsc_i2s_configure()
191 goto out; in au1xpsc_i2s_start()
202 tmo--; in au1xpsc_i2s_start()
207 ret = -ETIMEDOUT; in au1xpsc_i2s_start()
209 out: in au1xpsc_i2s_start()
223 tmo--; in au1xpsc_i2s_stop()
240 int ret, stype = substream->stream; in au1xpsc_i2s_trigger()
252 ret = -EINVAL; in au1xpsc_i2s_trigger()
261 snd_soc_dai_set_dma_data(dai, substream, &pscdata->dmaids[0]); in au1xpsc_i2s_startup()
289 .name = "au1xpsc-i2s",
299 wd = devm_kzalloc(&pdev->dev, sizeof(struct au1xpsc_audio_data), in au1xpsc_i2s_drvprobe()
302 return -ENOMEM; in au1xpsc_i2s_drvprobe()
304 wd->mmio = devm_platform_ioremap_resource(pdev, 0); in au1xpsc_i2s_drvprobe()
305 if (IS_ERR(wd->mmio)) in au1xpsc_i2s_drvprobe()
306 return PTR_ERR(wd->mmio); in au1xpsc_i2s_drvprobe()
310 return -EBUSY; in au1xpsc_i2s_drvprobe()
311 wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start; in au1xpsc_i2s_drvprobe()
315 return -EBUSY; in au1xpsc_i2s_drvprobe()
316 wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start; in au1xpsc_i2s_drvprobe()
329 wd->cfg |= PSC_I2SCFG_RT_FIFO8 | PSC_I2SCFG_TT_FIFO8; in au1xpsc_i2s_drvprobe()
331 /* don't wait for I2S core to become ready now; clocks may not in au1xpsc_i2s_drvprobe()
333 * time out. in au1xpsc_i2s_drvprobe()
336 /* name the DAI like this device instance ("au1xpsc-i2s.PSCINDEX") */ in au1xpsc_i2s_drvprobe()
337 memcpy(&wd->dai_drv, &au1xpsc_i2s_dai_template, in au1xpsc_i2s_drvprobe()
339 wd->dai_drv.name = dev_name(&pdev->dev); in au1xpsc_i2s_drvprobe()
343 return devm_snd_soc_register_component(&pdev->dev, in au1xpsc_i2s_drvprobe()
344 &au1xpsc_i2s_component, &wd->dai_drv, 1); in au1xpsc_i2s_drvprobe()
363 wd->pm[0] = __raw_readl(PSC_SEL(wd)); in au1xpsc_i2s_drvsuspend()
377 /* select I2S mode and PSC clock */ in au1xpsc_i2s_drvresume()
382 __raw_writel(wd->pm[0], PSC_SEL(wd)); in au1xpsc_i2s_drvresume()
413 MODULE_DESCRIPTION("Au12x0/Au1550 PSC I2S ALSA ASoC audio driver");