Lines Matching refs:rt1015
3 // rt1015.c -- RT1015 ALSA SoC audio amplifier driver
30 #include <sound/rt1015.h>
33 #include "rt1015.h"
433 struct rt1015_priv *rt1015 =
436 ucontrol->value.integer.value[0] = rt1015->boost_mode;
446 struct rt1015_priv *rt1015 =
449 rt1015->boost_mode = ucontrol->value.integer.value[0];
451 switch (rt1015->boost_mode) {
485 struct rt1015_priv *rt1015 =
488 ucontrol->value.integer.value[0] = rt1015->bypass_boost;
493 static void rt1015_calibrate(struct rt1015_priv *rt1015)
495 struct snd_soc_component *component = rt1015->component;
496 struct regmap *regmap = rt1015->regmap;
525 struct rt1015_priv *rt1015 =
528 if (!rt1015->dac_is_used) {
529 rt1015->bypass_boost = ucontrol->value.integer.value[0];
530 if (rt1015->bypass_boost == RT1015_Bypass_Boost &&
531 !rt1015->cali_done) {
532 rt1015_calibrate(rt1015);
533 rt1015->cali_done = 1;
535 regmap_write(rt1015->regmap, RT1015_MONO_DYNA_CTRL, 0x0010);
545 struct rt1015_priv *rt1015 = container_of(work, struct rt1015_priv,
547 struct snd_soc_component *component = rt1015->component;
553 regmap_read(rt1015->regmap, RT1015_CLK_DET, &val);
559 regmap_write(rt1015->regmap, RT1015_SYS_RST1, 0x0597);
560 regmap_write(rt1015->regmap, RT1015_SYS_RST1, 0x05f7);
561 regmap_write(rt1015->regmap, RT1015_MAN_I2C, 0x0028);
586 struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
588 if (rt1015->sysclk_src == RT1015_SCLK_S_PLL)
599 struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
603 rt1015->dac_is_used = 1;
604 if (rt1015->bypass_boost == RT1015_Enable_Boost) {
622 regmap_write(rt1015->regmap, RT1015_MAN_I2C, 0x00a8);
626 if (rt1015->bypass_boost == RT1015_Enable_Boost) {
637 rt1015->dac_is_used = 0;
639 cancel_delayed_work_sync(&rt1015->flush_work);
653 struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
657 if (rt1015->hw_config == RT1015_HW_28)
658 schedule_delayed_work(&rt1015->flush_work, msecs_to_jiffies(10));
659 msleep(rt1015->pdata.power_up_delay_ms);
728 struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
732 rt1015->lrck = params_rate(params);
733 pre_div = rl6231_get_clk_info(rt1015->sysclk, rt1015->lrck);
747 rt1015->bclk = rt1015->lrck * (32 << bclk_ms);
753 rt1015->lrck, pre_div, dai->id);
837 struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
840 if (freq == rt1015->sysclk && clk_id == rt1015->sysclk_src)
857 rt1015->sysclk = freq;
858 rt1015->sysclk_src = clk_id;
873 struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
880 rt1015->pll_in = 0;
881 rt1015->pll_out = 0;
886 if (source == rt1015->pll_src && freq_in == rt1015->pll_in &&
887 freq_out == rt1015->pll_out)
891 if (rt1015->bclk_ratio == 0) {
930 rt1015->pll_in = freq_in;
931 rt1015->pll_out = freq_out;
932 rt1015->pll_src = source;
940 struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
944 rt1015->bclk_ratio = ratio;
956 struct rt1015_priv *rt1015 =
959 rt1015->component = component;
960 rt1015->bclk_ratio = 0;
961 rt1015->cali_done = 0;
964 INIT_DELAYED_WORK(&rt1015->flush_work, rt1015_flush_work);
971 struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
973 cancel_delayed_work_sync(&rt1015->flush_work);
974 regmap_write(rt1015->regmap, RT1015_RESET, 0);
989 .name = "rt1015-aif",
1005 struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
1007 regcache_cache_only(rt1015->regmap, true);
1008 regcache_mark_dirty(rt1015->regmap);
1015 struct rt1015_priv *rt1015 = snd_soc_component_get_drvdata(component);
1017 regcache_cache_only(rt1015->regmap, false);
1018 regcache_sync(rt1015->regmap);
1056 { "rt1015", 0 },
1063 { .compatible = "realtek,rt1015", },
1077 static void rt1015_parse_dt(struct rt1015_priv *rt1015, struct device *dev)
1080 &rt1015->pdata.power_up_delay_ms);
1087 struct rt1015_priv *rt1015;
1091 rt1015 = devm_kzalloc(&i2c->dev, sizeof(struct rt1015_priv),
1093 if (rt1015 == NULL)
1096 i2c_set_clientdata(i2c, rt1015);
1098 rt1015->pdata = i2s_default_platform_data;
1101 rt1015->pdata = *pdata;
1103 rt1015_parse_dt(rt1015, &i2c->dev);
1105 rt1015->regmap = devm_regmap_init_i2c(i2c, &rt1015_regmap);
1106 if (IS_ERR(rt1015->regmap)) {
1107 ret = PTR_ERR(rt1015->regmap);
1113 rt1015->hw_config = (i2c->addr == 0x29) ? RT1015_HW_29 : RT1015_HW_28;
1115 regmap_read(rt1015->regmap, RT1015_DEVICE_ID, &val);
1118 "Device with ID register %x is not rt1015\n", val);
1129 struct rt1015_priv *rt1015 = i2c_get_clientdata(client);
1131 regmap_write(rt1015->regmap, RT1015_RESET, 0);
1136 .name = "rt1015",