rt5682            910 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682            942 sound/soc/codecs/rt5682.c 			rt5682->jack_type = SND_JACK_HEADSET;
rt5682            946 sound/soc/codecs/rt5682.c 			rt5682->jack_type = SND_JACK_HEADPHONE;
rt5682            958 sound/soc/codecs/rt5682.c 		rt5682->jack_type = 0;
rt5682            961 sound/soc/codecs/rt5682.c 	dev_dbg(component->dev, "jack_type = %d\n", rt5682->jack_type);
rt5682            962 sound/soc/codecs/rt5682.c 	return rt5682->jack_type;
rt5682            967 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = data;
rt5682            970 sound/soc/codecs/rt5682.c 			&rt5682->jack_detect_work, msecs_to_jiffies(250));
rt5682            977 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = container_of(work, struct rt5682_priv,
rt5682            980 sound/soc/codecs/rt5682.c 	if (snd_soc_component_read32(rt5682->component, RT5682_AJD1_CTRL)
rt5682            983 sound/soc/codecs/rt5682.c 		rt5682->jack_type = rt5682_headset_detect(rt5682->component, 0);
rt5682            985 sound/soc/codecs/rt5682.c 		snd_soc_jack_report(rt5682->hs_jack, rt5682->jack_type,
rt5682            990 sound/soc/codecs/rt5682.c 		schedule_delayed_work(&rt5682->jd_check_work, 500);
rt5682            997 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682            999 sound/soc/codecs/rt5682.c 	rt5682->hs_jack = hs_jack;
rt5682           1002 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_IRQ_CTRL_2,
rt5682           1004 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_RC_CLK_CTRL,
rt5682           1009 sound/soc/codecs/rt5682.c 	switch (rt5682->pdata.jd_src) {
rt5682           1018 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_GPIO_CTRL_1,
rt5682           1020 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_RC_CLK_CTRL,
rt5682           1024 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_2,
rt5682           1027 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_IRQ_CTRL_2,
rt5682           1031 sound/soc/codecs/rt5682.c 			   &rt5682->jack_detect_work, msecs_to_jiffies(250));
rt5682           1035 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_IRQ_CTRL_2,
rt5682           1037 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_RC_CLK_CTRL,
rt5682           1051 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 =
rt5682           1055 sound/soc/codecs/rt5682.c 	while (!rt5682->component)
rt5682           1058 sound/soc/codecs/rt5682.c 	while (!rt5682->component->card->instantiated)
rt5682           1061 sound/soc/codecs/rt5682.c 	mutex_lock(&rt5682->calibrate_mutex);
rt5682           1063 sound/soc/codecs/rt5682.c 	val = snd_soc_component_read32(rt5682->component, RT5682_AJD1_CTRL)
rt5682           1067 sound/soc/codecs/rt5682.c 		if (rt5682->jack_type == 0) {
rt5682           1069 sound/soc/codecs/rt5682.c 			rt5682->jack_type =
rt5682           1070 sound/soc/codecs/rt5682.c 				rt5682_headset_detect(rt5682->component, 1);
rt5682           1073 sound/soc/codecs/rt5682.c 			rt5682->jack_type = SND_JACK_HEADSET;
rt5682           1074 sound/soc/codecs/rt5682.c 			btn_type = rt5682_button_detect(rt5682->component);
rt5682           1086 sound/soc/codecs/rt5682.c 				rt5682->jack_type |= SND_JACK_BTN_0;
rt5682           1091 sound/soc/codecs/rt5682.c 				rt5682->jack_type |= SND_JACK_BTN_1;
rt5682           1096 sound/soc/codecs/rt5682.c 				rt5682->jack_type |= SND_JACK_BTN_2;
rt5682           1101 sound/soc/codecs/rt5682.c 				rt5682->jack_type |= SND_JACK_BTN_3;
rt5682           1107 sound/soc/codecs/rt5682.c 				dev_err(rt5682->component->dev,
rt5682           1115 sound/soc/codecs/rt5682.c 		rt5682->jack_type = rt5682_headset_detect(rt5682->component, 0);
rt5682           1118 sound/soc/codecs/rt5682.c 	snd_soc_jack_report(rt5682->hs_jack, rt5682->jack_type,
rt5682           1123 sound/soc/codecs/rt5682.c 	if (rt5682->jack_type & (SND_JACK_BTN_0 | SND_JACK_BTN_1 |
rt5682           1125 sound/soc/codecs/rt5682.c 		schedule_delayed_work(&rt5682->jd_check_work, 0);
rt5682           1127 sound/soc/codecs/rt5682.c 		cancel_delayed_work_sync(&rt5682->jd_check_work);
rt5682           1129 sound/soc/codecs/rt5682.c 	mutex_unlock(&rt5682->calibrate_mutex);
rt5682           1154 sound/soc/codecs/rt5682.c static int rt5682_div_sel(struct rt5682_priv *rt5682,
rt5682           1159 sound/soc/codecs/rt5682.c 	if (rt5682->sysclk < target) {
rt5682           1161 sound/soc/codecs/rt5682.c 			rt5682->sysclk);
rt5682           1167 sound/soc/codecs/rt5682.c 		if (target * div[i] == rt5682->sysclk)
rt5682           1169 sound/soc/codecs/rt5682.c 		if (target * div[i + 1] > rt5682->sysclk) {
rt5682           1171 sound/soc/codecs/rt5682.c 				rt5682->sysclk);
rt5682           1176 sound/soc/codecs/rt5682.c 	if (target * div[i] < rt5682->sysclk)
rt5682           1178 sound/soc/codecs/rt5682.c 			rt5682->sysclk);
rt5682           1199 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682           1203 sound/soc/codecs/rt5682.c 	idx = rt5682_div_sel(rt5682, 1500000, div, ARRAY_SIZE(div));
rt5682           1216 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682           1225 sound/soc/codecs/rt5682.c 		ref = 256 * rt5682->lrck[RT5682_AIF2];
rt5682           1227 sound/soc/codecs/rt5682.c 		ref = 256 * rt5682->lrck[RT5682_AIF1];
rt5682           1229 sound/soc/codecs/rt5682.c 	idx = rt5682_div_sel(rt5682, ref, div_f, ARRAY_SIZE(div_f));
rt5682           1241 sound/soc/codecs/rt5682.c 		if (rt5682->sysclk <= 12288000 * div_o[idx])
rt5682           1999 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682           2003 sound/soc/codecs/rt5682.c 	rt5682->lrck[dai->id] = params_rate(params);
rt5682           2004 sound/soc/codecs/rt5682.c 	pre_div = rl6231_get_clk_info(rt5682->sysclk, rt5682->lrck[dai->id]);
rt5682           2014 sound/soc/codecs/rt5682.c 				rt5682->lrck[dai->id], pre_div, dai->id);
rt5682           2043 sound/soc/codecs/rt5682.c 		if (rt5682->master[RT5682_AIF1]) {
rt5682           2060 sound/soc/codecs/rt5682.c 		if (rt5682->master[RT5682_AIF2]) {
rt5682           2085 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682           2090 sound/soc/codecs/rt5682.c 		rt5682->master[dai->id] = 1;
rt5682           2093 sound/soc/codecs/rt5682.c 		rt5682->master[dai->id] = 0;
rt5682           2150 sound/soc/codecs/rt5682.c 			tdm_ctrl | rt5682->master[dai->id]);
rt5682           2153 sound/soc/codecs/rt5682.c 		if (rt5682->master[dai->id] == 0)
rt5682           2169 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682           2172 sound/soc/codecs/rt5682.c 	if (freq == rt5682->sysclk && clk_id == rt5682->sysclk_src)
rt5682           2199 sound/soc/codecs/rt5682.c 	if (rt5682->master[RT5682_AIF2]) {
rt5682           2205 sound/soc/codecs/rt5682.c 	rt5682->sysclk = freq;
rt5682           2206 sound/soc/codecs/rt5682.c 	rt5682->sysclk_src = clk_id;
rt5682           2218 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682           2222 sound/soc/codecs/rt5682.c 	if (source == rt5682->pll_src && freq_in == rt5682->pll_in &&
rt5682           2223 sound/soc/codecs/rt5682.c 	    freq_out == rt5682->pll_out)
rt5682           2229 sound/soc/codecs/rt5682.c 		rt5682->pll_in = 0;
rt5682           2230 sound/soc/codecs/rt5682.c 		rt5682->pll_out = 0;
rt5682           2266 sound/soc/codecs/rt5682.c 	rt5682->pll_in = freq_in;
rt5682           2267 sound/soc/codecs/rt5682.c 	rt5682->pll_out = freq_out;
rt5682           2268 sound/soc/codecs/rt5682.c 	rt5682->pll_src = source;
rt5682           2276 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682           2278 sound/soc/codecs/rt5682.c 	rt5682->bclk[dai->id] = ratio;
rt5682           2302 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682           2306 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1,
rt5682           2308 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_PWR_DIG_1,
rt5682           2314 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_PWR_DIG_1,
rt5682           2318 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_PWR_DIG_1,
rt5682           2320 sound/soc/codecs/rt5682.c 		regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1,
rt5682           2333 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682           2335 sound/soc/codecs/rt5682.c 	rt5682->component = component;
rt5682           2342 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682           2344 sound/soc/codecs/rt5682.c 	rt5682_reset(rt5682->regmap);
rt5682           2350 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682           2352 sound/soc/codecs/rt5682.c 	regcache_cache_only(rt5682->regmap, true);
rt5682           2353 sound/soc/codecs/rt5682.c 	regcache_mark_dirty(rt5682->regmap);
rt5682           2359 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682           2361 sound/soc/codecs/rt5682.c 	regcache_cache_only(rt5682->regmap, false);
rt5682           2362 sound/soc/codecs/rt5682.c 	regcache_sync(rt5682->regmap);
rt5682           2364 sound/soc/codecs/rt5682.c 	rt5682_irq(0, rt5682);
rt5682           2462 sound/soc/codecs/rt5682.c static int rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev)
rt5682           2466 sound/soc/codecs/rt5682.c 		&rt5682->pdata.dmic1_data_pin);
rt5682           2468 sound/soc/codecs/rt5682.c 		&rt5682->pdata.dmic1_clk_pin);
rt5682           2470 sound/soc/codecs/rt5682.c 		&rt5682->pdata.jd_src);
rt5682           2472 sound/soc/codecs/rt5682.c 	rt5682->pdata.ldo1_en = of_get_named_gpio(dev->of_node,
rt5682           2478 sound/soc/codecs/rt5682.c static void rt5682_calibrate(struct rt5682_priv *rt5682)
rt5682           2482 sound/soc/codecs/rt5682.c 	mutex_lock(&rt5682->calibrate_mutex);
rt5682           2484 sound/soc/codecs/rt5682.c 	rt5682_reset(rt5682->regmap);
rt5682           2485 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_I2C_CTRL, 0x000f);
rt5682           2486 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_PWR_ANLG_1, 0xa2af);
rt5682           2488 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_PWR_ANLG_1, 0xf2af);
rt5682           2489 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_MICBIAS_2, 0x0300);
rt5682           2490 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_GLB_CLK, 0x8000);
rt5682           2491 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_PWR_DIG_1, 0x0100);
rt5682           2492 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_HP_IMP_SENS_CTRL_19, 0x3800);
rt5682           2493 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_CHOP_DAC, 0x3000);
rt5682           2494 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_CALIB_ADC_CTRL, 0x7005);
rt5682           2495 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_STO1_ADC_MIXER, 0x686c);
rt5682           2496 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_CAL_REC, 0x0d0d);
rt5682           2497 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_HP_CALIB_CTRL_2, 0x0321);
rt5682           2498 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_HP_LOGIC_CTRL_2, 0x0004);
rt5682           2499 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_HP_CALIB_CTRL_1, 0x7c00);
rt5682           2500 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_HP_CALIB_CTRL_3, 0x06a1);
rt5682           2501 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_A_DAC1_MUX, 0x0311);
rt5682           2502 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_HP_CALIB_CTRL_1, 0x7c00);
rt5682           2504 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_HP_CALIB_CTRL_1, 0xfc00);
rt5682           2507 sound/soc/codecs/rt5682.c 		regmap_read(rt5682->regmap, RT5682_HP_CALIB_STA_1, &value);
rt5682           2518 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_PWR_ANLG_1, 0x02af);
rt5682           2519 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_MICBIAS_2, 0x0080);
rt5682           2520 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_GLB_CLK, 0x0000);
rt5682           2521 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_PWR_DIG_1, 0x0000);
rt5682           2522 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_CHOP_DAC, 0x2000);
rt5682           2523 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_CALIB_ADC_CTRL, 0x2005);
rt5682           2524 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_STO1_ADC_MIXER, 0xc0c4);
rt5682           2526 sound/soc/codecs/rt5682.c 	mutex_unlock(&rt5682->calibrate_mutex);
rt5682           2534 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682;
rt5682           2538 sound/soc/codecs/rt5682.c 	rt5682 = devm_kzalloc(&i2c->dev, sizeof(struct rt5682_priv),
rt5682           2541 sound/soc/codecs/rt5682.c 	if (rt5682 == NULL)
rt5682           2544 sound/soc/codecs/rt5682.c 	i2c_set_clientdata(i2c, rt5682);
rt5682           2546 sound/soc/codecs/rt5682.c 	rt5682->pdata = i2s_default_platform_data;
rt5682           2549 sound/soc/codecs/rt5682.c 		rt5682->pdata = *pdata;
rt5682           2551 sound/soc/codecs/rt5682.c 		rt5682_parse_dt(rt5682, &i2c->dev);
rt5682           2553 sound/soc/codecs/rt5682.c 	rt5682->regmap = devm_regmap_init_i2c(i2c, &rt5682_regmap);
rt5682           2554 sound/soc/codecs/rt5682.c 	if (IS_ERR(rt5682->regmap)) {
rt5682           2555 sound/soc/codecs/rt5682.c 		ret = PTR_ERR(rt5682->regmap);
rt5682           2561 sound/soc/codecs/rt5682.c 	for (i = 0; i < ARRAY_SIZE(rt5682->supplies); i++)
rt5682           2562 sound/soc/codecs/rt5682.c 		rt5682->supplies[i].supply = rt5682_supply_names[i];
rt5682           2564 sound/soc/codecs/rt5682.c 	ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(rt5682->supplies),
rt5682           2565 sound/soc/codecs/rt5682.c 				      rt5682->supplies);
rt5682           2571 sound/soc/codecs/rt5682.c 	ret = regulator_bulk_enable(ARRAY_SIZE(rt5682->supplies),
rt5682           2572 sound/soc/codecs/rt5682.c 				    rt5682->supplies);
rt5682           2578 sound/soc/codecs/rt5682.c 	if (gpio_is_valid(rt5682->pdata.ldo1_en)) {
rt5682           2579 sound/soc/codecs/rt5682.c 		if (devm_gpio_request_one(&i2c->dev, rt5682->pdata.ldo1_en,
rt5682           2587 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_I2C_MODE, 0x1);
rt5682           2590 sound/soc/codecs/rt5682.c 	regmap_read(rt5682->regmap, RT5682_DEVICE_ID, &val);
rt5682           2596 sound/soc/codecs/rt5682.c 	rt5682_reset(rt5682->regmap);
rt5682           2598 sound/soc/codecs/rt5682.c 	mutex_init(&rt5682->calibrate_mutex);
rt5682           2599 sound/soc/codecs/rt5682.c 	rt5682_calibrate(rt5682);
rt5682           2601 sound/soc/codecs/rt5682.c 	ret = regmap_multi_reg_write(rt5682->regmap, patch_list,
rt5682           2606 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_DEPOP_1, 0x0000);
rt5682           2609 sound/soc/codecs/rt5682.c 	if (rt5682->pdata.dmic1_data_pin != RT5682_DMIC1_NULL) {
rt5682           2610 sound/soc/codecs/rt5682.c 		switch (rt5682->pdata.dmic1_data_pin) {
rt5682           2612 sound/soc/codecs/rt5682.c 			regmap_update_bits(rt5682->regmap, RT5682_DMIC_CTRL_1,
rt5682           2614 sound/soc/codecs/rt5682.c 			regmap_update_bits(rt5682->regmap, RT5682_GPIO_CTRL_1,
rt5682           2619 sound/soc/codecs/rt5682.c 			regmap_update_bits(rt5682->regmap, RT5682_DMIC_CTRL_1,
rt5682           2621 sound/soc/codecs/rt5682.c 			regmap_update_bits(rt5682->regmap, RT5682_GPIO_CTRL_1,
rt5682           2630 sound/soc/codecs/rt5682.c 		switch (rt5682->pdata.dmic1_clk_pin) {
rt5682           2632 sound/soc/codecs/rt5682.c 			regmap_update_bits(rt5682->regmap, RT5682_GPIO_CTRL_1,
rt5682           2637 sound/soc/codecs/rt5682.c 			regmap_update_bits(rt5682->regmap, RT5682_GPIO_CTRL_1,
rt5682           2647 sound/soc/codecs/rt5682.c 	regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1,
rt5682           2650 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_MICBIAS_2, 0x0380);
rt5682           2651 sound/soc/codecs/rt5682.c 	regmap_update_bits(rt5682->regmap, RT5682_GPIO_CTRL_1,
rt5682           2654 sound/soc/codecs/rt5682.c 	regmap_write(rt5682->regmap, RT5682_TEST_MODE_CTRL_1, 0x0000);
rt5682           2655 sound/soc/codecs/rt5682.c 	regmap_update_bits(rt5682->regmap, RT5682_BIAS_CUR_CTRL_8,
rt5682           2657 sound/soc/codecs/rt5682.c 	regmap_update_bits(rt5682->regmap, RT5682_CHARGE_PUMP_1,
rt5682           2660 sound/soc/codecs/rt5682.c 	INIT_DELAYED_WORK(&rt5682->jack_detect_work,
rt5682           2662 sound/soc/codecs/rt5682.c 	INIT_DELAYED_WORK(&rt5682->jd_check_work,
rt5682           2669 sound/soc/codecs/rt5682.c 			| IRQF_ONESHOT, "rt5682", rt5682);
rt5682           2682 sound/soc/codecs/rt5682.c 	struct rt5682_priv *rt5682 = i2c_get_clientdata(client);
rt5682           2684 sound/soc/codecs/rt5682.c 	rt5682_reset(rt5682->regmap);