From patchwork Wed Jun 28 10:56:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11384 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8860245vqr; Wed, 28 Jun 2023 04:51:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ42ST58tMqvx5aEDIGAYtdnZ8NP2sM3D01u8wMaENgQgs/ix7bRddkgb4MreYGrBsMk0zPR X-Received: by 2002:a17:90a:c56:b0:260:ba1e:9590 with SMTP id u22-20020a17090a0c5600b00260ba1e9590mr1493410pje.3.1687953060866; Wed, 28 Jun 2023 04:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687953060; cv=none; d=google.com; s=arc-20160816; b=TkqtndkchgW7mQUJl6S0JM9ILHa3SOiq0VxAXbZ6RBmwkNU9ngtWx1X0mpX+m4yWav P0UNyHRUwZFGIGOvptV7wUGWRYlMau18zPsUuw/Tz3VHUV4948pjZdiXzWahpXzPahWY oiDwDBa1Khn5Zq9uD0hG0Djspw1wgCkvmgCBtk674FPlkoNmsx6FN47gbJGQ5xyP0C5Q Twd2k4GHIoi55jCvPXMz1CL5CXC1napL2w4SiYvYiKYqR28ehuf6+6jm/szyCHd2EQ9c P6Y19sh8vGKe8JCfzG0h/+HpxTm32dXlNPPlIN79H0BS8XFGYtBbI1DWavQVeBzEz71h FOXQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=mTQsoS+h53Vzzjs8qIkqE4wzhWloV1Y4NhbaPd70qbM=; fh=yUwTDGrsvlHouV3fEPRrlKTGD+MlkkPh+H7LyYpVu8M=; b=E/QFoO4MgfRXwOxiRGr2lcKZuK5JdEC7uFldHc1cu3rsXXC4nbVQRKoQRgCJFjt84x Xt9MSDzgJMbvi3JsWD2P2+5RFqF6X1CfQyKMnjQrN5tphnY2TEOqNIAtUYWlC98wflP3 aaglXKfJnrDSxx6QWafH4kvZcVPabR2yFr0XrlfIbRkmYbu+yjIaZez9321lyjjXo8Cu BENEKTwyvoxf5KFWJlxfbWB0WuCGlEyedCYsZWXuDfqGnRI27E32UigfIr4Fj/2ws5ln kGX+N6h8u4V3YTebNDWfhIYyZuJkUlpgP0/eNYR67VJRlSeNpF2sxrEnROj4md9ucrhb rjiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Fb/Wu62f"; 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=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gq10-20020a17090b104a00b00263051bbd63si4455339pjb.159.2023.06.28.04.50.41; Wed, 28 Jun 2023 04:51:00 -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=@linaro.org header.s=google header.b="Fb/Wu62f"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230472AbjF1K52 (ORCPT + 99 others); Wed, 28 Jun 2023 06:57:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230332AbjF1K5A (ORCPT ); Wed, 28 Jun 2023 06:57:00 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24EF410EC for ; Wed, 28 Jun 2023 03:56:58 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-98df69cacd1so397776166b.1 for ; Wed, 28 Jun 2023 03:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687949816; x=1690541816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=mTQsoS+h53Vzzjs8qIkqE4wzhWloV1Y4NhbaPd70qbM=; b=Fb/Wu62fN9GstdwqxVGC9NlOLfqSqYunhCsHpNEsTngqJ05R6sbGO6EgkSCfC1O1KU Rp5DtAcNNhomPtbP1F/Zlc6CnHdUmNlh43TqMavwb4JcwmLgkdunqhQ0gF/HLPBhtVFb pQ871BCyLXXhg7YbABeh4F6v8gJC29AbEIBjudezHIKkQe8dNPVq5CHfZvMCEecowkkH bjfUdhjAoQgIcZ2FFoHdXJSNDylD2m2FdTquenR3st8z29J2qkgYZsDyTY0Y1o2zTc17 9t9x5vI0OEr6WZZEcF1tU02KQ9kr27Ma1nPLTLfrqipHihWq6LHtMQWFjCEIqfFW4MGA 7RkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687949816; x=1690541816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mTQsoS+h53Vzzjs8qIkqE4wzhWloV1Y4NhbaPd70qbM=; b=jWvhvqGKMvq6Moq0BnkeCzltoqxTcKXcynIVxnVJJUDnihL3ExRnOAPN/WMgaz759G eF6P36NHnRKlqxPPwD31xHSF80EwiI76ffNKKKEBj1SRMFZlPBdsPTuLGJPgtAqi9Otd Cq6fpwftvUHdD3PPX9SBuyENhIFtUqMN0M7J460njF4rXHRpydHZoBScppU4cX5hwLHv 9CQBvv2tRPC1HNQh0CSa+YXrQAXNsWkcfgO8KRBWF7sh3G8PXBIeFZnbdihopuMwhl+c R03fupklS/w+vOOe9wIcdrcKmBTKv9sYqe7muCddadRj2oj6B80NwZ93YqyI9ntf0c5B xjpA== X-Gm-Message-State: AC+VfDzNMg+fmxWFIRmxmNaxAss5q+9YflE4dmz4osEW4h1TMVKM9H8Z 9zObbXshpejbpjrJy5LszOQTGA== X-Received: by 2002:a17:907:7291:b0:98d:d26c:e142 with SMTP id dt17-20020a170907729100b0098dd26ce142mr11584981ejc.46.1687949816608; Wed, 28 Jun 2023 03:56:56 -0700 (PDT) Received: from hackbox.lan ([62.231.110.100]) by smtp.gmail.com with ESMTPSA id e8-20020a1709062c0800b0098921e1b064sm5544678ejh.181.2023.06.28.03.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 03:56:56 -0700 (PDT) From: Abel Vesa To: "Rafael J . Wysocki" , Kevin Hilman , Ulf Hansson , avel Machek , Len Brown , Greg Kroah-Hartman , Bjorn Andersson , Andy Gross , Konrad Dybcio , Mike Turquette , Stephen Boyd , Taniya Das Cc: linux-pm@vger.kernel.org, Linux Kernel Mailing List , linux-arm-msm@vger.kernel.org Subject: [PATCH 0/2] PM: domains: Add control for switching back and forth to HW control Date: Wed, 28 Jun 2023 13:56:50 +0300 Message-Id: <20230628105652.1670316-1-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769947068715553464?= X-GMAIL-MSGID: =?utf-8?q?1769947068715553464?= This is just a resend of [1]. This resend just adds the back story behind the need for such a generic API as a cover letter. Also added my SoB tag to Ulf's patch. Some of the newer Qualcomm platforms support handing of the control of some of the GDSCs (implemented as power domains in Linux) to some device firmware. The idea behind such approach is that the firmware knows best when such a power domain can be powered off or not and leads most of the time to better power consumption. At this point, if such GDSC provides HW control support, the current implementation is switching to HW control right after the GDSC gets powered on and it is left in HW control mode until right before the request for power off is done. This needs to remain as is for now, as we do not know for sure what each firmware expects from its related GDSCs. For example, the venus driver expects the codec GDSCs to remain always in HW control mode, otherwise the firmware would crush. But in some cases, the consumer driver needs to switch back and forth. And the explanation for such case is when a driver needs to interract with the device (e.g. reading status bits) and the firmware doesn't guarantee the GDSC will be enabled when in HW mode. Therefore, the consumer would need to switch back to SW mode, do its thing, and then switch again back to HW mode. This is where the patch from Ulf comes in. It allows consumers that actually need to control the HW/SW mode to do so. The GDSC patch just implemets the set_hwmode op and sets it for each GDSC that provides HW control mode. [1] https://lore.kernel.org/all/20230627104033.3345659-1-abel.vesa@linaro.org/ Abel Vesa (1): clk: qcom: gdsc: Add support for set_hwmode_dev Ulf Hansson (1): PM: domains: Allow devices attached to genpd to be managed by HW drivers/base/power/domain.c | 66 +++++++++++++++++++++++++++++++++++++ drivers/clk/qcom/gdsc.c | 22 +++++++++++++ include/linux/pm_domain.h | 15 +++++++++ 3 files changed, 103 insertions(+)