rt5640 463 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 466 sound/soc/codecs/rt5640.c rate = rt5640->sysclk / rl6231_get_pre_div(rt5640->regmap, rt5640 481 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 483 sound/soc/codecs/rt5640.c if (!rt5640->asrc_en) rt5640 919 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 922 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_PR_BASE + rt5640 924 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_DEPOP_M2, rt5640 926 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_DEPOP_M1, rt5640 929 sound/soc/codecs/rt5640.c regmap_write(rt5640->regmap, RT5640_PR_BASE + RT5640_HP_DCC_INT1, rt5640 932 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_PWR_ANLG1, rt5640 934 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_PWR_ANLG1, rt5640 938 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_PWR_ANLG1, rt5640 945 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 947 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_DEPOP_M2, rt5640 950 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_CHARGE_PUMP, rt5640 953 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_DEPOP_M3, rt5640 959 sound/soc/codecs/rt5640.c regmap_write(rt5640->regmap, RT5640_PR_BASE + rt5640 961 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_DEPOP_M1, rt5640 964 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_PR_BASE + rt5640 972 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 977 sound/soc/codecs/rt5640.c rt5640->hp_mute = false; rt5640 981 sound/soc/codecs/rt5640.c rt5640->hp_mute = true; rt5640 1041 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 1045 sound/soc/codecs/rt5640.c if (!rt5640->hp_mute) rt5640 1701 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 1705 sound/soc/codecs/rt5640.c rt5640->lrck[dai->id] = params_rate(params); rt5640 1706 sound/soc/codecs/rt5640.c pre_div = rl6231_get_clk_info(rt5640->sysclk, rt5640->lrck[dai->id]); rt5640 1709 sound/soc/codecs/rt5640.c rt5640->lrck[dai->id], dai->id); rt5640 1721 sound/soc/codecs/rt5640.c rt5640->bclk[dai->id] = rt5640->lrck[dai->id] * (32 << bclk_ms); rt5640 1724 sound/soc/codecs/rt5640.c rt5640->bclk[dai->id], rt5640->lrck[dai->id]); rt5640 1772 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 1778 sound/soc/codecs/rt5640.c rt5640->master[dai->id] = 1; rt5640 1782 sound/soc/codecs/rt5640.c rt5640->master[dai->id] = 0; rt5640 1837 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 1841 sound/soc/codecs/rt5640.c if (freq == rt5640->sysclk && clk_id == rt5640->sysclk_src) rt5640 1863 sound/soc/codecs/rt5640.c rt5640->sysclk = freq; rt5640 1864 sound/soc/codecs/rt5640.c rt5640->sysclk_src = clk_id; rt5640 1874 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 1878 sound/soc/codecs/rt5640.c if (source == rt5640->pll_src && freq_in == rt5640->pll_in && rt5640 1879 sound/soc/codecs/rt5640.c freq_out == rt5640->pll_out) rt5640 1885 sound/soc/codecs/rt5640.c rt5640->pll_in = 0; rt5640 1886 sound/soc/codecs/rt5640.c rt5640->pll_out = 0; rt5640 1926 sound/soc/codecs/rt5640.c rt5640->pll_in = freq_in; rt5640 1927 sound/soc/codecs/rt5640.c rt5640->pll_out = freq_out; rt5640 1928 sound/soc/codecs/rt5640.c rt5640->pll_src = source; rt5640 1936 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 1951 sound/soc/codecs/rt5640.c if (IS_ERR(rt5640->mclk)) rt5640 1955 sound/soc/codecs/rt5640.c clk_disable_unprepare(rt5640->mclk); rt5640 1957 sound/soc/codecs/rt5640.c ret = clk_prepare_enable(rt5640->mclk); rt5640 2003 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 2005 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_GPIO_CTRL1, rt5640 2009 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_DMIC, rt5640 2011 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_GPIO_CTRL1, rt5640 2016 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_DMIC, rt5640 2018 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_GPIO_CTRL1, rt5640 2029 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 2085 sound/soc/codecs/rt5640.c rt5640->asrc_en = true; rt5640 2088 sound/soc/codecs/rt5640.c rt5640->asrc_en = false; rt5640 2123 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 2127 sound/soc/codecs/rt5640.c rt5640->ovcd_irq_enabled = true; rt5640 2132 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 2136 sound/soc/codecs/rt5640.c rt5640->ovcd_irq_enabled = false; rt5640 2157 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 2163 sound/soc/codecs/rt5640.c if (rt5640->jd_inverted) rt5640 2180 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 2182 sound/soc/codecs/rt5640.c rt5640->poll_count = 0; rt5640 2183 sound/soc/codecs/rt5640.c rt5640->press_count = 0; rt5640 2184 sound/soc/codecs/rt5640.c rt5640->release_count = 0; rt5640 2185 sound/soc/codecs/rt5640.c rt5640->pressed = false; rt5640 2186 sound/soc/codecs/rt5640.c rt5640->press_reported = false; rt5640 2188 sound/soc/codecs/rt5640.c schedule_delayed_work(&rt5640->bp_work, msecs_to_jiffies(BP_POLL_TIME)); rt5640 2193 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = rt5640 2195 sound/soc/codecs/rt5640.c struct snd_soc_component *component = rt5640->component; rt5640 2202 sound/soc/codecs/rt5640.c rt5640->release_count = 0; rt5640 2203 sound/soc/codecs/rt5640.c rt5640->press_count++; rt5640 2205 sound/soc/codecs/rt5640.c if (rt5640->press_count >= BP_THRESHOLD) rt5640 2206 sound/soc/codecs/rt5640.c rt5640->pressed = true; rt5640 2209 sound/soc/codecs/rt5640.c rt5640->press_count = 0; rt5640 2210 sound/soc/codecs/rt5640.c rt5640->release_count++; rt5640 2217 sound/soc/codecs/rt5640.c rt5640->poll_count++; rt5640 2218 sound/soc/codecs/rt5640.c if (rt5640->poll_count < (JACK_UNPLUG_TIME / BP_POLL_TIME)) { rt5640 2219 sound/soc/codecs/rt5640.c schedule_delayed_work(&rt5640->bp_work, rt5640 2224 sound/soc/codecs/rt5640.c if (rt5640->pressed && !rt5640->press_reported) { rt5640 2226 sound/soc/codecs/rt5640.c snd_soc_jack_report(rt5640->jack, SND_JACK_BTN_0, rt5640 2228 sound/soc/codecs/rt5640.c rt5640->press_reported = true; rt5640 2231 sound/soc/codecs/rt5640.c if (rt5640->release_count >= BP_THRESHOLD) { rt5640 2232 sound/soc/codecs/rt5640.c if (rt5640->press_reported) { rt5640 2234 sound/soc/codecs/rt5640.c snd_soc_jack_report(rt5640->jack, 0, SND_JACK_BTN_0); rt5640 2241 sound/soc/codecs/rt5640.c schedule_delayed_work(&rt5640->bp_work, msecs_to_jiffies(BP_POLL_TIME)); rt5640 2291 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = rt5640 2293 sound/soc/codecs/rt5640.c struct snd_soc_component *component = rt5640->component; rt5640 2298 sound/soc/codecs/rt5640.c if (rt5640->jack->status & SND_JACK_HEADPHONE) { rt5640 2299 sound/soc/codecs/rt5640.c if (rt5640->jack->status & SND_JACK_MICROPHONE) { rt5640 2300 sound/soc/codecs/rt5640.c cancel_delayed_work_sync(&rt5640->bp_work); rt5640 2304 sound/soc/codecs/rt5640.c snd_soc_jack_report(rt5640->jack, 0, rt5640 2308 sound/soc/codecs/rt5640.c } else if (!(rt5640->jack->status & SND_JACK_HEADPHONE)) { rt5640 2310 sound/soc/codecs/rt5640.c WARN_ON(rt5640->ovcd_irq_enabled); rt5640 2321 sound/soc/codecs/rt5640.c snd_soc_jack_report(rt5640->jack, status, SND_JACK_HEADSET); rt5640 2322 sound/soc/codecs/rt5640.c } else if (rt5640->ovcd_irq_enabled && rt5640_micbias1_ovcd(component)) { rt5640 2343 sound/soc/codecs/rt5640.c queue_work(system_long_wq, &rt5640->jack_work); rt5640 2349 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = data; rt5640 2351 sound/soc/codecs/rt5640.c if (rt5640->jack) rt5640 2352 sound/soc/codecs/rt5640.c queue_work(system_long_wq, &rt5640->jack_work); rt5640 2359 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = data; rt5640 2361 sound/soc/codecs/rt5640.c cancel_work_sync(&rt5640->jack_work); rt5640 2362 sound/soc/codecs/rt5640.c cancel_delayed_work_sync(&rt5640->bp_work); rt5640 2368 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 2372 sound/soc/codecs/rt5640.c RT5640_JD_MASK, rt5640->jd_src); rt5640 2389 sound/soc/codecs/rt5640.c 0xa800 | rt5640->ovcd_sf); rt5640 2393 sound/soc/codecs/rt5640.c rt5640->ovcd_th | RT5640_MIC1_OVCD_EN); rt5640 2413 sound/soc/codecs/rt5640.c if (rt5640->jd_inverted) rt5640 2420 sound/soc/codecs/rt5640.c rt5640->jack = jack; rt5640 2421 sound/soc/codecs/rt5640.c if (rt5640->jack->status & SND_JACK_MICROPHONE) { rt5640 2426 sound/soc/codecs/rt5640.c enable_irq(rt5640->irq); rt5640 2428 sound/soc/codecs/rt5640.c queue_work(system_long_wq, &rt5640->jack_work); rt5640 2433 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 2439 sound/soc/codecs/rt5640.c if (!rt5640->jack) rt5640 2442 sound/soc/codecs/rt5640.c disable_irq(rt5640->irq); rt5640 2443 sound/soc/codecs/rt5640.c rt5640_cancel_work(rt5640); rt5640 2445 sound/soc/codecs/rt5640.c if (rt5640->jack->status & SND_JACK_MICROPHONE) { rt5640 2448 sound/soc/codecs/rt5640.c snd_soc_jack_report(rt5640->jack, 0, SND_JACK_BTN_0); rt5640 2451 sound/soc/codecs/rt5640.c rt5640->jack = NULL; rt5640 2468 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 2475 sound/soc/codecs/rt5640.c rt5640->mclk = devm_clk_get(component->dev, "mclk"); rt5640 2476 sound/soc/codecs/rt5640.c if (PTR_ERR(rt5640->mclk) == -EPROBE_DEFER) rt5640 2479 sound/soc/codecs/rt5640.c rt5640->component = component; rt5640 2551 sound/soc/codecs/rt5640.c rt5640->jd_src = val << RT5640_JD_SFT; rt5640 2558 sound/soc/codecs/rt5640.c rt5640->jd_inverted = true; rt5640 2565 sound/soc/codecs/rt5640.c rt5640->ovcd_th = RT5640_MIC1_OVTH_2000UA; rt5640 2566 sound/soc/codecs/rt5640.c rt5640->ovcd_sf = RT5640_MIC_OVCD_SF_0P75; rt5640 2572 sound/soc/codecs/rt5640.c rt5640->ovcd_th = RT5640_MIC1_OVTH_600UA; rt5640 2575 sound/soc/codecs/rt5640.c rt5640->ovcd_th = RT5640_MIC1_OVTH_1500UA; rt5640 2578 sound/soc/codecs/rt5640.c rt5640->ovcd_th = RT5640_MIC1_OVTH_2000UA; rt5640 2589 sound/soc/codecs/rt5640.c rt5640->ovcd_sf = val << RT5640_MIC_OVCD_SF_SFT; rt5640 2606 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 2610 sound/soc/codecs/rt5640.c regcache_cache_only(rt5640->regmap, true); rt5640 2611 sound/soc/codecs/rt5640.c regcache_mark_dirty(rt5640->regmap); rt5640 2612 sound/soc/codecs/rt5640.c if (gpio_is_valid(rt5640->ldo1_en)) rt5640 2613 sound/soc/codecs/rt5640.c gpio_set_value_cansleep(rt5640->ldo1_en, 0); rt5640 2620 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); rt5640 2622 sound/soc/codecs/rt5640.c if (gpio_is_valid(rt5640->ldo1_en)) { rt5640 2623 sound/soc/codecs/rt5640.c gpio_set_value_cansleep(rt5640->ldo1_en, 1); rt5640 2627 sound/soc/codecs/rt5640.c regcache_cache_only(rt5640->regmap, false); rt5640 2628 sound/soc/codecs/rt5640.c regcache_sync(rt5640->regmap); rt5640 2755 sound/soc/codecs/rt5640.c static int rt5640_parse_dt(struct rt5640_priv *rt5640, struct device_node *np) rt5640 2757 sound/soc/codecs/rt5640.c rt5640->ldo1_en = of_get_named_gpio(np, "realtek,ldo1-en-gpios", 0); rt5640 2764 sound/soc/codecs/rt5640.c if (!gpio_is_valid(rt5640->ldo1_en) && rt5640 2765 sound/soc/codecs/rt5640.c (rt5640->ldo1_en != -ENOENT)) rt5640 2766 sound/soc/codecs/rt5640.c return rt5640->ldo1_en; rt5640 2774 sound/soc/codecs/rt5640.c struct rt5640_priv *rt5640; rt5640 2778 sound/soc/codecs/rt5640.c rt5640 = devm_kzalloc(&i2c->dev, rt5640 2781 sound/soc/codecs/rt5640.c if (NULL == rt5640) rt5640 2783 sound/soc/codecs/rt5640.c i2c_set_clientdata(i2c, rt5640); rt5640 2786 sound/soc/codecs/rt5640.c ret = rt5640_parse_dt(rt5640, i2c->dev.of_node); rt5640 2790 sound/soc/codecs/rt5640.c rt5640->ldo1_en = -EINVAL; rt5640 2792 sound/soc/codecs/rt5640.c rt5640->regmap = devm_regmap_init_i2c(i2c, &rt5640_regmap); rt5640 2793 sound/soc/codecs/rt5640.c if (IS_ERR(rt5640->regmap)) { rt5640 2794 sound/soc/codecs/rt5640.c ret = PTR_ERR(rt5640->regmap); rt5640 2800 sound/soc/codecs/rt5640.c if (gpio_is_valid(rt5640->ldo1_en)) { rt5640 2801 sound/soc/codecs/rt5640.c ret = devm_gpio_request_one(&i2c->dev, rt5640->ldo1_en, rt5640 2806 sound/soc/codecs/rt5640.c rt5640->ldo1_en, ret); rt5640 2812 sound/soc/codecs/rt5640.c regmap_read(rt5640->regmap, RT5640_VENDOR_ID2, &val); rt5640 2819 sound/soc/codecs/rt5640.c regmap_write(rt5640->regmap, RT5640_RESET, 0); rt5640 2821 sound/soc/codecs/rt5640.c ret = regmap_register_patch(rt5640->regmap, init_list, rt5640 2826 sound/soc/codecs/rt5640.c regmap_update_bits(rt5640->regmap, RT5640_DUMMY1, rt5640 2829 sound/soc/codecs/rt5640.c rt5640->hp_mute = true; rt5640 2830 sound/soc/codecs/rt5640.c rt5640->irq = i2c->irq; rt5640 2831 sound/soc/codecs/rt5640.c INIT_DELAYED_WORK(&rt5640->bp_work, rt5640_button_press_work); rt5640 2832 sound/soc/codecs/rt5640.c INIT_WORK(&rt5640->jack_work, rt5640_jack_work); rt5640 2835 sound/soc/codecs/rt5640.c ret = devm_add_action_or_reset(&i2c->dev, rt5640_cancel_work, rt5640); rt5640 2839 sound/soc/codecs/rt5640.c ret = devm_request_irq(&i2c->dev, rt5640->irq, rt5640_irq, rt5640 2841 sound/soc/codecs/rt5640.c | IRQF_ONESHOT, "rt5640", rt5640); rt5640 2844 sound/soc/codecs/rt5640.c disable_irq(rt5640->irq); rt5640 2847 sound/soc/codecs/rt5640.c rt5640->irq, ret); rt5640 2848 sound/soc/codecs/rt5640.c rt5640->irq = -ENXIO;