From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4B9D29C326; Sun, 7 Sep 2025 20:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757276101; cv=none; b=N6Iu3UmMpm+n1Ope7pFOJKWAwUcMI3/aSr0h1vG3rFB2lLDwRrSJGr8R6IWZKtLiEwt0aaOCrW6BRNRLrUrmCSUNE9z6oUzDkYKhl6tIWTTLZC1EgLcGJ1zSS9L7s7/PO7ylXzGfEIVLbBq/BwoNXALq1tlGQK2kiIYGH3CouRQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757276101; c=relaxed/simple; bh=3Lk2gZol8HgqjWI6rSVqCVhutwnEjwB9EWVSgSsk7yc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SeBEM+omczPMYMKexCFepdolUehUt08+LmbKEJY1zWtO4NtHIViiQLL5Cl+LepXhT99x+pG8Jk32/+ojjIC6fPrSj38YfOfimHZKfPhSNzL+IS1CU7QwjToC+g3icU0NGFWEgWAAOJFRDv4zuTEJJHTAXLENaFppHCwOKeSySRo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zh1Pjb6u; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zh1Pjb6u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44DD8C4CEF8; Sun, 7 Sep 2025 20:15:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1757276101; bh=3Lk2gZol8HgqjWI6rSVqCVhutwnEjwB9EWVSgSsk7yc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zh1Pjb6uNVOPSrt6/8hiNjFEojylC2SiLLd/jgTYkJoQgr2fvsgDbR2HInkQLga+q oGe+rN3cacQimFCmYr7I5P7itNI3fNTeaFCl5QBe5iGSblb5dnKABcFzxumsBfZPR7 e88WGX9EFJKhZgCjxkdrAb17orRNlK4x73cwyysM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Taniya Das , Imran Shaik , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 62/64] clk: qcom: gdsc: Set retain_ff before moving to HW CTRL Date: Sun, 7 Sep 2025 21:58:44 +0200 Message-ID: <20250907195605.128430960@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250907195603.394640159@linuxfoundation.org> References: <20250907195603.394640159@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Taniya Das [ Upstream commit 25708f73ff171bb4171950c9f4be5aa8504b8459 ] Enable the retain_ff_enable bit of GDSCR only if the GDSC is already ON. Once the GDSCR moves to HW control, SW no longer can determine the state of the GDSCR and setting the retain_ff bit could destroy all the register contents we intended to save. Therefore, move the retain_ff configuration before switching the GDSC to HW trigger mode. Cc: stable@vger.kernel.org Fixes: 173722995cdb ("clk: qcom: gdsc: Add support to enable retention of GSDCR") Signed-off-by: Taniya Das Reviewed-by: Imran Shaik Tested-by: Imran Shaik # on QCS8300 Link: https://lore.kernel.org/r/20250214-gdsc_fixes-v1-1-73e56d68a80f@quicinc.com Signed-off-by: Bjorn Andersson [ Changed error path ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/clk/qcom/gdsc.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -273,6 +273,9 @@ static int gdsc_enable(struct generic_pm */ udelay(1); + if (sc->flags & RETAIN_FF_ENABLE) + gdsc_retain_ff_on(sc); + /* Turn on HW trigger mode if supported */ if (sc->flags & HW_CTRL) { ret = gdsc_hwctrl(sc, true); @@ -289,9 +292,6 @@ static int gdsc_enable(struct generic_pm udelay(1); } - if (sc->flags & RETAIN_FF_ENABLE) - gdsc_retain_ff_on(sc); - return 0; } @@ -392,13 +392,6 @@ static int gdsc_init(struct gdsc *sc) return ret; } - /* Turn on HW trigger mode if supported */ - if (sc->flags & HW_CTRL) { - ret = gdsc_hwctrl(sc, true); - if (ret < 0) - return ret; - } - /* * Make sure the retain bit is set if the GDSC is already on, * otherwise we end up turning off the GDSC and destroying all @@ -406,6 +399,14 @@ static int gdsc_init(struct gdsc *sc) */ if (sc->flags & RETAIN_FF_ENABLE) gdsc_retain_ff_on(sc); + + /* Turn on HW trigger mode if supported */ + if (sc->flags & HW_CTRL) { + ret = gdsc_hwctrl(sc, true); + if (ret < 0) + return ret; + } + } else if (sc->flags & ALWAYS_ON) { /* If ALWAYS_ON GDSCs are not ON, turn them ON */ gdsc_enable(&sc->pd);