Lines Matching +full:invert +full:- +full:enable

1 // SPDX-License-Identifier: GPL-2.0-only
3 * max98926.c -- ALSA SoC MAX98926 driver
4 * Copyright 2013-15 Maxim Integrated Products
76 { 0x36, 0x00 }, /* Block Enable */
78 { 0x38, 0x00 }, /* Global Enable */
122 SND_SOC_DAPM_DAC("Amp Enable", NULL, MAX98926_BLOCK_ENABLE,
124 SND_SOC_DAPM_SUPPLY("Global Enable", MAX98926_GLOBAL_ENABLE,
126 SND_SOC_DAPM_SUPPLY("VI Enable", MAX98926_BLOCK_ENABLE,
130 SND_SOC_DAPM_PGA("BST Enable", MAX98926_BLOCK_ENABLE,
152 {"VI Enable", NULL, "DAI_OUT"},
153 {"DAI Sel", "Left", "VI Enable"},
154 {"DAI Sel", "Right", "VI Enable"},
155 {"DAI Sel", "LeftRight", "VI Enable"},
156 {"DAI Sel", "LeftRightDiv2", "VI Enable"},
165 {"Amp Enable", NULL, "PCM Sel"},
167 {"BST Enable", NULL, "Amp Enable"},
168 {"BE_OUT", NULL, "BST Enable"},
205 static DECLARE_TLV_DB_SCALE(max98926_spk_tlv, -600, 100, 0);
222 (1<<MAX98926_SPK_GAIN_WIDTH)-1, 0,
232 (1<<MAX98926_ALC_TH_WIDTH)-1, 0),
236 (1<<MAX98926_BST_ILIM_SHIFT)-1, 0,
291 regmap_update_bits(max98926->regmap, in max98926_set_sense_data()
295 regmap_update_bits(max98926->regmap, in max98926_set_sense_data()
300 if (!max98926->interleave_mode) { in max98926_set_sense_data()
302 regmap_update_bits(max98926->regmap, in max98926_set_sense_data()
305 max98926->v_slot); in max98926_set_sense_data()
307 regmap_update_bits(max98926->regmap, in max98926_set_sense_data()
310 max98926->i_slot); in max98926_set_sense_data()
312 /* enable interleave mode */ in max98926_set_sense_data()
313 regmap_update_bits(max98926->regmap, in max98926_set_sense_data()
318 regmap_update_bits(max98926->regmap, in max98926_set_sense_data()
321 max98926->v_slot); in max98926_set_sense_data()
328 struct snd_soc_component *component = codec_dai->component; in max98926_dai_set_fmt()
330 unsigned int invert = 0; in max98926_dai_set_fmt() local
332 dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); in max98926_dai_set_fmt()
339 dev_err(component->dev, "DAI clock mode unsupported\n"); in max98926_dai_set_fmt()
340 return -EINVAL; in max98926_dai_set_fmt()
347 invert = MAX98926_DAI_WCI_MASK; in max98926_dai_set_fmt()
350 invert = MAX98926_DAI_BCI_MASK; in max98926_dai_set_fmt()
353 invert = MAX98926_DAI_BCI_MASK | MAX98926_DAI_WCI_MASK; in max98926_dai_set_fmt()
356 dev_err(component->dev, "DAI invert mode unsupported\n"); in max98926_dai_set_fmt()
357 return -EINVAL; in max98926_dai_set_fmt()
360 regmap_write(max98926->regmap, in max98926_dai_set_fmt()
362 regmap_update_bits(max98926->regmap, MAX98926_FORMAT, in max98926_dai_set_fmt()
363 MAX98926_DAI_BCI_MASK, invert); in max98926_dai_set_fmt()
371 int dai_sr = -EINVAL; in max98926_dai_hw_params()
373 struct snd_soc_component *component = dai->component; in max98926_dai_hw_params()
379 regmap_update_bits(max98926->regmap, in max98926_dai_hw_params()
383 max98926->ch_size = 16; in max98926_dai_hw_params()
386 regmap_update_bits(max98926->regmap, in max98926_dai_hw_params()
390 max98926->ch_size = 24; in max98926_dai_hw_params()
393 regmap_update_bits(max98926->regmap, in max98926_dai_hw_params()
397 max98926->ch_size = 32; in max98926_dai_hw_params()
400 dev_dbg(component->dev, "format unsupported %d\n", in max98926_dai_hw_params()
402 return -EINVAL; in max98926_dai_hw_params()
406 blr_clk_ratio = params_channels(params) * max98926->ch_size; in max98926_dai_hw_params()
410 regmap_update_bits(max98926->regmap, in max98926_dai_hw_params()
416 regmap_update_bits(max98926->regmap, in max98926_dai_hw_params()
422 regmap_update_bits(max98926->regmap, in max98926_dai_hw_params()
428 return -EINVAL; in max98926_dai_hw_params()
439 return -EINVAL; in max98926_dai_hw_params()
442 regmap_update_bits(max98926->regmap, in max98926_dai_hw_params()
458 .name = "max98926-aif1",
481 max98926->component = component; in max98926_probe()
483 /* Hi-Z all the slots */ in max98926_probe()
484 regmap_write(max98926->regmap, MAX98926_DOUT_HIZ_CFG4, 0xF0); in max98926_probe()
520 max98926 = devm_kzalloc(&i2c->dev, in max98926_i2c_probe()
523 return -ENOMEM; in max98926_i2c_probe()
526 max98926->regmap = devm_regmap_init_i2c(i2c, &max98926_regmap); in max98926_i2c_probe()
527 if (IS_ERR(max98926->regmap)) { in max98926_i2c_probe()
528 ret = PTR_ERR(max98926->regmap); in max98926_i2c_probe()
529 dev_err(&i2c->dev, in max98926_i2c_probe()
533 if (of_property_read_bool(i2c->dev.of_node, "interleave-mode")) in max98926_i2c_probe()
534 max98926->interleave_mode = true; in max98926_i2c_probe()
536 if (!of_property_read_u32(i2c->dev.of_node, "vmon-slot-no", &value)) { in max98926_i2c_probe()
538 dev_err(&i2c->dev, "vmon slot number is wrong:\n"); in max98926_i2c_probe()
539 return -EINVAL; in max98926_i2c_probe()
541 max98926->v_slot = value; in max98926_i2c_probe()
543 if (!of_property_read_u32(i2c->dev.of_node, "imon-slot-no", &value)) { in max98926_i2c_probe()
545 dev_err(&i2c->dev, "imon slot number is wrong:\n"); in max98926_i2c_probe()
546 return -EINVAL; in max98926_i2c_probe()
548 max98926->i_slot = value; in max98926_i2c_probe()
550 ret = regmap_read(max98926->regmap, in max98926_i2c_probe()
553 dev_err(&i2c->dev, "Failed to read: %x\n", reg); in max98926_i2c_probe()
557 ret = devm_snd_soc_register_component(&i2c->dev, in max98926_i2c_probe()
561 dev_err(&i2c->dev, in max98926_i2c_probe()
563 dev_info(&i2c->dev, "device version: %x\n", reg); in max98926_i2c_probe()