Lines Matching full:component

3 // rt5682s.c  --  RT5682I-VS ALSA SoC audio component driver
627 static int rt5682s_button_detect(struct snd_soc_component *component)
631 val = snd_soc_component_read(component, RT5682S_4BTN_IL_CMD_1);
633 snd_soc_component_write(component, RT5682S_4BTN_IL_CMD_1, val);
634 dev_dbg(component->dev, "%s btn_type=%x\n", __func__, btn_type);
635 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_2,
647 static void rt5682s_sar_power_mode(struct snd_soc_component *component, int mode)
649 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
655 snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_3,
657 snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_1,
661 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
666 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
669 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_2,
673 snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_3,
675 snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_1,
678 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
681 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
686 snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_1,
689 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
695 dev_err(component->dev, "Invalid SAR Power mode: %d\n", mode);
702 static void rt5682s_enable_push_button_irq(struct snd_soc_component *component)
704 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_13,
706 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
710 snd_soc_component_write(component, RT5682S_IL_CMD_1, 0x0040);
711 snd_soc_component_update_bits(component, RT5682S_4BTN_IL_CMD_2,
714 snd_soc_component_update_bits(component, RT5682S_IRQ_CTRL_3,
718 static void rt5682s_disable_push_button_irq(struct snd_soc_component *component)
720 snd_soc_component_update_bits(component, RT5682S_IRQ_CTRL_3,
722 snd_soc_component_update_bits(component, RT5682S_4BTN_IL_CMD_2,
724 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_13,
726 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
734 * @component: SoC audio component device.
741 static int rt5682s_headset_detect(struct snd_soc_component *component, int jack_insert)
743 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
748 rt5682s_disable_push_button_irq(component);
749 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_1,
752 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_1,
755 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_1,
758 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_3,
760 snd_soc_component_write(component, RT5682S_SAR_IL_CMD_3, 0x0365);
761 snd_soc_component_update_bits(component, RT5682S_HP_CHARGE_PUMP_2,
764 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_13,
766 snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_3,
768 snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_1,
771 snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_1,
777 val = snd_soc_component_read(component, RT5682S_CBJ_CTRL_2)
782 dev_dbg(component->dev, "%s, val=%d, count=%d\n", __func__, val, count);
788 snd_soc_component_write(component, RT5682S_SAR_IL_CMD_3, 0x024c);
789 snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_1,
791 snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
793 rt5682s_enable_push_button_irq(component);
794 rt5682s_sar_power_mode(component, SAR_PWR_SAVING);
800 snd_soc_component_update_bits(component, RT5682S_HP_CHARGE_PUMP_2,
805 rt5682s_sar_power_mode(component, SAR_PWR_OFF);
806 rt5682s_disable_push_button_irq(component);
807 snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_1,
811 snd_soc_component_update_bits(component,
815 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_3,
817 snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_1,
819 snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_3,
824 dev_dbg(component->dev, "jack_type = %d\n", jack_type);
836 if (!rt5682s->component ||
837 !snd_soc_card_is_instantiated(rt5682s->component->card)) {
844 dapm = snd_soc_component_to_dapm(rt5682s->component);
850 val = snd_soc_component_read(rt5682s->component, RT5682S_AJD1_CTRL)
856 rt5682s->jack_type = rt5682s_headset_detect(rt5682s->component, 1);
861 btn_type = rt5682s_button_detect(rt5682s->component);
893 dev_err(rt5682s->component->dev,
900 rt5682s->jack_type = rt5682s_headset_detect(rt5682s->component, 0);
924 if (snd_soc_component_read(rt5682s->component, RT5682S_AJD1_CTRL) & RT5682S_JDH_RS_MASK) {
942 static int rt5682s_set_jack_detect(struct snd_soc_component *component,
945 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
1009 dev_warn(component->dev, "Wrong JD source\n");
1043 * @component: SoC audio component device.
1052 * set of filters specified by the mask. And the component driver will turn on
1055 int rt5682s_sel_asrc_clk_src(struct snd_soc_component *component,
1069 snd_soc_component_update_bits(component, RT5682S_PLL_TRACK_2,
1074 snd_soc_component_update_bits(component, RT5682S_PLL_TRACK_3,
1078 snd_soc_component_update_bits(component, RT5682S_PLL_TRACK_11,
1091 dev_err(rt5682s->component->dev,
1097 dev_dbg(rt5682s->component->dev, "div[%d]=%d\n", i, div[i]);
1101 dev_dbg(rt5682s->component->dev,
1108 dev_err(rt5682s->component->dev,
1143 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1144 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
1153 snd_soc_component_update_bits(component, RT5682S_DMIC_CTRL_1,
1162 struct snd_soc_component *component = rt5682s->component;
1165 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_3,
1168 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_3,
1171 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_3,
1182 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1183 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
1199 struct snd_soc_component *component = rt5682s->component;
1206 snd_soc_component_update_bits(component, reg,
1215 snd_soc_component_update_bits(component, RT5682S_ADDA_CLK_1,
1223 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1224 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
1227 val = snd_soc_component_read(component, RT5682S_GPIO_CTRL_1)
1248 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1249 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
1257 val = (snd_soc_component_read(component, RT5682S_GLB_CLK)
1260 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_1,
1270 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_1,
1281 struct snd_soc_component *component = rt5682s->component;
1305 dev_err(component->dev, "get pre_div failed\n");
1309 dev_dbg(component->dev, "lrck is %dHz and pre_div is %d for iis %d master\n",
1311 snd_soc_component_update_bits(component, c_reg, c_mask, pre_div << c_sft);
1314 snd_soc_component_update_bits(component, p_reg, p_mask, on << p_sft);
1320 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1321 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
1338 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1339 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
1351 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1352 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
1364 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1379 val = (snd_soc_component_read(component, reg) >> sft) & 0xf;
1392 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1396 snd_soc_component_update_bits(component, RT5682S_DEPOP_1,
1400 snd_soc_component_update_bits(component, RT5682S_DEPOP_1,
1405 snd_soc_component_write(component, RT5682S_BIAS_CUR_CTRL_11, 0x6666);
1406 snd_soc_component_write(component, RT5682S_BIAS_CUR_CTRL_12, 0xa82a);
1408 snd_soc_component_update_bits(component, RT5682S_HP_CTRL_2,
1413 snd_soc_component_update_bits(component, RT5682S_HP_AMP_DET_CTL_1,
1418 snd_soc_component_update_bits(component, RT5682S_HP_CTRL_2,
1421 snd_soc_component_update_bits(component, RT5682S_HP_AMP_DET_CTL_1,
1423 snd_soc_component_update_bits(component, RT5682S_DEPOP_1,
1426 snd_soc_component_update_bits(component, RT5682S_DEPOP_1,
1437 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1438 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
1447 snd_soc_component_update_bits(component, RT5682S_STO1_ADC_DIG_VOL,
1451 snd_soc_component_update_bits(component, RT5682S_STO1_ADC_DIG_VOL,
1462 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1463 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
1470 rt5682s_sar_power_mode(component, SAR_PWR_NORMAL);
1473 rt5682s_sar_power_mode(component, SAR_PWR_SAVING);
1984 struct snd_soc_component *component = dai->component;
1988 snd_soc_component_update_bits(component,
1991 snd_soc_component_update_bits(component,
1998 dev_err(component->dev, "Invalid or oversized Tx slots.\n");
2023 snd_soc_component_update_bits(component, RT5682S_TDM_CTRL,
2053 snd_soc_component_update_bits(component, RT5682S_TDM_TCON_CTRL_1,
2055 snd_soc_component_update_bits(component, RT5682S_I2S1_SDP,
2064 struct snd_soc_component *component = dai->component;
2065 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2073 dev_err(component->dev, "Unsupported frame size: %d\n", frame_size);
2102 snd_soc_component_update_bits(component, RT5682S_I2S1_SDP,
2105 snd_soc_component_update_bits(component, RT5682S_I2S1_SDP,
2108 snd_soc_component_update_bits(component, RT5682S_I2S1_SDP,
2112 snd_soc_component_update_bits(component, RT5682S_I2S2_SDP,
2115 snd_soc_component_update_bits(component, RT5682S_I2S2_SDP,
2118 snd_soc_component_update_bits(component, RT5682S_I2S2_SDP,
2122 dev_err(component->dev, "Invalid dai->id: %d\n", dai->id);
2131 struct snd_soc_component *component = dai->component;
2132 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2191 snd_soc_component_update_bits(component, RT5682S_I2S1_SDP,
2193 snd_soc_component_update_bits(component, RT5682S_TDM_TCON_CTRL_1,
2202 snd_soc_component_update_bits(component, RT5682S_I2S2_SDP,
2207 dev_err(component->dev, "Invalid dai->id: %d\n", dai->id);
2213 static int rt5682s_set_component_sysclk(struct snd_soc_component *component,
2216 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2236 dev_err(component->dev, "Invalid clock id (%d)\n", clk_id);
2240 snd_soc_component_update_bits(component, RT5682S_GLB_CLK,
2242 snd_soc_component_update_bits(component, RT5682S_ADDA_CLK_1,
2244 snd_soc_component_update_bits(component, RT5682S_I2S2_M_CLK_CTRL_1,
2250 dev_dbg(component->dev, "Sysclk is %dHz and clock id is %d\n",
2330 static int rt5682s_set_component_pll(struct snd_soc_component *component,
2334 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2342 dev_dbg(component->dev, "PLL disabled\n");
2345 snd_soc_component_update_bits(component, RT5682S_GLB_CLK,
2352 snd_soc_component_update_bits(component, RT5682S_GLB_CLK,
2356 snd_soc_component_update_bits(component, RT5682S_GLB_CLK,
2360 dev_err(component->dev, "Unknown PLL Source %d\n", source);
2370 dev_dbg(component->dev,
2374 dev_err(component->dev,
2381 dev_dbg(component->dev,
2385 snd_soc_component_update_bits(component, RT5682S_PLL_CTRL_1,
2387 snd_soc_component_update_bits(component, RT5682S_PLL_CTRL_2,
2390 snd_soc_component_update_bits(component, RT5682S_PLL_CTRL_6,
2397 dev_dbg(component->dev,
2402 snd_soc_component_update_bits(component, RT5682S_PLL_CTRL_3,
2404 snd_soc_component_update_bits(component, RT5682S_PLL_CTRL_4,
2407 snd_soc_component_update_bits(component, RT5682S_PLL_CTRL_6,
2417 snd_soc_component_update_bits(component, RT5682S_PLL_CTRL_7,
2430 struct snd_soc_component *component = dai->component;
2431 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2437 snd_soc_component_update_bits(component, RT5682S_TDM_TCON_CTRL_1,
2441 snd_soc_component_update_bits(component, RT5682S_TDM_TCON_CTRL_1,
2445 snd_soc_component_update_bits(component, RT5682S_TDM_TCON_CTRL_1,
2449 snd_soc_component_update_bits(component, RT5682S_TDM_TCON_CTRL_1,
2462 struct snd_soc_component *component = dai->component;
2463 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2469 snd_soc_component_update_bits(component, RT5682S_ADDA_CLK_2,
2473 snd_soc_component_update_bits(component, RT5682S_ADDA_CLK_2,
2484 static int rt5682s_set_bias_level(struct snd_soc_component *component,
2487 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2488 struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
2521 dev_dbg(rt5682s->component->dev, "dai clk fmt not set correctly\n");
2531 struct snd_soc_component *component = rt5682s->component;
2539 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_1,
2543 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_1,
2547 snd_soc_component_update_bits(component, RT5682S_PWR_DIG_1,
2568 struct snd_soc_component *component = rt5682s->component;
2576 snd_soc_component_update_bits(component, RT5682S_PWR_ANLG_1,
2581 snd_soc_component_update_bits(component, RT5682S_PWR_DIG_1,
2597 struct snd_soc_component *component = rt5682s->component;
2607 dev_warn(component->dev, "%s: clk %s only support %d or %d Hz output\n",
2620 struct snd_soc_component *component = rt5682s->component;
2630 dev_warn(component->dev, "%s: clk %s only support %d or %d Hz output\n",
2643 struct snd_soc_component *component = rt5682s->component;
2660 dev_warn(component->dev,
2665 dev_warn(component->dev, "clk %s only support %d Hz input\n",
2673 rt5682s_set_component_pll(component, RT5682S_PLL2, RT5682S_PLL_S_MCLK,
2676 rt5682s_set_component_sysclk(component, RT5682S_SCLK_S_PLL2, 0,
2689 struct snd_soc_component *component = rt5682s->component;
2692 bclks_per_wclk = snd_soc_component_read(component, RT5682S_TDM_TCON_CTRL_1);
2753 struct snd_soc_component *component = rt5682s->component;
2762 for_each_component_dais(component, dai)
2766 dev_err(component->dev, "dai %d not found in component\n",
2786 static int rt5682s_register_dai_clks(struct snd_soc_component *component)
2788 struct device *dev = component->dev;
2789 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2849 static int rt5682s_dai_probe_clks(struct snd_soc_component *component)
2851 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2855 rt5682s->mclk = devm_clk_get_optional(component->dev, "mclk");
2860 ret = rt5682s_register_dai_clks(component);
2870 static inline int rt5682s_dai_probe_clks(struct snd_soc_component *component)
2876 static int rt5682s_probe(struct snd_soc_component *component)
2878 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2880 rt5682s->component = component;
2882 return rt5682s_dai_probe_clks(component);
2885 static void rt5682s_remove(struct snd_soc_component *component)
2887 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2893 static int rt5682s_suspend(struct snd_soc_component *component)
2895 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
2904 rt5682s->jack_type = rt5682s_headset_detect(component, 0);
2912 static int rt5682s_resume(struct snd_soc_component *component)
2914 struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
3027 dev_err(rt5682s->component->dev, "HP Calibration Failure\n");