From patchwork Sat Jan 28 08:27:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 648415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EDBF7C38142 for ; Sat, 28 Jan 2023 08:29:12 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A7BF5E7F; Sat, 28 Jan 2023 09:28:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A7BF5E7F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1674894550; bh=3lOmfp1wu4AxyOyDlBZA74hkP+DAkRXcoMWJ4UhUdsg=; h=From:To:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=nz7MLZOEPMuFjd4SiUrXWqvdQReQo8dEezGCUfNprubF3f3v16nNcA5A5aa6LL+0R KACafSZ1a7LotuCPolUyjcYL+d/TdIjCmd+v/G7aHizWN+KtMUL4cQUvh0ugjo11G1 pIJgdVMzjdrKGcae2D8XNRPmZsr1jZbR3US7tYy4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 08E5DF802DF; Sat, 28 Jan 2023 09:28:20 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 554AFF803DC; Sat, 28 Jan 2023 09:28:13 +0100 (CET) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C14E3F8007C for ; Sat, 28 Jan 2023 09:28:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C14E3F8007C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=shruggie-ro.20210112.gappssmtp.com header.i=@shruggie-ro.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=treD55nf Received: by mail-wr1-x42c.google.com with SMTP id d14so6896351wrr.9 for ; Sat, 28 Jan 2023 00:28:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shruggie-ro.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Y9aJH9dWW+lXIo+m5JL54uJsS21RU2JZM9Wrw00k7No=; b=treD55nfTAfWZWSzKShy9mwzsnfnSBTUoVysbGKxOPj5WmP+dMtEdOv0erz5Ru8obZ ve8E3jwlRM2jPNxYcuWYfnEU/ZeLc4PQqiH4MPEC+9kh6L1Tiapbt4dY8ZvoUucXDCON yF25vNXgq+3/VLPTHAeITAKK8i6LuZlQiQiz3Q+uXdd4AJh9RRhzvX5hTghFcADRkBjn qE3BxHUPakz08NccmMgRaNr2UV1sxqti3MjXD8aFJXkTr/O1mvfADdFFdeEwo300Ero5 de2mt++mgL40B7Pgw4qZKq8FDCN3JXzYITD509DLvTWPsqMShSg3Ayr30Hi+zDHh+Wgh 7W3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Y9aJH9dWW+lXIo+m5JL54uJsS21RU2JZM9Wrw00k7No=; b=RRt+/lXx5/zOxgfw6a9SmDd4ow085VbNxDYhk7MM7jC0TSrpMOD5sM6Vo2TC1Oxksy Jainb8S74Hneure+wExuTVwj7Wmo9MAsLrppiZvbFNIT8SvzmThHqWec+sFQleQ9FK7Q yjRAfrDbDI32vfWpPXQvci8SEEagF4vj3QDN+l0pNvc0gjdjdsSk3SNXLw4NmFCl6Ais BAejLG08l5Mxa1C2Wja/2y6Pon3iDsQqTE7wzTdM1VwytghuPjQ5u76b7yq4MDc+wqq6 uy9RjqnfVcO57llEp546h7CSgAVxl/D1CciUOX4up3aWFaMDmrGzP/NNYskavmdBxiHq hSRQ== X-Gm-Message-State: AFqh2koizKoJYnHAn3BKbJV611RhQKUc9DqBgjQ9kAhOi6/HBEHRHPQL uT3gIepgA4T9p7F8SzZGaqm4IQ== X-Google-Smtp-Source: AMrXdXt9KSRH7+r9cYAHQYj+3AoNx2UKmGCATXuRWMG6WddSwu/BzX2/w+k5ao9JwROWKW6FCOnHYw== X-Received: by 2002:a5d:61c5:0:b0:2bf:9608:57ee with SMTP id q5-20020a5d61c5000000b002bf960857eemr27136437wrv.21.1674894482631; Sat, 28 Jan 2023 00:28:02 -0800 (PST) Received: from neptune.. ([188.27.130.91]) by smtp.gmail.com with ESMTPSA id c17-20020a5d4cd1000000b002bfd52f31f6sm3815338wrt.9.2023.01.28.00.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Jan 2023 00:28:02 -0800 (PST) From: Alexandru Ardelean To: devicetree@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 1/4] ASoC: codecs: tas5720: split a tas5720_mute_soc_component() function Date: Sat, 28 Jan 2023 10:27:41 +0200 Message-Id: <20230128082744.41849-1-alex@shruggie.ro> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: steffen.aschbacher@stihl.de, tiwai@suse.com, lgirdwood@gmail.com, broonie@kernel.org, krzysztof.kozlowski+dt@linaro.org, Alexandru Ardelean Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This is to be re-used in tas5720_mute() (which is part of the dai_ops) and also in the tas5720_fault_check_work() hook. The benefit here isn't too great (now). It's only when we add support for a new device with a slightly different regmap that this becomes more useful. Signed-off-by: Alexandru Ardelean --- Changelog v1 -> v2: - https://lore.kernel.org/alsa-devel/20230115193347.24190-1-alex@shruggie.ro/ - No change sound/soc/codecs/tas5720.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c index 3885c0bf0b01..0587c9bb3c4e 100644 --- a/sound/soc/codecs/tas5720.c +++ b/sound/soc/codecs/tas5720.c @@ -199,9 +199,8 @@ static int tas5720_set_dai_tdm_slot(struct snd_soc_dai *dai, return ret; } -static int tas5720_mute(struct snd_soc_dai *dai, int mute, int direction) +static int tas5720_mute_soc_component(struct snd_soc_component *component, int mute) { - struct snd_soc_component *component = dai->component; int ret; ret = snd_soc_component_update_bits(component, TAS5720_DIGITAL_CTRL2_REG, @@ -214,6 +213,11 @@ static int tas5720_mute(struct snd_soc_dai *dai, int mute, int direction) return 0; } +static int tas5720_mute(struct snd_soc_dai *dai, int mute, int direction) +{ + return tas5720_mute_soc_component(dai->component, mute); +} + static void tas5720_fault_check_work(struct work_struct *work) { struct tas5720_data *tas5720 = container_of(work, struct tas5720_data, @@ -318,8 +322,7 @@ static int tas5720_codec_probe(struct snd_soc_component *component) expected_device_id, device_id); /* Set device to mute */ - ret = snd_soc_component_update_bits(component, TAS5720_DIGITAL_CTRL2_REG, - TAS5720_MUTE, TAS5720_MUTE); + ret = tas5720_mute_soc_component(component, 1); if (ret < 0) goto error_snd_soc_component_update_bits; From patchwork Sat Jan 28 08:27:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 648414 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE20DC27C76 for ; Sat, 28 Jan 2023 08:30:03 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 63228EBD; Sat, 28 Jan 2023 09:29:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 63228EBD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1674894601; bh=3YaWYP5kqSlanXrUpD8/vVOawWUzJQJcnomsOrGkWBk=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=aIIP9DPMLi2AXzJ02hPr8zWa9/vUx7svBaDjVSF8K9i8xIYDXZ+C65U0JzzY+GGtr Usyi5ZegOTDvotZOs9WRfdw56zBk1BpTTRh04zDpRcbCHv8pzighLxOzFcnf8Wn712 /mNOsOmdmVYIRFyua5Kk+t8igVoFKAKjIrC0V8+g= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 78EBAF804D2; Sat, 28 Jan 2023 09:28:28 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EE684F804D2; Sat, 28 Jan 2023 09:28:23 +0100 (CET) Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D1779F8025D for ; Sat, 28 Jan 2023 09:28:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D1779F8025D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=shruggie-ro.20210112.gappssmtp.com header.i=@shruggie-ro.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=Bzl+sEz9 Received: by mail-wr1-x42e.google.com with SMTP id d14so6896375wrr.9 for ; Sat, 28 Jan 2023 00:28:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shruggie-ro.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KUjme+dB/uvO/qUYSJuA9fMzsuN/WcMeFNH8OV1LxL4=; b=Bzl+sEz92i8ub/gdPdqEEgd64Fs00o02F8exX918BOyMJTJnvkfcSLrWm5QYJzCuLx weHsWtZYnZe9lnSqqmW226Gi3xp6YrsSclMScE8hkAI67U3DeYDKGUWSMgIDDy2a8iYk rKf3oBtwYpnizZIkSLn33oGzlnEvUh5I3KnObe+GW9Hcm5VS5UySh53Z+8F/Vix4EJN2 ZeLCZJPk20VVv+4tE/oamihR3KKt67wCyNjhzXG+efMiTuUxAPP7PEPXM0xZRxbqyTjr iuc7/D2/JvDBs8iBfu3/j1e8i6XLkn7Vt4XYC6AvO3rt0lL6TD8xvdSWchZXRgw04skM Tnnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KUjme+dB/uvO/qUYSJuA9fMzsuN/WcMeFNH8OV1LxL4=; b=773Xrnfci52JXNtD57r5mo6Us15a3343Zan8Pi4eMUHFZEKVlRfOTLr659k6En1t5e Da1RJNDwMhgw68xIRxm+kECUCU6wVaFKL7+LMCR93u0QGHgKxRnzv9pLEQ3t5aRmJOEI XP5771bMpkR/25YLmb4zc76OWAudza6kJZJtBJRWrO8d88nkDmz3oc2lfQcBefoGL4yQ iUHWD/F3ehxOZXeQ2g+M2pwueDlj8VyNhY8MF4Hl0zCF+SfSQIdJjKkZBreWSbVVF9LB o5m7pSpbM6q1j2FFV3QHWuSfTLWDqsnE54p4pEJQ2eIDETwccLWBJwxvZTD3HLzh9VQh zZyQ== X-Gm-Message-State: AFqh2kofQGkuZ26zcLUfkxRj+xOsIS/K6D1mR4O59BZkBTNk6kFibkh7 kzbxRJgS0JV+PjSJ+LA5fDw5yA== X-Google-Smtp-Source: AMrXdXv5crLfNXaf4syexFsnufZXwaLfZ1M9W5HFi/xTXolpRyD1tPqavW73bh1d6LgHDMOzpUkB/Q== X-Received: by 2002:a05:6000:a03:b0:2be:7a:c15d with SMTP id co3-20020a0560000a0300b002be007ac15dmr41482498wrb.57.1674894483999; Sat, 28 Jan 2023 00:28:03 -0800 (PST) Received: from neptune.. ([188.27.130.91]) by smtp.gmail.com with ESMTPSA id c17-20020a5d4cd1000000b002bfd52f31f6sm3815338wrt.9.2023.01.28.00.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Jan 2023 00:28:03 -0800 (PST) From: Alexandru Ardelean To: devicetree@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 2/4] ASoC: codecs: tas5720: add support for TAS5720A-Q1 (automotive) variant Date: Sat, 28 Jan 2023 10:27:42 +0200 Message-Id: <20230128082744.41849-2-alex@shruggie.ro> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230128082744.41849-1-alex@shruggie.ro> References: <20230128082744.41849-1-alex@shruggie.ro> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: steffen.aschbacher@stihl.de, tiwai@suse.com, lgirdwood@gmail.com, broonie@kernel.org, krzysztof.kozlowski+dt@linaro.org, Alexandru Ardelean Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Steffen Aschbacher This change adds support the TAS5720A-Q1 audio codec, in the same driver as tas5720. Functionally, this driver is pretty similar to it's TAS5720x variant. The first 3 registers are the same, so the main control and device identification can happen with these registers. The next registers differ. This variant offers control (in the registers) for 2 speakers, which is implemented here (in a basic manner). Signed-off-by: Steffen Aschbacher Signed-off-by: Alexandru Ardelean --- Changelog v1 -> v2: - https://lore.kernel.org/alsa-devel/20230115193347.24190-2-alex@shruggie.ro/ - Removed unused variable 'val' in tas5720_mute_soc_component() - Added missing object 'tas5720' in tas5720_mute_soc_component() sound/soc/codecs/tas5720.c | 104 ++++++++++++++++++++++++++++++++----- sound/soc/codecs/tas5720.h | 15 +++++- 2 files changed, 106 insertions(+), 13 deletions(-) diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c index 0587c9bb3c4e..2ad8fb29d005 100644 --- a/sound/soc/codecs/tas5720.c +++ b/sound/soc/codecs/tas5720.c @@ -30,6 +30,7 @@ enum tas572x_type { TAS5720, + TAS5720A_Q1, TAS5722, }; @@ -166,17 +167,26 @@ static int tas5720_set_dai_tdm_slot(struct snd_soc_dai *dai, return -EINVAL; } - /* Enable manual TDM slot selection (instead of I2C ID based) */ - ret = snd_soc_component_update_bits(component, TAS5720_DIGITAL_CTRL1_REG, - TAS5720_TDM_CFG_SRC, TAS5720_TDM_CFG_SRC); - if (ret < 0) - goto error_snd_soc_component_update_bits; + /* + * Enable manual TDM slot selection (instead of I2C ID based). + * This is not applicable to TAS5720A-Q1. + */ + switch (tas5720->devtype) { + case TAS5720A_Q1: + break; + default: + ret = snd_soc_component_update_bits(component, TAS5720_DIGITAL_CTRL1_REG, + TAS5720_TDM_CFG_SRC, TAS5720_TDM_CFG_SRC); + if (ret < 0) + goto error_snd_soc_component_update_bits; - /* Configure the TDM slot to process audio from */ - ret = snd_soc_component_update_bits(component, TAS5720_DIGITAL_CTRL2_REG, - TAS5720_TDM_SLOT_SEL_MASK, first_slot); - if (ret < 0) - goto error_snd_soc_component_update_bits; + /* Configure the TDM slot to process audio from */ + ret = snd_soc_component_update_bits(component, TAS5720_DIGITAL_CTRL2_REG, + TAS5720_TDM_SLOT_SEL_MASK, first_slot); + if (ret < 0) + goto error_snd_soc_component_update_bits; + break; + } /* Configure TDM slot width. This is only applicable to TAS5722. */ switch (tas5720->devtype) { @@ -201,10 +211,22 @@ static int tas5720_set_dai_tdm_slot(struct snd_soc_dai *dai, static int tas5720_mute_soc_component(struct snd_soc_component *component, int mute) { + struct tas5720_data *tas5720 = snd_soc_component_get_drvdata(component); + unsigned int reg, mask; int ret; - ret = snd_soc_component_update_bits(component, TAS5720_DIGITAL_CTRL2_REG, - TAS5720_MUTE, mute ? TAS5720_MUTE : 0); + switch (tas5720->devtype) { + case TAS5720A_Q1: + reg = TAS5720_Q1_VOLUME_CTRL_CFG_REG; + mask = TAS5720_Q1_MUTE; + break; + default: + reg = TAS5720_DIGITAL_CTRL2_REG; + mask = TAS5720_MUTE; + break; + } + + ret = snd_soc_component_update_bits(component, reg, mask, mute ? mask : 0); if (ret < 0) { dev_err(component->dev, "error (un-)muting device: %d\n", ret); return ret; @@ -309,6 +331,9 @@ static int tas5720_codec_probe(struct snd_soc_component *component) case TAS5720: expected_device_id = TAS5720_DEVICE_ID; break; + case TAS5720A_Q1: + expected_device_id = TAS5720A_Q1_DEVICE_ID; + break; case TAS5722: expected_device_id = TAS5722_DEVICE_ID; break; @@ -474,6 +499,15 @@ static const struct regmap_config tas5720_regmap_config = { .volatile_reg = tas5720_is_volatile_reg, }; +static const struct regmap_config tas5720a_q1_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + + .max_register = TAS5720_MAX_REG, + .cache_type = REGCACHE_RBTREE, + .volatile_reg = tas5720_is_volatile_reg, +}; + static const struct regmap_config tas5722_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -494,6 +528,16 @@ static const DECLARE_TLV_DB_RANGE(dac_analog_tlv, 0x3, 0x3, TLV_DB_SCALE_ITEM(2630, 0, 0), ); +/* + * DAC analog gain for TAS5720A-Q1. There are three discrete values to select from, ranging + * from 19.2 dB to 25.0dB. + */ +static const DECLARE_TLV_DB_RANGE(dac_analog_tlv_a_q1, + 0x0, 0x0, TLV_DB_SCALE_ITEM(1920, 0, 0), + 0x1, 0x1, TLV_DB_SCALE_ITEM(2260, 0, 0), + 0x2, 0x2, TLV_DB_SCALE_ITEM(2500, 0, 0), +); + /* * DAC digital volumes. From -103.5 to 24 dB in 0.5 dB or 0.25 dB steps * depending on the device. Note that setting the gain below -100 dB @@ -540,6 +584,15 @@ static const struct snd_kcontrol_new tas5720_snd_controls[] = { TAS5720_ANALOG_GAIN_SHIFT, 3, 0, dac_analog_tlv), }; +static const struct snd_kcontrol_new tas5720a_q1_snd_controls[] = { + SOC_DOUBLE_R_TLV("Speaker Driver Playback Volume", + TAS5720_Q1_VOLUME_CTRL_LEFT_REG, + TAS5720_Q1_VOLUME_CTRL_RIGHT_REG, + 0, 0xff, 0, tas5720_dac_tlv), + SOC_SINGLE_TLV("Speaker Driver Analog Gain", TAS5720_ANALOG_CTRL_REG, + TAS5720_ANALOG_GAIN_SHIFT, 3, 0, dac_analog_tlv_a_q1), +}; + static const struct snd_kcontrol_new tas5722_snd_controls[] = { SOC_SINGLE_EXT_TLV("Speaker Driver Playback Volume", 0, 0, 511, 0, @@ -577,6 +630,22 @@ static const struct snd_soc_component_driver soc_component_dev_tas5720 = { .endianness = 1, }; +static const struct snd_soc_component_driver soc_component_dev_tas5720_a_q1 = { + .probe = tas5720_codec_probe, + .remove = tas5720_codec_remove, + .suspend = tas5720_suspend, + .resume = tas5720_resume, + .controls = tas5720a_q1_snd_controls, + .num_controls = ARRAY_SIZE(tas5720a_q1_snd_controls), + .dapm_widgets = tas5720_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(tas5720_dapm_widgets), + .dapm_routes = tas5720_audio_map, + .num_dapm_routes = ARRAY_SIZE(tas5720_audio_map), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, +}; + static const struct snd_soc_component_driver soc_component_dev_tas5722 = { .probe = tas5720_codec_probe, .remove = tas5720_codec_remove, @@ -636,6 +705,7 @@ static struct snd_soc_dai_driver tas5720_dai[] = { static const struct i2c_device_id tas5720_id[] = { { "tas5720", TAS5720 }, + { "tas5720a-q1", TAS5720A_Q1 }, { "tas5722", TAS5722 }, { } }; @@ -662,6 +732,9 @@ static int tas5720_probe(struct i2c_client *client) case TAS5720: regmap_config = &tas5720_regmap_config; break; + case TAS5720A_Q1: + regmap_config = &tas5720a_q1_regmap_config; + break; case TAS5722: regmap_config = &tas5722_regmap_config; break; @@ -695,6 +768,12 @@ static int tas5720_probe(struct i2c_client *client) tas5720_dai, ARRAY_SIZE(tas5720_dai)); break; + case TAS5720A_Q1: + ret = devm_snd_soc_register_component(&client->dev, + &soc_component_dev_tas5720_a_q1, + tas5720_dai, + ARRAY_SIZE(tas5720_dai)); + break; case TAS5722: ret = devm_snd_soc_register_component(&client->dev, &soc_component_dev_tas5722, @@ -716,6 +795,7 @@ static int tas5720_probe(struct i2c_client *client) #if IS_ENABLED(CONFIG_OF) static const struct of_device_id tas5720_of_match[] = { { .compatible = "ti,tas5720", }, + { .compatible = "ti,tas5720a-q1", }, { .compatible = "ti,tas5722", }, { }, }; diff --git a/sound/soc/codecs/tas5720.h b/sound/soc/codecs/tas5720.h index 223858f0de71..b38459570241 100644 --- a/sound/soc/codecs/tas5720.h +++ b/sound/soc/codecs/tas5720.h @@ -10,7 +10,7 @@ #ifndef __TAS5720_H__ #define __TAS5720_H__ -/* Register Address Map */ +/* Register Address Map - first 3 regs are common for all variants */ #define TAS5720_DEVICE_ID_REG 0x00 #define TAS5720_POWER_CTRL_REG 0x01 #define TAS5720_DIGITAL_CTRL1_REG 0x02 @@ -27,7 +27,13 @@ #define TAS5722_ANALOG_CTRL2_REG 0x14 #define TAS5722_MAX_REG TAS5722_ANALOG_CTRL2_REG +/* Register Address Map - volume controls for the TAS5720-Q1 variant */ +#define TAS5720_Q1_VOLUME_CTRL_CFG_REG 0x03 +#define TAS5720_Q1_VOLUME_CTRL_LEFT_REG 0x04 +#define TAS5720_Q1_VOLUME_CTRL_RIGHT_REG 0x05 + /* TAS5720_DEVICE_ID_REG */ +#define TAS5720A_Q1_DEVICE_ID 0x00 #define TAS5720_DEVICE_ID 0x01 #define TAS5722_DEVICE_ID 0x12 @@ -53,6 +59,10 @@ #define TAS5720_MUTE BIT(4) #define TAS5720_TDM_SLOT_SEL_MASK GENMASK(2, 0) +/* TAS5720_Q1_VOLUME_CTRL_CFG_REG */ +#define TAS5720_Q1_FADE BIT(7) +#define TAS5720_Q1_MUTE GENMASK(1, 0) + /* TAS5720_ANALOG_CTRL_REG */ #define TAS5720_PWM_RATE_6_3_FSYNC (0x0 << 4) #define TAS5720_PWM_RATE_8_4_FSYNC (0x1 << 4) @@ -70,6 +80,9 @@ #define TAS5720_ANALOG_GAIN_MASK GENMASK(3, 2) #define TAS5720_ANALOG_GAIN_SHIFT (0x2) +/* TAS5720_Q1_ANALOG_CTRL_REG */ +#define TAS5720_Q1_CHAN_SEL BIT(1) + /* TAS5720_FAULT_REG */ #define TAS5720_OC_THRESH_100PCT (0x0 << 4) #define TAS5720_OC_THRESH_75PCT (0x1 << 4) From patchwork Sat Jan 28 08:27:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 647973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 09C60C27C76 for ; Sat, 28 Jan 2023 08:29:41 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 08A02ED0; Sat, 28 Jan 2023 09:28:49 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 08A02ED0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1674894579; bh=m9SCHIjomCFY5c7SdHttCipGG7sk/WyZKNvM4n6MjHc=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=TdNTMivrPNpbhFr73zewY6TBBHHn6QEC2Lm+jquCk/RAqGmq3Q9pJknOrWV6pnSla /I8V0QuC7MgtZApzty9dLKZVhXF992ArCmpG47CkXgG1upAjFJSVRTnBFtQIfVxPHF cWtjtu53OXW2L6I0cXZfme7LVe0rCTKaXDhx5xu8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D39AFF8025D; Sat, 28 Jan 2023 09:28:27 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9D699F8030F; Sat, 28 Jan 2023 09:28:16 +0100 (CET) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E83F6F8027D for ; Sat, 28 Jan 2023 09:28:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E83F6F8027D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=shruggie-ro.20210112.gappssmtp.com header.i=@shruggie-ro.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=cHeIIXHM Received: by mail-wr1-x429.google.com with SMTP id a3so209670wrt.6 for ; Sat, 28 Jan 2023 00:28:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shruggie-ro.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4YjpP2wq6+ACjqyzhOFcNXJo9yIAHLd5oTDFkJ5vDJI=; b=cHeIIXHM4bx0Is3aXKU0uDRppZwmHutmnygekfW361UPV0o049tzog/tnrlz+T0uxz 45480jh5NQjEXaNuVHJ4aQZZAj3qW2jm6DV/o35i72+PIU5Lu6yJTuT2AbXgDV7tssE6 HZ1Yq5Fx/r/4U8A8fu7VG7dee4wql+LJiRgM1KfJrjFYmcUT3N5Kr9N0u8CnDG4isdAf 0riz/NXLyCy45OwIXEt1F8BFw3vsoNNIBuOuvRgWrblBobf1jaLpEwd5N5LRZ5C94792 a9f+caVK0fa7uZibFLzVCqe2FegbCRhAaIIBN5mAmv8UIAX/dco33j66T+pnR+vjiNUx BKiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4YjpP2wq6+ACjqyzhOFcNXJo9yIAHLd5oTDFkJ5vDJI=; b=TY05FFhvAtyIm4TpvVM4cyiUIic2+K0s0n0fPhd00v0ZGuWluZKTFrN3myd0fprayl DIifqJw2o9BZs9AvBt8OQl7+x84dTe2WVNgr6nujFxztJUI0e+TaOgxDAaRDcp+y3KyU bdeAGA5mNmvprPxdqKkXW6dq4P85nehVl9GXDt9dLiytga/4kEmfRLJAtukTHOF2l2Nk Om4mTGX4P7rWkuzwxpOm0Dt89hy0/DtLv5l1laijaSfuASiqEzYqr1lXgJi4ow7fRYyj 75y2oWDZ1V6Tt9J7+BaQ4SoIypJ5GlDwlcupJrD4dMqmpRyD6tTxWuKOjLeGVgqrqbwo hgjQ== X-Gm-Message-State: AO0yUKUIYy6wQK08PyTYuSGsnCrSzwKk7lCY8vgh0HMsv2QJOzd4Ghlz 3bX5T3s2AxPaEjtw5Q3axJp+Kg== X-Google-Smtp-Source: AK7set/odpPYKeDI4Gh3Vd6c879W5kwr82f80JtMSa7PjyX5HpudarZJ3fBJJU2wChXc+YL0x2Xldg== X-Received: by 2002:a5d:4ac5:0:b0:2bf:c0f2:4b0 with SMTP id y5-20020a5d4ac5000000b002bfc0f204b0mr10197056wrs.19.1674894485169; Sat, 28 Jan 2023 00:28:05 -0800 (PST) Received: from neptune.. ([188.27.130.91]) by smtp.gmail.com with ESMTPSA id c17-20020a5d4cd1000000b002bfd52f31f6sm3815338wrt.9.2023.01.28.00.28.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Jan 2023 00:28:04 -0800 (PST) From: Alexandru Ardelean To: devicetree@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 3/4] ASoC: tas5720: set bit 7 in ANALOG_CTRL_REG for TAS5720A-Q1 during probe Date: Sat, 28 Jan 2023 10:27:43 +0200 Message-Id: <20230128082744.41849-3-alex@shruggie.ro> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230128082744.41849-1-alex@shruggie.ro> References: <20230128082744.41849-1-alex@shruggie.ro> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: steffen.aschbacher@stihl.de, tiwai@suse.com, lgirdwood@gmail.com, broonie@kernel.org, krzysztof.kozlowski+dt@linaro.org, Alexandru Ardelean Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Steffen Aschbacher Set the reserved bit 7 in the ANALOG_CTRL_REG for the TAS5720A-Q1 device, when probing. The datasheet mentions that the bit should be 1 during reset/powerup. The device did not initialize before setting this value to 1. So, this could be a quirk of this device. Or it could be a quirk with the board on which it was tested. That is why this patch is separate from the patch that adds support for the TAS5720A-Q1 device. Signed-off-by: Steffen Aschbacher Signed-off-by: Alexandru Ardelean --- Changelog v1 -> v2: - https://lore.kernel.org/alsa-devel/20230115193347.24190-3-alex@shruggie.ro/ - No change sound/soc/codecs/tas5720.c | 13 +++++++++++++ sound/soc/codecs/tas5720.h | 1 + 2 files changed, 14 insertions(+) diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c index 2ad8fb29d005..de6d01c8fdd3 100644 --- a/sound/soc/codecs/tas5720.c +++ b/sound/soc/codecs/tas5720.c @@ -351,6 +351,19 @@ static int tas5720_codec_probe(struct snd_soc_component *component) if (ret < 0) goto error_snd_soc_component_update_bits; + /* Set Bit 7 in TAS5720_ANALOG_CTRL_REG to 1 for TAS5720A_Q1 */ + switch (tas5720->devtype) { + case TAS5720A_Q1: + ret = snd_soc_component_update_bits(component, TAS5720_ANALOG_CTRL_REG, + TAS5720_Q1_RESERVED7_BIT, + TAS5720_Q1_RESERVED7_BIT); + break; + default: + break; + } + if (ret < 0) + goto error_snd_soc_component_update_bits; + /* * Enter shutdown mode - our default when not playing audio - to * minimize current consumption. On the TAS5720 there is no real down diff --git a/sound/soc/codecs/tas5720.h b/sound/soc/codecs/tas5720.h index b38459570241..54b59b05ef0a 100644 --- a/sound/soc/codecs/tas5720.h +++ b/sound/soc/codecs/tas5720.h @@ -81,6 +81,7 @@ #define TAS5720_ANALOG_GAIN_SHIFT (0x2) /* TAS5720_Q1_ANALOG_CTRL_REG */ +#define TAS5720_Q1_RESERVED7_BIT BIT(7) #define TAS5720_Q1_CHAN_SEL BIT(1) /* TAS5720_FAULT_REG */ From patchwork Sat Jan 28 08:27:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 647972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 23C05C38142 for ; Sat, 28 Jan 2023 08:30:12 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 150A6EE8; Sat, 28 Jan 2023 09:29:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 150A6EE8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1674894610; bh=3B3vkN1sWvv+jJA+eruD391VnHkUWkeJjdq7x5rYycE=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=A/MGpaEYZqlFbHenYWZZ5ThVpQOP3rGzFu15hvH+I3/s/JiifrtTGKDpgdLqrmkYK ol2+N2/wnA9XO3dHCgqoKVwQrORzA6qLDMNY4vKjmg98KTtC0EB7CwTXK35d08iRpd jQDNbAwRSwBK8ZnG+4cArMormWf/BXdEG68uPgv8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F3F98F80544; Sat, 28 Jan 2023 09:28:29 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 91BB6F803DC; Sat, 28 Jan 2023 09:28:26 +0100 (CET) Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 42880F80171 for ; Sat, 28 Jan 2023 09:28:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 42880F80171 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=shruggie-ro.20210112.gappssmtp.com header.i=@shruggie-ro.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=rZT95hm6 Received: by mail-wr1-x42b.google.com with SMTP id a3so209697wrt.6 for ; Sat, 28 Jan 2023 00:28:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shruggie-ro.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9lMGU9rK9OB+8LEnGHVaRIc7MkDB7sJchlMUQDFM0y0=; b=rZT95hm6VQ/dlTbnr5z6N8UBMsvLchadHMEBFMV2XBGkUsGHD/QU6n79nClcObpn1F kZ1u7qoE3HHGHLdTExOQbKq7fxX4xpw8sX8reg/4wxQW+49VnNTttFu9WUrrj8ngtazc R2v+fAQSFD9IG/M0OLBdTYCZuttfeKyGCycpWAtJe6HehLpKcjFotFzo3UPgVerWsPzN /LY+EaIdi0bowkLb2llHseF+GLlumd1HYKjnbB/GSTUBF3Hzq5xkrqCYUS1jpFOj6TH+ 4godhj/H9s6ABtxRHD2vJop06pBMu5Thhw0NHswBxuXH5oatFwHLtni0/S2wjkM3weK5 CJZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9lMGU9rK9OB+8LEnGHVaRIc7MkDB7sJchlMUQDFM0y0=; b=31uctuJ76CMvSxReAO2b+EbeMsH8tizF0crZgXcABbUdWXcy8FguGdd+bM+FhAqjzF EEQasb9HCa/jODMKgOQ6EWdKEcgBqChEsUlq8CQEy0NSSpJ9xYyrBAZymrVh92f3VxLY UPjejnrtsrKmjIRzeumfxUKB8zJHxGtFBonh2TWdjO72KQhzMJ3L3CMC83X1a03PKYj+ cbByFNahFxiFwwtyIfA2nIoV9dOARoAzxPbo81WLeT1qiSuaITfNwWG6e1CmxXVlm4cl iu9fDBmOiZz4/L2QTN3WKEC+6HlPqNyZ1yXMXDxkL9j/PvRbTtGzKH5C4q4xUSbdyaGm 0esQ== X-Gm-Message-State: AO0yUKWHn9EU7XyV9EI9kHBdjEbUmbWW6FAo64j0P6+s98Jl23VmyJmk Q7CevqRP4i11WZbde+T2/MZmiw== X-Google-Smtp-Source: AK7set9oxXFIdFSQ0KSzUdDUbKWvmM3nTWEb9JSr0orKabeTKM8Oto3DClgUXqezk8BKyXibl5ayZg== X-Received: by 2002:adf:ffcf:0:b0:2bf:c134:befc with SMTP id x15-20020adfffcf000000b002bfc134befcmr8591012wrs.18.1674894486339; Sat, 28 Jan 2023 00:28:06 -0800 (PST) Received: from neptune.. ([188.27.130.91]) by smtp.gmail.com with ESMTPSA id c17-20020a5d4cd1000000b002bfd52f31f6sm3815338wrt.9.2023.01.28.00.28.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Jan 2023 00:28:05 -0800 (PST) From: Alexandru Ardelean To: devicetree@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 4/4] ASoC: dt-bindings: add entry for TAS5720A-Q1 driver Date: Sat, 28 Jan 2023 10:27:44 +0200 Message-Id: <20230128082744.41849-4-alex@shruggie.ro> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230128082744.41849-1-alex@shruggie.ro> References: <20230128082744.41849-1-alex@shruggie.ro> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: steffen.aschbacher@stihl.de, tiwai@suse.com, lgirdwood@gmail.com, Krzysztof Kozlowski , broonie@kernel.org, krzysztof.kozlowski+dt@linaro.org, Alexandru Ardelean Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Steffen Aschbacher Add entry for the TAS5720A-Q1 driver in the dt-bindings doc. Acked-by: Krzysztof Kozlowski Signed-off-by: Steffen Aschbacher Signed-off-by: Alexandru Ardelean --- Changelog v1 -> v2: - https://lore.kernel.org/alsa-devel/20230115193347.24190-4-alex@shruggie.ro/ - Added Krzysztof's Acked-by tag Documentation/devicetree/bindings/sound/tas5720.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/tas5720.txt b/Documentation/devicetree/bindings/sound/tas5720.txt index df99ca9451b0..7d851ae2bba2 100644 --- a/Documentation/devicetree/bindings/sound/tas5720.txt +++ b/Documentation/devicetree/bindings/sound/tas5720.txt @@ -6,11 +6,13 @@ audio playback. For more product information please see the links below: https://www.ti.com/product/TAS5720L https://www.ti.com/product/TAS5720M +https://www.ti.com/product/TAS5720A-Q1 https://www.ti.com/product/TAS5722L Required properties: - compatible : "ti,tas5720", + "ti,tas5720a-q1", "ti,tas5722" - reg : I2C slave address - dvdd-supply : phandle to a 3.3-V supply for the digital circuitry