Lines Matching +full:current +full:- +full:boost +full:- +full:limit

1 // SPDX-License-Identifier: GPL-2.0-only
3 * max98926.c -- ALSA SoC MAX98926 driver
4 * Copyright 2013-15 Maxim Integrated Products
24 "Current", "Voltage",
75 { 0x35, 0x01 }, /* Boost Converter */
79 { 0x3A, 0x00 }, /* Boost Limiter */
159 {"PDM CH1 Source", "Current", "DAI_OUT"},
161 {"PDM CH0 Source", "Current", "DAI_OUT"},
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),
233 SOC_ENUM("Boost Output Voltage", max98926_boost_voltage),
234 SOC_SINGLE_TLV("Boost Current Limit", MAX98926_BOOST_LIMITER,
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()
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()
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()
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()
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()
518 max98926 = devm_kzalloc(&i2c->dev, in max98926_i2c_probe()
521 return -ENOMEM; in max98926_i2c_probe()
524 max98926->regmap = devm_regmap_init_i2c(i2c, &max98926_regmap); in max98926_i2c_probe()
525 if (IS_ERR(max98926->regmap)) { in max98926_i2c_probe()
526 ret = PTR_ERR(max98926->regmap); in max98926_i2c_probe()
527 dev_err(&i2c->dev, in max98926_i2c_probe()
531 if (of_property_read_bool(i2c->dev.of_node, "maxim,interleave-mode") || in max98926_i2c_probe()
532 of_property_read_bool(i2c->dev.of_node, "interleave-mode")) in max98926_i2c_probe()
533 max98926->interleave_mode = true; in max98926_i2c_probe()
535 if (!of_property_read_u32(i2c->dev.of_node, "vmon-slot-no", &value)) { in max98926_i2c_probe()
537 dev_err(&i2c->dev, "vmon slot number is wrong:\n"); in max98926_i2c_probe()
538 return -EINVAL; in max98926_i2c_probe()
540 max98926->v_slot = value; in max98926_i2c_probe()
542 if (!of_property_read_u32(i2c->dev.of_node, "imon-slot-no", &value)) { in max98926_i2c_probe()
544 dev_err(&i2c->dev, "imon slot number is wrong:\n"); in max98926_i2c_probe()
545 return -EINVAL; in max98926_i2c_probe()
547 max98926->i_slot = value; in max98926_i2c_probe()
549 ret = regmap_read(max98926->regmap, in max98926_i2c_probe()
552 dev_err(&i2c->dev, "Failed to read: %x\n", reg); in max98926_i2c_probe()
556 ret = devm_snd_soc_register_component(&i2c->dev, in max98926_i2c_probe()
560 dev_err(&i2c->dev, in max98926_i2c_probe()
562 dev_info(&i2c->dev, "device version: %x\n", reg); in max98926_i2c_probe()