Lines Matching refs:wm8993

469 	struct wm8993_priv *wm8993 = snd_soc_component_get_drvdata(component);  in _wm8993_set_fll()  local
477 if (Fref == wm8993->fll_fref && Fout == wm8993->fll_fout) in _wm8993_set_fll()
483 wm8993->fll_fref = 0; in _wm8993_set_fll()
484 wm8993->fll_fout = 0; in _wm8993_set_fll()
552 try_wait_for_completion(&wm8993->fll_lock); in _wm8993_set_fll()
557 timeout = wait_for_completion_timeout(&wm8993->fll_lock, timeout); in _wm8993_set_fll()
563 wm8993->fll_fref = Fref; in _wm8993_set_fll()
564 wm8993->fll_fout = Fout; in _wm8993_set_fll()
565 wm8993->fll_src = source; in _wm8993_set_fll()
578 struct wm8993_priv *wm8993 = snd_soc_component_get_drvdata(component); in configure_clock() local
582 switch (wm8993->sysclk_source) { in configure_clock()
584 dev_dbg(component->dev, "Using %dHz MCLK\n", wm8993->mclk_rate); in configure_clock()
588 if (wm8993->mclk_rate > 13500000) { in configure_clock()
590 wm8993->sysclk_rate = wm8993->mclk_rate / 2; in configure_clock()
593 wm8993->sysclk_rate = wm8993->mclk_rate; in configure_clock()
600 wm8993->fll_fout); in configure_clock()
604 if (wm8993->fll_fout > 13500000) { in configure_clock()
606 wm8993->sysclk_rate = wm8993->fll_fout / 2; in configure_clock()
609 wm8993->sysclk_rate = wm8993->fll_fout; in configure_clock()
619 dev_dbg(component->dev, "CLK_SYS is %dHz\n", wm8993->sysclk_rate); in configure_clock()
975 struct wm8993_priv *wm8993 = snd_soc_component_get_drvdata(component); in wm8993_set_bias_level() local
992 ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies), in wm8993_set_bias_level()
993 wm8993->supplies); in wm8993_set_bias_level()
997 regcache_cache_only(wm8993->regmap, false); in wm8993_set_bias_level()
998 regcache_sync(wm8993->regmap); in wm8993_set_bias_level()
1015 if (!wm8993->pdata.lineout1_diff || in wm8993_set_bias_level()
1016 !wm8993->pdata.lineout2_diff) in wm8993_set_bias_level()
1056 regcache_cache_only(wm8993->regmap, true); in wm8993_set_bias_level()
1057 regcache_mark_dirty(wm8993->regmap); in wm8993_set_bias_level()
1059 regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), in wm8993_set_bias_level()
1060 wm8993->supplies); in wm8993_set_bias_level()
1071 struct wm8993_priv *wm8993 = snd_soc_component_get_drvdata(component); in wm8993_set_sysclk() local
1075 wm8993->mclk_rate = freq; in wm8993_set_sysclk()
1078 wm8993->sysclk_source = clk_id; in wm8993_set_sysclk()
1092 struct wm8993_priv *wm8993 = snd_soc_component_get_drvdata(component); in wm8993_set_dai_fmt() local
1102 wm8993->master = 0; in wm8993_set_dai_fmt()
1106 wm8993->master = 1; in wm8993_set_dai_fmt()
1110 wm8993->master = 1; in wm8993_set_dai_fmt()
1115 wm8993->master = 1; in wm8993_set_dai_fmt()
1189 struct wm8993_priv *wm8993 = snd_soc_component_get_drvdata(component); in wm8993_hw_params() local
1206 wm8993->fs = params_rate(params); in wm8993_hw_params()
1207 wm8993->bclk = 2 * wm8993->fs; in wm8993_hw_params()
1208 if (wm8993->tdm_slots) { in wm8993_hw_params()
1210 wm8993->tdm_slots, wm8993->tdm_width); in wm8993_hw_params()
1211 wm8993->bclk *= wm8993->tdm_width * wm8993->tdm_slots; in wm8993_hw_params()
1215 wm8993->bclk *= 16; in wm8993_hw_params()
1218 wm8993->bclk *= 20; in wm8993_hw_params()
1222 wm8993->bclk *= 24; in wm8993_hw_params()
1226 wm8993->bclk *= 32; in wm8993_hw_params()
1234 dev_dbg(component->dev, "Target BCLK is %dHz\n", wm8993->bclk); in wm8993_hw_params()
1242 best_val = abs((wm8993->sysclk_rate / clk_sys_rates[0].ratio) in wm8993_hw_params()
1243 - wm8993->fs); in wm8993_hw_params()
1245 cur_val = abs((wm8993->sysclk_rate / in wm8993_hw_params()
1246 clk_sys_rates[i].ratio) - wm8993->fs); in wm8993_hw_params()
1259 best_val = abs(wm8993->fs - sample_rates[0].rate); in wm8993_hw_params()
1262 cur_val = abs(wm8993->fs - sample_rates[i].rate); in wm8993_hw_params()
1277 cur_val = ((wm8993->sysclk_rate * 10) / bclk_divs[i].div) in wm8993_hw_params()
1278 - wm8993->bclk; in wm8993_hw_params()
1286 wm8993->bclk = (wm8993->sysclk_rate * 10) / bclk_divs[best].div; in wm8993_hw_params()
1288 bclk_divs[best].div, wm8993->bclk); in wm8993_hw_params()
1292 dev_dbg(component->dev, "LRCLK_RATE is %d\n", wm8993->bclk / wm8993->fs); in wm8993_hw_params()
1293 aif4 |= wm8993->bclk / wm8993->fs; in wm8993_hw_params()
1301 if (wm8993->pdata.num_retune_configs) { in wm8993_hw_params()
1306 best_val = abs(wm8993->pdata.retune_configs[0].rate in wm8993_hw_params()
1307 - wm8993->fs); in wm8993_hw_params()
1308 for (i = 0; i < wm8993->pdata.num_retune_configs; i++) { in wm8993_hw_params()
1309 cur_val = abs(wm8993->pdata.retune_configs[i].rate in wm8993_hw_params()
1310 - wm8993->fs); in wm8993_hw_params()
1316 s = &wm8993->pdata.retune_configs[best]; in wm8993_hw_params()
1354 struct wm8993_priv *wm8993 = snd_soc_component_get_drvdata(component); in wm8993_set_tdm_slot() local
1360 wm8993->tdm_slots = 0; in wm8993_set_tdm_slot()
1393 wm8993->tdm_width = slot_width; in wm8993_set_tdm_slot()
1394 wm8993->tdm_slots = slots / 2; in wm8993_set_tdm_slot()
1406 struct wm8993_priv *wm8993 = data; in wm8993_irq() local
1409 ret = regmap_read(wm8993->regmap, WM8993_GPIO_CTRL_1, &val); in wm8993_irq()
1411 dev_err(wm8993->dev, "Failed to read interrupt status: %d\n", in wm8993_irq()
1416 ret = regmap_read(wm8993->regmap, WM8993_GPIOCTRL_2, &mask); in wm8993_irq()
1418 dev_err(wm8993->dev, "Failed to read interrupt mask: %d\n", in wm8993_irq()
1429 dev_crit(wm8993->dev, "Thermal warning\n"); in wm8993_irq()
1432 dev_dbg(wm8993->dev, "FLL locked\n"); in wm8993_irq()
1433 complete(&wm8993->fll_lock); in wm8993_irq()
1436 ret = regmap_write(wm8993->regmap, WM8993_GPIO_CTRL_1, val); in wm8993_irq()
1438 dev_err(wm8993->dev, "Failed to ack interrupt: %d\n", ret); in wm8993_irq()
1484 struct wm8993_priv *wm8993 = snd_soc_component_get_drvdata(component); in wm8993_probe() local
1487 wm8993->hubs_data.hp_startup_mode = 1; in wm8993_probe()
1488 wm8993->hubs_data.dcs_codes_l = -2; in wm8993_probe()
1489 wm8993->hubs_data.dcs_codes_r = -2; in wm8993_probe()
1490 wm8993->hubs_data.series_startup = 1; in wm8993_probe()
1506 wm_hubs_handle_analogue_pdata(component, wm8993->pdata.lineout1_diff, in wm8993_probe()
1507 wm8993->pdata.lineout2_diff, in wm8993_probe()
1508 wm8993->pdata.lineout1fb, in wm8993_probe()
1509 wm8993->pdata.lineout2fb, in wm8993_probe()
1510 wm8993->pdata.jd_scthr, in wm8993_probe()
1511 wm8993->pdata.jd_thr, in wm8993_probe()
1512 wm8993->pdata.micbias1_delay, in wm8993_probe()
1513 wm8993->pdata.micbias2_delay, in wm8993_probe()
1514 wm8993->pdata.micbias1_lvl, in wm8993_probe()
1515 wm8993->pdata.micbias2_lvl); in wm8993_probe()
1519 if (wm8993->pdata.num_retune_configs != 0) { in wm8993_probe()
1532 wm_hubs_add_analogue_routes(component, wm8993->pdata.lineout1_diff, in wm8993_probe()
1533 wm8993->pdata.lineout2_diff); in wm8993_probe()
1538 if (wm8993->pdata.lineout1_diff && wm8993->pdata.lineout2_diff) in wm8993_probe()
1548 struct wm8993_priv *wm8993 = snd_soc_component_get_drvdata(component); in wm8993_suspend() local
1549 int fll_fout = wm8993->fll_fout; in wm8993_suspend()
1550 int fll_fref = wm8993->fll_fref; in wm8993_suspend()
1560 wm8993->fll_fout = fll_fout; in wm8993_suspend()
1561 wm8993->fll_fref = fll_fref; in wm8993_suspend()
1570 struct wm8993_priv *wm8993 = snd_soc_component_get_drvdata(component); in wm8993_resume() local
1576 if (wm8993->fll_fout) { in wm8993_resume()
1577 int fll_fout = wm8993->fll_fout; in wm8993_resume()
1578 int fll_fref = wm8993->fll_fref; in wm8993_resume()
1580 wm8993->fll_fref = 0; in wm8993_resume()
1581 wm8993->fll_fout = 0; in wm8993_resume()
1583 ret = _wm8993_set_fll(component, 0, wm8993->fll_src, in wm8993_resume()
1628 struct wm8993_priv *wm8993; in wm8993_i2c_probe() local
1632 wm8993 = devm_kzalloc(&i2c->dev, sizeof(struct wm8993_priv), in wm8993_i2c_probe()
1634 if (wm8993 == NULL) in wm8993_i2c_probe()
1637 wm8993->dev = &i2c->dev; in wm8993_i2c_probe()
1638 init_completion(&wm8993->fll_lock); in wm8993_i2c_probe()
1640 wm8993->regmap = devm_regmap_init_i2c(i2c, &wm8993_regmap); in wm8993_i2c_probe()
1641 if (IS_ERR(wm8993->regmap)) { in wm8993_i2c_probe()
1642 ret = PTR_ERR(wm8993->regmap); in wm8993_i2c_probe()
1647 i2c_set_clientdata(i2c, wm8993); in wm8993_i2c_probe()
1649 for (i = 0; i < ARRAY_SIZE(wm8993->supplies); i++) in wm8993_i2c_probe()
1650 wm8993->supplies[i].supply = wm8993_supply_names[i]; in wm8993_i2c_probe()
1652 ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8993->supplies), in wm8993_i2c_probe()
1653 wm8993->supplies); in wm8993_i2c_probe()
1659 ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies), in wm8993_i2c_probe()
1660 wm8993->supplies); in wm8993_i2c_probe()
1666 ret = regmap_read(wm8993->regmap, WM8993_SOFTWARE_RESET, &reg); in wm8993_i2c_probe()
1678 ret = regmap_write(wm8993->regmap, WM8993_SOFTWARE_RESET, 0xffff); in wm8993_i2c_probe()
1682 ret = regmap_register_patch(wm8993->regmap, wm8993_regmap_patch, in wm8993_i2c_probe()
1685 dev_warn(wm8993->dev, "Failed to apply regmap patch: %d\n", in wm8993_i2c_probe()
1690 ret = regmap_update_bits(wm8993->regmap, WM8993_GPIO1, in wm8993_i2c_probe()
1698 "wm8993", wm8993); in wm8993_i2c_probe()
1704 regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies); in wm8993_i2c_probe()
1706 regcache_cache_only(wm8993->regmap, true); in wm8993_i2c_probe()
1719 free_irq(i2c->irq, wm8993); in wm8993_i2c_probe()
1721 regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies); in wm8993_i2c_probe()
1727 struct wm8993_priv *wm8993 = i2c_get_clientdata(i2c); in wm8993_i2c_remove() local
1730 free_irq(i2c->irq, wm8993); in wm8993_i2c_remove()
1731 regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies); in wm8993_i2c_remove()