From patchwork Mon Jan 17 16:08:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Tanure X-Patchwork-Id: 12715564 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EEB32C433EF for ; Mon, 17 Jan 2022 16:10:40 +0000 (UTC) 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 D1BAA17E0; Mon, 17 Jan 2022 17:09:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D1BAA17E0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642435838; bh=ziFdbF4qxwJAQPFrXZTHiwWTyM0Fy9EzGPLsny91jXA=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=STx9QT9CdWt29gHZ1UdN3q3Fi/IbWC45ti020SJR1mtdq5ryKTeXOuSFhHCUfzfId NUgN5T4n8SUkXibnfMar8kACOflwEB4qg57qrtcFEkvpvm5EUNGxB4afNZhqfKBv4k QmVeO6dKi4WwpAiUOPhfgbd9ExaRBWLwJoBU/X5E= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5B332F8050F; Mon, 17 Jan 2022 17:08:48 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 82061F800EB; Mon, 17 Jan 2022 17:08:45 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (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 A8B28F80100 for ; Mon, 17 Jan 2022 17:08:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A8B28F80100 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="aH9gWWxr" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20HFFYHA025138; Mon, 17 Jan 2022 10:08:34 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=KUv7ngvVuTUvfvAzKJH6kDlqhmw0mCvg7E2LNqztcsg=; b=aH9gWWxrwrp06o1iVySEwmvNsSTgYwG3Ih6PrPl5mQK2OtTIVgSJFBtnMcZPvx00KLEn lRu8ZMc5ZG30X8sOOqm8/9U/SpXt5iqCalnGKyCWQPLtnQo4aqDOF/Zv34oBSfhjynjB nUfSTmghIHhMDnPaEJyI8mFgtQ4C0a2X07Mi1Ce7mo/Ed5eji2bJuDbRWPGdnh+1/mw3 oT97g+6BEWL/ncFLmgaI4RmRAKspU393prnqPwJbN7MAJl1K6iKvA2OSJvkZ5Zmenx/y BvLKRy8mDHfj81LDZBm/Ew4d25Hg9VBjxWNsHMQfMTsJB52T1XMr0HjyT4CF1mysj8hl mQ== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3dnaxhr22c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 17 Jan 2022 10:08:34 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 17 Jan 2022 16:08:32 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.2375.18 via Frontend Transport; Mon, 17 Jan 2022 16:08:32 +0000 Received: from aryzen.ad.cirrus.com (unknown [198.61.64.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id D679E459; Mon, 17 Jan 2022 16:08:31 +0000 (UTC) From: Lucas Tanure To: Jaroslav Kysela , Takashi Iwai , Mark Brown Subject: [PATCH v2 1/6] ALSA: hda: cs35l41: Avoid overwriting register patch Date: Mon, 17 Jan 2022 16:08:25 +0000 Message-ID: <20220117160830.709403-1-tanureal@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Proofpoint-GUID: ZQoJ3bLYtcWhv2KkilNAPdRESf1c6SdB X-Proofpoint-ORIG-GUID: ZQoJ3bLYtcWhv2KkilNAPdRESf1c6SdB X-Proofpoint-Spam-Reason: safe Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org, Charles Keepax , linux-kernel@vger.kernel.org, Lucas Tanure 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" From: Charles Keepax regmap_register_patch can't be used to apply the probe sequence as a patch is already registers with the regmap by cs35l41_register_errata_patch and only a single patch can be attached to a single regmap. The driver doesn't currently rely on a cache sync to re-apply this probe sequence so simply switch it to a multi write. Fixes: 7b2f3eb492da ("ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems") Signed-off-by: Charles Keepax Signed-off-by: Lucas Tanure --- V2: Add Fixes tag --- sound/pci/hda/cs35l41_hda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index 30b40d865863..c47c5f0b4e59 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -480,7 +480,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i acpi_hw_cfg = NULL; if (cs35l41->reg_seq->probe) { - ret = regmap_register_patch(cs35l41->regmap, cs35l41->reg_seq->probe, + ret = regmap_multi_reg_write(cs35l41->regmap, cs35l41->reg_seq->probe, cs35l41->reg_seq->num_probe); if (ret) { dev_err(cs35l41->dev, "Fail to apply probe reg patch: %d\n", ret); From patchwork Mon Jan 17 16:08:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Tanure X-Patchwork-Id: 12715563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 49B1EC433F5 for ; Mon, 17 Jan 2022 16:10:25 +0000 (UTC) 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 5E77B1811; Mon, 17 Jan 2022 17:09:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5E77B1811 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642435823; bh=GYJJRk7/eopRKrzPgcmQZZXkBlbvS/5GC0z33Chg1PM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WY04kR+q/2qFJ0yZc4KzzzHcQO80HIrR/qW0ucVJGF1BfH+t11T9onmLqJOwNr08u cNBp+BA/WWejwqSBPOqhUZVD5Vd8l+Ym1DNV39sn4bLR+2IUIp2KTgHgWc3b6YttSJ tyukvtVzG6LHNJLx6QoMW9av2yXbnsYdPu9/mtic= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A6764F80254; Mon, 17 Jan 2022 17:08:46 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 86B81F80506; Mon, 17 Jan 2022 17:08:44 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (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 B7E2BF800EB for ; Mon, 17 Jan 2022 17:08:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B7E2BF800EB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="ABYlKoOy" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20HFFYHC025138; Mon, 17 Jan 2022 10:08:35 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=bl5u1NTQ5L1xVZfZHeopeNSvmI7iSBTqrV2EHIRtC04=; b=ABYlKoOylzmVdR60EJP8p8eXcFV4koeulRwpGDUtSRp3edJ3h5Nkv7TF9n7dsFmfaidQ 3B/JYwppuhGlNN/71Le3Ov6yWNJxKtqPznrIq0TV3UDyBdFzLtZY5DMnCsJ15ka/nIVA acd0NW1nL2Y5sCtwP8AY+Yl3inVYu3uKwIZSwH2xF5147LCd2DL7UvbA3vjav1uNZSdE QLW4nhaRJU/k8m7Nn5LcGP4jy09l+kOlIRkFFa8BCsP0AsCC9skeEF26Zf3K+hZWqeTY EbOFgPKJBxKRiP+KXnlMctHCdvBYmJxONNcUYY7SDKL8rBMhkTBXolJalCudwWGwy7d6 2A== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3dnaxhr22c-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 17 Jan 2022 10:08:34 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 17 Jan 2022 16:08:32 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.2375.18 via Frontend Transport; Mon, 17 Jan 2022 16:08:32 +0000 Received: from aryzen.ad.cirrus.com (unknown [198.61.64.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 30A6646C; Mon, 17 Jan 2022 16:08:32 +0000 (UTC) From: Lucas Tanure To: Jaroslav Kysela , Takashi Iwai , Mark Brown Subject: [PATCH v2 2/6] ALSA: hda: cs35l41: Add calls to newly added test key function Date: Mon, 17 Jan 2022 16:08:26 +0000 Message-ID: <20220117160830.709403-2-tanureal@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220117160830.709403-1-tanureal@opensource.cirrus.com> References: <20220117160830.709403-1-tanureal@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: ppEl2H72LnyX2_9CGX-V0GQJPYmIQdqP X-Proofpoint-ORIG-GUID: ppEl2H72LnyX2_9CGX-V0GQJPYmIQdqP X-Proofpoint-Spam-Reason: safe Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org, Charles Keepax , linux-kernel@vger.kernel.org, Lucas Tanure 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" From: Charles Keepax The test key now needs to be manually held when calling cs35l41_register_errata_patch, after patch: Add the missing function calls to this driver. Fixes: f517ba4924ad ("ASoC: cs35l41: Add support for hibernate memory retention mode") Signed-off-by: Charles Keepax Signed-off-by: Lucas Tanure --- V2: Add Fixes tag --- sound/pci/hda/cs35l41_hda.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index c47c5f0b4e59..509a380f9be7 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -463,6 +463,10 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i goto err; } + ret = cs35l41_test_key_unlock(cs35l41->dev, cs35l41->regmap); + if (ret) + goto err; + ret = cs35l41_register_errata_patch(cs35l41->dev, cs35l41->regmap, reg_revid); if (ret) goto err; @@ -473,6 +477,10 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i goto err; } + ret = cs35l41_test_key_lock(cs35l41->dev, cs35l41->regmap); + if (ret) + goto err; + ret = cs35l41_hda_apply_properties(cs35l41, acpi_hw_cfg); if (ret) goto err; From patchwork Mon Jan 17 16:08:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Tanure X-Patchwork-Id: 12715561 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 68D90C433F5 for ; Mon, 17 Jan 2022 16:09:35 +0000 (UTC) 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 C8C7117DC; Mon, 17 Jan 2022 17:08:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C8C7117DC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642435772; bh=0Rmt3op8NP3FL863hviZ7BB3200QVboGDJuy0fOGcmQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YmKp9q1Zpyf75LW9EmAgz6bjSqyiuYKE3XSTQgiCjKSJZFhtReW4ffH/VOKhZU19o 6UKen0GbACWzWzKLNE/nbWZWi07/jWisuOR28MWTUNM6wtiX9HZp+GQtXztsj/8q9T abWR8A9nRhjsDmzsJ7aqsj/tVqNgQHzB690Cl46M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 483BCF8025D; Mon, 17 Jan 2022 17:08:42 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AB686F8014B; Mon, 17 Jan 2022 17:08:40 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (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 BA4B4F80100 for ; Mon, 17 Jan 2022 17:08:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BA4B4F80100 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="SNG04o8d" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20HFFYHB025138; Mon, 17 Jan 2022 10:08:34 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=Q2jmIUxxgQlvMQHeVaQWubU1ZkCD95Vx51R0jGfn5TM=; b=SNG04o8dV/i9+3DIaf0FHZoKf1fe1PwPGBB0tHUdhQfQ9rbrB3D3TVg7BOypgqigsg+z MbwTEGwYA+hBU82NsZ69f0SVm7BXlDSvXgP/oxCKMQ90H9+TRSRxm892PVN8d7SR2mhG JvNE68N7OHagLa3a55hC5TgLJutBNvMzmDVeL7BNKwahXfMIJa/Yb2MXjdL+V9az7fgl ZfMwaMBguL0hsjFtSEq32RegT5nob1J5MX8fqAjNQOGUmEoZEEULmsrFrAad1281Sjbc URJB9FbS3I7DKK5n76S4EUk00qbUSDUraMDHL317Os8mW8jm7nNxEIosmi6YPmbEYGRV HA== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3dnaxhr22f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 17 Jan 2022 10:08:34 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 17 Jan 2022 16:08:32 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.2375.18 via Frontend Transport; Mon, 17 Jan 2022 16:08:32 +0000 Received: from aryzen.ad.cirrus.com (unknown [198.61.64.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 80DEB459; Mon, 17 Jan 2022 16:08:32 +0000 (UTC) From: Lucas Tanure To: Jaroslav Kysela , Takashi Iwai , Mark Brown Subject: [PATCH v2 3/6] ALSA: hda: cs35l41: Move cs35l41* calls to its own symbol namespace Date: Mon, 17 Jan 2022 16:08:27 +0000 Message-ID: <20220117160830.709403-3-tanureal@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220117160830.709403-1-tanureal@opensource.cirrus.com> References: <20220117160830.709403-1-tanureal@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: 6pceskFdUxspxGs1oRjnSlbngedhwVgk X-Proofpoint-ORIG-GUID: 6pceskFdUxspxGs1oRjnSlbngedhwVgk X-Proofpoint-Spam-Reason: safe Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Lucas Tanure 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" Create own namespace and avoid polluting the global namespace Signed-off-by: Lucas Tanure --- V2: No changes --- sound/pci/hda/cs35l41_hda.c | 5 ++--- sound/pci/hda/cs35l41_hda_i2c.c | 1 + sound/pci/hda/cs35l41_hda_spi.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index 509a380f9be7..c4f25e48dcc0 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -514,7 +514,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i return ret; } -EXPORT_SYMBOL_GPL(cs35l41_hda_probe); +EXPORT_SYMBOL_NS_GPL(cs35l41_hda_probe, SND_HDA_SCODEC_CS35L41); int cs35l41_hda_remove(struct device *dev) { @@ -528,8 +528,7 @@ int cs35l41_hda_remove(struct device *dev) return 0; } -EXPORT_SYMBOL_GPL(cs35l41_hda_remove); - +EXPORT_SYMBOL_NS_GPL(cs35l41_hda_remove, SND_HDA_SCODEC_CS35L41); MODULE_DESCRIPTION("CS35L41 HDA Driver"); MODULE_AUTHOR("Lucas Tanure, Cirrus Logic Inc, "); diff --git a/sound/pci/hda/cs35l41_hda_i2c.c b/sound/pci/hda/cs35l41_hda_i2c.c index 4a9462fb5c14..eeb387853ee3 100644 --- a/sound/pci/hda/cs35l41_hda_i2c.c +++ b/sound/pci/hda/cs35l41_hda_i2c.c @@ -62,5 +62,6 @@ static struct i2c_driver cs35l41_i2c_driver = { module_i2c_driver(cs35l41_i2c_driver); MODULE_DESCRIPTION("HDA CS35L41 driver"); +MODULE_IMPORT_NS(SND_HDA_SCODEC_CS35L41); MODULE_AUTHOR("Lucas Tanure "); MODULE_LICENSE("GPL"); diff --git a/sound/pci/hda/cs35l41_hda_spi.c b/sound/pci/hda/cs35l41_hda_spi.c index 77426e96c58f..15345a72b9d1 100644 --- a/sound/pci/hda/cs35l41_hda_spi.c +++ b/sound/pci/hda/cs35l41_hda_spi.c @@ -59,5 +59,6 @@ static struct spi_driver cs35l41_spi_driver = { module_spi_driver(cs35l41_spi_driver); MODULE_DESCRIPTION("HDA CS35L41 driver"); +MODULE_IMPORT_NS(SND_HDA_SCODEC_CS35L41); MODULE_AUTHOR("Lucas Tanure "); MODULE_LICENSE("GPL"); From patchwork Mon Jan 17 16:08:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Tanure X-Patchwork-Id: 12715565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D5F7C433F5 for ; Mon, 17 Jan 2022 16:10:58 +0000 (UTC) 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 20551183A; Mon, 17 Jan 2022 17:10:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 20551183A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642435856; bh=YiyJ330lUfCfVVNTP89SnpCxZDaA3BZArkMGXia7FIQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rMyLDJNOZUAKb/lgadYmaFBQ/nHUbdRMcXM8TtHuXmL9XNNcBsSre0wOZiL73SCG+ zIMPt+rBFCJCjkk/AanQDEUfbVzhQ97lvjGB1573k76RhYK8qkbJJIViTB8UF4tWb7 0WgOHd2rb0HH1ZkXdVcyu5LP6gjAJnw8KzpQD9+A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id ED53FF80518; Mon, 17 Jan 2022 17:08:48 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 727B4F80506; Mon, 17 Jan 2022 17:08:45 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (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 986D2F80254 for ; Mon, 17 Jan 2022 17:08:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 986D2F80254 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="MIyIeJSI" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20HFFYHE025138; Mon, 17 Jan 2022 10:08:36 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=NqFmW4aYe7NQ0YXxt5Fa5KfR4HPhf3lNiliwkux8kLk=; b=MIyIeJSIPljG+M2IbdnLf1NRVmvY+Fppn5obR5gFeVM4GqLenth/rBbMIY9plT4by2yh wuKi3mpNCw0/MwgEa99peYNjbpU5xaWq4PSgjjc+ubuAprgiQVcDngh4HLnBadNeZQQ9 Y4cO+N0HIkC0akZHfypJqmHU6YgVRT5tgJ3+gh5yxZ6CifcigO79yBf3sTSLndPVHZis Ze2BX+XgzmxsXosD0lm7B+2OBc3njV5hgvcGfvK/hIUIGo6IetSYHGMOPT5kCO93RtF+ U40YEIdWd11l8Aym1eX7E/Eu2N51L0thr1H1YfLSgKsoijFLloBnlSq9CjswfpMnSKFR qQ== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3dnaxhr22c-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 17 Jan 2022 10:08:35 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 17 Jan 2022 16:08:33 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.2375.18 via Frontend Transport; Mon, 17 Jan 2022 16:08:33 +0000 Received: from aryzen.ad.cirrus.com (unknown [198.61.64.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id CA24911D7; Mon, 17 Jan 2022 16:08:32 +0000 (UTC) From: Lucas Tanure To: Jaroslav Kysela , Takashi Iwai , Mark Brown Subject: [PATCH v2 4/6] ALSA: hda: cs35l41: Add missing default cases Date: Mon, 17 Jan 2022 16:08:28 +0000 Message-ID: <20220117160830.709403-4-tanureal@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220117160830.709403-1-tanureal@opensource.cirrus.com> References: <20220117160830.709403-1-tanureal@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: nkTHCk8YUaqFAqyB5i0hANWIX6iRwZDA X-Proofpoint-ORIG-GUID: nkTHCk8YUaqFAqyB5i0hANWIX6iRwZDA X-Proofpoint-Spam-Reason: safe Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Lucas Tanure 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" Add switch default cases at gpio pins configs Signed-off-by: Lucas Tanure --- V2: New patch with code split from Tidyup patch in this series --- sound/pci/hda/cs35l41_hda.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index c4f25e48dcc0..82f982f574a9 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -161,6 +161,9 @@ static void cs35l41_hda_playback_hook(struct device *dev, int action) if (reg_seq->close) ret = regmap_multi_reg_write(reg, reg_seq->close, reg_seq->num_close); break; + default: + ret = -EINVAL; + break; } if (ret) @@ -227,6 +230,8 @@ static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41, internal_boost = true; switch (hw_cfg->gpio1_func) { + case CS35L41_NOT_USED: + break; case CS35l41_VSPK_SWITCH: regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL, CS35L41_GPIO1_CTRL_MASK, 1 << CS35L41_GPIO1_CTRL_SHIFT); @@ -235,13 +240,21 @@ static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41, regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL, CS35L41_GPIO1_CTRL_MASK, 2 << CS35L41_GPIO1_CTRL_SHIFT); break; + default: + dev_err(cs35l41->dev, "Invalid function %d for GPIO1\n", hw_cfg->gpio1_func); + return -EINVAL; } switch (hw_cfg->gpio2_func) { + case CS35L41_NOT_USED: + break; case CS35L41_INTERRUPT: regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL, CS35L41_GPIO2_CTRL_MASK, 2 << CS35L41_GPIO2_CTRL_SHIFT); break; + default: + dev_err(cs35l41->dev, "Invalid function %d for GPIO2\n", hw_cfg->gpio2_func); + return -EINVAL; } if (internal_boost) { From patchwork Mon Jan 17 16:08:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Tanure X-Patchwork-Id: 12715562 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B5336C433EF for ; Mon, 17 Jan 2022 16:10:09 +0000 (UTC) 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 3F10C17EC; Mon, 17 Jan 2022 17:09:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3F10C17EC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642435806; bh=33yTT70QHlNBG648jZa4WM6Ipo3972gBKUUjoatyUGM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=r5ygIk5bSLlZYd6DwjjqyP2NfBZz8wtuzaGQIRbzS7zpfrl8CS3lQAIC3nu1lV6Zy ypIu7qc35XxTLmRoByRz/mytgjGKhkeWPzurihYfzf3QloCI04QYw0oavIPThm9Wze xrMOIaHXSA420NSa0Hl9OvyD8m1hi7cjdoGrWlJE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0AA7BF80100; Mon, 17 Jan 2022 17:08:46 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9F736F80249; Mon, 17 Jan 2022 17:08:43 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (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 93778F80249 for ; Mon, 17 Jan 2022 17:08:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 93778F80249 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="K1jiK7zT" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20HFFYHF025138; Mon, 17 Jan 2022 10:08:37 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=ckVtzevqA4xEJuoQpPtGyoEZQ52WPU9G2ryA25vdTls=; b=K1jiK7zTH68LhnKTRwBxnEYQNLryayc+bC5Sswo1kpNoU5z2iHf9C+ztpm2KqPtAyK6Q LZDKnTIdhsdBG0czs/AjH//WuQSjdX+mw5imVMn0CcWMPPzvKzFYY4IwluBonzrWrqul 0dx0HaiBGu9bGIWAoRMleQe0cXG39kDegj1cx0nczX3rGhM5jYrhXVn8JiBA9XQr2AZ3 L9QsTxXd36XJkOTvjp8FkfQJqxFoeMuhyVKRkh3ljoj44GblzaiUVKcQ7kpO1eBduv/P 0AKWmJJVuudQlArLdndJ38s/+pzRMbCUmlicgw1sQ0X4zbyXoX9Vizkt7fYRfg25vs1H pA== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3dnaxhr22c-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 17 Jan 2022 10:08:36 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 17 Jan 2022 16:08:33 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.2375.18 via Frontend Transport; Mon, 17 Jan 2022 16:08:33 +0000 Received: from aryzen.ad.cirrus.com (unknown [198.61.64.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 1E92446C; Mon, 17 Jan 2022 16:08:33 +0000 (UTC) From: Lucas Tanure To: Jaroslav Kysela , Takashi Iwai , Mark Brown Subject: [PATCH v2 5/6] ALSA: hda: cs35l41: Make use of the helper function dev_err_probe() Date: Mon, 17 Jan 2022 16:08:29 +0000 Message-ID: <20220117160830.709403-5-tanureal@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220117160830.709403-1-tanureal@opensource.cirrus.com> References: <20220117160830.709403-1-tanureal@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: LdW5S1a2eD39MAr7yv-u5LsfcYP51c3E X-Proofpoint-ORIG-GUID: LdW5S1a2eD39MAr7yv-u5LsfcYP51c3E X-Proofpoint-Spam-Reason: safe Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Lucas Tanure 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" When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Lucas Tanure --- V2: New patch with code split from Tidyup patch in this series --- sound/pci/hda/cs35l41_hda.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index 82f982f574a9..c317b392c3e3 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -429,8 +429,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i if (ret == -EBUSY) { dev_info(cs35l41->dev, "Reset line busy, assuming shared reset\n"); } else { - if (ret != -EPROBE_DEFER) - dev_err(cs35l41->dev, "Failed to get reset GPIO: %d\n", ret); + dev_err_probe(cs35l41->dev, ret, "Failed to get reset GPIO: %d\n", ret); goto err; } } From patchwork Mon Jan 17 16:08:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Tanure X-Patchwork-Id: 12715566 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 57CD7C433F5 for ; Mon, 17 Jan 2022 16:11:18 +0000 (UTC) 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 25D9F1865; Mon, 17 Jan 2022 17:10:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 25D9F1865 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642435876; bh=zDrQv0PKH9cVu0bgwvI1P5H+U7lpA2md3Ihg//jzm0M=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZcVKhzLIFZ7k+jwcfK9ZJlIJKmaQEs5PE3E+Vu9ov9XpMH3x2p2ky6jDBouKebGDA B+oS8a8op6chBgXoDFr4bNW+ZVk76B4SVGfAVgnxnm3nwF/atvI00obDbHc6DlSNLh o1IoFmj+3/Gmv93rmHNeVzRZZqZUXI6OSgqxsSvg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DCD24F80524; Mon, 17 Jan 2022 17:08:49 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6F0C4F80425; Mon, 17 Jan 2022 17:08:48 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (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 A5441F80425 for ; Mon, 17 Jan 2022 17:08:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A5441F80425 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="eNRF7JoF" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20HFFYHD025138; Mon, 17 Jan 2022 10:08:36 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=rkVf5Ta3dVOEysOBHkfGKELVhtVqwWh+4bLEY+Szko0=; b=eNRF7JoFy+9Y6Z4/C8TB4Q5BlLxYS7MrGJAflN3VRofwyXVLad6F5X+wRg7PjBLB5+nM VnCHF04adLyAiUOclkRcq1k2Z3jvQSdAZAQp9c0IlF/hSSd45sNVUOPQ7yfFNZILzYNS zMm1VC4+1ANk9y7PQdCQ7VYHdeLGUWd3p7cJxsZRHsHAnLuTT/JmrtmZAmZp8ChtA16i rPKZq1p7eQye8sABYvI4W7QAbOIVuD9rDwYQRP7aNaNOYZPE86WRUqcaD+oJXL2VAg2w UdVXtNDHwWLMg8DVt0K16Pnwg632AJigauZeQzHM9W4IA/jbS2s80eJQoBRDDEBdgv69 aA== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3dnaxhr22f-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 17 Jan 2022 10:08:35 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 17 Jan 2022 16:08:33 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.2375.18 via Frontend Transport; Mon, 17 Jan 2022 16:08:33 +0000 Received: from aryzen.ad.cirrus.com (unknown [198.61.64.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 6F14911D8; Mon, 17 Jan 2022 16:08:33 +0000 (UTC) From: Lucas Tanure To: Jaroslav Kysela , Takashi Iwai , Mark Brown Subject: [PATCH v2 6/6] ALSA: hda: cs35l41: Tidyup code Date: Mon, 17 Jan 2022 16:08:30 +0000 Message-ID: <20220117160830.709403-6-tanureal@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220117160830.709403-1-tanureal@opensource.cirrus.com> References: <20220117160830.709403-1-tanureal@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: KN-mRtUjkbpn0FZlKpg8yeubRl2_ka8n X-Proofpoint-ORIG-GUID: KN-mRtUjkbpn0FZlKpg8yeubRl2_ka8n X-Proofpoint-Spam-Reason: safe Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Lucas Tanure 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" Clean up and simplify cs35l41_hda_bind function Signed-off-by: Lucas Tanure --- V2: Removed changes not related with clean up --- sound/pci/hda/cs35l41_hda.c | 99 ++++++++++++++++----------------- sound/pci/hda/cs35l41_hda.h | 2 +- sound/pci/hda/cs35l41_hda_i2c.c | 1 - sound/pci/hda/cs35l41_hda_spi.c | 1 - 4 files changed, 49 insertions(+), 54 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index c317b392c3e3..3f9ddfb4eaf3 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 // -// cs35l41.c -- CS35l41 ALSA HDA audio driver +// CS35l41 ALSA HDA audio driver // // Copyright 2021 Cirrus Logic, Inc. // @@ -17,19 +17,19 @@ #include "cs35l41_hda.h" static const struct reg_sequence cs35l41_hda_config[] = { - { CS35L41_PLL_CLK_CTRL, 0x00000430 }, //3200000Hz, BCLK Input, PLL_REFCLK_EN = 1 - { CS35L41_GLOBAL_CLK_CTRL, 0x00000003 }, //GLOBAL_FS = 48 kHz - { CS35L41_SP_ENABLES, 0x00010000 }, //ASP_RX1_EN = 1 - { CS35L41_SP_RATE_CTRL, 0x00000021 }, //ASP_BCLK_FREQ = 3.072 MHz - { CS35L41_SP_FORMAT, 0x20200200 }, //24 bits, I2S, BCLK Slave, FSYNC Slave - { CS35L41_DAC_PCM1_SRC, 0x00000008 }, //DACPCM1_SRC = ASPRX1 - { CS35L41_AMP_DIG_VOL_CTRL, 0x00000000 }, //AMP_VOL_PCM 0.0 dB - { CS35L41_AMP_GAIN_CTRL, 0x00000084 }, //AMP_GAIN_PCM 4.5 dB - { CS35L41_PWR_CTRL2, 0x00000001 }, //AMP_EN = 1 + { CS35L41_PLL_CLK_CTRL, 0x00000430 }, // 3200000Hz, BCLK Input, PLL_REFCLK_EN = 1 + { CS35L41_GLOBAL_CLK_CTRL, 0x00000003 }, // GLOBAL_FS = 48 kHz + { CS35L41_SP_ENABLES, 0x00010000 }, // ASP_RX1_EN = 1 + { CS35L41_SP_RATE_CTRL, 0x00000021 }, // ASP_BCLK_FREQ = 3.072 MHz + { CS35L41_SP_FORMAT, 0x20200200 }, // 24 bits, I2S, BCLK Slave, FSYNC Slave + { CS35L41_DAC_PCM1_SRC, 0x00000008 }, // DACPCM1_SRC = ASPRX1 + { CS35L41_AMP_DIG_VOL_CTRL, 0x00000000 }, // AMP_VOL_PCM 0.0 dB + { CS35L41_AMP_GAIN_CTRL, 0x00000084 }, // AMP_GAIN_PCM 4.5 dB + { CS35L41_PWR_CTRL2, 0x00000001 }, // AMP_EN = 1 }; static const struct reg_sequence cs35l41_hda_start_bst[] = { - { CS35L41_PWR_CTRL2, 0x00000021 }, //BST_EN = 10, AMP_EN = 1 + { CS35L41_PWR_CTRL2, 0x00000021 }, // BST_EN = 10, AMP_EN = 1 { CS35L41_PWR_CTRL1, 0x00000001, 3000}, // set GLOBAL_EN = 1 }; @@ -60,7 +60,7 @@ static const struct reg_sequence cs35l41_stop_ext_vspk[] = { { 0x00000040, 0x00000055 }, { 0x00000040, 0x000000AA }, { 0x00007438, 0x00585941 }, - { 0x00002014, 0x00000000, 3000}, //set GLOBAL_EN = 0 + { 0x00002014, 0x00000000, 3000}, // set GLOBAL_EN = 0 { 0x0000742C, 0x00000009 }, { 0x00007438, 0x00580941 }, { 0x00011008, 0x00000001 }, @@ -78,7 +78,7 @@ static const struct reg_sequence cs35l41_safe_to_active[] = { { 0x0000742C, 0x0000000F }, { 0x0000742C, 0x00000079 }, { 0x00007438, 0x00585941 }, - { CS35L41_PWR_CTRL1, 0x00000001, 2000 }, //GLOBAL_EN = 1 + { CS35L41_PWR_CTRL1, 0x00000001, 2000 }, // GLOBAL_EN = 1 { 0x0000742C, 0x000000F9 }, { 0x00007438, 0x00580941 }, { 0x00000040, 0x000000CC }, @@ -89,8 +89,8 @@ static const struct reg_sequence cs35l41_active_to_safe[] = { { 0x00000040, 0x00000055 }, { 0x00000040, 0x000000AA }, { 0x00007438, 0x00585941 }, - { CS35L41_AMP_DIG_VOL_CTRL, 0x0000A678 }, //AMP_VOL_PCM Mute - { CS35L41_PWR_CTRL2, 0x00000000 }, //AMP_EN = 0 + { CS35L41_AMP_DIG_VOL_CTRL, 0x0000A678 }, // AMP_VOL_PCM Mute + { CS35L41_PWR_CTRL2, 0x00000000 }, // AMP_EN = 0 { CS35L41_PWR_CTRL1, 0x00000000 }, { 0x0000742C, 0x00000009, 2000 }, { 0x00007438, 0x00580941 }, @@ -168,7 +168,6 @@ static void cs35l41_hda_playback_hook(struct device *dev, int action) if (ret) dev_warn(cs35l41->dev, "Failed to apply multi reg write: %d\n", ret); - } static int cs35l41_hda_channel_map(struct device *dev, unsigned int tx_num, unsigned int *tx_slot, @@ -185,20 +184,19 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev); struct hda_component *comps = master_data; - if (comps && cs35l41->index >= 0 && cs35l41->index < HDA_MAX_COMPONENTS) - comps = &comps[cs35l41->index]; - else + if (!comps || cs35l41->index < 0 || cs35l41->index >= HDA_MAX_COMPONENTS) return -EINVAL; - if (!comps->dev) { - comps->dev = dev; - strscpy(comps->name, dev_name(dev), sizeof(comps->name)); - comps->playback_hook = cs35l41_hda_playback_hook; - comps->set_channel_map = cs35l41_hda_channel_map; - return 0; - } + comps = &comps[cs35l41->index]; + if (comps->dev) + return -EBUSY; - return -EBUSY; + comps->dev = dev; + strscpy(comps->name, dev_name(dev), sizeof(comps->name)); + comps->playback_hook = cs35l41_hda_playback_hook; + comps->set_channel_map = cs35l41_hda_channel_map; + + return 0; } static void cs35l41_hda_unbind(struct device *dev, struct device *master, void *master_data) @@ -269,11 +267,7 @@ static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41, cs35l41->reg_seq = &cs35l41_hda_reg_seq_ext_bst; } - ret = cs35l41_hda_channel_map(cs35l41->dev, 0, NULL, 1, (unsigned int *)&hw_cfg->spk_pos); - if (ret) - return ret; - - return 0; + return cs35l41_hda_channel_map(cs35l41->dev, 0, NULL, 1, (unsigned int *)&hw_cfg->spk_pos); } static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, @@ -282,7 +276,7 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c struct cs35l41_hda_hw_config *hw_cfg; u32 values[HDA_MAX_COMPONENTS]; struct acpi_device *adev; - struct device *acpi_dev; + struct device *physdev; char *property; size_t nval; int i, ret; @@ -293,11 +287,11 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c return ERR_PTR(-ENODEV); } - acpi_dev = get_device(acpi_get_first_physical_node(adev)); + physdev = get_device(acpi_get_first_physical_node(adev)); acpi_dev_put(adev); property = "cirrus,dev-index"; - ret = device_property_count_u32(acpi_dev, property); + ret = device_property_count_u32(physdev, property); if (ret <= 0) goto no_acpi_dsd; @@ -307,7 +301,7 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c } nval = ret; - ret = device_property_read_u32_array(acpi_dev, property, values, nval); + ret = device_property_read_u32_array(physdev, property, values, nval); if (ret) goto err; @@ -324,7 +318,9 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c goto err; } - /* No devm_ version as CLSA0100, in no_acpi_dsd case, can't use devm version */ + /* To use the same release code for all laptop variants we can't use devm_ version of + * gpiod_get here, as CLSA010* don't have a fully functional bios with an _DSD node + */ cs35l41->reset_gpio = fwnode_gpiod_get_index(&adev->fwnode, "reset", cs35l41->index, GPIOD_OUT_LOW, "cs35l41-reset"); @@ -335,46 +331,46 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c } property = "cirrus,speaker-position"; - ret = device_property_read_u32_array(acpi_dev, property, values, nval); + ret = device_property_read_u32_array(physdev, property, values, nval); if (ret) goto err_free; hw_cfg->spk_pos = values[cs35l41->index]; property = "cirrus,gpio1-func"; - ret = device_property_read_u32_array(acpi_dev, property, values, nval); + ret = device_property_read_u32_array(physdev, property, values, nval); if (ret) goto err_free; hw_cfg->gpio1_func = values[cs35l41->index]; property = "cirrus,gpio2-func"; - ret = device_property_read_u32_array(acpi_dev, property, values, nval); + ret = device_property_read_u32_array(physdev, property, values, nval); if (ret) goto err_free; hw_cfg->gpio2_func = values[cs35l41->index]; property = "cirrus,boost-peak-milliamp"; - ret = device_property_read_u32_array(acpi_dev, property, values, nval); + ret = device_property_read_u32_array(physdev, property, values, nval); if (ret == 0) hw_cfg->bst_ipk = values[cs35l41->index]; property = "cirrus,boost-ind-nanohenry"; - ret = device_property_read_u32_array(acpi_dev, property, values, nval); + ret = device_property_read_u32_array(physdev, property, values, nval); if (ret == 0) hw_cfg->bst_ind = values[cs35l41->index]; property = "cirrus,boost-cap-microfarad"; - ret = device_property_read_u32_array(acpi_dev, property, values, nval); + ret = device_property_read_u32_array(physdev, property, values, nval); if (ret == 0) hw_cfg->bst_cap = values[cs35l41->index]; - put_device(acpi_dev); + put_device(physdev); return hw_cfg; err_free: kfree(hw_cfg); err: - put_device(acpi_dev); + put_device(physdev); dev_err(cs35l41->dev, "Failed property %s: %d\n", property, ret); return ERR_PTR(ret); @@ -383,18 +379,18 @@ static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs35l41_hda *c /* * Device CLSA0100 doesn't have _DSD so a gpiod_get by the label reset won't work. * And devices created by i2c-multi-instantiate don't have their device struct pointing to - * the correct fwnode, so acpi_dev must be used here + * the correct fwnode, so acpi_dev must be used here. * And devm functions expect that the device requesting the resource has the correct - * fwnode + * fwnode. */ if (strncmp(hid, "CLSA0100", 8) != 0) return ERR_PTR(-EINVAL); /* check I2C address to assign the index */ cs35l41->index = id == 0x40 ? 0 : 1; - cs35l41->reset_gpio = gpiod_get_index(acpi_dev, NULL, 0, GPIOD_OUT_HIGH); + cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH); cs35l41->vspk_always_on = true; - put_device(acpi_dev); + put_device(physdev); return NULL; } @@ -449,7 +445,8 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i ret = regmap_read(cs35l41->regmap, CS35L41_IRQ1_STATUS3, &int_sts); if (ret || (int_sts & CS35L41_OTP_BOOT_ERR)) { - dev_err(cs35l41->dev, "OTP Boot error\n"); + dev_err(cs35l41->dev, "OTP Boot status %x error: %d\n", + int_sts & CS35L41_OTP_BOOT_ERR, ret); ret = -EIO; goto err; } @@ -501,7 +498,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i if (cs35l41->reg_seq->probe) { ret = regmap_multi_reg_write(cs35l41->regmap, cs35l41->reg_seq->probe, - cs35l41->reg_seq->num_probe); + cs35l41->reg_seq->num_probe); if (ret) { dev_err(cs35l41->dev, "Fail to apply probe reg patch: %d\n", ret); goto err; diff --git a/sound/pci/hda/cs35l41_hda.h b/sound/pci/hda/cs35l41_hda.h index 76c69a8a22f6..640afc98b686 100644 --- a/sound/pci/hda/cs35l41_hda.h +++ b/sound/pci/hda/cs35l41_hda.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 * - * cs35l41_hda.h -- CS35L41 ALSA HDA audio driver + * CS35L41 ALSA HDA audio driver * * Copyright 2021 Cirrus Logic, Inc. * diff --git a/sound/pci/hda/cs35l41_hda_i2c.c b/sound/pci/hda/cs35l41_hda_i2c.c index eeb387853ee3..c2397dc53e78 100644 --- a/sound/pci/hda/cs35l41_hda_i2c.c +++ b/sound/pci/hda/cs35l41_hda_i2c.c @@ -58,7 +58,6 @@ static struct i2c_driver cs35l41_i2c_driver = { .probe = cs35l41_hda_i2c_probe, .remove = cs35l41_hda_i2c_remove, }; - module_i2c_driver(cs35l41_i2c_driver); MODULE_DESCRIPTION("HDA CS35L41 driver"); diff --git a/sound/pci/hda/cs35l41_hda_spi.c b/sound/pci/hda/cs35l41_hda_spi.c index 15345a72b9d1..36815ab4e461 100644 --- a/sound/pci/hda/cs35l41_hda_spi.c +++ b/sound/pci/hda/cs35l41_hda_spi.c @@ -55,7 +55,6 @@ static struct spi_driver cs35l41_spi_driver = { .probe = cs35l41_hda_spi_probe, .remove = cs35l41_hda_spi_remove, }; - module_spi_driver(cs35l41_spi_driver); MODULE_DESCRIPTION("HDA CS35L41 driver");