aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Kulhavy <petr@barix.com>2016-03-31 12:41:26 -0400
committerMark Brown <broonie@kernel.org>2016-03-31 13:25:38 -0400
commit23a282c4f088efb337957ffa21c677d30eda0784 (patch)
treeddd91d614f3ef7bb04e9102a05782e8e48eec0bb
parenta593ed09040fa611f37953afe455e64c7653160d (diff)
ASoC: tas571x: added support for TAS5721
This adds support for TAS5721. Signed-off-by: Petr Kulhavy <petr@barix.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/Kconfig2
-rw-r--r--sound/soc/codecs/tas571x.c76
2 files changed, 77 insertions, 1 deletions
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 649e92a252ae..c011f076d58b 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -737,7 +737,7 @@ config SND_SOC_TAS5086
737 depends on I2C 737 depends on I2C
738 738
739config SND_SOC_TAS571X 739config SND_SOC_TAS571X
740 tristate "Texas Instruments TAS5711/TAS5717/TAS5719 power amplifiers" 740 tristate "Texas Instruments TAS5711/TAS5717/TAS5719/TAS5721 power amplifiers"
741 depends on I2C 741 depends on I2C
742 742
743config SND_SOC_TFA9879 743config SND_SOC_TFA9879
diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c
index ef6c8d9b251a..b8d19b77bde9 100644
--- a/sound/soc/codecs/tas571x.c
+++ b/sound/soc/codecs/tas571x.c
@@ -4,6 +4,9 @@
4 * Copyright (C) 2015 Google, Inc. 4 * Copyright (C) 2015 Google, Inc.
5 * Copyright (c) 2013 Daniel Mack <zonque@gmail.com> 5 * Copyright (c) 2013 Daniel Mack <zonque@gmail.com>
6 * 6 *
7 * TAS5721 support:
8 * Copyright (C) 2016 Petr Kulhavy, Barix AG <petr@barix.com>
9 *
7 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
@@ -372,6 +375,77 @@ static const struct tas571x_chip tas5717_chip = {
372 .vol_reg_size = 2, 375 .vol_reg_size = 2,
373}; 376};
374 377
378static const char *const tas5721_supply_names[] = {
379 "AVDD",
380 "DVDD",
381 "DRVDD",
382 "PVDD",
383};
384
385static const struct snd_kcontrol_new tas5721_controls[] = {
386 SOC_SINGLE_TLV("Master Volume",
387 TAS571X_MVOL_REG,
388 0, 0xff, 1, tas5711_volume_tlv),
389 SOC_DOUBLE_R_TLV("Speaker Volume",
390 TAS571X_CH1_VOL_REG,
391 TAS571X_CH2_VOL_REG,
392 0, 0xff, 1, tas5711_volume_tlv),
393 SOC_DOUBLE("Speaker Switch",
394 TAS571X_SOFT_MUTE_REG,
395 TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT,
396 1, 1),
397};
398
399static const struct reg_default tas5721_reg_defaults[] = {
400 {TAS571X_CLK_CTRL_REG, 0x6c},
401 {TAS571X_DEV_ID_REG, 0x00},
402 {TAS571X_ERR_STATUS_REG, 0x00},
403 {TAS571X_SYS_CTRL_1_REG, 0xa0},
404 {TAS571X_SDI_REG, 0x05},
405 {TAS571X_SYS_CTRL_2_REG, 0x40},
406 {TAS571X_SOFT_MUTE_REG, 0x00},
407 {TAS571X_MVOL_REG, 0xff},
408 {TAS571X_CH1_VOL_REG, 0x30},
409 {TAS571X_CH2_VOL_REG, 0x30},
410 {TAS571X_CH3_VOL_REG, 0x30},
411 {TAS571X_VOL_CFG_REG, 0x91},
412 {TAS571X_MODULATION_LIMIT_REG, 0x02},
413 {TAS571X_IC_DELAY_CH1_REG, 0xac},
414 {TAS571X_IC_DELAY_CH2_REG, 0x54},
415 {TAS571X_IC_DELAY_CH3_REG, 0xac},
416 {TAS571X_IC_DELAY_CH4_REG, 0x54},
417 {TAS571X_PWM_CH_SDN_GROUP_REG, 0x30},
418 {TAS571X_START_STOP_PERIOD_REG, 0x0f},
419 {TAS571X_OSC_TRIM_REG, 0x82},
420 {TAS571X_BKND_ERR_REG, 0x02},
421 {TAS571X_INPUT_MUX_REG, 0x17772},
422 {TAS571X_CH4_SRC_SELECT_REG, 0x4303},
423 {TAS571X_PWM_MUX_REG, 0x1021345},
424};
425
426static const struct regmap_config tas5721_regmap_config = {
427 .reg_bits = 8,
428 .val_bits = 32,
429 .max_register = 0xff,
430 .reg_read = tas571x_reg_read,
431 .reg_write = tas571x_reg_write,
432 .reg_defaults = tas5721_reg_defaults,
433 .num_reg_defaults = ARRAY_SIZE(tas5721_reg_defaults),
434 .cache_type = REGCACHE_RBTREE,
435 .wr_table = &tas571x_write_regs,
436 .volatile_table = &tas571x_volatile_regs,
437};
438
439
440static const struct tas571x_chip tas5721_chip = {
441 .supply_names = tas5721_supply_names,
442 .num_supply_names = ARRAY_SIZE(tas5721_supply_names),
443 .controls = tas5711_controls,
444 .num_controls = ARRAY_SIZE(tas5711_controls),
445 .regmap_config = &tas5721_regmap_config,
446 .vol_reg_size = 1,
447};
448
375static const struct snd_soc_dapm_widget tas571x_dapm_widgets[] = { 449static const struct snd_soc_dapm_widget tas571x_dapm_widgets[] = {
376 SND_SOC_DAPM_DAC("DACL", NULL, SND_SOC_NOPM, 0, 0), 450 SND_SOC_DAPM_DAC("DACL", NULL, SND_SOC_NOPM, 0, 0),
377 SND_SOC_DAPM_DAC("DACR", NULL, SND_SOC_NOPM, 0, 0), 451 SND_SOC_DAPM_DAC("DACR", NULL, SND_SOC_NOPM, 0, 0),
@@ -527,6 +601,7 @@ static const struct of_device_id tas571x_of_match[] = {
527 { .compatible = "ti,tas5711", .data = &tas5711_chip, }, 601 { .compatible = "ti,tas5711", .data = &tas5711_chip, },
528 { .compatible = "ti,tas5717", .data = &tas5717_chip, }, 602 { .compatible = "ti,tas5717", .data = &tas5717_chip, },
529 { .compatible = "ti,tas5719", .data = &tas5717_chip, }, 603 { .compatible = "ti,tas5719", .data = &tas5717_chip, },
604 { .compatible = "ti,tas5721", .data = &tas5721_chip, },
530 { } 605 { }
531}; 606};
532MODULE_DEVICE_TABLE(of, tas571x_of_match); 607MODULE_DEVICE_TABLE(of, tas571x_of_match);
@@ -535,6 +610,7 @@ static const struct i2c_device_id tas571x_i2c_id[] = {
535 { "tas5711", (kernel_ulong_t) &tas5711_chip }, 610 { "tas5711", (kernel_ulong_t) &tas5711_chip },
536 { "tas5717", (kernel_ulong_t) &tas5717_chip }, 611 { "tas5717", (kernel_ulong_t) &tas5717_chip },
537 { "tas5719", (kernel_ulong_t) &tas5717_chip }, 612 { "tas5719", (kernel_ulong_t) &tas5717_chip },
613 { "tas5721", (kernel_ulong_t) &tas5721_chip },
538 { } 614 { }
539}; 615};
540MODULE_DEVICE_TABLE(i2c, tas571x_i2c_id); 616MODULE_DEVICE_TABLE(i2c, tas571x_i2c_id);