Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19027227rwd; Wed, 28 Jun 2023 04:11:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ56SOkWfLAZRIi04HxDPg/92rGlTTSa4ce0mn/YUILZ56mc809WJocXZQM8IEZQaH3+WPSJ X-Received: by 2002:a2e:98cf:0:b0:2b5:1b80:264b with SMTP id s15-20020a2e98cf000000b002b51b80264bmr18001196ljj.12.1687950674867; Wed, 28 Jun 2023 04:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687950674; cv=none; d=google.com; s=arc-20160816; b=GnzHCHLXodU7eQwm0VPs+LWmYwHi6b6ifoapIekCAK8JXNymag2nEeCZ1d4G7YSsCS o7bUyI86zDh4F+Lwc7PZTATUp+cCYr6BelFXqrnN0H3sAy0s8y7ZovbDvRnk7AKTbydh p8dlx9xxhjhmE2LShlgY8pyEATAoCBnRyYPcaaXsHVf7e5NS/66ONOhi7lx0IVaaECAv uPet0Ta6XwePrMlaOt9SmWL4Ct5NAKy8zjvZO3df5ot9ghHhJMAJ8eZeyrPgxH0ZQgum M1PDoVul9edBJibQ6p15rjYN2Rcbhlt1AXksQc0azv6PWQxeFTUZpz4lKQFER/kaalOM WOPw== 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=/UOP/HXwOfjROV0iDHrU1g1p6LD4GcCF3K/FghLtNOU=; fh=yUwTDGrsvlHouV3fEPRrlKTGD+MlkkPh+H7LyYpVu8M=; b=lL6dNrcej0syuDBkr9iiyAaAGVYf7hEuYfcnw+zCx4steFrDCUbIhAIRe2u26CBhJ2 fNuUc8b5ayqJElOqrww2qk0milOjZsjW7PstklycuhNL4s2yoALEqOzOERg4cZQgvVlk ruEanach4wrbQRPP4VqAvzsKpx3XY+p/SMUeMLYJAUEcW98N7i4P/OFRhrq/zo4lvNi+ pKqD02f9rs9Px8kfF/E0bdF1GJB3DPPRtBjq/tIOFAw/Q10G6QPW0A5MrWlu1LN2uH16 R5TgqTmrewYnj+EFAfOEGiF0a7O22rvl+wHdg+XhXLX2aPbGSR0t5K7xbaVkZac4OcWA 0CqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dujCAIaX; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f26-20020a056402069a00b0051bebf75cb7si5445919edy.357.2023.06.28.04.10.48; Wed, 28 Jun 2023 04:11:14 -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=dujCAIaX; 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 S231214AbjF1K5j (ORCPT + 99 others); Wed, 28 Jun 2023 06:57:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230341AbjF1K5Z (ORCPT ); Wed, 28 Jun 2023 06:57:25 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 333871BF9 for ; Wed, 28 Jun 2023 03:57:01 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-98d34f1e54fso582663266b.2 for ; Wed, 28 Jun 2023 03:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687949819; x=1690541819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/UOP/HXwOfjROV0iDHrU1g1p6LD4GcCF3K/FghLtNOU=; b=dujCAIaXSqqrylpawSmjXQ0uVV5fxHuMEQFzZO//TIz9sxd1krxA8ZDYPCDBDRVh0/ BfluOhNKHaqL76P0tQO39OagrbXFJc2LI7Tg5leqj6NdydDD+PHLgE+d3n6pCSrGdu5c qsrE6I/PhnivlF9PkTMJ1Laa3igaQiDWgWYmKdVl0J3y4kuOVTJ4Mg9PU83v4ml0UsSx LK0jT/vaxWfQQJ50Yj/VnTLXf3Aj0r5qZRmcn1iRAh7QmanZn5fC3LhQaukjGHdSnlKi B/+a2PL7DVxgndOYPox3yCot4+cfYZCKp4OCr+ZnWX93JP3lLrsTMb7JnHyfIWJF5ROo sDKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687949819; x=1690541819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/UOP/HXwOfjROV0iDHrU1g1p6LD4GcCF3K/FghLtNOU=; b=OH6AB5Yurm/g0DXioZL+P2VC5tbmlFDVfoDy8lLg9dkTIEImiYNWl4N9iI5gJrYw40 C/sZyw2HYCpwFHOt+xTh/wTiHKbJfBZtkuB4ipKljUi+OYFoRDgsuqMXEnITEFNJ22gE yHZqz0fVhd3r/UgkNbLxDurjgwK6DByaM1n8ZeSMzgE0O7kcYZJbQL9XCFGlCEMlvQ0o t1mj8kP6lrHH0vclg7IwWCvEudSUrn+D2CfyjBfE/eXwlmWM09MzU1O7nMf0EuRBTEF5 pXcJfdWsI/n1dpPbSYsLYoZ7/exQZOslVR9R7I0nG/+MdQjRS9cCKUGcfuUcxy6GHgzB GLJA== X-Gm-Message-State: AC+VfDyN9yWJvzuKI0DNDRhEwYGkYfubK7YEOdujoPgQVgU/4d1tjwCq 9L241W0w+U2b3+/YIThUVdxH1g== X-Received: by 2002:a17:907:2683:b0:957:1df0:9cbf with SMTP id bn3-20020a170907268300b009571df09cbfmr25730821ejc.19.1687949819656; Wed, 28 Jun 2023 03:56:59 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 03:56:59 -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 2/2] clk: qcom: gdsc: Add support for set_hwmode_dev Date: Wed, 28 Jun 2023 13:56:52 +0300 Message-Id: <20230628105652.1670316-3-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230628105652.1670316-1-abel.vesa@linaro.org> References: <20230628105652.1670316-1-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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=unavailable 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 Implement the GDSC specific genpd set_hwmode_dev callback in order to switch the HW control on or off. For any GDSC that supports HW control set this callback in order to allow its consumers to control it. Signed-off-by: Abel Vesa --- drivers/clk/qcom/gdsc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c index 5358e28122ab..9a04bf2e4379 100644 --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -314,6 +314,26 @@ static int gdsc_enable(struct generic_pm_domain *domain) return 0; } +static int gdsc_set_hwmode_dev(struct generic_pm_domain *domain, + struct device *dev, bool enable) +{ + int ret = gdsc_hwctrl(domain_to_gdsc(domain), enable); + + if (ret) + goto out; + + /* + * Wait for the GDSC to go through a power down and + * up cycle. In case there is a status polling going on + * before the power cycle is completed it might read an + * wrong status value. + */ + udelay(1); + +out: + return ret; +} + static int gdsc_disable(struct generic_pm_domain *domain) { struct gdsc *sc = domain_to_gdsc(domain); @@ -451,6 +471,8 @@ static int gdsc_init(struct gdsc *sc) sc->pd.power_off = gdsc_disable; if (!sc->pd.power_on) sc->pd.power_on = gdsc_enable; + if (sc->flags & HW_CTRL) + sc->pd.set_hwmode_dev = gdsc_set_hwmode_dev; ret = pm_genpd_init(&sc->pd, NULL, !on); if (ret) -- 2.34.1