Lines Matching full:ak4375
254 struct ak4375_priv *ak4375 = snd_soc_component_get_drvdata(component); in ak4375_hw_params() local
257 ak4375->rate = params_rate(params); in ak4375_hw_params()
259 if (ak4375->rate <= 96000) in ak4375_hw_params()
260 ak4375->pld = 0; in ak4375_hw_params()
262 ak4375->pld = 1; in ak4375_hw_params()
264 freq_in = 32 * ak4375->rate / (ak4375->pld + 1); in ak4375_hw_params()
266 if ((ak4375->rate % 8000) == 0) in ak4375_hw_params()
278 struct ak4375_priv *ak4375 = snd_soc_component_get_drvdata(component); in ak4375_dai_set_pll() local
286 switch (ak4375->rate) { in ak4375_dai_set_pll()
324 if (ak4375->rate <= 24000) { in ak4375_dai_set_pll()
326 mclk = 512 * ak4375->rate; in ak4375_dai_set_pll()
329 } else if (ak4375->rate <= 96000) { in ak4375_dai_set_pll()
331 mclk = 256 * ak4375->rate; in ak4375_dai_set_pll()
336 mclk = 128 * ak4375->rate; in ak4375_dai_set_pll()
346 (ak4375->pld & 0xff00) >> 8); in ak4375_dai_set_pll()
348 ak4375->pld & 0x00ff); in ak4375_dai_set_pll()
361 dev_dbg(ak4375->dev, "rate=%d mclk=%d f_in=%d f_out=%d PLD=%d PLM=%d MDIV=%d DIV=%d\n", in ak4375_dai_set_pll()
362 ak4375->rate, mclk, freq_in, freq_out, ak4375->pld, plm, mdiv, div); in ak4375_dai_set_pll()
370 struct ak4375_priv *ak4375 = snd_soc_component_get_drvdata(component); in ak4375_mute() local
373 dev_dbg(ak4375->dev, "mute=%d val=%d\n", mute, val); in ak4375_mute()
376 ak4375->mute_save = val & DACMUTE_MASK; in ak4375_mute()
379 val |= ak4375->mute_save; in ak4375_mute()
402 .name = "ak4375-hifi",
415 static void ak4375_power_off(struct ak4375_priv *ak4375) in ak4375_power_off() argument
417 gpiod_set_value_cansleep(ak4375->pdn_gpiod, 0); in ak4375_power_off()
420 regulator_bulk_disable(ARRAY_SIZE(ak4375->supplies), ak4375->supplies); in ak4375_power_off()
423 static int ak4375_power_on(struct ak4375_priv *ak4375) in ak4375_power_on() argument
427 ret = regulator_bulk_enable(ARRAY_SIZE(ak4375->supplies), ak4375->supplies); in ak4375_power_on()
429 dev_err(ak4375->dev, "Failed to enable regulators: %d\n", ret); in ak4375_power_on()
435 gpiod_set_value_cansleep(ak4375->pdn_gpiod, 1); in ak4375_power_on()
443 struct ak4375_priv *ak4375 = dev_get_drvdata(dev); in ak4375_runtime_suspend() local
445 regcache_cache_only(ak4375->regmap, true); in ak4375_runtime_suspend()
446 ak4375_power_off(ak4375); in ak4375_runtime_suspend()
453 struct ak4375_priv *ak4375 = dev_get_drvdata(dev); in ak4375_runtime_resume() local
456 ret = ak4375_power_on(ak4375); in ak4375_runtime_resume()
460 regcache_cache_only(ak4375->regmap, false); in ak4375_runtime_resume()
461 regcache_mark_dirty(ak4375->regmap); in ak4375_runtime_resume()
463 return regcache_sync(ak4375->regmap); in ak4375_runtime_resume()
500 struct ak4375_priv *ak4375; in ak4375_i2c_probe() local
505 ak4375 = devm_kzalloc(&i2c->dev, sizeof(*ak4375), GFP_KERNEL); in ak4375_i2c_probe()
506 if (!ak4375) in ak4375_i2c_probe()
509 ak4375->regmap = devm_regmap_init_i2c(i2c, &ak4375_regmap); in ak4375_i2c_probe()
510 if (IS_ERR(ak4375->regmap)) in ak4375_i2c_probe()
511 return PTR_ERR(ak4375->regmap); in ak4375_i2c_probe()
513 i2c_set_clientdata(i2c, ak4375); in ak4375_i2c_probe()
514 ak4375->dev = &i2c->dev; in ak4375_i2c_probe()
519 ak4375->supplies[i].supply = supply_names[i]; in ak4375_i2c_probe()
521 ret = devm_regulator_bulk_get(ak4375->dev, ARRAY_SIZE(ak4375->supplies), ak4375->supplies); in ak4375_i2c_probe()
523 dev_err(ak4375->dev, "Failed to get regulators: %d\n", ret); in ak4375_i2c_probe()
527 ak4375->pdn_gpiod = devm_gpiod_get_optional(ak4375->dev, "pdn", GPIOD_OUT_LOW); in ak4375_i2c_probe()
528 if (IS_ERR(ak4375->pdn_gpiod)) in ak4375_i2c_probe()
529 return dev_err_probe(ak4375->dev, PTR_ERR(ak4375->pdn_gpiod), in ak4375_i2c_probe()
532 ret = ak4375_power_on(ak4375); in ak4375_i2c_probe()
537 regcache_cache_bypass(ak4375->regmap, true); in ak4375_i2c_probe()
539 ret = regmap_read(ak4375->regmap, AK4375_15_AUDIO_IF_FORMAT, &deviceid); in ak4375_i2c_probe()
541 dev_err(ak4375->dev, "unable to read DEVICEID!\n"); in ak4375_i2c_probe()
545 regcache_cache_bypass(ak4375->regmap, false); in ak4375_i2c_probe()
551 dev_err(ak4375->dev, "found untested AK4331\n"); in ak4375_i2c_probe()
554 dev_dbg(ak4375->dev, "found AK4375\n"); in ak4375_i2c_probe()
557 dev_dbg(ak4375->dev, "found AK4375A\n"); in ak4375_i2c_probe()
560 dev_err(ak4375->dev, "found unsupported AK4376/A!\n"); in ak4375_i2c_probe()
563 dev_err(ak4375->dev, "found unsupported AK4377!\n"); in ak4375_i2c_probe()
566 dev_err(ak4375->dev, "unrecognized DEVICEID!\n"); in ak4375_i2c_probe()
570 pm_runtime_set_active(ak4375->dev); in ak4375_i2c_probe()
571 pm_runtime_enable(ak4375->dev); in ak4375_i2c_probe()
573 ret = devm_snd_soc_register_component(ak4375->dev, drvdata->comp_drv, in ak4375_i2c_probe()
576 dev_err(ak4375->dev, "Failed to register CODEC: %d\n", ret); in ak4375_i2c_probe()
589 { .compatible = "asahi-kasei,ak4375", .data = &ak4375_drvdata },
596 .name = "ak4375",
606 MODULE_DESCRIPTION("ASoC AK4375 DAC driver");