Lines Matching refs:max98927
143 struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); in max98927_dai_set_fmt() local
153 max98927->provider = false; in max98927_dai_set_fmt()
157 max98927->provider = true; in max98927_dai_set_fmt()
165 regmap_update_bits(max98927->regmap, MAX98927_R0021_PCM_MASTER_MODE, in max98927_dai_set_fmt()
179 regmap_update_bits(max98927->regmap, MAX98927_R0020_PCM_MODE_CFG, in max98927_dai_set_fmt()
202 max98927->iface = fmt & SND_SOC_DAIFMT_FORMAT_MASK; in max98927_dai_set_fmt()
206 regmap_update_bits(max98927->regmap, MAX98927_R0018_PCM_RX_EN_A, in max98927_dai_set_fmt()
210 regmap_update_bits(max98927->regmap, in max98927_dai_set_fmt()
215 regmap_update_bits(max98927->regmap, MAX98927_R003B_SPK_SRC_SEL, in max98927_dai_set_fmt()
218 regmap_update_bits(max98927->regmap, MAX98927_R0035_PDM_RX_CTRL, in max98927_dai_set_fmt()
222 regmap_update_bits(max98927->regmap, MAX98927_R0035_PDM_RX_CTRL, in max98927_dai_set_fmt()
225 regmap_update_bits(max98927->regmap, MAX98927_R003B_SPK_SRC_SEL, in max98927_dai_set_fmt()
228 regmap_update_bits(max98927->regmap, MAX98927_R0018_PCM_RX_EN_A, in max98927_dai_set_fmt()
257 static int max98927_set_clock(struct max98927_priv *max98927, in max98927_set_clock() argument
260 struct snd_soc_component *component = max98927->component; in max98927_set_clock()
262 int blr_clk_ratio = params_channels(params) * max98927->ch_size; in max98927_set_clock()
265 if (max98927->provider) { in max98927_set_clock()
269 if (rate_table[i] >= max98927->sysclk) in max98927_set_clock()
276 regmap_update_bits(max98927->regmap, in max98927_set_clock()
282 if (!max98927->tdm_mode) { in max98927_set_clock()
291 regmap_update_bits(max98927->regmap, in max98927_set_clock()
303 struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); in max98927_dai_hw_params() local
324 max98927->ch_size = snd_pcm_format_width(params_format(params)); in max98927_dai_hw_params()
326 regmap_update_bits(max98927->regmap, MAX98927_R0020_PCM_MODE_CFG, in max98927_dai_hw_params()
367 regmap_update_bits(max98927->regmap, MAX98927_R0023_PCM_SR_SETUP1, in max98927_dai_hw_params()
369 regmap_update_bits(max98927->regmap, MAX98927_R0024_PCM_SR_SETUP2, in max98927_dai_hw_params()
374 if (max98927->interleave_mode && in max98927_dai_hw_params()
376 regmap_update_bits(max98927->regmap, in max98927_dai_hw_params()
381 regmap_update_bits(max98927->regmap, in max98927_dai_hw_params()
385 return max98927_set_clock(max98927, params); in max98927_dai_hw_params()
395 struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); in max98927_dai_tdm_slot() local
399 max98927->tdm_mode = true; in max98927_dai_tdm_slot()
409 regmap_update_bits(max98927->regmap, MAX98927_R0022_PCM_CLK_SETUP, in max98927_dai_tdm_slot()
429 regmap_update_bits(max98927->regmap, MAX98927_R0020_PCM_MODE_CFG, in max98927_dai_tdm_slot()
433 regmap_write(max98927->regmap, MAX98927_R0018_PCM_RX_EN_A, in max98927_dai_tdm_slot()
435 regmap_write(max98927->regmap, MAX98927_R0019_PCM_RX_EN_B, in max98927_dai_tdm_slot()
439 regmap_write(max98927->regmap, MAX98927_R001A_PCM_TX_EN_A, in max98927_dai_tdm_slot()
441 regmap_write(max98927->regmap, MAX98927_R001B_PCM_TX_EN_B, in max98927_dai_tdm_slot()
445 regmap_write(max98927->regmap, MAX98927_R001C_PCM_TX_HIZ_CTRL_A, in max98927_dai_tdm_slot()
447 regmap_write(max98927->regmap, MAX98927_R001D_PCM_TX_HIZ_CTRL_B, in max98927_dai_tdm_slot()
462 struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); in max98927_dai_set_sysclk() local
464 max98927->sysclk = freq; in max98927_dai_set_sysclk()
479 struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); in max98927_dac_event() local
483 max98927->tdm_mode = false; in max98927_dac_event()
486 regmap_update_bits(max98927->regmap, MAX98927_R003A_AMP_EN, in max98927_dac_event()
488 regmap_update_bits(max98927->regmap, MAX98927_R00FF_GLOBAL_SHDN, in max98927_dac_event()
492 regmap_update_bits(max98927->regmap, MAX98927_R00FF_GLOBAL_SHDN, in max98927_dac_event()
494 regmap_update_bits(max98927->regmap, MAX98927_R003A_AMP_EN, in max98927_dac_event()
652 struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); in max98927_probe() local
654 max98927->component = component; in max98927_probe()
657 regmap_write(max98927->regmap, MAX98927_R0100_SOFT_RESET, in max98927_probe()
661 regmap_write(max98927->regmap, MAX98927_R001C_PCM_TX_HIZ_CTRL_A, 0xFF); in max98927_probe()
662 regmap_write(max98927->regmap, MAX98927_R001D_PCM_TX_HIZ_CTRL_B, 0xFF); in max98927_probe()
663 regmap_write(max98927->regmap, MAX98927_R0025_PCM_TO_SPK_MONOMIX_A, in max98927_probe()
665 regmap_write(max98927->regmap, MAX98927_R0026_PCM_TO_SPK_MONOMIX_B, in max98927_probe()
668 regmap_write(max98927->regmap, MAX98927_R0036_AMP_VOL_CTRL, 0x38); in max98927_probe()
669 regmap_write(max98927->regmap, MAX98927_R003C_SPK_GAIN, 0x05); in max98927_probe()
671 regmap_write(max98927->regmap, MAX98927_R0037_AMP_DSP_CFG, 0x03); in max98927_probe()
673 regmap_write(max98927->regmap, MAX98927_R003F_MEAS_DSP_CFG, 0xF7); in max98927_probe()
675 regmap_write(max98927->regmap, MAX98927_R0040_BOOST_CTRL0, 0x1C); in max98927_probe()
676 regmap_write(max98927->regmap, MAX98927_R0042_BOOST_CTRL1, 0x3E); in max98927_probe()
678 regmap_write(max98927->regmap, MAX98927_R0043_MEAS_ADC_CFG, 0x04); in max98927_probe()
679 regmap_write(max98927->regmap, MAX98927_R0044_MEAS_ADC_BASE_MSB, 0x00); in max98927_probe()
680 regmap_write(max98927->regmap, MAX98927_R0045_MEAS_ADC_BASE_LSB, 0x24); in max98927_probe()
682 regmap_write(max98927->regmap, MAX98927_R007F_BROWNOUT_LVL4_AMP1_CTRL1, in max98927_probe()
685 regmap_write(max98927->regmap, MAX98927_R0082_ENV_TRACK_VOUT_HEADROOM, in max98927_probe()
687 regmap_write(max98927->regmap, MAX98927_R0086_ENV_TRACK_CTRL, 0x01); in max98927_probe()
688 regmap_write(max98927->regmap, MAX98927_R0087_ENV_TRACK_BOOST_VOUT_READ, in max98927_probe()
692 regmap_write(max98927->regmap, MAX98927_R001E_PCM_TX_CH_SRC_A, in max98927_probe()
693 (max98927->i_l_slot << MAX98927_PCM_TX_CH_SRC_A_I_SHIFT | max98927->v_l_slot) & 0xFF); in max98927_probe()
695 if (max98927->v_l_slot < 8) { in max98927_probe()
696 regmap_update_bits(max98927->regmap, in max98927_probe()
698 1 << max98927->v_l_slot, 0); in max98927_probe()
699 regmap_update_bits(max98927->regmap, MAX98927_R001A_PCM_TX_EN_A, in max98927_probe()
700 1 << max98927->v_l_slot, in max98927_probe()
701 1 << max98927->v_l_slot); in max98927_probe()
703 regmap_update_bits(max98927->regmap, in max98927_probe()
705 1 << (max98927->v_l_slot - 8), 0); in max98927_probe()
706 regmap_update_bits(max98927->regmap, MAX98927_R001B_PCM_TX_EN_B, in max98927_probe()
707 1 << (max98927->v_l_slot - 8), in max98927_probe()
708 1 << (max98927->v_l_slot - 8)); in max98927_probe()
711 if (max98927->i_l_slot < 8) { in max98927_probe()
712 regmap_update_bits(max98927->regmap, in max98927_probe()
714 1 << max98927->i_l_slot, 0); in max98927_probe()
715 regmap_update_bits(max98927->regmap, MAX98927_R001A_PCM_TX_EN_A, in max98927_probe()
716 1 << max98927->i_l_slot, in max98927_probe()
717 1 << max98927->i_l_slot); in max98927_probe()
719 regmap_update_bits(max98927->regmap, in max98927_probe()
721 1 << (max98927->i_l_slot - 8), 0); in max98927_probe()
722 regmap_update_bits(max98927->regmap, MAX98927_R001B_PCM_TX_EN_B, in max98927_probe()
723 1 << (max98927->i_l_slot - 8), in max98927_probe()
724 1 << (max98927->i_l_slot - 8)); in max98927_probe()
728 if (max98927->interleave_mode) in max98927_probe()
729 regmap_update_bits(max98927->regmap, in max98927_probe()
739 struct max98927_priv *max98927 = dev_get_drvdata(dev); in max98927_suspend() local
741 regcache_cache_only(max98927->regmap, true); in max98927_suspend()
742 regcache_mark_dirty(max98927->regmap); in max98927_suspend()
747 struct max98927_priv *max98927 = dev_get_drvdata(dev); in max98927_resume() local
749 regmap_write(max98927->regmap, MAX98927_R0100_SOFT_RESET, in max98927_resume()
751 regcache_cache_only(max98927->regmap, false); in max98927_resume()
752 regcache_sync(max98927->regmap); in max98927_resume()
786 struct max98927_priv *max98927) in max98927_slot_config() argument
792 max98927->v_l_slot = value & 0xF; in max98927_slot_config()
794 max98927->v_l_slot = 0; in max98927_slot_config()
797 max98927->i_l_slot = value & 0xF; in max98927_slot_config()
799 max98927->i_l_slot = 1; in max98927_slot_config()
807 struct max98927_priv *max98927 = NULL; in max98927_i2c_probe() local
809 max98927 = devm_kzalloc(&i2c->dev, sizeof(*max98927), GFP_KERNEL); in max98927_i2c_probe()
810 if (!max98927) { in max98927_i2c_probe()
814 i2c_set_clientdata(i2c, max98927); in max98927_i2c_probe()
818 max98927->interleave_mode = true; in max98927_i2c_probe()
823 max98927->interleave_mode = true; in max98927_i2c_probe()
827 max98927->regmap in max98927_i2c_probe()
829 if (IS_ERR(max98927->regmap)) { in max98927_i2c_probe()
830 ret = PTR_ERR(max98927->regmap); in max98927_i2c_probe()
836 max98927->reset_gpio = devm_gpiod_get_optional(&i2c->dev, "reset", in max98927_i2c_probe()
838 if (IS_ERR(max98927->reset_gpio)) { in max98927_i2c_probe()
839 ret = PTR_ERR(max98927->reset_gpio); in max98927_i2c_probe()
843 if (max98927->reset_gpio) { in max98927_i2c_probe()
844 gpiod_set_value_cansleep(max98927->reset_gpio, 0); in max98927_i2c_probe()
850 ret = regmap_read(max98927->regmap, MAX98927_R01FF_REV_ID, ®); in max98927_i2c_probe()
859 max98927_slot_config(i2c, max98927); in max98927_i2c_probe()
873 struct max98927_priv *max98927 = i2c_get_clientdata(i2c); in max98927_i2c_remove() local
875 if (max98927->reset_gpio) in max98927_i2c_remove()
876 gpiod_set_value_cansleep(max98927->reset_gpio, 1); in max98927_i2c_remove()