Lines Matching refs:cs42l42
55 struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(dai->component); in cs42l42_sdw_dai_startup() local
57 if (!cs42l42->init_done) in cs42l42_sdw_dai_startup()
67 struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(dai->component); in cs42l42_sdw_dai_hw_params() local
77 cs42l42->sample_rate = params_rate(params); in cs42l42_sdw_dai_hw_params()
86 ret = sdw_stream_add_slave(cs42l42->sdw_peripheral, &stream_config, &port_config, 1, in cs42l42_sdw_dai_hw_params()
101 struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(dai->component); in cs42l42_sdw_dai_prepare() local
103 dev_dbg(dai->dev, "dai_prepare: sclk=%u rate=%u\n", cs42l42->sclk, cs42l42->sample_rate); in cs42l42_sdw_dai_prepare()
105 if (!cs42l42->sclk || !cs42l42->sample_rate) in cs42l42_sdw_dai_prepare()
114 return cs42l42_pll_config(dai->component, cs42l42->sclk, cs42l42->sample_rate); in cs42l42_sdw_dai_prepare()
120 struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(dai->component); in cs42l42_sdw_dai_hw_free() local
123 sdw_stream_remove_slave(cs42l42->sdw_peripheral, sdw_stream); in cs42l42_sdw_dai_hw_free()
124 cs42l42->sample_rate = 0; in cs42l42_sdw_dai_hw_free()
133 struct cs42l42_private *cs42l42 = dev_get_drvdata(&slave->dev); in cs42l42_sdw_port_prep() local
142 dev_dbg(cs42l42->dev, "Prep Port pdn_mask:%x\n", pdn_mask); in cs42l42_sdw_port_prep()
143 regmap_clear_bits(cs42l42->regmap, CS42L42_PWR_CTL1, pdn_mask); in cs42l42_sdw_port_prep()
146 dev_dbg(cs42l42->dev, "Deprep Port pdn_mask:%x\n", pdn_mask); in cs42l42_sdw_port_prep()
147 regmap_set_bits(cs42l42->regmap, CS42L42_PWR_CTL1, pdn_mask); in cs42l42_sdw_port_prep()
286 struct cs42l42_private *cs42l42 = dev_get_drvdata(&peripheral->dev); in cs42l42_sdw_init() local
289 regcache_cache_only(cs42l42->regmap, false); in cs42l42_sdw_init()
291 ret = cs42l42_init(cs42l42); in cs42l42_sdw_init()
293 regcache_cache_only(cs42l42->regmap, true); in cs42l42_sdw_init()
298 ret = regcache_sync(cs42l42->regmap); in cs42l42_sdw_init()
300 dev_warn(cs42l42->dev, "Failed to sync cache: %d\n", ret); in cs42l42_sdw_init()
303 regmap_clear_bits(cs42l42->regmap, CS42L42_PWR_CTL3, CS42L42_SW_CLK_STP_STAT_SEL_MASK); in cs42l42_sdw_init()
307 pm_runtime_put_autosuspend(cs42l42->dev); in cs42l42_sdw_init()
312 struct cs42l42_private *cs42l42 = dev_get_drvdata(&peripheral->dev); in cs42l42_sdw_read_prop() local
316 ports = devm_kcalloc(cs42l42->dev, 2, sizeof(*ports), GFP_KERNEL); in cs42l42_sdw_read_prop()
343 struct cs42l42_private *cs42l42 = dev_get_drvdata(&peripheral->dev); in cs42l42_sdw_update_status() local
347 dev_dbg(cs42l42->dev, "ATTACHED\n"); in cs42l42_sdw_update_status()
355 if (cs42l42->sdw_waiting_first_unattach) in cs42l42_sdw_update_status()
363 if (!cs42l42->init_done) in cs42l42_sdw_update_status()
367 dev_dbg(cs42l42->dev, "UNATTACHED\n"); in cs42l42_sdw_update_status()
369 if (cs42l42->sdw_waiting_first_unattach) { in cs42l42_sdw_update_status()
374 cs42l42->sdw_waiting_first_unattach = false; in cs42l42_sdw_update_status()
375 gpiod_set_value_cansleep(cs42l42->reset_gpio, 1); in cs42l42_sdw_update_status()
389 struct cs42l42_private *cs42l42 = dev_get_drvdata(&peripheral->dev); in cs42l42_sdw_bus_config() local
393 if ((new_sclk != cs42l42->sclk) && cs42l42->stream_use) { in cs42l42_sdw_bus_config()
394 dev_warn(cs42l42->dev, "Rejected SCLK change while audio active\n"); in cs42l42_sdw_bus_config()
398 cs42l42->sclk = new_sclk; in cs42l42_sdw_bus_config()
400 dev_dbg(cs42l42->dev, "bus_config: sclk=%u c=%u r=%u\n", in cs42l42_sdw_bus_config()
401 cs42l42->sclk, params->col, params->row); in cs42l42_sdw_bus_config()
416 struct cs42l42_private *cs42l42 = dev_get_drvdata(dev); in cs42l42_sdw_runtime_suspend() local
420 if (!cs42l42->init_done) in cs42l42_sdw_runtime_suspend()
424 regcache_cache_only(cs42l42->regmap, true); in cs42l42_sdw_runtime_suspend()
433 static int __maybe_unused cs42l42_sdw_handle_unattach(struct cs42l42_private *cs42l42) in cs42l42_sdw_handle_unattach() argument
435 struct sdw_slave *peripheral = cs42l42->sdw_peripheral; in cs42l42_sdw_handle_unattach()
454 regmap_multi_reg_write_bypassed(cs42l42->regmap, in cs42l42_sdw_handle_unattach()
458 regcache_mark_dirty(cs42l42->regmap); in cs42l42_sdw_handle_unattach()
466 struct cs42l42_private *cs42l42 = dev_get_drvdata(dev); in cs42l42_sdw_runtime_resume() local
472 if (!cs42l42->init_done) in cs42l42_sdw_runtime_resume()
475 ret = cs42l42_sdw_handle_unattach(cs42l42); in cs42l42_sdw_runtime_resume()
479 dbnce = max(cs42l42->ts_dbnc_rise, cs42l42->ts_dbnc_fall); in cs42l42_sdw_runtime_resume()
485 regcache_cache_only(cs42l42->regmap, false); in cs42l42_sdw_runtime_resume()
488 regcache_sync_region(cs42l42->regmap, CS42L42_MIC_DET_CTL1, CS42L42_MIC_DET_CTL1); in cs42l42_sdw_runtime_resume()
489 regcache_sync(cs42l42->regmap); in cs42l42_sdw_runtime_resume()
496 struct cs42l42_private *cs42l42 = dev_get_drvdata(dev); in cs42l42_sdw_resume() local
507 ret = cs42l42_sdw_handle_unattach(cs42l42); in cs42l42_sdw_resume()
520 struct cs42l42_private *cs42l42; in cs42l42_sdw_probe() local
525 cs42l42 = devm_kzalloc(dev, sizeof(*cs42l42), GFP_KERNEL); in cs42l42_sdw_probe()
526 if (!cs42l42) in cs42l42_sdw_probe()
564 cs42l42->dev = dev; in cs42l42_sdw_probe()
565 cs42l42->regmap = regmap; in cs42l42_sdw_probe()
566 cs42l42->sdw_peripheral = peripheral; in cs42l42_sdw_probe()
567 cs42l42->irq = irq; in cs42l42_sdw_probe()
568 cs42l42->devid = CS42L42_CHIP_ID; in cs42l42_sdw_probe()
574 pm_runtime_set_autosuspend_delay(cs42l42->dev, 3000); in cs42l42_sdw_probe()
575 pm_runtime_use_autosuspend(cs42l42->dev); in cs42l42_sdw_probe()
576 pm_runtime_mark_last_busy(cs42l42->dev); in cs42l42_sdw_probe()
577 pm_runtime_set_active(cs42l42->dev); in cs42l42_sdw_probe()
578 pm_runtime_get_noresume(cs42l42->dev); in cs42l42_sdw_probe()
579 pm_runtime_enable(cs42l42->dev); in cs42l42_sdw_probe()
581 ret = cs42l42_common_probe(cs42l42, component_drv, &cs42l42_sdw_dai); in cs42l42_sdw_probe()
590 struct cs42l42_private *cs42l42 = dev_get_drvdata(&peripheral->dev); in cs42l42_sdw_remove() local
592 cs42l42_common_remove(cs42l42); in cs42l42_sdw_remove()
593 pm_runtime_disable(cs42l42->dev); in cs42l42_sdw_remove()