Lines Matching refs:max98927
141 struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); in max98927_dai_set_fmt() local
151 max98927->provider = false; in max98927_dai_set_fmt()
155 max98927->provider = true; in max98927_dai_set_fmt()
163 regmap_update_bits(max98927->regmap, MAX98927_R0021_PCM_MASTER_MODE, in max98927_dai_set_fmt()
177 regmap_update_bits(max98927->regmap, MAX98927_R0020_PCM_MODE_CFG, in max98927_dai_set_fmt()
200 max98927->iface = fmt & SND_SOC_DAIFMT_FORMAT_MASK; in max98927_dai_set_fmt()
204 regmap_update_bits(max98927->regmap, MAX98927_R0018_PCM_RX_EN_A, in max98927_dai_set_fmt()
208 regmap_update_bits(max98927->regmap, in max98927_dai_set_fmt()
213 regmap_update_bits(max98927->regmap, MAX98927_R003B_SPK_SRC_SEL, in max98927_dai_set_fmt()
216 regmap_update_bits(max98927->regmap, MAX98927_R0035_PDM_RX_CTRL, in max98927_dai_set_fmt()
220 regmap_update_bits(max98927->regmap, MAX98927_R0035_PDM_RX_CTRL, in max98927_dai_set_fmt()
223 regmap_update_bits(max98927->regmap, MAX98927_R003B_SPK_SRC_SEL, in max98927_dai_set_fmt()
226 regmap_update_bits(max98927->regmap, MAX98927_R0018_PCM_RX_EN_A, in max98927_dai_set_fmt()
255 static int max98927_set_clock(struct max98927_priv *max98927, in max98927_set_clock() argument
258 struct snd_soc_component *component = max98927->component; in max98927_set_clock()
260 int blr_clk_ratio = params_channels(params) * max98927->ch_size; in max98927_set_clock()
263 if (max98927->provider) { in max98927_set_clock()
267 if (rate_table[i] >= max98927->sysclk) in max98927_set_clock()
274 regmap_update_bits(max98927->regmap, in max98927_set_clock()
280 if (!max98927->tdm_mode) { in max98927_set_clock()
289 regmap_update_bits(max98927->regmap, in max98927_set_clock()
301 struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); in max98927_dai_hw_params() local
322 max98927->ch_size = snd_pcm_format_width(params_format(params)); in max98927_dai_hw_params()
324 regmap_update_bits(max98927->regmap, MAX98927_R0020_PCM_MODE_CFG, in max98927_dai_hw_params()
365 regmap_update_bits(max98927->regmap, MAX98927_R0023_PCM_SR_SETUP1, in max98927_dai_hw_params()
367 regmap_update_bits(max98927->regmap, MAX98927_R0024_PCM_SR_SETUP2, in max98927_dai_hw_params()
372 if (max98927->interleave_mode && in max98927_dai_hw_params()
374 regmap_update_bits(max98927->regmap, in max98927_dai_hw_params()
379 regmap_update_bits(max98927->regmap, in max98927_dai_hw_params()
383 return max98927_set_clock(max98927, params); in max98927_dai_hw_params()
393 struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); in max98927_dai_tdm_slot() local
397 max98927->tdm_mode = true; in max98927_dai_tdm_slot()
407 regmap_update_bits(max98927->regmap, MAX98927_R0022_PCM_CLK_SETUP, in max98927_dai_tdm_slot()
427 regmap_update_bits(max98927->regmap, MAX98927_R0020_PCM_MODE_CFG, in max98927_dai_tdm_slot()
431 regmap_write(max98927->regmap, MAX98927_R0018_PCM_RX_EN_A, in max98927_dai_tdm_slot()
433 regmap_write(max98927->regmap, MAX98927_R0019_PCM_RX_EN_B, in max98927_dai_tdm_slot()
437 regmap_write(max98927->regmap, MAX98927_R001A_PCM_TX_EN_A, in max98927_dai_tdm_slot()
439 regmap_write(max98927->regmap, MAX98927_R001B_PCM_TX_EN_B, in max98927_dai_tdm_slot()
443 regmap_write(max98927->regmap, MAX98927_R001C_PCM_TX_HIZ_CTRL_A, in max98927_dai_tdm_slot()
445 regmap_write(max98927->regmap, MAX98927_R001D_PCM_TX_HIZ_CTRL_B, in max98927_dai_tdm_slot()
460 struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); in max98927_dai_set_sysclk() local
462 max98927->sysclk = freq; in max98927_dai_set_sysclk()
477 struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); in max98927_dac_event() local
481 max98927->tdm_mode = false; in max98927_dac_event()
484 regmap_update_bits(max98927->regmap, MAX98927_R003A_AMP_EN, in max98927_dac_event()
486 regmap_update_bits(max98927->regmap, MAX98927_R00FF_GLOBAL_SHDN, in max98927_dac_event()
490 regmap_update_bits(max98927->regmap, MAX98927_R00FF_GLOBAL_SHDN, in max98927_dac_event()
492 regmap_update_bits(max98927->regmap, MAX98927_R003A_AMP_EN, in max98927_dac_event()
650 struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); in max98927_probe() local
652 max98927->component = component; in max98927_probe()
655 regmap_write(max98927->regmap, MAX98927_R0100_SOFT_RESET, in max98927_probe()
659 regmap_write(max98927->regmap, MAX98927_R001C_PCM_TX_HIZ_CTRL_A, 0xFF); in max98927_probe()
660 regmap_write(max98927->regmap, MAX98927_R001D_PCM_TX_HIZ_CTRL_B, 0xFF); in max98927_probe()
661 regmap_write(max98927->regmap, MAX98927_R0025_PCM_TO_SPK_MONOMIX_A, in max98927_probe()
663 regmap_write(max98927->regmap, MAX98927_R0026_PCM_TO_SPK_MONOMIX_B, in max98927_probe()
666 regmap_write(max98927->regmap, MAX98927_R0036_AMP_VOL_CTRL, 0x38); in max98927_probe()
667 regmap_write(max98927->regmap, MAX98927_R003C_SPK_GAIN, 0x05); in max98927_probe()
669 regmap_write(max98927->regmap, MAX98927_R0037_AMP_DSP_CFG, 0x03); in max98927_probe()
671 regmap_write(max98927->regmap, MAX98927_R003F_MEAS_DSP_CFG, 0xF7); in max98927_probe()
673 regmap_write(max98927->regmap, MAX98927_R0040_BOOST_CTRL0, 0x1C); in max98927_probe()
674 regmap_write(max98927->regmap, MAX98927_R0042_BOOST_CTRL1, 0x3E); in max98927_probe()
676 regmap_write(max98927->regmap, MAX98927_R0043_MEAS_ADC_CFG, 0x04); in max98927_probe()
677 regmap_write(max98927->regmap, MAX98927_R0044_MEAS_ADC_BASE_MSB, 0x00); in max98927_probe()
678 regmap_write(max98927->regmap, MAX98927_R0045_MEAS_ADC_BASE_LSB, 0x24); in max98927_probe()
680 regmap_write(max98927->regmap, MAX98927_R007F_BROWNOUT_LVL4_AMP1_CTRL1, in max98927_probe()
683 regmap_write(max98927->regmap, MAX98927_R0082_ENV_TRACK_VOUT_HEADROOM, in max98927_probe()
685 regmap_write(max98927->regmap, MAX98927_R0086_ENV_TRACK_CTRL, 0x01); in max98927_probe()
686 regmap_write(max98927->regmap, MAX98927_R0087_ENV_TRACK_BOOST_VOUT_READ, in max98927_probe()
690 regmap_write(max98927->regmap, MAX98927_R001E_PCM_TX_CH_SRC_A, in max98927_probe()
691 (max98927->i_l_slot << MAX98927_PCM_TX_CH_SRC_A_I_SHIFT | max98927->v_l_slot) & 0xFF); in max98927_probe()
693 if (max98927->v_l_slot < 8) { in max98927_probe()
694 regmap_update_bits(max98927->regmap, in max98927_probe()
696 1 << max98927->v_l_slot, 0); in max98927_probe()
697 regmap_update_bits(max98927->regmap, MAX98927_R001A_PCM_TX_EN_A, in max98927_probe()
698 1 << max98927->v_l_slot, in max98927_probe()
699 1 << max98927->v_l_slot); in max98927_probe()
701 regmap_update_bits(max98927->regmap, in max98927_probe()
703 1 << (max98927->v_l_slot - 8), 0); in max98927_probe()
704 regmap_update_bits(max98927->regmap, MAX98927_R001B_PCM_TX_EN_B, in max98927_probe()
705 1 << (max98927->v_l_slot - 8), in max98927_probe()
706 1 << (max98927->v_l_slot - 8)); in max98927_probe()
709 if (max98927->i_l_slot < 8) { in max98927_probe()
710 regmap_update_bits(max98927->regmap, in max98927_probe()
712 1 << max98927->i_l_slot, 0); in max98927_probe()
713 regmap_update_bits(max98927->regmap, MAX98927_R001A_PCM_TX_EN_A, in max98927_probe()
714 1 << max98927->i_l_slot, in max98927_probe()
715 1 << max98927->i_l_slot); in max98927_probe()
717 regmap_update_bits(max98927->regmap, in max98927_probe()
719 1 << (max98927->i_l_slot - 8), 0); in max98927_probe()
720 regmap_update_bits(max98927->regmap, MAX98927_R001B_PCM_TX_EN_B, in max98927_probe()
721 1 << (max98927->i_l_slot - 8), in max98927_probe()
722 1 << (max98927->i_l_slot - 8)); in max98927_probe()
726 if (max98927->interleave_mode) in max98927_probe()
727 regmap_update_bits(max98927->regmap, in max98927_probe()
737 struct max98927_priv *max98927 = dev_get_drvdata(dev); in max98927_suspend() local
739 regcache_cache_only(max98927->regmap, true); in max98927_suspend()
740 regcache_mark_dirty(max98927->regmap); in max98927_suspend()
745 struct max98927_priv *max98927 = dev_get_drvdata(dev); in max98927_resume() local
747 regmap_write(max98927->regmap, MAX98927_R0100_SOFT_RESET, in max98927_resume()
749 regcache_cache_only(max98927->regmap, false); in max98927_resume()
750 regcache_sync(max98927->regmap); in max98927_resume()
784 struct max98927_priv *max98927) in max98927_slot_config() argument
790 max98927->v_l_slot = value & 0xF; in max98927_slot_config()
792 max98927->v_l_slot = 0; in max98927_slot_config()
795 max98927->i_l_slot = value & 0xF; in max98927_slot_config()
797 max98927->i_l_slot = 1; in max98927_slot_config()
805 struct max98927_priv *max98927 = NULL; in max98927_i2c_probe() local
807 max98927 = devm_kzalloc(&i2c->dev, sizeof(*max98927), GFP_KERNEL); in max98927_i2c_probe()
808 if (!max98927) { in max98927_i2c_probe()
812 i2c_set_clientdata(i2c, max98927); in max98927_i2c_probe()
816 max98927->interleave_mode = true; in max98927_i2c_probe()
821 max98927->interleave_mode = true; in max98927_i2c_probe()
825 max98927->regmap in max98927_i2c_probe()
827 if (IS_ERR(max98927->regmap)) { in max98927_i2c_probe()
828 ret = PTR_ERR(max98927->regmap); in max98927_i2c_probe()
834 max98927->reset_gpio = devm_gpiod_get_optional(&i2c->dev, "reset", in max98927_i2c_probe()
836 if (IS_ERR(max98927->reset_gpio)) { in max98927_i2c_probe()
837 ret = PTR_ERR(max98927->reset_gpio); in max98927_i2c_probe()
841 if (max98927->reset_gpio) { in max98927_i2c_probe()
842 gpiod_set_value_cansleep(max98927->reset_gpio, 0); in max98927_i2c_probe()
848 ret = regmap_read(max98927->regmap, MAX98927_R01FF_REV_ID, ®); in max98927_i2c_probe()
857 max98927_slot_config(i2c, max98927); in max98927_i2c_probe()
871 struct max98927_priv *max98927 = i2c_get_clientdata(i2c); in max98927_i2c_remove() local
873 if (max98927->reset_gpio) in max98927_i2c_remove()
874 gpiod_set_value_cansleep(max98927->reset_gpio, 1); in max98927_i2c_remove()