int omap_st_set_chgain(unsigned int id, int channel, s16 chgain) { struct omap_mcbsp *mcbsp; struct omap_mcbsp_st_data *st_data; int ret = 0; if (!omap_mcbsp_check_valid_id(id)) { printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); return -ENODEV; } mcbsp = id_to_mcbsp_ptr(id); st_data = mcbsp->st_data; if (!st_data) return -ENOENT; spin_lock_irq(&mcbsp->lock); if (channel == 0) st_data->ch0gain = chgain; else if (channel == 1) st_data->ch1gain = chgain; else ret = -EINVAL; if (st_data->enabled) omap_st_chgain(mcbsp); spin_unlock_irq(&mcbsp->lock); return ret; }
static int omap_st_start(struct omap_mcbsp *mcbsp) { struct omap_mcbsp_st_data *st_data = mcbsp->st_data; if (st_data->enabled && !st_data->running) { omap_st_fir_write(mcbsp, st_data->taps); omap_st_chgain(mcbsp); if (!mcbsp->free) { omap_st_on(mcbsp); st_data->running = 1; } } return 0; }
int omap_st_set_chgain(struct omap_mcbsp *mcbsp, int channel, s16 chgain) { struct omap_mcbsp_st_data *st_data = mcbsp->st_data; int ret = 0; if (!st_data) return -ENOENT; spin_lock_irq(&mcbsp->lock); if (channel == 0) st_data->ch0gain = chgain; else if (channel == 1) st_data->ch1gain = chgain; else ret = -EINVAL; if (st_data->enabled) omap_st_chgain(mcbsp); spin_unlock_irq(&mcbsp->lock); return ret; }