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]);
233 struct au1xpsc_audio_data *ctx;
235 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
236 if (!ctx)
239 mutex_init(&ctx->lock);
250 ctx->mmio = devm_ioremap(&pdev->dev, iores->start,
252 if (!ctx->mmio)
258 ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
263 ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
266 WR(ctx, AC97_ENABLE, EN_D | EN_CE);
267 WR(ctx, AC97_ENABLE, EN_CE);
269 ctx->cfg = CFG_RC(3) | CFG_XS(3);
270 WR(ctx, AC97_CONFIG, ctx->cfg);
272 platform_set_drvdata(pdev, ctx);
283 ac97c_workdata = ctx;
289 struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev);
293 WR(ctx, AC97_ENABLE, EN_D); /* clock off, disable */
303 struct au1xpsc_audio_data *ctx = dev_get_drvdata(dev);
305 WR(ctx, AC97_ENABLE, EN_D); /* clock off, disable */
312 struct au1xpsc_audio_data *ctx = dev_get_drvdata(dev);
314 WR(ctx, AC97_ENABLE, EN_D | EN_CE);
315 WR(ctx, AC97_ENABLE, EN_CE);
316 WR(ctx, AC97_CONFIG, ctx->cfg);