From patchwork Wed Jun 27 07:39:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 140309 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp534422ljj; Wed, 27 Jun 2018 00:40:03 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfTuTNrUrJ7wLJ8MYAjlg27lBHwH7MonYlrQ/xQEcQ9EoF8TukItLb5hHdC8BhMLrKnGgFQ X-Received: by 2002:a1c:d9d0:: with SMTP id q199-v6mr4182852wmg.78.1530085203526; Wed, 27 Jun 2018 00:40:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530085203; cv=none; d=google.com; s=arc-20160816; b=ga5qu9UMjGGNcV68SjLbqEcfpOdoWavdlKoNb9324JSRqbwrK+azk2eWY/Eb/TEjev O82zxzDZCP8iruaXfptKfVkN2AJ3RNQr5+6ilvrP62Kz8pOXdkfvu6cSD1J74GWG7OI4 4irgx+QY+uBclQayE1DXW3hLZIGHDOlu4H/rsEnhLLsSmIHa62IrZusfsrqiy+cP+p+d o9OqELn1AM5BNyQxkFXKkAsyoNtJUWAdhRvuaAdXEl5UI2yS8EirI5OqhINkGmzN2qVW jxvEQS4JyfVxUHmjhT5htiJdZvel0bntm8zUzr0tPkJLcQ/5vFhH1ZWlOHRRaG1AWOu4 uEcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to:arc-authentication-results; bh=NZg9vAp0ArC6koo6apk9XX8JmM3V9OHTZtehfxsC+X4=; b=Dp1AKDMmCSqFLBFY8D900UoS9DkMOoUbzNIxL0l5pg+XZMYGXEC6/KPq+MOXsS34kq oFAo/k5BX7ZUSE4IsybAOvR3t+R3UfoPa3ftOh50b7dyE1DoKISWld9FOPY0Tj3i50yW 6PPAhzeDpHaOmWWgpfMyhqHv1rg8A7HzfPp1sXleY+aazHtuDUeCnRnJLnER5nBKG0oM IbwTgNzCiN3NXEdS3780JPBeamAVayfSZz7RrwiVdrmxZWlX6rp+nJqmGrmxtiq+YWHm 21c981tYwlHZu9dhcz8om1STZ1dDiU0Am7lvAHJ9MABLnXAUPbHXPMi/mcuDxdc+GVjt JU9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=Esyj1aJX; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id w204-v6si1177263wmd.184.2018.06.27.00.40.03; Wed, 27 Jun 2018 00:40:03 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=Esyj1aJX; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 07EDF267957; Wed, 27 Jun 2018 09:39:52 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7D77A267950; Wed, 27 Jun 2018 09:39:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_SOFTFAIL,T_DKIMWL_WL_MED autolearn=disabled version=3.4.0 Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by alsa0.perex.cz (Postfix) with ESMTP id 6B620267943 for ; Wed, 27 Jun 2018 09:39:45 +0200 (CEST) Received: by mail-wr0-f196.google.com with SMTP id p12-v6so926246wrn.11 for ; Wed, 27 Jun 2018 00:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5dbIgBjwx56oKvZVIYDHgy9JrAl3QFz2qsLjSwXS7bA=; b=Esyj1aJX3RIA+bV3RSzx1BRg3yXwT+Uwnb1Ul9cwMLjTv7fHwrwy71LDfVwCFdQSSa 4iQbddlX4LE4yCldTo7zpesJrPHD1gBbzYQEp0PNkxfA3WRc+jzOC0/e6/+rqF75EkIA BgAFhQFq1CNhS+0n37F++nEjr3Q5JePSmPk7HpAUgnN5u2NiJzV16DfePHwPXq4nWBzQ 6QPSlNIP2uSHRtULXdZhAEAkjJ5Jmte9oVikjCOOl4fHvASwjxwn88H0ZhhrMpqSNWRo hnj7lrScRrQm1GBZFj3PRJ7z3DIChgREUQg/WxdIw6wnxIGY8kYRJQyuJZLE+hS8zTdq bdNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5dbIgBjwx56oKvZVIYDHgy9JrAl3QFz2qsLjSwXS7bA=; b=af4nxqcucvVvSfi1HfqIb9Q3KJx34q8K/1ffV5T9nulwr9uzlCdPueXPxHnwq3mtfW lG6m61w4p9bChC9o2SGpQmG0LNOo6A3qA638KBWUOTQGFG5sYecVuR616R//X7MR/RqB 3fv13gBLrV1RJBV33YX1bx0vVjVObuhvnJVFJBuCjel6kScrs07fHDlXttE6/zegyP+o JhWlVYOVJC6On9/BdnynFV8Q4z3EDf1mnrF1knVCO/8VFUTb6GRRj3PklKtCsM3EXQbf kk0ny2FBP3UArg8ALixtMA1aQUx4elbN1GR2hDxvmmu99vksQ9w0mRa0YOT0nBCHeNus auYQ== X-Gm-Message-State: APt69E0KQ2s8J6l99G0k3CSIS+O1l1IIfxf1vvmzOYSaPGodR4WfqWTT Z63mXw7sk74uqI2whsYY0yE8dw== X-Received: by 2002:adf:be8d:: with SMTP id i13-v6mr4071314wrh.86.1530085184810; Wed, 27 Jun 2018 00:39:44 -0700 (PDT) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id m58-v6sm5852169wrf.61.2018.06.27.00.39.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Jun 2018 00:39:44 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood Date: Wed, 27 Jun 2018 09:39:37 +0200 Message-Id: <20180627073937.29912-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180627073937.29912-1-jbrunet@baylibre.com> References: <20180627073937.29912-1-jbrunet@baylibre.com> Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Jerome Brunet Subject: [alsa-devel] [PATCH v2 2/2] ASoC: tas517x: add tas5707 support X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org Add support for the tas5707 audio power amplifier. Signed-off-by: Jerome Brunet --- sound/soc/codecs/Kconfig | 5 ++- sound/soc/codecs/tas571x.c | 110 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/tas571x.h | 16 +++++++ 3 files changed, 130 insertions(+), 1 deletion(-) -- 2.14.4 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 1d2ddb528fd2..f5839eeeed5e 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -953,8 +953,11 @@ config SND_SOC_TAS5086 depends on I2C config SND_SOC_TAS571X - tristate "Texas Instruments TAS5711/TAS5717/TAS5719/TAS5721 power amplifiers" + tristate "Texas Instruments TAS571x power amplifiers" depends on I2C + help + Enable support for Texas Instruments TAS5707, TAS5711, TAS5717, + TAS5719 and TAS5721 power amplifiers config SND_SOC_TAS5720 tristate "Texas Instruments TAS5720 Mono Audio amplifier" diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c index 52f34c94ec25..ca2dfe12344e 100644 --- a/sound/soc/codecs/tas571x.c +++ b/sound/soc/codecs/tas571x.c @@ -7,6 +7,9 @@ * TAS5721 support: * Copyright (C) 2016 Petr Kulhavy, Barix AG * + * TAS5707 support: + * Copyright (C) 2018 Jerome Brunet, Baylibre SAS + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -444,6 +447,111 @@ static const struct tas571x_chip tas5711_chip = { .vol_reg_size = 1, }; +static const struct regmap_range tas5707_volatile_regs_range[] = { + regmap_reg_range(TAS571X_CLK_CTRL_REG, TAS571X_ERR_STATUS_REG), + regmap_reg_range(TAS571X_OSC_TRIM_REG, TAS571X_OSC_TRIM_REG), + regmap_reg_range(TAS5707_CH1_BQ0_REG, TAS5707_CH2_BQ6_REG), +}; + +static const struct regmap_access_table tas5707_volatile_regs = { + .yes_ranges = tas5707_volatile_regs_range, + .n_yes_ranges = ARRAY_SIZE(tas5707_volatile_regs_range), + +}; + +static const DECLARE_TLV_DB_SCALE(tas5707_volume_tlv, -7900, 50, 1); + +static const char * const tas5707_volume_slew_step_txt[] = { + "256", "512", "1024", "2048", +}; + +static const unsigned int tas5707_volume_slew_step_values[] = { + 3, 0, 1, 2, +}; + +static SOC_VALUE_ENUM_SINGLE_DECL(tas5707_volume_slew_step_enum, + TAS571X_VOL_CFG_REG, 0, 0x3, + tas5707_volume_slew_step_txt, + tas5707_volume_slew_step_values); + +static const struct snd_kcontrol_new tas5707_controls[] = { + SOC_SINGLE_TLV("Master Volume", + TAS571X_MVOL_REG, + 0, 0xff, 1, tas5707_volume_tlv), + SOC_DOUBLE_R_TLV("Speaker Volume", + TAS571X_CH1_VOL_REG, + TAS571X_CH2_VOL_REG, + 0, 0xff, 1, tas5707_volume_tlv), + SOC_DOUBLE("Speaker Switch", + TAS571X_SOFT_MUTE_REG, + TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT, + 1, 1), + + SOC_ENUM("Slew Rate Steps", tas5707_volume_slew_step_enum), + + BIQUAD_COEFS("CH1 - Biquad 0", TAS5707_CH1_BQ0_REG), + BIQUAD_COEFS("CH1 - Biquad 1", TAS5707_CH1_BQ1_REG), + BIQUAD_COEFS("CH1 - Biquad 2", TAS5707_CH1_BQ2_REG), + BIQUAD_COEFS("CH1 - Biquad 3", TAS5707_CH1_BQ3_REG), + BIQUAD_COEFS("CH1 - Biquad 4", TAS5707_CH1_BQ4_REG), + BIQUAD_COEFS("CH1 - Biquad 5", TAS5707_CH1_BQ5_REG), + BIQUAD_COEFS("CH1 - Biquad 6", TAS5707_CH1_BQ6_REG), + + BIQUAD_COEFS("CH2 - Biquad 0", TAS5707_CH2_BQ0_REG), + BIQUAD_COEFS("CH2 - Biquad 1", TAS5707_CH2_BQ1_REG), + BIQUAD_COEFS("CH2 - Biquad 2", TAS5707_CH2_BQ2_REG), + BIQUAD_COEFS("CH2 - Biquad 3", TAS5707_CH2_BQ3_REG), + BIQUAD_COEFS("CH2 - Biquad 4", TAS5707_CH2_BQ4_REG), + BIQUAD_COEFS("CH2 - Biquad 5", TAS5707_CH2_BQ5_REG), + BIQUAD_COEFS("CH2 - Biquad 6", TAS5707_CH2_BQ6_REG), +}; + +static const struct reg_default tas5707_reg_defaults[] = { + {TAS571X_CLK_CTRL_REG, 0x6c}, + {TAS571X_DEV_ID_REG, 0x70}, + {TAS571X_ERR_STATUS_REG, 0x00}, + {TAS571X_SYS_CTRL_1_REG, 0xa0}, + {TAS571X_SDI_REG, 0x05}, + {TAS571X_SYS_CTRL_2_REG, 0x40}, + {TAS571X_SOFT_MUTE_REG, 0x00}, + {TAS571X_MVOL_REG, 0xff}, + {TAS571X_CH1_VOL_REG, 0x30}, + {TAS571X_CH2_VOL_REG, 0x30}, + {TAS571X_VOL_CFG_REG, 0x91}, + {TAS571X_MODULATION_LIMIT_REG, 0x02}, + {TAS571X_IC_DELAY_CH1_REG, 0xac}, + {TAS571X_IC_DELAY_CH2_REG, 0x54}, + {TAS571X_IC_DELAY_CH3_REG, 0xac}, + {TAS571X_IC_DELAY_CH4_REG, 0x54}, + {TAS571X_START_STOP_PERIOD_REG, 0x0f}, + {TAS571X_OSC_TRIM_REG, 0x82}, + {TAS571X_BKND_ERR_REG, 0x02}, + {TAS571X_INPUT_MUX_REG, 0x17772}, + {TAS571X_PWM_MUX_REG, 0x1021345}, +}; + +static const struct regmap_config tas5707_regmap_config = { + .reg_bits = 8, + .val_bits = 32, + .max_register = 0xff, + .reg_read = tas571x_reg_read, + .reg_write = tas571x_reg_write, + .reg_defaults = tas5707_reg_defaults, + .num_reg_defaults = ARRAY_SIZE(tas5707_reg_defaults), + .cache_type = REGCACHE_RBTREE, + .wr_table = &tas571x_write_regs, + .volatile_table = &tas5707_volatile_regs, +}; + +static const struct tas571x_chip tas5707_chip = { + .supply_names = tas5711_supply_names, + .num_supply_names = ARRAY_SIZE(tas5711_supply_names), + .controls = tas5707_controls, + .num_controls = ARRAY_SIZE(tas5707_controls), + .regmap_config = &tas5707_regmap_config, + .vol_reg_size = 1, +}; + static const char *const tas5717_supply_names[] = { "AVDD", "DVDD", @@ -775,6 +883,7 @@ static int tas571x_i2c_remove(struct i2c_client *client) } static const struct of_device_id tas571x_of_match[] = { + { .compatible = "ti,tas5707", .data = &tas5707_chip, }, { .compatible = "ti,tas5711", .data = &tas5711_chip, }, { .compatible = "ti,tas5717", .data = &tas5717_chip, }, { .compatible = "ti,tas5719", .data = &tas5717_chip, }, @@ -784,6 +893,7 @@ static const struct of_device_id tas571x_of_match[] = { MODULE_DEVICE_TABLE(of, tas571x_of_match); static const struct i2c_device_id tas571x_i2c_id[] = { + { "tas5707", (kernel_ulong_t) &tas5707_chip }, { "tas5711", (kernel_ulong_t) &tas5711_chip }, { "tas5717", (kernel_ulong_t) &tas5717_chip }, { "tas5719", (kernel_ulong_t) &tas5717_chip }, diff --git a/sound/soc/codecs/tas571x.h b/sound/soc/codecs/tas571x.h index c45677bc26ad..bd23e89cfe79 100644 --- a/sound/soc/codecs/tas571x.h +++ b/sound/soc/codecs/tas571x.h @@ -53,6 +53,22 @@ #define TAS571X_PWM_MUX_REG 0x25 /* 20-byte biquad registers */ +#define TAS5707_CH1_BQ0_REG 0x29 +#define TAS5707_CH1_BQ1_REG 0x2a +#define TAS5707_CH1_BQ2_REG 0x2b +#define TAS5707_CH1_BQ3_REG 0x2c +#define TAS5707_CH1_BQ4_REG 0x2d +#define TAS5707_CH1_BQ5_REG 0x2e +#define TAS5707_CH1_BQ6_REG 0x2f + +#define TAS5707_CH2_BQ0_REG 0x30 +#define TAS5707_CH2_BQ1_REG 0x31 +#define TAS5707_CH2_BQ2_REG 0x32 +#define TAS5707_CH2_BQ3_REG 0x33 +#define TAS5707_CH2_BQ4_REG 0x34 +#define TAS5707_CH2_BQ5_REG 0x35 +#define TAS5707_CH2_BQ6_REG 0x36 + #define TAS5717_CH1_BQ0_REG 0x26 #define TAS5717_CH1_BQ1_REG 0x27 #define TAS5717_CH1_BQ2_REG 0x28