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
743 ret = coeff_ram_sync(component, tscs454); in pll_power_event()
805 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in aif_free() local
807 mutex_lock(&tscs454->aifs_status_lock); in aif_free()
811 set_aif_status_inactive(&tscs454->aifs_status, aif->id, playback); in aif_free()
814 aif->id, tscs454->aifs_status.streams); in aif_free()
816 if (!aif_active(&tscs454->aifs_status, aif->id)) { in aif_free()
824 if (!aifs_active(&tscs454->aifs_status)) { in aif_free()
826 tscs454->internal_rate.pll->id); in aif_free()
827 free_pll(tscs454->internal_rate.pll); in aif_free()
830 mutex_unlock(&tscs454->aifs_status_lock); in aif_free()
2632 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in tscs454_set_sysclk() local
2644 tscs454->bclk_freq = freq; in tscs454_set_sysclk()
2882 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in tscs454_set_dai_fmt() local
2883 struct aif *aif = &tscs454->aifs[dai->id]; in tscs454_set_dai_fmt()
3170 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in tscs454_hw_params() local
3172 struct aif *aif = &tscs454->aifs[dai->id]; in tscs454_hw_params()
3176 mutex_lock(&tscs454->aifs_status_lock); in tscs454_hw_params()
3181 if (!aif_active(&tscs454->aifs_status, aif->id)) { in tscs454_hw_params()
3183 aif->pll = &tscs454->pll1; in tscs454_hw_params()
3185 aif->pll = &tscs454->pll2; in tscs454_hw_params()
3193 if (!aifs_active(&tscs454->aifs_status)) { /* First active aif */ in tscs454_hw_params()
3196 tscs454->internal_rate.pll = &tscs454->pll1; in tscs454_hw_params()
3198 tscs454->internal_rate.pll = &tscs454->pll2; in tscs454_hw_params()
3201 tscs454->internal_rate.pll->id); in tscs454_hw_params()
3203 reserve_pll(tscs454->internal_rate.pll); in tscs454_hw_params()
3219 set_aif_status_active(&tscs454->aifs_status, aif->id, in tscs454_hw_params()
3223 aif->id, tscs454->aifs_status.streams); in tscs454_hw_params()
3227 mutex_unlock(&tscs454->aifs_status_lock); in tscs454_hw_params()
3236 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in tscs454_hw_free() local
3237 struct aif *aif = &tscs454->aifs[dai->id]; in tscs454_hw_free()
3248 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in tscs454_prepare() local
3249 struct aif *aif = &tscs454->aifs[dai->id]; in tscs454_prepare()
3280 struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); in tscs454_probe() local
3284 switch (tscs454->sysclk_src_id) { in tscs454_probe()
3310 if (tscs454->sysclk_src_id < PLL_INPUT_BCLK) in tscs454_probe()
3401 struct tscs454 *tscs454; in tscs454_i2c_probe() local
3405 tscs454 = devm_kzalloc(&i2c->dev, sizeof(*tscs454), GFP_KERNEL); in tscs454_i2c_probe()
3406 if (!tscs454) in tscs454_i2c_probe()
3409 ret = tscs454_data_init(tscs454, i2c); in tscs454_i2c_probe()
3413 i2c_set_clientdata(i2c, tscs454); in tscs454_i2c_probe()
3416 tscs454->sysclk = devm_clk_get(&i2c->dev, src_names[src]); in tscs454_i2c_probe()
3417 if (!IS_ERR(tscs454->sysclk)) { in tscs454_i2c_probe()
3419 } else if (PTR_ERR(tscs454->sysclk) != -ENOENT) { in tscs454_i2c_probe()
3420 ret = PTR_ERR(tscs454->sysclk); in tscs454_i2c_probe()
3426 tscs454->sysclk_src_id = src; in tscs454_i2c_probe()
3428 ret = regmap_write(tscs454->regmap, in tscs454_i2c_probe()
3434 regcache_mark_dirty(tscs454->regmap); in tscs454_i2c_probe()
3436 ret = regmap_register_patch(tscs454->regmap, tscs454_patch, in tscs454_i2c_probe()
3443 regmap_write(tscs454->regmap, R_PAGESEL, 0x00); in tscs454_i2c_probe()