Lines Matching defs:component
379 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
380 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
387 dev_err(component->dev, "Failed to set DMIC clock\n");
389 snd_soc_component_update_bits(component, RT5651_DMIC, RT5651_DMIC_CLK_MASK,
684 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
685 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
722 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
723 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
767 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
768 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
787 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
791 snd_soc_component_update_bits(component, RT5651_PWR_ANLG2,
796 snd_soc_component_update_bits(component, RT5651_PWR_ANLG2,
810 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
814 snd_soc_component_update_bits(component, RT5651_PWR_ANLG2,
819 snd_soc_component_update_bits(component, RT5651_PWR_ANLG2,
833 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
837 snd_soc_component_update_bits(component, RT5651_PWR_ANLG2,
842 snd_soc_component_update_bits(component, RT5651_PWR_ANLG2,
1284 struct snd_soc_component *component = dai->component;
1285 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
1293 dev_err(component->dev, "Unsupported clock setting\n");
1298 dev_err(component->dev, "Unsupported frame size: %d\n", frame_size);
1329 snd_soc_component_update_bits(component, RT5651_I2S1_SDP,
1331 snd_soc_component_update_bits(component, RT5651_ADDA_CLK1, mask_clk, val_clk);
1336 snd_soc_component_update_bits(component, RT5651_I2S2_SDP,
1338 snd_soc_component_update_bits(component, RT5651_ADDA_CLK1, mask_clk, val_clk);
1341 dev_err(component->dev, "Wrong dai->id: %d\n", dai->id);
1350 struct snd_soc_component *component = dai->component;
1351 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
1394 snd_soc_component_update_bits(component, RT5651_I2S1_SDP,
1399 snd_soc_component_update_bits(component, RT5651_I2S2_SDP,
1404 dev_err(component->dev, "Wrong dai->id: %d\n", dai->id);
1413 struct snd_soc_component *component = dai->component;
1414 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
1433 dev_err(component->dev, "Invalid clock id (%d)\n", clk_id);
1436 snd_soc_component_update_bits(component, RT5651_PWR_ANLG2,
1438 snd_soc_component_update_bits(component, RT5651_GLB_CLK,
1451 struct snd_soc_component *component = dai->component;
1452 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
1461 dev_dbg(component->dev, "PLL disabled\n");
1465 snd_soc_component_update_bits(component, RT5651_GLB_CLK,
1472 snd_soc_component_update_bits(component, RT5651_GLB_CLK,
1476 snd_soc_component_update_bits(component, RT5651_GLB_CLK,
1480 snd_soc_component_update_bits(component, RT5651_GLB_CLK,
1484 dev_err(component->dev, "Unknown PLL source %d\n", source);
1490 dev_err(component->dev, "Unsupported input clock %d\n", freq_in);
1494 dev_dbg(component->dev, "bypass=%d m=%d n=%d k=%d\n",
1498 snd_soc_component_write(component, RT5651_PLL_CTRL1,
1500 snd_soc_component_write(component, RT5651_PLL_CTRL2,
1511 static int rt5651_set_bias_level(struct snd_soc_component *component,
1516 if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) {
1517 if (snd_soc_component_read(component, RT5651_PLL_MODE_1) & 0x9200)
1518 snd_soc_component_update_bits(component, RT5651_D_MISC,
1523 if (SND_SOC_BIAS_OFF == snd_soc_component_get_bias_level(component)) {
1524 snd_soc_component_update_bits(component, RT5651_PWR_ANLG1,
1530 snd_soc_component_update_bits(component, RT5651_PWR_ANLG1,
1533 snd_soc_component_update_bits(component, RT5651_D_MISC, 0x1, 0x1);
1538 snd_soc_component_write(component, RT5651_D_MISC, 0x0010);
1539 snd_soc_component_write(component, RT5651_PWR_DIG1, 0x0000);
1540 snd_soc_component_write(component, RT5651_PWR_DIG2, 0x0000);
1541 snd_soc_component_write(component, RT5651_PWR_VOL, 0x0000);
1542 snd_soc_component_write(component, RT5651_PWR_MIXER, 0x0000);
1544 snd_soc_component_update_bits(component, RT5651_PWR_ANLG1,
1547 snd_soc_component_update_bits(component, RT5651_PWR_ANLG2,
1558 static void rt5651_enable_micbias1_for_ovcd(struct snd_soc_component *component)
1560 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1571 static void rt5651_disable_micbias1_for_ovcd(struct snd_soc_component *component)
1573 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1583 static void rt5651_enable_micbias1_ovcd_irq(struct snd_soc_component *component)
1585 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
1587 snd_soc_component_update_bits(component, RT5651_IRQ_CTRL2,
1592 static void rt5651_disable_micbias1_ovcd_irq(struct snd_soc_component *component)
1594 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
1596 snd_soc_component_update_bits(component, RT5651_IRQ_CTRL2,
1601 static void rt5651_clear_micbias1_ovcd(struct snd_soc_component *component)
1603 snd_soc_component_update_bits(component, RT5651_IRQ_CTRL2,
1607 static bool rt5651_micbias1_ovcd(struct snd_soc_component *component)
1611 val = snd_soc_component_read(component, RT5651_IRQ_CTRL2);
1612 dev_dbg(component->dev, "irq ctrl2 %#04x\n", val);
1617 static bool rt5651_jack_inserted(struct snd_soc_component *component)
1619 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
1624 dev_dbg(component->dev, "jack-detect gpio %d\n", val);
1628 val = snd_soc_component_read(component, RT5651_INT_IRQ_ST);
1629 dev_dbg(component->dev, "irq status %#04x\n", val);
1660 static void rt5651_start_button_press_work(struct snd_soc_component *component)
1662 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
1669 rt5651_clear_micbias1_ovcd(component);
1677 struct snd_soc_component *component = rt5651->component;
1680 if (!rt5651_jack_inserted(component))
1683 if (rt5651_micbias1_ovcd(component)) {
1689 rt5651_clear_micbias1_ovcd(component);
1707 dev_dbg(component->dev, "headset button press\n");
1715 dev_dbg(component->dev, "headset button release\n");
1719 rt5651_enable_micbias1_ovcd_irq(component);
1726 static int rt5651_detect_headset(struct snd_soc_component *component)
1739 rt5651_clear_micbias1_ovcd(component);
1744 if (!rt5651_jack_inserted(component))
1747 if (rt5651_micbias1_ovcd(component)) {
1753 dev_dbg(component->dev, "mic-gnd shorted\n");
1759 dev_dbg(component->dev, "mic-gnd open\n");
1767 dev_err(component->dev, "Error detecting headset vs headphones, bad contact?, assuming headphones\n");
1785 struct snd_soc_component *component = rt5651->component;
1788 if (!rt5651_jack_inserted(component)) {
1793 rt5651_disable_micbias1_ovcd_irq(component);
1794 rt5651_disable_micbias1_for_ovcd(component);
1798 dev_dbg(component->dev, "jack unplugged\n");
1803 rt5651_enable_micbias1_for_ovcd(component);
1804 report = rt5651_detect_headset(component);
1805 dev_dbg(component->dev, "detect report %#02x\n", report);
1809 rt5651_enable_micbias1_ovcd_irq(component);
1812 rt5651_disable_micbias1_for_ovcd(component);
1814 } else if (rt5651->ovcd_irq_enabled && rt5651_micbias1_ovcd(component)) {
1815 dev_dbg(component->dev, "OVCD IRQ\n");
1826 rt5651_disable_micbias1_ovcd_irq(component);
1827 rt5651_start_button_press_work(component);
1856 static void rt5651_enable_jack_detect(struct snd_soc_component *component,
1860 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
1872 snd_soc_component_update_bits(component, RT5651_JD_CTRL2,
1876 snd_soc_component_update_bits(component,
1881 snd_soc_component_update_bits(component,
1887 snd_soc_component_update_bits(component, RT5651_JD_CTRL2,
1891 snd_soc_component_update_bits(component,
1896 snd_soc_component_update_bits(component,
1902 snd_soc_component_update_bits(component, RT5651_JD_CTRL2,
1906 snd_soc_component_update_bits(component,
1911 snd_soc_component_update_bits(component,
1917 dev_err(component->dev, "Currently only JD1_1 / JD1_2 / JD2 are supported\n");
1923 snd_soc_component_update_bits(component, RT5651_GPIO_CTRL1,
1927 snd_soc_component_update_bits(component, RT5651_PWR_ANLG2,
1932 snd_soc_component_write(component, RT5651_PR_BASE + RT5651_BIAS_CUR4,
1935 snd_soc_component_update_bits(component, RT5651_MICBIAS,
1954 snd_soc_component_update_bits(component, RT5651_IRQ_CTRL2,
1959 rt5651_enable_micbias1_for_ovcd(component);
1960 rt5651_enable_micbias1_ovcd_irq(component);
1968 static void rt5651_disable_jack_detect(struct snd_soc_component *component)
1970 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
1976 rt5651_disable_micbias1_ovcd_irq(component);
1977 rt5651_disable_micbias1_for_ovcd(component);
1984 static int rt5651_set_jack(struct snd_soc_component *component,
1988 rt5651_enable_jack_detect(component, jack, data);
1990 rt5651_disable_jack_detect(component);
1998 * property parsing MUST be done from the component driver's probe function,
2002 static void rt5651_apply_properties(struct snd_soc_component *component)
2004 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
2007 if (device_property_read_bool(component->dev, "realtek,in2-differential"))
2008 snd_soc_component_update_bits(component, RT5651_IN1_IN2,
2011 if (device_property_read_bool(component->dev, "realtek,dmic-en"))
2012 snd_soc_component_update_bits(component, RT5651_GPIO_CTRL1,
2015 if (device_property_read_u32(component->dev,
2019 if (device_property_read_bool(component->dev, "realtek,jack-detect-not-inverted"))
2030 if (device_property_read_u32(component->dev,
2043 dev_warn(component->dev, "Warning: Invalid over-current-threshold-microamp value: %d, defaulting to 2000uA\n",
2048 if (device_property_read_u32(component->dev,
2053 dev_warn(component->dev, "Warning: Invalid over-current-scale-factor value: %d, defaulting to 0.75\n",
2058 static int rt5651_probe(struct snd_soc_component *component)
2060 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
2062 rt5651->component = component;
2064 snd_soc_component_update_bits(component, RT5651_PWR_ANLG1,
2067 snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
2069 rt5651_apply_properties(component);
2075 static int rt5651_suspend(struct snd_soc_component *component)
2077 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
2084 static int rt5651_resume(struct snd_soc_component *component)
2086 struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
2089 snd_soc_component_cache_sync(component);