From nobody Wed Dec 17 04:41:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86BE3C433FE for ; Thu, 13 Oct 2022 06:49:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbiJMGtX (ORCPT ); Thu, 13 Oct 2022 02:49:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229657AbiJMGtD (ORCPT ); Thu, 13 Oct 2022 02:49:03 -0400 Received: from us-smtp-delivery-115.mimecast.com (us-smtp-delivery-115.mimecast.com [170.10.133.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 964881463B0 for ; Wed, 12 Oct 2022 23:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maxlinear.com; s=selector; t=1665643737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yW/6V1qRcDmA37h7BKc8WxQSHaHKLLO2foHGntzZ9N4=; b=oqts3gZXDybtQLXgKB3l3e/izVkY53vCSb16Vi9jFmp6S6YqCHXc4Yj8uYtJZ2luRF2fY4 Q91UhyVZKM/HBrI/iLUM2GzmVfIOPIeBBseKgIdRzYUqN9I7fDGLaHr9O7KA2Utdny1EmI HcYhQYF4CY7Ww0toRkYYCzklNVRuXZhGDOBhqBu+ECr/XfoOJrKCDKposl9UuJYAXOuCLX mMj/ekCc/0t0Xe1XfPM4O/w8bvA4QOVtrLtNCrd+Q6B/Bf1DwpUhKyo7yu88Gkzp9J8/VH bQU7SVwFUnob2H8UxLSXih2lNbtppHqjlaZ+QsWOLZokPUZtiEHcpKeC/5v/Cw== Received: from mail.maxlinear.com (174-47-1-84.static.ctl.one [174.47.1.84]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id us-mta-562-APN1wHB2N8KLM2CyH0UUIw-1; Thu, 13 Oct 2022 02:48:48 -0400 X-MC-Unique: APN1wHB2N8KLM2CyH0UUIw-1 Received: from sgsxdev001.isng.phoenix.local (10.226.81.111) by mail.maxlinear.com (10.23.38.119) with Microsoft SMTP Server id 15.1.2375.24; Wed, 12 Oct 2022 23:48:45 -0700 From: Rahul Tanwar To: , , , CC: , , "Rahul Tanwar" Subject: [PATCH v4 3/4] clk: mxl: Add option to override gate clks Date: Thu, 13 Oct 2022 14:48:32 +0800 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: maxlinear.com Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In MxL's LGM SoC, gate clocks can be controlled either from CGU clk driver i.e. this driver or directly from power management driver/daemon. It is dependent on the power policy/profile requirements of the end product. To support such use cases, provide option to override gate clks enable/disa= ble by adding a flag GATE_CLK_HW which controls if these gate clks are controll= ed by HW i.e. this driver or overridden in order to allow it to be controlled by power profiles instead. Reviewed-by: Yi xin Zhu Signed-off-by: Rahul Tanwar --- drivers/clk/x86/clk-cgu.c | 15 ++++++++++++++- drivers/clk/x86/clk-cgu.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/clk/x86/clk-cgu.c b/drivers/clk/x86/clk-cgu.c index 1f7e93de67bc..5eafd7e0d945 100644 --- a/drivers/clk/x86/clk-cgu.c +++ b/drivers/clk/x86/clk-cgu.c @@ -354,8 +354,21 @@ int lgm_clk_register_branches(struct lgm_clk_provider = *ctx, hw =3D lgm_clk_register_fixed_factor(ctx, list); break; case CLK_TYPE_GATE: - hw =3D lgm_clk_register_gate(ctx, list); + if (list->gate_flags & GATE_CLK_HW) + hw =3D lgm_clk_register_gate(ctx, list); + else + /* + * GATE_CLKs can be controlled either from + * CGU clk driver i.e. this driver or directly + * from power management driver/daemon. It is + * dependent on the power policy/profile requirements + * of the end product. To override control of gate + * clks from this driver, provide NULL for this index + * of gate clk provider. + */ + hw =3D NULL; break; + default: dev_err(ctx->dev, "invalid clk type\n"); return -EINVAL; diff --git a/drivers/clk/x86/clk-cgu.h b/drivers/clk/x86/clk-cgu.h index 0aa0f35d63a0..73ce84345f81 100644 --- a/drivers/clk/x86/clk-cgu.h +++ b/drivers/clk/x86/clk-cgu.h @@ -197,6 +197,7 @@ struct lgm_clk_branch { /* clock flags definition */ #define CLOCK_FLAG_VAL_INIT BIT(16) #define MUX_CLK_SW BIT(17) +#define GATE_CLK_HW BIT(18) =20 #define LGM_MUX(_id, _name, _pdata, _f, _reg, \ _shift, _width, _cf, _v) \ --=20 2.17.1