Lines Matching refs:wm8731

90 	struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component);  in wm8731_set_deemph()  local
96 if (wm8731->deemph) { in wm8731_set_deemph()
99 if (abs(wm8731_deemph[i] - wm8731->playback_fs) < in wm8731_set_deemph()
100 abs(wm8731_deemph[best] - wm8731->playback_fs)) in wm8731_set_deemph()
120 struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); in wm8731_get_deemph() local
122 ucontrol->value.integer.value[0] = wm8731->deemph; in wm8731_get_deemph()
131 struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); in wm8731_put_deemph() local
138 mutex_lock(&wm8731->lock); in wm8731_put_deemph()
139 if (wm8731->deemph != deemph) { in wm8731_put_deemph()
140 wm8731->deemph = deemph; in wm8731_put_deemph()
146 mutex_unlock(&wm8731->lock); in wm8731_put_deemph()
215 struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); in wm8731_check_osc() local
217 return wm8731->sysclk_type == WM8731_SYSCLK_XTAL; in wm8731_check_osc()
338 struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); in wm8731_hw_params() local
340 int i = get_coeff(wm8731->sysclk, params_rate(params)); in wm8731_hw_params()
344 wm8731->playback_fs = params_rate(params); in wm8731_hw_params()
386 struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); in wm8731_set_dai_sysclk() local
391 if (wm8731->mclk && clk_set_rate(wm8731->mclk, freq)) in wm8731_set_dai_sysclk()
393 wm8731->sysclk_type = clk_id; in wm8731_set_dai_sysclk()
401 wm8731->constraints = NULL; in wm8731_set_dai_sysclk()
404 wm8731->constraints = &wm8731_constraints_12000000; in wm8731_set_dai_sysclk()
408 wm8731->constraints = &wm8731_constraints_12288000_18432000; in wm8731_set_dai_sysclk()
412 wm8731->constraints = &wm8731_constraints_11289600_16934400; in wm8731_set_dai_sysclk()
418 wm8731->sysclk = freq; in wm8731_set_dai_sysclk()
488 struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); in wm8731_set_bias_level() local
494 if (wm8731->mclk) { in wm8731_set_bias_level()
495 ret = clk_prepare_enable(wm8731->mclk); in wm8731_set_bias_level()
504 ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies), in wm8731_set_bias_level()
505 wm8731->supplies); in wm8731_set_bias_level()
509 regcache_sync(wm8731->regmap); in wm8731_set_bias_level()
517 if (wm8731->mclk) in wm8731_set_bias_level()
518 clk_disable_unprepare(wm8731->mclk); in wm8731_set_bias_level()
520 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), in wm8731_set_bias_level()
521 wm8731->supplies); in wm8731_set_bias_level()
522 regcache_mark_dirty(wm8731->regmap); in wm8731_set_bias_level()
531 struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(dai->component); in wm8731_startup() local
533 if (wm8731->constraints) in wm8731_startup()
536 wm8731->constraints); in wm8731_startup()
573 struct wm8731_priv *wm8731) in wm8731_request_supplies() argument
577 for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++) in wm8731_request_supplies()
578 wm8731->supplies[i].supply = wm8731_supply_names[i]; in wm8731_request_supplies()
580 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(wm8731->supplies), in wm8731_request_supplies()
581 wm8731->supplies); in wm8731_request_supplies()
587 ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies), in wm8731_request_supplies()
588 wm8731->supplies); in wm8731_request_supplies()
597 static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731) in wm8731_hw_init() argument
601 ret = wm8731_reset(wm8731->regmap); in wm8731_hw_init()
608 regmap_write(wm8731->regmap, WM8731_PWR, 0x7f); in wm8731_hw_init()
611 regmap_update_bits(wm8731->regmap, WM8731_LOUT1V, 0x100, 0); in wm8731_hw_init()
612 regmap_update_bits(wm8731->regmap, WM8731_ROUT1V, 0x100, 0); in wm8731_hw_init()
613 regmap_update_bits(wm8731->regmap, WM8731_LINVOL, 0x100, 0); in wm8731_hw_init()
614 regmap_update_bits(wm8731->regmap, WM8731_RINVOL, 0x100, 0); in wm8731_hw_init()
617 regmap_update_bits(wm8731->regmap, WM8731_APANA, 0x8, 0); in wm8731_hw_init()
619 regcache_mark_dirty(wm8731->regmap); in wm8731_hw_init()
623 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); in wm8731_hw_init()
665 struct wm8731_priv *wm8731; in wm8731_spi_probe() local
668 wm8731 = devm_kzalloc(&spi->dev, sizeof(*wm8731), GFP_KERNEL); in wm8731_spi_probe()
669 if (wm8731 == NULL) in wm8731_spi_probe()
672 wm8731->mclk = devm_clk_get(&spi->dev, "mclk"); in wm8731_spi_probe()
673 if (IS_ERR(wm8731->mclk)) { in wm8731_spi_probe()
674 ret = PTR_ERR(wm8731->mclk); in wm8731_spi_probe()
676 wm8731->mclk = NULL; in wm8731_spi_probe()
685 mutex_init(&wm8731->lock); in wm8731_spi_probe()
687 spi_set_drvdata(spi, wm8731); in wm8731_spi_probe()
689 ret = wm8731_request_supplies(&spi->dev, wm8731); in wm8731_spi_probe()
693 wm8731->regmap = devm_regmap_init_spi(spi, &wm8731_regmap); in wm8731_spi_probe()
694 if (IS_ERR(wm8731->regmap)) { in wm8731_spi_probe()
695 ret = PTR_ERR(wm8731->regmap); in wm8731_spi_probe()
701 ret = wm8731_hw_init(&spi->dev, wm8731); in wm8731_spi_probe()
734 struct wm8731_priv *wm8731; in wm8731_i2c_probe() local
737 wm8731 = devm_kzalloc(&i2c->dev, sizeof(struct wm8731_priv), in wm8731_i2c_probe()
739 if (wm8731 == NULL) in wm8731_i2c_probe()
742 wm8731->mclk = devm_clk_get(&i2c->dev, "mclk"); in wm8731_i2c_probe()
743 if (IS_ERR(wm8731->mclk)) { in wm8731_i2c_probe()
744 ret = PTR_ERR(wm8731->mclk); in wm8731_i2c_probe()
746 wm8731->mclk = NULL; in wm8731_i2c_probe()
755 mutex_init(&wm8731->lock); in wm8731_i2c_probe()
757 i2c_set_clientdata(i2c, wm8731); in wm8731_i2c_probe()
759 ret = wm8731_request_supplies(&i2c->dev, wm8731); in wm8731_i2c_probe()
763 wm8731->regmap = devm_regmap_init_i2c(i2c, &wm8731_regmap); in wm8731_i2c_probe()
764 if (IS_ERR(wm8731->regmap)) { in wm8731_i2c_probe()
765 ret = PTR_ERR(wm8731->regmap); in wm8731_i2c_probe()
771 ret = wm8731_hw_init(&i2c->dev, wm8731); in wm8731_i2c_probe()