Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5705670rwl; Thu, 29 Dec 2022 01:21:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXvIq9LwDluwXd1KXGh5aggktUP3HCL+5WSPG2hMD4L4OLHoQky//yHOz4DSJmwGjb2H/NLU X-Received: by 2002:a17:906:1d4a:b0:81a:c653:4a06 with SMTP id o10-20020a1709061d4a00b0081ac6534a06mr27768322ejh.66.1672305685051; Thu, 29 Dec 2022 01:21:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672305685; cv=none; d=google.com; s=arc-20160816; b=oAQ/qnVapatNSTzRmkh1j3JSl8vvc/GbruBfWS3RlULv/eu13JWsaf24G4S3SuVYHO IXDhZyLadjtOql/S9xsc3f9ztTP1m8HJWDXnX5E1PB7jSXa7ZwyIEfRcvQjdRuR8VF5k 8s3jzes3q5vsp87D7YqcHqFJITWgvxE3zykR51QAj5HQV+1CtCPZUhAI9GSCVuM84EuW HRw5ER8NTOBCBFpUBfzVRnaKkPidVBCtRXelcmsFg36Ly/geAPVomjsFetPs1HT3wZQs soWdUi2bozykXjmM6D8yZr+ldJsX7dKrQP2cFHwrnkidMrsPD6i0X092g2e/Od4fkYNu yzTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=8KIiQNFKqzc7opQJ8ok0FfP39sLd9x5gpUsGJ8JTvp0=; b=ggf8R5TcAqBDWMZyWp4AvXKI68+FPkL65TqDrZTwpKdlvYNOmOKhw3ZBHY+eEb1AEo zXVy024GkuGk2hQXNkq/alsX+DOoj/27Y9jzCzPwFrTJQcsL8DAIPA8BD5Mmk8V9MO1k dNimrpgwW2+0onk+omAsoGdgkvxmgnXlZHMT/oF25OHd5NIEuRO874rmXJfv1cOad5XS HBRBjHjjbD2aPiPRs80TFkMSQnAtnMFqMJ2GqGB0XywUoSxvDziyPYuYSjhVjZaXcd3E zomBzUSQgaG6GbjVwP0MaPxNi/JuDVdc8bkg2rA+xPjW6BIvKEKJfJIgUu0iAoKp8+tx Pr0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="fxENY/Wx"; 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 j27-20020a170906279b00b007a8beb3aa4csi11951997ejc.872.2022.12.29.01.21.08; Thu, 29 Dec 2022 01:21:25 -0800 (PST) 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="fxENY/Wx"; 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 S233089AbiL2IED (ORCPT + 62 others); Thu, 29 Dec 2022 03:04:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbiL2IEB (ORCPT ); Thu, 29 Dec 2022 03:04:01 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ADA1D2DA for ; Thu, 29 Dec 2022 00:04:01 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id fy4so18543137pjb.0 for ; Thu, 29 Dec 2022 00:04:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8KIiQNFKqzc7opQJ8ok0FfP39sLd9x5gpUsGJ8JTvp0=; b=fxENY/WxTKg7eKS46UKKzjcaEgaZMSAIt+Ys0flXSHONKVVDibA7JqN54SUBJLdBQW V5RCs11JLQz/M4GNr81/8s4fRvLBIgQeIpHfXHNMUgRAcRp4Kj8Nwg5n32JP41kTCk+p unFP7fkQA797WjqhRok4wwHbqejpy7xzm/4f0MjXR3S8jHGaM1CFnEbnckhDr4ULyBb7 pN4RzdniMZXFgDM3+XED28/fKuvdn7Vg2gHlygbmglLe4Ro9h822/ACLAKlHH+tX8vTX lg+83a9cQpOE/nc+t3tcbnhTQ/S8ZOJ+5XMqVZ4XPR1+Gw0+6gxmVrNMxrTRhgPb6a2k CuFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8KIiQNFKqzc7opQJ8ok0FfP39sLd9x5gpUsGJ8JTvp0=; b=qQEXViiiporgelJ9CfUkuICvlpFxdV43Fe0C3zFcj+wKI2bJYp3NHl8LBwjuWsy0RI DU5T84nog3YEJ7FeZX5mDi0yiOGutYM8Z187MG6RYlqp4WrD8uJT5F5qP+Gqa0yBC+8H jpabifSzOPgO13QJy92e6pBCpDOPMdJ0ADCCrZmcHY2QOK99pIJjW08eisG8GLjWOCFs 2YdN84q80+gf9CDW+DXma4ch1Cg7619KE7E4h1vKr53w8k6INiCeB/XJ1/E5HpUj+BcB IruUinTsiwqhsrZKsxvQnZf01Js6Z45gvlKgOAhsyznRlZXC+wvgDc2yZ/uKW+Q7IJLP NrCg== X-Gm-Message-State: AFqh2kpaOE+uM2o8yErF1bDagdK7MZyb+whg7NRy3KXJYF1gAxkan9Au 5cNdUisfDmhgbzFDs74USno= X-Received: by 2002:a17:902:edc3:b0:189:5ef4:6ae9 with SMTP id q3-20020a170902edc300b001895ef46ae9mr26746572plk.45.1672301040510; Thu, 29 Dec 2022 00:04:00 -0800 (PST) Received: from localhost.localdomain ([2402:7500:587:a2f0:9dda:bb2d:720c:85e8]) by smtp.gmail.com with ESMTPSA id e9-20020a170902784900b001895b2c4cf6sm12146987pln.297.2022.12.29.00.03.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Dec 2022 00:04:00 -0800 (PST) From: cy_huang To: lgirdwood@gmail.com, broonie@kernel.org Cc: cy_huang@richtek.com, jeff_chang@richtek.com, oder_chiou@realtek.com, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: rt9120: Make dev PM runtime bind AsoC component PM Date: Thu, 29 Dec 2022 16:03:53 +0800 Message-Id: <1672301033-3675-1-git-send-email-u0084500@gmail.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-1.8 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 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 From: ChiYuan Huang RT9120 uses PM runtime autosuspend to decrease the frequently on/off spent time. This exists one case, when pcm is closed and dev PM is waiting for autosuspend time expired to enter runtime suspend state. At the mean time, system is going to enter suspend, dev PM runtime suspend won't be called. It makes the rt9120 suspend consumption current not as expected. This patch can fix the rt9120 dev PM issue during runtime autosuspend and system suspend by binding dev PM runtime and ASoC component PM. Fixes: 80b949f332e3 ("ASoC: rt9120: Use pm_runtime and regcache to optimize 'pwdnn' logic") Signed-off-by: ChiYuan Huang --- sound/soc/codecs/rt9120.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/codecs/rt9120.c b/sound/soc/codecs/rt9120.c index 644300e..fcf4fba 100644 --- a/sound/soc/codecs/rt9120.c +++ b/sound/soc/codecs/rt9120.c @@ -177,8 +177,20 @@ static int rt9120_codec_probe(struct snd_soc_component *comp) return 0; } +static int rt9120_codec_suspend(struct snd_soc_component *comp) +{ + return pm_runtime_force_suspend(comp->dev); +} + +static int rt9120_codec_resume(struct snd_soc_component *comp) +{ + return pm_runtime_force_resume(comp->dev); +} + static const struct snd_soc_component_driver rt9120_component_driver = { .probe = rt9120_codec_probe, + .suspend = rt9120_codec_suspend, + .resume = rt9120_codec_resume, .controls = rt9120_snd_controls, .num_controls = ARRAY_SIZE(rt9120_snd_controls), .dapm_widgets = rt9120_dapm_widgets, -- 2.7.4