Lines Matching +full:invert +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
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,
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()
300 unsigned int invert = 0; in max98925_dai_set_fmt() local
302 dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); in max98925_dai_set_fmt()
306 regmap_update_bits(max98925->regmap, in max98925_dai_set_fmt()
316 regmap_update_bits(max98925->regmap, in max98925_dai_set_fmt()
323 dev_err(component->dev, "DAI clock mode unsupported"); in max98925_dai_set_fmt()
324 return -EINVAL; in max98925_dai_set_fmt()
331 invert = M98925_DAI_WCI_MASK; in max98925_dai_set_fmt()
334 invert = M98925_DAI_BCI_MASK; in max98925_dai_set_fmt()
337 invert = M98925_DAI_BCI_MASK | M98925_DAI_WCI_MASK; in max98925_dai_set_fmt()
340 dev_err(component->dev, "DAI invert mode unsupported"); in max98925_dai_set_fmt()
341 return -EINVAL; in max98925_dai_set_fmt()
344 regmap_update_bits(max98925->regmap, MAX98925_FORMAT, in max98925_dai_set_fmt()
345 M98925_DAI_BCI_MASK | M98925_DAI_WCI_MASK, invert); in max98925_dai_set_fmt()
353 struct snd_soc_component *component = max98925->component; in max98925_set_clock()
356 int blr_clk_ratio = params_channels(params) * max98925->ch_size; in max98925_set_clock()
360 regmap_update_bits(max98925->regmap, in max98925_set_clock()
365 regmap_update_bits(max98925->regmap, in max98925_set_clock()
370 regmap_update_bits(max98925->regmap, in max98925_set_clock()
375 return -EINVAL; in max98925_set_clock()
378 switch (max98925->sysclk) { in max98925_set_clock()
396 dev_info(max98925->component->dev, "unsupported sysclk %d\n", in max98925_set_clock()
397 max98925->sysclk); in max98925_set_clock()
398 return -EINVAL; in max98925_set_clock()
402 return -EINVAL; in max98925_set_clock()
405 regmap_update_bits(max98925->regmap, in max98925_set_clock()
409 regmap_write(max98925->regmap, in max98925_set_clock()
411 regmap_write(max98925->regmap, in max98925_set_clock()
414 regmap_write(max98925->regmap, in max98925_set_clock()
416 regmap_write(max98925->regmap, in max98925_set_clock()
419 regmap_update_bits(max98925->regmap, MAX98925_DAI_CLK_MODE1, in max98925_set_clock()
428 struct snd_soc_component *component = dai->component; in max98925_dai_hw_params()
433 regmap_update_bits(max98925->regmap, in max98925_dai_hw_params()
436 max98925->ch_size = 16; in max98925_dai_hw_params()
439 regmap_update_bits(max98925->regmap, in max98925_dai_hw_params()
442 max98925->ch_size = 24; in max98925_dai_hw_params()
445 regmap_update_bits(max98925->regmap, in max98925_dai_hw_params()
448 max98925->ch_size = 32; in max98925_dai_hw_params()
453 return -EINVAL; in max98925_dai_hw_params()
455 dev_dbg(component->dev, "%s: format supported %d", in max98925_dai_hw_params()
463 struct snd_soc_component *component = dai->component; in max98925_dai_set_sysclk()
469 regmap_update_bits(max98925->regmap, in max98925_dai_set_sysclk()
475 regmap_update_bits(max98925->regmap, in max98925_dai_set_sysclk()
481 return -EINVAL; in max98925_dai_set_sysclk()
483 max98925->sysclk = freq; in max98925_dai_set_sysclk()
498 .name = "max98925-aif1",
521 max98925->component = component; in max98925_probe()
522 regmap_write(max98925->regmap, MAX98925_GLOBAL_ENABLE, 0x00); in max98925_probe()
524 regmap_write(max98925->regmap, in max98925_probe()
526 regmap_write(max98925->regmap, MAX98925_TDM_SLOT_SELECT, 0xC8); in max98925_probe()
527 regmap_write(max98925->regmap, MAX98925_DOUT_HIZ_CFG1, 0xFF); in max98925_probe()
528 regmap_write(max98925->regmap, MAX98925_DOUT_HIZ_CFG2, 0xFF); in max98925_probe()
529 regmap_write(max98925->regmap, MAX98925_DOUT_HIZ_CFG3, 0xFF); in max98925_probe()
530 regmap_write(max98925->regmap, MAX98925_DOUT_HIZ_CFG4, 0xF0); in max98925_probe()
531 regmap_write(max98925->regmap, MAX98925_FILTERS, 0xD8); in max98925_probe()
532 regmap_write(max98925->regmap, MAX98925_ALC_CONFIGURATION, 0xF8); in max98925_probe()
533 regmap_write(max98925->regmap, MAX98925_CONFIGURATION, 0xF0); in max98925_probe()
535 regmap_write(max98925->regmap, MAX98925_BOOST_LIMITER, 0xF8); in max98925_probe()
571 max98925 = devm_kzalloc(&i2c->dev, in max98925_i2c_probe()
574 return -ENOMEM; in max98925_i2c_probe()
577 max98925->regmap = devm_regmap_init_i2c(i2c, &max98925_regmap); in max98925_i2c_probe()
578 if (IS_ERR(max98925->regmap)) { in max98925_i2c_probe()
579 ret = PTR_ERR(max98925->regmap); in max98925_i2c_probe()
580 dev_err(&i2c->dev, in max98925_i2c_probe()
585 if (!of_property_read_u32(i2c->dev.of_node, "vmon-slot-no", &value)) { in max98925_i2c_probe()
587 dev_err(&i2c->dev, "vmon slot number is wrong:\n"); in max98925_i2c_probe()
588 return -EINVAL; in max98925_i2c_probe()
590 max98925->v_slot = value; in max98925_i2c_probe()
592 if (!of_property_read_u32(i2c->dev.of_node, "imon-slot-no", &value)) { in max98925_i2c_probe()
594 dev_err(&i2c->dev, "imon slot number is wrong:\n"); in max98925_i2c_probe()
595 return -EINVAL; in max98925_i2c_probe()
597 max98925->i_slot = value; in max98925_i2c_probe()
600 ret = regmap_read(max98925->regmap, MAX98925_REV_VERSION, ®); in max98925_i2c_probe()
602 dev_err(&i2c->dev, "Read revision failed\n"); in max98925_i2c_probe()
607 ret = -ENODEV; in max98925_i2c_probe()
608 dev_err(&i2c->dev, "Invalid revision (%d 0x%02X)\n", in max98925_i2c_probe()
613 dev_info(&i2c->dev, "device version 0x%02X\n", reg); in max98925_i2c_probe()
615 ret = devm_snd_soc_register_component(&i2c->dev, in max98925_i2c_probe()
619 dev_err(&i2c->dev, in max98925_i2c_probe()