rt1011 34 sound/soc/codecs/rt1011.c static int rt1011_calibrate(struct rt1011_priv *rt1011, rt1011 685 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 687 sound/soc/codecs/rt1011.c regmap_multi_reg_write(rt1011->regmap, init_list, RT1011_INIT_REG_LEN); rt1011 1042 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = rt1011 1045 sound/soc/codecs/rt1011.c ucontrol->value.integer.value[0] = rt1011->recv_spk_mode; rt1011 1055 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = rt1011 1058 sound/soc/codecs/rt1011.c if (ucontrol->value.integer.value[0] == rt1011->recv_spk_mode) rt1011 1062 sound/soc/codecs/rt1011.c rt1011->recv_spk_mode = ucontrol->value.integer.value[0]; rt1011 1064 sound/soc/codecs/rt1011.c if (rt1011->recv_spk_mode) { rt1011 1122 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = rt1011 1144 sound/soc/codecs/rt1011.c bq_drc_info = rt1011->bq_drc_params[mode_idx]; rt1011 1159 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = rt1011 1182 sound/soc/codecs/rt1011.c bq_drc_info = rt1011->bq_drc_params[mode_idx]; rt1011 1226 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 1228 sound/soc/codecs/rt1011.c ucontrol->value.integer.value[0] = rt1011->cali_done; rt1011 1237 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 1242 sound/soc/codecs/rt1011.c rt1011->cali_done = 0; rt1011 1245 sound/soc/codecs/rt1011.c rt1011_calibrate(rt1011, 1); rt1011 1250 sound/soc/codecs/rt1011.c static int rt1011_r0_load(struct rt1011_priv *rt1011) rt1011 1252 sound/soc/codecs/rt1011.c if (!rt1011->r0_reg) rt1011 1256 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_INIT_RECIPROCAL_REG_24_16, rt1011 1257 sound/soc/codecs/rt1011.c ((rt1011->r0_reg>>16) & 0x1ff)); rt1011 1258 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_INIT_RECIPROCAL_REG_15_0, rt1011 1259 sound/soc/codecs/rt1011.c (rt1011->r0_reg & 0xffff)); rt1011 1260 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_SPK_TEMP_PROTECT_4, 0x4080); rt1011 1269 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 1271 sound/soc/codecs/rt1011.c ucontrol->value.integer.value[0] = rt1011->r0_reg; rt1011 1280 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 1284 sound/soc/codecs/rt1011.c if (ucontrol->value.integer.value[0] == rt1011->r0_reg) rt1011 1293 sound/soc/codecs/rt1011.c dev = regmap_get_device(rt1011->regmap); rt1011 1295 sound/soc/codecs/rt1011.c rt1011->r0_reg = ucontrol->value.integer.value[0]; rt1011 1298 sound/soc/codecs/rt1011.c r0_integer = format / rt1011->r0_reg / 128; rt1011 1299 sound/soc/codecs/rt1011.c r0_factor = ((format / rt1011->r0_reg * 100) / 128) rt1011 1302 sound/soc/codecs/rt1011.c r0_integer, r0_factor, rt1011->r0_reg); rt1011 1304 sound/soc/codecs/rt1011.c if (rt1011->r0_reg) rt1011 1305 sound/soc/codecs/rt1011.c rt1011_r0_load(rt1011); rt1011 1373 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 1375 sound/soc/codecs/rt1011.c if (rt1011->sysclk_src == RT1011_FS_SYS_PRE_S_PLL1) rt1011 1540 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 1544 sound/soc/codecs/rt1011.c rt1011->lrck = params_rate(params); rt1011 1545 sound/soc/codecs/rt1011.c pre_div = rt1011_get_clk_info(rt1011->sysclk, rt1011->lrck); rt1011 1549 sound/soc/codecs/rt1011.c rt1011->lrck * 64, rt1011->lrck * 256); rt1011 1551 sound/soc/codecs/rt1011.c rt1011->lrck * 256, SND_SOC_CLOCK_IN); rt1011 1562 sound/soc/codecs/rt1011.c rt1011->bclk = rt1011->lrck * (32 << bclk_ms); rt1011 1568 sound/soc/codecs/rt1011.c rt1011->lrck, pre_div, dai->id); rt1011 1693 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 1696 sound/soc/codecs/rt1011.c if (freq == rt1011->sysclk && clk_id == rt1011->sysclk_src) rt1011 1724 sound/soc/codecs/rt1011.c rt1011->sysclk = freq; rt1011 1725 sound/soc/codecs/rt1011.c rt1011->sysclk_src = clk_id; rt1011 1737 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 1741 sound/soc/codecs/rt1011.c if (source == rt1011->pll_src && freq_in == rt1011->pll_in && rt1011 1742 sound/soc/codecs/rt1011.c freq_out == rt1011->pll_out) rt1011 1748 sound/soc/codecs/rt1011.c rt1011->pll_in = 0; rt1011 1749 sound/soc/codecs/rt1011.c rt1011->pll_out = 0; rt1011 1795 sound/soc/codecs/rt1011.c rt1011->pll_in = freq_in; rt1011 1796 sound/soc/codecs/rt1011.c rt1011->pll_out = freq_out; rt1011 1797 sound/soc/codecs/rt1011.c rt1011->pll_src = source; rt1011 1873 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 1876 sound/soc/codecs/rt1011.c rt1011->component = component; rt1011 1878 sound/soc/codecs/rt1011.c schedule_work(&rt1011->cali_work); rt1011 1880 sound/soc/codecs/rt1011.c rt1011->bq_drc_params = devm_kcalloc(component->dev, rt1011 1883 sound/soc/codecs/rt1011.c if (!rt1011->bq_drc_params) rt1011 1887 sound/soc/codecs/rt1011.c rt1011->bq_drc_params[i] = devm_kcalloc(component->dev, rt1011 1890 sound/soc/codecs/rt1011.c if (!rt1011->bq_drc_params[i]) rt1011 1899 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 1901 sound/soc/codecs/rt1011.c cancel_work_sync(&rt1011->cali_work); rt1011 1902 sound/soc/codecs/rt1011.c rt1011_reset(rt1011->regmap); rt1011 1908 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 1910 sound/soc/codecs/rt1011.c regcache_cache_only(rt1011->regmap, true); rt1011 1911 sound/soc/codecs/rt1011.c regcache_mark_dirty(rt1011->regmap); rt1011 1918 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); rt1011 1920 sound/soc/codecs/rt1011.c regcache_cache_only(rt1011->regmap, false); rt1011 1921 sound/soc/codecs/rt1011.c regcache_sync(rt1011->regmap); rt1011 2034 sound/soc/codecs/rt1011.c static int rt1011_calibrate(struct rt1011_priv *rt1011, unsigned char cali_flag) rt1011 2040 sound/soc/codecs/rt1011.c struct device *dev = regmap_get_device(rt1011->regmap); rt1011 2042 sound/soc/codecs/rt1011.c snd_soc_component_get_dapm(rt1011->component); rt1011 2046 sound/soc/codecs/rt1011.c regcache_cache_bypass(rt1011->regmap, true); rt1011 2048 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_RESET, 0x0000); rt1011 2049 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_SYSTEM_RESET_3, 0x740f); rt1011 2050 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_SYSTEM_RESET_3, 0x770f); rt1011 2053 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_CLK_2, 0x9400); rt1011 2054 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_PLL_1, 0x0800); rt1011 2055 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_PLL_2, 0x0020); rt1011 2056 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_CLK_DET, 0x0800); rt1011 2059 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_ADC_SET_5, 0x0a20); rt1011 2060 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_DAC_SET_2, 0xe232); rt1011 2061 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_ADC_SET_1, 0x2925); rt1011 2062 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_ADC_SET_4, 0xc000); rt1011 2065 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_SPK_PRO_DC_DET_1, 0xb00c); rt1011 2066 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_SPK_PRO_DC_DET_2, 0xcccc); rt1011 2069 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_POWER_1, 0xe0e0); rt1011 2070 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_POWER_3, 0x5003); rt1011 2071 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_POWER_9, 0xa860); rt1011 2072 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_DAC_SET_2, 0xa032); rt1011 2075 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_POWER_2, 0x0007); rt1011 2076 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_POWER_3, 0x5ff7); rt1011 2077 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_A_TEMP_SEN, 0x7f44); rt1011 2078 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_A_TIMING_1, 0x4054); rt1011 2079 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_BAT_GAIN_1, 0x309c); rt1011 2082 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_DC_CALIB_CLASSD_3, 0xcb00); rt1011 2083 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_BOOST_CON_1, 0xe080); rt1011 2084 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_POWER_4, 0x16f2); rt1011 2085 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_POWER_6, 0x36ad); rt1011 2088 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_MIXER_1, 0x3f1d); rt1011 2091 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_EFUSE_CONTROL_1, 0x0d0a); rt1011 2094 sound/soc/codecs/rt1011.c regmap_read(rt1011->regmap, RT1011_EFUSE_ADC_OFFSET_18_16, &value); rt1011 2096 sound/soc/codecs/rt1011.c regmap_read(rt1011->regmap, RT1011_EFUSE_ADC_OFFSET_15_0, &value); rt1011 2099 sound/soc/codecs/rt1011.c regmap_read(rt1011->regmap, RT1011_EFUSE_DAC_OFFSET_G0_20_16, &value); rt1011 2101 sound/soc/codecs/rt1011.c regmap_read(rt1011->regmap, RT1011_EFUSE_DAC_OFFSET_G0_15_0, &value); rt1011 2104 sound/soc/codecs/rt1011.c regmap_read(rt1011->regmap, RT1011_EFUSE_DAC_OFFSET_G1_20_16, &value); rt1011 2106 sound/soc/codecs/rt1011.c regmap_read(rt1011->regmap, RT1011_EFUSE_DAC_OFFSET_G1_15_0, &value); rt1011 2113 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_CLASS_D_POS, 0x010e); rt1011 2114 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, rt1011 2118 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_SPK_TEMP_PROTECT_0, 0x8000); rt1011 2119 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_SPK_TEMP_PROTECT_7, 0xf000); rt1011 2120 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_SPK_TEMP_PROTECT_4, 0x4040); rt1011 2121 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_SPK_TEMP_PROTECT_0, 0xc000); rt1011 2122 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_SPK_TEMP_PROTECT_6, 0x07c2); rt1011 2127 sound/soc/codecs/rt1011.c regmap_read(rt1011->regmap, rt1011 2130 sound/soc/codecs/rt1011.c regmap_read(rt1011->regmap, rt1011 2150 sound/soc/codecs/rt1011.c rt1011->r0_reg = r0[0]; rt1011 2151 sound/soc/codecs/rt1011.c rt1011->cali_done = 1; rt1011 2158 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_SPK_TEMP_PROTECT_0, 0x0000); rt1011 2160 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_POWER_9, 0xa840); rt1011 2161 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_SPK_TEMP_PROTECT_6, 0x0702); rt1011 2162 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_MIXER_1, 0xffdd); rt1011 2163 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_CLASSD_INTERNAL_SET_1, 0x0701); rt1011 2164 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_DAC_SET_3, 0xe004); rt1011 2165 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_A_TEMP_SEN, 0x7f40); rt1011 2166 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_POWER_1, 0x0000); rt1011 2167 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_POWER_2, 0x0000); rt1011 2168 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_POWER_3, 0x0002); rt1011 2169 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_POWER_4, 0x00f2); rt1011 2171 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, RT1011_RESET, 0x0000); rt1011 2175 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, rt1011 2178 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, rt1011 2181 sound/soc/codecs/rt1011.c regmap_write(rt1011->regmap, rt1011 2186 sound/soc/codecs/rt1011.c regcache_cache_bypass(rt1011->regmap, false); rt1011 2187 sound/soc/codecs/rt1011.c regcache_mark_dirty(rt1011->regmap); rt1011 2188 sound/soc/codecs/rt1011.c regcache_sync(rt1011->regmap); rt1011 2196 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = rt1011 2198 sound/soc/codecs/rt1011.c struct snd_soc_component *component = rt1011->component; rt1011 2200 sound/soc/codecs/rt1011.c rt1011_calibrate(rt1011, 1); rt1011 2207 sound/soc/codecs/rt1011.c rt1011->cali_done = 0; rt1011 2216 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011; rt1011 2220 sound/soc/codecs/rt1011.c rt1011 = devm_kzalloc(&i2c->dev, sizeof(struct rt1011_priv), rt1011 2222 sound/soc/codecs/rt1011.c if (rt1011 == NULL) rt1011 2225 sound/soc/codecs/rt1011.c i2c_set_clientdata(i2c, rt1011); rt1011 2227 sound/soc/codecs/rt1011.c rt1011->regmap = devm_regmap_init_i2c(i2c, &rt1011_regmap); rt1011 2228 sound/soc/codecs/rt1011.c if (IS_ERR(rt1011->regmap)) { rt1011 2229 sound/soc/codecs/rt1011.c ret = PTR_ERR(rt1011->regmap); rt1011 2235 sound/soc/codecs/rt1011.c regmap_read(rt1011->regmap, RT1011_DEVICE_ID, &val); rt1011 2242 sound/soc/codecs/rt1011.c INIT_WORK(&rt1011->cali_work, rt1011_calibration_work); rt1011 2252 sound/soc/codecs/rt1011.c struct rt1011_priv *rt1011 = i2c_get_clientdata(client); rt1011 2254 sound/soc/codecs/rt1011.c rt1011_reset(rt1011->regmap);