Lines Matching full:max98390

3  * max98390.c  --  MAX98390 ALSA Soc Audio driver
25 #include "max98390.h"
167 struct max98390_priv *max98390 = in max98390_dai_set_fmt() local
180 max98390->provider = true; in max98390_dai_set_fmt()
188 regmap_update_bits(max98390->regmap, in max98390_dai_set_fmt()
204 regmap_update_bits(max98390->regmap, in max98390_dai_set_fmt()
227 regmap_update_bits(max98390->regmap, in max98390_dai_set_fmt()
253 struct max98390_priv *max98390 = in max98390_set_clock() local
266 if (max98390->provider) { in max98390_set_clock()
270 if (rate_table[i] >= max98390->sysclk) in max98390_set_clock()
278 regmap_update_bits(max98390->regmap, in max98390_set_clock()
284 if (!max98390->tdm_mode) { in max98390_set_clock()
293 regmap_update_bits(max98390->regmap, in max98390_set_clock()
307 struct max98390_priv *max98390 = in max98390_dai_hw_params() local
330 regmap_update_bits(max98390->regmap, in max98390_dai_hw_params()
373 regmap_update_bits(max98390->regmap, in max98390_dai_hw_params()
388 struct max98390_priv *max98390 = in max98390_dai_tdm_slot() local
395 max98390->tdm_mode = false; in max98390_dai_tdm_slot()
397 max98390->tdm_mode = true; in max98390_dai_tdm_slot()
400 "Tdm mode : %d\n", max98390->tdm_mode); in max98390_dai_tdm_slot()
410 regmap_update_bits(max98390->regmap, in max98390_dai_tdm_slot()
432 regmap_update_bits(max98390->regmap, in max98390_dai_tdm_slot()
437 regmap_write(max98390->regmap, in max98390_dai_tdm_slot()
440 regmap_write(max98390->regmap, in max98390_dai_tdm_slot()
445 regmap_write(max98390->regmap, in max98390_dai_tdm_slot()
448 regmap_write(max98390->regmap, in max98390_dai_tdm_slot()
459 struct max98390_priv *max98390 = in max98390_dai_set_sysclk() local
462 max98390->sysclk = freq; in max98390_dai_set_sysclk()
478 struct max98390_priv *max98390 = in max98390_dac_event() local
483 regmap_update_bits(max98390->regmap, in max98390_dac_event()
486 regmap_update_bits(max98390->regmap, in max98390_dac_event()
491 regmap_update_bits(max98390->regmap, in max98390_dac_event()
494 regmap_update_bits(max98390->regmap, in max98390_dac_event()
540 struct max98390_priv *max98390 = in max98390_ref_rdc_put() local
543 max98390->ref_rdc_value = ucontrol->value.integer.value[0]; in max98390_ref_rdc_put()
545 regmap_write(max98390->regmap, DSM_TPROT_RECIP_RDC_ROOM_BYTE0, in max98390_ref_rdc_put()
546 max98390->ref_rdc_value & 0x000000ff); in max98390_ref_rdc_put()
547 regmap_write(max98390->regmap, DSM_TPROT_RECIP_RDC_ROOM_BYTE1, in max98390_ref_rdc_put()
548 (max98390->ref_rdc_value >> 8) & 0x000000ff); in max98390_ref_rdc_put()
549 regmap_write(max98390->regmap, DSM_TPROT_RECIP_RDC_ROOM_BYTE2, in max98390_ref_rdc_put()
550 (max98390->ref_rdc_value >> 16) & 0x000000ff); in max98390_ref_rdc_put()
560 struct max98390_priv *max98390 = in max98390_ref_rdc_get() local
563 ucontrol->value.integer.value[0] = max98390->ref_rdc_value; in max98390_ref_rdc_get()
573 struct max98390_priv *max98390 = in max98390_ambient_temp_put() local
576 max98390->ambient_temp_value = ucontrol->value.integer.value[0]; in max98390_ambient_temp_put()
578 regmap_write(max98390->regmap, DSM_TPROT_ROOM_TEMPERATURE_BYTE1, in max98390_ambient_temp_put()
579 (max98390->ambient_temp_value >> 8) & 0x000000ff); in max98390_ambient_temp_put()
580 regmap_write(max98390->regmap, DSM_TPROT_ROOM_TEMPERATURE_BYTE0, in max98390_ambient_temp_put()
581 (max98390->ambient_temp_value) & 0x000000ff); in max98390_ambient_temp_put()
591 struct max98390_priv *max98390 = in max98390_ambient_temp_get() local
594 ucontrol->value.integer.value[0] = max98390->ambient_temp_value; in max98390_ambient_temp_get()
616 struct max98390_priv *max98390 = in max98390_adaptive_rdc_get() local
619 regmap_read(max98390->regmap, THERMAL_RDC_RD_BACK_BYTE1, &rdc); in max98390_adaptive_rdc_get()
620 regmap_read(max98390->regmap, THERMAL_RDC_RD_BACK_BYTE0, &rdc0); in max98390_adaptive_rdc_get()
637 struct max98390_priv *max98390 = snd_soc_component_get_drvdata(component); in max98390_dsm_calib_put() local
643 regmap_read(max98390->regmap, MAX98390_R23FF_GLOBAL_EN, &val); in max98390_dsm_calib_put()
646 regmap_update_bits(max98390->regmap, MAX98390_R203A_AMP_EN, in max98390_dsm_calib_put()
648 regmap_update_bits(max98390->regmap, MAX98390_R23FF_GLOBAL_EN, in max98390_dsm_calib_put()
652 regmap_read(max98390->regmap, THERMAL_RDC_RD_BACK_BYTE1, &rdc); in max98390_dsm_calib_put()
653 regmap_read(max98390->regmap, THERMAL_RDC_RD_BACK_BYTE0, &rdc_cal_result); in max98390_dsm_calib_put()
654 regmap_read(max98390->regmap, MAX98390_MEAS_ADC_CH2_READ, &temp); in max98390_dsm_calib_put()
658 regmap_update_bits(max98390->regmap, MAX98390_R23FF_GLOBAL_EN, in max98390_dsm_calib_put()
660 regmap_update_bits(max98390->regmap, MAX98390_R203A_AMP_EN, in max98390_dsm_calib_put()
668 max98390->ref_rdc_value = 268435456U / rdc_cal_result; in max98390_dsm_calib_put()
670 max98390->ambient_temp_value = temp * 52 - 1188; in max98390_dsm_calib_put()
771 .name = "max98390-aif1",
796 struct max98390_priv *max98390 = in max98390_dsm_init() local
804 if (!strcmp(max98390->dsm_param_name, "default")) { in max98390_dsm_init()
813 max98390->dsm_param_name); in max98390_dsm_init()
827 "max98390: param fw size %zd\n", in max98390_dsm_init()
846 regmap_write(max98390->regmap, MAX98390_R203A_AMP_EN, 0x80); in max98390_dsm_init()
848 regmap_bulk_write(max98390->regmap, param_start_addr, in max98390_dsm_init()
850 regmap_write(max98390->regmap, MAX98390_R23E1_DSP_GLOBAL_EN, 0x01); in max98390_dsm_init()
860 struct max98390_priv *max98390 = in max98390_init_regs() local
863 regmap_write(max98390->regmap, MAX98390_CLK_MON, 0x6f); in max98390_init_regs()
864 regmap_write(max98390->regmap, MAX98390_DAT_MON, 0x00); in max98390_init_regs()
865 regmap_write(max98390->regmap, MAX98390_PWR_GATE_CTL, 0x00); in max98390_init_regs()
866 regmap_write(max98390->regmap, MAX98390_PCM_RX_EN_A, 0x03); in max98390_init_regs()
867 regmap_write(max98390->regmap, MAX98390_ENV_TRACK_VOUT_HEADROOM, 0x0e); in max98390_init_regs()
868 regmap_write(max98390->regmap, MAX98390_BOOST_BYPASS1, 0x46); in max98390_init_regs()
869 regmap_write(max98390->regmap, MAX98390_FET_SCALING3, 0x03); in max98390_init_regs()
872 regmap_write(max98390->regmap, in max98390_init_regs()
874 (max98390->i_l_slot << 4 | in max98390_init_regs()
875 max98390->v_l_slot)&0xFF); in max98390_init_regs()
877 if (max98390->v_l_slot < 8) { in max98390_init_regs()
878 regmap_update_bits(max98390->regmap, in max98390_init_regs()
880 1 << max98390->v_l_slot, 0); in max98390_init_regs()
881 regmap_update_bits(max98390->regmap, in max98390_init_regs()
883 1 << max98390->v_l_slot, in max98390_init_regs()
884 1 << max98390->v_l_slot); in max98390_init_regs()
886 regmap_update_bits(max98390->regmap, in max98390_init_regs()
888 1 << (max98390->v_l_slot - 8), 0); in max98390_init_regs()
889 regmap_update_bits(max98390->regmap, in max98390_init_regs()
891 1 << (max98390->v_l_slot - 8), in max98390_init_regs()
892 1 << (max98390->v_l_slot - 8)); in max98390_init_regs()
895 if (max98390->i_l_slot < 8) { in max98390_init_regs()
896 regmap_update_bits(max98390->regmap, in max98390_init_regs()
898 1 << max98390->i_l_slot, 0); in max98390_init_regs()
899 regmap_update_bits(max98390->regmap, in max98390_init_regs()
901 1 << max98390->i_l_slot, in max98390_init_regs()
902 1 << max98390->i_l_slot); in max98390_init_regs()
904 regmap_update_bits(max98390->regmap, in max98390_init_regs()
906 1 << (max98390->i_l_slot - 8), 0); in max98390_init_regs()
907 regmap_update_bits(max98390->regmap, in max98390_init_regs()
909 1 << (max98390->i_l_slot - 8), in max98390_init_regs()
910 1 << (max98390->i_l_slot - 8)); in max98390_init_regs()
916 struct max98390_priv *max98390 = in max98390_probe() local
919 regmap_write(max98390->regmap, MAX98390_SOFTWARE_RESET, 0x01); in max98390_probe()
929 if (max98390->ref_rdc_value) { in max98390_probe()
930 regmap_write(max98390->regmap, DSM_TPROT_RECIP_RDC_ROOM_BYTE0, in max98390_probe()
931 max98390->ref_rdc_value & 0x000000ff); in max98390_probe()
932 regmap_write(max98390->regmap, DSM_TPROT_RECIP_RDC_ROOM_BYTE1, in max98390_probe()
933 (max98390->ref_rdc_value >> 8) & 0x000000ff); in max98390_probe()
934 regmap_write(max98390->regmap, DSM_TPROT_RECIP_RDC_ROOM_BYTE2, in max98390_probe()
935 (max98390->ref_rdc_value >> 16) & 0x000000ff); in max98390_probe()
937 if (max98390->ambient_temp_value) { in max98390_probe()
938 regmap_write(max98390->regmap, DSM_TPROT_ROOM_TEMPERATURE_BYTE1, in max98390_probe()
939 (max98390->ambient_temp_value >> 8) & 0x000000ff); in max98390_probe()
940 regmap_write(max98390->regmap, DSM_TPROT_ROOM_TEMPERATURE_BYTE0, in max98390_probe()
941 (max98390->ambient_temp_value) & 0x000000ff); in max98390_probe()
950 struct max98390_priv *max98390 = dev_get_drvdata(dev); in max98390_suspend() local
954 regcache_cache_only(max98390->regmap, true); in max98390_suspend()
955 regcache_mark_dirty(max98390->regmap); in max98390_suspend()
962 struct max98390_priv *max98390 = dev_get_drvdata(dev); in max98390_resume() local
966 regcache_cache_only(max98390->regmap, false); in max98390_resume()
967 regcache_sync(max98390->regmap); in max98390_resume()
1002 struct max98390_priv *max98390) in max98390_slot_config() argument
1008 max98390->v_l_slot = value & 0xF; in max98390_slot_config()
1010 max98390->v_l_slot = 0; in max98390_slot_config()
1013 max98390->i_l_slot = value & 0xF; in max98390_slot_config()
1015 max98390->i_l_slot = 1; in max98390_slot_config()
1023 struct max98390_priv *max98390 = NULL; in max98390_i2c_probe() local
1035 max98390 = devm_kzalloc(&i2c->dev, sizeof(*max98390), GFP_KERNEL); in max98390_i2c_probe()
1036 if (!max98390) { in max98390_i2c_probe()
1040 i2c_set_clientdata(i2c, max98390); in max98390_i2c_probe()
1043 &max98390->ambient_temp_value); in max98390_i2c_probe()
1049 &max98390->ref_rdc_value); in max98390_i2c_probe()
1057 __func__, max98390->ref_rdc_value, in max98390_i2c_probe()
1058 max98390->ambient_temp_value); in max98390_i2c_probe()
1061 &max98390->dsm_param_name); in max98390_i2c_probe()
1063 max98390->dsm_param_name = "default"; in max98390_i2c_probe()
1066 max98390_slot_config(i2c, max98390); in max98390_i2c_probe()
1069 max98390->regmap = devm_regmap_init_i2c(i2c, &max98390_regmap); in max98390_i2c_probe()
1070 if (IS_ERR(max98390->regmap)) { in max98390_i2c_probe()
1071 ret = PTR_ERR(max98390->regmap); in max98390_i2c_probe()
1089 ret = regmap_read(max98390->regmap, in max98390_i2c_probe()
1097 dev_info(&i2c->dev, "MAX98390 revisionID: 0x%02X\n", reg); in max98390_i2c_probe()
1107 { "max98390", 0},
1115 { .compatible = "maxim,max98390", },
1131 .name = "max98390",
1142 MODULE_DESCRIPTION("ALSA SoC MAX98390 driver");