rt5651 380 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 383 sound/soc/codecs/rt5651.c rate = rt5651->sysclk / rl6231_get_pre_div(rt5651->regmap, rt5651 685 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 690 sound/soc/codecs/rt5651.c regmap_update_bits(rt5651->regmap, RT5651_PR_BASE + rt5651 692 sound/soc/codecs/rt5651.c regmap_update_bits(rt5651->regmap, RT5651_DEPOP_M2, rt5651 694 sound/soc/codecs/rt5651.c regmap_update_bits(rt5651->regmap, RT5651_DEPOP_M1, rt5651 698 sound/soc/codecs/rt5651.c regmap_write(rt5651->regmap, RT5651_PR_BASE + rt5651 701 sound/soc/codecs/rt5651.c regmap_update_bits(rt5651->regmap, RT5651_PWR_ANLG1, rt5651 703 sound/soc/codecs/rt5651.c regmap_update_bits(rt5651->regmap, RT5651_PWR_ANLG1, rt5651 707 sound/soc/codecs/rt5651.c regmap_update_bits(rt5651->regmap, RT5651_PWR_ANLG1, rt5651 723 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 728 sound/soc/codecs/rt5651.c regmap_update_bits(rt5651->regmap, RT5651_DEPOP_M2, rt5651 731 sound/soc/codecs/rt5651.c regmap_update_bits(rt5651->regmap, RT5651_CHARGE_PUMP, rt5651 734 sound/soc/codecs/rt5651.c regmap_update_bits(rt5651->regmap, RT5651_DEPOP_M3, rt5651 741 sound/soc/codecs/rt5651.c regmap_write(rt5651->regmap, RT5651_PR_BASE + rt5651 743 sound/soc/codecs/rt5651.c regmap_update_bits(rt5651->regmap, RT5651_DEPOP_M1, rt5651 746 sound/soc/codecs/rt5651.c regmap_update_bits(rt5651->regmap, RT5651_PR_BASE + rt5651 748 sound/soc/codecs/rt5651.c rt5651->hp_mute = false; rt5651 752 sound/soc/codecs/rt5651.c rt5651->hp_mute = true; rt5651 768 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 772 sound/soc/codecs/rt5651.c if (!rt5651->hp_mute) rt5651 1285 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 1289 sound/soc/codecs/rt5651.c rt5651->lrck[dai->id] = params_rate(params); rt5651 1290 sound/soc/codecs/rt5651.c pre_div = rl6231_get_clk_info(rt5651->sysclk, rt5651->lrck[dai->id]); rt5651 1302 sound/soc/codecs/rt5651.c rt5651->bclk[dai->id] = rt5651->lrck[dai->id] * (32 << bclk_ms); rt5651 1305 sound/soc/codecs/rt5651.c rt5651->bclk[dai->id], rt5651->lrck[dai->id]); rt5651 1351 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 1356 sound/soc/codecs/rt5651.c rt5651->master[dai->id] = 1; rt5651 1360 sound/soc/codecs/rt5651.c rt5651->master[dai->id] = 0; rt5651 1414 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 1418 sound/soc/codecs/rt5651.c if (freq == rt5651->sysclk && clk_id == rt5651->sysclk_src) rt5651 1440 sound/soc/codecs/rt5651.c rt5651->sysclk = freq; rt5651 1441 sound/soc/codecs/rt5651.c rt5651->sysclk_src = clk_id; rt5651 1452 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 1456 sound/soc/codecs/rt5651.c if (source == rt5651->pll_src && freq_in == rt5651->pll_in && rt5651 1457 sound/soc/codecs/rt5651.c freq_out == rt5651->pll_out) rt5651 1463 sound/soc/codecs/rt5651.c rt5651->pll_in = 0; rt5651 1464 sound/soc/codecs/rt5651.c rt5651->pll_out = 0; rt5651 1504 sound/soc/codecs/rt5651.c rt5651->pll_in = freq_in; rt5651 1505 sound/soc/codecs/rt5651.c rt5651->pll_out = freq_out; rt5651 1506 sound/soc/codecs/rt5651.c rt5651->pll_src = source; rt5651 1585 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 1589 sound/soc/codecs/rt5651.c rt5651->ovcd_irq_enabled = true; rt5651 1594 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 1598 sound/soc/codecs/rt5651.c rt5651->ovcd_irq_enabled = false; rt5651 1619 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 1622 sound/soc/codecs/rt5651.c if (rt5651->gpiod_hp_det) { rt5651 1623 sound/soc/codecs/rt5651.c val = gpiod_get_value_cansleep(rt5651->gpiod_hp_det); rt5651 1631 sound/soc/codecs/rt5651.c switch (rt5651->jd_src) { rt5651 1645 sound/soc/codecs/rt5651.c if (rt5651->jd_active_high) rt5651 1662 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 1664 sound/soc/codecs/rt5651.c rt5651->poll_count = 0; rt5651 1665 sound/soc/codecs/rt5651.c rt5651->press_count = 0; rt5651 1666 sound/soc/codecs/rt5651.c rt5651->release_count = 0; rt5651 1667 sound/soc/codecs/rt5651.c rt5651->pressed = false; rt5651 1668 sound/soc/codecs/rt5651.c rt5651->press_reported = false; rt5651 1670 sound/soc/codecs/rt5651.c schedule_delayed_work(&rt5651->bp_work, msecs_to_jiffies(BP_POLL_TIME)); rt5651 1675 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = rt5651 1677 sound/soc/codecs/rt5651.c struct snd_soc_component *component = rt5651->component; rt5651 1684 sound/soc/codecs/rt5651.c rt5651->release_count = 0; rt5651 1685 sound/soc/codecs/rt5651.c rt5651->press_count++; rt5651 1687 sound/soc/codecs/rt5651.c if (rt5651->press_count >= BP_THRESHOLD) rt5651 1688 sound/soc/codecs/rt5651.c rt5651->pressed = true; rt5651 1691 sound/soc/codecs/rt5651.c rt5651->press_count = 0; rt5651 1692 sound/soc/codecs/rt5651.c rt5651->release_count++; rt5651 1699 sound/soc/codecs/rt5651.c rt5651->poll_count++; rt5651 1700 sound/soc/codecs/rt5651.c if (rt5651->poll_count < (JACK_UNPLUG_TIME / BP_POLL_TIME)) { rt5651 1701 sound/soc/codecs/rt5651.c schedule_delayed_work(&rt5651->bp_work, rt5651 1706 sound/soc/codecs/rt5651.c if (rt5651->pressed && !rt5651->press_reported) { rt5651 1708 sound/soc/codecs/rt5651.c snd_soc_jack_report(rt5651->hp_jack, SND_JACK_BTN_0, rt5651 1710 sound/soc/codecs/rt5651.c rt5651->press_reported = true; rt5651 1713 sound/soc/codecs/rt5651.c if (rt5651->release_count >= BP_THRESHOLD) { rt5651 1714 sound/soc/codecs/rt5651.c if (rt5651->press_reported) { rt5651 1716 sound/soc/codecs/rt5651.c snd_soc_jack_report(rt5651->hp_jack, 0, SND_JACK_BTN_0); rt5651 1723 sound/soc/codecs/rt5651.c schedule_delayed_work(&rt5651->bp_work, msecs_to_jiffies(BP_POLL_TIME)); rt5651 1771 sound/soc/codecs/rt5651.c static bool rt5651_support_button_press(struct rt5651_priv *rt5651) rt5651 1773 sound/soc/codecs/rt5651.c if (!rt5651->hp_jack) rt5651 1777 sound/soc/codecs/rt5651.c return (rt5651->hp_jack->status & SND_JACK_MICROPHONE) && rt5651 1778 sound/soc/codecs/rt5651.c rt5651->gpiod_hp_det == NULL; rt5651 1783 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = rt5651 1785 sound/soc/codecs/rt5651.c struct snd_soc_component *component = rt5651->component; rt5651 1790 sound/soc/codecs/rt5651.c if (rt5651->hp_jack->status & SND_JACK_HEADPHONE) { rt5651 1791 sound/soc/codecs/rt5651.c if (rt5651->hp_jack->status & SND_JACK_MICROPHONE) { rt5651 1792 sound/soc/codecs/rt5651.c cancel_delayed_work_sync(&rt5651->bp_work); rt5651 1796 sound/soc/codecs/rt5651.c snd_soc_jack_report(rt5651->hp_jack, 0, rt5651 1800 sound/soc/codecs/rt5651.c } else if (!(rt5651->hp_jack->status & SND_JACK_HEADPHONE)) { rt5651 1802 sound/soc/codecs/rt5651.c WARN_ON(rt5651->ovcd_irq_enabled); rt5651 1806 sound/soc/codecs/rt5651.c snd_soc_jack_report(rt5651->hp_jack, report, SND_JACK_HEADSET); rt5651 1807 sound/soc/codecs/rt5651.c if (rt5651_support_button_press(rt5651)) { rt5651 1814 sound/soc/codecs/rt5651.c } else if (rt5651->ovcd_irq_enabled && rt5651_micbias1_ovcd(component)) { rt5651 1835 sound/soc/codecs/rt5651.c queue_work(system_long_wq, &rt5651->jack_detect_work); rt5651 1841 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = data; rt5651 1843 sound/soc/codecs/rt5651.c queue_work(system_power_efficient_wq, &rt5651->jack_detect_work); rt5651 1850 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = data; rt5651 1852 sound/soc/codecs/rt5651.c cancel_work_sync(&rt5651->jack_detect_work); rt5651 1853 sound/soc/codecs/rt5651.c cancel_delayed_work_sync(&rt5651->bp_work); rt5651 1860 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 1864 sound/soc/codecs/rt5651.c switch (rt5651->jd_src) { rt5651 1866 sound/soc/codecs/rt5651.c rt5651->gpiod_hp_det = gpiod_hp_det; rt5651 1867 sound/soc/codecs/rt5651.c if (!rt5651->gpiod_hp_det) rt5651 1875 sound/soc/codecs/rt5651.c if (rt5651->jd_active_high) rt5651 1890 sound/soc/codecs/rt5651.c if (rt5651->jd_active_high) rt5651 1905 sound/soc/codecs/rt5651.c if (rt5651->jd_active_high) rt5651 1933 sound/soc/codecs/rt5651.c 0xa800 | rt5651->ovcd_sf); rt5651 1941 sound/soc/codecs/rt5651.c rt5651->ovcd_th | rt5651 1957 sound/soc/codecs/rt5651.c rt5651->hp_jack = hp_jack; rt5651 1958 sound/soc/codecs/rt5651.c if (rt5651_support_button_press(rt5651)) { rt5651 1963 sound/soc/codecs/rt5651.c enable_irq(rt5651->irq); rt5651 1965 sound/soc/codecs/rt5651.c queue_work(system_power_efficient_wq, &rt5651->jack_detect_work); rt5651 1970 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 1972 sound/soc/codecs/rt5651.c disable_irq(rt5651->irq); rt5651 1973 sound/soc/codecs/rt5651.c rt5651_cancel_work(rt5651); rt5651 1975 sound/soc/codecs/rt5651.c if (rt5651_support_button_press(rt5651)) { rt5651 1978 sound/soc/codecs/rt5651.c snd_soc_jack_report(rt5651->hp_jack, 0, SND_JACK_BTN_0); rt5651 1981 sound/soc/codecs/rt5651.c rt5651->hp_jack = NULL; rt5651 2004 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 2017 sound/soc/codecs/rt5651.c rt5651->jd_src = val; rt5651 2020 sound/soc/codecs/rt5651.c rt5651->jd_active_high = true; rt5651 2027 sound/soc/codecs/rt5651.c rt5651->ovcd_th = RT5651_MIC1_OVTH_2000UA; rt5651 2028 sound/soc/codecs/rt5651.c rt5651->ovcd_sf = RT5651_MIC_OVCD_SF_0P75; rt5651 2034 sound/soc/codecs/rt5651.c rt5651->ovcd_th = RT5651_MIC1_OVTH_600UA; rt5651 2037 sound/soc/codecs/rt5651.c rt5651->ovcd_th = RT5651_MIC1_OVTH_1500UA; rt5651 2040 sound/soc/codecs/rt5651.c rt5651->ovcd_th = RT5651_MIC1_OVTH_2000UA; rt5651 2051 sound/soc/codecs/rt5651.c rt5651->ovcd_sf = val << RT5651_MIC_OVCD_SF_SFT; rt5651 2060 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 2062 sound/soc/codecs/rt5651.c rt5651->component = component; rt5651 2077 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 2079 sound/soc/codecs/rt5651.c regcache_cache_only(rt5651->regmap, true); rt5651 2080 sound/soc/codecs/rt5651.c regcache_mark_dirty(rt5651->regmap); rt5651 2086 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); rt5651 2088 sound/soc/codecs/rt5651.c regcache_cache_only(rt5651->regmap, false); rt5651 2215 sound/soc/codecs/rt5651.c struct rt5651_priv *rt5651; rt5651 2219 sound/soc/codecs/rt5651.c rt5651 = devm_kzalloc(&i2c->dev, sizeof(*rt5651), rt5651 2221 sound/soc/codecs/rt5651.c if (NULL == rt5651) rt5651 2224 sound/soc/codecs/rt5651.c i2c_set_clientdata(i2c, rt5651); rt5651 2226 sound/soc/codecs/rt5651.c rt5651->regmap = devm_regmap_init_i2c(i2c, &rt5651_regmap); rt5651 2227 sound/soc/codecs/rt5651.c if (IS_ERR(rt5651->regmap)) { rt5651 2228 sound/soc/codecs/rt5651.c ret = PTR_ERR(rt5651->regmap); rt5651 2234 sound/soc/codecs/rt5651.c err = regmap_read(rt5651->regmap, RT5651_DEVICE_ID, &ret); rt5651 2244 sound/soc/codecs/rt5651.c regmap_write(rt5651->regmap, RT5651_RESET, 0); rt5651 2246 sound/soc/codecs/rt5651.c ret = regmap_register_patch(rt5651->regmap, init_list, rt5651 2251 sound/soc/codecs/rt5651.c rt5651->irq = i2c->irq; rt5651 2252 sound/soc/codecs/rt5651.c rt5651->hp_mute = true; rt5651 2254 sound/soc/codecs/rt5651.c INIT_DELAYED_WORK(&rt5651->bp_work, rt5651_button_press_work); rt5651 2255 sound/soc/codecs/rt5651.c INIT_WORK(&rt5651->jack_detect_work, rt5651_jack_detect_work); rt5651 2258 sound/soc/codecs/rt5651.c ret = devm_add_action_or_reset(&i2c->dev, rt5651_cancel_work, rt5651); rt5651 2262 sound/soc/codecs/rt5651.c ret = devm_request_irq(&i2c->dev, rt5651->irq, rt5651_irq, rt5651 2264 sound/soc/codecs/rt5651.c | IRQF_ONESHOT, "rt5651", rt5651); rt5651 2267 sound/soc/codecs/rt5651.c disable_irq(rt5651->irq); rt5651 2270 sound/soc/codecs/rt5651.c rt5651->irq, ret); rt5651 2271 sound/soc/codecs/rt5651.c rt5651->irq = -ENXIO;