Lines Matching +full:alc +full:- +full:enable

1 // SPDX-License-Identifier: GPL-2.0-only
3 * max98925.c -- ALSA SoC Stereo MAX98925 driver
4 * Copyright 2013-15 Maxim Integrated Products
74 { 0x31, 0x00 }, /* ALC Attack */
75 { 0x32, 0x80 }, /* ALC Atten and Release */
76 { 0x33, 0x00 }, /* ALC Infinite Hold Release */
77 { 0x34, 0x92 }, /* ALC Configuration */
79 { 0x36, 0x00 }, /* Block Enable */
81 { 0x38, 0x00 }, /* Global Enable */
105 regmap_update_bits(max98925->regmap, in max98925_dac_event()
113 regmap_update_bits(max98925->regmap, in max98925_dac_event()
129 SND_SOC_DAPM_DAC_E("Amp Enable", NULL, MAX98925_BLOCK_ENABLE,
132 SND_SOC_DAPM_SUPPLY("Global Enable", MAX98925_GLOBAL_ENABLE,
148 {"Amp Enable", NULL, "Rc Filter MUX"},
149 {"BE_OUT", NULL, "Amp Enable"},
150 {"BE_OUT", NULL, "Global Enable"},
187 static DECLARE_TLV_DB_SCALE(max98925_spk_tlv, -600, 100, 0);
191 M98925_SPK_GAIN_SHIFT, (1<<M98925_SPK_GAIN_WIDTH)-1, 0,
197 SOC_SINGLE("ALC Switch", MAX98925_THRESHOLD,
199 SOC_SINGLE("ALC Threshold", MAX98925_THRESHOLD, M98925_ALC_TH_SHIFT,
200 (1<<M98925_ALC_TH_WIDTH)-1, 0),
260 int ret = -EINVAL; in max98925_rate_value()
278 regmap_update_bits(max98925->regmap, in max98925_set_sense_data()
281 regmap_update_bits(max98925->regmap, in max98925_set_sense_data()
284 max98925->v_slot << M98925_DAI_VMON_SLOT_SHIFT); in max98925_set_sense_data()
286 regmap_update_bits(max98925->regmap, in max98925_set_sense_data()
289 regmap_update_bits(max98925->regmap, in max98925_set_sense_data()
292 max98925->i_slot << M98925_DAI_IMON_SLOT_SHIFT); in max98925_set_sense_data()
298 struct snd_soc_component *component = codec_dai->component; in max98925_dai_set_fmt()
302 dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); in max98925_dai_set_fmt()
305 regmap_update_bits(max98925->regmap, in max98925_dai_set_fmt()
315 regmap_update_bits(max98925->regmap, in max98925_dai_set_fmt()
320 dev_err(component->dev, "DAI clock mode unsupported"); in max98925_dai_set_fmt()
321 return -EINVAL; in max98925_dai_set_fmt()
337 dev_err(component->dev, "DAI invert mode unsupported"); in max98925_dai_set_fmt()
338 return -EINVAL; in max98925_dai_set_fmt()
341 regmap_update_bits(max98925->regmap, MAX98925_FORMAT, in max98925_dai_set_fmt()
350 struct snd_soc_component *component = max98925->component; in max98925_set_clock()
353 int blr_clk_ratio = params_channels(params) * max98925->ch_size; in max98925_set_clock()
357 regmap_update_bits(max98925->regmap, in max98925_set_clock()
362 regmap_update_bits(max98925->regmap, in max98925_set_clock()
367 regmap_update_bits(max98925->regmap, in max98925_set_clock()
372 return -EINVAL; in max98925_set_clock()
375 switch (max98925->sysclk) { in max98925_set_clock()
393 dev_info(max98925->component->dev, "unsupported sysclk %d\n", in max98925_set_clock()
394 max98925->sysclk); in max98925_set_clock()
395 return -EINVAL; in max98925_set_clock()
399 return -EINVAL; in max98925_set_clock()
402 regmap_update_bits(max98925->regmap, in max98925_set_clock()
406 regmap_write(max98925->regmap, in max98925_set_clock()
408 regmap_write(max98925->regmap, in max98925_set_clock()
411 regmap_write(max98925->regmap, in max98925_set_clock()
413 regmap_write(max98925->regmap, in max98925_set_clock()
416 regmap_update_bits(max98925->regmap, MAX98925_DAI_CLK_MODE1, in max98925_set_clock()
425 struct snd_soc_component *component = dai->component; in max98925_dai_hw_params()
430 regmap_update_bits(max98925->regmap, in max98925_dai_hw_params()
433 max98925->ch_size = 16; in max98925_dai_hw_params()
436 regmap_update_bits(max98925->regmap, in max98925_dai_hw_params()
439 max98925->ch_size = 24; in max98925_dai_hw_params()
442 regmap_update_bits(max98925->regmap, in max98925_dai_hw_params()
445 max98925->ch_size = 32; in max98925_dai_hw_params()
450 return -EINVAL; in max98925_dai_hw_params()
452 dev_dbg(component->dev, "%s: format supported %d", in max98925_dai_hw_params()
460 struct snd_soc_component *component = dai->component; in max98925_dai_set_sysclk()
466 regmap_update_bits(max98925->regmap, in max98925_dai_set_sysclk()
472 regmap_update_bits(max98925->regmap, in max98925_dai_set_sysclk()
478 return -EINVAL; in max98925_dai_set_sysclk()
480 max98925->sysclk = freq; in max98925_dai_set_sysclk()
495 .name = "max98925-aif1",
518 max98925->component = component; in max98925_probe()
519 regmap_write(max98925->regmap, MAX98925_GLOBAL_ENABLE, 0x00); in max98925_probe()
521 regmap_write(max98925->regmap, in max98925_probe()
523 regmap_write(max98925->regmap, MAX98925_TDM_SLOT_SELECT, 0xC8); in max98925_probe()
524 regmap_write(max98925->regmap, MAX98925_DOUT_HIZ_CFG1, 0xFF); in max98925_probe()
525 regmap_write(max98925->regmap, MAX98925_DOUT_HIZ_CFG2, 0xFF); in max98925_probe()
526 regmap_write(max98925->regmap, MAX98925_DOUT_HIZ_CFG3, 0xFF); in max98925_probe()
527 regmap_write(max98925->regmap, MAX98925_DOUT_HIZ_CFG4, 0xF0); in max98925_probe()
528 regmap_write(max98925->regmap, MAX98925_FILTERS, 0xD8); in max98925_probe()
529 regmap_write(max98925->regmap, MAX98925_ALC_CONFIGURATION, 0xF8); in max98925_probe()
530 regmap_write(max98925->regmap, MAX98925_CONFIGURATION, 0xF0); in max98925_probe()
531 /* Disable ALC muting */ in max98925_probe()
532 regmap_write(max98925->regmap, MAX98925_BOOST_LIMITER, 0xF8); in max98925_probe()
566 max98925 = devm_kzalloc(&i2c->dev, in max98925_i2c_probe()
569 return -ENOMEM; in max98925_i2c_probe()
572 max98925->regmap = devm_regmap_init_i2c(i2c, &max98925_regmap); in max98925_i2c_probe()
573 if (IS_ERR(max98925->regmap)) { in max98925_i2c_probe()
574 ret = PTR_ERR(max98925->regmap); in max98925_i2c_probe()
575 dev_err(&i2c->dev, in max98925_i2c_probe()
580 if (!of_property_read_u32(i2c->dev.of_node, "vmon-slot-no", &value)) { in max98925_i2c_probe()
582 dev_err(&i2c->dev, "vmon slot number is wrong:\n"); in max98925_i2c_probe()
583 return -EINVAL; in max98925_i2c_probe()
585 max98925->v_slot = value; in max98925_i2c_probe()
587 if (!of_property_read_u32(i2c->dev.of_node, "imon-slot-no", &value)) { in max98925_i2c_probe()
589 dev_err(&i2c->dev, "imon slot number is wrong:\n"); in max98925_i2c_probe()
590 return -EINVAL; in max98925_i2c_probe()
592 max98925->i_slot = value; in max98925_i2c_probe()
595 ret = regmap_read(max98925->regmap, MAX98925_REV_VERSION, &reg); in max98925_i2c_probe()
597 dev_err(&i2c->dev, "Read revision failed\n"); in max98925_i2c_probe()
602 ret = -ENODEV; in max98925_i2c_probe()
603 dev_err(&i2c->dev, "Invalid revision (%d 0x%02X)\n", in max98925_i2c_probe()
608 dev_info(&i2c->dev, "device version 0x%02X\n", reg); in max98925_i2c_probe()
610 ret = devm_snd_soc_register_component(&i2c->dev, in max98925_i2c_probe()
614 dev_err(&i2c->dev, in max98925_i2c_probe()