Lines Matching refs:cs35l45

26 	struct cs35l45_private *cs35l45 = snd_soc_component_get_drvdata(component);  in cs35l45_global_en_ev()  local
28 dev_dbg(cs35l45->dev, "%s event : %x\n", __func__, event); in cs35l45_global_en_ev()
32 regmap_write(cs35l45->regmap, CS35L45_GLOBAL_ENABLES, in cs35l45_global_en_ev()
40 regmap_write(cs35l45->regmap, CS35L45_GLOBAL_ENABLES, 0); in cs35l45_global_en_ev()
224 static int cs35l45_set_pll(struct cs35l45_private *cs35l45, unsigned int freq) in cs35l45_set_pll() argument
231 dev_err(cs35l45->dev, "Invalid freq: %u\n", freq); in cs35l45_set_pll()
235 regmap_read(cs35l45->regmap, CS35L45_REFCLK_INPUT, &val); in cs35l45_set_pll()
240 regmap_set_bits(cs35l45->regmap, CS35L45_REFCLK_INPUT, CS35L45_PLL_OPEN_LOOP_MASK); in cs35l45_set_pll()
241 regmap_update_bits(cs35l45->regmap, CS35L45_REFCLK_INPUT, in cs35l45_set_pll()
244 regmap_clear_bits(cs35l45->regmap, CS35L45_REFCLK_INPUT, CS35L45_PLL_REFCLK_EN_MASK); in cs35l45_set_pll()
245 regmap_clear_bits(cs35l45->regmap, CS35L45_REFCLK_INPUT, CS35L45_PLL_OPEN_LOOP_MASK); in cs35l45_set_pll()
246 regmap_set_bits(cs35l45->regmap, CS35L45_REFCLK_INPUT, CS35L45_PLL_REFCLK_EN_MASK); in cs35l45_set_pll()
253 struct cs35l45_private *cs35l45 = snd_soc_component_get_drvdata(codec_dai->component); in cs35l45_asp_set_fmt() local
260 dev_err(cs35l45->dev, "Invalid DAI clocking\n"); in cs35l45_asp_set_fmt()
272 dev_err(cs35l45->dev, "Invalid DAI format\n"); in cs35l45_asp_set_fmt()
294 dev_warn(cs35l45->dev, "Invalid DAI clock polarity\n"); in cs35l45_asp_set_fmt()
298 regmap_update_bits(cs35l45->regmap, CS35L45_ASP_CONTROL2, in cs35l45_asp_set_fmt()
313 struct cs35l45_private *cs35l45 = snd_soc_component_get_drvdata(dai->component); in cs35l45_asp_hw_params() local
331 dev_warn(cs35l45->dev, "Unsupported sample rate (%d)\n", in cs35l45_asp_hw_params()
336 regmap_update_bits(cs35l45->regmap, CS35L45_GLOBAL_SAMPLE_RATE, in cs35l45_asp_hw_params()
342 if (cs35l45->slot_width) in cs35l45_asp_hw_params()
343 asp_width = cs35l45->slot_width; in cs35l45_asp_hw_params()
348 regmap_update_bits(cs35l45->regmap, CS35L45_ASP_CONTROL2, in cs35l45_asp_hw_params()
352 regmap_update_bits(cs35l45->regmap, CS35L45_ASP_DATA_CONTROL5, in cs35l45_asp_hw_params()
356 regmap_update_bits(cs35l45->regmap, CS35L45_ASP_CONTROL2, in cs35l45_asp_hw_params()
360 regmap_update_bits(cs35l45->regmap, CS35L45_ASP_DATA_CONTROL1, in cs35l45_asp_hw_params()
365 if (cs35l45->sysclk_set) in cs35l45_asp_hw_params()
369 regmap_read(cs35l45->regmap, CS35L45_ASP_CONTROL2, &asp_fmt); in cs35l45_asp_hw_params()
377 cs35l45->slot_count, slot_multiple); in cs35l45_asp_hw_params()
379 return cs35l45_set_pll(cs35l45, bclk); in cs35l45_asp_hw_params()
386 struct cs35l45_private *cs35l45 = snd_soc_component_get_drvdata(dai->component); in cs35l45_asp_set_tdm_slot() local
391 cs35l45->slot_width = slot_width; in cs35l45_asp_set_tdm_slot()
392 cs35l45->slot_count = slots; in cs35l45_asp_set_tdm_slot()
400 struct cs35l45_private *cs35l45 = snd_soc_component_get_drvdata(dai->component); in cs35l45_asp_set_sysclk() local
404 dev_err(cs35l45->dev, "Invalid clk_id %d\n", clk_id); in cs35l45_asp_set_sysclk()
408 cs35l45->sysclk_set = false; in cs35l45_asp_set_sysclk()
412 ret = cs35l45_set_pll(cs35l45, freq); in cs35l45_asp_set_sysclk()
416 cs35l45->sysclk_set = true; in cs35l45_asp_set_sysclk()
423 struct cs35l45_private *cs35l45 = snd_soc_component_get_drvdata(dai->component); in cs35l45_mute_stream() local
429 regmap_read(cs35l45->regmap, CS35L45_GLOBAL_SAMPLE_RATE, &global_fs); in cs35l45_mute_stream()
443 regmap_read(cs35l45->regmap, CS35L45_AMP_PCM_HPF_TST, &val); in cs35l45_mute_stream()
454 regmap_multi_reg_write(cs35l45->regmap, hpf_override_seq, in cs35l45_mute_stream()
509 struct cs35l45_private *cs35l45 = dev_get_drvdata(dev); in cs35l45_runtime_suspend() local
511 regcache_cache_only(cs35l45->regmap, true); in cs35l45_runtime_suspend()
513 dev_dbg(cs35l45->dev, "Runtime suspended\n"); in cs35l45_runtime_suspend()
520 struct cs35l45_private *cs35l45 = dev_get_drvdata(dev); in cs35l45_runtime_resume() local
523 dev_dbg(cs35l45->dev, "Runtime resume\n"); in cs35l45_runtime_resume()
525 regcache_cache_only(cs35l45->regmap, false); in cs35l45_runtime_resume()
526 ret = regcache_sync(cs35l45->regmap); in cs35l45_runtime_resume()
528 dev_warn(cs35l45->dev, "regcache_sync failed: %d\n", ret); in cs35l45_runtime_resume()
531 regmap_clear_bits(cs35l45->regmap, CS35L45_ERROR_RELEASE, CS35L45_GLOBAL_ERR_RLS_MASK); in cs35l45_runtime_resume()
532 regmap_set_bits(cs35l45->regmap, CS35L45_ERROR_RELEASE, CS35L45_GLOBAL_ERR_RLS_MASK); in cs35l45_runtime_resume()
533 regmap_clear_bits(cs35l45->regmap, CS35L45_ERROR_RELEASE, CS35L45_GLOBAL_ERR_RLS_MASK); in cs35l45_runtime_resume()
537 static int cs35l45_apply_property_config(struct cs35l45_private *cs35l45) in cs35l45_apply_property_config() argument
541 if (device_property_read_u32(cs35l45->dev, in cs35l45_apply_property_config()
543 regmap_update_bits(cs35l45->regmap, CS35L45_ASP_CONTROL3, in cs35l45_apply_property_config()
551 static int cs35l45_initialize(struct cs35l45_private *cs35l45) in cs35l45_initialize() argument
553 struct device *dev = cs35l45->dev; in cs35l45_initialize()
558 ret = regmap_read_poll_timeout(cs35l45->regmap, CS35L45_IRQ1_EINT_4, sts, in cs35l45_initialize()
562 dev_err(cs35l45->dev, "Timeout waiting for OTP boot\n"); in cs35l45_initialize()
566 ret = regmap_bulk_read(cs35l45->regmap, CS35L45_DEVID, dev_id, ARRAY_SIZE(dev_id)); in cs35l45_initialize()
568 dev_err(cs35l45->dev, "Get Device ID failed: %d\n", ret); in cs35l45_initialize()
576 dev_err(cs35l45->dev, "Bad DEVID 0x%x\n", dev_id[0]); in cs35l45_initialize()
580 dev_info(cs35l45->dev, "Cirrus Logic CS35L45: REVID %02X OTPID %02X\n", in cs35l45_initialize()
583 regmap_write(cs35l45->regmap, CS35L45_IRQ1_EINT_4, in cs35l45_initialize()
586 ret = cs35l45_apply_patch(cs35l45); in cs35l45_initialize()
592 ret = cs35l45_apply_property_config(cs35l45); in cs35l45_initialize()
596 pm_runtime_set_autosuspend_delay(cs35l45->dev, 3000); in cs35l45_initialize()
597 pm_runtime_use_autosuspend(cs35l45->dev); in cs35l45_initialize()
598 pm_runtime_set_active(cs35l45->dev); in cs35l45_initialize()
599 pm_runtime_enable(cs35l45->dev); in cs35l45_initialize()
604 int cs35l45_probe(struct cs35l45_private *cs35l45) in cs35l45_probe() argument
606 struct device *dev = cs35l45->dev; in cs35l45_probe()
609 cs35l45->vdd_batt = devm_regulator_get(dev, "vdd-batt"); in cs35l45_probe()
610 if (IS_ERR(cs35l45->vdd_batt)) in cs35l45_probe()
611 return dev_err_probe(dev, PTR_ERR(cs35l45->vdd_batt), in cs35l45_probe()
614 cs35l45->vdd_a = devm_regulator_get(dev, "vdd-a"); in cs35l45_probe()
615 if (IS_ERR(cs35l45->vdd_a)) in cs35l45_probe()
616 return dev_err_probe(dev, PTR_ERR(cs35l45->vdd_a), in cs35l45_probe()
620 ret = regulator_enable(cs35l45->vdd_batt); in cs35l45_probe()
624 ret = regulator_enable(cs35l45->vdd_a); in cs35l45_probe()
629 cs35l45->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in cs35l45_probe()
630 if (IS_ERR(cs35l45->reset_gpio)) { in cs35l45_probe()
631 ret = PTR_ERR(cs35l45->reset_gpio); in cs35l45_probe()
632 cs35l45->reset_gpio = NULL; in cs35l45_probe()
641 if (cs35l45->reset_gpio) { in cs35l45_probe()
643 gpiod_set_value_cansleep(cs35l45->reset_gpio, 1); in cs35l45_probe()
648 ret = cs35l45_initialize(cs35l45); in cs35l45_probe()
661 gpiod_set_value_cansleep(cs35l45->reset_gpio, 0); in cs35l45_probe()
663 regulator_disable(cs35l45->vdd_a); in cs35l45_probe()
664 regulator_disable(cs35l45->vdd_batt); in cs35l45_probe()
670 void cs35l45_remove(struct cs35l45_private *cs35l45) in cs35l45_remove() argument
672 pm_runtime_disable(cs35l45->dev); in cs35l45_remove()
674 gpiod_set_value_cansleep(cs35l45->reset_gpio, 0); in cs35l45_remove()
675 regulator_disable(cs35l45->vdd_a); in cs35l45_remove()
677 regulator_disable(cs35l45->vdd_batt); in cs35l45_remove()