From patchwork Fri Nov 17 14:13:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Strozek X-Patchwork-Id: 166195 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp556830vqn; Fri, 17 Nov 2023 06:14:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMjenddWh82pq8sb17cSFR8CXtdpoVOALs07zIZwaa1dxNOBt6Gh8WfeGj99GoJJlLZ59M X-Received: by 2002:a05:6a00:3a06:b0:6c6:9b11:f73f with SMTP id fj6-20020a056a003a0600b006c69b11f73fmr18641122pfb.28.1700230484515; Fri, 17 Nov 2023 06:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700230484; cv=none; d=google.com; s=arc-20160816; b=hkLwlKcRe+hxi6S6CXmxZ2nFooYbzxTmii7HYySPolpItDZSCnEdljVDk1wRvwVSlS WfvM/jQ/iY0gkrTQoBu/NjpGc80zsPJLwH46iluWpUgSK1vdcaMiH9iL9Oy0iWiGCvan d4oP2H4o57XycZ5buEexYMTsipTbxmYfCAkNeaQvlylO3Z1Cn+/n4jQAVPoIkI9wQ29b i6rqSw+JldJTRS7lAjYFIJ+GHWJ8h/00tubXZO/I18Xlv2y/9yHHQ9AZQ/a3iT0tkr7Y /Tjrq2gOqaQS+1rfEdLraRv7LJ2x6EQur2AzSWJSYd68o39da6kYKs6w/wSkKKiN4rD8 Fnqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rj31nEuXsSCk5S72HM5/0U8eQA9XedhRN77KOYy0rEc=; fh=KySyJaCx6e9HlRw2D2oLQPSdTHBwZsIBeFoG7LcS+QY=; b=z5BvKhjK89LtRyEiCsKnlWwgz5xIxNmGVGasGRvQUGvUHcOhWu6FrtEb4fDLwu3rO2 jQMH1dlkQw9YSdHYLJZU1NnvOpsH2mT+5r3R1lDFwy+3QHJm8Qy9v+d2etdaObkODh1i 0Go00J1ColFBLEL2XNTr7bNtKSbCaV1dCWHGaLavF0bQKy0NoX+aJZwoyFuqS92pY3SD Z7zd26VT3SB9bDwrasR584jrTTdnE9I6iJ6KPi3L1p6rsNKuITN26KgMyRUYrWu1+Cvb ToCChbKGM4s4V7qh4qLLQe7N+0vBVOXiGMgIjyOecA8+qrl6HpLkq/qrlGJdLGs9EWg4 6fGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=RhUfxQJ8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id f13-20020a056a001acd00b0068fe9c452acsi2012698pfv.376.2023.11.17.06.14.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 06:14:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=RhUfxQJ8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id B7CE782E4827; Fri, 17 Nov 2023 06:14:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346030AbjKQOOM (ORCPT + 30 others); Fri, 17 Nov 2023 09:14:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230383AbjKQOOG (ORCPT ); Fri, 17 Nov 2023 09:14:06 -0500 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1B6911F; Fri, 17 Nov 2023 06:14:02 -0800 (PST) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AH8IefJ017599; Fri, 17 Nov 2023 08:13:50 -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=Rj31nEuXsSCk5S72HM5/0U8eQA9XedhRN77KOYy0rEc=; b= RhUfxQJ8pl6931XOouMdOsG6XQZm3qajmsdSRweujS/XDFRS3QNfACauvAUOQjO3 Emt3wQLGvVFAhe/VEo6DW5SMC0EtHRgQWtGrtn4Sj4jg44TJfSmX+WMHdi6EXLhi LRMl1tQZkEqZxMKd9baKnHO1zyXVdVnjGahSh9CT/dM3+8PEG6CrtkWgGFv4eUHk YiRW+mREP8nD0cPuYw1We7IpeTJDYcfTV2dlwwia69lUhxy3VxSFG8RdjmO/82eh 6iPigQlOPzdZvc1UjbGnWREkZGRQK7xTt5y6nwXOdGNbQI6CJ1aQ5MsILLWoZR4t F+PP9ek4Km5asZDpPGLzFQ== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3ua7w2qj86-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Nov 2023 08:13:50 -0600 (CST) 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_256_GCM_SHA384) id 15.2.1118.39; Fri, 17 Nov 2023 14:13:46 +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.2.1118.39 via Frontend Transport; Fri, 17 Nov 2023 14:13:46 +0000 Received: from upx-tgl-008-ubuntu.ad.cirrus.com (upx-tgl-008-ubuntu.ad.cirrus.com [198.90.251.167]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id B42EB15B9; Fri, 17 Nov 2023 14:13:46 +0000 (UTC) From: Maciej Strozek To: Mark Brown CC: James Schulman , David Rhodes , Liam Girdwood , , , , , Maciej Strozek Subject: [PATCH 1/7] ASoC: cs43130: Fix the position of const qualifier Date: Fri, 17 Nov 2023 14:13:38 +0000 Message-ID: <20231117141344.64320-2-mstrozek@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> References: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: d4OMc01Oymr7hSgMxSeUVKB8YTLgZnv1 X-Proofpoint-GUID: d4OMc01Oymr7hSgMxSeUVKB8YTLgZnv1 X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 17 Nov 2023 06:14:23 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782820880513857093 X-GMAIL-MSGID: 1782820880513857093 Signed-off-by: Maciej Strozek --- sound/soc/codecs/cs43130.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c index 0b40fdfb1825..20f06679b8f7 100644 --- a/sound/soc/codecs/cs43130.c +++ b/sound/soc/codecs/cs43130.c @@ -1682,7 +1682,7 @@ static ssize_t hpload_dc_r_show(struct device *dev, return cs43130_show_dc(dev, buf, HP_RIGHT); } -static u16 const cs43130_ac_freq[CS43130_AC_FREQ] = { +static const u16 cs43130_ac_freq[CS43130_AC_FREQ] = { 24, 43, 93, @@ -2362,7 +2362,7 @@ static const struct regmap_config cs43130_regmap = { .use_single_write = true, }; -static u16 const cs43130_dc_threshold[CS43130_DC_THRESHOLD] = { +static const u16 cs43130_dc_threshold[CS43130_DC_THRESHOLD] = { 50, 120, }; From patchwork Fri Nov 17 14:13:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Strozek X-Patchwork-Id: 166192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp556430vqn; Fri, 17 Nov 2023 06:14:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUlKKYgKdF3px/8pxUihVBXh2qXEYhdKIWkYkUH3HyRoxwNZ2fgiAGRfbgijQIh6s0K7Dk X-Received: by 2002:a4a:3443:0:b0:581:40d0:7166 with SMTP id n3-20020a4a3443000000b0058140d07166mr19376769oof.8.1700230451740; Fri, 17 Nov 2023 06:14:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700230451; cv=none; d=google.com; s=arc-20160816; b=0Jk+pyO3oQoEV3eMhxwHPf+NsqXmYyTcoSKGm54o3JOc78wm/oqohMl1nm0OAXlDv7 XXfoNaPr1w41ZUYdbtjQWj6xc0aFR2otj13ZhRO6sGwdgID/uXHmv55WTC4bidqv3aBf pzfeN1/bImXxviMLx11AULfIAyfEc55mLIfbMjlmHTDC2UE/xFalDRrw7VP5X3EklB+I LMmW3RlEGYCOjLaNmBu1pQcjR8z38m3JKx5i8W/2FmxVOrrO0vOA5Cf52OyIOZ62Hyw5 gCHCphKXo5t5KATkD901LxM5ThVH4cqh27HmH9B4jf/neWzeCaI5qXtGOFSXM9Yx2ypF Kk+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6nw9/LmGLszAOwC3SVOIkEn6mwCimN6BH+fyeN1E600=; fh=KySyJaCx6e9HlRw2D2oLQPSdTHBwZsIBeFoG7LcS+QY=; b=WDVusXqcsRdndhVrLGzdXqXJB3M9ylqWWjZZLE3TNMBQycw5EFsZT/+/9FmzbwAJhJ JH/tYRtUhm/u7vZvgtWE3cANQCmFFBigkMB9JCViklqH7/PsDJ/OOCsrsSDwkuqdqt7/ qDUvGI7XG757qyP4MeKOs6fA8KFtCzZ1w+A7rTwxAKmdI4/xAYjFYA1dV532M1oZJ/I0 RNOtDpHPDdXo3+GcXw3wqrnPau72K+Jil27ZQqFVbvggV+eFq8mj+Q318Ka30wUYDKaz QzA+A31JWQpmjir1Yd2cQ/5FCq7Ena5av+TJgOiKZM1mJ0+HKvgTnb6TzPTGgZ7aPBcN 4INg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=JY4FcnGf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k7-20020a4a3107000000b0058a2131464bsi612046ooa.67.2023.11.17.06.14.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 06:14:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=JY4FcnGf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 056908153D1C; Fri, 17 Nov 2023 06:14:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232243AbjKQOOH (ORCPT + 30 others); Fri, 17 Nov 2023 09:14:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbjKQOOF (ORCPT ); Fri, 17 Nov 2023 09:14:05 -0500 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40A06D4E; Fri, 17 Nov 2023 06:14:02 -0800 (PST) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AH8IefI017599; Fri, 17 Nov 2023 08:13:49 -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=6nw9/LmGLszAOwC3SVOIkEn6mwCimN6BH+fyeN1E600=; b= JY4FcnGfg/NLLmPgZ6b4ftgL57/L0XL0ft2i5nU/bd6onECrHuBqBo1kKFzL0nEk GF0pLqfbyTRpb9c9F5s8a6du9UJAicD7t0uqpKV9KhPmtMyzFRKaipyODhVrtQCE QDuXNJOSdQ3obq6/udukjoWgpEkvvKz8K6GOwtHXqnOmK0v2Ot7hNPr5uVOrMMzP g9PyGfYcv6EXqMdrBZ8gay4i+8HZhAHXj3pdEvvkFNMfTtBwV2ppCEdHRLyB/D7r cJuRhUjyyTWRfsuSiSr6uJGkkREpU2xVTa1x4tkuH9o2YM23wc+p0l5PIMErBrsJ wwsreBaxI2YS3sy5gBD3Tg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3ua7w2qj86-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Nov 2023 08:13:49 -0600 (CST) 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_256_GCM_SHA384) id 15.2.1118.39; Fri, 17 Nov 2023 14:13:46 +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.2.1118.39 via Frontend Transport; Fri, 17 Nov 2023 14:13:46 +0000 Received: from upx-tgl-008-ubuntu.ad.cirrus.com (upx-tgl-008-ubuntu.ad.cirrus.com [198.90.251.167]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id C5BC73581; Fri, 17 Nov 2023 14:13:46 +0000 (UTC) From: Maciej Strozek To: Mark Brown CC: James Schulman , David Rhodes , Liam Girdwood , , , , , Maciej Strozek Subject: [PATCH 2/7] ASoC: cs43130: Fix incorrect frame delay configuration Date: Fri, 17 Nov 2023 14:13:39 +0000 Message-ID: <20231117141344.64320-3-mstrozek@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> References: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: xMJZgkaxrt8opvDPw-9hKzLQEeckuZRw X-Proofpoint-GUID: xMJZgkaxrt8opvDPw-9hKzLQEeckuZRw X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 17 Nov 2023 06:14:08 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782820846309899936 X-GMAIL-MSGID: 1782820846309899936 Signed-off-by: Maciej Strozek --- sound/soc/codecs/cs43130.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c index 20f06679b8f7..d8ec325b9cc9 100644 --- a/sound/soc/codecs/cs43130.c +++ b/sound/soc/codecs/cs43130.c @@ -578,7 +578,7 @@ static int cs43130_set_sp_fmt(int dai_id, unsigned int bitwidth_sclk, break; case SND_SOC_DAIFMT_LEFT_J: hi_size = bitwidth_sclk; - frm_delay = 2; + frm_delay = 0; frm_phase = 1; break; case SND_SOC_DAIFMT_DSP_A: From patchwork Fri Nov 17 14:13:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Strozek X-Patchwork-Id: 166197 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp556834vqn; Fri, 17 Nov 2023 06:14:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJz1A2+3ZDvzxoN56ik7sf24cZASTeHIAo33dYlNbQ5wPfJLEaDoSY7HbN9lEimcOb/A3o X-Received: by 2002:a05:6870:219b:b0:1ea:eed:fd02 with SMTP id l27-20020a056870219b00b001ea0eedfd02mr22094946oae.45.1700230484521; Fri, 17 Nov 2023 06:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700230484; cv=none; d=google.com; s=arc-20160816; b=Iff+Ja7qvicw3hHemK58PH8/7+YJNrP64VbVqEw7VaGu4fBXFfE0P+Dv5wsIwnogIh rzTrFFWotnVAc+jDtN6QV/9Odsivb4vurSNLMETgMg7kiYa5bDhdC0a+sSE1nbbKmRRz 5AvCTzmGriVPqRxzZuDAIk0TvyxIPuHdH55grI0MS1sUgQElDpmPjsRPb1090vs7GINj wPnArmGefao2aI4tPncbD9cElRxg4mg09nmZOOf2BqcDKz8AR/ztZ6PMvUaaRmjSccQa K9UmzGvTwmezN3QgNqXhY0/tS/w+30+ogvBO3/tz9HvTQit30KS6QN6HmYkSEWyOnknI Qkug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eQHPmKVYs9Cxq8bgVHJlqm/zIEmuE52dOPPbKaZHA6w=; fh=KySyJaCx6e9HlRw2D2oLQPSdTHBwZsIBeFoG7LcS+QY=; b=y14khZmX0uKNYJf5b9P27+qhckxg8CKUsZiHK+v+0E1aD+f4HF7DHim929P5gTcpab KzTWcSEvKPKYiQjvKgVjcbZ+xmdS7MGGrYV4dQX0pcDbzY5MktGEJuAgrOfGoELzOsfv DcrSRJngsgGAvCiVka1omfuh6izCC3qtkDEvvIF3cUkN8YmphFdoJHq1JI9rAggBC8kB OFvvr14XT8Vwyigwnno4vQBp5OjD+nvuG53+ts+70nKODuaGCECZKXkJQGxzvCG3DCLi UGE2i07UyzbUWzncevJIKoVZFqtI/Fo8XJt/8LZeGsAvTaKtXHtas7Wtqy7DwOmtawBK QSdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=ZSBOZnkq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id fu27-20020a0568705d9b00b001e9b54e6380si605139oab.98.2023.11.17.06.14.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 06:14:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=ZSBOZnkq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0A9DA81F8FC0; Fri, 17 Nov 2023 06:14:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345930AbjKQOOK (ORCPT + 30 others); Fri, 17 Nov 2023 09:14:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230513AbjKQOOG (ORCPT ); Fri, 17 Nov 2023 09:14:06 -0500 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8360CD52; Fri, 17 Nov 2023 06:14:02 -0800 (PST) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AH7fERx025627; Fri, 17 Nov 2023 08:13:48 -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=eQHPmKVYs9Cxq8bgVHJlqm/zIEmuE52dOPPbKaZHA6w=; b= ZSBOZnkqT87yPiuSy+d12hKuHYilyKARVa/3rMuBYkBOMg1rnhzSFcVvDSL5J2uj w129rkzizESKiu7XQS25EAv7pMjMK/P9Q/CVbbDqqpXF0NwFR46QTWIyzzE3XTRi QkC4dzk3KpHc5wirY7RUyu6bkzir0blOLlFGLCbELYAEc/XcWHuxrgYZ+aDfywp0 bIIaMLU68sBIv/dJX0Cas1pnGsOk07MBnYiHG4dT97u14lsbMG8LxkqqDf7izaTM pPZEfCiIHg7s5GCkbklEe9Vrjev7kMP6BcDEzSVWQNphIGS8HWaymktnZ0ZDmrTm ud+M08cqa+15zG7fiGY0fg== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3ua6wpfjs8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Nov 2023 08:13:48 -0600 (CST) 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_256_GCM_SHA384) id 15.2.1118.39; Fri, 17 Nov 2023 14:13:46 +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.2.1118.39 via Frontend Transport; Fri, 17 Nov 2023 14:13:46 +0000 Received: from upx-tgl-008-ubuntu.ad.cirrus.com (upx-tgl-008-ubuntu.ad.cirrus.com [198.90.251.167]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id D8F1A3582; Fri, 17 Nov 2023 14:13:46 +0000 (UTC) From: Maciej Strozek To: Mark Brown CC: James Schulman , David Rhodes , Liam Girdwood , , , , , Maciej Strozek Subject: [PATCH 3/7] ASoC: cs43130: Allow configuration of bit clock and frame inversion Date: Fri, 17 Nov 2023 14:13:40 +0000 Message-ID: <20231117141344.64320-4-mstrozek@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> References: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: 3Twmk12_ptNpSR9cgVrow_2OwfaJ63fc X-Proofpoint-ORIG-GUID: 3Twmk12_ptNpSR9cgVrow_2OwfaJ63fc X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 06:14:23 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782820880706988730 X-GMAIL-MSGID: 1782820880706988730 Signed-off-by: Maciej Strozek --- sound/soc/codecs/cs43130.c | 42 ++++++++++++++++++++++++++++++++++++-- sound/soc/codecs/cs43130.h | 1 + 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c index d8ec325b9cc9..62647045d8c4 100644 --- a/sound/soc/codecs/cs43130.c +++ b/sound/soc/codecs/cs43130.c @@ -595,6 +595,27 @@ static int cs43130_set_sp_fmt(int dai_id, unsigned int bitwidth_sclk, return -EINVAL; } + switch (cs43130->dais[dai_id].dai_invert) { + case SND_SOC_DAIFMT_NB_NF: + sclk_edge = 1; + lrck_edge = 0; + break; + case SND_SOC_DAIFMT_IB_NF: + sclk_edge = 0; + lrck_edge = 0; + break; + case SND_SOC_DAIFMT_NB_IF: + sclk_edge = 1; + lrck_edge = 1; + break; + case SND_SOC_DAIFMT_IB_IF: + sclk_edge = 0; + lrck_edge = 1; + break; + default: + return -EINVAL; + } + switch (cs43130->dais[dai_id].dai_mode) { case SND_SOC_DAIFMT_CBS_CFS: dai_mode_val = 0; @@ -607,8 +628,6 @@ static int cs43130_set_sp_fmt(int dai_id, unsigned int bitwidth_sclk, } frm_size = bitwidth_sclk * params_channels(params); - sclk_edge = 1; - lrck_edge = 0; loc_ch1 = 0; loc_ch2 = bitwidth_sclk * (params_channels(params) - 1); @@ -1483,6 +1502,25 @@ static int cs43130_pcm_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) return -EINVAL; } + switch (fmt & SND_SOC_DAIFMT_INV_MASK) { + case SND_SOC_DAIFMT_NB_NF: + cs43130->dais[codec_dai->id].dai_invert = SND_SOC_DAIFMT_NB_NF; + break; + case SND_SOC_DAIFMT_IB_NF: + cs43130->dais[codec_dai->id].dai_invert = SND_SOC_DAIFMT_IB_NF; + break; + case SND_SOC_DAIFMT_NB_IF: + cs43130->dais[codec_dai->id].dai_invert = SND_SOC_DAIFMT_NB_IF; + break; + case SND_SOC_DAIFMT_IB_IF: + cs43130->dais[codec_dai->id].dai_invert = SND_SOC_DAIFMT_IB_IF; + break; + default: + dev_err(cs43130->dev, "Unsupported invert mode 0x%x\n", + fmt & SND_SOC_DAIFMT_INV_MASK); + return -EINVAL; + } + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: cs43130->dais[codec_dai->id].dai_format = SND_SOC_DAIFMT_I2S; diff --git a/sound/soc/codecs/cs43130.h b/sound/soc/codecs/cs43130.h index 90e8895275e7..c7b2708aebcd 100644 --- a/sound/soc/codecs/cs43130.h +++ b/sound/soc/codecs/cs43130.h @@ -497,6 +497,7 @@ struct cs43130_dai { unsigned int sclk; unsigned int dai_format; unsigned int dai_mode; + unsigned int dai_invert; }; struct cs43130_private { From patchwork Fri Nov 17 14:13:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Strozek X-Patchwork-Id: 166194 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp556755vqn; Fri, 17 Nov 2023 06:14:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvnHnF/vwIjD4oMU0Vth2qk954k3Al5P/z0RzNdETVS0fEzHk7x7HdFbK3g5wiZ50Qqy6O X-Received: by 2002:a17:90b:1646:b0:27d:1538:e324 with SMTP id il6-20020a17090b164600b0027d1538e324mr17882881pjb.32.1700230477849; Fri, 17 Nov 2023 06:14:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700230477; cv=none; d=google.com; s=arc-20160816; b=ORONyYriuVXy+GHMUuT/wUA0vJPFyhLv410GtjrLzU/3pq+q9QuXusAeJraUNqit+r YBMk8wxVqjW8svssowjzR+t+nSsqe6I4ksf40m7Xr4FnG8LuUFAOc5L0K9nzmCyC4G3y 7zsjAa5IN5wmRokOYPACrCF2Y/NQ12CrT7eWI3iVsirUaVYIm+yFuBtcg1Oek1T5x8OY kjfdJx4O7/bp4/JMNAoSpjYTUHsEuoD/ebAx9qOXxnwVGXXM9gxflVlb2TdsS1MnIHtv yeWaKNjXzPB82UmL3Dw7Xr5Emrk+EUWM7ESwG+z9kTUssrpLDwjN/i1SRlGkovOhDSgd 3aCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jRbqwH6Ge42ChxgF46Ivy2SJOZSLFeYbW7olQcYfGhk=; fh=KySyJaCx6e9HlRw2D2oLQPSdTHBwZsIBeFoG7LcS+QY=; b=QjBgqLpgqSYk6s6sKzSWXNw2NDRlVHZZRy7Il8dhFjsA47RjdmHY7FwusHMEOoyrWP gkIXnAIhz8foHvVCFYt9BxLCpQxeLPAqck60Edb5eRLhPiD/2zkZO38g395UqJyRLISe srACbQUcfpbhMl5q/3anthwKykEa28+wh7830KVzJgnDay0iWTKpqV6oOLlQk6Ad3HhB MGmu0tBP/kWuLN6KhiJ7PaYT4q56Lll8STW2EAn17+p99ME2VZ5yhRBNpU+B3HBGRCdH QkXPdto7Q0cX7NsnlW9hL3dYbzQXZ4hh4FMT52w0UcgTjwtV5YLWEm357xHOyILJGs7d gFzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=GhAqSG8d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 16-20020a17090a0f1000b002802950ea02si1859349pjy.170.2023.11.17.06.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 06:14:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=GhAqSG8d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 075068217073; Fri, 17 Nov 2023 06:14:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346117AbjKQOOa (ORCPT + 30 others); Fri, 17 Nov 2023 09:14:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232515AbjKQOOU (ORCPT ); Fri, 17 Nov 2023 09:14:20 -0500 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 866C9D52; Fri, 17 Nov 2023 06:14:06 -0800 (PST) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AH8IefN017599; Fri, 17 Nov 2023 08:13:53 -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=jRbqwH6Ge42ChxgF46Ivy2SJOZSLFeYbW7olQcYfGhk=; b= GhAqSG8duowMLbg9WO7saNx3IKEGLM6GQDv8t3/6G0NIaKISeFOYf53sNnxJVlVp Iam40mYKdRYRkXnj809eEBhv4IUl93iCnMG3uafqLDsmZcb0/p4PYWQywzqTw7lZ WDv+TS8mgiZuLX5DrannPQfbnOPaZrGcOBnFQLUZYii4fkfTTgwdIta8xU8pEQHD D6Jn7zh5+cTkkW6sceOQez5OgmL0aVeQSP2blbFDiiE9sI7FWMz6cCqVBcI78udh o2bQMS07ZuqezIpCrOdXVDs9OYJIwoC3aJa4Vsk4qBQEQDD+rhIPYKuDZzJ+6uTL NHDg3ekEadx3WZ7qzHenMg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3ua7w2qj86-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Nov 2023 08:13:53 -0600 (CST) 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_256_GCM_SHA384) id 15.2.1118.39; Fri, 17 Nov 2023 14:13:47 +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.2.1118.39 via Frontend Transport; Fri, 17 Nov 2023 14:13:47 +0000 Received: from upx-tgl-008-ubuntu.ad.cirrus.com (upx-tgl-008-ubuntu.ad.cirrus.com [198.90.251.167]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id EAF26357F; Fri, 17 Nov 2023 14:13:46 +0000 (UTC) From: Maciej Strozek To: Mark Brown CC: James Schulman , David Rhodes , Liam Girdwood , , , , , Maciej Strozek Subject: [PATCH 4/7] ASoC: cs43130: Store device in private struct and use it more consistently Date: Fri, 17 Nov 2023 14:13:41 +0000 Message-ID: <20231117141344.64320-5-mstrozek@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> References: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: ABDyWQ0mJNPqoeKyds5AXSOrH1dnR7Nu X-Proofpoint-GUID: ABDyWQ0mJNPqoeKyds5AXSOrH1dnR7Nu X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 17 Nov 2023 06:14:36 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782820873895863176 X-GMAIL-MSGID: 1782820873895863176 Also remove one unnecessary debug print Signed-off-by: Maciej Strozek --- sound/soc/codecs/cs43130.c | 151 ++++++++++++++++++------------------- sound/soc/codecs/cs43130.h | 1 + 2 files changed, 75 insertions(+), 77 deletions(-) diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c index 62647045d8c4..447abbaa6f47 100644 --- a/sound/soc/codecs/cs43130.c +++ b/sound/soc/codecs/cs43130.c @@ -238,7 +238,7 @@ static int cs43130_pll_config(struct snd_soc_component *component) struct cs43130_private *cs43130 = snd_soc_component_get_drvdata(component); const struct cs43130_pll_params *pll_entry; - dev_dbg(component->dev, "cs43130->mclk = %u, cs43130->mclk_int = %u\n", + dev_dbg(cs43130->dev, "cs43130->mclk = %u, cs43130->mclk_int = %u\n", cs43130->mclk, cs43130->mclk_int); pll_entry = cs43130_get_pll_table(cs43130->mclk, cs43130->mclk_int); @@ -303,7 +303,7 @@ static int cs43130_set_pll(struct snd_soc_component *component, int pll_id, int cs43130->mclk = freq_in; break; default: - dev_err(component->dev, + dev_err(cs43130->dev, "unsupported pll input reference clock:%d\n", freq_in); return -EINVAL; } @@ -316,13 +316,13 @@ static int cs43130_set_pll(struct snd_soc_component *component, int pll_id, int cs43130->mclk_int = freq_out; break; default: - dev_err(component->dev, + dev_err(cs43130->dev, "unsupported pll output ref clock: %u\n", freq_out); return -EINVAL; } ret = cs43130_pll_config(component); - dev_dbg(component->dev, "cs43130->pll_bypass = %d", cs43130->pll_bypass); + dev_dbg(cs43130->dev, "cs43130->pll_bypass = %d", cs43130->pll_bypass); return ret; } @@ -346,7 +346,7 @@ static int cs43130_change_clksrc(struct snd_soc_component *component, mclk_int_decoded = CS43130_MCLK_24P5; break; default: - dev_err(component->dev, "Invalid MCLK INT freq: %u\n", cs43130->mclk_int); + dev_err(cs43130->dev, "Invalid MCLK INT freq: %u\n", cs43130->mclk_int); return -EINVAL; } @@ -370,7 +370,7 @@ static int cs43130_change_clksrc(struct snd_soc_component *component, CS43130_XTAL_RDY_INT_MASK, 1 << CS43130_XTAL_RDY_INT_SHIFT); if (ret == 0) { - dev_err(component->dev, "Timeout waiting for XTAL_READY interrupt\n"); + dev_err(cs43130->dev, "Timeout waiting for XTAL_READY interrupt\n"); return -ETIMEDOUT; } } @@ -406,7 +406,7 @@ static int cs43130_change_clksrc(struct snd_soc_component *component, CS43130_XTAL_RDY_INT_MASK, 1 << CS43130_XTAL_RDY_INT_SHIFT); if (ret == 0) { - dev_err(component->dev, "Timeout waiting for XTAL_READY interrupt\n"); + dev_err(cs43130->dev, "Timeout waiting for XTAL_READY interrupt\n"); return -ETIMEDOUT; } } @@ -422,7 +422,7 @@ static int cs43130_change_clksrc(struct snd_soc_component *component, CS43130_PLL_RDY_INT_MASK, 1 << CS43130_PLL_RDY_INT_SHIFT); if (ret == 0) { - dev_err(component->dev, "Timeout waiting for PLL_READY interrupt\n"); + dev_err(cs43130->dev, "Timeout waiting for PLL_READY interrupt\n"); return -ETIMEDOUT; } @@ -453,7 +453,7 @@ static int cs43130_change_clksrc(struct snd_soc_component *component, 1 << CS43130_PDN_PLL_SHIFT); break; default: - dev_err(component->dev, "Invalid MCLK source value\n"); + dev_err(cs43130->dev, "Invalid MCLK source value\n"); return -EINVAL; } @@ -823,7 +823,7 @@ static int cs43130_dsd_hw_params(struct snd_pcm_substream *substream, dsd_speed = 1; break; default: - dev_err(component->dev, "Rate(%u) not supported\n", + dev_err(cs43130->dev, "Rate(%u) not supported\n", params_rate(params)); return -EINVAL; } @@ -894,7 +894,7 @@ static int cs43130_hw_params(struct snd_pcm_substream *substream, dsd_speed = 1; break; default: - dev_err(component->dev, "Rate(%u) not supported\n", + dev_err(cs43130->dev, "Rate(%u) not supported\n", params_rate(params)); return -EINVAL; } @@ -911,7 +911,7 @@ static int cs43130_hw_params(struct snd_pcm_substream *substream, regmap_write(cs43130->regmap, CS43130_SP_SRATE, rate_map->val); break; default: - dev_err(component->dev, "Invalid DAI (%d)\n", dai->id); + dev_err(cs43130->dev, "Invalid DAI (%d)\n", dai->id); return -EINVAL; } @@ -935,21 +935,21 @@ static int cs43130_hw_params(struct snd_pcm_substream *substream, if (!sclk) { /* at this point, SCLK must be set */ - dev_err(component->dev, "SCLK freq is not set\n"); + dev_err(cs43130->dev, "SCLK freq is not set\n"); return -EINVAL; } bitwidth_sclk = (sclk / params_rate(params)) / params_channels(params); if (bitwidth_sclk < bitwidth_dai) { - dev_err(component->dev, "Format not supported: SCLK freq is too low\n"); + dev_err(cs43130->dev, "Format not supported: SCLK freq is too low\n"); return -EINVAL; } - dev_dbg(component->dev, + dev_dbg(cs43130->dev, "sclk = %u, fs = %d, bitwidth_dai = %u\n", sclk, params_rate(params), bitwidth_dai); - dev_dbg(component->dev, + dev_dbg(cs43130->dev, "bitwidth_sclk = %u, num_ch = %u\n", bitwidth_sclk, params_channels(params)); @@ -1208,7 +1208,7 @@ static int cs43130_dsd_event(struct snd_soc_dapm_widget *w, } break; default: - dev_err(component->dev, "Invalid event = 0x%x\n", event); + dev_err(cs43130->dev, "Invalid event = 0x%x\n", event); return -EINVAL; } return 0; @@ -1265,7 +1265,7 @@ static int cs43130_pcm_event(struct snd_soc_dapm_widget *w, } break; default: - dev_err(component->dev, "Invalid event = 0x%x\n", event); + dev_err(cs43130->dev, "Invalid event = 0x%x\n", event); return -EINVAL; } return 0; @@ -1341,7 +1341,7 @@ static int cs43130_dac_event(struct snd_soc_dapm_widget *w, } break; default: - dev_err(component->dev, "Invalid DAC event = 0x%x\n", event); + dev_err(cs43130->dev, "Invalid DAC event = 0x%x\n", event); return -EINVAL; } return 0; @@ -1379,7 +1379,7 @@ static int cs43130_hpin_event(struct snd_soc_dapm_widget *w, ARRAY_SIZE(hpin_postpmu_seq)); break; default: - dev_err(component->dev, "Invalid HPIN event = 0x%x\n", event); + dev_err(cs43130->dev, "Invalid HPIN event = 0x%x\n", event); return -EINVAL; } return 0; @@ -1498,7 +1498,7 @@ static int cs43130_pcm_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) cs43130->dais[codec_dai->id].dai_mode = SND_SOC_DAIFMT_CBM_CFM; break; default: - dev_err(component->dev, "unsupported mode\n"); + dev_err(cs43130->dev, "unsupported mode\n"); return -EINVAL; } @@ -1535,12 +1535,12 @@ static int cs43130_pcm_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) cs43130->dais[codec_dai->id].dai_format = SND_SOC_DAIFMT_DSP_B; break; default: - dev_err(component->dev, + dev_err(cs43130->dev, "unsupported audio format\n"); return -EINVAL; } - dev_dbg(component->dev, "dai_id = %d, dai_mode = %u, dai_format = %u\n", + dev_dbg(cs43130->dev, "dai_id = %d, dai_mode = %u, dai_format = %u\n", codec_dai->id, cs43130->dais[codec_dai->id].dai_mode, cs43130->dais[codec_dai->id].dai_format); @@ -1561,11 +1561,11 @@ static int cs43130_dsd_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) cs43130->dais[codec_dai->id].dai_mode = SND_SOC_DAIFMT_CBM_CFM; break; default: - dev_err(component->dev, "Unsupported DAI format.\n"); + dev_err(cs43130->dev, "Unsupported DAI format.\n"); return -EINVAL; } - dev_dbg(component->dev, "dai_mode = 0x%x\n", + dev_dbg(cs43130->dev, "dai_mode = 0x%x\n", cs43130->dais[codec_dai->id].dai_mode); return 0; @@ -1578,7 +1578,7 @@ static int cs43130_set_sysclk(struct snd_soc_dai *codec_dai, struct cs43130_private *cs43130 = snd_soc_component_get_drvdata(component); cs43130->dais[codec_dai->id].sclk = freq; - dev_dbg(component->dev, "dai_id = %d, sclk = %u\n", codec_dai->id, + dev_dbg(cs43130->dev, "dai_id = %d, sclk = %u\n", codec_dai->id, cs43130->dais[codec_dai->id].sclk); return 0; @@ -1668,7 +1668,7 @@ static int cs43130_component_set_sysclk(struct snd_soc_component *component, { struct cs43130_private *cs43130 = snd_soc_component_get_drvdata(component); - dev_dbg(component->dev, "clk_id = %d, source = %d, freq = %d, dir = %d\n", + dev_dbg(cs43130->dev, "clk_id = %d, source = %d, freq = %d, dir = %d\n", clk_id, source, freq, dir); switch (freq) { @@ -1677,14 +1677,14 @@ static int cs43130_component_set_sysclk(struct snd_soc_component *component, cs43130->mclk = freq; break; default: - dev_err(component->dev, "Invalid MCLK INT freq: %u\n", freq); + dev_err(cs43130->dev, "Invalid MCLK INT freq: %u\n", freq); return -EINVAL; } if (source == CS43130_MCLK_SRC_EXT) { cs43130->pll_bypass = true; } else { - dev_err(component->dev, "Invalid MCLK source\n"); + dev_err(cs43130->dev, "Invalid MCLK source\n"); return -EINVAL; } @@ -1971,7 +1971,6 @@ static int cs43130_update_hpload(unsigned int msk, int ac_idx, unsigned int reg; u32 addr; u16 impedance; - struct snd_soc_component *component = cs43130->component; switch (msk) { case CS43130_HPLOAD_DC_INT: @@ -2001,7 +2000,7 @@ static int cs43130_update_hpload(unsigned int msk, int ac_idx, else cs43130->hpload_dc[HP_RIGHT] = impedance; - dev_dbg(component->dev, "HP DC impedance (Ch %u): %u\n", !left_ch, + dev_dbg(cs43130->dev, "HP DC impedance (Ch %u): %u\n", !left_ch, impedance); } else { if (left_ch) @@ -2009,7 +2008,7 @@ static int cs43130_update_hpload(unsigned int msk, int ac_idx, else cs43130->hpload_ac[ac_idx][HP_RIGHT] = impedance; - dev_dbg(component->dev, "HP AC (%u Hz) impedance (Ch %u): %u\n", + dev_dbg(cs43130->dev, "HP AC (%u Hz) impedance (Ch %u): %u\n", cs43130->ac_freq[ac_idx], !left_ch, impedance); } @@ -2023,7 +2022,6 @@ static int cs43130_hpload_proc(struct cs43130_private *cs43130, int ret; unsigned int msk; u16 ac_reg_val; - struct snd_soc_component *component = cs43130->component; reinit_completion(&cs43130->hpload_evt); @@ -2046,17 +2044,17 @@ static int cs43130_hpload_proc(struct cs43130_private *cs43130, msecs_to_jiffies(1000)); regmap_read(cs43130->regmap, CS43130_INT_MASK_4, &msk); if (!ret) { - dev_err(component->dev, "Timeout waiting for HPLOAD interrupt\n"); + dev_err(cs43130->dev, "Timeout waiting for HPLOAD interrupt\n"); return -1; } - dev_dbg(component->dev, "HP load stat: %x, INT_MASK_4: %x\n", + dev_dbg(cs43130->dev, "HP load stat: %x, INT_MASK_4: %x\n", cs43130->hpload_stat, msk); if ((cs43130->hpload_stat & (CS43130_HPLOAD_NO_DC_INT | CS43130_HPLOAD_UNPLUG_INT | CS43130_HPLOAD_OOR_INT)) || !(cs43130->hpload_stat & rslt_msk)) { - dev_dbg(component->dev, "HP load measure failed\n"); + dev_dbg(cs43130->dev, "HP load measure failed\n"); return -1; } @@ -2167,9 +2165,9 @@ static void cs43130_imp_meas(struct work_struct *wk) snd_soc_jack_report(&cs43130->jack, CS43130_JACK_HEADPHONE, CS43130_JACK_MASK); - dev_dbg(component->dev, "Set HP output control. DC threshold\n"); + dev_dbg(cs43130->dev, "Set HP output control. DC threshold\n"); for (i = 0; i < CS43130_DC_THRESHOLD; i++) - dev_dbg(component->dev, "DC threshold[%d]: %u.\n", i, + dev_dbg(cs43130->dev, "DC threshold[%d]: %u.\n", i, cs43130->dc_threshold[i]); cs43130_set_hv(cs43130->regmap, cs43130->hpload_dc[HP_LEFT], @@ -2203,7 +2201,6 @@ static void cs43130_imp_meas(struct work_struct *wk) static irqreturn_t cs43130_irq_thread(int irq, void *data) { struct cs43130_private *cs43130 = (struct cs43130_private *)data; - struct snd_soc_component *component = cs43130->component; unsigned int stickies[CS43130_NUM_INT]; unsigned int irq_occurrence = 0; unsigned int masks[CS43130_NUM_INT]; @@ -2221,8 +2218,6 @@ static irqreturn_t cs43130_irq_thread(int irq, void *data) for (j = 0; j < 8; j++) irq_occurrence += (stickies[i] >> j) & 1; } - dev_dbg(component->dev, "number of interrupts occurred (%u)\n", - irq_occurrence); if (!irq_occurrence) return IRQ_NONE; @@ -2239,7 +2234,7 @@ static irqreturn_t cs43130_irq_thread(int irq, void *data) if (stickies[3] & CS43130_HPLOAD_NO_DC_INT) { cs43130->hpload_stat = stickies[3]; - dev_err(component->dev, + dev_err(cs43130->dev, "DC load has not completed before AC load (%x)\n", cs43130->hpload_stat); complete(&cs43130->hpload_evt); @@ -2248,7 +2243,7 @@ static irqreturn_t cs43130_irq_thread(int irq, void *data) if (stickies[3] & CS43130_HPLOAD_UNPLUG_INT) { cs43130->hpload_stat = stickies[3]; - dev_err(component->dev, "HP unplugged during measurement (%x)\n", + dev_err(cs43130->dev, "HP unplugged during measurement (%x)\n", cs43130->hpload_stat); complete(&cs43130->hpload_evt); return IRQ_HANDLED; @@ -2256,7 +2251,7 @@ static irqreturn_t cs43130_irq_thread(int irq, void *data) if (stickies[3] & CS43130_HPLOAD_OOR_INT) { cs43130->hpload_stat = stickies[3]; - dev_err(component->dev, "HP load out of range (%x)\n", + dev_err(cs43130->dev, "HP load out of range (%x)\n", cs43130->hpload_stat); complete(&cs43130->hpload_evt); return IRQ_HANDLED; @@ -2264,7 +2259,7 @@ static irqreturn_t cs43130_irq_thread(int irq, void *data) if (stickies[3] & CS43130_HPLOAD_AC_INT) { cs43130->hpload_stat = stickies[3]; - dev_dbg(component->dev, "HP AC load measurement done (%x)\n", + dev_dbg(cs43130->dev, "HP AC load measurement done (%x)\n", cs43130->hpload_stat); complete(&cs43130->hpload_evt); return IRQ_HANDLED; @@ -2272,7 +2267,7 @@ static irqreturn_t cs43130_irq_thread(int irq, void *data) if (stickies[3] & CS43130_HPLOAD_DC_INT) { cs43130->hpload_stat = stickies[3]; - dev_dbg(component->dev, "HP DC load measurement done (%x)\n", + dev_dbg(cs43130->dev, "HP DC load measurement done (%x)\n", cs43130->hpload_stat); complete(&cs43130->hpload_evt); return IRQ_HANDLED; @@ -2280,7 +2275,7 @@ static irqreturn_t cs43130_irq_thread(int irq, void *data) if (stickies[3] & CS43130_HPLOAD_ON_INT) { cs43130->hpload_stat = stickies[3]; - dev_dbg(component->dev, "HP load state machine on done (%x)\n", + dev_dbg(cs43130->dev, "HP load state machine on done (%x)\n", cs43130->hpload_stat); complete(&cs43130->hpload_evt); return IRQ_HANDLED; @@ -2288,19 +2283,19 @@ static irqreturn_t cs43130_irq_thread(int irq, void *data) if (stickies[3] & CS43130_HPLOAD_OFF_INT) { cs43130->hpload_stat = stickies[3]; - dev_dbg(component->dev, "HP load state machine off done (%x)\n", + dev_dbg(cs43130->dev, "HP load state machine off done (%x)\n", cs43130->hpload_stat); complete(&cs43130->hpload_evt); return IRQ_HANDLED; } if (stickies[0] & CS43130_XTAL_ERR_INT) { - dev_err(component->dev, "Crystal err: clock is not running\n"); + dev_err(cs43130->dev, "Crystal err: clock is not running\n"); return IRQ_HANDLED; } if (stickies[0] & CS43130_HP_UNPLUG_INT) { - dev_dbg(component->dev, "HP unplugged\n"); + dev_dbg(cs43130->dev, "HP unplugged\n"); cs43130->hpload_done = false; snd_soc_jack_report(&cs43130->jack, 0, CS43130_JACK_MASK); return IRQ_HANDLED; @@ -2309,7 +2304,7 @@ static irqreturn_t cs43130_irq_thread(int irq, void *data) if (stickies[0] & CS43130_HP_PLUG_INT) { if (cs43130->dc_meas && !cs43130->hpload_done && !work_busy(&cs43130->work)) { - dev_dbg(component->dev, "HP load queue work\n"); + dev_dbg(cs43130->dev, "HP load queue work\n"); queue_work(cs43130->wq, &cs43130->work); } @@ -2341,19 +2336,19 @@ static int cs43130_probe(struct snd_soc_component *component) ret = snd_soc_card_jack_new(card, "Headphone", CS43130_JACK_MASK, &cs43130->jack); if (ret < 0) { - dev_err(component->dev, "Cannot create jack\n"); + dev_err(cs43130->dev, "Cannot create jack\n"); return ret; } cs43130->hpload_done = false; if (cs43130->dc_meas) { - ret = sysfs_create_groups(&component->dev->kobj, hpload_groups); + ret = sysfs_create_groups(&cs43130->dev->kobj, hpload_groups); if (ret) return ret; cs43130->wq = create_singlethread_workqueue("cs43130_hp"); if (!cs43130->wq) { - sysfs_remove_groups(&component->dev->kobj, hpload_groups); + sysfs_remove_groups(&cs43130->dev->kobj, hpload_groups); return -ENOMEM; } INIT_WORK(&cs43130->work, cs43130_imp_meas); @@ -2429,7 +2424,7 @@ static int cs43130_handle_device_data(struct i2c_client *i2c_client, cs43130->xtal_ibias = CS43130_XTAL_IBIAS_15UA; break; default: - dev_err(&i2c_client->dev, + dev_err(cs43130->dev, "Invalid cirrus,xtal-ibias value: %d\n", val); return -EINVAL; } @@ -2464,6 +2459,8 @@ static int cs43130_i2c_probe(struct i2c_client *client) if (!cs43130) return -ENOMEM; + cs43130->dev = &client->dev; + i2c_set_clientdata(client, cs43130); cs43130->regmap = devm_regmap_init_i2c(client, &cs43130_regmap); @@ -2472,7 +2469,7 @@ static int cs43130_i2c_probe(struct i2c_client *client) return ret; } - if (client->dev.of_node) { + if (cs43130->dev->of_node) { ret = cs43130_handle_device_data(client, cs43130); if (ret != 0) return ret; @@ -2480,21 +2477,21 @@ static int cs43130_i2c_probe(struct i2c_client *client) for (i = 0; i < ARRAY_SIZE(cs43130->supplies); i++) cs43130->supplies[i].supply = cs43130_supply_names[i]; - ret = devm_regulator_bulk_get(&client->dev, + ret = devm_regulator_bulk_get(cs43130->dev, ARRAY_SIZE(cs43130->supplies), cs43130->supplies); if (ret != 0) { - dev_err(&client->dev, "Failed to request supplies: %d\n", ret); + dev_err(cs43130->dev, "Failed to request supplies: %d\n", ret); return ret; } ret = regulator_bulk_enable(ARRAY_SIZE(cs43130->supplies), cs43130->supplies); if (ret != 0) { - dev_err(&client->dev, "Failed to enable supplies: %d\n", ret); + dev_err(cs43130->dev, "Failed to enable supplies: %d\n", ret); return ret; } - cs43130->reset_gpio = devm_gpiod_get_optional(&client->dev, + cs43130->reset_gpio = devm_gpiod_get_optional(cs43130->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(cs43130->reset_gpio)) { ret = PTR_ERR(cs43130->reset_gpio); @@ -2508,7 +2505,7 @@ static int cs43130_i2c_probe(struct i2c_client *client) devid = cirrus_read_device_id(cs43130->regmap, CS43130_DEVID_AB); if (devid < 0) { ret = devid; - dev_err(&client->dev, "Failed to read device ID: %d\n", ret); + dev_err(cs43130->dev, "Failed to read device ID: %d\n", ret); goto err; } @@ -2519,7 +2516,7 @@ static int cs43130_i2c_probe(struct i2c_client *client) case CS43198_CHIP_ID: break; default: - dev_err(&client->dev, + dev_err(cs43130->dev, "CS43130 Device ID %X. Expected ID %X, %X, %X or %X\n", devid, CS43130_CHIP_ID, CS4399_CHIP_ID, CS43131_CHIP_ID, CS43198_CHIP_ID); @@ -2530,11 +2527,11 @@ static int cs43130_i2c_probe(struct i2c_client *client) cs43130->dev_id = devid; ret = regmap_read(cs43130->regmap, CS43130_REV_ID, ®); if (ret < 0) { - dev_err(&client->dev, "Get Revision ID failed\n"); + dev_err(cs43130->dev, "Get Revision ID failed\n"); goto err; } - dev_info(&client->dev, + dev_info(cs43130->dev, "Cirrus Logic CS43130 (%x), Revision: %02X\n", devid, reg & 0xFF); @@ -2544,21 +2541,21 @@ static int cs43130_i2c_probe(struct i2c_client *client) init_completion(&cs43130->pll_rdy); init_completion(&cs43130->hpload_evt); - ret = devm_request_threaded_irq(&client->dev, client->irq, + ret = devm_request_threaded_irq(cs43130->dev, client->irq, NULL, cs43130_irq_thread, IRQF_ONESHOT | IRQF_TRIGGER_LOW, "cs43130", cs43130); if (ret != 0) { - dev_err(&client->dev, "Failed to request IRQ: %d\n", ret); + dev_err(cs43130->dev, "Failed to request IRQ: %d\n", ret); goto err; } cs43130->mclk_int_src = CS43130_MCLK_SRC_RCO; - pm_runtime_set_autosuspend_delay(&client->dev, 100); - pm_runtime_use_autosuspend(&client->dev); - pm_runtime_set_active(&client->dev); - pm_runtime_enable(&client->dev); + pm_runtime_set_autosuspend_delay(cs43130->dev, 100); + pm_runtime_use_autosuspend(cs43130->dev); + pm_runtime_set_active(cs43130->dev); + pm_runtime_enable(cs43130->dev); switch (cs43130->dev_id) { case CS43130_CHIP_ID: @@ -2594,11 +2591,11 @@ static int cs43130_i2c_probe(struct i2c_client *client) break; } - ret = devm_snd_soc_register_component(&client->dev, + ret = devm_snd_soc_register_component(cs43130->dev, &soc_component_dev_cs43130, cs43130_dai, ARRAY_SIZE(cs43130_dai)); if (ret < 0) { - dev_err(&client->dev, + dev_err(cs43130->dev, "snd_soc_register_component failed with ret = %d\n", ret); goto err; } @@ -2636,15 +2633,15 @@ static void cs43130_i2c_remove(struct i2c_client *client) cancel_work_sync(&cs43130->work); flush_workqueue(cs43130->wq); - device_remove_file(&client->dev, &dev_attr_hpload_dc_l); - device_remove_file(&client->dev, &dev_attr_hpload_dc_r); - device_remove_file(&client->dev, &dev_attr_hpload_ac_l); - device_remove_file(&client->dev, &dev_attr_hpload_ac_r); + device_remove_file(cs43130->dev, &dev_attr_hpload_dc_l); + device_remove_file(cs43130->dev, &dev_attr_hpload_dc_r); + device_remove_file(cs43130->dev, &dev_attr_hpload_ac_l); + device_remove_file(cs43130->dev, &dev_attr_hpload_ac_r); } gpiod_set_value_cansleep(cs43130->reset_gpio, 0); - pm_runtime_disable(&client->dev); + pm_runtime_disable(cs43130->dev); regulator_bulk_disable(CS43130_NUM_SUPPLIES, cs43130->supplies); } diff --git a/sound/soc/codecs/cs43130.h b/sound/soc/codecs/cs43130.h index c7b2708aebcd..d3f595bbd3ba 100644 --- a/sound/soc/codecs/cs43130.h +++ b/sound/soc/codecs/cs43130.h @@ -501,6 +501,7 @@ struct cs43130_dai { }; struct cs43130_private { + struct device *dev; struct snd_soc_component *component; struct regmap *regmap; struct regulator_bulk_data supplies[CS43130_NUM_SUPPLIES]; From patchwork Fri Nov 17 14:13:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Strozek X-Patchwork-Id: 166198 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp557039vqn; Fri, 17 Nov 2023 06:15:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IFAcjDPh7/jBpX2AzdX8T4nFP2T8vIlSklOHtyDRhuMyZJT53z3MLyEjqu4VfPUH/3U/Tcc X-Received: by 2002:a9d:6e02:0:b0:6d6:4c54:730c with SMTP id e2-20020a9d6e02000000b006d64c54730cmr12873301otr.24.1700230501250; Fri, 17 Nov 2023 06:15:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700230501; cv=none; d=google.com; s=arc-20160816; b=n7asX4KcjdlfTPaXGRTBKLQKpF8unkBzy020zIWpgWGmI9af5LS8+2MCg1+tN5K0l6 TK2eRh6mnzi3E03GI79BPWLhfr+gVv2LFZ8estVjmounKpRcSR0AfbWi2uMRawwRuSS5 hj4aH4M4SwyUQekBAMlPdRqLD6pF0I126L/OBSId2Zf5zbyfpznuHcdspaloAUBn9d4u eZvz7d1sUneIkTk9CnuMFtlQLXd8qaS5zBFebHcqsgD3ecp7SiPpGCcjw3juheDvl6HX gUMFUuqDhV7e3Cs7/ZkPFBsih3TfwK8+pxGqkU/IP+yIgP5i+HaxCOgZYyLATDqfHXPP eH+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4HaIFMTOjpP+Ms2WViMv3zP8mKWXp14xrqThpoI5Tmk=; fh=KySyJaCx6e9HlRw2D2oLQPSdTHBwZsIBeFoG7LcS+QY=; b=L8oufnlgt2nc/3Vwy5lCdcRff+gfJeKmycHE4Ev2i5kb+dbP3O9qJRf0DdFL4ljMJk kJQGXZjaC/MmhIUoRHhBxLJ7LWw2n/cs1w8pD2M/F8bnjV0BvXKrI6UnHOszpvLNs22z 1SqwAcTHam9IR2qP4NhLjCTqApm5r8kAitkcKBSGgCDLzokUHTVbpCgohTKRN+N0zikn kDzoyyyKbuph/TEYfr1nBpkDaeTXR9EKVMSQcjWxNau48+tZ1+bpn1mvM1nf71OBjchl xl7u3IIxthXx4aI82xAA9AlefdSb3cMYbt2Bl9FOfGYL9qqsO2Qq9kFiRTSlKmpCS+A6 fyoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=FebCxSaQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id w19-20020a9d6393000000b006d6569c41d2si604266otk.97.2023.11.17.06.15.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 06:15:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=FebCxSaQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id E424A81F4735; Fri, 17 Nov 2023 06:14:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346067AbjKQOOV (ORCPT + 30 others); Fri, 17 Nov 2023 09:14:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232335AbjKQOOI (ORCPT ); Fri, 17 Nov 2023 09:14:08 -0500 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A59A5C5; Fri, 17 Nov 2023 06:14:04 -0800 (PST) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AH8IefL017599; Fri, 17 Nov 2023 08:13:51 -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=4HaIFMTOjpP+Ms2WViMv3zP8mKWXp14xrqThpoI5Tmk=; b= FebCxSaQtqPSDYbKMC77pRdLXoRez4P7O1oVYAGS7pT5SjmZUA8KdUtrU6gX83+I 2Sj71ZYCZhm5LKl/lMbU1AhiAI25JhGSElRrEa27y9BzN1DEvg84I1eYterw3Fff LSOL0MCGn7xkT+P2ivcS76BZU2lhj3YmvLXN76BnCue/8GftIHoXkLQMnOrVs7/E xB50SCwn4KfgWy+768+WUGh58Krv3yB/GAL4ywhPFrIj5M2gb/XM1YIMpXxkYmdz c/MUTCsWwPWSSTyk5u5JYEPMvvdEzg2p4vLzq4g2G6dgUI122SyFKwplKjO+BQ31 ybzgiSOa6ERXIkEF7VhwRw== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3ua7w2qj86-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Nov 2023 08:13:51 -0600 (CST) 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_256_GCM_SHA384) id 15.2.1118.39; Fri, 17 Nov 2023 14:13:47 +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.2.1118.39 via Frontend Transport; Fri, 17 Nov 2023 14:13:47 +0000 Received: from upx-tgl-008-ubuntu.ad.cirrus.com (upx-tgl-008-ubuntu.ad.cirrus.com [198.90.251.167]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 0C35F15A0; Fri, 17 Nov 2023 14:13:47 +0000 (UTC) From: Maciej Strozek To: Mark Brown CC: James Schulman , David Rhodes , Liam Girdwood , , , , , Maciej Strozek Subject: [PATCH 5/7] ASoC: cs43130: Add handling of ACPI Date: Fri, 17 Nov 2023 14:13:42 +0000 Message-ID: <20231117141344.64320-6-mstrozek@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> References: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: nuMHCH6S8fiWExjsj0QBkDLoHuYHp88z X-Proofpoint-GUID: nuMHCH6S8fiWExjsj0QBkDLoHuYHp88z X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 06:14:47 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782820897926128734 X-GMAIL-MSGID: 1782820897926128734 Signed-off-by: Maciej Strozek --- sound/soc/codecs/cs43130.c | 44 ++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c index 447abbaa6f47..fd39328579fb 100644 --- a/sound/soc/codecs/cs43130.c +++ b/sound/soc/codecs/cs43130.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include @@ -2400,14 +2400,12 @@ static const u16 cs43130_dc_threshold[CS43130_DC_THRESHOLD] = { 120, }; -static int cs43130_handle_device_data(struct i2c_client *i2c_client, - struct cs43130_private *cs43130) +static int cs43130_handle_device_data(struct cs43130_private *cs43130) { - struct device_node *np = i2c_client->dev.of_node; unsigned int val; int i; - if (of_property_read_u32(np, "cirrus,xtal-ibias", &val) < 0) { + if (device_property_read_u32(cs43130->dev, "cirrus,xtal-ibias", &val) < 0) { /* Crystal is unused. System clock is used for external MCLK */ cs43130->xtal_ibias = CS43130_XTAL_UNUSED; return 0; @@ -2429,18 +2427,18 @@ static int cs43130_handle_device_data(struct i2c_client *i2c_client, return -EINVAL; } - cs43130->dc_meas = of_property_read_bool(np, "cirrus,dc-measure"); - cs43130->ac_meas = of_property_read_bool(np, "cirrus,ac-measure"); + cs43130->dc_meas = device_property_read_bool(cs43130->dev, "cirrus,dc-measure"); + cs43130->ac_meas = device_property_read_bool(cs43130->dev, "cirrus,ac-measure"); - if (of_property_read_u16_array(np, "cirrus,ac-freq", cs43130->ac_freq, - CS43130_AC_FREQ) < 0) { + if (!device_property_read_u16_array(cs43130->dev, "cirrus,ac-freq", cs43130->ac_freq, + CS43130_AC_FREQ)) { for (i = 0; i < CS43130_AC_FREQ; i++) cs43130->ac_freq[i] = cs43130_ac_freq[i]; } - if (of_property_read_u16_array(np, "cirrus,dc-threshold", + if (!device_property_read_u16_array(cs43130->dev, "cirrus,dc-threshold", cs43130->dc_threshold, - CS43130_DC_THRESHOLD) < 0) { + CS43130_DC_THRESHOLD)) { for (i = 0; i < CS43130_DC_THRESHOLD; i++) cs43130->dc_threshold[i] = cs43130_dc_threshold[i]; } @@ -2469,11 +2467,12 @@ static int cs43130_i2c_probe(struct i2c_client *client) return ret; } - if (cs43130->dev->of_node) { - ret = cs43130_handle_device_data(client, cs43130); + if (dev_fwnode(cs43130->dev)) { + ret = cs43130_handle_device_data(cs43130); if (ret != 0) return ret; } + for (i = 0; i < ARRAY_SIZE(cs43130->supplies); i++) cs43130->supplies[i].supply = cs43130_supply_names[i]; @@ -2704,6 +2703,7 @@ static const struct dev_pm_ops cs43130_runtime_pm = { NULL) }; +#if IS_ENABLED(CONFIG_OF) static const struct of_device_id cs43130_of_match[] = { {.compatible = "cirrus,cs43130",}, {.compatible = "cirrus,cs4399",}, @@ -2713,6 +2713,17 @@ static const struct of_device_id cs43130_of_match[] = { }; MODULE_DEVICE_TABLE(of, cs43130_of_match); +#endif + +#if IS_ENABLED(CONFIG_ACPI) +static const struct acpi_device_id cs43130_acpi_match[] = { + { "CSC4399", 0 }, + {} +}; + +MODULE_DEVICE_TABLE(acpi, cs43130_acpi_match); +#endif + static const struct i2c_device_id cs43130_i2c_id[] = { {"cs43130", 0}, @@ -2726,9 +2737,10 @@ MODULE_DEVICE_TABLE(i2c, cs43130_i2c_id); static struct i2c_driver cs43130_i2c_driver = { .driver = { - .name = "cs43130", - .of_match_table = cs43130_of_match, - .pm = &cs43130_runtime_pm, + .name = "cs43130", + .of_match_table = of_match_ptr(cs43130_of_match), + .acpi_match_table = ACPI_PTR(cs43130_acpi_match), + .pm = &cs43130_runtime_pm, }, .id_table = cs43130_i2c_id, .probe = cs43130_i2c_probe, From patchwork Fri Nov 17 14:13:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Strozek X-Patchwork-Id: 166193 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp556697vqn; Fri, 17 Nov 2023 06:14:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4EuHZ85bd2H/q8979AJ3fF+OVvql9wxolSHFu+mpgCFYGBPYcAl5vpEKFLli5aO6dta5h X-Received: by 2002:aa7:8c19:0:b0:68e:351b:15b8 with SMTP id c25-20020aa78c19000000b0068e351b15b8mr14548226pfd.12.1700230474207; Fri, 17 Nov 2023 06:14:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700230474; cv=none; d=google.com; s=arc-20160816; b=UFxYURgz9ulEALVGO2TA4rAEl2vBCjOsvPcV/jRzrKZ+EGMRAYxBCS451fXuFjkvb1 qIzV1hOeSVvqdu3Tw8UfLlkaMFGWAdBj7y7uCjrSlbhKIXZuT320cMtMs+rj/TMf4zoC 6YCcWqT40aB7quvmK8WFc3ZQ7Hyggp80cmZsUT256bhwL785Cp67qktoZIRc8zbPQR3M 0xqpu8+Me8CErwSQiCEBJ1XhMAHEsde242ufRxL8fr1l1LTutlwwVS3zsv4eCDeLpbOW wVN4h8qQ+L2Wc2Ea5y3rxFdxsC6TnYpBeOogi1YnNnHkx11BNvQpOyqqCVO/bB1Kww17 7UgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W64wMY4JDd5Fw2BbTWagHGzZxuKk6vjKkgnSKun7nH8=; fh=KySyJaCx6e9HlRw2D2oLQPSdTHBwZsIBeFoG7LcS+QY=; b=R66v9eOwMM9Ev2Tlpsf2nu77zgOu4EykMZUqXhCSZcm5DxRrKcbJFFsR38RdNkV+sU 9J0XREFELprKaIgC4/LqSKtl9I6sHmKRHBiJASuU+OT5M4Ps/4d3u/h61gK/0b3XRQF2 TAMXjQx4zjJtXBLl9cwlEf3A/85xk4aSp0daKujOMhLQOMIMiiR1c12pz4hwq70f3BBb 12b1+TjA/z8P0yOnRnkClr41eC386RPmBvmORBDnV6RYXPWrqsJskhLEi0eDV4Ril/fu O7CMiWAW1DETdncT7/NC8IZK2lObUjZ+urgibi3vQfFXaFUR72tl2UgY3J5KUuJJZGbH iz9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=HooMQkxf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id w20-20020a056a0014d400b006b6efb7f99fsi2051277pfu.280.2023.11.17.06.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 06:14:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=HooMQkxf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CB608819146D; Fri, 17 Nov 2023 06:14:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232432AbjKQOOY (ORCPT + 30 others); Fri, 17 Nov 2023 09:14:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345808AbjKQOOJ (ORCPT ); Fri, 17 Nov 2023 09:14:09 -0500 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF84E11F; Fri, 17 Nov 2023 06:14:05 -0800 (PST) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AH8IefM017599; Fri, 17 Nov 2023 08:13:52 -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=W64wMY4JDd5Fw2BbTWagHGzZxuKk6vjKkgnSKun7nH8=; b= HooMQkxfqgBGH/i9+TKH2FbeitgRg1YOnFm2Ju12aFDvrqSQMjdVptuQ6BOVDUU0 k9w60rLoUvKQ4rDuauyF+TjCwYdQK75ivBxu3OnCQEH1bAhgRg1NLBCfWqyXGwIw haWSLryR02/VVx7sJ9F4iYDXPnX5sBFT5eGSTZ8ngZeSTyfzeY213HKD6qQ9SVx2 66oS9bh0FGE4Ly83XYiq1Ao1YEoALLAPD70K6FtxGvzzocUYhL5aLTtF06hVrPtF NIDu1NazV+cPTqScAfT9HoV+puncLt9EPaE352cfH7NFKK3GIIfxxWugJhwKni5h QLW20BSCBJLXsqz9/hSyJA== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3ua7w2qj86-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Nov 2023 08:13:52 -0600 (CST) 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_256_GCM_SHA384) id 15.2.1118.39; Fri, 17 Nov 2023 14:13:47 +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.2.1118.39 via Frontend Transport; Fri, 17 Nov 2023 14:13:47 +0000 Received: from upx-tgl-008-ubuntu.ad.cirrus.com (upx-tgl-008-ubuntu.ad.cirrus.com [198.90.251.167]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 12ED83581; Fri, 17 Nov 2023 14:13:47 +0000 (UTC) From: Maciej Strozek To: Mark Brown CC: James Schulman , David Rhodes , Liam Girdwood , , , , , Maciej Strozek Subject: [PATCH 6/7] ASoC: cs43130: Allow driver to work without IRQ thread Date: Fri, 17 Nov 2023 14:13:43 +0000 Message-ID: <20231117141344.64320-7-mstrozek@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> References: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: g8xh5h9rQ8qavCW3ClbUb019i61gWdLC X-Proofpoint-GUID: g8xh5h9rQ8qavCW3ClbUb019i61gWdLC X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 17 Nov 2023 06:14:30 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782820869745609830 X-GMAIL-MSGID: 1782820869745609830 Signed-off-by: Maciej Strozek --- sound/soc/codecs/cs43130.c | 56 +++++++++++++++++++++++++++++++------- sound/soc/codecs/cs43130.h | 1 + 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c index fd39328579fb..1e7c32eedc7b 100644 --- a/sound/soc/codecs/cs43130.c +++ b/sound/soc/codecs/cs43130.c @@ -326,6 +326,43 @@ static int cs43130_set_pll(struct snd_soc_component *component, int pll_id, int return ret; } +static int cs43130_wait_for_completion(struct cs43130_private *cs43130, struct completion *to_poll, + int time) +{ + int stickies, offset, flag; + int ret = 0; + + if (cs43130->has_irq_line) { + ret = wait_for_completion_timeout(to_poll, msecs_to_jiffies(time)); + } else { + if (to_poll == &cs43130->xtal_rdy) { + offset = 0; + flag = CS43130_XTAL_RDY_INT; + } else if (to_poll == &cs43130->pll_rdy) { + offset = 0; + flag = CS43130_PLL_RDY_INT; + } else if (to_poll == &cs43130->hpload_evt) { + offset = 3; + flag = CS43130_HPLOAD_NO_DC_INT | CS43130_HPLOAD_UNPLUG_INT | + CS43130_HPLOAD_OOR_INT | CS43130_HPLOAD_AC_INT | + CS43130_HPLOAD_DC_INT | CS43130_HPLOAD_ON_INT | + CS43130_HPLOAD_OFF_INT; + } else { + return 0; + } + + ret = regmap_read_poll_timeout(cs43130->regmap, CS43130_INT_STATUS_1 + offset, + stickies, (stickies & flag), + 1000, time * 1000); + + /* + * Return 0 for an timeout/error to be consistent with wait_for_completion_timeout + */ + ret = !ret; + } + return ret; +} + static int cs43130_change_clksrc(struct snd_soc_component *component, enum cs43130_mclk_src_sel src) { @@ -364,8 +401,7 @@ static int cs43130_change_clksrc(struct snd_soc_component *component, CS43130_XTAL_RDY_INT_MASK, 0); regmap_update_bits(cs43130->regmap, CS43130_PWDN_CTL, CS43130_PDN_XTAL_MASK, 0); - ret = wait_for_completion_timeout(&cs43130->xtal_rdy, - msecs_to_jiffies(100)); + ret = cs43130_wait_for_completion(cs43130, &cs43130->xtal_rdy, 100); regmap_update_bits(cs43130->regmap, CS43130_INT_MASK_1, CS43130_XTAL_RDY_INT_MASK, 1 << CS43130_XTAL_RDY_INT_SHIFT); @@ -400,8 +436,7 @@ static int cs43130_change_clksrc(struct snd_soc_component *component, CS43130_XTAL_RDY_INT_MASK, 0); regmap_update_bits(cs43130->regmap, CS43130_PWDN_CTL, CS43130_PDN_XTAL_MASK, 0); - ret = wait_for_completion_timeout(&cs43130->xtal_rdy, - msecs_to_jiffies(100)); + ret = cs43130_wait_for_completion(cs43130, &cs43130->xtal_rdy, 100); regmap_update_bits(cs43130->regmap, CS43130_INT_MASK_1, CS43130_XTAL_RDY_INT_MASK, 1 << CS43130_XTAL_RDY_INT_SHIFT); @@ -416,8 +451,7 @@ static int cs43130_change_clksrc(struct snd_soc_component *component, CS43130_PLL_RDY_INT_MASK, 0); regmap_update_bits(cs43130->regmap, CS43130_PWDN_CTL, CS43130_PDN_PLL_MASK, 0); - ret = wait_for_completion_timeout(&cs43130->pll_rdy, - msecs_to_jiffies(100)); + ret = cs43130_wait_for_completion(cs43130, &cs43130->pll_rdy, 100); regmap_update_bits(cs43130->regmap, CS43130_INT_MASK_1, CS43130_PLL_RDY_INT_MASK, 1 << CS43130_PLL_RDY_INT_SHIFT); @@ -2040,8 +2074,8 @@ static int cs43130_hpload_proc(struct cs43130_private *cs43130, regmap_multi_reg_write(cs43130->regmap, seq, seq_size); - ret = wait_for_completion_timeout(&cs43130->hpload_evt, - msecs_to_jiffies(1000)); + ret = cs43130_wait_for_completion(cs43130, &cs43130->hpload_evt, 1000); + regmap_read(cs43130->regmap, CS43130_INT_MASK_4, &msk); if (!ret) { dev_err(cs43130->dev, "Timeout waiting for HPLOAD interrupt\n"); @@ -2545,8 +2579,10 @@ static int cs43130_i2c_probe(struct i2c_client *client) IRQF_ONESHOT | IRQF_TRIGGER_LOW, "cs43130", cs43130); if (ret != 0) { - dev_err(cs43130->dev, "Failed to request IRQ: %d\n", ret); - goto err; + dev_dbg(cs43130->dev, "Failed to request IRQ: %d, will poll instead\n", ret); + cs43130->has_irq_line = 0; + } else { + cs43130->has_irq_line = 1; } cs43130->mclk_int_src = CS43130_MCLK_SRC_RCO; diff --git a/sound/soc/codecs/cs43130.h b/sound/soc/codecs/cs43130.h index d3f595bbd3ba..dbdb5b262f1b 100644 --- a/sound/soc/codecs/cs43130.h +++ b/sound/soc/codecs/cs43130.h @@ -508,6 +508,7 @@ struct cs43130_private { struct gpio_desc *reset_gpio; unsigned int dev_id; /* codec device ID */ int xtal_ibias; + bool has_irq_line; /* shared by both DAIs */ struct mutex clk_mutex; From patchwork Fri Nov 17 14:13:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Strozek X-Patchwork-Id: 166196 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp556832vqn; Fri, 17 Nov 2023 06:14:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcIc7JA5CRWsCma2OE/K+9NbGZM3pwFWeJJ8ADQsx4qRNdXI6x8ushVR4QIifO+khDcZYe X-Received: by 2002:a05:6808:138b:b0:3ad:e147:4b83 with SMTP id c11-20020a056808138b00b003ade1474b83mr2776718oiw.12.1700230484521; Fri, 17 Nov 2023 06:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700230484; cv=none; d=google.com; s=arc-20160816; b=BhrroabcuZ1OgQxZQUssoR81xuawuzz2WVmdW3b0IoE0vGq3nP1F4q4WPnB+R7dMhE VwrKxWtVthl4OmqOZ6ZGns75y7aFKqCM8oJN7q6Nw0O+hl++jaNbm6q3IxNO0Vlik+Yt zW7IJb3kFExWgRpVaoc9NJtKpf/+6HnxVJpJmRXQ1gCytiaJe2boGdONSJgXEF8LPfWk IKtIVJvNZsljYHuv4U35m5Kf8zoXCLwqndVI+254YekHyaBIrJUsk0g1ztR9P2JzhYvZ giBc8GVHWCFrkp5bmxgGJuaPi0p0VM38SxdAr0zgLgQ0cydxfT6zWrjquhSeIjvfn6jm Wigg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M6W+QVktOBh17HSN1EqFh0hC5Sn5ODIVhO8qEILw3CI=; fh=KySyJaCx6e9HlRw2D2oLQPSdTHBwZsIBeFoG7LcS+QY=; b=qpyumGoo2UICvzr6jATwIpBGWh3Wy5wXnrGHPCGEoX8TaUM4whuyNhWL12Y2moJAx7 cP91tfYd8vL5wuUVqnw55kL30c5LRHpYCe1CQ29o8ap3JFVuCmRdvMbDlkGGXYSn9u7A 438FByL8yslR5Fpb6p74igad6ENXN59IBM1eUZcBhFW6sDvSBAb3EZ5hLUafsSICsX1+ repkrwtUTdFgAdEO+qxLgFsS0rVhmoLEIEVt3bY2OnePgkhPNHc3pyjkQ0LLJzWajg/V EiOylEyG1K+MZJLGe//kQ8iLwDLATcBUYLOnlx7u5K9NNLx/B6M4GWRaiKhMA0NTmOD/ aeBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=Q+vz0Z0s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z11-20020a9d65cb000000b006ce2ec2a675si609574oth.38.2023.11.17.06.14.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 06:14:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=Q+vz0Z0s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1BBDC819A692; Fri, 17 Nov 2023 06:14:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346044AbjKQOO2 (ORCPT + 30 others); Fri, 17 Nov 2023 09:14:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345949AbjKQOOK (ORCPT ); Fri, 17 Nov 2023 09:14:10 -0500 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1632D4B; Fri, 17 Nov 2023 06:14:06 -0800 (PST) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AH8IefO017599; Fri, 17 Nov 2023 08:13:54 -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=M6W+QVktOBh17HSN1EqFh0hC5Sn5ODIVhO8qEILw3CI=; b= Q+vz0Z0sPPk3Oq84zc6ryjNjyQ9+dNZ20e35fOfvatApQXucmpa4hFn59rDoMdwa sUru9OKW/aAMa5iNlfUGfSZzbu0CaFfi2q2jgcYjoWSW1zq0SwSTZt74kgEXLYmO fWY6KpzUkViYRzXKmt4Cm/LbXuLPA/iDqUATGzQTO/DVDu2UndM4dK8CXXGNl1ai ZDnXMyOGpHQMsi1+mF/mK+6eswRIBIS7crFOJ8IIta2q65gFY9zkRGTttqfxbMhr 1yD1UsLLfXg1t4JRDUsoABOllzA+t7LdFsctoD3DZIwQdDRB8iaHiFv1Y+b+rPbK W7WsgVdQAbFnVN1n4/BH0Q== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3ua7w2qj86-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Nov 2023 08:13:54 -0600 (CST) Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 17 Nov 2023 14:13:47 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.39 via Frontend Transport; Fri, 17 Nov 2023 14:13:47 +0000 Received: from upx-tgl-008-ubuntu.ad.cirrus.com (upx-tgl-008-ubuntu.ad.cirrus.com [198.90.251.167]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 21C3E15B9; Fri, 17 Nov 2023 14:13:47 +0000 (UTC) From: Maciej Strozek To: Mark Brown CC: James Schulman , David Rhodes , Liam Girdwood , , , , , Maciej Strozek Subject: [PATCH 7/7] ASoC:cs43130: Add switch to control normal and alt hp inputs Date: Fri, 17 Nov 2023 14:13:44 +0000 Message-ID: <20231117141344.64320-8-mstrozek@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> References: <20231117141344.64320-1-mstrozek@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: HHy7PmnneZgXiJqVC4NCra9DsHWE9Gp0 X-Proofpoint-GUID: HHy7PmnneZgXiJqVC4NCra9DsHWE9Gp0 X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 17 Nov 2023 06:14:33 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782820880812198779 X-GMAIL-MSGID: 1782820880812198779 Make sure these inputs are mutually exclusive as recommended by the datasheet Signed-off-by: Maciej Strozek --- sound/soc/codecs/cs43130.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c index 1e7c32eedc7b..8b77bd7fa907 100644 --- a/sound/soc/codecs/cs43130.c +++ b/sound/soc/codecs/cs43130.c @@ -1419,7 +1419,15 @@ static int cs43130_hpin_event(struct snd_soc_dapm_widget *w, return 0; } +static const char * const bypass_mux_text[] = { + "Internal", + "Alternative", +}; +static SOC_ENUM_SINGLE_DECL(bypass_enum, SND_SOC_NOPM, 0, bypass_mux_text); +static const struct snd_kcontrol_new bypass_ctrl = SOC_DAPM_ENUM("Switch", bypass_enum); + static const struct snd_soc_dapm_widget digital_hp_widgets[] = { + SND_SOC_DAPM_MUX("Bypass Switch", SND_SOC_NOPM, 0, 0, &bypass_ctrl), SND_SOC_DAPM_OUTPUT("HPOUTA"), SND_SOC_DAPM_OUTPUT("HPOUTB"), @@ -1472,13 +1480,13 @@ static const struct snd_soc_dapm_route digital_hp_routes[] = { {"DSD", NULL, "XSPIN DSD"}, {"HiFi DAC", NULL, "ASPIN PCM"}, {"HiFi DAC", NULL, "DSD"}, - {"HPOUTA", NULL, "HiFi DAC"}, - {"HPOUTB", NULL, "HiFi DAC"}, + {"Bypass Switch", "Internal", "HiFi DAC"}, + {"HPOUTA", NULL, "Bypass Switch"}, + {"HPOUTB", NULL, "Bypass Switch"}, }; static const struct snd_soc_dapm_route analog_hp_routes[] = { - {"HPOUTA", NULL, "Analog Playback"}, - {"HPOUTB", NULL, "Analog Playback"}, + {"Bypass Switch", "Alternative", "Analog Playback"}, }; static struct snd_soc_dapm_route all_hp_routes[