Lines Matching refs:ctx

72 static inline unsigned long RD(struct au1xpsc_audio_data *ctx, int reg)
74 return __raw_readl(ctx->mmio + reg);
77 static inline void WR(struct au1xpsc_audio_data *ctx, int reg, unsigned long v)
79 __raw_writel(v, ctx->mmio + reg);
86 struct au1xpsc_audio_data *ctx = ac97_to_ctx(ac97);
93 mutex_lock(&ctx->lock);
96 while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo)
103 WR(ctx, AC97_CMDRESP, CMD_IDX(r) | CMD_READ);
109 while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo)
111 data = RD(ctx, AC97_CMDRESP);
117 mutex_unlock(&ctx->lock);
128 struct au1xpsc_audio_data *ctx = ac97_to_ctx(ac97);
133 mutex_lock(&ctx->lock);
135 for (tmo = 5; (RD(ctx, AC97_STATUS) & STAT_CP) && tmo; tmo--)
142 WR(ctx, AC97_CMDRESP, CMD_WRITE | CMD_IDX(r) | CMD_SET_DATA(v));
144 for (tmo = 10; (RD(ctx, AC97_STATUS) & STAT_CP) && tmo; tmo--)
149 mutex_unlock(&ctx->lock);
157 struct au1xpsc_audio_data *ctx = ac97_to_ctx(ac97);
159 WR(ctx, AC97_CONFIG, ctx->cfg | CFG_SG | CFG_SN);
161 WR(ctx, AC97_CONFIG, ctx->cfg | CFG_SG);
162 WR(ctx, AC97_CONFIG, ctx->cfg);
167 struct au1xpsc_audio_data *ctx = ac97_to_ctx(ac97);
170 WR(ctx, AC97_CONFIG, ctx->cfg | CFG_RS);
172 WR(ctx, AC97_CONFIG, ctx->cfg);
176 while (((RD(ctx, AC97_STATUS) & STAT_RD) == 0) && --i)
193 struct au1xpsc_audio_data *ctx = snd_soc_dai_get_drvdata(dai);
194 snd_soc_dai_set_dma_data(dai, substream, &ctx->dmaids[0]);
234 struct au1xpsc_audio_data *ctx;
236 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
237 if (!ctx)
240 mutex_init(&ctx->lock);
251 ctx->mmio = devm_ioremap(&pdev->dev, iores->start,
253 if (!ctx->mmio)
259 ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
264 ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
267 WR(ctx, AC97_ENABLE, EN_D | EN_CE);
268 WR(ctx, AC97_ENABLE, EN_CE);
270 ctx->cfg = CFG_RC(3) | CFG_XS(3);
271 WR(ctx, AC97_CONFIG, ctx->cfg);
273 platform_set_drvdata(pdev, ctx);
284 ac97c_workdata = ctx;
290 struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev);
294 WR(ctx, AC97_ENABLE, EN_D); /* clock off, disable */
302 struct au1xpsc_audio_data *ctx = dev_get_drvdata(dev);
304 WR(ctx, AC97_ENABLE, EN_D); /* clock off, disable */
311 struct au1xpsc_audio_data *ctx = dev_get_drvdata(dev);
313 WR(ctx, AC97_ENABLE, EN_D | EN_CE);
314 WR(ctx, AC97_ENABLE, EN_CE);
315 WR(ctx, AC97_CONFIG, ctx->cfg);