Lines Matching refs:tscs454

124 struct tscs454 {  struct
276 static inline int tscs454_data_init(struct tscs454 *tscs454, in tscs454_data_init() argument
282 tscs454->regmap = devm_regmap_init_i2c(i2c, &tscs454_regmap_cfg); in tscs454_data_init()
283 if (IS_ERR(tscs454->regmap)) { in tscs454_data_init()
284 ret = PTR_ERR(tscs454->regmap); in tscs454_data_init()
289 aif_init(&tscs454->aifs[i], i); in tscs454_data_init()
291 mutex_init(&tscs454->aifs_status_lock); in tscs454_data_init()
292 pll_init(&tscs454->pll1, 1); in tscs454_data_init()
293 pll_init(&tscs454->pll2, 2); in tscs454_data_init()
295 coeff_ram_init(&tscs454->dac_ram); in tscs454_data_init()
296 coeff_ram_init(&tscs454->spk_ram); in tscs454_data_init()
297 coeff_ram_init(&tscs454->sub_ram); in tscs454_data_init()
312 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in coeff_ram_get() local
320 coeff_ram = tscs454->dac_ram.cache; in coeff_ram_get()
321 coeff_ram_lock = &tscs454->dac_ram.lock; in coeff_ram_get()
323 coeff_ram = tscs454->spk_ram.cache; in coeff_ram_get()
324 coeff_ram_lock = &tscs454->spk_ram.lock; in coeff_ram_get()
326 coeff_ram = tscs454->sub_ram.cache; in coeff_ram_get()
327 coeff_ram_lock = &tscs454->sub_ram.lock; in coeff_ram_get()
347 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in write_coeff_ram() local
368 ret = regmap_write(tscs454->regmap, r_addr, coeff_addr); in write_coeff_ram()
375 ret = regmap_bulk_write(tscs454->regmap, r_wr, in write_coeff_ram()
393 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in coeff_ram_put() local
408 coeff_ram = tscs454->dac_ram.cache; in coeff_ram_put()
409 coeff_ram_lock = &tscs454->dac_ram.lock; in coeff_ram_put()
410 coeff_ram_synced = &tscs454->dac_ram.synced; in coeff_ram_put()
415 coeff_ram = tscs454->spk_ram.cache; in coeff_ram_put()
416 coeff_ram_lock = &tscs454->spk_ram.lock; in coeff_ram_put()
417 coeff_ram_synced = &tscs454->spk_ram.synced; in coeff_ram_put()
422 coeff_ram = tscs454->sub_ram.cache; in coeff_ram_put()
423 coeff_ram_lock = &tscs454->sub_ram.lock; in coeff_ram_put()
424 coeff_ram_synced = &tscs454->sub_ram.synced; in coeff_ram_put()
439 mutex_lock(&tscs454->pll1.lock); in coeff_ram_put()
440 mutex_lock(&tscs454->pll2.lock); in coeff_ram_put()
457 mutex_unlock(&tscs454->pll2.lock); in coeff_ram_put()
458 mutex_unlock(&tscs454->pll1.lock); in coeff_ram_put()
465 struct tscs454 *tscs454) in coeff_ram_sync() argument
469 mutex_lock(&tscs454->dac_ram.lock); in coeff_ram_sync()
470 if (!tscs454->dac_ram.synced) { in coeff_ram_sync()
471 ret = write_coeff_ram(component, tscs454->dac_ram.cache, in coeff_ram_sync()
475 mutex_unlock(&tscs454->dac_ram.lock); in coeff_ram_sync()
479 mutex_unlock(&tscs454->dac_ram.lock); in coeff_ram_sync()
481 mutex_lock(&tscs454->spk_ram.lock); in coeff_ram_sync()
482 if (!tscs454->spk_ram.synced) { in coeff_ram_sync()
483 ret = write_coeff_ram(component, tscs454->spk_ram.cache, in coeff_ram_sync()
487 mutex_unlock(&tscs454->spk_ram.lock); in coeff_ram_sync()
491 mutex_unlock(&tscs454->spk_ram.lock); in coeff_ram_sync()
493 mutex_lock(&tscs454->sub_ram.lock); in coeff_ram_sync()
494 if (!tscs454->sub_ram.synced) { in coeff_ram_sync()
495 ret = write_coeff_ram(component, tscs454->sub_ram.cache, in coeff_ram_sync()
499 mutex_unlock(&tscs454->sub_ram.lock); in coeff_ram_sync()
503 mutex_unlock(&tscs454->sub_ram.lock); in coeff_ram_sync()
627 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in set_sysclk() local
633 if (tscs454->sysclk_src_id < PLL_INPUT_BCLK) in set_sysclk()
634 freq = clk_get_rate(tscs454->sysclk); in set_sysclk()
636 freq = tscs454->bclk_freq; in set_sysclk()
679 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in pll_connected() local
683 mutex_lock(&tscs454->pll1.lock); in pll_connected()
684 users = tscs454->pll1.users; in pll_connected()
685 mutex_unlock(&tscs454->pll1.lock); in pll_connected()
689 mutex_lock(&tscs454->pll2.lock); in pll_connected()
690 users = tscs454->pll2.users; in pll_connected()
691 mutex_unlock(&tscs454->pll2.lock); in pll_connected()
708 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in pll_power_event() local
748 ret = coeff_ram_sync(component, tscs454); in pll_power_event()
810 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in aif_free() local
812 mutex_lock(&tscs454->aifs_status_lock); in aif_free()
816 set_aif_status_inactive(&tscs454->aifs_status, aif->id, playback); in aif_free()
819 aif->id, tscs454->aifs_status.streams); in aif_free()
821 if (!aif_active(&tscs454->aifs_status, aif->id)) { in aif_free()
829 if (!aifs_active(&tscs454->aifs_status)) { in aif_free()
831 tscs454->internal_rate.pll->id); in aif_free()
832 free_pll(tscs454->internal_rate.pll); in aif_free()
835 mutex_unlock(&tscs454->aifs_status_lock); in aif_free()
2637 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in tscs454_set_sysclk() local
2649 tscs454->bclk_freq = freq; in tscs454_set_sysclk()
2887 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in tscs454_set_dai_fmt() local
2888 struct aif *aif = &tscs454->aifs[dai->id]; in tscs454_set_dai_fmt()
3174 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in tscs454_hw_params() local
3176 struct aif *aif = &tscs454->aifs[dai->id]; in tscs454_hw_params()
3180 mutex_lock(&tscs454->aifs_status_lock); in tscs454_hw_params()
3185 if (!aif_active(&tscs454->aifs_status, aif->id)) { in tscs454_hw_params()
3187 aif->pll = &tscs454->pll1; in tscs454_hw_params()
3189 aif->pll = &tscs454->pll2; in tscs454_hw_params()
3197 if (!aifs_active(&tscs454->aifs_status)) { /* First active aif */ in tscs454_hw_params()
3200 tscs454->internal_rate.pll = &tscs454->pll1; in tscs454_hw_params()
3202 tscs454->internal_rate.pll = &tscs454->pll2; in tscs454_hw_params()
3205 tscs454->internal_rate.pll->id); in tscs454_hw_params()
3207 reserve_pll(tscs454->internal_rate.pll); in tscs454_hw_params()
3223 set_aif_status_active(&tscs454->aifs_status, aif->id, in tscs454_hw_params()
3227 aif->id, tscs454->aifs_status.streams); in tscs454_hw_params()
3231 mutex_unlock(&tscs454->aifs_status_lock); in tscs454_hw_params()
3240 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in tscs454_hw_free() local
3241 struct aif *aif = &tscs454->aifs[dai->id]; in tscs454_hw_free()
3252 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in tscs454_prepare() local
3253 struct aif *aif = &tscs454->aifs[dai->id]; in tscs454_prepare()
3284 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in tscs454_probe() local
3288 switch (tscs454->sysclk_src_id) { in tscs454_probe()
3314 if (tscs454->sysclk_src_id < PLL_INPUT_BCLK) in tscs454_probe()
3405 struct tscs454 *tscs454; in tscs454_i2c_probe() local
3409 tscs454 = devm_kzalloc(&i2c->dev, sizeof(*tscs454), GFP_KERNEL); in tscs454_i2c_probe()
3410 if (!tscs454) in tscs454_i2c_probe()
3413 ret = tscs454_data_init(tscs454, i2c); in tscs454_i2c_probe()
3417 i2c_set_clientdata(i2c, tscs454); in tscs454_i2c_probe()
3420 tscs454->sysclk = devm_clk_get(&i2c->dev, src_names[src]); in tscs454_i2c_probe()
3421 if (!IS_ERR(tscs454->sysclk)) { in tscs454_i2c_probe()
3423 } else if (PTR_ERR(tscs454->sysclk) != -ENOENT) { in tscs454_i2c_probe()
3424 ret = PTR_ERR(tscs454->sysclk); in tscs454_i2c_probe()
3430 tscs454->sysclk_src_id = src; in tscs454_i2c_probe()
3432 ret = regmap_write(tscs454->regmap, in tscs454_i2c_probe()
3438 regcache_mark_dirty(tscs454->regmap); in tscs454_i2c_probe()
3440 ret = regmap_register_patch(tscs454->regmap, tscs454_patch, in tscs454_i2c_probe()
3447 regmap_write(tscs454->regmap, R_PAGESEL, 0x00); in tscs454_i2c_probe()