Lines Matching refs:ak4375

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