rt5668 898 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 922 sound/soc/codecs/rt5668.c rt5668->jack_type = SND_JACK_HEADSET; rt5668 926 sound/soc/codecs/rt5668.c rt5668->jack_type = SND_JACK_HEADPHONE; rt5668 936 sound/soc/codecs/rt5668.c rt5668->jack_type = 0; rt5668 939 sound/soc/codecs/rt5668.c dev_dbg(component->dev, "jack_type = %d\n", rt5668->jack_type); rt5668 940 sound/soc/codecs/rt5668.c return rt5668->jack_type; rt5668 945 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = data; rt5668 948 sound/soc/codecs/rt5668.c &rt5668->jack_detect_work, msecs_to_jiffies(250)); rt5668 955 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = container_of(work, struct rt5668_priv, rt5668 958 sound/soc/codecs/rt5668.c if (snd_soc_component_read32(rt5668->component, RT5668_AJD1_CTRL) rt5668 961 sound/soc/codecs/rt5668.c rt5668->jack_type = rt5668_headset_detect(rt5668->component, 0); rt5668 963 sound/soc/codecs/rt5668.c snd_soc_jack_report(rt5668->hs_jack, rt5668->jack_type, rt5668 968 sound/soc/codecs/rt5668.c schedule_delayed_work(&rt5668->jd_check_work, 500); rt5668 975 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 977 sound/soc/codecs/rt5668.c switch (rt5668->pdata.jd_src) { rt5668 986 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_GPIO_CTRL_1, rt5668 988 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_RC_CLK_CTRL, rt5668 992 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_PWR_ANLG_2, rt5668 995 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_IRQ_CTRL_2, rt5668 999 sound/soc/codecs/rt5668.c &rt5668->jack_detect_work, msecs_to_jiffies(250)); rt5668 1003 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_IRQ_CTRL_2, rt5668 1005 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_RC_CLK_CTRL, rt5668 1014 sound/soc/codecs/rt5668.c rt5668->hs_jack = hs_jack; rt5668 1021 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = rt5668 1025 sound/soc/codecs/rt5668.c while (!rt5668->component) rt5668 1028 sound/soc/codecs/rt5668.c while (!rt5668->component->card->instantiated) rt5668 1031 sound/soc/codecs/rt5668.c mutex_lock(&rt5668->calibrate_mutex); rt5668 1033 sound/soc/codecs/rt5668.c val = snd_soc_component_read32(rt5668->component, RT5668_AJD1_CTRL) rt5668 1037 sound/soc/codecs/rt5668.c if (rt5668->jack_type == 0) { rt5668 1039 sound/soc/codecs/rt5668.c rt5668->jack_type = rt5668 1040 sound/soc/codecs/rt5668.c rt5668_headset_detect(rt5668->component, 1); rt5668 1043 sound/soc/codecs/rt5668.c rt5668->jack_type = SND_JACK_HEADSET; rt5668 1044 sound/soc/codecs/rt5668.c btn_type = rt5668_button_detect(rt5668->component); rt5668 1056 sound/soc/codecs/rt5668.c rt5668->jack_type |= SND_JACK_BTN_0; rt5668 1061 sound/soc/codecs/rt5668.c rt5668->jack_type |= SND_JACK_BTN_1; rt5668 1066 sound/soc/codecs/rt5668.c rt5668->jack_type |= SND_JACK_BTN_2; rt5668 1071 sound/soc/codecs/rt5668.c rt5668->jack_type |= SND_JACK_BTN_3; rt5668 1077 sound/soc/codecs/rt5668.c dev_err(rt5668->component->dev, rt5668 1085 sound/soc/codecs/rt5668.c rt5668->jack_type = rt5668_headset_detect(rt5668->component, 0); rt5668 1088 sound/soc/codecs/rt5668.c snd_soc_jack_report(rt5668->hs_jack, rt5668->jack_type, rt5668 1093 sound/soc/codecs/rt5668.c if (rt5668->jack_type & (SND_JACK_BTN_0 | SND_JACK_BTN_1 | rt5668 1095 sound/soc/codecs/rt5668.c schedule_delayed_work(&rt5668->jd_check_work, 0); rt5668 1097 sound/soc/codecs/rt5668.c cancel_delayed_work_sync(&rt5668->jd_check_work); rt5668 1099 sound/soc/codecs/rt5668.c mutex_unlock(&rt5668->calibrate_mutex); rt5668 1128 sound/soc/codecs/rt5668.c static int rt5668_div_sel(struct rt5668_priv *rt5668, rt5668 1133 sound/soc/codecs/rt5668.c if (rt5668->sysclk < target) { rt5668 1135 sound/soc/codecs/rt5668.c rt5668->sysclk); rt5668 1141 sound/soc/codecs/rt5668.c if (target * div[i] == rt5668->sysclk) rt5668 1143 sound/soc/codecs/rt5668.c if (target * div[i + 1] > rt5668->sysclk) { rt5668 1145 sound/soc/codecs/rt5668.c rt5668->sysclk); rt5668 1150 sound/soc/codecs/rt5668.c if (target * div[i] < rt5668->sysclk) rt5668 1152 sound/soc/codecs/rt5668.c rt5668->sysclk); rt5668 1173 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 1177 sound/soc/codecs/rt5668.c idx = rt5668_div_sel(rt5668, 1500000, div, ARRAY_SIZE(div)); rt5668 1190 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 1198 sound/soc/codecs/rt5668.c ref = 256 * rt5668->lrck[RT5668_AIF2]; rt5668 1200 sound/soc/codecs/rt5668.c ref = 256 * rt5668->lrck[RT5668_AIF1]; rt5668 1202 sound/soc/codecs/rt5668.c idx = rt5668_div_sel(rt5668, ref, div, ARRAY_SIZE(div)); rt5668 1921 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 1925 sound/soc/codecs/rt5668.c rt5668->lrck[dai->id] = params_rate(params); rt5668 1926 sound/soc/codecs/rt5668.c pre_div = rl6231_get_clk_info(rt5668->sysclk, rt5668->lrck[dai->id]); rt5668 1936 sound/soc/codecs/rt5668.c rt5668->lrck[dai->id], pre_div, dai->id); rt5668 1965 sound/soc/codecs/rt5668.c if (rt5668->master[RT5668_AIF1]) { rt5668 1982 sound/soc/codecs/rt5668.c if (rt5668->master[RT5668_AIF2]) { rt5668 2007 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 2012 sound/soc/codecs/rt5668.c rt5668->master[dai->id] = 1; rt5668 2015 sound/soc/codecs/rt5668.c rt5668->master[dai->id] = 0; rt5668 2072 sound/soc/codecs/rt5668.c tdm_ctrl | rt5668->master[dai->id]); rt5668 2075 sound/soc/codecs/rt5668.c if (rt5668->master[dai->id] == 0) rt5668 2091 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 2094 sound/soc/codecs/rt5668.c if (freq == rt5668->sysclk && clk_id == rt5668->sysclk_src) rt5668 2121 sound/soc/codecs/rt5668.c if (rt5668->master[RT5668_AIF2]) { rt5668 2127 sound/soc/codecs/rt5668.c rt5668->sysclk = freq; rt5668 2128 sound/soc/codecs/rt5668.c rt5668->sysclk_src = clk_id; rt5668 2140 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 2144 sound/soc/codecs/rt5668.c if (source == rt5668->pll_src && freq_in == rt5668->pll_in && rt5668 2145 sound/soc/codecs/rt5668.c freq_out == rt5668->pll_out) rt5668 2151 sound/soc/codecs/rt5668.c rt5668->pll_in = 0; rt5668 2152 sound/soc/codecs/rt5668.c rt5668->pll_out = 0; rt5668 2188 sound/soc/codecs/rt5668.c rt5668->pll_in = freq_in; rt5668 2189 sound/soc/codecs/rt5668.c rt5668->pll_out = freq_out; rt5668 2190 sound/soc/codecs/rt5668.c rt5668->pll_src = source; rt5668 2198 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 2200 sound/soc/codecs/rt5668.c rt5668->bclk[dai->id] = ratio; rt5668 2224 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 2228 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_PWR_ANLG_1, rt5668 2231 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_PWR_DIG_1, rt5668 2237 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_PWR_ANLG_1, rt5668 2239 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_PWR_DIG_1, rt5668 2243 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_PWR_DIG_1, rt5668 2245 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_PWR_ANLG_1, rt5668 2258 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 2260 sound/soc/codecs/rt5668.c rt5668->component = component; rt5668 2267 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 2269 sound/soc/codecs/rt5668.c rt5668_reset(rt5668->regmap); rt5668 2275 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 2277 sound/soc/codecs/rt5668.c regcache_cache_only(rt5668->regmap, true); rt5668 2278 sound/soc/codecs/rt5668.c regcache_mark_dirty(rt5668->regmap); rt5668 2284 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); rt5668 2286 sound/soc/codecs/rt5668.c regcache_cache_only(rt5668->regmap, false); rt5668 2287 sound/soc/codecs/rt5668.c regcache_sync(rt5668->regmap); rt5668 2385 sound/soc/codecs/rt5668.c static int rt5668_parse_dt(struct rt5668_priv *rt5668, struct device *dev) rt5668 2389 sound/soc/codecs/rt5668.c &rt5668->pdata.dmic1_data_pin); rt5668 2391 sound/soc/codecs/rt5668.c &rt5668->pdata.dmic1_clk_pin); rt5668 2393 sound/soc/codecs/rt5668.c &rt5668->pdata.jd_src); rt5668 2395 sound/soc/codecs/rt5668.c rt5668->pdata.ldo1_en = of_get_named_gpio(dev->of_node, rt5668 2401 sound/soc/codecs/rt5668.c static void rt5668_calibrate(struct rt5668_priv *rt5668) rt5668 2405 sound/soc/codecs/rt5668.c mutex_lock(&rt5668->calibrate_mutex); rt5668 2407 sound/soc/codecs/rt5668.c rt5668_reset(rt5668->regmap); rt5668 2408 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_PWR_ANLG_1, 0xa2bf); rt5668 2410 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_PWR_ANLG_1, 0xf2bf); rt5668 2411 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_MICBIAS_2, 0x0380); rt5668 2412 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_PWR_DIG_1, 0x8001); rt5668 2413 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_TEST_MODE_CTRL_1, 0x0000); rt5668 2414 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_STO1_DAC_MIXER, 0x2080); rt5668 2415 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_STO1_ADC_MIXER, 0x4040); rt5668 2416 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_DEPOP_1, 0x0069); rt5668 2417 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_CHOP_DAC, 0x3000); rt5668 2418 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_HP_CTRL_2, 0x6000); rt5668 2419 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_HP_CHARGE_PUMP_1, 0x0f26); rt5668 2420 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_CALIB_ADC_CTRL, 0x7f05); rt5668 2421 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_STO1_ADC_MIXER, 0x686c); rt5668 2422 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_CAL_REC, 0x0d0d); rt5668 2423 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_HP_CALIB_CTRL_9, 0x000f); rt5668 2424 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_PWR_DIG_1, 0x8d01); rt5668 2425 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_HP_CALIB_CTRL_2, 0x0321); rt5668 2426 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_HP_LOGIC_CTRL_2, 0x0004); rt5668 2427 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_HP_CALIB_CTRL_1, 0x7c00); rt5668 2428 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_HP_CALIB_CTRL_3, 0x06a1); rt5668 2429 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_A_DAC1_MUX, 0x0311); rt5668 2430 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_RESET_HPF_CTRL, 0x0000); rt5668 2431 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_ADC_STO1_HP_CTRL_1, 0x3320); rt5668 2433 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_HP_CALIB_CTRL_1, 0xfc00); rt5668 2436 sound/soc/codecs/rt5668.c regmap_read(rt5668->regmap, RT5668_HP_CALIB_STA_1, &value); rt5668 2447 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_STO1_ADC_MIXER, 0xc0c4); rt5668 2448 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_PWR_DIG_1, 0x0000); rt5668 2450 sound/soc/codecs/rt5668.c mutex_unlock(&rt5668->calibrate_mutex); rt5668 2458 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668; rt5668 2462 sound/soc/codecs/rt5668.c rt5668 = devm_kzalloc(&i2c->dev, sizeof(struct rt5668_priv), rt5668 2465 sound/soc/codecs/rt5668.c if (rt5668 == NULL) rt5668 2468 sound/soc/codecs/rt5668.c i2c_set_clientdata(i2c, rt5668); rt5668 2471 sound/soc/codecs/rt5668.c rt5668->pdata = *pdata; rt5668 2473 sound/soc/codecs/rt5668.c rt5668_parse_dt(rt5668, &i2c->dev); rt5668 2475 sound/soc/codecs/rt5668.c rt5668->regmap = devm_regmap_init_i2c(i2c, &rt5668_regmap); rt5668 2476 sound/soc/codecs/rt5668.c if (IS_ERR(rt5668->regmap)) { rt5668 2477 sound/soc/codecs/rt5668.c ret = PTR_ERR(rt5668->regmap); rt5668 2483 sound/soc/codecs/rt5668.c for (i = 0; i < ARRAY_SIZE(rt5668->supplies); i++) rt5668 2484 sound/soc/codecs/rt5668.c rt5668->supplies[i].supply = rt5668_supply_names[i]; rt5668 2486 sound/soc/codecs/rt5668.c ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(rt5668->supplies), rt5668 2487 sound/soc/codecs/rt5668.c rt5668->supplies); rt5668 2493 sound/soc/codecs/rt5668.c ret = regulator_bulk_enable(ARRAY_SIZE(rt5668->supplies), rt5668 2494 sound/soc/codecs/rt5668.c rt5668->supplies); rt5668 2500 sound/soc/codecs/rt5668.c if (gpio_is_valid(rt5668->pdata.ldo1_en)) { rt5668 2501 sound/soc/codecs/rt5668.c if (devm_gpio_request_one(&i2c->dev, rt5668->pdata.ldo1_en, rt5668 2509 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_I2C_MODE, 0x1); rt5668 2512 sound/soc/codecs/rt5668.c regmap_read(rt5668->regmap, RT5668_DEVICE_ID, &val); rt5668 2518 sound/soc/codecs/rt5668.c rt5668_reset(rt5668->regmap); rt5668 2520 sound/soc/codecs/rt5668.c rt5668_calibrate(rt5668); rt5668 2522 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_DEPOP_1, 0x0000); rt5668 2525 sound/soc/codecs/rt5668.c if (rt5668->pdata.dmic1_data_pin != RT5668_DMIC1_NULL) { rt5668 2526 sound/soc/codecs/rt5668.c switch (rt5668->pdata.dmic1_data_pin) { rt5668 2528 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_DMIC_CTRL_1, rt5668 2530 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_GPIO_CTRL_1, rt5668 2535 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_DMIC_CTRL_1, rt5668 2537 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_GPIO_CTRL_1, rt5668 2546 sound/soc/codecs/rt5668.c switch (rt5668->pdata.dmic1_clk_pin) { rt5668 2548 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_GPIO_CTRL_1, rt5668 2553 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_GPIO_CTRL_1, rt5668 2563 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_PWR_ANLG_1, rt5668 2566 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_MICBIAS_2, 0x0380); rt5668 2567 sound/soc/codecs/rt5668.c regmap_update_bits(rt5668->regmap, RT5668_GPIO_CTRL_1, rt5668 2570 sound/soc/codecs/rt5668.c regmap_write(rt5668->regmap, RT5668_TEST_MODE_CTRL_1, 0x0000); rt5668 2572 sound/soc/codecs/rt5668.c INIT_DELAYED_WORK(&rt5668->jack_detect_work, rt5668 2574 sound/soc/codecs/rt5668.c INIT_DELAYED_WORK(&rt5668->jd_check_work, rt5668 2577 sound/soc/codecs/rt5668.c mutex_init(&rt5668->calibrate_mutex); rt5668 2582 sound/soc/codecs/rt5668.c | IRQF_ONESHOT, "rt5668", rt5668); rt5668 2594 sound/soc/codecs/rt5668.c struct rt5668_priv *rt5668 = i2c_get_clientdata(client); rt5668 2596 sound/soc/codecs/rt5668.c rt5668_reset(rt5668->regmap);