Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp702891imw; Fri, 8 Jul 2022 10:08:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1scyHQKaFShA1VEQliwxTIhQB6Hl7qYc4i95TPxdpMA10gSX9EHXOywjw+pkFA98NA1+lvP X-Received: by 2002:a17:90b:390d:b0:1ed:3058:45e5 with SMTP id ob13-20020a17090b390d00b001ed305845e5mr856631pjb.141.1657300097503; Fri, 08 Jul 2022 10:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657300097; cv=none; d=google.com; s=arc-20160816; b=RR+PozH2CQ5RdzCxMYhbUNLx3R7+ULeuaqW8B+cBEe0pj4KJAi+g798QD3W6gsEtbf G4+d03vSDf7SxUOPDCIMbmWoJNN8t0KE1xBYjWkuNCey/KUXTECtIfmbiK7cK6xcbclt jOwWq/qfpnGt/Y8X/LeJdiaNxcZPYl+MyBUbRyhI7lmKmK/bgSoDyn3wh7g8n4P82qAP xrRqpqhLCtWL8CdVaP9kaxQnY/DZXAFIr+w8exW23R1C+aGdDtxtIGY7y141OR6PsuuR ymZw17paiqf+pNNp4t2lz6YFnB7EcB6Gq503yQedUCZWfX0WVt43sPRwcDwOTssr5RMz CBlA== 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=HY2aQJ3seKosRomDmgMnHWVFcuzDBXXIFx3XPBOLqNA=; b=PlQ/ImlS6vaQbONbq650V3oIF0XxoxvM3eof8xX+9SZ+Ga1Tum0rL6lcbSu2m+03Vg 24H498cXWiIkHhC4Mz3KNkuJbrFqU07QCZeJmWHQmhgSu/CnDUc+IY0Acr1OV3Pm+gfW LWvDX6AIdboCR2Lm2BnR36D+6gjtHBl3lh4WTh/7KS3OwPWcOvSLjzhuA/Pw46HcAuSD EJIyrU2lWNqDiopVMNsIn50Rq5RiDOHBak5f5MU6ej+S0WOU32lEMflgC0Cig89vWPyh Rj2lPr4m4urzUavW2QOneOTr+CEwBOHWJxi6fLltduXNnVVnQGOQt6QbIFEXe5yKTHNd Fj3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ePkWqh97; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s6-20020a17090302c600b0016a3564918fsi27705590plk.369.2022.07.08.10.07.41; Fri, 08 Jul 2022 10:08:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ePkWqh97; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239055AbiGHQCr (ORCPT + 99 others); Fri, 8 Jul 2022 12:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239007AbiGHQCY (ORCPT ); Fri, 8 Jul 2022 12:02:24 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C7047478B; Fri, 8 Jul 2022 09:02:23 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id r14so25374177wrg.1; Fri, 08 Jul 2022 09:02:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HY2aQJ3seKosRomDmgMnHWVFcuzDBXXIFx3XPBOLqNA=; b=ePkWqh97Odk53ihOmkyCeBaBZDdkyf77ORSv02MRLn4rHr0kFiPcDG8gMrwdbHPppk 7xcOHgMxJ7Yoko7rmhreGqvi9Sl+WWqAEcW+G/rLYYpa336Aveb3AJyQTVWeXs6xYpbZ YUlVGgSjCgzvizcU8eimplzQNh78DHbbUQ1rt9+bWtiG0jpMPJE04kEHFkePV/qOLJXa sfW1KMMQEwELaib2WFZu7rg4mp1bf7YeLUAEg010YsIXRy6bKNUfGTVYAAXY/bm6+qsF XVb+NDB3jIAzLIwy6z7ZBLR16kwI4NxumyGsXbePjfdr9z8NwTEg7GNLvJns6EqmgHOr 6XrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HY2aQJ3seKosRomDmgMnHWVFcuzDBXXIFx3XPBOLqNA=; b=bqHjY4IUbCxZfZr643gLPSf+/WPyIHVUrw5vvh1CuC2FyZAeqnt7rYqb5KnXot/wh5 hR5nfUHI2yVjoX+ceHcxTlG/LiRvsNe16p/bRLQHPNR6JXc9BwbnLJLVqHnRgnhTYE3M eaNtWIRmOTKTuCJ3NVUXqw8kB8uI2bLYlmRTDtxEcJ/bI+4UjA7a//O4CngdVY4gQCYP dTbNjjbIM4rQQ/lajj5LuwRmWV8rSZFsBaA6qpdApREZWoshQfVmulakhHiOUlrKspNk uuyiloPi2HfwMf57OHxszaOAeSD2kwhDVHesung3fhrrU4zQcJrEEBJMTT2iALtNHedO Ry9w== X-Gm-Message-State: AJIora/f1eD2x54AznIoqgoQxLicRX7uAMvnyzQQsIbuojf73695ANxU 2C/i9atB0sFUe2dLBeQB0z0= X-Received: by 2002:a05:6000:1887:b0:21d:33c1:efd6 with SMTP id a7-20020a056000188700b0021d33c1efd6mr4014091wri.134.1657296142965; Fri, 08 Jul 2022 09:02:22 -0700 (PDT) Received: from localhost (92.40.203.144.threembb.co.uk. [92.40.203.144]) by smtp.gmail.com with ESMTPSA id z4-20020a5d44c4000000b0021d9207e6f1sm1331973wrr.34.2022.07.08.09.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 09:02:22 -0700 (PDT) From: Aidan MacDonald To: paul@crapouillou.net, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Cc: linux-mips@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 10/11] ASoC: jz4740-i2s: Move component functions near the component driver Date: Fri, 8 Jul 2022 17:02:43 +0100 Message-Id: <20220708160244.21933-11-aidanmacdonald.0x0@gmail.com> In-Reply-To: <20220708160244.21933-1-aidanmacdonald.0x0@gmail.com> References: <20220708160244.21933-1-aidanmacdonald.0x0@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Move the component suspend/resume functions near the definition of the component driver to emphasize that they're unrelated to the DAI functions. Signed-off-by: Aidan MacDonald --- sound/soc/jz4740/jz4740-i2s.c | 72 +++++++++++++++++------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c index 70b9d28a40ce..5db73f12efcf 100644 --- a/sound/soc/jz4740/jz4740-i2s.c +++ b/sound/soc/jz4740/jz4740-i2s.c @@ -303,42 +303,6 @@ static int jz4740_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, return ret; } -static int jz4740_i2s_suspend(struct snd_soc_component *component) -{ - struct jz4740_i2s *i2s = snd_soc_component_get_drvdata(component); - - if (snd_soc_component_active(component)) { - regmap_clear_bits(i2s->regmap, JZ_REG_AIC_CONF, JZ_AIC_CONF_ENABLE); - clk_disable_unprepare(i2s->clk_i2s); - } - - clk_disable_unprepare(i2s->clk_aic); - - return 0; -} - -static int jz4740_i2s_resume(struct snd_soc_component *component) -{ - struct jz4740_i2s *i2s = snd_soc_component_get_drvdata(component); - int ret; - - ret = clk_prepare_enable(i2s->clk_aic); - if (ret) - return ret; - - if (snd_soc_component_active(component)) { - ret = clk_prepare_enable(i2s->clk_i2s); - if (ret) { - clk_disable_unprepare(i2s->clk_aic); - return ret; - } - - regmap_set_bits(i2s->regmap, JZ_REG_AIC_CONF, JZ_AIC_CONF_ENABLE); - } - - return 0; -} - static int jz4740_i2s_dai_probe(struct snd_soc_dai *dai) { struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); @@ -459,6 +423,42 @@ static const struct i2s_soc_info jz4780_i2s_soc_info = { .pll_clk_name = "pll half", }; +static int jz4740_i2s_suspend(struct snd_soc_component *component) +{ + struct jz4740_i2s *i2s = snd_soc_component_get_drvdata(component); + + if (snd_soc_component_active(component)) { + regmap_clear_bits(i2s->regmap, JZ_REG_AIC_CONF, JZ_AIC_CONF_ENABLE); + clk_disable_unprepare(i2s->clk_i2s); + } + + clk_disable_unprepare(i2s->clk_aic); + + return 0; +} + +static int jz4740_i2s_resume(struct snd_soc_component *component) +{ + struct jz4740_i2s *i2s = snd_soc_component_get_drvdata(component); + int ret; + + ret = clk_prepare_enable(i2s->clk_aic); + if (ret) + return ret; + + if (snd_soc_component_active(component)) { + ret = clk_prepare_enable(i2s->clk_i2s); + if (ret) { + clk_disable_unprepare(i2s->clk_aic); + return ret; + } + + regmap_set_bits(i2s->regmap, JZ_REG_AIC_CONF, JZ_AIC_CONF_ENABLE); + } + + return 0; +} + static const struct snd_soc_component_driver jz4740_i2s_component = { .name = "jz4740-i2s", .suspend = jz4740_i2s_suspend, -- 2.35.1