Lines Matching refs:mcbsp

65 static void omap_mcbsp_st_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)  in omap_mcbsp_st_write()  argument
67 writel_relaxed(val, mcbsp->st_data->io_base_st + reg); in omap_mcbsp_st_write()
70 static int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg) in omap_mcbsp_st_read() argument
72 return readl_relaxed(mcbsp->st_data->io_base_st + reg); in omap_mcbsp_st_read()
75 #define MCBSP_ST_READ(mcbsp, reg) omap_mcbsp_st_read(mcbsp, OMAP_ST_REG_##reg) argument
76 #define MCBSP_ST_WRITE(mcbsp, reg, val) \ argument
77 omap_mcbsp_st_write(mcbsp, OMAP_ST_REG_##reg, val)
79 static void omap_mcbsp_st_on(struct omap_mcbsp *mcbsp) in omap_mcbsp_st_on() argument
83 if (mcbsp->pdata->force_ick_on) in omap_mcbsp_st_on()
84 mcbsp->pdata->force_ick_on(mcbsp->st_data->mcbsp_iclk, true); in omap_mcbsp_st_on()
87 w = MCBSP_ST_READ(mcbsp, SYSCONFIG); in omap_mcbsp_st_on()
88 MCBSP_ST_WRITE(mcbsp, SYSCONFIG, w & ~(ST_AUTOIDLE)); in omap_mcbsp_st_on()
91 w = MCBSP_READ(mcbsp, SSELCR); in omap_mcbsp_st_on()
92 MCBSP_WRITE(mcbsp, SSELCR, w | SIDETONEEN); in omap_mcbsp_st_on()
95 w = MCBSP_ST_READ(mcbsp, SSELCR); in omap_mcbsp_st_on()
96 MCBSP_ST_WRITE(mcbsp, SSELCR, w | ST_SIDETONEEN); in omap_mcbsp_st_on()
99 static void omap_mcbsp_st_off(struct omap_mcbsp *mcbsp) in omap_mcbsp_st_off() argument
103 w = MCBSP_ST_READ(mcbsp, SSELCR); in omap_mcbsp_st_off()
104 MCBSP_ST_WRITE(mcbsp, SSELCR, w & ~(ST_SIDETONEEN)); in omap_mcbsp_st_off()
106 w = MCBSP_READ(mcbsp, SSELCR); in omap_mcbsp_st_off()
107 MCBSP_WRITE(mcbsp, SSELCR, w & ~(SIDETONEEN)); in omap_mcbsp_st_off()
110 w = MCBSP_ST_READ(mcbsp, SYSCONFIG); in omap_mcbsp_st_off()
111 MCBSP_ST_WRITE(mcbsp, SYSCONFIG, w | ST_AUTOIDLE); in omap_mcbsp_st_off()
113 if (mcbsp->pdata->force_ick_on) in omap_mcbsp_st_off()
114 mcbsp->pdata->force_ick_on(mcbsp->st_data->mcbsp_iclk, false); in omap_mcbsp_st_off()
117 static void omap_mcbsp_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir) in omap_mcbsp_st_fir_write() argument
121 val = MCBSP_ST_READ(mcbsp, SSELCR); in omap_mcbsp_st_fir_write()
124 MCBSP_ST_WRITE(mcbsp, SSELCR, val & ~(ST_COEFFWREN)); in omap_mcbsp_st_fir_write()
126 MCBSP_ST_WRITE(mcbsp, SSELCR, val | ST_COEFFWREN); in omap_mcbsp_st_fir_write()
129 MCBSP_ST_WRITE(mcbsp, SFIRCR, fir[i]); in omap_mcbsp_st_fir_write()
133 val = MCBSP_ST_READ(mcbsp, SSELCR); in omap_mcbsp_st_fir_write()
135 val = MCBSP_ST_READ(mcbsp, SSELCR); in omap_mcbsp_st_fir_write()
137 MCBSP_ST_WRITE(mcbsp, SSELCR, val & ~(ST_COEFFWREN)); in omap_mcbsp_st_fir_write()
140 dev_err(mcbsp->dev, "McBSP FIR load error!\n"); in omap_mcbsp_st_fir_write()
143 static void omap_mcbsp_st_chgain(struct omap_mcbsp *mcbsp) in omap_mcbsp_st_chgain() argument
145 struct omap_mcbsp_st_data *st_data = mcbsp->st_data; in omap_mcbsp_st_chgain()
147 MCBSP_ST_WRITE(mcbsp, SGAINCR, ST_CH0GAIN(st_data->ch0gain) | in omap_mcbsp_st_chgain()
151 static int omap_mcbsp_st_set_chgain(struct omap_mcbsp *mcbsp, int channel, in omap_mcbsp_st_set_chgain() argument
154 struct omap_mcbsp_st_data *st_data = mcbsp->st_data; in omap_mcbsp_st_set_chgain()
160 spin_lock_irq(&mcbsp->lock); in omap_mcbsp_st_set_chgain()
169 omap_mcbsp_st_chgain(mcbsp); in omap_mcbsp_st_set_chgain()
170 spin_unlock_irq(&mcbsp->lock); in omap_mcbsp_st_set_chgain()
175 static int omap_mcbsp_st_get_chgain(struct omap_mcbsp *mcbsp, int channel, in omap_mcbsp_st_get_chgain() argument
178 struct omap_mcbsp_st_data *st_data = mcbsp->st_data; in omap_mcbsp_st_get_chgain()
184 spin_lock_irq(&mcbsp->lock); in omap_mcbsp_st_get_chgain()
191 spin_unlock_irq(&mcbsp->lock); in omap_mcbsp_st_get_chgain()
196 static int omap_mcbsp_st_enable(struct omap_mcbsp *mcbsp) in omap_mcbsp_st_enable() argument
198 struct omap_mcbsp_st_data *st_data = mcbsp->st_data; in omap_mcbsp_st_enable()
203 spin_lock_irq(&mcbsp->lock); in omap_mcbsp_st_enable()
205 omap_mcbsp_st_start(mcbsp); in omap_mcbsp_st_enable()
206 spin_unlock_irq(&mcbsp->lock); in omap_mcbsp_st_enable()
211 static int omap_mcbsp_st_disable(struct omap_mcbsp *mcbsp) in omap_mcbsp_st_disable() argument
213 struct omap_mcbsp_st_data *st_data = mcbsp->st_data; in omap_mcbsp_st_disable()
219 spin_lock_irq(&mcbsp->lock); in omap_mcbsp_st_disable()
220 omap_mcbsp_st_stop(mcbsp); in omap_mcbsp_st_disable()
222 spin_unlock_irq(&mcbsp->lock); in omap_mcbsp_st_disable()
227 static int omap_mcbsp_st_is_enabled(struct omap_mcbsp *mcbsp) in omap_mcbsp_st_is_enabled() argument
229 struct omap_mcbsp_st_data *st_data = mcbsp->st_data; in omap_mcbsp_st_is_enabled()
240 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); in st_taps_show() local
241 struct omap_mcbsp_st_data *st_data = mcbsp->st_data; in st_taps_show()
245 spin_lock_irq(&mcbsp->lock); in st_taps_show()
251 spin_unlock_irq(&mcbsp->lock); in st_taps_show()
260 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); in st_taps_store() local
261 struct omap_mcbsp_st_data *st_data = mcbsp->st_data; in st_taps_store()
264 spin_lock_irq(&mcbsp->lock); in st_taps_store()
288 spin_unlock_irq(&mcbsp->lock); in st_taps_store()
304 int omap_mcbsp_st_start(struct omap_mcbsp *mcbsp) in omap_mcbsp_st_start() argument
306 struct omap_mcbsp_st_data *st_data = mcbsp->st_data; in omap_mcbsp_st_start()
309 omap_mcbsp_st_fir_write(mcbsp, st_data->taps); in omap_mcbsp_st_start()
310 omap_mcbsp_st_chgain(mcbsp); in omap_mcbsp_st_start()
312 if (!mcbsp->free) { in omap_mcbsp_st_start()
313 omap_mcbsp_st_on(mcbsp); in omap_mcbsp_st_start()
321 int omap_mcbsp_st_stop(struct omap_mcbsp *mcbsp) in omap_mcbsp_st_stop() argument
323 struct omap_mcbsp_st_data *st_data = mcbsp->st_data; in omap_mcbsp_st_stop()
326 if (!mcbsp->free) { in omap_mcbsp_st_stop()
327 omap_mcbsp_st_off(mcbsp); in omap_mcbsp_st_stop()
337 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); in omap_mcbsp_st_init() local
346 st_data = devm_kzalloc(mcbsp->dev, sizeof(*mcbsp->st_data), GFP_KERNEL); in omap_mcbsp_st_init()
350 st_data->mcbsp_iclk = clk_get(mcbsp->dev, "ick"); in omap_mcbsp_st_init()
352 dev_warn(mcbsp->dev, in omap_mcbsp_st_init()
357 st_data->io_base_st = devm_ioremap(mcbsp->dev, res->start, in omap_mcbsp_st_init()
362 ret = sysfs_create_group(&mcbsp->dev->kobj, &sidetone_attr_group); in omap_mcbsp_st_init()
366 mcbsp->st_data = st_data; in omap_mcbsp_st_init()
373 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); in omap_mcbsp_st_cleanup() local
375 if (mcbsp->st_data) { in omap_mcbsp_st_cleanup()
376 sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group); in omap_mcbsp_st_cleanup()
377 clk_put(mcbsp->st_data->mcbsp_iclk); in omap_mcbsp_st_cleanup()
402 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); \
413 return omap_mcbsp_st_set_chgain(mcbsp, channel, val); \
421 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); \
424 if (omap_mcbsp_st_get_chgain(mcbsp, channel, &chgain)) \
438 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_st_put_mode() local
441 if (value == omap_mcbsp_st_is_enabled(mcbsp)) in omap_mcbsp_st_put_mode()
445 omap_mcbsp_st_enable(mcbsp); in omap_mcbsp_st_put_mode()
447 omap_mcbsp_st_disable(mcbsp); in omap_mcbsp_st_put_mode()
456 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_st_get_mode() local
458 ucontrol->value.integer.value[0] = omap_mcbsp_st_is_enabled(mcbsp); in omap_mcbsp_st_get_mode()
490 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_st_add_controls() local
492 if (!mcbsp->st_data) { in omap_mcbsp_st_add_controls()
493 dev_warn(mcbsp->dev, "No sidetone data for port\n"); in omap_mcbsp_st_add_controls()
507 dev_err(mcbsp->dev, "Port %d not supported\n", port_id); in omap_mcbsp_st_add_controls()