Lines Matching +full:rate +full:- +full:np +full:- +full:ms

1 // SPDX-License-Identifier: GPL-2.0-only
19 #include <sound/soc-dapm.h>
66 regcache_mark_dirty(pcm512x->regmap); \
67 regcache_cache_only(pcm512x->regmap, true); \
230 ucontrol->value.integer.value[0] = pcm512x->overclock_pll; in pcm512x_overclock_pll_get()
245 return -EBUSY; in pcm512x_overclock_pll_put()
248 pcm512x->overclock_pll = ucontrol->value.integer.value[0]; in pcm512x_overclock_pll_put()
258 ucontrol->value.integer.value[0] = pcm512x->overclock_dsp; in pcm512x_overclock_dsp_get()
273 return -EBUSY; in pcm512x_overclock_dsp_put()
276 pcm512x->overclock_dsp = ucontrol->value.integer.value[0]; in pcm512x_overclock_dsp_put()
286 ucontrol->value.integer.value[0] = pcm512x->overclock_dac; in pcm512x_overclock_dac_get()
301 return -EBUSY; in pcm512x_overclock_dac_put()
304 pcm512x->overclock_dac = ucontrol->value.integer.value[0]; in pcm512x_overclock_dac_put()
308 static const DECLARE_TLV_DB_SCALE(digital_tlv, -10350, 50, 1);
309 static const DECLARE_TLV_DB_SCALE(analog_tlv, -600, 600, 0);
313 "FIR interpolation with de-emphasis",
314 "Low latency IIR with de-emphasis",
315 "High attenuation with de-emphasis",
317 "Ringing-less low latency FIR",
341 "21ms", "106ms", "213ms", "533ms", "1.07s", "2.13s", "5.33s", "10.66s"
388 pcm512x->regmap, PCM512x_MUTE, PCM512x_RQML | PCM512x_RQMR, in pcm512x_update_mute()
389 (!!(pcm512x->mute & 0x5) << PCM512x_RQML_SHIFT) in pcm512x_update_mute()
390 | (!!(pcm512x->mute & 0x3) << PCM512x_RQMR_SHIFT)); in pcm512x_update_mute()
399 mutex_lock(&pcm512x->mutex); in pcm512x_digital_playback_switch_get()
400 ucontrol->value.integer.value[0] = !(pcm512x->mute & 0x4); in pcm512x_digital_playback_switch_get()
401 ucontrol->value.integer.value[1] = !(pcm512x->mute & 0x2); in pcm512x_digital_playback_switch_get()
402 mutex_unlock(&pcm512x->mutex); in pcm512x_digital_playback_switch_get()
414 mutex_lock(&pcm512x->mutex); in pcm512x_digital_playback_switch_put()
416 if ((pcm512x->mute & 0x4) == (ucontrol->value.integer.value[0] << 2)) { in pcm512x_digital_playback_switch_put()
417 pcm512x->mute ^= 0x4; in pcm512x_digital_playback_switch_put()
420 if ((pcm512x->mute & 0x2) == (ucontrol->value.integer.value[1] << 1)) { in pcm512x_digital_playback_switch_put()
421 pcm512x->mute ^= 0x2; in pcm512x_digital_playback_switch_put()
428 dev_err(component->dev, in pcm512x_digital_playback_switch_put()
430 mutex_unlock(&pcm512x->mutex); in pcm512x_digital_playback_switch_put()
435 mutex_unlock(&pcm512x->mutex); in pcm512x_digital_playback_switch_put()
468 SOC_ENUM("Volume Ramp Down Rate", pcm512x_vndf),
470 SOC_ENUM("Volume Ramp Up Rate", pcm512x_vnuf),
472 SOC_ENUM("Volume Ramp Down Emergency Rate", pcm512x_vedf),
501 return 25000000 + 25000000 * pcm512x->overclock_pll / 100; in pcm512x_pll_max()
506 return 50000000 + 50000000 * pcm512x->overclock_dsp / 100; in pcm512x_dsp_max()
510 unsigned long rate) in pcm512x_dac_max() argument
512 return rate + rate * pcm512x->overclock_dac / 100; in pcm512x_dac_max()
517 if (!pcm512x->pll_out) in pcm512x_sck_max()
527 * NCP target rate... in pcm512x_ncp_target()
533 * rate to get the recommended dividers even when overclocking. in pcm512x_ncp_target()
551 struct pcm512x_priv *pcm512x = rule->private; in pcm512x_hw_rule_rate()
575 return -EINVAL; in pcm512x_hw_rule_rate()
578 return snd_interval_ranges(hw_param_interval(params, rule->var), in pcm512x_hw_rule_rate()
585 struct snd_soc_component *component = dai->component; in pcm512x_dai_startup_master()
587 struct device *dev = dai->dev; in pcm512x_dai_startup_master()
591 if (IS_ERR(pcm512x->sclk)) { in pcm512x_dai_startup_master()
593 PTR_ERR(pcm512x->sclk)); in pcm512x_dai_startup_master()
594 return PTR_ERR(pcm512x->sclk); in pcm512x_dai_startup_master()
597 if (pcm512x->pll_out) in pcm512x_dai_startup_master()
598 return snd_pcm_hw_rule_add(substream->runtime, 0, in pcm512x_dai_startup_master()
603 SNDRV_PCM_HW_PARAM_CHANNELS, -1); in pcm512x_dai_startup_master()
608 return -ENOMEM; in pcm512x_dai_startup_master()
609 constraints_no_pll->nrats = 1; in pcm512x_dai_startup_master()
612 return -ENOMEM; in pcm512x_dai_startup_master()
613 constraints_no_pll->rats = rats_no_pll; in pcm512x_dai_startup_master()
614 rats_no_pll->num = clk_get_rate(pcm512x->sclk) / 64; in pcm512x_dai_startup_master()
615 rats_no_pll->den_min = 1; in pcm512x_dai_startup_master()
616 rats_no_pll->den_max = 128; in pcm512x_dai_startup_master()
617 rats_no_pll->den_step = 1; in pcm512x_dai_startup_master()
619 return snd_pcm_hw_constraint_ratnums(substream->runtime, 0, in pcm512x_dai_startup_master()
627 struct snd_soc_component *component = dai->component; in pcm512x_dai_startup_slave()
629 struct device *dev = dai->dev; in pcm512x_dai_startup_slave()
630 struct regmap *regmap = pcm512x->regmap; in pcm512x_dai_startup_slave()
632 if (IS_ERR(pcm512x->sclk)) { in pcm512x_dai_startup_slave()
634 PTR_ERR(pcm512x->sclk)); in pcm512x_dai_startup_slave()
645 return snd_pcm_hw_constraint_list(substream->runtime, 0, in pcm512x_dai_startup_slave()
653 struct snd_soc_component *component = dai->component; in pcm512x_dai_startup()
656 switch (pcm512x->fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { in pcm512x_dai_startup()
665 return -EINVAL; in pcm512x_dai_startup()
672 struct pcm512x_priv *pcm512x = dev_get_drvdata(component->dev); in pcm512x_set_bias_level()
681 ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, in pcm512x_set_bias_level()
684 dev_err(component->dev, "Failed to remove standby: %d\n", in pcm512x_set_bias_level()
691 ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, in pcm512x_set_bias_level()
694 dev_err(component->dev, "Failed to request standby: %d\n", in pcm512x_set_bias_level()
707 struct device *dev = dai->dev; in pcm512x_find_sck()
708 struct snd_soc_component *component = dai->component; in pcm512x_find_sck()
718 * to find a fast DAC rate in pcm512x_find_sck()
720 pow2 = 1 << fls((pcm512x_pll_max(pcm512x) - 16000000) / bclk_rate); in pcm512x_find_sck()
753 struct device *dev = dai->dev; in pcm512x_find_pll_coeff()
754 struct snd_soc_component *component = dai->component; in pcm512x_find_pll_coeff()
781 for (R = 16; R; R--) { in pcm512x_find_pll_coeff()
789 pcm512x->real_pll = pll_rate; in pcm512x_find_pll_coeff()
819 pcm512x->real_pll = pll_rate; in pcm512x_find_pll_coeff()
831 dev_err(dev, "Need a slower clock as pll-input\n"); in pcm512x_find_pll_coeff()
832 return -EINVAL; in pcm512x_find_pll_coeff()
835 dev_err(dev, "Need a faster clock as pll-input\n"); in pcm512x_find_pll_coeff()
836 return -EINVAL; in pcm512x_find_pll_coeff()
847 pcm512x->real_pll = DIV_ROUND_DOWN_ULL((u64)K * pllin_rate, 10000 * P); in pcm512x_find_pll_coeff()
850 pcm512x->pll_r = R; in pcm512x_find_pll_coeff()
851 pcm512x->pll_j = J; in pcm512x_find_pll_coeff()
852 pcm512x->pll_d = D; in pcm512x_find_pll_coeff()
853 pcm512x->pll_p = P; in pcm512x_find_pll_coeff()
861 struct snd_soc_component *component = dai->component; in pcm512x_pllin_dac_rate()
865 if (!pcm512x->pll_out) in pcm512x_pllin_dac_rate()
874 dac_rate -= osr_rate) { in pcm512x_pllin_dac_rate()
882 dac_rate -= osr_rate; in pcm512x_pllin_dac_rate()
891 struct device *dev = dai->dev; in pcm512x_set_dividers()
892 struct snd_soc_component *component = dai->component; in pcm512x_set_dividers()
914 if (pcm512x->bclk_ratio > 0) { in pcm512x_set_dividers()
915 lrclk_div = pcm512x->bclk_ratio; in pcm512x_set_dividers()
921 return -EINVAL; in pcm512x_set_dividers()
925 if (!pcm512x->pll_out) { in pcm512x_set_dividers()
926 sck_rate = clk_get_rate(pcm512x->sclk); in pcm512x_set_dividers()
939 return -EINVAL; in pcm512x_set_dividers()
943 pllin_rate = clk_get_rate(pcm512x->sclk); in pcm512x_set_dividers()
947 return -EINVAL; in pcm512x_set_dividers()
954 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
955 PCM512x_PLL_COEFF_0, pcm512x->pll_p - 1); in pcm512x_set_dividers()
961 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
962 PCM512x_PLL_COEFF_1, pcm512x->pll_j); in pcm512x_set_dividers()
968 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
969 PCM512x_PLL_COEFF_2, pcm512x->pll_d >> 8); in pcm512x_set_dividers()
975 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
976 PCM512x_PLL_COEFF_3, pcm512x->pll_d & 0xff); in pcm512x_set_dividers()
982 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
983 PCM512x_PLL_COEFF_4, pcm512x->pll_r - 1); in pcm512x_set_dividers()
989 mck_rate = pcm512x->real_pll; in pcm512x_set_dividers()
996 return -EINVAL; in pcm512x_set_dividers()
999 /* the actual rate */ in pcm512x_set_dividers()
1008 /* the desired clock rate is "compatible" with the pll input in pcm512x_set_dividers()
1014 ret = regmap_update_bits(pcm512x->regmap, PCM512x_DAC_REF, in pcm512x_set_dividers()
1017 dev_err(component->dev, in pcm512x_set_dividers()
1022 gpio = PCM512x_GREF_GPIO1 + pcm512x->pll_in - 1; in pcm512x_set_dividers()
1023 ret = regmap_update_bits(pcm512x->regmap, PCM512x_GPIO_DACIN, in pcm512x_set_dividers()
1026 dev_err(component->dev, in pcm512x_set_dividers()
1028 pcm512x->pll_in, ret); in pcm512x_set_dividers()
1039 for (; dac_mul; dac_mul--) { in pcm512x_set_dividers()
1044 dev_err(dev, "Failed to find DAC rate\n"); in pcm512x_set_dividers()
1045 return -EINVAL; in pcm512x_set_dividers()
1052 ret = regmap_update_bits(pcm512x->regmap, PCM512x_DAC_REF, in pcm512x_set_dividers()
1055 dev_err(component->dev, in pcm512x_set_dividers()
1066 return -EINVAL; in pcm512x_set_dividers()
1072 return -EINVAL; in pcm512x_set_dividers()
1083 return -EINVAL; in pcm512x_set_dividers()
1089 ret = regmap_write(pcm512x->regmap, PCM512x_DSP_CLKDIV, dsp_div - 1); in pcm512x_set_dividers()
1095 ret = regmap_write(pcm512x->regmap, PCM512x_DAC_CLKDIV, dac_div - 1); in pcm512x_set_dividers()
1101 ret = regmap_write(pcm512x->regmap, PCM512x_NCP_CLKDIV, ncp_div - 1); in pcm512x_set_dividers()
1107 ret = regmap_write(pcm512x->regmap, PCM512x_OSR_CLKDIV, osr_div - 1); in pcm512x_set_dividers()
1113 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
1114 PCM512x_MASTER_CLKDIV_1, bclk_div - 1); in pcm512x_set_dividers()
1120 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
1121 PCM512x_MASTER_CLKDIV_2, lrclk_div - 1); in pcm512x_set_dividers()
1127 ret = regmap_write(pcm512x->regmap, PCM512x_IDAC_1, idac >> 8); in pcm512x_set_dividers()
1133 ret = regmap_write(pcm512x->regmap, PCM512x_IDAC_2, idac & 0xff); in pcm512x_set_dividers()
1147 ret = regmap_update_bits(pcm512x->regmap, PCM512x_FS_SPEED_MODE, in pcm512x_set_dividers()
1150 dev_err(component->dev, "Failed to set fs speed: %d\n", ret); in pcm512x_set_dividers()
1154 dev_dbg(component->dev, "DSP divider %d\n", dsp_div); in pcm512x_set_dividers()
1155 dev_dbg(component->dev, "DAC divider %d\n", dac_div); in pcm512x_set_dividers()
1156 dev_dbg(component->dev, "NCP divider %d\n", ncp_div); in pcm512x_set_dividers()
1157 dev_dbg(component->dev, "OSR divider %d\n", osr_div); in pcm512x_set_dividers()
1158 dev_dbg(component->dev, "BCK divider %d\n", bclk_div); in pcm512x_set_dividers()
1159 dev_dbg(component->dev, "LRCK divider %d\n", lrclk_div); in pcm512x_set_dividers()
1160 dev_dbg(component->dev, "IDAC %d\n", idac); in pcm512x_set_dividers()
1161 dev_dbg(component->dev, "1<<FSSP %d\n", 1 << fssp); in pcm512x_set_dividers()
1170 struct snd_soc_component *component = dai->component; in pcm512x_hw_params()
1176 dev_dbg(component->dev, "hw_params %u Hz, %u channels\n", in pcm512x_hw_params()
1194 dev_err(component->dev, "Bad frame size: %d\n", in pcm512x_hw_params()
1196 return -EINVAL; in pcm512x_hw_params()
1199 ret = regmap_update_bits(pcm512x->regmap, PCM512x_I2S_1, in pcm512x_hw_params()
1202 dev_err(component->dev, "Failed to set frame size: %d\n", ret); in pcm512x_hw_params()
1206 if ((pcm512x->fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) == in pcm512x_hw_params()
1208 ret = regmap_update_bits(pcm512x->regmap, PCM512x_ERROR_DETECT, in pcm512x_hw_params()
1211 dev_err(component->dev, in pcm512x_hw_params()
1219 if (pcm512x->pll_out) { in pcm512x_hw_params()
1220 ret = regmap_write(pcm512x->regmap, PCM512x_FLEX_A, 0x11); in pcm512x_hw_params()
1222 dev_err(component->dev, "Failed to set FLEX_A: %d\n", ret); in pcm512x_hw_params()
1226 ret = regmap_write(pcm512x->regmap, PCM512x_FLEX_B, 0xff); in pcm512x_hw_params()
1228 dev_err(component->dev, "Failed to set FLEX_B: %d\n", ret); in pcm512x_hw_params()
1232 ret = regmap_update_bits(pcm512x->regmap, PCM512x_ERROR_DETECT, in pcm512x_hw_params()
1241 dev_err(component->dev, in pcm512x_hw_params()
1242 "Failed to ignore auto-clock failures: %d\n", in pcm512x_hw_params()
1247 ret = regmap_update_bits(pcm512x->regmap, PCM512x_ERROR_DETECT, in pcm512x_hw_params()
1256 dev_err(component->dev, in pcm512x_hw_params()
1257 "Failed to ignore auto-clock failures: %d\n", in pcm512x_hw_params()
1262 if (!pcm512x->force_pll_on) { in pcm512x_hw_params()
1263 ret = regmap_update_bits(pcm512x->regmap, in pcm512x_hw_params()
1269 ret = regmap_write(pcm512x->regmap, in pcm512x_hw_params()
1272 dev_err(component->dev, in pcm512x_hw_params()
1276 ret = regmap_write(pcm512x->regmap, in pcm512x_hw_params()
1279 dev_err(component->dev, in pcm512x_hw_params()
1283 ret = regmap_write(pcm512x->regmap, in pcm512x_hw_params()
1285 dev_dbg(component->dev, "Enabling PLL for TAS575x\n"); in pcm512x_hw_params()
1289 dev_err(component->dev, "Failed to set pll mode: %d\n", ret); in pcm512x_hw_params()
1298 if (pcm512x->pll_out) { in pcm512x_hw_params()
1299 ret = regmap_update_bits(pcm512x->regmap, PCM512x_PLL_REF, in pcm512x_hw_params()
1302 dev_err(component->dev, in pcm512x_hw_params()
1307 gpio = PCM512x_GREF_GPIO1 + pcm512x->pll_in - 1; in pcm512x_hw_params()
1308 ret = regmap_update_bits(pcm512x->regmap, PCM512x_GPIO_PLLIN, in pcm512x_hw_params()
1311 dev_err(component->dev, in pcm512x_hw_params()
1313 pcm512x->pll_in, ret); in pcm512x_hw_params()
1317 ret = regmap_update_bits(pcm512x->regmap, PCM512x_PLL_EN, in pcm512x_hw_params()
1320 dev_err(component->dev, "Failed to enable pll: %d\n", ret); in pcm512x_hw_params()
1324 gpio = PCM512x_G1OE << (pcm512x->pll_out - 1); in pcm512x_hw_params()
1325 ret = regmap_update_bits(pcm512x->regmap, PCM512x_GPIO_EN, in pcm512x_hw_params()
1328 dev_err(component->dev, "Failed to enable gpio %d: %d\n", in pcm512x_hw_params()
1329 pcm512x->pll_out, ret); in pcm512x_hw_params()
1333 gpio = PCM512x_GPIO_OUTPUT_1 + pcm512x->pll_out - 1; in pcm512x_hw_params()
1334 ret = regmap_update_bits(pcm512x->regmap, gpio, in pcm512x_hw_params()
1337 dev_err(component->dev, "Failed to output pll on %d: %d\n", in pcm512x_hw_params()
1338 ret, pcm512x->pll_out); in pcm512x_hw_params()
1343 ret = regmap_update_bits(pcm512x->regmap, PCM512x_SYNCHRONIZE, in pcm512x_hw_params()
1346 dev_err(component->dev, "Failed to halt clocks: %d\n", ret); in pcm512x_hw_params()
1350 ret = regmap_update_bits(pcm512x->regmap, PCM512x_SYNCHRONIZE, in pcm512x_hw_params()
1353 dev_err(component->dev, "Failed to resume clocks: %d\n", ret); in pcm512x_hw_params()
1363 struct snd_soc_component *component = dai->component; in pcm512x_set_fmt()
1385 return -EINVAL; in pcm512x_set_fmt()
1388 ret = regmap_update_bits(pcm512x->regmap, PCM512x_BCLK_LRCLK_CFG, in pcm512x_set_fmt()
1392 dev_err(component->dev, "Failed to enable clock output: %d\n", ret); in pcm512x_set_fmt()
1396 ret = regmap_update_bits(pcm512x->regmap, PCM512x_MASTER_MODE, in pcm512x_set_fmt()
1400 dev_err(component->dev, "Failed to enable provider mode: %d\n", ret); in pcm512x_set_fmt()
1421 dev_err(component->dev, "unsupported DAI format: 0x%x\n", in pcm512x_set_fmt()
1422 pcm512x->fmt); in pcm512x_set_fmt()
1423 return -EINVAL; in pcm512x_set_fmt()
1426 ret = regmap_update_bits(pcm512x->regmap, PCM512x_I2S_1, in pcm512x_set_fmt()
1429 dev_err(component->dev, "Failed to set data format: %d\n", ret); in pcm512x_set_fmt()
1433 ret = regmap_update_bits(pcm512x->regmap, PCM512x_I2S_2, in pcm512x_set_fmt()
1436 dev_err(component->dev, "Failed to set data offset: %d\n", ret); in pcm512x_set_fmt()
1440 pcm512x->fmt = fmt; in pcm512x_set_fmt()
1447 struct snd_soc_component *component = dai->component; in pcm512x_set_bclk_ratio()
1451 return -EINVAL; in pcm512x_set_bclk_ratio()
1453 pcm512x->bclk_ratio = ratio; in pcm512x_set_bclk_ratio()
1460 struct snd_soc_component *component = dai->component; in pcm512x_mute()
1465 mutex_lock(&pcm512x->mutex); in pcm512x_mute()
1468 pcm512x->mute |= 0x1; in pcm512x_mute()
1469 ret = regmap_update_bits(pcm512x->regmap, PCM512x_MUTE, in pcm512x_mute()
1473 dev_err(component->dev, in pcm512x_mute()
1478 regmap_read_poll_timeout(pcm512x->regmap, in pcm512x_mute()
1483 pcm512x->mute &= ~0x1; in pcm512x_mute()
1486 dev_err(component->dev, in pcm512x_mute()
1491 regmap_read_poll_timeout(pcm512x->regmap, in pcm512x_mute()
1495 == ((~pcm512x->mute >> 1) & 0x3), in pcm512x_mute()
1500 mutex_unlock(&pcm512x->mutex); in pcm512x_mute()
1515 .name = "pcm512x-hifi",
1574 return -ENOMEM; in pcm512x_probe()
1576 mutex_init(&pcm512x->mutex); in pcm512x_probe()
1579 pcm512x->regmap = regmap; in pcm512x_probe()
1581 for (i = 0; i < ARRAY_SIZE(pcm512x->supplies); i++) in pcm512x_probe()
1582 pcm512x->supplies[i].supply = pcm512x_supply_names[i]; in pcm512x_probe()
1584 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(pcm512x->supplies), in pcm512x_probe()
1585 pcm512x->supplies); in pcm512x_probe()
1591 pcm512x->supply_nb[0].notifier_call = pcm512x_regulator_event_0; in pcm512x_probe()
1592 pcm512x->supply_nb[1].notifier_call = pcm512x_regulator_event_1; in pcm512x_probe()
1593 pcm512x->supply_nb[2].notifier_call = pcm512x_regulator_event_2; in pcm512x_probe()
1595 for (i = 0; i < ARRAY_SIZE(pcm512x->supplies); i++) { in pcm512x_probe()
1597 pcm512x->supplies[i].consumer, in pcm512x_probe()
1598 &pcm512x->supply_nb[i]); in pcm512x_probe()
1606 ret = regulator_bulk_enable(ARRAY_SIZE(pcm512x->supplies), in pcm512x_probe()
1607 pcm512x->supplies); in pcm512x_probe()
1627 pcm512x->sclk = devm_clk_get(dev, NULL); in pcm512x_probe()
1628 if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER) { in pcm512x_probe()
1629 ret = -EPROBE_DEFER; in pcm512x_probe()
1632 if (!IS_ERR(pcm512x->sclk)) { in pcm512x_probe()
1633 ret = clk_prepare_enable(pcm512x->sclk); in pcm512x_probe()
1641 ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, in pcm512x_probe()
1654 if (dev->of_node) { in pcm512x_probe()
1655 const struct device_node *np = dev->of_node; in pcm512x_probe() local
1658 if (of_property_read_u32(np, "pll-in", &val) >= 0) { in pcm512x_probe()
1660 dev_err(dev, "Invalid pll-in\n"); in pcm512x_probe()
1661 ret = -EINVAL; in pcm512x_probe()
1664 pcm512x->pll_in = val; in pcm512x_probe()
1667 if (of_property_read_u32(np, "pll-out", &val) >= 0) { in pcm512x_probe()
1669 dev_err(dev, "Invalid pll-out\n"); in pcm512x_probe()
1670 ret = -EINVAL; in pcm512x_probe()
1673 pcm512x->pll_out = val; in pcm512x_probe()
1676 if (!pcm512x->pll_in != !pcm512x->pll_out) { in pcm512x_probe()
1678 "Error: both pll-in and pll-out, or none\n"); in pcm512x_probe()
1679 ret = -EINVAL; in pcm512x_probe()
1682 if (pcm512x->pll_in && pcm512x->pll_in == pcm512x->pll_out) { in pcm512x_probe()
1683 dev_err(dev, "Error: pll-in == pll-out\n"); in pcm512x_probe()
1684 ret = -EINVAL; in pcm512x_probe()
1688 if (!strcmp(np->name, "tas5756") || in pcm512x_probe()
1689 !strcmp(np->name, "tas5754")) in pcm512x_probe()
1690 pcm512x->force_pll_on = 1; in pcm512x_probe()
1691 dev_dbg(dev, "Device ID: %s\n", np->name); in pcm512x_probe()
1707 if (!IS_ERR(pcm512x->sclk)) in pcm512x_probe()
1708 clk_disable_unprepare(pcm512x->sclk); in pcm512x_probe()
1710 regulator_bulk_disable(ARRAY_SIZE(pcm512x->supplies), in pcm512x_probe()
1711 pcm512x->supplies); in pcm512x_probe()
1721 if (!IS_ERR(pcm512x->sclk)) in pcm512x_remove()
1722 clk_disable_unprepare(pcm512x->sclk); in pcm512x_remove()
1723 regulator_bulk_disable(ARRAY_SIZE(pcm512x->supplies), in pcm512x_remove()
1724 pcm512x->supplies); in pcm512x_remove()
1734 ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, in pcm512x_suspend()
1741 ret = regulator_bulk_disable(ARRAY_SIZE(pcm512x->supplies), in pcm512x_suspend()
1742 pcm512x->supplies); in pcm512x_suspend()
1748 if (!IS_ERR(pcm512x->sclk)) in pcm512x_suspend()
1749 clk_disable_unprepare(pcm512x->sclk); in pcm512x_suspend()
1759 if (!IS_ERR(pcm512x->sclk)) { in pcm512x_resume()
1760 ret = clk_prepare_enable(pcm512x->sclk); in pcm512x_resume()
1767 ret = regulator_bulk_enable(ARRAY_SIZE(pcm512x->supplies), in pcm512x_resume()
1768 pcm512x->supplies); in pcm512x_resume()
1774 regcache_cache_only(pcm512x->regmap, false); in pcm512x_resume()
1775 ret = regcache_sync(pcm512x->regmap); in pcm512x_resume()
1781 ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, in pcm512x_resume()