From patchwork Thu Nov 18 07:06:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626075 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22410C433F5 for ; Thu, 18 Nov 2021 07:09:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 55B1C6138D for ; Thu, 18 Nov 2021 07:09:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 55B1C6138D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C4BA618B1; Thu, 18 Nov 2021 08:08:31 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C4BA618B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219361; bh=Q35Kbv+b/Ze3CYUQLWWHBZQtrzvoVmy0FF8iI1s4a0E=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OoJAk/aJk+jeDtBzku9CXZ/slpTAfbE07sJ5TQgWyPZVOKC5GqvGG4jpt4WXkFQU4 wPx5rqcG/MYgWqy8xvcsrouOZVloauz8gE0FtDMJzQH2bQ7jkRtWypPLj856RwHyMg PAsR097h0K+cvj5tSJpOenh4b/mCX+4u3PR0e4z0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 31D1EF804D6; Thu, 18 Nov 2021 08:07:49 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B8AC1F804D6; Thu, 18 Nov 2021 08:07:44 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2085.outbound.protection.outlook.com [40.107.93.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3010AF80115 for ; Thu, 18 Nov 2021 08:07:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3010AF80115 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="GWJq+xdW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZsWOOK74Vl0MAl33avV4yBX1yG1JXsGkQroy1N70Ea/R/DewnRVeftaNp6AXVUH3NcxGL/jwls4e/J6p92rNIuLC6tSse4BVD9hCmkOeXK+EJBh5u3tQMoLtlWN8cFlrP5tPVe/xmrjTik0ssgHYe6poyUy1g6n8asdCOw/9geU2gidq3QhsKzlKInUI53N1r9b4q0PwFzrFbGzhfpMgfYVEs9jtj/uniEQstz7JxFjRqEbVukvIothCqQ3tSNPOnckixaz0KalMDeIF6UiQpyurGUHHUbVsJ+raIOO1B7jgesGPPBuio2ASwzBLrxYNXO/z0etzjS+vFFGDcjNkdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZH6DmP+YK97sU7+9CBpXUI1T4uB1MtrtKVEuznSRq6c=; b=HpkNE0fUHLs4MaW/u/ncDbNIRIQTPbPvrnCg0ljPaFVUr5JOQVVsLJ8885KmyLeiXAbH6DViTuYU6OD735O0axFHRlWxjCjvTaz/VpL8arYGB6Q1WVXXJUFBpVBeil9kTrrx7IvHedds2jFEbjuoxRdP9sYkDK9S4ZQs+QIaCq0HiFGUq10whjKN8wG02/Jlztee2QBRkYA3ZPrv98lRFe6CzDjbPXcQYSnpqwvYsxFmuvwDkadgZlyRZo65hwgrKE9AE7dVmIi5aErtynf02EM58TJdv+UFm/RhYMXZGdbwCm7HaHbxFURP0MVOzve7JZLh6LCzgNPsRgwqDNyt5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZH6DmP+YK97sU7+9CBpXUI1T4uB1MtrtKVEuznSRq6c=; b=GWJq+xdWkNRJOEGZzDc81o4aese7H+wrQjxr26/pb1noS/wIATRP5SRUWeYFLfKiIiXEMK0LEsuHCzTIUyLTULas6VEBjW3Sz3cyrU13SsVrs0vNd2t+gJDqEiig49yM3Pz5ZpOtpRpm0G9N2sAyYtqrc1O2mtP6AW1M7IK5+BA0B9F9QCdsiAgvaieRMBYkhVQK5D5UyI9lYoOHS9/AKuseOCZsZ3qp6NGSkJXD/pyaLa1aTNgNvyJYeNThICEzFvzsVrym0PRJNsmfIYU8p/QVVkV3GiSc0nT3tYENAjpSZdX45e9yWaS2x/2iQLMDGiQVVYpGDWlwDnSJw0XaFg== Received: from BN9PR03CA0608.namprd03.prod.outlook.com (2603:10b6:408:106::13) by MN2PR12MB2863.namprd12.prod.outlook.com (2603:10b6:208:103::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22; Thu, 18 Nov 2021 07:07:29 +0000 Received: from BN8NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::7) by BN9PR03CA0608.outlook.office365.com (2603:10b6:408:106::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 07:07:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by BN8NAM11FT050.mail.protection.outlook.com (10.13.177.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:07:28 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 17 Nov 2021 23:07:27 -0800 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:07:24 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 01/16] ASoC: tegra: Fix wrong value type in ADMAIF Date: Thu, 18 Nov 2021 12:36:56 +0530 Message-ID: <1637219231-406-2-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a31ad3e2-e580-4d20-f4cc-08d9aa621519 X-MS-TrafficTypeDiagnostic: MN2PR12MB2863: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ErcfxqCjhbyYkkeGSq2nHgFn2dRb4YR+CQXHy9p42zHy20m7FERZ/B9UvxtUf2eCIqoDG/2uKOQXgIVp0RQMdzZ8jx9iLiXbW92BoafXBGT8BuEhn/AN1dUu40E5eLpPRhFVZBtZ2dBg8oyMpBGqsoDlvNogFbw2OGInp2wJaMZfFXV90UZbhmhJ7EXcX3SbkJ4JkbpRd0K4qM2ktSITPj+H3jhU8iJlcsaIsycoYVwX5/ziZaTWnljcLJPXJ6sC1RHTZoiyz+J4rx1QQIj6YhFU/LhyyvwokLOlpstS97FtDDTPvxYfPyCKTkenurSvN41qX32u81UnDVqKkG2KIpqrIEYUZ6TaTZkeQX7xfgqXSj+7xorGoR0mGPqiS99MAGmKANPwNHaEjJR1TwNJ6V1uAjAoag+WRJGacIwR5v2nGaKuSwWLXbhY1KmAkSRSfeXJxhN/c1WDWSa7ryTEiQz/62WxbFsXypqM7dU94jrLlNKZuTqNQ7VLJsn3lyyULs2ftKo+K7rPnGiKMIw7m04xX3NCunay6phRxXclFhtjRZwRG5RtgihNw6aKDiL9r0Mxvn6395g9huAHpc7HwMpbTPR4nqIljzYdMj1kgM3Ju9nWw4FPEjMQWGuE/+NLD745WYMlnoa3lhczZ94rcgUASdLMaTj+svUrBGZfAReIliQVXz9P/wtxBE67dVBvGGSJTNZZAoobJ0u32WVy6Q== X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(82310400003)(36756003)(70586007)(47076005)(86362001)(7636003)(70206006)(356005)(83380400001)(4326008)(2616005)(107886003)(426003)(5660300002)(336012)(26005)(36860700001)(8936002)(7696005)(316002)(54906003)(110136005)(2906002)(6666004)(186003)(8676002)(508600001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:07:28.5586 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a31ad3e2-e580-4d20-f4cc-08d9aa621519 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2863 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The enum controls are expected to use enumerated value type. Update relevant references in control get/put callbacks. Fixes: f74028e159bb ("ASoC: tegra: Add Tegra210 based ADMAIF driver") Suggested-by: Takashi Iwai Signed-off-by: Sameer Pujar --- sound/soc/tegra/tegra210_admaif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/tegra/tegra210_admaif.c b/sound/soc/tegra/tegra210_admaif.c index bcccdf3..6febe80 100644 --- a/sound/soc/tegra/tegra210_admaif.c +++ b/sound/soc/tegra/tegra210_admaif.c @@ -430,7 +430,7 @@ static int tegra_admaif_get_control(struct snd_kcontrol *kcontrol, struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; struct tegra_admaif *admaif = snd_soc_component_get_drvdata(cmpnt); - long *uctl_val = &ucontrol->value.integer.value[0]; + unsigned int *uctl_val = &ucontrol->value.enumerated.item[0]; if (strstr(kcontrol->id.name, "Playback Mono To Stereo")) *uctl_val = admaif->mono_to_stereo[ADMAIF_TX_PATH][ec->reg]; @@ -450,7 +450,7 @@ static int tegra_admaif_put_control(struct snd_kcontrol *kcontrol, struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; struct tegra_admaif *admaif = snd_soc_component_get_drvdata(cmpnt); - int value = ucontrol->value.integer.value[0]; + unsigned int value = ucontrol->value.enumerated.item[0]; if (strstr(kcontrol->id.name, "Playback Mono To Stereo")) admaif->mono_to_stereo[ADMAIF_TX_PATH][ec->reg] = value; From patchwork Thu Nov 18 07:06:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626079 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EEE0C433F5 for ; Thu, 18 Nov 2021 07:09:58 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C9A546115C for ; Thu, 18 Nov 2021 07:09:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C9A546115C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 32DA118C0; Thu, 18 Nov 2021 08:09:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 32DA118C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219396; bh=zHWP1ApygB2X35SYSRxdWP66XTHpopMj2Idhkvxi+EQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bWlQDBHRw0KPk5Rn3/xDUKUB7d2zD8yyAW1fTSrLzy8I/oy36JXkE0umLjFXLr6lN xppcMQe9LXDSIVYCA3Q0zCjwaY+FKwdDqXDIcbm+JuScKz7y8UWt4S2WJpSweUljmC iH3VVhKA4p4SwGFJ2St763kYdvJV/Jo1SJgE9sgE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 10291F80508; Thu, 18 Nov 2021 08:08:01 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 51E91F80507; Thu, 18 Nov 2021 08:07:55 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2074.outbound.protection.outlook.com [40.107.94.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C3170F80115 for ; Thu, 18 Nov 2021 08:07:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C3170F80115 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="RUpYTkF1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bwVAEf2U3qII/jGdApytODATtMpdu4M6LXOin0xBJcsPR706fu2m0SrCnXifmVrPyCr/SzrEAuSwsr3AauFAjEILby6PjWCy4ALlkS33hqZHoNYIjyWY0UWLZfX4DXjVoQ4WTYKjqA0wZ+rU1yyrwoVBgOm31korrWFiEDMkQc8hGQTj8oJjEjqDw3ZegHhINIPHrnzT3fabK7TXTjNp/3fVtpsINDiuoIkM+fT7pV+8/npVdzfbkCTstvFzxiKcBM5abxFXJ8foxlwWwP5yMCYOAc+6oY0lh+lz9est/1DPXveDdwxCBu9OPHF53dkiN44nKZaUCcURr8QCQXqYFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sM15j5fzhraL0w4q+XcwRI6QqWGkPBkP5384VGUNAKA=; b=i5KSQ8BXOr9/fUVeltMkESwKgRjyG8yCL402Rghz1dHuu+H/JKws2kry9ZxY3yO4yoqhWxV6dsD4qgmdTJPvOQDbrBPzPdFvX85a0rwE/a6yWMkhWWisUGOuTZ1rs4ebCtnkrUFh+ffNY4k+x9srDBb4QggLpP+4uqdwqpawzGxBShdW05DUK8tjNcLcuueFUT72lYLVAyPHw7/QE2AL2BEarHAG2zjnvYKS5Hkf1vu2F/foAM7UlqAeYtKOAHIp9Dr3GK+aZDT412yW6FD5YB3RI2oMNcbyFO4hBebdMOl39VT1gElpH/S1RV5eoqH6sc5vgY0XJXhHvQkYaq8SqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=perex.cz smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sM15j5fzhraL0w4q+XcwRI6QqWGkPBkP5384VGUNAKA=; b=RUpYTkF1mmQV8FG7zeV6zU5UmUusWF4ut3835dDW6gZsuURIU1GbBIjGfnfj6rw5OB/WHdkySVQfv/jlaZiTgYeABBFFTjfBPKR3s7raeQXF3ueiUd/GvkH2fHZDd4dA/iTWK/Up4jhLvDfO7o+81OVWKUDVlgPj6cYaH7h77Sogb6cLCRMTlsUZjX97kKU2XtfTYJBiIrcChKgD/Esk5nh55RlJ/eqrzN8+lrWTe585x310MPqAuZEwkQPP0NUAV1kJP699eUcfihfBrNRWj1cQf9NqejMuOACAAWEIpbGQnwtnT6UBG7qNL8kgK+wfNdmKI5JJhPSum8+Ps8kswg== Received: from MW2PR2101CA0023.namprd21.prod.outlook.com (2603:10b6:302:1::36) by DM6PR12MB3882.namprd12.prod.outlook.com (2603:10b6:5:149::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Thu, 18 Nov 2021 07:07:38 +0000 Received: from CO1NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:302:1:cafe::26) by MW2PR2101CA0023.outlook.office365.com (2603:10b6:302:1::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.11 via Frontend Transport; Thu, 18 Nov 2021 07:07:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT005.mail.protection.outlook.com (10.13.174.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:07:37 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:07:30 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:07:30 +0000 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:07:27 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 02/16] ASoC: tegra: Fix wrong value type in I2S Date: Thu, 18 Nov 2021 12:36:57 +0530 Message-ID: <1637219231-406-3-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 598ccb96-473f-4338-0993-08d9aa621a70 X-MS-TrafficTypeDiagnostic: DM6PR12MB3882: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:854; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yvcHil9Ye2PFtpnftZya1JeZk5IZBo07KkXIpUrJO23r509eUwmDSlTEGZltxAiLfUoZiCF2shNvFI7X2jwnOfsBS+hEVMHJldzZhKvmRITGQImTGMb44v6HdQWhaj5aFfus0BEq2pJzG68vsEAX6Tqg4p+KCO4OMb5x6tioomCcQPb6G0CBxwrS+x5BAT3OAvmbRoSIAGKksPqAp7PysOor3PzmJiaPwi0AtGXlCwjrbkKpF/eKhkFp3GpXY7XArMpeQuZIUMgVfv6ITX+m6pJu5j9rC2C5dzHUmgK4t2JzGJJHcooqwnCnmlBN6i+KuRjHUITYETMLe1YnEosKaz9WwPXN6+2L7vfkfnATRanrCtV0HHiyEaPYKASPv4JHFKLtC5fS8TGHD2wHtKx1I5v14xu0QQKiUU2F8LJxVqaNinmMCIkWByItn0TmWHXsiKOiRwrmYHXDZKVEnzrjIzM7WFjojDt/jJzRB9mrh2UFLkq0+wS4BQX6jYhtHqrx8kx7Ex07QOXo+RwKZWjlaYBEYH8xKS3J2ope7UtIu7TYV61iJw7oIrlUG76CTQpJ7DE1EX7KhdyTcjF5dlsHGBzLB0/uuZZmyP021OBAGknmaVaCdEe+SQO8BrorrMji6tcRZ0pqwZ1rgZ1/XxSz7Ot9f0jBqU8KJPIV7GZTUqT6PmN8pOFTBNxsiiq0lR5FcBRM80XZWKiFRDB/ZyjOxg== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(6666004)(83380400001)(36906005)(8676002)(86362001)(107886003)(356005)(54906003)(316002)(47076005)(186003)(70586007)(26005)(70206006)(36756003)(508600001)(4326008)(110136005)(2906002)(426003)(2616005)(8936002)(336012)(5660300002)(7636003)(82310400003)(7696005)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:07:37.5013 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 598ccb96-473f-4338-0993-08d9aa621a70 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3882 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The enum controls are expected to use enumerated value type. Update relevant references in control get/put callbacks. Fixes: c0bfa98349d1 ("ASoC: tegra: Add Tegra210 based I2S driver") Suggested-by: Takashi Iwai Signed-off-by: Sameer Pujar --- sound/soc/tegra/tegra210_i2s.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/sound/soc/tegra/tegra210_i2s.c b/sound/soc/tegra/tegra210_i2s.c index 45f31cc..5c30461 100644 --- a/sound/soc/tegra/tegra210_i2s.c +++ b/sound/soc/tegra/tegra210_i2s.c @@ -317,24 +317,27 @@ static int tegra210_i2s_get_control(struct snd_kcontrol *kcontrol, { struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); - long *uctl_val = &ucontrol->value.integer.value[0]; if (strstr(kcontrol->id.name, "Loopback")) - *uctl_val = i2s->loopback; + ucontrol->value.integer.value[0] = i2s->loopback; else if (strstr(kcontrol->id.name, "FSYNC Width")) - *uctl_val = i2s->fsync_width; + ucontrol->value.integer.value[0] = i2s->fsync_width; else if (strstr(kcontrol->id.name, "Capture Stereo To Mono")) - *uctl_val = i2s->stereo_to_mono[I2S_TX_PATH]; + ucontrol->value.enumerated.item[0] = + i2s->stereo_to_mono[I2S_TX_PATH]; else if (strstr(kcontrol->id.name, "Capture Mono To Stereo")) - *uctl_val = i2s->mono_to_stereo[I2S_TX_PATH]; + ucontrol->value.enumerated.item[0] = + i2s->mono_to_stereo[I2S_TX_PATH]; else if (strstr(kcontrol->id.name, "Playback Stereo To Mono")) - *uctl_val = i2s->stereo_to_mono[I2S_RX_PATH]; + ucontrol->value.enumerated.item[0] = + i2s->stereo_to_mono[I2S_RX_PATH]; else if (strstr(kcontrol->id.name, "Playback Mono To Stereo")) - *uctl_val = i2s->mono_to_stereo[I2S_RX_PATH]; + ucontrol->value.enumerated.item[0] = + i2s->mono_to_stereo[I2S_RX_PATH]; else if (strstr(kcontrol->id.name, "Playback FIFO Threshold")) - *uctl_val = i2s->rx_fifo_th; + ucontrol->value.integer.value[0] = i2s->rx_fifo_th; else if (strstr(kcontrol->id.name, "BCLK Ratio")) - *uctl_val = i2s->bclk_ratio; + ucontrol->value.integer.value[0] = i2s->bclk_ratio; return 0; } @@ -344,10 +347,9 @@ static int tegra210_i2s_put_control(struct snd_kcontrol *kcontrol, { struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); - int value = ucontrol->value.integer.value[0]; if (strstr(kcontrol->id.name, "Loopback")) { - i2s->loopback = value; + i2s->loopback = ucontrol->value.integer.value[0]; regmap_update_bits(i2s->regmap, TEGRA210_I2S_CTRL, I2S_CTRL_LPBK_MASK, @@ -362,24 +364,28 @@ static int tegra210_i2s_put_control(struct snd_kcontrol *kcontrol, * cases mixer control is used to update custom values. A value * of "N" here means, width is "N + 1" bit clock wide. */ - i2s->fsync_width = value; + i2s->fsync_width = ucontrol->value.integer.value[0]; regmap_update_bits(i2s->regmap, TEGRA210_I2S_CTRL, I2S_CTRL_FSYNC_WIDTH_MASK, i2s->fsync_width << I2S_FSYNC_WIDTH_SHIFT); } else if (strstr(kcontrol->id.name, "Capture Stereo To Mono")) { - i2s->stereo_to_mono[I2S_TX_PATH] = value; + i2s->stereo_to_mono[I2S_TX_PATH] = + ucontrol->value.enumerated.item[0]; } else if (strstr(kcontrol->id.name, "Capture Mono To Stereo")) { - i2s->mono_to_stereo[I2S_TX_PATH] = value; + i2s->mono_to_stereo[I2S_TX_PATH] = + ucontrol->value.enumerated.item[0]; } else if (strstr(kcontrol->id.name, "Playback Stereo To Mono")) { - i2s->stereo_to_mono[I2S_RX_PATH] = value; + i2s->stereo_to_mono[I2S_RX_PATH] = + ucontrol->value.enumerated.item[0]; } else if (strstr(kcontrol->id.name, "Playback Mono To Stereo")) { - i2s->mono_to_stereo[I2S_RX_PATH] = value; + i2s->mono_to_stereo[I2S_RX_PATH] = + ucontrol->value.enumerated.item[0]; } else if (strstr(kcontrol->id.name, "Playback FIFO Threshold")) { - i2s->rx_fifo_th = value; + i2s->rx_fifo_th = ucontrol->value.integer.value[0]; } else if (strstr(kcontrol->id.name, "BCLK Ratio")) { - i2s->bclk_ratio = value; + i2s->bclk_ratio = ucontrol->value.integer.value[0]; } return 0; From patchwork Thu Nov 18 07:06:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626103 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48453C433EF for ; Thu, 18 Nov 2021 07:13:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C0CDE611C5 for ; Thu, 18 Nov 2021 07:13:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C0CDE611C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2F8F918B1; Thu, 18 Nov 2021 08:13:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2F8F918B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219634; bh=yR5DpmWeUmayEa9qzSb8kLGzz0mEtNWC4TzsrJHl/LM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=mMGeeRbeikv5EHFUCxZQ0gN3pTyqoigfanTCqTg8/icGIlVxFz60poaC8NoLXZF2h AHUDUfWk2T4hZI0CtUpGJo4V2nosgRLMTnk8DorSP7nO8/M31B/uMDFaXvvj0kfSWk 2cClxFrZOK/GGHKagPEQ0voGatU8H67V9lFxRb2U= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 33D22F804E7; Thu, 18 Nov 2021 08:10:00 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0D1ACF8026D; Thu, 18 Nov 2021 08:09:36 +0100 (CET) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2065.outbound.protection.outlook.com [40.107.102.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6F5F2F8010B for ; Thu, 18 Nov 2021 08:07:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6F5F2F8010B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="DZfinv6i" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i1qGA0XtIJ5WtzHLrhy7wbPXS9y5lLBi1zabJntd45r46f6AZYZkt/IkETKxB9lxPfGcqb9/k5WJeFuyTrU9N/1oKhZuGzt3037zoHb+9VU5CqVMF3eVCa9eLYTD6AanEFN0F81iKbOvxb6X90raSqiCBAXfYGxtMF9atY/ijChuyvFqNmKWuDJ4GM7WaOg6QUPeENlHZN6PzncyuGlZ71eHmKk1h1vCuKsO7YDC7CiS/SJXgOhYec2BTlgx3ng5T6ckMRLW9EeLwlYBBdmQmSjgf8gOLNnfvQ2YjEG778Dp/rdNf4gie5KbuOaX+CrFiwAhPhsvYEgUxwJ+HmxVdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mV0HxFpFjFVpO1xM9KtS6UhVlBJntxLrhxEmgLPZpiM=; b=FQ8M3+lRZxa03yIO2V4z9E+xbu/a1aamMFRpBjLanzodqB/XWkoD0qqIxeAzOyBSjfKPHOtptVlXUKA/acQNmiLr2DtWU5D+NgHhReoWuhzkGns1WmYKs8LG8jQ0sGRZPUXbdDKcrY32X92eeGyPRZ64VRg+PIx+aY5hsFq6sQ7gRNXr5plz4PJFNl/v1hDG4FrfbeOpfo0WopEFTJnAa5uqA+k7r0zG49rRu5vkzm4jXpa2GF5EnnF9rcJxh1BSLA5tztLp7CPMMAgQxRNjzlwRKAAil7evRpHZTi7N13Uj9X8YzcOz6iewegaoaQmcv4kKp/rartAc+Nz15wNMxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mV0HxFpFjFVpO1xM9KtS6UhVlBJntxLrhxEmgLPZpiM=; b=DZfinv6iozA5ZKX7ltufadsJ47rVw68p9e8PYYlN7ImBWZjYzqcy1qrD+Ui3wPTl6m+pr77YKut7/S8rJhUFV16H22NE+VmfKxvUE85iCbZDkdjPp8HKaR4YONrW5A/vEvJ2w1/ksf60+JaCBtXmXIUP6v5Avn2om2+8IioLrc2kLJlaitErTWrRDGErRbg1+rysEd89/A6iC0WWUn4RFh6XuuIAvUnhkPngk6s487bXy9PMxeI8UGTZziEzd6U9cDxbz7PyaFc3jDBPfQ1+yFXOD8ZlWfxSzqHbCBW94h1H+SgD8WKJmgC8llEmQISGd0Y3ZlzUNnfgbNkKDs62Zg== Received: from BN9PR03CA0934.namprd03.prod.outlook.com (2603:10b6:408:108::9) by CH0PR12MB5124.namprd12.prod.outlook.com (2603:10b6:610:bf::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.19; Thu, 18 Nov 2021 07:07:35 +0000 Received: from BN8NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:408:108:cafe::a) by BN9PR03CA0934.outlook.office365.com (2603:10b6:408:108::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Thu, 18 Nov 2021 07:07:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.36) by BN8NAM11FT017.mail.protection.outlook.com (10.13.177.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:07:34 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:07:33 +0000 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:07:30 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 03/16] ASoC: tegra: Fix wrong value type in DMIC Date: Thu, 18 Nov 2021 12:36:58 +0530 Message-ID: <1637219231-406-4-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c871b2bb-76ae-4a16-1689-08d9aa621880 X-MS-TrafficTypeDiagnostic: CH0PR12MB5124: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hjKyJ9xfcPV7Zwnh90TcZ7bG40tp8aKQPkZjx4lRvu+VIA79RvfOwwkfA1EHVVoobaOVY6zt0PwNZ73V+K9LvuhBxcYp3MpslsPViEqtzb2frC0++vmzdagNRZ4TR3T4vFwULFLr2epAnGchlwdNG3kxk3cPYNAL0yPEfPZIyl2mkrneHjx8WRckXJR1kDw2DC/8E528n+PdwYRWNYXse4IaLHYQQPQbAlOkl9ceFbecDtrJGL601hBsDwMe6UBWaxTC/xy0PqQDskJUDi+6R34BHJfrYtt+Ht5NnNIRJCz60AOOR84HwXfAAp0/2klk08FLreBV/Oz1Hk8Cd/nBRJvRlY3VLw7e7eZUobCMJZ+VqIQfpG4jFOmdBrYJS2hzZI5DQrrMV4GqfolHhrvWC6I6yS+YvxhxQvgEoOMJ4Y8kU2k5jqQyBouXJj84fF+MZYdfdtMf9bDWm7TAGEB7WMWdbaJzcQpm5wuIMHgiO+bYps/3WpKLrQN8BylMKS3wg0WAyFMjpB5lpMzLkwopipcfIv12vA4O566W1ciFSLK6cOWMUWYAxbZw52m6vbbhGO8qOBmgcpLgRIldFlOUDQH2mDoqGR3uRDWNJebnaaC+1ot/xVI1SlI022BQBysHtswylkQIUBGM5YLB+96MC5gLK4bvGbdSqotI6N92LWEYxGeon33wtBbHOfV5GKdFF6UpYrv2JjldQZlkOcHJEA== X-Forefront-Antispam-Report: CIP:216.228.112.36; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid05.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(82310400003)(316002)(2906002)(110136005)(70206006)(508600001)(83380400001)(4326008)(70586007)(336012)(8936002)(2616005)(426003)(5660300002)(26005)(186003)(36756003)(7696005)(47076005)(107886003)(86362001)(36860700001)(6666004)(7636003)(54906003)(8676002)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:07:34.2511 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c871b2bb-76ae-4a16-1689-08d9aa621880 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.36]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5124 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The enum controls are expected to use enumerated value type. Update relevant references in control get/put callbacks. Fixes: 8c8ff982e9e2 ("ASoC: tegra: Add Tegra210 based DMIC driver") Suggested-by: Takashi Iwai Signed-off-by: Sameer Pujar --- sound/soc/tegra/tegra210_dmic.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/sound/soc/tegra/tegra210_dmic.c b/sound/soc/tegra/tegra210_dmic.c index b096478..ee2aedb 100644 --- a/sound/soc/tegra/tegra210_dmic.c +++ b/sound/soc/tegra/tegra210_dmic.c @@ -165,15 +165,15 @@ static int tegra210_dmic_get_control(struct snd_kcontrol *kcontrol, if (strstr(kcontrol->id.name, "Boost Gain Volume")) ucontrol->value.integer.value[0] = dmic->boost_gain; else if (strstr(kcontrol->id.name, "Channel Select")) - ucontrol->value.integer.value[0] = dmic->ch_select; + ucontrol->value.enumerated.item[0] = dmic->ch_select; else if (strstr(kcontrol->id.name, "Mono To Stereo")) - ucontrol->value.integer.value[0] = dmic->mono_to_stereo; + ucontrol->value.enumerated.item[0] = dmic->mono_to_stereo; else if (strstr(kcontrol->id.name, "Stereo To Mono")) - ucontrol->value.integer.value[0] = dmic->stereo_to_mono; + ucontrol->value.enumerated.item[0] = dmic->stereo_to_mono; else if (strstr(kcontrol->id.name, "OSR Value")) - ucontrol->value.integer.value[0] = dmic->osr_val; + ucontrol->value.enumerated.item[0] = dmic->osr_val; else if (strstr(kcontrol->id.name, "LR Polarity Select")) - ucontrol->value.integer.value[0] = dmic->lrsel; + ucontrol->value.enumerated.item[0] = dmic->lrsel; return 0; } @@ -183,20 +183,19 @@ static int tegra210_dmic_put_control(struct snd_kcontrol *kcontrol, { struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); - int value = ucontrol->value.integer.value[0]; if (strstr(kcontrol->id.name, "Boost Gain Volume")) - dmic->boost_gain = value; + dmic->boost_gain = ucontrol->value.integer.value[0]; else if (strstr(kcontrol->id.name, "Channel Select")) - dmic->ch_select = ucontrol->value.integer.value[0]; + dmic->ch_select = ucontrol->value.enumerated.item[0]; else if (strstr(kcontrol->id.name, "Mono To Stereo")) - dmic->mono_to_stereo = value; + dmic->mono_to_stereo = ucontrol->value.enumerated.item[0]; else if (strstr(kcontrol->id.name, "Stereo To Mono")) - dmic->stereo_to_mono = value; + dmic->stereo_to_mono = ucontrol->value.enumerated.item[0]; else if (strstr(kcontrol->id.name, "OSR Value")) - dmic->osr_val = value; + dmic->osr_val = ucontrol->value.enumerated.item[0]; else if (strstr(kcontrol->id.name, "LR Polarity Select")) - dmic->lrsel = value; + dmic->lrsel = ucontrol->value.enumerated.item[0]; return 0; } From patchwork Thu Nov 18 07:06:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626077 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30FB3C433F5 for ; Thu, 18 Nov 2021 07:09:35 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 841C16128C for ; Thu, 18 Nov 2021 07:09:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 841C16128C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E2E6A189F; Thu, 18 Nov 2021 08:08:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E2E6A189F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219373; bh=5QiYGEBbv+XAWRg0PB7PRrxQUR7sXEaZIrIzt7SetGo=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=mBJ/e5kso83kfx3N/wRaXH0YVz1UPJ+EzBS9DbPDdk8C5j6TWATwTBYQssJ3JsnQe KU8zT3Nu9jxs41AbWlOVhj0xq7rbkT+JyBSdTB9ZbsYpGSjWNFL9ap2bOgTcI7k/9K 4P1iqA9qViEMmRNyufw2NByHzfSbLzukwkx1un84= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A37F8F8026D; Thu, 18 Nov 2021 08:07:53 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 16495F804FD; Thu, 18 Nov 2021 08:07:52 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2040.outbound.protection.outlook.com [40.107.93.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4377EF8026D for ; Thu, 18 Nov 2021 08:07:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4377EF8026D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="YV6547rc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VNfpBq2t2HdNTu0QzPJlBR0Y51RhlvlmwCjta+Z3y4jc8H/s0BlaS/dxdWXeEec1oxwkOgbCQaRkk6yyRUbGeeZd8csaIHbXfTB3VSBYuIwrWJ4WKHGRjl2OGHaVGSxqSWI2ibj/nmkdIO0rL6/2bb4OP41k2Nqs/UHViy1qYqYP4dWiVk1EvSsUKIhwykIUZX2vcPRV6LWsbtZElJGulZRVi3wZkFVL1bdNeEW/0kCWoSnf7CfAI0/5yIFfL0hhyoK1HON5gBz66IrC4j98Jy7ql3CmcLhf8zuR4/B2+w6pkwFmDO7Ax4Yr38kZh2hHQgpSccExruXqaIDzfRRAtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ozyVOo3RFAaSkcukvhO9Dx9HeICtugnJq7spXeStDuU=; b=KmknvWWCskaSWJ/TpnDMLGFRlgfMyL0FJywxde8gsDHhLD1fmjGkUqE6UdqwZZ1TtTieKHTLGBoEzWQAMUOF7/RyXWuALa5pwFddUYGpmdOSdPfdgPL4420GvHrgpLG8HQ+lmIG/80h9laAJazmUax84HpPQiNiLyzGiJuM3jLNbfQwSyBFhqQnzPrUe/7voIlzWOv97xTr2dQ9Rfm1xcCpC1uFcQliVt7kwJMqn/sObb+FYJsNvq1ArUAk/zPiw4xtgJ7rKRAQKLkOPA0kc4oe9mWnFCAA0KmmXtCLFVPY0JsX9tjayI91wXm1T1tzmY/bjv0k77lHZ7akg6nNeNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ozyVOo3RFAaSkcukvhO9Dx9HeICtugnJq7spXeStDuU=; b=YV6547rcTI1lS8Uti+Z6cZK/tArY4RruAlNs89RCK3cPUw+X8MqCVk8V2uaJymmyec+WBE0AQNba9y/klolf08OD5XzUThMhd0gj0khOUU2VwvupS8uJZQi3uWjPwN4zKEOCb05WxtMEy4ssMemT5ejAKA4w69OUbrilKwpJsKAC5tLYMP7pgQ8eyplabRa7FKXaFKXwq4v87Me3R2aXIpVsm24N7saH8WXbG/bKCRGT1P1O6ktJzhqhkYZo/tHMZznxd0BWn/4X21rxEbMxUJPyws2sdrv22vVAqPv2W8Dq55b1cCIx7orCfGJxVrLUgMCL20CkgS4p3Esi9EgYag== Received: from BN9PR03CA0810.namprd03.prod.outlook.com (2603:10b6:408:13f::35) by BN6PR12MB1716.namprd12.prod.outlook.com (2603:10b6:404:104::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Thu, 18 Nov 2021 07:07:41 +0000 Received: from BN8NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13f:cafe::9d) by BN9PR03CA0810.outlook.office365.com (2603:10b6:408:13f::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 07:07:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT005.mail.protection.outlook.com (10.13.176.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:07:40 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:07:36 +0000 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:07:33 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 04/16] ASoC: tegra: Fix wrong value type in DSPK Date: Thu, 18 Nov 2021 12:36:59 +0530 Message-ID: <1637219231-406-5-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad279f0e-a07d-4a25-1fd6-08d9aa621c01 X-MS-TrafficTypeDiagnostic: BN6PR12MB1716: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x7fHJv1HEFF0DxGrIYUSzkIw3S7+5GK9RYX6B8ku3HANhq9lDeHh3UJkshP5rprN3j12tybiiLjDD3CKCnFIQ8D3ETnD1Yoft1qKh8v8ZqTdYzCPk4+/eKoux5+BH8Xft54njrhvTg6AQMKWwsMOhpkc9HFYJTuaBwKZZSmnUFQgsI78R2oNo1IrLfqMvqNCvu1eGjiuaL/s8M7Vdwdg7H4OXTNr1KCABkkSwLIqt6UDEjF2WIdsDCP72fq8YT2IkcRWl+v4hALGCPzeJeHu1HfLvs3RRfWdzW58wozWmFQ0ozG03Aa3Mg8oK9OcY6csW7tA70e0w1idWAjgZbRASI2ynZUZ/YYGg5AlVO/SX2EyEUla4fKvY8CquLMe8JRQtaR+1Ul7cMwOkLH9uQ+K98uTfgvBUu9SB1Zm1trCgKd33sqFddmhzWHTmWhs3eZXBVGNNMJjcvROmS+IECTwa01bcn+Rx/qgP6HuJtO6F3TxVU4epIA7yaoAI/Tt3IVaReNt1yuoF8MYtp/ace+4h9JLLWI5cZK3yjAEAN5lDRcS3+bSnVW9TzBNve+CxRMBy6ZxbQnzn5dtvxO1g8qhet1ZCXSPO3fk/fulRI8sdRsLDF05pDLJoVCXQgi3LeK3g42jOojtMjMj5YMZzC+/V/qqXCOwB6bzS8iJNQPY6Gd48CQ/LWqOwInbVLXAngdB9LAoRnaROuxPWxT81Mn2dg== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(86362001)(7696005)(356005)(7636003)(2906002)(316002)(47076005)(83380400001)(36906005)(36756003)(54906003)(110136005)(508600001)(4326008)(70206006)(70586007)(107886003)(336012)(426003)(82310400003)(186003)(26005)(36860700001)(8676002)(8936002)(5660300002)(6666004)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:07:40.1309 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad279f0e-a07d-4a25-1fd6-08d9aa621c01 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1716 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The enum controls are expected to use enumerated value type. Update relevant references in control get/put callbacks. Fixes: 327ef6470266 ("ASoC: tegra: Add Tegra186 based DSPK driver") Suggested-by: Takashi Iwai Signed-off-by: Sameer Pujar --- sound/soc/tegra/tegra186_dspk.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/sound/soc/tegra/tegra186_dspk.c b/sound/soc/tegra/tegra186_dspk.c index 8ee9a77..67269e7 100644 --- a/sound/soc/tegra/tegra186_dspk.c +++ b/sound/soc/tegra/tegra186_dspk.c @@ -35,15 +35,15 @@ static int tegra186_dspk_get_control(struct snd_kcontrol *kcontrol, if (strstr(kcontrol->id.name, "FIFO Threshold")) ucontrol->value.integer.value[0] = dspk->rx_fifo_th; else if (strstr(kcontrol->id.name, "OSR Value")) - ucontrol->value.integer.value[0] = dspk->osr_val; + ucontrol->value.enumerated.item[0] = dspk->osr_val; else if (strstr(kcontrol->id.name, "LR Polarity Select")) - ucontrol->value.integer.value[0] = dspk->lrsel; + ucontrol->value.enumerated.item[0] = dspk->lrsel; else if (strstr(kcontrol->id.name, "Channel Select")) - ucontrol->value.integer.value[0] = dspk->ch_sel; + ucontrol->value.enumerated.item[0] = dspk->ch_sel; else if (strstr(kcontrol->id.name, "Mono To Stereo")) - ucontrol->value.integer.value[0] = dspk->mono_to_stereo; + ucontrol->value.enumerated.item[0] = dspk->mono_to_stereo; else if (strstr(kcontrol->id.name, "Stereo To Mono")) - ucontrol->value.integer.value[0] = dspk->stereo_to_mono; + ucontrol->value.enumerated.item[0] = dspk->stereo_to_mono; return 0; } @@ -53,20 +53,19 @@ static int tegra186_dspk_put_control(struct snd_kcontrol *kcontrol, { struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); - int val = ucontrol->value.integer.value[0]; if (strstr(kcontrol->id.name, "FIFO Threshold")) - dspk->rx_fifo_th = val; + dspk->rx_fifo_th = ucontrol->value.integer.value[0]; else if (strstr(kcontrol->id.name, "OSR Value")) - dspk->osr_val = val; + dspk->osr_val = ucontrol->value.enumerated.item[0]; else if (strstr(kcontrol->id.name, "LR Polarity Select")) - dspk->lrsel = val; + dspk->lrsel = ucontrol->value.enumerated.item[0]; else if (strstr(kcontrol->id.name, "Channel Select")) - dspk->ch_sel = val; + dspk->ch_sel = ucontrol->value.enumerated.item[0]; else if (strstr(kcontrol->id.name, "Mono To Stereo")) - dspk->mono_to_stereo = val; + dspk->mono_to_stereo = ucontrol->value.enumerated.item[0]; else if (strstr(kcontrol->id.name, "Stereo To Mono")) - dspk->stereo_to_mono = val; + dspk->stereo_to_mono = ucontrol->value.enumerated.item[0]; return 0; } From patchwork Thu Nov 18 07:07:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626107 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8724BC433EF for ; Thu, 18 Nov 2021 07:14:31 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 130A0611CC for ; Thu, 18 Nov 2021 07:14:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 130A0611CC Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7650518EA; Thu, 18 Nov 2021 08:13:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7650518EA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219669; bh=E6AhRpqQbQd65CYE2LXCq5rhy4XbPfDm/ZibikuaNGU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZfdYeQfrWM7xrqlkxrFLlVX+Dp+ROIXMCy7RqwpuLvgAY5RsGLP1dnUxlSNhZ2IJP RP67dOkonu06Pk1r2UXmm9cs5qTctbiUiDe688wTBCLqlRVmWWINj84RaXM0fk2MH2 OL5sPJwZdzSHx6xzeEgjcX7XmRHyhOFz3ZdvvkPw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1F98BF80506; Thu, 18 Nov 2021 08:10:03 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4E958F8010B; Thu, 18 Nov 2021 08:09:36 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2070.outbound.protection.outlook.com [40.107.244.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 28366F804EC for ; Thu, 18 Nov 2021 08:07:46 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 28366F804EC Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="MmidvVk2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AQMGw3vgKGErqf91glFTEEftoXQY9rTBOA6Sw9R8/YuEAaLGf2uoU7uKetATuNdmcFE8Inhow+AGwjMdVKqMwsCptK0HdrCNfiMmQVHNlxa35oJX1EnWCtFRw6rrx+DaVuf1iec8newC2d1YTyvi9MffHnfXCnQn2ENph1iYTIuYLKNA6WZwIWl4gzBQTdOaosJszyzOtCS6t7KzTIau+wB4H4t9hDzE52qsNS5AS1yGFqFzwGw238Kvz+HvPWG2DjTagbgQM43jyS4fstg1W8R//INuMBQgecVSTAgnppTp5phqxxmLa2Jfnf+fjkD9d4WIPADkSVjZ/73uudARLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NysmW/bYkHMp5jSpr73mAkiNXPnkdpZRKkpN5nWiwI4=; b=cWoJlnk5gkkpG9VLrExeDNaqo7mxAsHNPLwGS3CCxu4bTWeO/lv9gpcBmYkLIUSmveqdSA5lvvs7JxfQZpuJuBk5qQwid1H7cwdZEuM61x7o/H++88fiYybaTTTymnCqByc25s1LzUUGaLgzkwe2ivlhzeS0R7TVwwno+JXM10U5h8KrHTJRIig/Ad8wHjWqV660muaMZT4url9xl4nUzE3vdw5c0/WZXGDm1mvYWrY2M0EWRH7+oAorminF/dV5oeESjN+phNXWBG7Jb60k5eCJe9YCY05v0EkGMEoEDbj5GApp0JcpQtB899+bEY+g+EH1IZfu6U2W6qDM7YdN6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NysmW/bYkHMp5jSpr73mAkiNXPnkdpZRKkpN5nWiwI4=; b=MmidvVk2YI+w/n2CI3FaKd0wQmPzIeDs5BlaxbgEYdtrDxXiaX50sRV5voixot4W5awqAwP0L6d9Eor2d5oHRpN6sC7/PIdXSm05t8afEAUFJVZA2NgCAAGtATu4dpjAr1SnY44y+cXUdPzxeIb0J34bghe9ltQcEIrgrhnZ0C/NsPhD/Z7DwnDy1OrnRlNfS762vFuTgvCdyfYHz6MiIQRNnBxblXKbH03/D5258Y3t6Qb4H0/6fNpVLPFLhXiynPYyg8n1Dy2DPlZQwLWizIZXZb0qChMJBdbbsYNb37Lp24yEvERmGYEFoofIT8PSoz5P346O8N++peQd95JZbg== Received: from MW2PR2101CA0016.namprd21.prod.outlook.com (2603:10b6:302:1::29) by DM6PR12MB4529.namprd12.prod.outlook.com (2603:10b6:5:2ab::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21; Thu, 18 Nov 2021 07:07:42 +0000 Received: from CO1NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:302:1:cafe::4b) by MW2PR2101CA0016.outlook.office365.com (2603:10b6:302:1::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.11 via Frontend Transport; Thu, 18 Nov 2021 07:07:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT005.mail.protection.outlook.com (10.13.174.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:07:40 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:07:39 +0000 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:07:36 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 05/16] ASoC: tegra: Fix wrong value type in SFC Date: Thu, 18 Nov 2021 12:37:00 +0530 Message-ID: <1637219231-406-6-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce036a89-e927-4dd3-f971-08d9aa621c34 X-MS-TrafficTypeDiagnostic: DM6PR12MB4529: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2PsYRA2ET/TWIXD08bJxTZ2SxtPhS9nSlwePdKeiHc3OoSfqQISt0tb+HgsM5aq/qZbW1huJ21IIXz+Eo/Q68/R8Jzg62UsNrlZTLY4nlvxJgCCHbzvPKYk39EalujqNC6PRUPA9WkvtKQ5TfVyRIrFDyhhIvsNP21/o+M4KnBHUGC0ePVlKBTzyN1FME253fYokIp+qg39YMIIGFyYjhVwzrmzzFkOcFyORQtX4keljRLi7w3bVwUbu0KUQuvudpMA4P+iO0Qpm/wiWZkq/3bTE7IiKUFtKNiTMMylg16WhaSWe6qu0Q/m9hWfjR+K9rJf53k+EUxNMb+NfZPwH4Uoh84c7+VmPHPjAogdn7WQa9Zao6BrdgIJeX6LRGerz2odoEmCAC0JSbMELfCAGBCx93NG+ScOjyXBzPjWu7vz77fEkh30bcZczw+ExFQ7MWBh3uBsNX65xYmN/m9LgoD51YPKdomApjIOWkdhtP/EiHUy/IWAX0W9/TYJQTVMF1lfNDizle0iGqWFzUrCXL5IsnFo1toATCnk02DeFEs3qeRa5xs7X+NNYpUn16q+sfyjhaECaaXNKNBNQ2PPcppIv1jitD2J5R5YHG9wPpbBvbGpor6lEFlBShxXK2JFcZLrha+YS+EYKaeEtnNy8qkIiXT5C+s/W79yYP0NqBkr8ZhjjbhEeU0mwsk1MUGH7RC8DeMxhh07/OM0XsdFbQw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(426003)(86362001)(26005)(8676002)(508600001)(36906005)(8936002)(2616005)(2906002)(316002)(47076005)(83380400001)(356005)(110136005)(7636003)(54906003)(5660300002)(36860700001)(7696005)(107886003)(4326008)(186003)(70586007)(336012)(82310400003)(70206006)(6666004)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:07:40.5227 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce036a89-e927-4dd3-f971-08d9aa621c34 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4529 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The enum controls are expected to use enumerated value type. Update relevant references in control get/put callbacks. Fixes: b2f74ec53a6c ("ASoC: tegra: Add Tegra210 based SFC driver") Suggested-by: Takashi Iwai Signed-off-by: Sameer Pujar --- sound/soc/tegra/tegra210_sfc.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sound/soc/tegra/tegra210_sfc.c b/sound/soc/tegra/tegra210_sfc.c index dc477ee..cb592ef 100644 --- a/sound/soc/tegra/tegra210_sfc.c +++ b/sound/soc/tegra/tegra210_sfc.c @@ -3251,16 +3251,16 @@ static int tegra210_sfc_get_control(struct snd_kcontrol *kcontrol, struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt); if (strstr(kcontrol->id.name, "Input Stereo To Mono")) - ucontrol->value.integer.value[0] = + ucontrol->value.enumerated.item[0] = sfc->stereo_to_mono[SFC_RX_PATH]; else if (strstr(kcontrol->id.name, "Input Mono To Stereo")) - ucontrol->value.integer.value[0] = + ucontrol->value.enumerated.item[0] = sfc->mono_to_stereo[SFC_RX_PATH]; else if (strstr(kcontrol->id.name, "Output Stereo To Mono")) - ucontrol->value.integer.value[0] = + ucontrol->value.enumerated.item[0] = sfc->stereo_to_mono[SFC_TX_PATH]; else if (strstr(kcontrol->id.name, "Output Mono To Stereo")) - ucontrol->value.integer.value[0] = + ucontrol->value.enumerated.item[0] = sfc->mono_to_stereo[SFC_TX_PATH]; return 0; @@ -3271,16 +3271,19 @@ static int tegra210_sfc_put_control(struct snd_kcontrol *kcontrol, { struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt); - int value = ucontrol->value.integer.value[0]; if (strstr(kcontrol->id.name, "Input Stereo To Mono")) - sfc->stereo_to_mono[SFC_RX_PATH] = value; + sfc->stereo_to_mono[SFC_RX_PATH] = + ucontrol->value.enumerated.item[0]; else if (strstr(kcontrol->id.name, "Input Mono To Stereo")) - sfc->mono_to_stereo[SFC_RX_PATH] = value; + sfc->mono_to_stereo[SFC_RX_PATH] = + ucontrol->value.enumerated.item[0]; else if (strstr(kcontrol->id.name, "Output Stereo To Mono")) - sfc->stereo_to_mono[SFC_TX_PATH] = value; + sfc->stereo_to_mono[SFC_TX_PATH] = + ucontrol->value.enumerated.item[0]; else if (strstr(kcontrol->id.name, "Output Mono To Stereo")) - sfc->mono_to_stereo[SFC_TX_PATH] = value; + sfc->mono_to_stereo[SFC_TX_PATH] = + ucontrol->value.enumerated.item[0]; else return 0; From patchwork Thu Nov 18 07:07:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626081 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B795BC433F5 for ; Thu, 18 Nov 2021 07:10:17 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 314896138D for ; Thu, 18 Nov 2021 07:10:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 314896138D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8DEE218D3; Thu, 18 Nov 2021 08:09:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8DEE218D3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219415; bh=+DpzkZ1BTUPljphqsfad606UEJU7zSUanXqfa6IK87M=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=kcSQQCvhMksclnOBQG8z+KbW4zr/xPFODHEzYyuXRjl0nLs5Xu1T82fyVET9r6Jrs /Z6sZXufkG/OWn2Bztx3Nxqp1u78Tps0dajYVjRcQtifPd8cw/LhhueF8HN7FWcgSB mA+fFl4e4lvEi6313k/4tPQjcdMMOS5uJA6CADEY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AF10CF80516; Thu, 18 Nov 2021 08:08:06 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4B874F80508; Thu, 18 Nov 2021 08:08:00 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2080.outbound.protection.outlook.com [40.107.96.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 500ABF804DF for ; Thu, 18 Nov 2021 08:07:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 500ABF804DF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="D1RBVNqD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=brMnGcqaEfFfxNaHZeuwVi/bNoXkcXPkGOwUOXI+sDGm7NGpS7fb89Dzu6fSqiUM8iCJDhf+P2Eybt68F+893WlrvWG+QKyefQ1V0JveATmdmp54zwRBxPTD+3CyiKG6sm+VuVRG9rpAUORWzT1we8paTZI41HZwnrt1BJP2fwtkHjuQc2ooQqF+FFBzAeKlEWZ5klwOUKqBoB+Sgq/efEwuaUUq66BdBoHoS6TufVMwZSkqY1za8lGTPUKzwTIwMhBcj0eYpFQ8TdVs+3m+BZ3QRE8PJd57/awwzyr8AoBO3jxDZVItmN70Zus7s6VFNRT09x1tJPoJZAfS29JODg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yZb6l6gEMXvJ2FiONZI9dL+tCCHZLLekQ7JCKCcfQho=; b=iISs9W4lh9PX3Sd877R75eYbZAmYKIEg4lBMs9c3cVCAtmUE7wL2e5j9EYoYEXm6fUtrbJo4xKF9MB/cga1PgkVDTnv726AIuHR/5gK426VY9cgNN7XHcylkl7aWNzzKBw0dVfNRkrGhFMLsP3zN5RfAOK1S2K6sDPhl0MS5HgchSEgQJLSw4EpqJHh74hs/msa7Rf7l/z03zCFTcWFnJjrpjYS/Xv+We2i/S9/oWZEN7Rx8CXZ5oPlEXJP4BJgAakN78owEYcR1WF22qL04kRHzyv03p+FcZn3UhTT80BMaONYD7Ekhc+IdR+w6eES0/raNnmol49I8YFkJTYbUwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yZb6l6gEMXvJ2FiONZI9dL+tCCHZLLekQ7JCKCcfQho=; b=D1RBVNqDCFQnfyLl3CHePEAmP5MZdjyUL0n0vkxK8ez4blHeE0pam7k+aneRYfvUZkV+tW3QCZUNdCVhl5M8/ZsbOwOmgAtx8sh6mJQ7FmkBFI6IqdZKp8JXHqW/OmI9hLPmZ1zqtaBYJyYzdiZLRjsaPEotNJLZ/ogKZ7j37xWwSwMHChNg2TWJU+rLsseIb6UOw3JK7uUTrtnTzdFoVa4PD/oYtZ7a2Ay/2IGdW9wQGPrnrnB1ki4HREfuLTv7wPQDHsNBnxrPBrz6O2CVF3r1wM2FUxpgTdIDNymH8jHXD0RXl1JC00eWwDauUIxCidcJel6hjvCa/SgboW+pSQ== Received: from BN6PR1201CA0015.namprd12.prod.outlook.com (2603:10b6:405:4c::25) by BN8PR12MB4979.namprd12.prod.outlook.com (2603:10b6:408:75::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 07:07:44 +0000 Received: from BN8NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:405:4c:cafe::cf) by BN6PR1201CA0015.outlook.office365.com (2603:10b6:405:4c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 07:07:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by BN8NAM11FT063.mail.protection.outlook.com (10.13.177.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:07:42 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 17 Nov 2021 23:07:42 -0800 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:07:39 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 06/16] ASoC: tegra: Fix wrong value type in MVC Date: Thu, 18 Nov 2021 12:37:01 +0530 Message-ID: <1637219231-406-7-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f89e23e9-bdc8-4bcb-117c-08d9aa621d8d X-MS-TrafficTypeDiagnostic: BN8PR12MB4979: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1284; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HYbrOme+4e0aSr2UIwski6gmO7CAYx+HCAw70bMW/cCWZM6/sQa0KMyklERNQEkaDccqXWJjanZ0Pz0dJXUrnXEggRsOX5Cj73TgtY683Wr60GknW3SnWlgucK3nIdUaTCNX4vpRiZummIRLvAZbcT838ZqOZx83OkVcqL02uI+32HWzbFrFL1D+7khaTEuX/c162OuQzGisLXuCVfIzvqytaboqMD20C/mUq13fqdq7vtGNTxQzNdeL1CdueHGaYmCwIfNqlGb7VXJPPNV2VVnPQpCFkehxQEcNed/pC0biNZHIxXCZruukbDcrjpzr4HkEWNkUlxU2pDCYuLY2Iw14VD3xLx3yeCDLIiB0MUdqSF6jTIaDDTELoJN2VzoI8MSIrWPNvpAwAOBhv13mqvPHvpnSE5J3cvFTCv5l4eVn7CXc1rOhiW5er8MpX7ELEZaaGIkcO8UL5a2tlXJoLn2vgP46OcPhBYPeQap4L3mTueAU/lABHufWjoX7lB4fMohI0YcXMBmwQuLoA+Ic5Gfcfh+uasUsjmaby3c57krgnRBBMbVhXE1Tg3VXZkiR+vDFTbPGONN5lgqo/0A9NofUPMEAAUhPNKtaIWAIJEVZQ5CP2r3ZJvjN5ZJNW8K2UI9D+ZKywez2xzohvBg1aDaAKYnEF0nAG6xwtQxH9DsjEGYBlUvWWj8b6cE4Z40pL8ioyKRClG8WIXulI7dreg== X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(86362001)(4326008)(5660300002)(356005)(36860700001)(54906003)(36756003)(8676002)(82310400003)(26005)(47076005)(6666004)(7636003)(110136005)(316002)(8936002)(508600001)(70586007)(7696005)(336012)(107886003)(186003)(426003)(2616005)(83380400001)(70206006)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:07:42.7358 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f89e23e9-bdc8-4bcb-117c-08d9aa621d8d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB4979 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The enum controls are expected to use enumerated value type. Update relevant references in control get/put callbacks. Fixes: e539891f9687 ("ASoC: tegra: Add Tegra210 based MVC driver") Suggested-by: Takashi Iwai Signed-off-by: Sameer Pujar --- sound/soc/tegra/tegra210_mvc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/tegra/tegra210_mvc.c b/sound/soc/tegra/tegra210_mvc.c index 7b9c700..b7e3170 100644 --- a/sound/soc/tegra/tegra210_mvc.c +++ b/sound/soc/tegra/tegra210_mvc.c @@ -275,7 +275,7 @@ static int tegra210_mvc_get_curve_type(struct snd_kcontrol *kcontrol, struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt); - ucontrol->value.integer.value[0] = mvc->curve_type; + ucontrol->value.enumerated.item[0] = mvc->curve_type; return 0; } @@ -285,7 +285,7 @@ static int tegra210_mvc_put_curve_type(struct snd_kcontrol *kcontrol, { struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt); - int value; + unsigned int value; regmap_read(mvc->regmap, TEGRA210_MVC_ENABLE, &value); if (value & TEGRA210_MVC_EN) { @@ -294,10 +294,10 @@ static int tegra210_mvc_put_curve_type(struct snd_kcontrol *kcontrol, return -EINVAL; } - if (mvc->curve_type == ucontrol->value.integer.value[0]) + if (mvc->curve_type == ucontrol->value.enumerated.item[0]) return 0; - mvc->curve_type = ucontrol->value.integer.value[0]; + mvc->curve_type = ucontrol->value.enumerated.item[0]; tegra210_mvc_reset_vol_settings(mvc, cmpnt->dev); From patchwork Thu Nov 18 07:07:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626099 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C1A9C433F5 for ; Thu, 18 Nov 2021 07:13:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id ACA356128C for ; Thu, 18 Nov 2021 07:13:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ACA356128C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id ED8164E; Thu, 18 Nov 2021 08:12:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ED8164E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219608; bh=C2ajaOIXo0/P9TP4U2dZ676USDjpJp+IyOO5zb8dUVQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=GtwZu9SKb0CbbaVIjU0iYG/t5RvNUUOwtz+AKce+bMm/YMadf0lZDqAxY8bEvP3d6 3hfNIQAoEtZ5bVb8qbk0IkdZy2F0/MfLkz2DjaqItzeJb+G+ijMEDcQNOO/PEr5x3G CYjGCuFMXg2EwMDjxoyhvp2K7rdGxgGE3B6P5G8Q= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5C1CAF8026D; Thu, 18 Nov 2021 08:09:59 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F02DFF804EB; Thu, 18 Nov 2021 08:09:36 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2084.outbound.protection.outlook.com [40.107.243.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A9005F804FD for ; Thu, 18 Nov 2021 08:07:51 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A9005F804FD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="hIEqjhax" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lREGkmBrAmYWpf5QYLfOvdEmHd4vXfw73qm/Jub2fJsegEn9Xr8evqkFMhqTBtjYC5GtoETmjAXgBygohzxqlThyjZp05JVVLjICAtoueoMzm4hFkNW6vRSX+OKzxGmKLyumO36rTpUSvb4qhrFCZbK0GA49WZ6e+hUXQoXGZFtOit9RECzesCjO1mMURQFITKL6tZDqdu7i2zjFe7ECQuerqpSLUdSBm/fBPFq9k4kdOAHW8hBq402Ds8G1Sbclxnvy3OHTD6sPSyVlWF6vEARDxOpXYp7uK32ZAbRds+w2Vlqs9ChWIc27QQzE027M97xiRMYA0HA6YXA0pv8eCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1Qkb2ZDWYZx09hj7ENpj87i6yIgDCWrhrk3FPS4BLYY=; b=ACWB7hwpfd5jcwl4pomqCjz+wpI2jvoUcz12U8A6dWAFWjuif/9Jqv5GE4oXJgOPr3mOU3L30enKKdImL4ftbVsJEFmqk+M2oa+5rkUufmKs5ho1BK4lv+eCPjoB9o07nwuC0RzVeQcXy5AIGmRll5GTxbZqsc5XDrtqhNTRjO+MRbxHHpSo2PG/XgJyKiczV9Ofr+sXCWxd+OG5DOQJlcvtPB8vfaPc0evWDypOMU7evPpIw5EesqoX2PDtmMxurGtG9yjuANsIC5lDCF3qCGStV9MBBu4IpGV3zymWJ9dA3aefS6s8oJTI8L+pFgJ1BbcW1tYcpPEfTkZ18NRwbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1Qkb2ZDWYZx09hj7ENpj87i6yIgDCWrhrk3FPS4BLYY=; b=hIEqjhaxM43EpL7InFRAXTtTnAprc8kBsdolOv+S748KhTjx+ux0A53aTrR0J8XrIO7sSRoQFTAEIiDAFSADzY+YLadPDycaispn3l8Nhxp32+qsaSPLXTtqM03TCSJWCLQ6TS3VffVsGHB014WKTloKjNeq+1+mB/1D3uWQbNvrIX+jgIjH25UkFugA59zMp/JwG47cW1drKkbVKCmNRogaz2jIXLQFofr2SdYImZ1hGTvr1ViwSvcQjLfW2Zw5VkqwMaddBMMnRiNtOxfuICm8/8jyXRmHMykZhLz4OuxDoJLqTDciXdoEIwzbRlDjEiCnpEvtkYrQsx+yd2j0ug== Received: from BN8PR03CA0008.namprd03.prod.outlook.com (2603:10b6:408:94::21) by DM5PR1201MB0092.namprd12.prod.outlook.com (2603:10b6:4:54::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Thu, 18 Nov 2021 07:07:47 +0000 Received: from BN8NAM11FT066.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::d1) by BN8PR03CA0008.outlook.office365.com (2603:10b6:408:94::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:07:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.36) by BN8NAM11FT066.mail.protection.outlook.com (10.13.177.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:07:45 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:07:45 +0000 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:07:42 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 07/16] ASoC: tegra: Fix kcontrol put callback in ADMAIF Date: Thu, 18 Nov 2021 12:37:02 +0530 Message-ID: <1637219231-406-8-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: db956fe3-5e82-4d2c-a713-08d9aa621f8b X-MS-TrafficTypeDiagnostic: DM5PR1201MB0092: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6/+y7Az5rT8VEp9i9OCRti5o0ZPsfA5jQEW5tnJiV5WycRYE0DDVMnY9NVP43E/Nqwqn8Ma/vZsV7QkLVsJScwGOkohFytAUK0yiVZ7AMw7ZZ3oixXGOfYNBRZj+qX4+LdIbNQJriXyCggNux0DJYsag+CnhFP4EeDvlh8SvJpGsuPcF95EcEVbCDxt+2LjlUg3zU8OOuNpcyk3ci9hpnUVgvFlcN4d56fR9p0C+5Pq7uQiHX8/albwOjH6c+MoiWJ4GbFZRW3zluZsepv+EgqpBzDPoj1BhTSf4RSuW2pjRoQYILnHdWX+x0ZaIhlOBbEWjlRUNI4PnANYA9mMvnSgM24pO/UU/6RjCQbz1ZuK1crP0/qyACf7UE2uQUjfYH+Ef1xL0BkuSNKFEGVU2/ZwEfhLY/7/1ac7gbNijPr3aaB8b53Y9Hs7BKz5BBUgCBcFkDkLtPWgaXq89ZGGJkhtzULdhJgGsCnUjC8huZsuPln2EpP3qF4Yl2FieZATZ52On4kNh3rVnseOWcmk+x+RnCk2ySriiXfs8d2y5VQAe3T+BjOujckz4ayG+YxwK8SaM56eyB83pFikZP4JevMmU6XhXokL2oT5ALlRLr3AzloEN1yDghOd3th2Fd4O7rRaJ+/AJJUhWvX2YNyq7usGFa8iWxqYYIrTwJDV9Fcn+O0PyRxNd06S1YO49mQOhVInfjLUmI3ze5rXEfEawaQ== X-Forefront-Antispam-Report: CIP:216.228.112.36; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid05.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(8936002)(336012)(8676002)(82310400003)(110136005)(426003)(83380400001)(70586007)(86362001)(36756003)(26005)(36860700001)(186003)(47076005)(6666004)(7696005)(2616005)(4326008)(54906003)(316002)(36906005)(5660300002)(508600001)(7636003)(107886003)(356005)(70206006)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:07:45.9110 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: db956fe3-5e82-4d2c-a713-08d9aa621f8b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.36]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT066.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0092 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Update the ADMAIF driver accordingly. Fixes: f74028e159bb ("ASoC: tegra: Add Tegra210 based ADMAIF driver") Suggested-by: Jaroslav Kysela Suggested-by: Mark Brown Signed-off-by: Sameer Pujar --- sound/soc/tegra/tegra210_admaif.c | 138 ++++++++++++++++++++++++++++++-------- 1 file changed, 109 insertions(+), 29 deletions(-) diff --git a/sound/soc/tegra/tegra210_admaif.c b/sound/soc/tegra/tegra210_admaif.c index 6febe80..1a2e868 100644 --- a/sound/soc/tegra/tegra210_admaif.c +++ b/sound/soc/tegra/tegra210_admaif.c @@ -424,46 +424,122 @@ static const struct snd_soc_dai_ops tegra_admaif_dai_ops = { .trigger = tegra_admaif_trigger, }; -static int tegra_admaif_get_control(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static int tegra210_admaif_pget_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); + struct tegra_admaif *admaif = snd_soc_component_get_drvdata(cmpnt); struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; + + ucontrol->value.enumerated.item[0] = + admaif->mono_to_stereo[ADMAIF_TX_PATH][ec->reg]; + + return 0; +} + +static int tegra210_admaif_pput_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); struct tegra_admaif *admaif = snd_soc_component_get_drvdata(cmpnt); - unsigned int *uctl_val = &ucontrol->value.enumerated.item[0]; + struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; + unsigned int value = ucontrol->value.enumerated.item[0]; - if (strstr(kcontrol->id.name, "Playback Mono To Stereo")) - *uctl_val = admaif->mono_to_stereo[ADMAIF_TX_PATH][ec->reg]; - else if (strstr(kcontrol->id.name, "Capture Mono To Stereo")) - *uctl_val = admaif->mono_to_stereo[ADMAIF_RX_PATH][ec->reg]; - else if (strstr(kcontrol->id.name, "Playback Stereo To Mono")) - *uctl_val = admaif->stereo_to_mono[ADMAIF_TX_PATH][ec->reg]; - else if (strstr(kcontrol->id.name, "Capture Stereo To Mono")) - *uctl_val = admaif->stereo_to_mono[ADMAIF_RX_PATH][ec->reg]; + if (value == admaif->mono_to_stereo[ADMAIF_TX_PATH][ec->reg]) + return 0; + + admaif->mono_to_stereo[ADMAIF_TX_PATH][ec->reg] = value; + + return 1; +} + +static int tegra210_admaif_cget_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); + struct tegra_admaif *admaif = snd_soc_component_get_drvdata(cmpnt); + struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; + + ucontrol->value.enumerated.item[0] = + admaif->mono_to_stereo[ADMAIF_RX_PATH][ec->reg]; return 0; } -static int tegra_admaif_put_control(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static int tegra210_admaif_cput_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); + struct tegra_admaif *admaif = snd_soc_component_get_drvdata(cmpnt); struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == admaif->mono_to_stereo[ADMAIF_RX_PATH][ec->reg]) + return 0; + + admaif->mono_to_stereo[ADMAIF_RX_PATH][ec->reg] = value; + + return 1; +} + +static int tegra210_admaif_pget_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); struct tegra_admaif *admaif = snd_soc_component_get_drvdata(cmpnt); + struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; + + ucontrol->value.enumerated.item[0] = + admaif->stereo_to_mono[ADMAIF_TX_PATH][ec->reg]; + + return 0; +} + +static int tegra210_admaif_pput_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); + struct tegra_admaif *admaif = snd_soc_component_get_drvdata(cmpnt); + struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; unsigned int value = ucontrol->value.enumerated.item[0]; - if (strstr(kcontrol->id.name, "Playback Mono To Stereo")) - admaif->mono_to_stereo[ADMAIF_TX_PATH][ec->reg] = value; - else if (strstr(kcontrol->id.name, "Capture Mono To Stereo")) - admaif->mono_to_stereo[ADMAIF_RX_PATH][ec->reg] = value; - else if (strstr(kcontrol->id.name, "Playback Stereo To Mono")) - admaif->stereo_to_mono[ADMAIF_TX_PATH][ec->reg] = value; - else if (strstr(kcontrol->id.name, "Capture Stereo To Mono")) - admaif->stereo_to_mono[ADMAIF_RX_PATH][ec->reg] = value; + if (value == admaif->stereo_to_mono[ADMAIF_TX_PATH][ec->reg]) + return 0; + + admaif->stereo_to_mono[ADMAIF_TX_PATH][ec->reg] = value; + + return 1; +} + +static int tegra210_admaif_cget_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); + struct tegra_admaif *admaif = snd_soc_component_get_drvdata(cmpnt); + struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; + + ucontrol->value.enumerated.item[0] = + admaif->stereo_to_mono[ADMAIF_RX_PATH][ec->reg]; return 0; } +static int tegra210_admaif_cput_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); + struct tegra_admaif *admaif = snd_soc_component_get_drvdata(cmpnt); + struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == admaif->stereo_to_mono[ADMAIF_RX_PATH][ec->reg]) + return 0; + + admaif->stereo_to_mono[ADMAIF_RX_PATH][ec->reg] = value; + + return 1; +} + static int tegra_admaif_dai_probe(struct snd_soc_dai *dai) { struct tegra_admaif *admaif = snd_soc_dai_get_drvdata(dai); @@ -559,17 +635,21 @@ static const char * const tegra_admaif_mono_conv_text[] = { } #define TEGRA_ADMAIF_CIF_CTRL(reg) \ - NV_SOC_ENUM_EXT("ADMAIF" #reg " Playback Mono To Stereo", reg - 1,\ - tegra_admaif_get_control, tegra_admaif_put_control, \ + NV_SOC_ENUM_EXT("ADMAIF" #reg " Playback Mono To Stereo", reg - 1, \ + tegra210_admaif_pget_mono_to_stereo, \ + tegra210_admaif_pput_mono_to_stereo, \ tegra_admaif_mono_conv_text), \ - NV_SOC_ENUM_EXT("ADMAIF" #reg " Playback Stereo To Mono", reg - 1,\ - tegra_admaif_get_control, tegra_admaif_put_control, \ + NV_SOC_ENUM_EXT("ADMAIF" #reg " Playback Stereo To Mono", reg - 1, \ + tegra210_admaif_pget_stereo_to_mono, \ + tegra210_admaif_pput_stereo_to_mono, \ tegra_admaif_stereo_conv_text), \ - NV_SOC_ENUM_EXT("ADMAIF" #reg " Capture Mono To Stereo", reg - 1, \ - tegra_admaif_get_control, tegra_admaif_put_control, \ + NV_SOC_ENUM_EXT("ADMAIF" #reg " Capture Mono To Stereo", reg - 1, \ + tegra210_admaif_cget_mono_to_stereo, \ + tegra210_admaif_cput_mono_to_stereo, \ tegra_admaif_mono_conv_text), \ - NV_SOC_ENUM_EXT("ADMAIF" #reg " Capture Stereo To Mono", reg - 1, \ - tegra_admaif_get_control, tegra_admaif_put_control, \ + NV_SOC_ENUM_EXT("ADMAIF" #reg " Capture Stereo To Mono", reg - 1, \ + tegra210_admaif_cget_stereo_to_mono, \ + tegra210_admaif_cput_stereo_to_mono, \ tegra_admaif_stereo_conv_text) static struct snd_kcontrol_new tegra210_admaif_controls[] = { From patchwork Thu Nov 18 07:07:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626083 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6190C433F5 for ; Thu, 18 Nov 2021 07:10:45 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1A2C16128C for ; Thu, 18 Nov 2021 07:10:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1A2C16128C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 70E5F18B2; Thu, 18 Nov 2021 08:09:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 70E5F18B2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219443; bh=1N7wFyT0DwGLEReW8NgGhhkC9Nt9dihutUgqMiuVc/g=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YfzLcWHloIqF4gNsoy7BMOA0o86ktdglNoVcbcslfaUQecnNuoFqqrQpHPycjKQhk LvftdrMPEoPflA3CjoUjC4dc1nLfUpSrD5vg5QxQTvWnwqhgbjy3iM/U4rg7k34D21 3vafsEti0oDHUFN6/2brqhxQPoKULA5bZd/LWV/M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D4F36F8051F; Thu, 18 Nov 2021 08:08:11 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EEEF7F8051B; Thu, 18 Nov 2021 08:08:08 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2053.outbound.protection.outlook.com [40.107.94.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 556EBF80115 for ; Thu, 18 Nov 2021 08:07:54 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 556EBF80115 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="J4+3hiWS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MQhqvjH+pHfLbcE1psca/MbAVe/srYTO1BVxvuMv3Gb4ENRAXT2r03+At3hudeJgqItX0OxUK6N+LH0z/j3IY5lmjrNNPk59lcNP7fUD8zZeuB3WcDXt9ZCnDJlh5LlhKYx/hTozRnQBTRrEldFi1t5587bzp/hAFCNRCjC8S6tEsYMwXKc0jHzZdgpS9RILEgWroKhaET0GqzDZfR29D1n3Dj1P0NQmjDBedKO91vU1FnU4y5fVmqTJHqU8Fu4T0dI9dh+nHoaj1iKOcXRWQZ5oUnnOuyr7HvNAP6lbIrSSj/Wa3DJJr2TTmP9GyTPY8fudKpgK/6n0ea2DJ/wmNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eEEKudTWKk0QtMJIDz95B23T25QBZWfOPG0xmcPBvOw=; b=YzZqO5BwxvTGw/3ieciHRMfF4/vUQxORd891w1RGHJq2LLXgubzb7db8+cIGCHHxypJLeb+DTYpjL/uTkvldKYuM66hu7aR0owbgwi8ShqM+Mc5F1ZYQU8bTeHLf9qAYLmUoSHlC9gc6u0meADKnLLMHI9ye4LFo8JXvAyQpR+AJzUmugtrl2FKey+kIKu3vQMUR/I1yR4V3zBLPEkCAoLUGwK32lIa3eW0PcCE2rZF1QzNTyz0LEWOxOLKCm8uS85vD05wven1kcpsLqsWK2yN7uT5mUk0PH2Zcw9Jqg1rcF+QqUKxLNJCmR+GgheJPym72Q7xSYdkuW4AF1IRnJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=perex.cz smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eEEKudTWKk0QtMJIDz95B23T25QBZWfOPG0xmcPBvOw=; b=J4+3hiWSpoDvIH57L3LetMiE5R6HKw80n2ERNBkmSKbkfC89+ybqz6PfKLYgtUr8lZl0srJoQ9UG7ii5l85rodUT+peTlA55g5x3JSJfTBSwfQGDVsq2xRLfE5aKvOx8sZ+YxvsR094HAVtllvzGiwaWm7tWDZJGWewNqly8w8tUxWpC8APozIoaUBF18dJQfkn+3mYMZUHVnU9WEgCYB33A4giUBTZ/w0c0hWICcAERtH9AbJKeqUxo9D9SiRGY637V+NBB5afwxQQAjcevlXbXsOUuXtVCG3sO0SToQcCJ2kWFQ6Aj6MB/WkYL96Tp7Um8dBmoY1w7CZV5jN2TmQ== Received: from BN0PR07CA0012.namprd07.prod.outlook.com (2603:10b6:408:141::34) by DM6PR12MB3980.namprd12.prod.outlook.com (2603:10b6:5:1cc::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 07:07:50 +0000 Received: from BN8NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:408:141:cafe::e) by BN0PR07CA0012.outlook.office365.com (2603:10b6:408:141::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Thu, 18 Nov 2021 07:07:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT068.mail.protection.outlook.com (10.13.177.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:07:49 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:07:48 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:07:48 +0000 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:07:45 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 08/16] ASoC: tegra: Fix kcontrol put callback in I2S Date: Thu, 18 Nov 2021 12:37:03 +0530 Message-ID: <1637219231-406-9-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 914c3c62-fb88-414d-37de-08d9aa622192 X-MS-TrafficTypeDiagnostic: DM6PR12MB3980: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QBMsFnM/GaoUj+u4eidG64ObEQgibWNhODHVlbu0kjcHSZfAM2Xb4Noxdc3esj7ZNO5gsjoIuReuHRHTy3f+pG5sqLORrcln8s3HO2lt1W+xTseMiM2DrsoB8rwsXS230CDlI4qsJIy62Kpt++Ay4ucThcxL2sPHe8q96bA4tehvJSMlY8XZZy1FHRlv9vS/LoxT5H9Zic3bJ2hQd1108j4vRXHxglCASXkt2o74YXlvWR1wgH3Wxb77RqpPzAUoc21ersJEdoGp6HEOWX0kjPW8223sVELLdoss4DY8C20/1ph7UtVZ3RoKzpWIjb0Fsa4D9R0bTupAJ+MRqKF1mHk4m5i70l4iI9Vf6v+oXmXrKm//qvJ0rdbAaE3XxY1LWovwnWQ+lfMQv/tiYAsvllHWW5xSrnEok2orr6FkJAwb9C8Zjdv7Lyk8MDLW/nIysOW2moU5V7a18FcT7GnsxuivG3XDBA1MdjdEj33MaOxWka4AcI0zNG0mKtkfPf32HwNMO6x1WVBcyhUmQupLyQblKtHPA7jgYwCEcJc3k7THaPdS1lOsSYUw28HyJ6ajnqMzLYQ5HtP2e62r3I+oimG+Ez1hDWy2dZqK74b0wpAhtP3dRErtX4sftc2ykxqeg1UvWd4Kj0XW3pk7LN8z1Loo7U4/Pz3ObX+ypJ5jhEWJIcDiGcnygJj1yCQdHjnXWgSQJEcb8hZRFz8hKLF8nA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(36860700001)(26005)(7636003)(5660300002)(356005)(508600001)(47076005)(336012)(2616005)(186003)(82310400003)(426003)(30864003)(2906002)(86362001)(7696005)(70206006)(54906003)(70586007)(110136005)(36756003)(8936002)(8676002)(316002)(83380400001)(107886003)(6666004)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:07:49.4184 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 914c3c62-fb88-414d-37de-08d9aa622192 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3980 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Update the I2S driver accordingly. Fixes: c0bfa98349d1 ("ASoC: tegra: Add Tegra210 based I2S driver") Suggested-by: Jaroslav Kysela Suggested-by: Mark Brown Signed-off-by: Sameer Pujar --- sound/soc/tegra/tegra210_i2s.c | 302 ++++++++++++++++++++++++++++++----------- 1 file changed, 226 insertions(+), 76 deletions(-) diff --git a/sound/soc/tegra/tegra210_i2s.c b/sound/soc/tegra/tegra210_i2s.c index 5c30461..9552bbb 100644 --- a/sound/soc/tegra/tegra210_i2s.c +++ b/sound/soc/tegra/tegra210_i2s.c @@ -302,91 +302,235 @@ static int tegra210_i2s_set_tdm_slot(struct snd_soc_dai *dai, return 0; } -static int tegra210_i2s_set_dai_bclk_ratio(struct snd_soc_dai *dai, - unsigned int ratio) +static int tegra210_i2s_get_loopback(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - struct tegra210_i2s *i2s = snd_soc_dai_get_drvdata(dai); + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); - i2s->bclk_ratio = ratio; + ucontrol->value.integer.value[0] = i2s->loopback; return 0; } -static int tegra210_i2s_get_control(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static int tegra210_i2s_put_loopback(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + int value = ucontrol->value.integer.value[0]; + + if (value == i2s->loopback) + return 0; + + i2s->loopback = value; - if (strstr(kcontrol->id.name, "Loopback")) - ucontrol->value.integer.value[0] = i2s->loopback; - else if (strstr(kcontrol->id.name, "FSYNC Width")) - ucontrol->value.integer.value[0] = i2s->fsync_width; - else if (strstr(kcontrol->id.name, "Capture Stereo To Mono")) - ucontrol->value.enumerated.item[0] = - i2s->stereo_to_mono[I2S_TX_PATH]; - else if (strstr(kcontrol->id.name, "Capture Mono To Stereo")) - ucontrol->value.enumerated.item[0] = - i2s->mono_to_stereo[I2S_TX_PATH]; - else if (strstr(kcontrol->id.name, "Playback Stereo To Mono")) - ucontrol->value.enumerated.item[0] = - i2s->stereo_to_mono[I2S_RX_PATH]; - else if (strstr(kcontrol->id.name, "Playback Mono To Stereo")) - ucontrol->value.enumerated.item[0] = - i2s->mono_to_stereo[I2S_RX_PATH]; - else if (strstr(kcontrol->id.name, "Playback FIFO Threshold")) - ucontrol->value.integer.value[0] = i2s->rx_fifo_th; - else if (strstr(kcontrol->id.name, "BCLK Ratio")) - ucontrol->value.integer.value[0] = i2s->bclk_ratio; + regmap_update_bits(i2s->regmap, TEGRA210_I2S_CTRL, I2S_CTRL_LPBK_MASK, + i2s->loopback << I2S_CTRL_LPBK_SHIFT); + + return 1; +} + +static int tegra210_i2s_get_fsync_width(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + + ucontrol->value.integer.value[0] = i2s->fsync_width; return 0; } -static int tegra210_i2s_put_control(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static int tegra210_i2s_put_fsync_width(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + int value = ucontrol->value.integer.value[0]; + + if (value == i2s->fsync_width) + return 0; + + i2s->fsync_width = value; + + /* + * Frame sync width is used only for FSYNC modes and not + * applicable for LRCK modes. Reset value for this field is "0", + * which means the width is one bit clock wide. + * The width requirement may depend on the codec and in such + * cases mixer control is used to update custom values. A value + * of "N" here means, width is "N + 1" bit clock wide. + */ + regmap_update_bits(i2s->regmap, TEGRA210_I2S_CTRL, + I2S_CTRL_FSYNC_WIDTH_MASK, + i2s->fsync_width << I2S_FSYNC_WIDTH_SHIFT); + + return 1; +} + +static int tegra210_i2s_cget_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); - if (strstr(kcontrol->id.name, "Loopback")) { - i2s->loopback = ucontrol->value.integer.value[0]; + ucontrol->value.enumerated.item[0] = i2s->stereo_to_mono[I2S_TX_PATH]; - regmap_update_bits(i2s->regmap, TEGRA210_I2S_CTRL, - I2S_CTRL_LPBK_MASK, - i2s->loopback << I2S_CTRL_LPBK_SHIFT); + return 0; +} - } else if (strstr(kcontrol->id.name, "FSYNC Width")) { - /* - * Frame sync width is used only for FSYNC modes and not - * applicable for LRCK modes. Reset value for this field is "0", - * which means the width is one bit clock wide. - * The width requirement may depend on the codec and in such - * cases mixer control is used to update custom values. A value - * of "N" here means, width is "N + 1" bit clock wide. - */ - i2s->fsync_width = ucontrol->value.integer.value[0]; - - regmap_update_bits(i2s->regmap, TEGRA210_I2S_CTRL, - I2S_CTRL_FSYNC_WIDTH_MASK, - i2s->fsync_width << I2S_FSYNC_WIDTH_SHIFT); - - } else if (strstr(kcontrol->id.name, "Capture Stereo To Mono")) { - i2s->stereo_to_mono[I2S_TX_PATH] = - ucontrol->value.enumerated.item[0]; - } else if (strstr(kcontrol->id.name, "Capture Mono To Stereo")) { - i2s->mono_to_stereo[I2S_TX_PATH] = - ucontrol->value.enumerated.item[0]; - } else if (strstr(kcontrol->id.name, "Playback Stereo To Mono")) { - i2s->stereo_to_mono[I2S_RX_PATH] = - ucontrol->value.enumerated.item[0]; - } else if (strstr(kcontrol->id.name, "Playback Mono To Stereo")) { - i2s->mono_to_stereo[I2S_RX_PATH] = - ucontrol->value.enumerated.item[0]; - } else if (strstr(kcontrol->id.name, "Playback FIFO Threshold")) { - i2s->rx_fifo_th = ucontrol->value.integer.value[0]; - } else if (strstr(kcontrol->id.name, "BCLK Ratio")) { - i2s->bclk_ratio = ucontrol->value.integer.value[0]; - } +static int tegra210_i2s_cput_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == i2s->stereo_to_mono[I2S_TX_PATH]) + return 0; + + i2s->stereo_to_mono[I2S_TX_PATH] = value; + + return 1; +} + +static int tegra210_i2s_cget_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + + ucontrol->value.enumerated.item[0] = i2s->mono_to_stereo[I2S_TX_PATH]; + + return 0; +} + +static int tegra210_i2s_cput_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == i2s->mono_to_stereo[I2S_TX_PATH]) + return 0; + + i2s->mono_to_stereo[I2S_TX_PATH] = value; + + return 1; +} + +static int tegra210_i2s_pget_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + + ucontrol->value.enumerated.item[0] = i2s->stereo_to_mono[I2S_RX_PATH]; + + return 0; +} + +static int tegra210_i2s_pput_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == i2s->stereo_to_mono[I2S_RX_PATH]) + return 0; + + i2s->stereo_to_mono[I2S_RX_PATH] = value; + + return 1; +} + +static int tegra210_i2s_pget_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + + ucontrol->value.enumerated.item[0] = i2s->mono_to_stereo[I2S_RX_PATH]; + + return 0; +} + +static int tegra210_i2s_pput_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == i2s->mono_to_stereo[I2S_RX_PATH]) + return 0; + + i2s->mono_to_stereo[I2S_RX_PATH] = value; + + return 1; +} + +static int tegra210_i2s_pget_fifo_th(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + + ucontrol->value.integer.value[0] = i2s->rx_fifo_th; + + return 0; +} + +static int tegra210_i2s_pput_fifo_th(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + int value = ucontrol->value.integer.value[0]; + + if (value == i2s->rx_fifo_th) + return 0; + + i2s->rx_fifo_th = value; + + return 1; +} + +static int tegra210_i2s_get_bclk_ratio(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + + ucontrol->value.integer.value[0] = i2s->bclk_ratio; + + return 0; +} + +static int tegra210_i2s_put_bclk_ratio(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt); + int value = ucontrol->value.integer.value[0]; + + if (value == i2s->bclk_ratio) + return 0; + + i2s->bclk_ratio = value; + + return 1; +} + +static int tegra210_i2s_set_dai_bclk_ratio(struct snd_soc_dai *dai, + unsigned int ratio) +{ + struct tegra210_i2s *i2s = snd_soc_dai_get_drvdata(dai); + + i2s->bclk_ratio = ratio; return 0; } @@ -604,22 +748,28 @@ static const struct soc_enum tegra210_i2s_stereo_conv_enum = tegra210_i2s_stereo_conv_text); static const struct snd_kcontrol_new tegra210_i2s_controls[] = { - SOC_SINGLE_EXT("Loopback", 0, 0, 1, 0, tegra210_i2s_get_control, - tegra210_i2s_put_control), - SOC_SINGLE_EXT("FSYNC Width", 0, 0, 255, 0, tegra210_i2s_get_control, - tegra210_i2s_put_control), + SOC_SINGLE_EXT("Loopback", 0, 0, 1, 0, tegra210_i2s_get_loopback, + tegra210_i2s_put_loopback), + SOC_SINGLE_EXT("FSYNC Width", 0, 0, 255, 0, + tegra210_i2s_get_fsync_width, + tegra210_i2s_put_fsync_width), SOC_ENUM_EXT("Capture Stereo To Mono", tegra210_i2s_stereo_conv_enum, - tegra210_i2s_get_control, tegra210_i2s_put_control), + tegra210_i2s_cget_stereo_to_mono, + tegra210_i2s_cput_stereo_to_mono), SOC_ENUM_EXT("Capture Mono To Stereo", tegra210_i2s_mono_conv_enum, - tegra210_i2s_get_control, tegra210_i2s_put_control), + tegra210_i2s_cget_mono_to_stereo, + tegra210_i2s_cput_mono_to_stereo), SOC_ENUM_EXT("Playback Stereo To Mono", tegra210_i2s_stereo_conv_enum, - tegra210_i2s_get_control, tegra210_i2s_put_control), + tegra210_i2s_pget_mono_to_stereo, + tegra210_i2s_pput_mono_to_stereo), SOC_ENUM_EXT("Playback Mono To Stereo", tegra210_i2s_mono_conv_enum, - tegra210_i2s_get_control, tegra210_i2s_put_control), + tegra210_i2s_pget_stereo_to_mono, + tegra210_i2s_pput_stereo_to_mono), SOC_SINGLE_EXT("Playback FIFO Threshold", 0, 0, I2S_RX_FIFO_DEPTH - 1, - 0, tegra210_i2s_get_control, tegra210_i2s_put_control), - SOC_SINGLE_EXT("BCLK Ratio", 0, 0, INT_MAX, 0, tegra210_i2s_get_control, - tegra210_i2s_put_control), + 0, tegra210_i2s_pget_fifo_th, tegra210_i2s_pput_fifo_th), + SOC_SINGLE_EXT("BCLK Ratio", 0, 0, INT_MAX, 0, + tegra210_i2s_get_bclk_ratio, + tegra210_i2s_put_bclk_ratio), }; static const struct snd_soc_dapm_widget tegra210_i2s_widgets[] = { From patchwork Thu Nov 18 07:07:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626105 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C86D9C433F5 for ; Thu, 18 Nov 2021 07:14:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4609A611C5 for ; Thu, 18 Nov 2021 07:14:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4609A611C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B0C2F18C5; Thu, 18 Nov 2021 08:13:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B0C2F18C5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219652; bh=Y3wh1IweUUvqFj9O9aqGU+JHvZ7kAguFSMj7yvIADqs=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=I18dPvu/6HbIkhYm3IT+jFa6gKfwR7hhS6CyiYK47BvlZIE4uGKWaxRGa8CF1miY3 9GqCcqi0iObzmV349nNdF/x1DzMag7/vscD07V/yQKn1hmQoh9XX/OH9evjUbEUEOP GcsRxIV5w6uNgRElmls0SYzTcxabeCgccLYMpowk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 34B37F804FC; Thu, 18 Nov 2021 08:10:01 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 24F01F80423; Thu, 18 Nov 2021 08:09:36 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2058.outbound.protection.outlook.com [40.107.93.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 18655F804FE for ; Thu, 18 Nov 2021 08:07:56 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 18655F804FE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="XCrP5Qxk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JtKYL6Tie75wOgYcX5/XHWH342gNMl/iG7sLmxCNeaO8I6Gp3/wl1nuJ3mXLahu0MM86siszUezwne7OkvAv51sh0Cj9x6YwJn3WQnnMOmstCFk19EotzFLSbQFT9/lNvKvNc+Auj5fOcRdAXlZ3G66LGPN5/Axa41WTugbjnxXpmO50USO3pfKrkhCGO2rmjdtNRv5TSnvoRtLMsiK5BdBrsNqNboaAdu2ILYPCfI55tusKbf/YlRS0pMpJGfD6s1h7Gk84/XjFj+zjMJxqD5w0kG1yssCRtSMqttM6iwL63h9BwLP8TZjGbMFiuDHDRUVQ3wVfYDLgL2YYlIISsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=191Q6XSEun4VNne3at/RyZO5r8kHGp0iRg/Sz8UD2VI=; b=X7MjLeQuJGqcyKAYKkCAT+n3PUoG3E1MlMAdVv/xBan4tpPu435L5SwMLK1V/vqLfWXQiJ+KU371o8BQaa5Px7r2BmNyen3WHBb5hehX0631xnce43JJl7nSbINJlD8NP8+QG/QW6ZVHUKd65OM/rRFFlnn/uRLJJJ7bmHSegbzBBpCIHfTz5Nr6ALKsx94vL9B3rghWrO8WNTCkA+lI81a1uyWJIbO9hycrE2kS6AxyQGlLH1MloJ2ye86M27Mgc5Bs+QvGRsJu5ESP1rZey/N/HHVcy1Wbhy78QtfIBql721EyYQ9lgxo9N4px9m5piGGOJBdyLYBjTIDFjhM/bA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=191Q6XSEun4VNne3at/RyZO5r8kHGp0iRg/Sz8UD2VI=; b=XCrP5QxkaNwbhZZOkZC+sw27da0w9LWh3Mk/hMs9GT5IeZaHZbjqAculPoa5k1raXi5UidudljAqV+RRdX3+93tLWEGXM+GV1D8EvHUw6nKfxD7otuAHmWkGIqiBEQzZ1Q7CugMp3JoPaSiEGePLbHuZp/LQKgjjEfmLc8dQ3P0glQbWyX0X7hpYldrcTFkWsKP2Fs6500XQdW01SGwWFu/TguAFWDYqrys0A+Srz4NPeMlhUsi36fBZvpX6/mVCAdnQ5S/ggj2hAJAv0fJc1KIaGbGzZ/nY67+VFAokyV7VuH/SdJLm907k7T2B/+dbVK8hKRaI7XmIAjEMuq5A/g== Received: from BN6PR2001CA0044.namprd20.prod.outlook.com (2603:10b6:405:16::30) by BYAPR12MB3414.namprd12.prod.outlook.com (2603:10b6:a03:aa::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15; Thu, 18 Nov 2021 07:07:52 +0000 Received: from BN8NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:405:16:cafe::8d) by BN6PR2001CA0044.outlook.office365.com (2603:10b6:405:16::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Thu, 18 Nov 2021 07:07:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by BN8NAM11FT025.mail.protection.outlook.com (10.13.177.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:07:51 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 17 Nov 2021 23:07:50 -0800 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:07:48 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 09/16] ASoC: tegra: Fix kcontrol put callback in DMIC Date: Thu, 18 Nov 2021 12:37:04 +0530 Message-ID: <1637219231-406-10-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2417427d-dfc2-45db-7ad7-08d9aa622307 X-MS-TrafficTypeDiagnostic: BYAPR12MB3414: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 18lyeGlrx73/gckPfg0GYCcLvFpbGIVZasTr6KRXWMB/4JnfIPThms0Y0evrl82QYj+pwGmiLZb/p44wkDfwpHwlwBZTPEGbPVNZwrnIMOhCi+fg8/t7SsGfVh3eKPcb2iOAcQUHxhJlQ2upcme/y9WF4s7McXNIeH99hai0Izgv2GfF8OysFc69lFq301U8VL/liU7cnYK8SVkgJBP6giBLq/aycvGgt8vJ0Ry1RH9rY9FAiv3EuaUldfh3rLwexEAl0qC8iSOOETKoaRaR7S1UpdUZNtRBqVfG5pzoTmZnaOlIGEuGqGM8G55VIsXOiF1Nb5whLZ16iQCNnYDpj5K/WwWXoz5BnAwQXFFKOxYwYNLXcx6zBmeiPLMII2k2oQojoDlvVZQDdUQCPS0RR0LurjTx39A1NXwAHJDzdFEy/IYfMPmv93Xp9cclzK0zq4pzZfyMrMcOMrCaghcKtexCUyIbwWzdP+tX5MyK40e24WOH28lHCnce5JkiLuFXPVNV/MMBGgK1QszEkI+LeM3ARU/LrmsC1HLPig+F9tikjn5ZmzvHd3jAUdxQambzdKqOkdu8kunajYKWQ/EJ+duEwK4Sz28UrxMtn2vRfIRKJtxc0+zHtO+WEr+pAyH2l6Oa8TnDp7vJo2e9xY8H7lN+jiLFNjnGeEY4nhw/cuYjPlwXjf5UV/ZE+jWEQSLb/XzE6YnctxFlgT8LbQvt9w== X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(26005)(2906002)(107886003)(54906003)(86362001)(70586007)(5660300002)(4326008)(316002)(70206006)(82310400003)(7636003)(7696005)(83380400001)(6666004)(36756003)(186003)(36860700001)(47076005)(426003)(8676002)(110136005)(356005)(2616005)(508600001)(8936002)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:07:51.8596 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2417427d-dfc2-45db-7ad7-08d9aa622307 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3414 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Update the DMIC driver accordingly. Fixes: 8c8ff982e9e2 ("ASoC: tegra: Add Tegra210 based DMIC driver") Suggested-by: Jaroslav Kysela Suggested-by: Mark Brown Signed-off-by: Sameer Pujar --- sound/soc/tegra/tegra210_dmic.c | 183 ++++++++++++++++++++++++++++++++-------- 1 file changed, 149 insertions(+), 34 deletions(-) diff --git a/sound/soc/tegra/tegra210_dmic.c b/sound/soc/tegra/tegra210_dmic.c index ee2aedb..db95794 100644 --- a/sound/soc/tegra/tegra210_dmic.c +++ b/sound/soc/tegra/tegra210_dmic.c @@ -156,50 +156,162 @@ static int tegra210_dmic_hw_params(struct snd_pcm_substream *substream, return 0; } -static int tegra210_dmic_get_control(struct snd_kcontrol *kcontrol, +static int tegra210_dmic_get_boost_gain(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); + + ucontrol->value.integer.value[0] = dmic->boost_gain; + + return 0; +} + +static int tegra210_dmic_put_boost_gain(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); + int value = ucontrol->value.integer.value[0]; + + if (value == dmic->boost_gain) + return 0; + + dmic->boost_gain = value; + + return 1; +} + +static int tegra210_dmic_get_ch_select(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); + + ucontrol->value.enumerated.item[0] = dmic->ch_select; + + return 0; +} + +static int tegra210_dmic_put_ch_select(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == dmic->ch_select) + return 0; + + dmic->ch_select = value; + + return 1; +} + +static int tegra210_dmic_get_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); + + ucontrol->value.enumerated.item[0] = dmic->mono_to_stereo; + + return 0; +} + +static int tegra210_dmic_put_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == dmic->mono_to_stereo) + return 0; + + dmic->mono_to_stereo = value; + + return 1; +} + +static int tegra210_dmic_get_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); + + ucontrol->value.enumerated.item[0] = dmic->stereo_to_mono; + + return 0; +} + +static int tegra210_dmic_put_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == dmic->stereo_to_mono) + return 0; + + dmic->stereo_to_mono = value; + + return 1; +} + +static int tegra210_dmic_get_osr_val(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); - if (strstr(kcontrol->id.name, "Boost Gain Volume")) - ucontrol->value.integer.value[0] = dmic->boost_gain; - else if (strstr(kcontrol->id.name, "Channel Select")) - ucontrol->value.enumerated.item[0] = dmic->ch_select; - else if (strstr(kcontrol->id.name, "Mono To Stereo")) - ucontrol->value.enumerated.item[0] = dmic->mono_to_stereo; - else if (strstr(kcontrol->id.name, "Stereo To Mono")) - ucontrol->value.enumerated.item[0] = dmic->stereo_to_mono; - else if (strstr(kcontrol->id.name, "OSR Value")) - ucontrol->value.enumerated.item[0] = dmic->osr_val; - else if (strstr(kcontrol->id.name, "LR Polarity Select")) - ucontrol->value.enumerated.item[0] = dmic->lrsel; + ucontrol->value.enumerated.item[0] = dmic->osr_val; return 0; } -static int tegra210_dmic_put_control(struct snd_kcontrol *kcontrol, +static int tegra210_dmic_put_osr_val(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == dmic->osr_val) + return 0; + + dmic->osr_val = value; + + return 1; +} + +static int tegra210_dmic_get_pol_sel(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); - if (strstr(kcontrol->id.name, "Boost Gain Volume")) - dmic->boost_gain = ucontrol->value.integer.value[0]; - else if (strstr(kcontrol->id.name, "Channel Select")) - dmic->ch_select = ucontrol->value.enumerated.item[0]; - else if (strstr(kcontrol->id.name, "Mono To Stereo")) - dmic->mono_to_stereo = ucontrol->value.enumerated.item[0]; - else if (strstr(kcontrol->id.name, "Stereo To Mono")) - dmic->stereo_to_mono = ucontrol->value.enumerated.item[0]; - else if (strstr(kcontrol->id.name, "OSR Value")) - dmic->osr_val = ucontrol->value.enumerated.item[0]; - else if (strstr(kcontrol->id.name, "LR Polarity Select")) - dmic->lrsel = ucontrol->value.enumerated.item[0]; + ucontrol->value.enumerated.item[0] = dmic->lrsel; return 0; } +static int tegra210_dmic_put_pol_sel(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == dmic->lrsel) + return 0; + + dmic->lrsel = value; + + return 1; +} + static const struct snd_soc_dai_ops tegra210_dmic_dai_ops = { .hw_params = tegra210_dmic_hw_params, }; @@ -286,19 +398,22 @@ static const struct soc_enum tegra210_dmic_lrsel_enum = static const struct snd_kcontrol_new tegra210_dmic_controls[] = { SOC_SINGLE_EXT("Boost Gain Volume", 0, 0, MAX_BOOST_GAIN, 0, - tegra210_dmic_get_control, tegra210_dmic_put_control), + tegra210_dmic_get_boost_gain, + tegra210_dmic_put_boost_gain), SOC_ENUM_EXT("Channel Select", tegra210_dmic_ch_enum, - tegra210_dmic_get_control, tegra210_dmic_put_control), + tegra210_dmic_get_ch_select, tegra210_dmic_put_ch_select), SOC_ENUM_EXT("Mono To Stereo", - tegra210_dmic_mono_conv_enum, tegra210_dmic_get_control, - tegra210_dmic_put_control), + tegra210_dmic_mono_conv_enum, + tegra210_dmic_get_mono_to_stereo, + tegra210_dmic_put_mono_to_stereo), SOC_ENUM_EXT("Stereo To Mono", - tegra210_dmic_stereo_conv_enum, tegra210_dmic_get_control, - tegra210_dmic_put_control), + tegra210_dmic_stereo_conv_enum, + tegra210_dmic_get_stereo_to_mono, + tegra210_dmic_put_stereo_to_mono), SOC_ENUM_EXT("OSR Value", tegra210_dmic_osr_enum, - tegra210_dmic_get_control, tegra210_dmic_put_control), + tegra210_dmic_get_osr_val, tegra210_dmic_put_osr_val), SOC_ENUM_EXT("LR Polarity Select", tegra210_dmic_lrsel_enum, - tegra210_dmic_get_control, tegra210_dmic_put_control), + tegra210_dmic_get_pol_sel, tegra210_dmic_put_pol_sel), }; static const struct snd_soc_component_driver tegra210_dmic_compnt = { From patchwork Thu Nov 18 07:07:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626085 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20ED1C433EF for ; Thu, 18 Nov 2021 07:11:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 9CE056128C for ; Thu, 18 Nov 2021 07:11:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9CE056128C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 183DD18C9; Thu, 18 Nov 2021 08:10:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 183DD18C9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219464; bh=ENfUTimaxCbiVl5o7uSL9/WyanVBBlvEpIgsBmPQhB0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=LeMzI6Wh2iO9GbtPDK5DgNUzunyjQG4AGcAWRzVWfNpov47AkGJP3NNAArLRQUZw6 28ttnIuO4DHMj6ONZpaG3hfQipNHZI4axBLbWFhsMQ8c3E8wxOIkOAubsqKak/XQzO 9CeQ2GHD+24RVRt2bWdThJuNdT3S8+LJlcddhXkU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 81465F804DF; Thu, 18 Nov 2021 08:08:25 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 26803F8052E; Thu, 18 Nov 2021 08:08:23 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2049.outbound.protection.outlook.com [40.107.93.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C424CF804DF for ; Thu, 18 Nov 2021 08:07:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C424CF804DF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="BvqoLZ3Q" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZVVz2BUZ1AYJP3ynRSpXN2mmxuVR9EvXXQJaCvGBE47KQ6l5Oa4qAY9tm1IZeqSF33lqPVq2Omx1gZg5102rjGd5ZWlqowKlgTfTVP1/OXfRz4wossw1XQ6ggr/OpxIyJN6A5sTiD9Uf9A7lZSviopNjDDms3tdqa0/66NSkJ00YnuUcKonVzBk1A03ZW3EK3TJerU79NnTm9a7D/CcoCl8paikCIGkamhrvKOnMgRGkWSDV2ZKtrElTr55ZmEZ4/NCrkXeWGKcAqVbFOF/Rm/vH4bFZ+/h8qWmef3C3tGgV7nwlkw9Pq0GcZk21fwW4PDZnhKIFiDybvtnWJnt1ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7EyzUBn0C50ScRpxCiSjR/hwHCTAIwl7ZGwCwMD4AjA=; b=Fuk22ysly6FwJQ/efI/yUx5qtWMPGf4M3HK0UEr8djVPRYmvtMjVSYmyGXBcsj5Wg50OAL19QNXxUw4Z94Rn646DYIekKGTVM63kCVCn1VrSAlElIiehEA4AauwOoSWNxheLEJhvKkKngn6CVyGElbi/B/4tYJ1U9AGk4fhh0m+dWG1lM2v9Rz7xNvlguRQZETRepZ9haPBQ6kPT8IHZMtwt5ewllWgamoOLks7kKPsJpenZqMUaQEPbpZD9U60XKO2D7s/7GGEmO8LDWa3+GFLBsviat2Sqhz1iWcaE4eBnUGzrALGy/czkI4z6DB8n8taw+wimcSCC8x41g83yJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=perex.cz smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7EyzUBn0C50ScRpxCiSjR/hwHCTAIwl7ZGwCwMD4AjA=; b=BvqoLZ3Qh24RTLR9wjwnpacqkwhOra0RtgdwZBYyXol4RmVLMkxIaX2ZUjqQR2wg1FIdtPa7zwAGdTeuDZZrBAugV3nG7PHsAqH3liVdCTD2x9oHKabwRueASBtkGGcOM7Mjnbio/DvDs53giNIULSzzaw1xz2aqUBxsGh4ZIZzGypUOjORXYFxYCu6REVo/pBEqy1/7SbjxrRi5SzQHTJN4/Rl+uVUrVybrw+S2zOi6fQirjqyLzxSE1y72WlvpF80KHhNFhHNWvxTlK+HfS6CO4beGxUCiqnAC/26VfsDJ2+6nF50dh8sS4q6NdA/CqR6DZWcvgkIR9wlRU/y20g== Received: from BN9PR03CA0809.namprd03.prod.outlook.com (2603:10b6:408:13f::34) by CH2PR12MB3734.namprd12.prod.outlook.com (2603:10b6:610:2a::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 07:07:55 +0000 Received: from BN8NAM11FT040.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13f:cafe::a2) by BN9PR03CA0809.outlook.office365.com (2603:10b6:408:13f::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27 via Frontend Transport; Thu, 18 Nov 2021 07:07:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by BN8NAM11FT040.mail.protection.outlook.com (10.13.177.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:07:54 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 17 Nov 2021 23:07:54 -0800 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:07:53 +0000 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:07:51 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 10/16] ASoC: tegra: Fix kcontrol put callback in DSPK Date: Thu, 18 Nov 2021 12:37:05 +0530 Message-ID: <1637219231-406-11-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5925f29f-87ba-467a-5281-08d9aa6224d1 X-MS-TrafficTypeDiagnostic: CH2PR12MB3734: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 331NgMp502owJZ3fl/lm4+gS0mVMMqas3NS/e/lJ0aNQTnQWXjK2nwLcpyAzHGPT5Du18E7M5RrrWNnAB17dBL5bCEEDCyLOOvJJO1yvv12GX7a5/PEkUuSKWZuvw86BrmRrjp7ur7KH9zU5pUsPmIM3zxLRhCyCnK2Jh4bRwtRPyckgolnjjvkjVKYjl/SBLUFshhPkRXMInwtoyENe71KOtzyCEfl4Dl/QgBmmHKefkPkMDhNyphixJOuoSNvCu/yH3mZlm2qj0HqF6tSSpvTUUOCmdqq/g4IOnZCiiqeMlQfbhTWrk/5WuQZlq2RYH2xSz36GMhlRxez9hmTwpjiWrZFfYgYxWIOfzF+8M6ft82dXXcLbrzSamhyh5Cj8JAzRmUn4cMZJDG1WGGWHYpBCCPDiI7cZxMlbMsH/s5/rxT3iTp3/q9Wtt7ch0XgP/3mMEvGqx/p3x4PpfM22q8qU66Uavqele+Z7YdOIIaO9n51p2srVwKjDD9v1hpN7KF8LZDnEqc4JbSDYBDE05stVuv1Fe94pt7ubPKYJMh/3Dc5PA3Y9E9GR1Z9D22hhFoq/aU9pyctByZ2i/jG+1glScYDC9otB/YPctrslX21Sx5T4Kuje0hmrbhLZPN7rt2ELfkr+BVKvOLIdZKQTr4JWFCfd/VJo1EzJ+EG5v6kRoJJuwANB6YlavhDmBkKfSwQME5a1j3L95LQMSh7h9A== X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(26005)(5660300002)(8676002)(2906002)(107886003)(6666004)(8936002)(36756003)(2616005)(82310400003)(426003)(7696005)(4326008)(316002)(186003)(336012)(86362001)(356005)(47076005)(7636003)(110136005)(508600001)(70586007)(54906003)(83380400001)(36860700001)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:07:54.9171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5925f29f-87ba-467a-5281-08d9aa6224d1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT040.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3734 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Update the DSPK driver accordingly. Fixes: 327ef6470266 ("ASoC: tegra: Add Tegra186 based DSPK driver") Suggested-by: Jaroslav Kysela Suggested-by: Mark Brown Signed-off-by: Sameer Pujar --- sound/soc/tegra/tegra186_dspk.c | 178 ++++++++++++++++++++++++++++++++-------- 1 file changed, 146 insertions(+), 32 deletions(-) diff --git a/sound/soc/tegra/tegra186_dspk.c b/sound/soc/tegra/tegra186_dspk.c index 67269e7..a74c980 100644 --- a/sound/soc/tegra/tegra186_dspk.c +++ b/sound/soc/tegra/tegra186_dspk.c @@ -26,50 +26,162 @@ static const struct reg_default tegra186_dspk_reg_defaults[] = { { TEGRA186_DSPK_CODEC_CTRL, 0x03000000 }, }; -static int tegra186_dspk_get_control(struct snd_kcontrol *kcontrol, +static int tegra186_dspk_get_fifo_th(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); - if (strstr(kcontrol->id.name, "FIFO Threshold")) - ucontrol->value.integer.value[0] = dspk->rx_fifo_th; - else if (strstr(kcontrol->id.name, "OSR Value")) - ucontrol->value.enumerated.item[0] = dspk->osr_val; - else if (strstr(kcontrol->id.name, "LR Polarity Select")) - ucontrol->value.enumerated.item[0] = dspk->lrsel; - else if (strstr(kcontrol->id.name, "Channel Select")) - ucontrol->value.enumerated.item[0] = dspk->ch_sel; - else if (strstr(kcontrol->id.name, "Mono To Stereo")) - ucontrol->value.enumerated.item[0] = dspk->mono_to_stereo; - else if (strstr(kcontrol->id.name, "Stereo To Mono")) - ucontrol->value.enumerated.item[0] = dspk->stereo_to_mono; + ucontrol->value.integer.value[0] = dspk->rx_fifo_th; return 0; } -static int tegra186_dspk_put_control(struct snd_kcontrol *kcontrol, +static int tegra186_dspk_put_fifo_th(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); + int value = ucontrol->value.integer.value[0]; - if (strstr(kcontrol->id.name, "FIFO Threshold")) - dspk->rx_fifo_th = ucontrol->value.integer.value[0]; - else if (strstr(kcontrol->id.name, "OSR Value")) - dspk->osr_val = ucontrol->value.enumerated.item[0]; - else if (strstr(kcontrol->id.name, "LR Polarity Select")) - dspk->lrsel = ucontrol->value.enumerated.item[0]; - else if (strstr(kcontrol->id.name, "Channel Select")) - dspk->ch_sel = ucontrol->value.enumerated.item[0]; - else if (strstr(kcontrol->id.name, "Mono To Stereo")) - dspk->mono_to_stereo = ucontrol->value.enumerated.item[0]; - else if (strstr(kcontrol->id.name, "Stereo To Mono")) - dspk->stereo_to_mono = ucontrol->value.enumerated.item[0]; + if (value == dspk->rx_fifo_th) + return 0; + + dspk->rx_fifo_th = value; + + return 1; +} + +static int tegra186_dspk_get_osr_val(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); + + ucontrol->value.enumerated.item[0] = dspk->osr_val; + + return 0; +} + +static int tegra186_dspk_put_osr_val(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == dspk->osr_val) + return 0; + + dspk->osr_val = value; + + return 1; +} + +static int tegra186_dspk_get_pol_sel(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); + + ucontrol->value.enumerated.item[0] = dspk->lrsel; + + return 0; +} + +static int tegra186_dspk_put_pol_sel(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == dspk->lrsel) + return 0; + + dspk->lrsel = value; + + return 1; +} + +static int tegra186_dspk_get_ch_sel(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); + + ucontrol->value.enumerated.item[0] = dspk->ch_sel; + + return 0; +} + +static int tegra186_dspk_put_ch_sel(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == dspk->ch_sel) + return 0; + + dspk->ch_sel = value; + + return 1; +} + +static int tegra186_dspk_get_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); + + ucontrol->value.enumerated.item[0] = dspk->mono_to_stereo; + + return 0; +} + +static int tegra186_dspk_put_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == dspk->mono_to_stereo) + return 0; + + dspk->mono_to_stereo = value; + + return 1; +} + +static int tegra186_dspk_get_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); + + ucontrol->value.enumerated.item[0] = dspk->stereo_to_mono; return 0; } +static int tegra186_dspk_put_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == dspk->stereo_to_mono) + return 0; + + dspk->stereo_to_mono = value; + + return 1; +} + static int __maybe_unused tegra186_dspk_runtime_suspend(struct device *dev) { struct tegra186_dspk *dspk = dev_get_drvdata(dev); @@ -278,17 +390,19 @@ static const struct soc_enum tegra186_dspk_lrsel_enum = static const struct snd_kcontrol_new tegrat186_dspk_controls[] = { SOC_SINGLE_EXT("FIFO Threshold", SND_SOC_NOPM, 0, TEGRA186_DSPK_RX_FIFO_DEPTH - 1, 0, - tegra186_dspk_get_control, tegra186_dspk_put_control), + tegra186_dspk_get_fifo_th, tegra186_dspk_put_fifo_th), SOC_ENUM_EXT("OSR Value", tegra186_dspk_osr_enum, - tegra186_dspk_get_control, tegra186_dspk_put_control), + tegra186_dspk_get_osr_val, tegra186_dspk_put_osr_val), SOC_ENUM_EXT("LR Polarity Select", tegra186_dspk_lrsel_enum, - tegra186_dspk_get_control, tegra186_dspk_put_control), + tegra186_dspk_get_pol_sel, tegra186_dspk_put_pol_sel), SOC_ENUM_EXT("Channel Select", tegra186_dspk_ch_sel_enum, - tegra186_dspk_get_control, tegra186_dspk_put_control), + tegra186_dspk_get_ch_sel, tegra186_dspk_put_ch_sel), SOC_ENUM_EXT("Mono To Stereo", tegra186_dspk_mono_conv_enum, - tegra186_dspk_get_control, tegra186_dspk_put_control), + tegra186_dspk_get_mono_to_stereo, + tegra186_dspk_put_mono_to_stereo), SOC_ENUM_EXT("Stereo To Mono", tegra186_dspk_stereo_conv_enum, - tegra186_dspk_get_control, tegra186_dspk_put_control), + tegra186_dspk_get_stereo_to_mono, + tegra186_dspk_put_stereo_to_mono), }; static const struct snd_soc_component_driver tegra186_dspk_cmpnt = { From patchwork Thu Nov 18 07:07:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626087 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0BB1C433EF for ; Thu, 18 Nov 2021 07:11:33 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 278CA6115C for ; Thu, 18 Nov 2021 07:11:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 278CA6115C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 860D018D8; Thu, 18 Nov 2021 08:10:41 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 860D018D8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219491; bh=29UH+agiG+X5gC5QwxL1+UQGBRi57ixVPttfE4rnrvE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=oumAIKsawrVpFiYvzV9TBNqVcOewCQ0R+8cFDq7yo/869xZQLYwaTdm0YfpSJ+0AA 2TAMwIY2aFRGTNvDd7Dbg13zxDJQfiLi8lqQuraO2Rp215Gysy6PfWSUXnapFAn0EE ahgplqijPs5uDhQd4bzeny9lt9yPOBIp5J3ENtSk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 59962F8053B; Thu, 18 Nov 2021 08:08:30 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A023AF80535; Thu, 18 Nov 2021 08:08:26 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2063.outbound.protection.outlook.com [40.107.101.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9F611F80511 for ; Thu, 18 Nov 2021 08:08:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9F611F80511 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="S761Z5+E" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lfmF+5ZU+5SdQDi8mAs5DM/fzOXExlQ2tqjcczIpkib5EtCb7GqyfIKhIv+ifIGEurS2E2W890dPIXysxuHVv0Ne0aiId4V+lNr9mNZ3wzw8prlExI/jA4c4iKbRWguv7R0oxvOZdIgFO/cYvhSr35SbQQPBMrtLqQtnNbG4GW5B3X36Bj8KTqq74jS+JGIFAgk1DDa3yAE3tvnQ+ml8HT/bn0Ly3G25N6DwJCw0WlX2V9oIgs/frGK6SNNRodEUkZd6VPOyiqatiBca9MBsSeuv1pthTTuP8LCwXKYq7qumRPozB2M6+LrNGL4wUeoZXkhj4TtxFe3I4bIQmf0PbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=seKJXWAwKPt0HlTyQtw9cWNRWo8z3o3zV5fHVffk/V0=; b=OUx++er7HMowhUrE9ZtHdKJz9GSPrgg/s2p65NVCtmqMJ9in/sMeZRLsK1RtCJuBY26sdi8Ute5wkTI9dDcqHNcL+P3ht5HMoWJCBq4YDTXUYLF01exWy5zcsVJpKaVJIgkuQWVHagikdtQfLgYlWozkN6/N7fl9dzw4vnY0fKWBERD+FBV5HxYZvzklgb/Z4CX52tpc6ZqeBtwhreN07/4M4rP+DP5ASXs2rCddJbINeGRUbzRSCtx30w8otHeWxCOqKK95wzUUyDdKVyfxJnZglV6wa6Runy+qCWL0xszvX+yGWOn9/eOJiEBTStiDz+IUM5RccLHOKs9K2D3y7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=seKJXWAwKPt0HlTyQtw9cWNRWo8z3o3zV5fHVffk/V0=; b=S761Z5+E6NQKkHjuK1f5thcn6NyKd2i+sbW+oaLtN0i9vwYmF/8LrrLV0wcqBjZ09tbN6J8kadUTd9asRHN0ahMqbXeFDawL40uahpC4IQ6ir7DSLoUyyxbtY4ELNwarmZQ3EuwMaDXItk7zz6WozKoKAwFnGY65zT+PmPc+4hFdmhjQj4qP2TKbSLBUO1bI7iiALgysgD+mYwinAva5V2gn9xA2US6dvUiDX9IplUHz+AY2CawNVgBRHqSeaC9j31UZdOd2oQe2iFe4SljugRbfVuQ/h8eSxEeiu7ovgy/jlqFCxFkm+pK1vye2PY8dKDqAz3stxjGc4Vhiy9BJ+g== Received: from MW4PR04CA0162.namprd04.prod.outlook.com (2603:10b6:303:85::17) by DM4PR12MB5087.namprd12.prod.outlook.com (2603:10b6:5:38a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 07:07:59 +0000 Received: from CO1NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:303:85:cafe::98) by MW4PR04CA0162.outlook.office365.com (2603:10b6:303:85::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Thu, 18 Nov 2021 07:07:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by CO1NAM11FT012.mail.protection.outlook.com (10.13.175.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:07:57 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:07:56 +0000 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:07:54 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 11/16] ASoC: tegra: Fix kcontrol put callback in AHUB Date: Thu, 18 Nov 2021 12:37:06 +0530 Message-ID: <1637219231-406-12-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 79e6bd86-f6bc-4a42-8127-08d9aa622661 X-MS-TrafficTypeDiagnostic: DM4PR12MB5087: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 68a2v4+RVlSZizGF5mtDMlGnj9HJNb49LDlOKhkHg4dWQ1tYmOLVC0ebfENRlIqoso9uJy4YXq+m1gUDJDs9YLugOME7GNAO272GOSWPqdHwdoDbkTpnWVdEh0YD8LBU6ePdF3Fcm8Zh8DfDq7xtAan97jT78yV+TQM6lJn2pnjaPzRBrllyF/jEdATdrabDJhAHQJZEPeE4ZN2oP0OBSD7BQxpVUYwOwVyr07ZHVx4StM5A96fBuPlgsFbybmR35v0ixEhcEugmCxJxpCWtgJbMu6d/nxuh2MQ03QlOK8yz/8+ZkMO6yFdbb9xekXrAgtsKuWAsdZLAC3u1rv7onbDR0nAU/78lYhx38PNOQonlS/ce3XhY5fqmXWATkxxS1L29c0DlgpqEtcedxqzhM8siDN6vXnLI7bLmtV9T1J+hAc1cwO150zllvJFAKh/iR/oGzrLKqc3bOjqCsZZM8H1x/a/dgqR7Gnpw24dQJu+4cpb8HXfvpfGnK/Qb7qTlGVl/7fOClI5BlXunUbZrDbUupr1hzzdbfQ/RZ11GrjD/tGC5WnutbuXSF9EOflhU1e+QrFVXt5e1346ZWNSgU7L+fA84MsWIYVYaKLoH6W0uuAI5kZK4uKCnPJ6wQ4kA2ZE30/uRGCCpn5gLv44DhCqgpI6MObhAiilj2FXoGmyr6IYBv0CJ7m1qLBLStz/c0XiKljV2OZNWM5GybCX4qQ== X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid02.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(36860700001)(26005)(7636003)(5660300002)(356005)(508600001)(47076005)(336012)(186003)(2616005)(82310400003)(426003)(86362001)(2906002)(7696005)(70206006)(70586007)(54906003)(110136005)(36756003)(8936002)(36906005)(8676002)(316002)(83380400001)(107886003)(6666004)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:07:57.5947 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79e6bd86-f6bc-4a42-8127-08d9aa622661 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5087 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Update the AHUB driver accordingly. Fixes: 16e1bcc2caf4 ("ASoC: tegra: Add Tegra210 based AHUB driver") Signed-off-by: Sameer Pujar Suggested-by: Jaroslav Kysela Suggested-by: Mark Brown --- sound/soc/tegra/tegra210_ahub.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sound/soc/tegra/tegra210_ahub.c b/sound/soc/tegra/tegra210_ahub.c index a1989ea..388b815 100644 --- a/sound/soc/tegra/tegra210_ahub.c +++ b/sound/soc/tegra/tegra210_ahub.c @@ -62,6 +62,7 @@ static int tegra_ahub_put_value_enum(struct snd_kcontrol *kctl, unsigned int *item = uctl->value.enumerated.item; unsigned int value = e->values[item[0]]; unsigned int i, bit_pos, reg_idx = 0, reg_val = 0; + int change = 0; if (item[0] >= e->items) return -EINVAL; @@ -86,12 +87,14 @@ static int tegra_ahub_put_value_enum(struct snd_kcontrol *kctl, /* Update widget power if state has changed */ if (snd_soc_component_test_bits(cmpnt, update[i].reg, - update[i].mask, update[i].val)) - snd_soc_dapm_mux_update_power(dapm, kctl, item[0], e, - &update[i]); + update[i].mask, + update[i].val)) + change |= snd_soc_dapm_mux_update_power(dapm, kctl, + item[0], e, + &update[i]); } - return 0; + return change; } static struct snd_soc_dai_driver tegra210_ahub_dais[] = { From patchwork Thu Nov 18 07:07:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626089 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62CA9C433FE for ; Thu, 18 Nov 2021 07:11:46 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D78CB6115C for ; Thu, 18 Nov 2021 07:11:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D78CB6115C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4C4A618D4; Thu, 18 Nov 2021 08:10:54 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4C4A618D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219504; bh=b8exMLZWAG0FmcqtP9/Pa5PmmyiEiZnf7Gsybp9GEa4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CtCVgkEG4VX/TFLre+Tmh2sbD9XKwD3hj98MQLBXSunfPvTDWpePOwlVFwXjqudqT nsy0zTrZXNb7YNOLZZtod+VXoSz9GdqkbM+aOHSR3lU1AOXxMVg54x+8qEH6MLownr sx+L4xWlncGhL9nvvHT/rA8TGuElW0me0vMFeOAQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 61CCFF80518; Thu, 18 Nov 2021 08:08:35 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 110D6F8053E; Thu, 18 Nov 2021 08:08:33 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2041.outbound.protection.outlook.com [40.107.93.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5FD07F80518 for ; Thu, 18 Nov 2021 08:08:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5FD07F80518 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="o5PcF9mQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GGNs+IOGRRkz8D7WJM+zI7KHqbqtRjJM4AuYK6k6P/JPOzNLwm7xrhh2ArARcaKomW44/P6cA7NftLBmpSlJjl+lKxb05QRtW7P81TTEb/QMmTo25DQGLL3d71+MropPqbcwqrnHSKXY6VewEz0pYJu9qC4JE+5nTWtLp9bQDbYytSeMFg/UPP+9X9tOExm3FpbOrvcQZTcii1ywpX4eWvaftDMINOJaVi9WCxEWG8WxDX7R7Mwtvkr61GrGGxdJ+BxY+0i02ACyQxWRglHdaSxZ2r6rYLZBFkve9mt2F2P2B13NH9SHnqoVr14w16kgm1Q7nzt+xvQBUG22dTWzMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CV2x6b6gAZ+bVot2eqGvSzCcoLsmqlxVgN+rM5CthDw=; b=OimeooWv3agOeCBNVtIrmZR+u710Jc/8rodbJMJKV9aOxqGV/ywFtiMUJAfYYQHk/ONgRAuJy3V3iUlwnAa0v4K3w+HEyua2mb9ZHxitHPKFjCxvMN+L5UsvyQhUtsqpM/8aAFmtzDkzk/cpK4SKpKKHBK6cPEeW7HbiTa4tBbHqowJFmGWv/f9eBeUQR81K3mugtcocmkoM+Xn6+EUGL/0xbR3x9xlTDknv0yfOou9ihF8Wu2tsalI4iaCZOmAkD8Z4rOTWEeZ2ig0j9cvopMI93QAEdu9YnrneIr/83Zglc91dmqxQ6tvPZTdl7pvWLvNIacHv3HKU7/ipat8dgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CV2x6b6gAZ+bVot2eqGvSzCcoLsmqlxVgN+rM5CthDw=; b=o5PcF9mQWd/ctRHEnXoXo36Jm5dX/c5Yn+OEo/zpBzyxevCP1U+BY65x7+pLQIK9mRI79UsH1IHmxZpRFHvvVpepDQp9sHDNpYoRSNbwfyUBsQYz2TLxRbJ0GLZOqhvG7ujNRytuoLQejyx1OqPFbaCx9+k0r2/b/grRWDvdqmH3P3wj1nuqMVxzfsEkVVe/u/89JiALmm2YbIIW54dupIHs8k/ap5JK5AERlVS6WJTyDoxCWiZ0evaFwzW03XOhIZrsfUyW9wX9QyyGJ//6ylzkCFBA9o0h1lfxJNl9CfiVY0N8rZdHiRDTpNJ1PSVQNy8FFcIj4mDMuBMS0ReNlA== Received: from BN9PR03CA0653.namprd03.prod.outlook.com (2603:10b6:408:13b::28) by BY5PR12MB4834.namprd12.prod.outlook.com (2603:10b6:a03:1b2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 07:08:02 +0000 Received: from BN8NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13b:cafe::c9) by BN9PR03CA0653.outlook.office365.com (2603:10b6:408:13b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22 via Frontend Transport; Thu, 18 Nov 2021 07:08:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by BN8NAM11FT051.mail.protection.outlook.com (10.13.177.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:08:00 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 17 Nov 2021 23:07:59 -0800 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:07:57 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 12/16] ASoC: tegra: Fix kcontrol put callback in MVC Date: Thu, 18 Nov 2021 12:37:07 +0530 Message-ID: <1637219231-406-13-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 035b8c50-c5c9-4ec0-2e68-08d9aa62284e X-MS-TrafficTypeDiagnostic: BY5PR12MB4834: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wPdW2a1Ihz5hQULpQC/JSiRHkckq4AWPZjU8zl+pg0jJRBVUji1/gwa7n7rSd0r2JsIxYZxkWSyBmsLJXY1AEf7Kc39xbYdkfr6g8QgQiIyKZA1CIBrTSIQ+nyS7lmXwfUXYbVSbXqR/tI5c/+gHDyadS/+1NlXH4ixlW0fJtci8PQZfN0LdHbGULp4cx3V5QJvehkDbIQwmV/KFZarGaKhZ5ONUInCttz+nsm0zurG+YddzISzzjfTilJjmK9Td7CCI7osL6EDp24RvOWAKnYvsZytcC/zlZzj5KgHKU0vaD/Wn6Pc1dyHIwAs7QN0VpJ4CTwRpTKY/Uon251g8vwp0jURUzcXH+CjthDJ1hfTdLM7jaIaLudIZ93kQZyncGxN7Ww7bPivnUELAGhtPTihyu0EXu/+TRwF3qEQTt5tGJZ6R/ZuW/Klqy4u47iqhO7/P0OB7SEjosgaH/prKU/8AbYXKqJm5XnDP7Xpm2Rc2ARiShoc0RZDQcKsqfxSQ+rGMa19lOsStieCMsfBVujch0cnxtk0M3JFaMLJXTDmghs3JmTcpJQ5aHYgBOYyHrfFellgtsWolkgL6xTUGS0/8hmZqU51+2G8nu1VQcY+s/berlDzy7jtHfooEiHl55/XgWIQcLDxzNzmghFsUptE/CW5Yq1HFjcsOIf/6wOwVdwxyzdN7srVQsR93ASRz+FPVQCabq8JkVRQ5sryHTw== X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(316002)(2906002)(86362001)(26005)(8936002)(54906003)(47076005)(7636003)(426003)(356005)(7696005)(5660300002)(336012)(36860700001)(186003)(2616005)(83380400001)(36756003)(4326008)(110136005)(70586007)(8676002)(508600001)(70206006)(107886003)(82310400003)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:08:00.7816 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 035b8c50-c5c9-4ec0-2e68-08d9aa62284e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4834 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Filter out duplicate updates in MVC driver. Fixes: e539891f9687 ("ASoC: tegra: Add Tegra210 based MVC driver") Signed-off-by: Sameer Pujar Suggested-by: Jaroslav Kysela Suggested-by: Mark Brown --- sound/soc/tegra/tegra210_mvc.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/sound/soc/tegra/tegra210_mvc.c b/sound/soc/tegra/tegra210_mvc.c index b7e3170..85b1558 100644 --- a/sound/soc/tegra/tegra210_mvc.c +++ b/sound/soc/tegra/tegra210_mvc.c @@ -136,7 +136,7 @@ static int tegra210_mvc_put_mute(struct snd_kcontrol *kcontrol, struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt); unsigned int value; - u8 mute_mask; + u8 new_mask, old_mask; int err; pm_runtime_get_sync(cmpnt->dev); @@ -148,11 +148,19 @@ static int tegra210_mvc_put_mute(struct snd_kcontrol *kcontrol, if (err < 0) goto end; - mute_mask = ucontrol->value.integer.value[0]; + regmap_read(mvc->regmap, TEGRA210_MVC_CTRL, &value); + + old_mask = (value >> TEGRA210_MVC_MUTE_SHIFT) & TEGRA210_MUTE_MASK_EN; + new_mask = ucontrol->value.integer.value[0]; + + if (new_mask == old_mask) { + err = 0; + goto end; + } err = regmap_update_bits(mvc->regmap, mc->reg, TEGRA210_MVC_MUTE_MASK, - mute_mask << TEGRA210_MVC_MUTE_SHIFT); + new_mask << TEGRA210_MVC_MUTE_SHIFT); if (err < 0) goto end; @@ -195,7 +203,7 @@ static int tegra210_mvc_put_vol(struct snd_kcontrol *kcontrol, unsigned int reg = mc->reg; unsigned int value; u8 chan; - int err; + int err, old_volume; pm_runtime_get_sync(cmpnt->dev); @@ -207,10 +215,16 @@ static int tegra210_mvc_put_vol(struct snd_kcontrol *kcontrol, goto end; chan = (reg - TEGRA210_MVC_TARGET_VOL) / REG_SIZE; + old_volume = mvc->volume[chan]; tegra210_mvc_conv_vol(mvc, chan, ucontrol->value.integer.value[0]); + if (mvc->volume[chan] == old_volume) { + err = 0; + goto end; + } + /* Configure init volume same as target volume */ regmap_write(mvc->regmap, TEGRA210_MVC_REG_OFFSET(TEGRA210_MVC_INIT_VOL, chan), From patchwork Thu Nov 18 07:07:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626091 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B1C9C433EF for ; Thu, 18 Nov 2021 07:12:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 7862C6115C for ; Thu, 18 Nov 2021 07:12:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7862C6115C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CEFA718DD; Thu, 18 Nov 2021 08:11:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CEFA718DD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219523; bh=hkyQ6LrOEu0r0N4VJZh0VRobbIQPXZ4BlrvdIpSPZfU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=nPxnpca0BdGjlx4LJ+TZcIhSfftSGezaPAqpYBkstlChK1hb1rDRzVO2P3wkHrXpr KJ1/h+uBiqkXnsjBhbUNsR2cdj4Uvx+dKq98ybnnov9Cm1nEMKLptOI9qa9ALBQEN0 F3rLp9+a4ljZEgph+ztuBTT4V9ONd/+quWeanCzc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 59924F804F2; Thu, 18 Nov 2021 08:08:42 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id ED8F3F8053D; Thu, 18 Nov 2021 08:08:38 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2083.outbound.protection.outlook.com [40.107.220.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 56A16F80524 for ; Thu, 18 Nov 2021 08:08:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 56A16F80524 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="G+nMAuZS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gdx8TQnWmp0h+SA185KQWR97/l9h+OLNx1I2roosy/vc6AmZ4o0GjUjYqmAJpBbySJG724gnKGwyCrQAJB0sB9yjMAXIwNAKnq3GooYo6uOvj52O9NEPgDALdWHg+R7/UJLsNnTN0Tg++zO7VjxRIAjWgLVzq0ksgR71N5AxYZRBsPP1vUV9yi1T5LuobgK+gZ6oYp2r8ijV6oVkAeZZtJiNHFT0zafIgRvcBAT8hPn+EAeNLdAuFUWIcCAMxQX0B7MKYZNRn9wLC8KtWSFuaELsudMeQVzsf6gz11y1gqJk+M46MZsQpFg6XW2PFgFLy79Jm0R/z4F7HWInIih3JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Qp8apSfahRT9HCiE6++FiVgESKJ4WaZDVtz+XJTCa3Q=; b=luFllsprLsXRWDhNtK5BviwYZc6JDs7Vzb3zM6Bonmf0wQhY+IqpuZwMyNQOIXbWoPa4Q4sR1VGm21PFbkTolYld/6ze5UCBHpI/b4qdXV9MQba7u3xQDCWVKuLb8IadHLRmrr5UcxlSW8ZoA1MQjKdm8hkgy3Ys4P8xJ5dbpHeDHQGvH95fz68PIq7zjVuD90ocdl3etRKUis6SJ3Ng0+RvqapwcXSBId73iP1yYV1azZuOJEtyTCKi6vfV+8UE8bnRzpN81+NUEjwcauy9ejpeaKv0Ot8BUeIPnxi9pfmmfZZmIvYKt/TD+bMiIDqZUuJnd7DcPjyTCrB86ARXHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qp8apSfahRT9HCiE6++FiVgESKJ4WaZDVtz+XJTCa3Q=; b=G+nMAuZSbuFHhNwLNt9c7kk2t31jANGQI5M7G9dfR8n+I5urkRVa1gegCLZkJK6thF8mIujthdILZulv2JLN2+Vc+0C+UUaLu7WH/dfoKVQ3kLcAklpzrfS8uw4JYst9GtS2DzjkHu/GpfxZDcJ7WS/69GA3lqfZw/ENbzqkLvUvXFBmjEZsamZd1s04fdWddJX4JRtOdJsvddqno3oPdCH+9kG7bl0FJv01GbSrk1DtH/G+5bFGHHRpOUkF1brvS2pJpfBxm7T2O16a1IbdGjTfKnbeEXQGYtjmMZA3CTvVsnUQPpCKiqJHxWGZo7sxBo1HEYiOtROfyud0jes5SA== Received: from BN6PR1701CA0005.namprd17.prod.outlook.com (2603:10b6:405:15::15) by BL0PR12MB2465.namprd12.prod.outlook.com (2603:10b6:207:45::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Thu, 18 Nov 2021 07:08:06 +0000 Received: from BN8NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:405:15:cafe::6d) by BN6PR1701CA0005.outlook.office365.com (2603:10b6:405:15::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Thu, 18 Nov 2021 07:08:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT018.mail.protection.outlook.com (10.13.176.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:08:05 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:08:02 +0000 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:08:00 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 13/16] ASoC: tegra: Fix kcontrol put callback in SFC Date: Thu, 18 Nov 2021 12:37:08 +0530 Message-ID: <1637219231-406-14-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f4d4ff1-0f4a-4968-5b47-08d9aa622ae1 X-MS-TrafficTypeDiagnostic: BL0PR12MB2465: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2BCWdyezw35q7uuKOR8G6U+qbITDZyNWIpsDcsJCLhoJ02tWzTqVxenkohujv89nnHerOZ7LwF5f+QPZxfGudF0l2O9iO+A/taLLnCdEE9GrXqANqg+/XJN5h7yI18skjWtNhbZZca4rjsFsc/9+6pEyoZlfTGhd/hqTys+YjglEVKFd2YrOWnhEazRFXRX9/zUqWjaekRHy6l/IB4bz8AIdPAfchynY2IzB4X6axjR9MuA+lxupRsGm8+twR4FT+jwbTze64ljke6j+jxvbuYuOvHDknaaC1+E4I5w7fSLDx3X0kXy3EGI1DzK/HQuPfaai9f7QI/1N/U3imDeGf89alnRnuUOjBBOsFIHMLfhkRBxOLYzNhv1qIc8PJOK7mKE4zyz5V5Nrlap1NPN2ZX6JA3NKpdGfn78XqcAMEedEJNE8S0gWd0anX1hmcpDpVqedyMyDfl9zvwhfYmEQn2uQe2IHWupZrmemfxxTNAY2VRiRtisNL5RAYPhfFFbVAZyZ4+S4nMUCLuPr6aILPiX/ge3tW7LWL3ApCFwoTTBeNw6YHNdo5971lt5K/3G+XlL3uy+JssysSSRmK+c4L1XptvBqqbnzx3GEtQwqHdxH5HCqkBMIHrE7EhtJsj6VsElIUMEazqikTHFtvVGh0G5M4Fg9utLKjkKrni66oPzNlcnbVPg04vdA2SzaezncwijzcxSycM6Vjqh8TEmy7Q== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(316002)(36756003)(36906005)(7636003)(5660300002)(7696005)(107886003)(26005)(508600001)(186003)(36860700001)(2616005)(8936002)(8676002)(336012)(47076005)(2906002)(82310400003)(54906003)(70206006)(356005)(86362001)(70586007)(110136005)(83380400001)(426003)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:08:05.0885 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f4d4ff1-0f4a-4968-5b47-08d9aa622ae1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2465 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Filter out duplicate updates in SFC driver. Fixes: b2f74ec53a6c ("ASoC: tegra: Add Tegra210 based SFC driver") Signed-off-by: Sameer Pujar Suggested-by: Jaroslav Kysela Suggested-by: Mark Brown --- sound/soc/tegra/tegra210_sfc.c | 124 ++++++++++++++++++++++++++++++----------- 1 file changed, 93 insertions(+), 31 deletions(-) diff --git a/sound/soc/tegra/tegra210_sfc.c b/sound/soc/tegra/tegra210_sfc.c index cb592ef..7a2227e 100644 --- a/sound/soc/tegra/tegra210_sfc.c +++ b/sound/soc/tegra/tegra210_sfc.c @@ -3244,49 +3244,107 @@ static int tegra210_sfc_init(struct snd_soc_dapm_widget *w, return tegra210_sfc_write_coeff_ram(cmpnt); } -static int tegra210_sfc_get_control(struct snd_kcontrol *kcontrol, +static int tegra210_sfc_iget_stereo_to_mono(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt); - if (strstr(kcontrol->id.name, "Input Stereo To Mono")) - ucontrol->value.enumerated.item[0] = - sfc->stereo_to_mono[SFC_RX_PATH]; - else if (strstr(kcontrol->id.name, "Input Mono To Stereo")) - ucontrol->value.enumerated.item[0] = - sfc->mono_to_stereo[SFC_RX_PATH]; - else if (strstr(kcontrol->id.name, "Output Stereo To Mono")) - ucontrol->value.enumerated.item[0] = - sfc->stereo_to_mono[SFC_TX_PATH]; - else if (strstr(kcontrol->id.name, "Output Mono To Stereo")) - ucontrol->value.enumerated.item[0] = - sfc->mono_to_stereo[SFC_TX_PATH]; + ucontrol->value.enumerated.item[0] = sfc->stereo_to_mono[SFC_RX_PATH]; return 0; } -static int tegra210_sfc_put_control(struct snd_kcontrol *kcontrol, +static int tegra210_sfc_iput_stereo_to_mono(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt); + unsigned int value = ucontrol->value.enumerated.item[0]; - if (strstr(kcontrol->id.name, "Input Stereo To Mono")) - sfc->stereo_to_mono[SFC_RX_PATH] = - ucontrol->value.enumerated.item[0]; - else if (strstr(kcontrol->id.name, "Input Mono To Stereo")) - sfc->mono_to_stereo[SFC_RX_PATH] = - ucontrol->value.enumerated.item[0]; - else if (strstr(kcontrol->id.name, "Output Stereo To Mono")) - sfc->stereo_to_mono[SFC_TX_PATH] = - ucontrol->value.enumerated.item[0]; - else if (strstr(kcontrol->id.name, "Output Mono To Stereo")) - sfc->mono_to_stereo[SFC_TX_PATH] = - ucontrol->value.enumerated.item[0]; - else + if (value == sfc->stereo_to_mono[SFC_RX_PATH]) + return 0; + + sfc->stereo_to_mono[SFC_RX_PATH] = value; + + return 1; +} + +static int tegra210_sfc_iget_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt); + + ucontrol->value.enumerated.item[0] = sfc->mono_to_stereo[SFC_RX_PATH]; + + return 0; +} + +static int tegra210_sfc_iput_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == sfc->mono_to_stereo[SFC_RX_PATH]) + return 0; + + sfc->mono_to_stereo[SFC_RX_PATH] = value; + + return 1; +} + +static int tegra210_sfc_oget_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt); + + ucontrol->value.enumerated.item[0] = sfc->stereo_to_mono[SFC_TX_PATH]; + + return 0; +} + +static int tegra210_sfc_oput_stereo_to_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == sfc->stereo_to_mono[SFC_TX_PATH]) return 0; + sfc->stereo_to_mono[SFC_TX_PATH] = value; + + return 1; +} + +static int tegra210_sfc_oget_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt); + + ucontrol->value.enumerated.item[0] = sfc->mono_to_stereo[SFC_TX_PATH]; + + return 0; +} + +static int tegra210_sfc_oput_mono_to_stereo(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); + struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt); + unsigned int value = ucontrol->value.enumerated.item[0]; + + if (value == sfc->mono_to_stereo[SFC_TX_PATH]) + return 0; + + sfc->mono_to_stereo[SFC_TX_PATH] = value; + return 1; } @@ -3387,13 +3445,17 @@ static const struct soc_enum tegra210_sfc_mono_conv_enum = static const struct snd_kcontrol_new tegra210_sfc_controls[] = { SOC_ENUM_EXT("Input Stereo To Mono", tegra210_sfc_stereo_conv_enum, - tegra210_sfc_get_control, tegra210_sfc_put_control), + tegra210_sfc_iget_stereo_to_mono, + tegra210_sfc_iput_stereo_to_mono), SOC_ENUM_EXT("Input Mono To Stereo", tegra210_sfc_mono_conv_enum, - tegra210_sfc_get_control, tegra210_sfc_put_control), + tegra210_sfc_iget_mono_to_stereo, + tegra210_sfc_iput_mono_to_stereo), SOC_ENUM_EXT("Output Stereo To Mono", tegra210_sfc_stereo_conv_enum, - tegra210_sfc_get_control, tegra210_sfc_put_control), + tegra210_sfc_oget_stereo_to_mono, + tegra210_sfc_oput_stereo_to_mono), SOC_ENUM_EXT("Output Mono To Stereo", tegra210_sfc_mono_conv_enum, - tegra210_sfc_get_control, tegra210_sfc_put_control), + tegra210_sfc_oget_mono_to_stereo, + tegra210_sfc_oput_mono_to_stereo), }; static const struct snd_soc_component_driver tegra210_sfc_cmpnt = { From patchwork Thu Nov 18 07:07:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626093 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E90A8C433EF for ; Thu, 18 Nov 2021 07:12:36 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 558E96115C for ; Thu, 18 Nov 2021 07:12:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 558E96115C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BB90F18E7; Thu, 18 Nov 2021 08:11:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BB90F18E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219554; bh=og/kH9vK5xWax+RDT4g1/B+KP4y5sTVyd9VoKd6VJ6A=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YHbMxkfN4gUKbGaovkRwYngRdhFtwo6rkAsIhxK/AvtB4JAZUyxdaFPyFZvXtsrBe LWNRi5vyps2Qeio6JHZQJK2szIr9xBy397WpauCnlr3E6yn2YvSvZrqFePmHsB1GCk S9lFcmNNrWJLt5BCQqL+U6do6g1+cMwwQqyl0kTs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6B78CF80549; Thu, 18 Nov 2021 08:08:47 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F3B3CF80524; Thu, 18 Nov 2021 08:08:40 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2081.outbound.protection.outlook.com [40.107.244.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4E29BF80526 for ; Thu, 18 Nov 2021 08:08:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4E29BF80526 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="AKF7PRMV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L8fDT2QEqpknlRQOMgfjMusOVmu6yEn9jBXs3vB830y9QMTndF4jl45LvliLSrSmSKO4VapmcvueorkRLt+GjZMokj70g4nT+2af1/2dzb8ASCq6C1VX9EHbWORHyd7HT6ni2puKr3/oolMuPlqOePmxL/y3n7q9QkFxh52HMjtQJX5euBsFu88OyYpAZPqQK/74Zu9mc8OfoKEmBj5EzK4ffl+s/Cn/w0teqlRWqDYCrQWEGdTHsQMtKac28fQjDe3KxKWLble6LV0DJmBq1WDDhSCHRznm4/HbNVXbI41px7sCB2tBGEgXeKdLIP9/meCtOG+UFPoyDCg7OpU5EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PktcI9cavefHccx9wJ7xoNYt427yPivaSQDVB9VDtMs=; b=Ur1zucmw5RuI+vatBTj62p2LHD5C3jlltSGcd4WZLN5DTzv/PufdbLwH/vAtqbLcZJGPIfQ7x5uBuc4IVy1YYPIJjOC07A3M7Q4LwT/2pgStbrNqWKaQKyHcx/ICqLxqxqKZCFlQZOH1e0DmoO3LOuqWYQ1Ps2pWe5ZG0cOAO4tliDk8h0e8P/NyuwuhqX7sx1RRsl0soVO7m+D+Cv3pAvz6KwIreoc2bkbJx8rjbQPtuh0vs5R17blvSuOLOALWs6NIxUAh8AjK4sIHYG/pXq80EGvx9lXD6DtglsS+0k6qboNJ9DftqnT72s1Icnl4eMYubgd/9FoRiHDJz3EvsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=perex.cz smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PktcI9cavefHccx9wJ7xoNYt427yPivaSQDVB9VDtMs=; b=AKF7PRMVRW3W4H3zDjYOSgDcCYy4euvL1T/Tp2PaGfbH3xU07eIWWwEnPdAsX5GnW07oObfld0OU1/bfRMAWozIwMrkFwCKURpCnP0KVFNuFiF6wFyJFfjmelbG8IA2KLBE6zd28D43bus2wmvTIl85iqLUZMTGEvtHbIncX2qupgYeK6QMz6g6zCzZLYObxz8njnPKv/WJKMp3zcGUHl8FPLPmwz79FOWndhK9qO+rT83z4NY5wtI1OOXklQE6/Zi0KacSDAED9JnumATp/bL0UpUC7Xg6NmfJ2S5mL1fozgpZGQPCsDQBtXCxDDYRbhCl5kksyWcwYgDP8/9bzwA== Received: from CO1PR15CA0075.namprd15.prod.outlook.com (2603:10b6:101:20::19) by MN2PR12MB3968.namprd12.prod.outlook.com (2603:10b6:208:16f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Thu, 18 Nov 2021 07:08:07 +0000 Received: from CO1NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:101:20:cafe::66) by CO1PR15CA0075.outlook.office365.com (2603:10b6:101:20::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 07:08:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by CO1NAM11FT015.mail.protection.outlook.com (10.13.175.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:08:06 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:08:06 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:08:05 +0000 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:08:03 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 14/16] ASoC: tegra: Fix kcontrol put callback in AMX Date: Thu, 18 Nov 2021 12:37:09 +0530 Message-ID: <1637219231-406-15-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4219fd8c-0db6-4006-f074-08d9aa622bc8 X-MS-TrafficTypeDiagnostic: MN2PR12MB3968: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uTXufS8RmKi3XWT64Gi6qN3abcaDr3grpuIe6ixa/zTSOqoC0mQRAldve6AReSjp7vDiuRiLvUUYlKMBXQcY261e5AxIJxA47l0oes5R5smxfhvXKteqv3YZMkvOGyF1E/5CkjM0J+Lbcrq7HBdhGlQa9kNUIqXTYFxbtx9n7f4gnAUDA64/1LMzoXddV7bqPjKtMamZ3rw8su69+iYf1CQJlPoPm2SdkmXNSHYXEJTHg0Iai7m8Km7VdqAV+dfD7qNgLHaBt2kijWxQUkKOu6g4dRow90pHOchjQ3b7zOKXrRGt7KWawsOaLqOUWxpxoTSMH1oUZ598h05c9ftGL/VOKlcWa6f9aJLCHqDkWEcpOm0jld2R0QkCwF82uLNcYwvCg1Gj/gBsxCaW3JSgB3V8kqiYdYBzgS5RcFru6Zmkm44e3wtIdmdxVA/svFt5iVWT1WcVIts/xOB5FNrW0BqAAQ4gZPuWN20dhEDNg1UIFDRDASyt5kWSpVOZwbA0uCg8Y06QpzB3dvYFtQxIyrQMTMQPZFd+nDT1XPsqKZRN5Xosnx36CXOy60FEHLbEkj0oDjoXMSuNBnuZdwX99eECvbq5Z2TkDdI/Z8uGN2loQAwKbystCUICTHfhEsu/wql5uMK2mnuhWWIyw7f8nAeTXJ70eTlwGkaKDb99Fune5M8WOCv7Qb4w/YlqKjb6zfhq72VBte3JRqpyQ51Qpg== X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid02.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(107886003)(316002)(36906005)(36860700001)(83380400001)(70206006)(4326008)(70586007)(8676002)(82310400003)(508600001)(186003)(356005)(5660300002)(7636003)(47076005)(26005)(8936002)(110136005)(2616005)(36756003)(2906002)(426003)(336012)(86362001)(7696005)(54906003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:08:06.6722 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4219fd8c-0db6-4006-f074-08d9aa622bc8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3968 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Filter out duplicate updates in AMX driver. Fixes: 77f7df346c45 ("ASoC: tegra: Add Tegra210 based AMX driver") Signed-off-by: Sameer Pujar Suggested-by: Jaroslav Kysela Suggested-by: Mark Brown --- sound/soc/tegra/tegra210_amx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/tegra/tegra210_amx.c b/sound/soc/tegra/tegra210_amx.c index af9bddf..6895763 100644 --- a/sound/soc/tegra/tegra210_amx.c +++ b/sound/soc/tegra/tegra210_amx.c @@ -222,6 +222,9 @@ static int tegra210_amx_put_byte_map(struct snd_kcontrol *kcontrol, int reg = mc->reg; int value = ucontrol->value.integer.value[0]; + if (value == bytes_map[reg]) + return 0; + if (value >= 0 && value <= 255) { /* Update byte map and enable slot */ bytes_map[reg] = value; From patchwork Thu Nov 18 07:07:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626097 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C4E1C433EF for ; Thu, 18 Nov 2021 07:13:11 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A84F46138F for ; Thu, 18 Nov 2021 07:13:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A84F46138F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DF73E18BA; Thu, 18 Nov 2021 08:12:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DF73E18BA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219589; bh=xRGdEPIqUQEvT3bTbr95CdZloeK+ukgEiI7qUaabQXs=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=AZD68nQKPVhPUMM+wWcuTY9+q4BWV9qA56NwtngTpzGYt7cez4kSZGO9CHLqkOvUl asR7iBvq5GzaLwEHZknYA3pcqnBYfse8A7Th/BhsrYp4TV3f7YYAhuviAyqGS40J0o GbsZJNUU0ferGUPTR3NOdPVVN5q778yFIR0XOVUc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 46B91F80553; Thu, 18 Nov 2021 08:08:59 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 247E9F80552; Thu, 18 Nov 2021 08:08:56 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2088.outbound.protection.outlook.com [40.107.244.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 97051F8052E for ; Thu, 18 Nov 2021 08:08:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 97051F8052E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="ecDKtw2U" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PJeHa9o9zoGW8m9JooLOLo3d9Abrj8WhuJ12iMnj3Cl+U79JvIvAIULs0OsEqKV6MJLBPP3c+3HWA7BTK1DuwrjfUeJOisLpPnvSzAQtMPTZuJxpFeZSQaMk/uRDqI0GSgJuIaxPRrybUYXsjqDu1XxkryVGvNUF0+zHs0dTQ9yrQTHPZhdDIFCDAxnRPTvDdvQteH+BloQMmTYEmsn2JbYadJtIHXKa6CJjgHavrRfEcIQ2IEjK9dZLrXVbW7sMYhM0B83rmJk/dZVKQXqh/AUlT2hF6GywnhG+OTrinKev2O4+D03GZQkGhRiCeN2FS1TzgVodLGe0XVZI0FMMPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ugxmlf/o55vAjvWrVe9GahbKf/lSIhQJpc3KN9DrvFo=; b=LgK5hbAi5Ke7TFNHj1g8AjM06eyHyNRpC80ar0ya1+nxbWOrI2GpF2XfnJXYqYe+PZn0zwn53oDlVGbpdM1le4uPlJ8YCSj6KdPfV08FQthQ+1PtVl30Tc4ExH/xWKzbx+26lUBVnDuP/iW9Xtu+J46lrpwy1/ey4NL+sOzmNQ0ovpvVYMEhFuwIyFnevSiIyaM0f21ugVDo9NhJcUw74PMiy6I4HEmS5eXyJbdk5azjoVwfi9VCjY5pvJJQLRVNdP1e1u8/IhdT/xBoQmCF/mGVrnLJXHsKmeflZ7ZXtRSUto3TI9yWXBkp9hQU1H4XBJcVwzy58+8butVACWH5Gg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ugxmlf/o55vAjvWrVe9GahbKf/lSIhQJpc3KN9DrvFo=; b=ecDKtw2U0RHHoLw27rjaDTTb+igss6K5btHWs3G6EY5cBqTltcB36JtkrRXLdjlDWyOQydNAjn3S0w8llU4cddySHlZSIiTeFLJci6Gas1ziG7ggiICSJvfdtFO2O1GVNuS9jqtb+G6FDdMOLYSOXWEHLrE6nKreyLCdJcHusysuzIt7WjjbYb+qjAIrba7jhc+9IUUUIWe0AgEXnQNpJnyti0i+Mmz1yCaPXkOlgsK6ct4nq2nI3bfLwIqALYzEgYp42PEqDF1wuyxg5gtl1x0fbwz0lFRHtjaSomljDveB5B36Wui5G5Qadn4um1oKwDr6pJgoVifT4XqId0XE3g== Received: from BN0PR04CA0029.namprd04.prod.outlook.com (2603:10b6:408:ee::34) by BYAPR12MB3431.namprd12.prod.outlook.com (2603:10b6:a03:da::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22; Thu, 18 Nov 2021 07:08:14 +0000 Received: from BN8NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ee:cafe::d6) by BN0PR04CA0029.outlook.office365.com (2603:10b6:408:ee::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Thu, 18 Nov 2021 07:08:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.36) by BN8NAM11FT039.mail.protection.outlook.com (10.13.177.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:08:13 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:08:09 +0000 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:08:06 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 15/16] ASoC: tegra: Fix kcontrol put callback in ADX Date: Thu, 18 Nov 2021 12:37:10 +0530 Message-ID: <1637219231-406-16-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23043389-b77f-4831-530b-08d9aa622fee X-MS-TrafficTypeDiagnostic: BYAPR12MB3431: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hd7ZURJL7Fdn/qSjIZpDx1wWY3LPzDkr6QAlTc9vRzuZ8o6OoEDSmAqOnD0hyfLxLaxPLA3xSfqHzv7NXgThrS6YuHxi19dKvwCXIRZn+1agS0lbqx/G8xR+Bb3tbw5I0X40rqLPhbGJ+lMO5I4TOB9cNxbNs0EoWW47ZpB4PgvbupxnbITzUUa95/sJKGGFBPB1/AqIy0tgXWlla+XUcYNNAb2/EFfjMs2VhWeIA379Svq30qYEduwlJqxsdY/8g5wpITwHBjxJZrpL7HmcHelcVfWLgUzXLsiOtBqS3hXnF3FyOEW31Hh2+4fOi2nYDcu1zlktHMTcZyibExqQsBpc0gSQi8P51y9yCurD5t8pPc8fq3iztLodaJwyLjh+09J6xyA/IIUrh8qQ4NJjMUHePbknOLyocVy411TZIp11SkzQuqrRkndmqGmUeVK8sA0AAlGZVJW0i9H0h4iE9qWvxYC2UU0Rt4vraAZQdj8/wTv0A1vJ9x0WbD5vaof54wSXmmgwd4oPK/T3lgF9cjB5IXuvatecmVx+U53mESYRSFPXlxDFl0rxIK0LvtxqKrsv64aTEncyGEEGheQkKzxuXx4qgRTElAM6DJLt6Y4u8GpOXehtSEuQjD/QjX5C21QqyQZ3k/N1m2rxBn7dYzPPxBrXfulyif/Es6BK7BvBSEK+88OIPzJvzC74X8gR/Ez/k2IDCxuBnTyAOPhTAg== X-Forefront-Antispam-Report: CIP:216.228.112.36; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid05.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(82310400003)(4326008)(5660300002)(2616005)(186003)(47076005)(426003)(107886003)(336012)(36756003)(70206006)(83380400001)(70586007)(8936002)(508600001)(8676002)(2906002)(110136005)(6666004)(54906003)(316002)(36860700001)(7636003)(7696005)(86362001)(26005)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:08:13.1863 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23043389-b77f-4831-530b-08d9aa622fee X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.36]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3431 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Filter out duplicate updates in ADX driver. Fixes: a99ab6f395a9 ("ASoC: tegra: Add Tegra210 based ADX driver") Signed-off-by: Sameer Pujar Suggested-by: Jaroslav Kysela Suggested-by: Mark Brown --- sound/soc/tegra/tegra210_adx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c index d7c7849..933c450 100644 --- a/sound/soc/tegra/tegra210_adx.c +++ b/sound/soc/tegra/tegra210_adx.c @@ -193,6 +193,9 @@ static int tegra210_adx_put_byte_map(struct snd_kcontrol *kcontrol, struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;; + if (value == bytes_map[mc->reg]) + return 0; + if (value >= 0 && value <= 255) { /* update byte map and enable slot */ bytes_map[mc->reg] = value; From patchwork Thu Nov 18 07:07:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 12626095 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56D60C433EF for ; Thu, 18 Nov 2021 07:12:53 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id AB7596128C for ; Thu, 18 Nov 2021 07:12:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AB7596128C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 245761778; Thu, 18 Nov 2021 08:12:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 245761778 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637219571; bh=8eWMEahyTjeeOuUighsh57oBuFIGQj5mjFoHVVg2r0E=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=qYiza/BdRx8uTeRoxwoDPe4/lxYKAWITYlB97uKyg/gRCuh29PmE9cfsxdS7yjIxV px9jrxMr0/nqzzEFyB5Sn+FbPM5cu8NABhPFcJJd+UeITQm+HZVmb9O2k94Kg0Nd2a X4rG0zclLHhOIXUb3y8rsT/uLWt+M2va0BE7GHe8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AAE98F80527; Thu, 18 Nov 2021 08:08:55 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 90C94F80552; Thu, 18 Nov 2021 08:08:53 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20619.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eae::619]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2471FF80528 for ; Thu, 18 Nov 2021 08:08:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2471FF80528 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="aQmL9egd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P3/TrL1eVPKc7DcVBvNdrRA9A3KY1Q7f1y16N16K7avNi5ZAe4uxH31K4zSs/7tk9PSxCOVqBOcSuJCCIk5quI5mmELilb1drDxyZ2Hs1wYvPyAhejR45f11gfjEXnWoCdCB9DJ/8LRnhVSaKOoIKwGwLL7T9xk4zGkS6Cx351kgRrUsjPwGBt0G1Z7FzgOJbPA3Stk97xM7v24hfSMc47D99oDDB7HukKhply1lVe183Ah43ZWO6I1fqpvrqF+uKEo2eP5y4W7QR8kDoORqPz+CRZ15Qru6aqTs1qxsrGnUcQidVM4Np7KuD7ROiRftQKl+kmgJglB/kdgsmibHCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+MILkjcPVK1cJw0GpgLGNZUa1pPeCN+g+hdwQLaF2TE=; b=kEkkJTZa5WYLfhh5THR/Js83kZkgbODANZRwDN3LxYUJfzDEgy2m9dsTZ4aVaZObZXSPbk0cVidSp+3z9Dltu+K/q7XCuEufwhfuwSlqUd/qDLsoFSATkj/d5CqC0pKkZ2XWs8NK04zJIHXtehnGsADfWgA0tD64Tqf8VJXkS7mOZgMCMhLCzt7OGj/7/DMGslXlWNk0yhqwNvPorG/dJBvMM2oI91E57HdNg8N45MLAvL47gheWXV8ZdE7ZpIej/CVQRukqs564DnGzqkfHppF9Gk7PKhm5RZZK6/erFD4jD3W1FTGHAgGZtq2uu8whhbUOfAaqrZoA4Snzz5dmSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+MILkjcPVK1cJw0GpgLGNZUa1pPeCN+g+hdwQLaF2TE=; b=aQmL9egdXVohZ5c+2wRxeIPJuCyWkBCybRInrG0cJYuVHG1ZRKXT3uArBRUdU7sI1dqQspePYAU9fCsv8CfOtvQTBL9ZZE8zVsssUbWKNfyP2PKGrS97ZW2p2O6S2jk9sZw0ATCQIb9hp9td4rvl9wVtvWoEiyseHnymGHAzL60g3zJLKs2KLARhl1RtL+HPnXStMTc9v4o8MRl70REZrj4lyqDlWCgm39+dwXjZWcWItb0vO9KtK5RPACUhcgENaRfcU0ifM6D0W7B+oB6c0sdTR3U4Fg2ZfdWGZif8k02v7mIc1fiNynY4sfVrIpfbG+7clZiPJaqSWmCtspDOQw== Received: from MW4PR04CA0276.namprd04.prod.outlook.com (2603:10b6:303:89::11) by DM6PR12MB3148.namprd12.prod.outlook.com (2603:10b6:5:11c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 07:08:14 +0000 Received: from CO1NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:303:89:cafe::4b) by MW4PR04CA0276.outlook.office365.com (2603:10b6:303:89::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Thu, 18 Nov 2021 07:08:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by CO1NAM11FT023.mail.protection.outlook.com (10.13.175.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 07:08:12 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Nov 2021 07:08:11 +0000 Received: from audio.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 18 Nov 2021 07:08:09 +0000 From: Sameer Pujar To: , , , Subject: [PATCH v3 16/16] ASoC: tegra: Fix kcontrol put callback in Mixer Date: Thu, 18 Nov 2021 12:37:11 +0530 Message-ID: <1637219231-406-17-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637219231-406-1-git-send-email-spujar@nvidia.com> References: <1637219231-406-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0f613140-d815-452c-6dd7-08d9aa622f31 X-MS-TrafficTypeDiagnostic: DM6PR12MB3148: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gdFY90hmIzYuFiDWx8/bXSlF1ul0Lkn4fReDmJmeWTP2Sqy1Gk9aHT8+MO4kypMJskDhxCKfYT1agNlVvQCWG01qm9Z3E7fwU+6vDllOtMqKhBrbvru9QOI40N63jDWpQZ00TnkhIeJj2n6jxPZ4OeVimqFZFhFVsxyvuZEU02Lb5vH+K85oX8Ue6rAhlgy5yckk0Dz7DpN6iRJW4AAfkFxlaYYl+VWyieXv75sgIjLk4MmkUy0qDBrpG9oDr6MJRKB2RZmexSYmax2q+h9UHHX/wGvCotPVxZRTdDX1zscSxXN6N3+igzts655+uJN9aF41HejOYj3FrCWLSj4IiVQQbaObEqvQ6M5KK0162V6LlGdZzWtO9nmy8bW6Yi0+7wmHSztBqC/7fgjaZ318Bcn5BRlXYMhD9xjZ5RktZt8gbOn88ul18Qv1mJN/EfSkVooj9L29d8Coqszb3sDNTrcPQLn4J2GHuQkGw+c3bJAMqQSkmyh7g1OuOboNOCJl937POpQ9wtMhEZ/53zvHdsUi5eMBz6QCoUJOXqk+klDNjh3UtefRSsFzZhZdX0VqfOFcuHISgrRvghYJbEOQN5vr1E790twceKvhZjPhKgIVaE1xLt3RWfWXzxytoNWjxRpU7zbLOD7e1cVCtmauLI4KwMlDS0e3TG5vgIwy2pAHGC8AcfHVhEvl4CXy/uaXlIA5JSYuwX4Wjboqy91cDQ== X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid04.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(7636003)(83380400001)(26005)(7696005)(82310400003)(70586007)(5660300002)(2616005)(6666004)(8676002)(186003)(356005)(70206006)(4326008)(316002)(36756003)(107886003)(8936002)(47076005)(508600001)(2906002)(426003)(336012)(36906005)(36860700001)(86362001)(54906003)(110136005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:08:12.3921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f613140-d815-452c-6dd7-08d9aa622f31 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3148 Cc: alsa-devel@alsa-project.org, Sameer Pujar , linux-kernel@vger.kernel.org, jonathanh@nvidia.com, thierry.reding@gmail.com, linux-tegra@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The kcontrol put callback is expected to return 1 when there is change in HW or when the update is acknowledged by driver. This would ensure that change notifications are sent to subscribed applications. Filter out duplicate updates in Mixer driver. Fixes: 05bb3d5ec64a ("ASoC: tegra: Add Tegra210 based Mixer driver") Signed-off-by: Sameer Pujar Suggested-by: Jaroslav Kysela Suggested-by: Mark Brown --- sound/soc/tegra/tegra210_mixer.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/sound/soc/tegra/tegra210_mixer.c b/sound/soc/tegra/tegra210_mixer.c index 55e6177..51d3755 100644 --- a/sound/soc/tegra/tegra210_mixer.c +++ b/sound/soc/tegra/tegra210_mixer.c @@ -192,24 +192,24 @@ static int tegra210_mixer_get_gain(struct snd_kcontrol *kcontrol, return 0; } -static int tegra210_mixer_put_gain(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static int tegra210_mixer_apply_gain(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol, + bool instant_gain) { struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); struct tegra210_mixer *mixer = snd_soc_component_get_drvdata(cmpnt); unsigned int reg = mc->reg, id; - bool instant_gain = false; int err; - if (strstr(kcontrol->id.name, "Instant Gain Volume")) - instant_gain = true; - /* Save gain value for specific MIXER input */ id = (reg - TEGRA210_MIXER_GAIN_CFG_RAM_ADDR_0) / TEGRA210_MIXER_GAIN_CFG_RAM_ADDR_STRIDE; + if (mixer->gain_value[id] == ucontrol->value.integer.value[0]) + return 0; + mixer->gain_value[id] = ucontrol->value.integer.value[0]; err = tegra210_mixer_configure_gain(cmpnt, id, instant_gain); @@ -221,6 +221,18 @@ static int tegra210_mixer_put_gain(struct snd_kcontrol *kcontrol, return 1; } +static int tegra210_mixer_put_gain(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + return tegra210_mixer_apply_gain(kcontrol, ucontrol, false); +} + +static int tegra210_mixer_put_instant_gain(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + return tegra210_mixer_apply_gain(kcontrol, ucontrol, true); +} + static int tegra210_mixer_set_audio_cif(struct tegra210_mixer *mixer, struct snd_pcm_hw_params *params, unsigned int reg, @@ -388,7 +400,7 @@ ADDER_CTRL_DECL(adder5, TEGRA210_MIXER_TX5_ADDER_CONFIG); SOC_SINGLE_EXT("RX" #id " Instant Gain Volume", \ MIXER_GAIN_CFG_RAM_ADDR((id) - 1), 0, \ 0x20000, 0, tegra210_mixer_get_gain, \ - tegra210_mixer_put_gain), + tegra210_mixer_put_instant_gain), /* Volume controls for all MIXER inputs */ static const struct snd_kcontrol_new tegra210_mixer_gain_ctls[] = {