• Home
  • Raw
  • Download

Lines Matching +full:sclk +full:- +full:strength

2  * cs35l35.c -- CS35L35 ALSA SoC audio driver
32 #include <sound/soc-dapm.h>
167 gpiod_set_value_cansleep(cs35l35->reset_gpio, 0); in cs35l35_reset()
169 gpiod_set_value_cansleep(cs35l35->reset_gpio, 1); in cs35l35_reset()
177 if (cs35l35->pdata.ext_bst) { in cs35l35_wait_for_pdn()
182 reinit_completion(&cs35l35->pdn_done); in cs35l35_wait_for_pdn()
184 ret = wait_for_completion_timeout(&cs35l35->pdn_done, in cs35l35_wait_for_pdn()
187 dev_err(cs35l35->dev, "PDN_DONE did not complete\n"); in cs35l35_wait_for_pdn()
188 return -ETIMEDOUT; in cs35l35_wait_for_pdn()
197 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in cs35l35_sdin_event()
203 regmap_update_bits(cs35l35->regmap, CS35L35_CLK_CTL1, in cs35l35_sdin_event()
206 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL1, in cs35l35_sdin_event()
209 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL1, in cs35l35_sdin_event()
213 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL1, in cs35l35_sdin_event()
216 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL1, in cs35l35_sdin_event()
220 regmap_update_bits(cs35l35->regmap, CS35L35_AMP_DIG_VOL_CTL, in cs35l35_sdin_event()
225 regmap_update_bits(cs35l35->regmap, CS35L35_CLK_CTL1, in cs35l35_sdin_event()
229 regmap_update_bits(cs35l35->regmap, CS35L35_AMP_DIG_VOL_CTL, in cs35l35_sdin_event()
234 dev_err(component->dev, "Invalid event = 0x%x\n", event); in cs35l35_sdin_event()
235 ret = -EINVAL; in cs35l35_sdin_event()
243 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in cs35l35_main_amp_event()
250 if (cs35l35->pdata.bst_pdn_fet_on) in cs35l35_main_amp_event()
251 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL2, in cs35l35_main_amp_event()
255 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL2, in cs35l35_main_amp_event()
262 if (cs35l35->pdm_mode) in cs35l35_main_amp_event()
263 regmap_update_bits(cs35l35->regmap, in cs35l35_main_amp_event()
268 regmap_update_bits(cs35l35->regmap, CS35L35_PROTECT_CTL, in cs35l35_main_amp_event()
272 regmap_bulk_read(cs35l35->regmap, CS35L35_INT_STATUS_1, in cs35l35_main_amp_event()
277 regmap_update_bits(cs35l35->regmap, CS35L35_PROTECT_CTL, in cs35l35_main_amp_event()
280 if (cs35l35->pdata.bst_pdn_fet_on) in cs35l35_main_amp_event()
281 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL2, in cs35l35_main_amp_event()
285 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL2, in cs35l35_main_amp_event()
295 if (cs35l35->pdm_mode) in cs35l35_main_amp_event()
296 regmap_update_bits(cs35l35->regmap, in cs35l35_main_amp_event()
299 cs35l35->pdata.bst_vctl in cs35l35_main_amp_event()
304 dev_err(component->dev, "Invalid event = 0x%x\n", event); in cs35l35_main_amp_event()
310 static DECLARE_TLV_DB_SCALE(dig_vol_tlv, -10200, 50, 0);
372 struct snd_soc_component *component = codec_dai->component; in cs35l35_set_dai_fmt()
377 regmap_update_bits(cs35l35->regmap, CS35L35_CLK_CTL1, in cs35l35_set_dai_fmt()
379 cs35l35->slave_mode = false; in cs35l35_set_dai_fmt()
382 regmap_update_bits(cs35l35->regmap, CS35L35_CLK_CTL1, in cs35l35_set_dai_fmt()
384 cs35l35->slave_mode = true; in cs35l35_set_dai_fmt()
387 return -EINVAL; in cs35l35_set_dai_fmt()
392 cs35l35->i2s_mode = true; in cs35l35_set_dai_fmt()
393 cs35l35->pdm_mode = false; in cs35l35_set_dai_fmt()
396 cs35l35->pdm_mode = true; in cs35l35_set_dai_fmt()
397 cs35l35->i2s_mode = false; in cs35l35_set_dai_fmt()
400 return -EINVAL; in cs35l35_set_dai_fmt()
466 return -EINVAL; in cs35l35_get_clk_config()
473 struct snd_soc_component *component = dai->component; in cs35l35_hw_params()
475 struct classh_cfg *classh = &cs35l35->pdata.classh_algo; in cs35l35_hw_params()
482 int clk_ctl = cs35l35_get_clk_config(cs35l35->sysclk, srate); in cs35l35_hw_params()
485 dev_err(component->dev, "Invalid CLK:Rate %d:%d\n", in cs35l35_hw_params()
486 cs35l35->sysclk, srate); in cs35l35_hw_params()
487 return -EINVAL; in cs35l35_hw_params()
490 ret = regmap_update_bits(cs35l35->regmap, CS35L35_CLK_CTL2, in cs35l35_hw_params()
493 dev_err(component->dev, "Failed to set port config %d\n", ret); in cs35l35_hw_params()
499 * When configured for the weak-drive detection path (CH_WKFET_DIS = 0) in cs35l35_hw_params()
500 * the Class H algorithm does not enable weak-drive operation for in cs35l35_hw_params()
505 if (classh->classh_wk_fet_disable == 0x00 && in cs35l35_hw_params()
507 ret = regmap_update_bits(cs35l35->regmap, in cs35l35_hw_params()
512 dev_err(component->dev, "Failed to set fet config %d\n", in cs35l35_hw_params()
520 * Just make sure your SCLK is fast enough to fill the frame in cs35l35_hw_params()
522 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in cs35l35_hw_params()
534 dev_err(component->dev, "Unsupported Width %d\n", in cs35l35_hw_params()
536 return -EINVAL; in cs35l35_hw_params()
538 regmap_update_bits(cs35l35->regmap, in cs35l35_hw_params()
543 if (cs35l35->pdata.stereo) { in cs35l35_hw_params()
544 regmap_update_bits(cs35l35->regmap, in cs35l35_hw_params()
552 if (cs35l35->i2s_mode) { in cs35l35_hw_params()
553 /* We have to take the SCLK to derive num sclks in cs35l35_hw_params()
556 if ((cs35l35->sclk / srate) % 4) { in cs35l35_hw_params()
557 dev_err(component->dev, "Unsupported sclk/fs ratio %d:%d\n", in cs35l35_hw_params()
558 cs35l35->sclk, srate); in cs35l35_hw_params()
559 return -EINVAL; in cs35l35_hw_params()
561 sp_sclks = ((cs35l35->sclk / srate) / 4) - 1; in cs35l35_hw_params()
564 if (cs35l35->slave_mode) { in cs35l35_hw_params()
571 dev_err(component->dev, "ratio not supported\n"); in cs35l35_hw_params()
572 return -EINVAL; in cs35l35_hw_params()
581 dev_err(component->dev, "ratio not supported\n"); in cs35l35_hw_params()
582 return -EINVAL; in cs35l35_hw_params()
585 ret = regmap_update_bits(cs35l35->regmap, in cs35l35_hw_params()
590 dev_err(component->dev, "Failed to set fsclk %d\n", ret); in cs35l35_hw_params()
610 struct snd_soc_component *component = dai->component; in cs35l35_pcm_startup()
613 if (!substream->runtime) in cs35l35_pcm_startup()
616 snd_pcm_hw_constraint_list(substream->runtime, 0, in cs35l35_pcm_startup()
619 regmap_update_bits(cs35l35->regmap, CS35L35_AMP_INP_DRV_CTL, in cs35l35_pcm_startup()
638 struct snd_soc_component *component = dai->component; in cs35l35_pdm_startup()
641 if (!substream->runtime) in cs35l35_pdm_startup()
644 snd_pcm_hw_constraint_list(substream->runtime, 0, in cs35l35_pdm_startup()
648 regmap_update_bits(cs35l35->regmap, CS35L35_AMP_INP_DRV_CTL, in cs35l35_pdm_startup()
658 struct snd_soc_component *component = dai->component; in cs35l35_dai_set_sysclk()
661 /* Need the SCLK Frequency regardless of sysclk source for I2S */ in cs35l35_dai_set_sysclk()
662 cs35l35->sclk = freq; in cs35l35_dai_set_sysclk()
682 .name = "cs35l35-pcm",
702 .name = "cs35l35-pdm",
734 dev_err(component->dev, "Invalid CLK Source\n"); in cs35l35_component_set_sysclk()
735 return -EINVAL; in cs35l35_component_set_sysclk()
749 cs35l35->sysclk = freq; in cs35l35_component_set_sysclk()
752 dev_err(component->dev, "Invalid CLK Frequency Input : %d\n", freq); in cs35l35_component_set_sysclk()
753 return -EINVAL; in cs35l35_component_set_sysclk()
756 ret = regmap_update_bits(cs35l35->regmap, CS35L35_CLK_CTL1, in cs35l35_component_set_sysclk()
760 dev_err(component->dev, "Failed to set sysclk %d\n", ret); in cs35l35_component_set_sysclk()
770 struct regmap *regmap = cs35l35->regmap; in cs35l35_boost_inductor()
830 dev_err(cs35l35->dev, "Invalid Inductor Value %d uH\n", in cs35l35_boost_inductor()
832 return -EINVAL; in cs35l35_boost_inductor()
840 struct classh_cfg *classh = &cs35l35->pdata.classh_algo; in cs35l35_component_probe()
841 struct monitor_cfg *monitor_config = &cs35l35->pdata.mon_cfg; in cs35l35_component_probe()
845 if (cs35l35->pdata.bst_vctl) in cs35l35_component_probe()
846 regmap_update_bits(cs35l35->regmap, CS35L35_BST_CVTR_V_CTL, in cs35l35_component_probe()
848 cs35l35->pdata.bst_vctl); in cs35l35_component_probe()
850 if (cs35l35->pdata.bst_ipk) in cs35l35_component_probe()
851 regmap_update_bits(cs35l35->regmap, CS35L35_BST_PEAK_I, in cs35l35_component_probe()
853 cs35l35->pdata.bst_ipk << in cs35l35_component_probe()
856 ret = cs35l35_boost_inductor(cs35l35, cs35l35->pdata.boost_ind); in cs35l35_component_probe()
860 if (cs35l35->pdata.gain_zc) in cs35l35_component_probe()
861 regmap_update_bits(cs35l35->regmap, CS35L35_PROTECT_CTL, in cs35l35_component_probe()
863 cs35l35->pdata.gain_zc << in cs35l35_component_probe()
866 if (cs35l35->pdata.aud_channel) in cs35l35_component_probe()
867 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
870 cs35l35->pdata.aud_channel << in cs35l35_component_probe()
873 if (cs35l35->pdata.stereo) { in cs35l35_component_probe()
874 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
877 cs35l35->pdata.adv_channel << in cs35l35_component_probe()
879 if (cs35l35->pdata.shared_bst) in cs35l35_component_probe()
880 regmap_update_bits(cs35l35->regmap, CS35L35_CLASS_H_CTL, in cs35l35_component_probe()
889 if (cs35l35->pdata.sp_drv_str) in cs35l35_component_probe()
890 regmap_update_bits(cs35l35->regmap, CS35L35_CLK_CTL1, in cs35l35_component_probe()
892 cs35l35->pdata.sp_drv_str << in cs35l35_component_probe()
894 if (cs35l35->pdata.sp_drv_unused) in cs35l35_component_probe()
895 regmap_update_bits(cs35l35->regmap, CS35L35_SP_FMT_CTL3, in cs35l35_component_probe()
897 cs35l35->pdata.sp_drv_unused << in cs35l35_component_probe()
900 if (classh->classh_algo_enable) { in cs35l35_component_probe()
901 if (classh->classh_bst_override) in cs35l35_component_probe()
902 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
905 classh->classh_bst_override << in cs35l35_component_probe()
907 if (classh->classh_bst_max_limit) in cs35l35_component_probe()
908 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
911 classh->classh_bst_max_limit << in cs35l35_component_probe()
913 if (classh->classh_mem_depth) in cs35l35_component_probe()
914 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
917 classh->classh_mem_depth << in cs35l35_component_probe()
919 if (classh->classh_headroom) in cs35l35_component_probe()
920 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
923 classh->classh_headroom << in cs35l35_component_probe()
925 if (classh->classh_release_rate) in cs35l35_component_probe()
926 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
929 classh->classh_release_rate << in cs35l35_component_probe()
931 if (classh->classh_wk_fet_disable) in cs35l35_component_probe()
932 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
935 classh->classh_wk_fet_disable << in cs35l35_component_probe()
937 if (classh->classh_wk_fet_delay) in cs35l35_component_probe()
938 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
941 classh->classh_wk_fet_delay << in cs35l35_component_probe()
943 if (classh->classh_wk_fet_thld) in cs35l35_component_probe()
944 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
947 classh->classh_wk_fet_thld << in cs35l35_component_probe()
949 if (classh->classh_vpch_auto) in cs35l35_component_probe()
950 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
953 classh->classh_vpch_auto << in cs35l35_component_probe()
955 if (classh->classh_vpch_rate) in cs35l35_component_probe()
956 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
959 classh->classh_vpch_rate << in cs35l35_component_probe()
961 if (classh->classh_vpch_man) in cs35l35_component_probe()
962 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
965 classh->classh_vpch_man << in cs35l35_component_probe()
969 if (monitor_config->is_present) { in cs35l35_component_probe()
970 if (monitor_config->vmon_specs) { in cs35l35_component_probe()
971 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
974 monitor_config->vmon_dpth << in cs35l35_component_probe()
976 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
979 monitor_config->vmon_loc << in cs35l35_component_probe()
981 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
984 monitor_config->vmon_frm << in cs35l35_component_probe()
987 if (monitor_config->imon_specs) { in cs35l35_component_probe()
988 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
991 monitor_config->imon_dpth << in cs35l35_component_probe()
993 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
996 monitor_config->imon_loc << in cs35l35_component_probe()
998 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1001 monitor_config->imon_frm << in cs35l35_component_probe()
1003 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1006 monitor_config->imon_scale << in cs35l35_component_probe()
1009 if (monitor_config->vpmon_specs) { in cs35l35_component_probe()
1010 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1013 monitor_config->vpmon_dpth << in cs35l35_component_probe()
1015 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1018 monitor_config->vpmon_loc << in cs35l35_component_probe()
1020 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1023 monitor_config->vpmon_frm << in cs35l35_component_probe()
1026 if (monitor_config->vbstmon_specs) { in cs35l35_component_probe()
1027 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1030 monitor_config->vpmon_dpth << in cs35l35_component_probe()
1032 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1035 monitor_config->vbstmon_loc << in cs35l35_component_probe()
1037 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1040 monitor_config->vbstmon_frm << in cs35l35_component_probe()
1043 if (monitor_config->vpbrstat_specs) { in cs35l35_component_probe()
1044 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1047 monitor_config->vpbrstat_dpth << in cs35l35_component_probe()
1049 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1052 monitor_config->vpbrstat_loc << in cs35l35_component_probe()
1054 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1057 monitor_config->vpbrstat_frm << in cs35l35_component_probe()
1060 if (monitor_config->zerofill_specs) { in cs35l35_component_probe()
1061 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1064 monitor_config->zerofill_dpth << in cs35l35_component_probe()
1066 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1069 monitor_config->zerofill_loc << in cs35l35_component_probe()
1071 regmap_update_bits(cs35l35->regmap, in cs35l35_component_probe()
1074 monitor_config->zerofill_frm << in cs35l35_component_probe()
1118 regmap_read(cs35l35->regmap, CS35L35_INT_STATUS_4, &sticky4); in cs35l35_irq()
1119 regmap_read(cs35l35->regmap, CS35L35_INT_STATUS_3, &sticky3); in cs35l35_irq()
1120 regmap_read(cs35l35->regmap, CS35L35_INT_STATUS_2, &sticky2); in cs35l35_irq()
1121 regmap_read(cs35l35->regmap, CS35L35_INT_STATUS_1, &sticky1); in cs35l35_irq()
1123 regmap_read(cs35l35->regmap, CS35L35_INT_MASK_4, &mask4); in cs35l35_irq()
1124 regmap_read(cs35l35->regmap, CS35L35_INT_MASK_3, &mask3); in cs35l35_irq()
1125 regmap_read(cs35l35->regmap, CS35L35_INT_MASK_2, &mask2); in cs35l35_irq()
1126 regmap_read(cs35l35->regmap, CS35L35_INT_MASK_1, &mask1); in cs35l35_irq()
1134 complete(&cs35l35->pdn_done); in cs35l35_irq()
1137 regmap_read(cs35l35->regmap, CS35L35_INT_STATUS_1, &current1); in cs35l35_irq()
1141 dev_crit(cs35l35->dev, "Calibration Error\n"); in cs35l35_irq()
1146 regmap_update_bits(cs35l35->regmap, in cs35l35_irq()
1149 regmap_update_bits(cs35l35->regmap, in cs35l35_irq()
1153 regmap_update_bits(cs35l35->regmap, in cs35l35_irq()
1160 dev_crit(cs35l35->dev, "AMP Short Error\n"); in cs35l35_irq()
1163 dev_dbg(cs35l35->dev, "Amp short error release\n"); in cs35l35_irq()
1164 regmap_update_bits(cs35l35->regmap, in cs35l35_irq()
1167 regmap_update_bits(cs35l35->regmap, in cs35l35_irq()
1171 regmap_update_bits(cs35l35->regmap, in cs35l35_irq()
1178 dev_warn(cs35l35->dev, "Over temperature warning\n"); in cs35l35_irq()
1182 dev_dbg(cs35l35->dev, "Over temperature warn release\n"); in cs35l35_irq()
1183 regmap_update_bits(cs35l35->regmap, in cs35l35_irq()
1186 regmap_update_bits(cs35l35->regmap, in cs35l35_irq()
1190 regmap_update_bits(cs35l35->regmap, in cs35l35_irq()
1197 dev_crit(cs35l35->dev, "Over temperature error\n"); in cs35l35_irq()
1200 dev_dbg(cs35l35->dev, "Over temperature error release\n"); in cs35l35_irq()
1201 regmap_update_bits(cs35l35->regmap, in cs35l35_irq()
1204 regmap_update_bits(cs35l35->regmap, in cs35l35_irq()
1208 regmap_update_bits(cs35l35->regmap, in cs35l35_irq()
1215 dev_crit(cs35l35->dev, "VBST error: powering off!\n"); in cs35l35_irq()
1216 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL2, in cs35l35_irq()
1218 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL1, in cs35l35_irq()
1223 dev_crit(cs35l35->dev, "LBST error: powering off!\n"); in cs35l35_irq()
1224 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL2, in cs35l35_irq()
1226 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL1, in cs35l35_irq()
1231 dev_dbg(cs35l35->dev, "Error: Reactive Brownout\n"); in cs35l35_irq()
1234 dev_dbg(cs35l35->dev, "Error: VMON overflow\n"); in cs35l35_irq()
1237 dev_dbg(cs35l35->dev, "Error: IMON overflow\n"); in cs35l35_irq()
1246 struct device_node *np = i2c_client->dev.of_node; in cs35l35_handle_of_data()
1248 struct classh_cfg *classh_config = &pdata->classh_algo; in cs35l35_handle_of_data()
1249 struct monitor_cfg *monitor_config = &pdata->mon_cfg; in cs35l35_handle_of_data()
1253 const int mon_array_size = imon_array_size - 1; in cs35l35_handle_of_data()
1259 pdata->bst_pdn_fet_on = of_property_read_bool(np, in cs35l35_handle_of_data()
1260 "cirrus,boost-pdn-fet-on"); in cs35l35_handle_of_data()
1262 ret = of_property_read_u32(np, "cirrus,boost-ctl-millivolt", &val32); in cs35l35_handle_of_data()
1265 dev_err(&i2c_client->dev, in cs35l35_handle_of_data()
1267 return -EINVAL; in cs35l35_handle_of_data()
1269 pdata->bst_vctl = ((val32 - 2600) / 100) + 1; in cs35l35_handle_of_data()
1272 ret = of_property_read_u32(np, "cirrus,boost-peak-milliamp", &val32); in cs35l35_handle_of_data()
1275 dev_err(&i2c_client->dev, in cs35l35_handle_of_data()
1277 return -EINVAL; in cs35l35_handle_of_data()
1280 pdata->bst_ipk = ((val32 - 1680) / 110) | CS35L35_VALID_PDATA; in cs35l35_handle_of_data()
1283 ret = of_property_read_u32(np, "cirrus,boost-ind-nanohenry", &val32); in cs35l35_handle_of_data()
1285 pdata->boost_ind = val32; in cs35l35_handle_of_data()
1287 dev_err(&i2c_client->dev, "Inductor not specified.\n"); in cs35l35_handle_of_data()
1288 return -EINVAL; in cs35l35_handle_of_data()
1291 if (of_property_read_u32(np, "cirrus,sp-drv-strength", &val32) >= 0) in cs35l35_handle_of_data()
1292 pdata->sp_drv_str = val32; in cs35l35_handle_of_data()
1293 if (of_property_read_u32(np, "cirrus,sp-drv-unused", &val32) >= 0) in cs35l35_handle_of_data()
1294 pdata->sp_drv_unused = val32 | CS35L35_VALID_PDATA; in cs35l35_handle_of_data()
1296 pdata->stereo = of_property_read_bool(np, "cirrus,stereo-config"); in cs35l35_handle_of_data()
1298 if (pdata->stereo) { in cs35l35_handle_of_data()
1299 ret = of_property_read_u32(np, "cirrus,audio-channel", &val32); in cs35l35_handle_of_data()
1301 pdata->aud_channel = val32; in cs35l35_handle_of_data()
1303 ret = of_property_read_u32(np, "cirrus,advisory-channel", in cs35l35_handle_of_data()
1306 pdata->adv_channel = val32; in cs35l35_handle_of_data()
1308 pdata->shared_bst = of_property_read_bool(np, in cs35l35_handle_of_data()
1309 "cirrus,shared-boost"); in cs35l35_handle_of_data()
1312 pdata->ext_bst = of_property_read_bool(np, "cirrus,external-boost"); in cs35l35_handle_of_data()
1314 pdata->gain_zc = of_property_read_bool(np, "cirrus,amp-gain-zc"); in cs35l35_handle_of_data()
1316 classh = of_get_child_by_name(np, "cirrus,classh-internal-algo"); in cs35l35_handle_of_data()
1317 classh_config->classh_algo_enable = classh ? true : false; in cs35l35_handle_of_data()
1319 if (classh_config->classh_algo_enable) { in cs35l35_handle_of_data()
1320 classh_config->classh_bst_override = in cs35l35_handle_of_data()
1321 of_property_read_bool(np, "cirrus,classh-bst-overide"); in cs35l35_handle_of_data()
1324 "cirrus,classh-bst-max-limit", in cs35l35_handle_of_data()
1328 classh_config->classh_bst_max_limit = val32; in cs35l35_handle_of_data()
1332 "cirrus,classh-bst-max-limit", in cs35l35_handle_of_data()
1336 classh_config->classh_bst_max_limit = val32; in cs35l35_handle_of_data()
1339 ret = of_property_read_u32(classh, "cirrus,classh-mem-depth", in cs35l35_handle_of_data()
1343 classh_config->classh_mem_depth = val32; in cs35l35_handle_of_data()
1346 ret = of_property_read_u32(classh, "cirrus,classh-release-rate", in cs35l35_handle_of_data()
1349 classh_config->classh_release_rate = val32; in cs35l35_handle_of_data()
1351 ret = of_property_read_u32(classh, "cirrus,classh-headroom", in cs35l35_handle_of_data()
1355 classh_config->classh_headroom = val32; in cs35l35_handle_of_data()
1359 "cirrus,classh-wk-fet-disable", in cs35l35_handle_of_data()
1362 classh_config->classh_wk_fet_disable = val32; in cs35l35_handle_of_data()
1364 ret = of_property_read_u32(classh, "cirrus,classh-wk-fet-delay", in cs35l35_handle_of_data()
1368 classh_config->classh_wk_fet_delay = val32; in cs35l35_handle_of_data()
1371 ret = of_property_read_u32(classh, "cirrus,classh-wk-fet-thld", in cs35l35_handle_of_data()
1374 classh_config->classh_wk_fet_thld = val32; in cs35l35_handle_of_data()
1376 ret = of_property_read_u32(classh, "cirrus,classh-vpch-auto", in cs35l35_handle_of_data()
1380 classh_config->classh_vpch_auto = val32; in cs35l35_handle_of_data()
1383 ret = of_property_read_u32(classh, "cirrus,classh-vpch-rate", in cs35l35_handle_of_data()
1387 classh_config->classh_vpch_rate = val32; in cs35l35_handle_of_data()
1390 ret = of_property_read_u32(classh, "cirrus,classh-vpch-man", in cs35l35_handle_of_data()
1393 classh_config->classh_vpch_man = val32; in cs35l35_handle_of_data()
1398 signal_format = of_get_child_by_name(np, "cirrus,monitor-signal-format"); in cs35l35_handle_of_data()
1399 monitor_config->is_present = signal_format ? true : false; in cs35l35_handle_of_data()
1400 if (monitor_config->is_present) { in cs35l35_handle_of_data()
1404 monitor_config->imon_specs = true; in cs35l35_handle_of_data()
1405 monitor_config->imon_dpth = monitor_array[0]; in cs35l35_handle_of_data()
1406 monitor_config->imon_loc = monitor_array[1]; in cs35l35_handle_of_data()
1407 monitor_config->imon_frm = monitor_array[2]; in cs35l35_handle_of_data()
1408 monitor_config->imon_scale = monitor_array[3]; in cs35l35_handle_of_data()
1413 monitor_config->vmon_specs = true; in cs35l35_handle_of_data()
1414 monitor_config->vmon_dpth = monitor_array[0]; in cs35l35_handle_of_data()
1415 monitor_config->vmon_loc = monitor_array[1]; in cs35l35_handle_of_data()
1416 monitor_config->vmon_frm = monitor_array[2]; in cs35l35_handle_of_data()
1421 monitor_config->vpmon_specs = true; in cs35l35_handle_of_data()
1422 monitor_config->vpmon_dpth = monitor_array[0]; in cs35l35_handle_of_data()
1423 monitor_config->vpmon_loc = monitor_array[1]; in cs35l35_handle_of_data()
1424 monitor_config->vpmon_frm = monitor_array[2]; in cs35l35_handle_of_data()
1429 monitor_config->vbstmon_specs = true; in cs35l35_handle_of_data()
1430 monitor_config->vbstmon_dpth = monitor_array[0]; in cs35l35_handle_of_data()
1431 monitor_config->vbstmon_loc = monitor_array[1]; in cs35l35_handle_of_data()
1432 monitor_config->vbstmon_frm = monitor_array[2]; in cs35l35_handle_of_data()
1437 monitor_config->vpbrstat_specs = true; in cs35l35_handle_of_data()
1438 monitor_config->vpbrstat_dpth = monitor_array[0]; in cs35l35_handle_of_data()
1439 monitor_config->vpbrstat_loc = monitor_array[1]; in cs35l35_handle_of_data()
1440 monitor_config->vpbrstat_frm = monitor_array[2]; in cs35l35_handle_of_data()
1445 monitor_config->zerofill_specs = true; in cs35l35_handle_of_data()
1446 monitor_config->zerofill_dpth = monitor_array[0]; in cs35l35_handle_of_data()
1447 monitor_config->zerofill_loc = monitor_array[1]; in cs35l35_handle_of_data()
1448 monitor_config->zerofill_frm = monitor_array[2]; in cs35l35_handle_of_data()
1476 struct device *dev = &i2c_client->dev; in cs35l35_i2c_probe()
1485 return -ENOMEM; in cs35l35_i2c_probe()
1487 cs35l35->dev = dev; in cs35l35_i2c_probe()
1490 cs35l35->regmap = devm_regmap_init_i2c(i2c_client, &cs35l35_regmap); in cs35l35_i2c_probe()
1491 if (IS_ERR(cs35l35->regmap)) { in cs35l35_i2c_probe()
1492 ret = PTR_ERR(cs35l35->regmap); in cs35l35_i2c_probe()
1498 cs35l35->supplies[i].supply = cs35l35_supplies[i]; in cs35l35_i2c_probe()
1500 cs35l35->num_supplies = ARRAY_SIZE(cs35l35_supplies); in cs35l35_i2c_probe()
1502 ret = devm_regulator_bulk_get(dev, cs35l35->num_supplies, in cs35l35_i2c_probe()
1503 cs35l35->supplies); in cs35l35_i2c_probe()
1510 cs35l35->pdata = *pdata; in cs35l35_i2c_probe()
1515 return -ENOMEM; in cs35l35_i2c_probe()
1516 if (i2c_client->dev.of_node) { in cs35l35_i2c_probe()
1522 cs35l35->pdata = *pdata; in cs35l35_i2c_probe()
1525 ret = regulator_bulk_enable(cs35l35->num_supplies, in cs35l35_i2c_probe()
1526 cs35l35->supplies); in cs35l35_i2c_probe()
1533 cs35l35->reset_gpio = devm_gpiod_get_optional(dev, "reset", in cs35l35_i2c_probe()
1535 if (IS_ERR(cs35l35->reset_gpio)) { in cs35l35_i2c_probe()
1536 ret = PTR_ERR(cs35l35->reset_gpio); in cs35l35_i2c_probe()
1537 cs35l35->reset_gpio = NULL; in cs35l35_i2c_probe()
1538 if (ret == -EBUSY) { in cs35l35_i2c_probe()
1549 init_completion(&cs35l35->pdn_done); in cs35l35_i2c_probe()
1551 ret = devm_request_threaded_irq(dev, i2c_client->irq, NULL, cs35l35_irq, in cs35l35_i2c_probe()
1559 ret = regmap_read(cs35l35->regmap, CS35L35_DEVID_AB, &reg); in cs35l35_i2c_probe()
1562 ret = regmap_read(cs35l35->regmap, CS35L35_DEVID_CD, &reg); in cs35l35_i2c_probe()
1564 ret = regmap_read(cs35l35->regmap, CS35L35_DEVID_E, &reg); in cs35l35_i2c_probe()
1570 ret = -ENODEV; in cs35l35_i2c_probe()
1574 ret = regmap_read(cs35l35->regmap, CS35L35_REV_ID, &reg); in cs35l35_i2c_probe()
1580 ret = regmap_register_patch(cs35l35->regmap, cs35l35_errata_patch, in cs35l35_i2c_probe()
1591 regmap_write(cs35l35->regmap, CS35L35_INT_MASK_1, in cs35l35_i2c_probe()
1593 regmap_write(cs35l35->regmap, CS35L35_INT_MASK_2, in cs35l35_i2c_probe()
1595 regmap_write(cs35l35->regmap, CS35L35_INT_MASK_3, in cs35l35_i2c_probe()
1597 regmap_write(cs35l35->regmap, CS35L35_INT_MASK_4, in cs35l35_i2c_probe()
1600 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL2, in cs35l35_i2c_probe()
1604 if (cs35l35->pdata.bst_pdn_fet_on) in cs35l35_i2c_probe()
1605 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL2, in cs35l35_i2c_probe()
1609 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL2, in cs35l35_i2c_probe()
1613 regmap_update_bits(cs35l35->regmap, CS35L35_PWRCTL3, in cs35l35_i2c_probe()
1617 regmap_update_bits(cs35l35->regmap, CS35L35_PROTECT_CTL, in cs35l35_i2c_probe()
1630 regulator_bulk_disable(cs35l35->num_supplies, in cs35l35_i2c_probe()
1631 cs35l35->supplies); in cs35l35_i2c_probe()
1632 gpiod_set_value_cansleep(cs35l35->reset_gpio, 0); in cs35l35_i2c_probe()
1641 regulator_bulk_disable(cs35l35->num_supplies, cs35l35->supplies); in cs35l35_i2c_remove()
1642 gpiod_set_value_cansleep(cs35l35->reset_gpio, 0); in cs35l35_i2c_remove()