Lines Matching +full:adc2 +full:-
1 // SPDX-License-Identifier: GPL-2.0
5 // Copyright (C) 2024-2025 Cirrus Logic, Inc. and
26 "vdd-a",
27 "vdd-io",
136 struct regmap *regmap = cs530x->regmap; in cs530x_put_volsw_vu()
154 static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -1270, 50, 0);
157 "Min Phase Slow Roll-off",
158 "Min Phase Fast Roll-off",
159 "Linear Phase Slow Roll-off",
160 "Linear Phase Fast Roll-off",
240 SOC_SINGLE("ADC2 Invert Switch", CS530X_IN_INV, CS530X_INOUT2_INV_SHIFT, 1, 0),
272 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in cs530x_adc_event()
274 struct regmap *regmap = cs530x->regmap; in cs530x_adc_event()
278 cs530x->adc_pairs_count++; in cs530x_adc_event()
282 (w->shift * 2), CS530X_INOUT_MUTE); in cs530x_adc_event()
284 ((w->shift + 1) * 2), CS530X_INOUT_MUTE); in cs530x_adc_event()
286 cs530x->adc_pairs_count--; in cs530x_adc_event()
287 if (!cs530x->adc_pairs_count) { in cs530x_adc_event()
295 (w->shift * 2), CS530X_INOUT_MUTE); in cs530x_adc_event()
297 ((w->shift + 1) * 2), CS530X_INOUT_MUTE); in cs530x_adc_event()
301 return -EINVAL; in cs530x_adc_event()
358 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in cs530x_dac_event()
360 struct regmap *regmap = cs530x->regmap; in cs530x_dac_event()
364 cs530x->dac_pairs_count++; in cs530x_dac_event()
368 (w->shift * 2), CS530X_INOUT_MUTE); in cs530x_dac_event()
370 ((w->shift + 1) * 2), CS530X_INOUT_MUTE); in cs530x_dac_event()
372 cs530x->dac_pairs_count--; in cs530x_dac_event()
373 if (!cs530x->dac_pairs_count) { in cs530x_dac_event()
381 (w->shift * 2), CS530X_INOUT_MUTE); in cs530x_dac_event()
383 ((w->shift + 1) * 2), CS530X_INOUT_MUTE); in cs530x_dac_event()
387 return -EINVAL; in cs530x_dac_event()
427 SND_SOC_DAPM_ADC("ADC2", NULL, CS530X_IN_ENABLES, 1, 0),
467 { "ADC2", NULL, "Global Enable" },
472 { "ADC2", NULL, "ADC12 Enable" },
474 { "IN HPF", "Switch", "ADC2" },
478 { "AIF Capture", NULL, "ADC2" },
703 struct regmap *regmap = cs530x->regmap; in cs530x_set_bclk()
724 dev_err(component->dev, "Invalid BCLK frequency %d\n", freq); in cs530x_set_bclk()
725 return -EINVAL; in cs530x_set_bclk()
728 dev_dbg(component->dev, "BCLK frequency is %d\n", freq); in cs530x_set_bclk()
738 struct regmap *regmap = priv->regmap; in cs530x_set_pll_refclk()
759 dev_err(component->dev, "Invalid PLL refclk %d\n", freq); in cs530x_set_pll_refclk()
760 return -EINVAL; in cs530x_set_pll_refclk()
771 struct snd_soc_component *component = dai->component; in cs530x_hw_params()
773 struct regmap *regmap = cs530x->regmap; in cs530x_hw_params()
802 dev_err(component->dev, "Invalid sample rate %d\n", fs); in cs530x_hw_params()
803 return -EINVAL; in cs530x_hw_params()
812 dev_dbg(component->dev, "Configuring for %d %d bit TDM slots\n", in cs530x_hw_params()
813 cs530x->tdm_slots, cs530x->tdm_width); in cs530x_hw_params()
815 cs530x->tdm_width, in cs530x_hw_params()
816 cs530x->tdm_slots, in cs530x_hw_params()
834 struct snd_soc_component *component = dai->component; in cs530x_set_fmt()
836 struct regmap *regmap = priv->regmap; in cs530x_set_fmt()
846 return -EINVAL; in cs530x_set_fmt()
860 return -EINVAL; in cs530x_set_fmt()
870 return -EINVAL; in cs530x_set_fmt()
891 dev_err(component->dev, "Invalid MCLK %d\n", freq); in cs530x_check_mclk_freq()
899 struct snd_soc_component *component = dai->component; in cs530x_set_tdm_slot()
901 struct regmap *regmap = cs530x->regmap; in cs530x_set_tdm_slot()
936 dev_err(component->dev, "Invalid TX slot(s) 0x%x\n", tx_mask); in cs530x_set_tdm_slot()
937 return -EINVAL; in cs530x_set_tdm_slot()
940 cs530x->tdm_width = slot_width; in cs530x_set_tdm_slot()
941 cs530x->tdm_slots = slots; in cs530x_set_tdm_slot()
955 .name = "cs530x-dai",
976 struct regmap *regmap = cs530x->regmap; in cs530x_set_pll()
989 return -EINVAL; in cs530x_set_pll()
999 dev_err(component->dev, "Invalid PLL source %d\n", source); in cs530x_set_pll()
1000 return -EINVAL; in cs530x_set_pll()
1016 switch (cs530x->devtype) { in cs530x_component_probe()
1088 dev_err(component->dev, "Invalid device type %d\n", in cs530x_component_probe()
1089 cs530x->devtype); in cs530x_component_probe()
1090 return -EINVAL; in cs530x_component_probe()
1100 struct regmap *regmap = cs530x->regmap; in cs530x_set_sysclk()
1109 dev_err(component->dev, "Invalid MCLK source rate %d\n", freq); in cs530x_set_sysclk()
1110 return -EINVAL; in cs530x_set_sysclk()
1116 dev_err(component->dev, "Invalid sysclk source: %d\n", source); in cs530x_set_sysclk()
1117 return -EINVAL; in cs530x_set_sysclk()
1168 struct device *dev = cs530x->dev; in cs530x_check_device_id()
1172 ret = regmap_read(cs530x->regmap, CS530X_DEVID, &dev_id); in cs530x_check_device_id()
1176 ret = regmap_read(cs530x->regmap, CS530X_REVID, &rev); in cs530x_check_device_id()
1182 cs530x->num_dacs = 2; in cs530x_check_device_id()
1183 cs530x->num_adcs = 2; in cs530x_check_device_id()
1186 cs530x->num_dacs = 2; in cs530x_check_device_id()
1189 cs530x->num_dacs = 4; in cs530x_check_device_id()
1192 cs530x->num_dacs = 8; in cs530x_check_device_id()
1195 cs530x->num_adcs = 2; in cs530x_check_device_id()
1198 cs530x->num_adcs = 4; in cs530x_check_device_id()
1201 cs530x->num_adcs = 8; in cs530x_check_device_id()
1204 return dev_err_probe(dev, -EINVAL, "Invalid device ID 0x%x\n", in cs530x_check_device_id()
1208 if (cs530x->devtype != dev_id) { in cs530x_check_device_id()
1210 dev_id, cs530x->devtype); in cs530x_check_device_id()
1211 return -EINVAL; in cs530x_check_device_id()
1215 cs530x->num_adcs, cs530x->num_dacs); in cs530x_check_device_id()
1222 struct regmap *regmap = cs530x->regmap; in cs530x_parse_device_properties()
1223 struct device *dev = cs530x->dev; in cs530x_parse_device_properties()
1226 switch (cs530x->num_adcs) { in cs530x_parse_device_properties()
1228 if (device_property_read_bool(dev, "cirrus,in-hiz-pin78")) in cs530x_parse_device_properties()
1231 if (device_property_read_bool(dev, "cirrus,in-hiz-pin56")) in cs530x_parse_device_properties()
1236 if (device_property_read_bool(dev, "cirrus,in-hiz-pin34")) in cs530x_parse_device_properties()
1241 if (device_property_read_bool(dev, "cirrus,in-hiz-pin12")) in cs530x_parse_device_properties()
1249 return dev_err_probe(dev, -EINVAL, in cs530x_parse_device_properties()
1251 cs530x->num_adcs); in cs530x_parse_device_properties()
1257 struct device *dev = cs530x->dev; in cs530x_probe()
1260 cs530x->dev_dai = devm_kmemdup(dev, &cs530x_dai, in cs530x_probe()
1261 sizeof(*(cs530x->dev_dai)), in cs530x_probe()
1263 if (!cs530x->dev_dai) in cs530x_probe()
1264 return -ENOMEM; in cs530x_probe()
1266 for (i = 0; i < ARRAY_SIZE(cs530x->supplies); i++) in cs530x_probe()
1267 cs530x->supplies[i].supply = cs530x_supply_names[i]; in cs530x_probe()
1269 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(cs530x->supplies), in cs530x_probe()
1270 cs530x->supplies); in cs530x_probe()
1274 ret = regulator_bulk_enable(ARRAY_SIZE(cs530x->supplies), in cs530x_probe()
1275 cs530x->supplies); in cs530x_probe()
1279 cs530x->reset_gpio = devm_gpiod_get_optional(dev, "reset", in cs530x_probe()
1281 if (IS_ERR(cs530x->reset_gpio)) { in cs530x_probe()
1282 ret = dev_err_probe(dev, PTR_ERR(cs530x->reset_gpio), in cs530x_probe()
1287 if (cs530x->reset_gpio) { in cs530x_probe()
1289 gpiod_set_value_cansleep(cs530x->reset_gpio, 0); in cs530x_probe()
1297 if (!cs530x->reset_gpio) { in cs530x_probe()
1298 ret = regmap_write(cs530x->regmap, CS530X_SW_RESET, in cs530x_probe()
1310 if (cs530x->num_adcs) { in cs530x_probe()
1311 cs530x->dev_dai->capture.channels_min = 2; in cs530x_probe()
1312 cs530x->dev_dai->capture.channels_max = cs530x->num_adcs; in cs530x_probe()
1315 if (cs530x->num_dacs) { in cs530x_probe()
1316 cs530x->dev_dai->playback.channels_min = 2; in cs530x_probe()
1317 cs530x->dev_dai->playback.channels_max = cs530x->num_dacs; in cs530x_probe()
1322 cs530x->dev_dai, 1); in cs530x_probe()
1331 gpiod_set_value_cansleep(cs530x->reset_gpio, 1); in cs530x_probe()
1334 regulator_bulk_disable(ARRAY_SIZE(cs530x->supplies), in cs530x_probe()
1335 cs530x->supplies); in cs530x_probe()