Lines Matching +full:vref +full:- +full:p +full:- +full:supply

1 // SPDX-License-Identifier: GPL-2.0-only
19 #include <sound/soc-dapm.h>
54 * We can't use the same notifier block for more than one supply and
65 regcache_mark_dirty(pcm512x->regmap); \
66 regcache_cache_only(pcm512x->regmap, true); \
229 ucontrol->value.integer.value[0] = pcm512x->overclock_pll; in pcm512x_overclock_pll_get()
244 return -EBUSY; in pcm512x_overclock_pll_put()
247 pcm512x->overclock_pll = ucontrol->value.integer.value[0]; in pcm512x_overclock_pll_put()
257 ucontrol->value.integer.value[0] = pcm512x->overclock_dsp; in pcm512x_overclock_dsp_get()
272 return -EBUSY; in pcm512x_overclock_dsp_put()
275 pcm512x->overclock_dsp = ucontrol->value.integer.value[0]; in pcm512x_overclock_dsp_put()
285 ucontrol->value.integer.value[0] = pcm512x->overclock_dac; in pcm512x_overclock_dac_get()
300 return -EBUSY; in pcm512x_overclock_dac_put()
303 pcm512x->overclock_dac = ucontrol->value.integer.value[0]; in pcm512x_overclock_dac_put()
307 static const DECLARE_TLV_DB_SCALE(digital_tlv, -10350, 50, 1);
308 static const DECLARE_TLV_DB_SCALE(analog_tlv, -600, 600, 0);
312 "FIR interpolation with de-emphasis",
313 "Low latency IIR with de-emphasis",
314 "High attenuation with de-emphasis",
316 "Ringing-less low latency FIR",
387 pcm512x->regmap, PCM512x_MUTE, PCM512x_RQML | PCM512x_RQMR, in pcm512x_update_mute()
388 (!!(pcm512x->mute & 0x5) << PCM512x_RQML_SHIFT) in pcm512x_update_mute()
389 | (!!(pcm512x->mute & 0x3) << PCM512x_RQMR_SHIFT)); in pcm512x_update_mute()
398 mutex_lock(&pcm512x->mutex); in pcm512x_digital_playback_switch_get()
399 ucontrol->value.integer.value[0] = !(pcm512x->mute & 0x4); in pcm512x_digital_playback_switch_get()
400 ucontrol->value.integer.value[1] = !(pcm512x->mute & 0x2); in pcm512x_digital_playback_switch_get()
401 mutex_unlock(&pcm512x->mutex); in pcm512x_digital_playback_switch_get()
413 mutex_lock(&pcm512x->mutex); in pcm512x_digital_playback_switch_put()
415 if ((pcm512x->mute & 0x4) == (ucontrol->value.integer.value[0] << 2)) { in pcm512x_digital_playback_switch_put()
416 pcm512x->mute ^= 0x4; in pcm512x_digital_playback_switch_put()
419 if ((pcm512x->mute & 0x2) == (ucontrol->value.integer.value[1] << 1)) { in pcm512x_digital_playback_switch_put()
420 pcm512x->mute ^= 0x2; in pcm512x_digital_playback_switch_put()
427 dev_err(component->dev, in pcm512x_digital_playback_switch_put()
429 mutex_unlock(&pcm512x->mutex); in pcm512x_digital_playback_switch_put()
434 mutex_unlock(&pcm512x->mutex); in pcm512x_digital_playback_switch_put()
500 return 25000000 + 25000000 * pcm512x->overclock_pll / 100; in pcm512x_pll_max()
505 return 50000000 + 50000000 * pcm512x->overclock_dsp / 100; in pcm512x_dsp_max()
511 return rate + rate * pcm512x->overclock_dac / 100; in pcm512x_dac_max()
516 if (!pcm512x->pll_out) in pcm512x_sck_max()
550 struct pcm512x_priv *pcm512x = rule->private; in pcm512x_hw_rule_rate()
574 return -EINVAL; in pcm512x_hw_rule_rate()
577 return snd_interval_ranges(hw_param_interval(params, rule->var), in pcm512x_hw_rule_rate()
584 struct snd_soc_component *component = dai->component; in pcm512x_dai_startup_master()
586 struct device *dev = dai->dev; in pcm512x_dai_startup_master()
590 if (IS_ERR(pcm512x->sclk)) { in pcm512x_dai_startup_master()
592 PTR_ERR(pcm512x->sclk)); in pcm512x_dai_startup_master()
593 return PTR_ERR(pcm512x->sclk); in pcm512x_dai_startup_master()
596 if (pcm512x->pll_out) in pcm512x_dai_startup_master()
597 return snd_pcm_hw_rule_add(substream->runtime, 0, in pcm512x_dai_startup_master()
602 SNDRV_PCM_HW_PARAM_CHANNELS, -1); in pcm512x_dai_startup_master()
607 return -ENOMEM; in pcm512x_dai_startup_master()
608 constraints_no_pll->nrats = 1; in pcm512x_dai_startup_master()
611 return -ENOMEM; in pcm512x_dai_startup_master()
612 constraints_no_pll->rats = rats_no_pll; in pcm512x_dai_startup_master()
613 rats_no_pll->num = clk_get_rate(pcm512x->sclk) / 64; in pcm512x_dai_startup_master()
614 rats_no_pll->den_min = 1; in pcm512x_dai_startup_master()
615 rats_no_pll->den_max = 128; in pcm512x_dai_startup_master()
616 rats_no_pll->den_step = 1; in pcm512x_dai_startup_master()
618 return snd_pcm_hw_constraint_ratnums(substream->runtime, 0, in pcm512x_dai_startup_master()
626 struct snd_soc_component *component = dai->component; in pcm512x_dai_startup_slave()
628 struct device *dev = dai->dev; in pcm512x_dai_startup_slave()
629 struct regmap *regmap = pcm512x->regmap; in pcm512x_dai_startup_slave()
631 if (IS_ERR(pcm512x->sclk)) { in pcm512x_dai_startup_slave()
633 PTR_ERR(pcm512x->sclk)); in pcm512x_dai_startup_slave()
644 return snd_pcm_hw_constraint_list(substream->runtime, 0, in pcm512x_dai_startup_slave()
652 struct snd_soc_component *component = dai->component; in pcm512x_dai_startup()
655 switch (pcm512x->fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { in pcm512x_dai_startup()
664 return -EINVAL; in pcm512x_dai_startup()
671 struct pcm512x_priv *pcm512x = dev_get_drvdata(component->dev); in pcm512x_set_bias_level()
680 ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, in pcm512x_set_bias_level()
683 dev_err(component->dev, "Failed to remove standby: %d\n", in pcm512x_set_bias_level()
690 ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, in pcm512x_set_bias_level()
693 dev_err(component->dev, "Failed to request standby: %d\n", in pcm512x_set_bias_level()
706 struct device *dev = dai->dev; in pcm512x_find_sck()
707 struct snd_soc_component *component = dai->component; in pcm512x_find_sck()
712 /* 64 MHz <= pll_rate <= 100 MHz, VREF mode */ in pcm512x_find_sck()
713 /* 16 MHz <= sck_rate <= 25 MHz, VREF mode */ in pcm512x_find_sck()
719 pow2 = 1 << fls((pcm512x_pll_max(pcm512x) - 16000000) / bclk_rate); in pcm512x_find_sck()
735 /* pll_rate = pllin_rate * R * J.D / P
739 * 1 <= P <= 15
742 * 1 MHz <= pllin_rate / P <= 20 MHz
744 * 6.667 MHz <= pllin_rate / P <= 20 MHz
752 struct device *dev = dai->dev; in pcm512x_find_pll_coeff()
753 struct snd_soc_component *component = dai->component; in pcm512x_find_pll_coeff()
756 int R, J, D, P; in pcm512x_find_pll_coeff() local
767 /* pllin_rate / P (or here, den) cannot be greater than 20 MHz */ in pcm512x_find_pll_coeff()
774 P = den; in pcm512x_find_pll_coeff()
776 && 1000000 <= pllin_rate / P && pllin_rate / P <= 20000000) { in pcm512x_find_pll_coeff()
780 for (R = 16; R; R--) { in pcm512x_find_pll_coeff()
787 dev_dbg(dev, "R * J / P = %d * %d / %d\n", R, J, P); in pcm512x_find_pll_coeff()
788 pcm512x->real_pll = pll_rate; in pcm512x_find_pll_coeff()
805 for (P = den; P <= 15; P++) { in pcm512x_find_pll_coeff()
806 if (pllin_rate / P < 6667000 || 200000000 < pllin_rate / P) in pcm512x_find_pll_coeff()
808 if (num * P % den) in pcm512x_find_pll_coeff()
810 K = num * P / den; in pcm512x_find_pll_coeff()
817 dev_dbg(dev, "J.D / P = %d.%04d / %d\n", J, D, P); in pcm512x_find_pll_coeff()
818 pcm512x->real_pll = pll_rate; in pcm512x_find_pll_coeff()
825 /* find smallest possible P */ in pcm512x_find_pll_coeff()
826 P = DIV_ROUND_UP(pllin_rate, 20000000); in pcm512x_find_pll_coeff()
827 if (!P) in pcm512x_find_pll_coeff()
828 P = 1; in pcm512x_find_pll_coeff()
829 else if (P > 15) { in pcm512x_find_pll_coeff()
830 dev_err(dev, "Need a slower clock as pll-input\n"); in pcm512x_find_pll_coeff()
831 return -EINVAL; in pcm512x_find_pll_coeff()
833 if (pllin_rate / P < 6667000) { in pcm512x_find_pll_coeff()
834 dev_err(dev, "Need a faster clock as pll-input\n"); in pcm512x_find_pll_coeff()
835 return -EINVAL; in pcm512x_find_pll_coeff()
837 K = DIV_ROUND_CLOSEST_ULL(10000ULL * pll_rate * P, pllin_rate); in pcm512x_find_pll_coeff()
845 dev_dbg(dev, "J.D / P ~ %d.%04d / %d\n", J, D, P); in pcm512x_find_pll_coeff()
846 pcm512x->real_pll = DIV_ROUND_DOWN_ULL((u64)K * pllin_rate, 10000 * P); in pcm512x_find_pll_coeff()
849 pcm512x->pll_r = R; in pcm512x_find_pll_coeff()
850 pcm512x->pll_j = J; in pcm512x_find_pll_coeff()
851 pcm512x->pll_d = D; in pcm512x_find_pll_coeff()
852 pcm512x->pll_p = P; in pcm512x_find_pll_coeff()
860 struct snd_soc_component *component = dai->component; in pcm512x_pllin_dac_rate()
864 if (!pcm512x->pll_out) in pcm512x_pllin_dac_rate()
873 dac_rate -= osr_rate) { in pcm512x_pllin_dac_rate()
881 dac_rate -= osr_rate; in pcm512x_pllin_dac_rate()
890 struct device *dev = dai->dev; in pcm512x_set_dividers()
891 struct snd_soc_component *component = dai->component; in pcm512x_set_dividers()
913 if (pcm512x->bclk_ratio > 0) { in pcm512x_set_dividers()
914 lrclk_div = pcm512x->bclk_ratio; in pcm512x_set_dividers()
920 return -EINVAL; in pcm512x_set_dividers()
924 if (!pcm512x->pll_out) { in pcm512x_set_dividers()
925 sck_rate = clk_get_rate(pcm512x->sclk); in pcm512x_set_dividers()
938 return -EINVAL; in pcm512x_set_dividers()
942 pllin_rate = clk_get_rate(pcm512x->sclk); in pcm512x_set_dividers()
946 return -EINVAL; in pcm512x_set_dividers()
953 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
954 PCM512x_PLL_COEFF_0, pcm512x->pll_p - 1); in pcm512x_set_dividers()
956 dev_err(dev, "Failed to write PLL P: %d\n", ret); in pcm512x_set_dividers()
960 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
961 PCM512x_PLL_COEFF_1, pcm512x->pll_j); in pcm512x_set_dividers()
967 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
968 PCM512x_PLL_COEFF_2, pcm512x->pll_d >> 8); in pcm512x_set_dividers()
974 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
975 PCM512x_PLL_COEFF_3, pcm512x->pll_d & 0xff); in pcm512x_set_dividers()
981 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
982 PCM512x_PLL_COEFF_4, pcm512x->pll_r - 1); in pcm512x_set_dividers()
988 mck_rate = pcm512x->real_pll; in pcm512x_set_dividers()
995 return -EINVAL; in pcm512x_set_dividers()
1013 ret = regmap_update_bits(pcm512x->regmap, PCM512x_DAC_REF, in pcm512x_set_dividers()
1016 dev_err(component->dev, in pcm512x_set_dividers()
1021 gpio = PCM512x_GREF_GPIO1 + pcm512x->pll_in - 1; in pcm512x_set_dividers()
1022 ret = regmap_update_bits(pcm512x->regmap, PCM512x_GPIO_DACIN, in pcm512x_set_dividers()
1025 dev_err(component->dev, in pcm512x_set_dividers()
1027 pcm512x->pll_in, ret); in pcm512x_set_dividers()
1038 for (; dac_mul; dac_mul--) { in pcm512x_set_dividers()
1044 return -EINVAL; in pcm512x_set_dividers()
1051 ret = regmap_update_bits(pcm512x->regmap, PCM512x_DAC_REF, in pcm512x_set_dividers()
1054 dev_err(component->dev, in pcm512x_set_dividers()
1065 return -EINVAL; in pcm512x_set_dividers()
1071 return -EINVAL; in pcm512x_set_dividers()
1082 return -EINVAL; in pcm512x_set_dividers()
1088 ret = regmap_write(pcm512x->regmap, PCM512x_DSP_CLKDIV, dsp_div - 1); in pcm512x_set_dividers()
1094 ret = regmap_write(pcm512x->regmap, PCM512x_DAC_CLKDIV, dac_div - 1); in pcm512x_set_dividers()
1100 ret = regmap_write(pcm512x->regmap, PCM512x_NCP_CLKDIV, ncp_div - 1); in pcm512x_set_dividers()
1106 ret = regmap_write(pcm512x->regmap, PCM512x_OSR_CLKDIV, osr_div - 1); in pcm512x_set_dividers()
1112 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
1113 PCM512x_MASTER_CLKDIV_1, bclk_div - 1); in pcm512x_set_dividers()
1119 ret = regmap_write(pcm512x->regmap, in pcm512x_set_dividers()
1120 PCM512x_MASTER_CLKDIV_2, lrclk_div - 1); in pcm512x_set_dividers()
1126 ret = regmap_write(pcm512x->regmap, PCM512x_IDAC_1, idac >> 8); in pcm512x_set_dividers()
1132 ret = regmap_write(pcm512x->regmap, PCM512x_IDAC_2, idac & 0xff); in pcm512x_set_dividers()
1146 ret = regmap_update_bits(pcm512x->regmap, PCM512x_FS_SPEED_MODE, in pcm512x_set_dividers()
1149 dev_err(component->dev, "Failed to set fs speed: %d\n", ret); in pcm512x_set_dividers()
1153 dev_dbg(component->dev, "DSP divider %d\n", dsp_div); in pcm512x_set_dividers()
1154 dev_dbg(component->dev, "DAC divider %d\n", dac_div); in pcm512x_set_dividers()
1155 dev_dbg(component->dev, "NCP divider %d\n", ncp_div); in pcm512x_set_dividers()
1156 dev_dbg(component->dev, "OSR divider %d\n", osr_div); in pcm512x_set_dividers()
1157 dev_dbg(component->dev, "BCK divider %d\n", bclk_div); in pcm512x_set_dividers()
1158 dev_dbg(component->dev, "LRCK divider %d\n", lrclk_div); in pcm512x_set_dividers()
1159 dev_dbg(component->dev, "IDAC %d\n", idac); in pcm512x_set_dividers()
1160 dev_dbg(component->dev, "1<<FSSP %d\n", 1 << fssp); in pcm512x_set_dividers()
1169 struct snd_soc_component *component = dai->component; in pcm512x_hw_params()
1175 dev_dbg(component->dev, "hw_params %u Hz, %u channels\n", in pcm512x_hw_params()
1193 dev_err(component->dev, "Bad frame size: %d\n", in pcm512x_hw_params()
1195 return -EINVAL; in pcm512x_hw_params()
1198 ret = regmap_update_bits(pcm512x->regmap, PCM512x_I2S_1, in pcm512x_hw_params()
1201 dev_err(component->dev, "Failed to set frame size: %d\n", ret); in pcm512x_hw_params()
1205 if ((pcm512x->fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) == in pcm512x_hw_params()
1207 ret = regmap_update_bits(pcm512x->regmap, PCM512x_ERROR_DETECT, in pcm512x_hw_params()
1210 dev_err(component->dev, in pcm512x_hw_params()
1218 if (pcm512x->pll_out) { in pcm512x_hw_params()
1219 ret = regmap_write(pcm512x->regmap, PCM512x_FLEX_A, 0x11); in pcm512x_hw_params()
1221 dev_err(component->dev, "Failed to set FLEX_A: %d\n", ret); in pcm512x_hw_params()
1225 ret = regmap_write(pcm512x->regmap, PCM512x_FLEX_B, 0xff); in pcm512x_hw_params()
1227 dev_err(component->dev, "Failed to set FLEX_B: %d\n", ret); in pcm512x_hw_params()
1231 ret = regmap_update_bits(pcm512x->regmap, PCM512x_ERROR_DETECT, in pcm512x_hw_params()
1240 dev_err(component->dev, in pcm512x_hw_params()
1241 "Failed to ignore auto-clock failures: %d\n", in pcm512x_hw_params()
1246 ret = regmap_update_bits(pcm512x->regmap, PCM512x_ERROR_DETECT, in pcm512x_hw_params()
1255 dev_err(component->dev, in pcm512x_hw_params()
1256 "Failed to ignore auto-clock failures: %d\n", in pcm512x_hw_params()
1261 ret = regmap_update_bits(pcm512x->regmap, PCM512x_PLL_EN, in pcm512x_hw_params()
1264 dev_err(component->dev, "Failed to disable pll: %d\n", ret); in pcm512x_hw_params()
1273 if (pcm512x->pll_out) { in pcm512x_hw_params()
1274 ret = regmap_update_bits(pcm512x->regmap, PCM512x_PLL_REF, in pcm512x_hw_params()
1277 dev_err(component->dev, in pcm512x_hw_params()
1282 gpio = PCM512x_GREF_GPIO1 + pcm512x->pll_in - 1; in pcm512x_hw_params()
1283 ret = regmap_update_bits(pcm512x->regmap, PCM512x_GPIO_PLLIN, in pcm512x_hw_params()
1286 dev_err(component->dev, in pcm512x_hw_params()
1288 pcm512x->pll_in, ret); in pcm512x_hw_params()
1292 ret = regmap_update_bits(pcm512x->regmap, PCM512x_PLL_EN, in pcm512x_hw_params()
1295 dev_err(component->dev, "Failed to enable pll: %d\n", ret); in pcm512x_hw_params()
1299 gpio = PCM512x_G1OE << (pcm512x->pll_out - 1); in pcm512x_hw_params()
1300 ret = regmap_update_bits(pcm512x->regmap, PCM512x_GPIO_EN, in pcm512x_hw_params()
1303 dev_err(component->dev, "Failed to enable gpio %d: %d\n", in pcm512x_hw_params()
1304 pcm512x->pll_out, ret); in pcm512x_hw_params()
1308 gpio = PCM512x_GPIO_OUTPUT_1 + pcm512x->pll_out - 1; in pcm512x_hw_params()
1309 ret = regmap_update_bits(pcm512x->regmap, gpio, in pcm512x_hw_params()
1312 dev_err(component->dev, "Failed to output pll on %d: %d\n", in pcm512x_hw_params()
1313 ret, pcm512x->pll_out); in pcm512x_hw_params()
1318 ret = regmap_update_bits(pcm512x->regmap, PCM512x_SYNCHRONIZE, in pcm512x_hw_params()
1321 dev_err(component->dev, "Failed to halt clocks: %d\n", ret); in pcm512x_hw_params()
1325 ret = regmap_update_bits(pcm512x->regmap, PCM512x_SYNCHRONIZE, in pcm512x_hw_params()
1328 dev_err(component->dev, "Failed to resume clocks: %d\n", ret); in pcm512x_hw_params()
1338 struct snd_soc_component *component = dai->component; in pcm512x_set_fmt()
1360 return -EINVAL; in pcm512x_set_fmt()
1363 ret = regmap_update_bits(pcm512x->regmap, PCM512x_BCLK_LRCLK_CFG, in pcm512x_set_fmt()
1367 dev_err(component->dev, "Failed to enable clock output: %d\n", ret); in pcm512x_set_fmt()
1371 ret = regmap_update_bits(pcm512x->regmap, PCM512x_MASTER_MODE, in pcm512x_set_fmt()
1375 dev_err(component->dev, "Failed to enable provider mode: %d\n", ret); in pcm512x_set_fmt()
1396 dev_err(component->dev, "unsupported DAI format: 0x%x\n", in pcm512x_set_fmt()
1397 pcm512x->fmt); in pcm512x_set_fmt()
1398 return -EINVAL; in pcm512x_set_fmt()
1401 ret = regmap_update_bits(pcm512x->regmap, PCM512x_I2S_1, in pcm512x_set_fmt()
1404 dev_err(component->dev, "Failed to set data format: %d\n", ret); in pcm512x_set_fmt()
1408 ret = regmap_update_bits(pcm512x->regmap, PCM512x_I2S_2, in pcm512x_set_fmt()
1411 dev_err(component->dev, "Failed to set data offset: %d\n", ret); in pcm512x_set_fmt()
1415 pcm512x->fmt = fmt; in pcm512x_set_fmt()
1422 struct snd_soc_component *component = dai->component; in pcm512x_set_bclk_ratio()
1426 return -EINVAL; in pcm512x_set_bclk_ratio()
1428 pcm512x->bclk_ratio = ratio; in pcm512x_set_bclk_ratio()
1435 struct snd_soc_component *component = dai->component; in pcm512x_mute()
1440 mutex_lock(&pcm512x->mutex); in pcm512x_mute()
1443 pcm512x->mute |= 0x1; in pcm512x_mute()
1444 ret = regmap_update_bits(pcm512x->regmap, PCM512x_MUTE, in pcm512x_mute()
1448 dev_err(component->dev, in pcm512x_mute()
1453 regmap_read_poll_timeout(pcm512x->regmap, in pcm512x_mute()
1458 pcm512x->mute &= ~0x1; in pcm512x_mute()
1461 dev_err(component->dev, in pcm512x_mute()
1466 regmap_read_poll_timeout(pcm512x->regmap, in pcm512x_mute()
1470 == ((~pcm512x->mute >> 1) & 0x3), in pcm512x_mute()
1475 mutex_unlock(&pcm512x->mutex); in pcm512x_mute()
1490 .name = "pcm512x-hifi",
1549 return -ENOMEM; in pcm512x_probe()
1551 mutex_init(&pcm512x->mutex); in pcm512x_probe()
1554 pcm512x->regmap = regmap; in pcm512x_probe()
1556 for (i = 0; i < ARRAY_SIZE(pcm512x->supplies); i++) in pcm512x_probe()
1557 pcm512x->supplies[i].supply = pcm512x_supply_names[i]; in pcm512x_probe()
1559 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(pcm512x->supplies), in pcm512x_probe()
1560 pcm512x->supplies); in pcm512x_probe()
1566 pcm512x->supply_nb[0].notifier_call = pcm512x_regulator_event_0; in pcm512x_probe()
1567 pcm512x->supply_nb[1].notifier_call = pcm512x_regulator_event_1; in pcm512x_probe()
1568 pcm512x->supply_nb[2].notifier_call = pcm512x_regulator_event_2; in pcm512x_probe()
1570 for (i = 0; i < ARRAY_SIZE(pcm512x->supplies); i++) { in pcm512x_probe()
1572 pcm512x->supplies[i].consumer, in pcm512x_probe()
1573 &pcm512x->supply_nb[i]); in pcm512x_probe()
1581 ret = regulator_bulk_enable(ARRAY_SIZE(pcm512x->supplies), in pcm512x_probe()
1582 pcm512x->supplies); in pcm512x_probe()
1602 pcm512x->sclk = devm_clk_get(dev, NULL); in pcm512x_probe()
1603 if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER) { in pcm512x_probe()
1604 ret = -EPROBE_DEFER; in pcm512x_probe()
1607 if (!IS_ERR(pcm512x->sclk)) { in pcm512x_probe()
1608 ret = clk_prepare_enable(pcm512x->sclk); in pcm512x_probe()
1616 ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, in pcm512x_probe()
1629 if (dev->of_node) { in pcm512x_probe()
1630 const struct device_node *np = dev->of_node; in pcm512x_probe()
1633 if (of_property_read_u32(np, "pll-in", &val) >= 0) { in pcm512x_probe()
1635 dev_err(dev, "Invalid pll-in\n"); in pcm512x_probe()
1636 ret = -EINVAL; in pcm512x_probe()
1639 pcm512x->pll_in = val; in pcm512x_probe()
1642 if (of_property_read_u32(np, "pll-out", &val) >= 0) { in pcm512x_probe()
1644 dev_err(dev, "Invalid pll-out\n"); in pcm512x_probe()
1645 ret = -EINVAL; in pcm512x_probe()
1648 pcm512x->pll_out = val; in pcm512x_probe()
1651 if (!pcm512x->pll_in != !pcm512x->pll_out) { in pcm512x_probe()
1653 "Error: both pll-in and pll-out, or none\n"); in pcm512x_probe()
1654 ret = -EINVAL; in pcm512x_probe()
1657 if (pcm512x->pll_in && pcm512x->pll_in == pcm512x->pll_out) { in pcm512x_probe()
1658 dev_err(dev, "Error: pll-in == pll-out\n"); in pcm512x_probe()
1659 ret = -EINVAL; in pcm512x_probe()
1677 if (!IS_ERR(pcm512x->sclk)) in pcm512x_probe()
1678 clk_disable_unprepare(pcm512x->sclk); in pcm512x_probe()
1680 regulator_bulk_disable(ARRAY_SIZE(pcm512x->supplies), in pcm512x_probe()
1681 pcm512x->supplies); in pcm512x_probe()
1691 if (!IS_ERR(pcm512x->sclk)) in pcm512x_remove()
1692 clk_disable_unprepare(pcm512x->sclk); in pcm512x_remove()
1693 regulator_bulk_disable(ARRAY_SIZE(pcm512x->supplies), in pcm512x_remove()
1694 pcm512x->supplies); in pcm512x_remove()
1704 ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, in pcm512x_suspend()
1711 ret = regulator_bulk_disable(ARRAY_SIZE(pcm512x->supplies), in pcm512x_suspend()
1712 pcm512x->supplies); in pcm512x_suspend()
1718 if (!IS_ERR(pcm512x->sclk)) in pcm512x_suspend()
1719 clk_disable_unprepare(pcm512x->sclk); in pcm512x_suspend()
1729 if (!IS_ERR(pcm512x->sclk)) { in pcm512x_resume()
1730 ret = clk_prepare_enable(pcm512x->sclk); in pcm512x_resume()
1737 ret = regulator_bulk_enable(ARRAY_SIZE(pcm512x->supplies), in pcm512x_resume()
1738 pcm512x->supplies); in pcm512x_resume()
1744 regcache_cache_only(pcm512x->regmap, false); in pcm512x_resume()
1745 ret = regcache_sync(pcm512x->regmap); in pcm512x_resume()
1751 ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, in pcm512x_resume()