Lines Matching defs:cs42l42

2 // cs42l42-sdw.c -- CS42L42 ALSA SoC audio driver SoundWire driver
23 #include "cs42l42.h"
55 struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(dai->component);
57 if (!cs42l42->init_done)
67 struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(dai->component);
77 cs42l42->sample_rate = params_rate(params);
86 ret = sdw_stream_add_slave(cs42l42->sdw_peripheral, &stream_config, &port_config, 1,
101 struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(dai->component);
103 dev_dbg(dai->dev, "dai_prepare: sclk=%u rate=%u\n", cs42l42->sclk, cs42l42->sample_rate);
105 if (!cs42l42->sclk || !cs42l42->sample_rate)
114 return cs42l42_pll_config(dai->component, cs42l42->sclk, cs42l42->sample_rate);
120 struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(dai->component);
123 sdw_stream_remove_slave(cs42l42->sdw_peripheral, sdw_stream);
124 cs42l42->sample_rate = 0;
133 struct cs42l42_private *cs42l42 = dev_get_drvdata(&slave->dev);
142 dev_dbg(cs42l42->dev, "Prep Port pdn_mask:%x\n", pdn_mask);
143 regmap_clear_bits(cs42l42->regmap, CS42L42_PWR_CTL1, pdn_mask);
146 dev_dbg(cs42l42->dev, "Deprep Port pdn_mask:%x\n", pdn_mask);
147 regmap_set_bits(cs42l42->regmap, CS42L42_PWR_CTL1, pdn_mask);
178 .name = "cs42l42-sdw",
283 /* Initialise cs42l42 using SoundWire - this is only called once, during initialisation */
286 struct cs42l42_private *cs42l42 = dev_get_drvdata(&peripheral->dev);
289 regcache_cache_only(cs42l42->regmap, false);
291 ret = cs42l42_init(cs42l42);
293 regcache_cache_only(cs42l42->regmap, true);
298 ret = regcache_sync(cs42l42->regmap);
300 dev_warn(cs42l42->dev, "Failed to sync cache: %d\n", ret);
303 regmap_clear_bits(cs42l42->regmap, CS42L42_PWR_CTL3, CS42L42_SW_CLK_STP_STAT_SEL_MASK);
307 pm_runtime_put_autosuspend(cs42l42->dev);
312 struct cs42l42_private *cs42l42 = dev_get_drvdata(&peripheral->dev);
316 ports = devm_kcalloc(cs42l42->dev, 2, sizeof(*ports), GFP_KERNEL);
343 struct cs42l42_private *cs42l42 = dev_get_drvdata(&peripheral->dev);
347 dev_dbg(cs42l42->dev, "ATTACHED\n");
355 if (cs42l42->sdw_waiting_first_unattach)
363 if (!cs42l42->init_done)
367 dev_dbg(cs42l42->dev, "UNATTACHED\n");
369 if (cs42l42->sdw_waiting_first_unattach) {
374 cs42l42->sdw_waiting_first_unattach = false;
375 gpiod_set_value_cansleep(cs42l42->reset_gpio, 1);
389 struct cs42l42_private *cs42l42 = dev_get_drvdata(&peripheral->dev);
392 /* The cs42l42 cannot support a glitchless SWIRE_CLK change. */
393 if ((new_sclk != cs42l42->sclk) && cs42l42->stream_use) {
394 dev_warn(cs42l42->dev, "Rejected SCLK change while audio active\n");
398 cs42l42->sclk = new_sclk;
400 dev_dbg(cs42l42->dev, "bus_config: sclk=%u c=%u r=%u\n",
401 cs42l42->sclk, params->col, params->row);
416 struct cs42l42_private *cs42l42 = dev_get_drvdata(dev);
420 if (!cs42l42->init_done)
424 regcache_cache_only(cs42l42->regmap, true);
433 static int __maybe_unused cs42l42_sdw_handle_unattach(struct cs42l42_private *cs42l42)
435 struct sdw_slave *peripheral = cs42l42->sdw_peripheral;
454 regmap_multi_reg_write_bypassed(cs42l42->regmap,
458 regcache_mark_dirty(cs42l42->regmap);
466 struct cs42l42_private *cs42l42 = dev_get_drvdata(dev);
472 if (!cs42l42->init_done)
475 ret = cs42l42_sdw_handle_unattach(cs42l42);
479 dbnce = max(cs42l42->ts_dbnc_rise, cs42l42->ts_dbnc_fall);
485 regcache_cache_only(cs42l42->regmap, false);
488 regcache_sync_region(cs42l42->regmap, CS42L42_MIC_DET_CTL1, CS42L42_MIC_DET_CTL1);
489 regcache_sync(cs42l42->regmap);
496 struct cs42l42_private *cs42l42 = dev_get_drvdata(dev);
507 ret = cs42l42_sdw_handle_unattach(cs42l42);
520 struct cs42l42_private *cs42l42;
525 cs42l42 = devm_kzalloc(dev, sizeof(*cs42l42), GFP_KERNEL);
526 if (!cs42l42)
564 cs42l42->dev = dev;
565 cs42l42->regmap = regmap;
566 cs42l42->sdw_peripheral = peripheral;
567 cs42l42->irq = irq;
568 cs42l42->devid = CS42L42_CHIP_ID;
574 pm_runtime_set_autosuspend_delay(cs42l42->dev, 3000);
575 pm_runtime_use_autosuspend(cs42l42->dev);
576 pm_runtime_mark_last_busy(cs42l42->dev);
577 pm_runtime_set_active(cs42l42->dev);
578 pm_runtime_get_noresume(cs42l42->dev);
579 pm_runtime_enable(cs42l42->dev);
581 ret = cs42l42_common_probe(cs42l42, component_drv, &cs42l42_sdw_dai);
590 struct cs42l42_private *cs42l42 = dev_get_drvdata(&peripheral->dev);
592 cs42l42_common_remove(cs42l42);
593 pm_runtime_disable(cs42l42->dev);
611 .name = "cs42l42-sdw",