Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1554823lqp; Mon, 15 Apr 2024 09:38:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVsn+q5W08UXy7nbJy0R+ly1nQbguX1F/hv/wy2IOCjdjAwLdpI90W2ZRw20v3z1S0koHuhqEHcQbxzVLdvYWVymTKu6sYbALbmtAIj4g== X-Google-Smtp-Source: AGHT+IFISuOB3aeGA7WSHo3Hv7X+/3k0/dTLwXmd+ua47ucC6l3W73sszH30QYu7ayzUGyQPPK7Z X-Received: by 2002:a50:d596:0:b0:56c:1696:58a8 with SMTP id v22-20020a50d596000000b0056c169658a8mr9919488edi.0.1713199094736; Mon, 15 Apr 2024 09:38:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713199094; cv=pass; d=google.com; s=arc-20160816; b=PW6dDgt/7mKVd85KR6m5MM3FLedQLCgZ2NFDvGvuR52XNbjqAatt+0KC8fwUl2dYc0 5f9Dg3+csKzkSPTew3itTx7Foj3wJYvX7JGJnSDjIp0NSs5+qF9T1yv4MWhl/zSfG8xO qqJz9XNsbZf/T+S0scu7q1Saa7IlZP9LCOywfvc2caWQ1jYRDiqehYskrbQeyYL/X2Uq /mi1FBJnrSd6dVNGKCtUB8Sr/zfd7/FES3TDtw1I70Pbz7EY+dsaN/e+Vw7Fg3IEF2YC n0D5Pr3/mVhW9NOsc6O1+V3SpKr1Fk4kI9SDecQmwJjOFPKZqfNY/MIXdk4MTDzOSs5r jSBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=u0IzFP0orBuP48GmD52pXJ9QVijErFaA9Th5ayIb1GM=; fh=mWEa8kD57fMXkUdPHBEJD6cIWPe6iYGLhbK4K2UH3fw=; b=lfkIsDaObSpBaVfu6Lx9VTg/rCwq56HW5IFuvZXtxrfuUe8kX6IW6q2GxY22aT7RCs lSW9VBQL+3k9LOzQKcV8X9Xz8f30QfO9nqx7bR9OdgPXd04lWXhDSvnNGmQurQh3t68Z eN9mO2plnaijQ4ioy/tYF7vPNzp3Dca+VvqvMPWdgQT4XYH79XXcujycfurLvCz4RGVr nArMiMQt4J4vsl6g8hI63EuJ9tTyZGCV3uY8MNoRZ1BRK5wocD5vgOQhFCI7aKStAUV9 swO5gMUjS9E3ielVpfeApvlsQr0dcaHSjHhj7ae8nlQ9dMYsGrfwSaNbbAobUbA6xPA/ xtGw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-145568-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145568-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m22-20020a509316000000b0056e3fa0fbd1si4642692eda.495.2024.04.15.09.38.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 09:38:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145568-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-145568-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145568-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 661FA1F2265B for ; Mon, 15 Apr 2024 16:38:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DACF483CAF; Mon, 15 Apr 2024 16:37:11 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E4E6482897; Mon, 15 Apr 2024 16:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713199031; cv=none; b=dqwa6kXRiaOAfnSIHShRgkp/0HK5ZPmvPLrOgpXafat87j6f+tov14iLxTWPi6Sfw6V4bx3yYSGTxk82bZ/Agu4Q9JnOnUarkM8H2G5BVLCaQAlVXYNOUySa+qUL+NrchFOUbbj1A4W25Ks0ht/qdcRx8zVNf4J+ib7hW/dbjUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713199031; c=relaxed/simple; bh=QjR7z+IUvta/EMx7HFog6puX37jtBuP+gN6KnJSleTs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SX3OjNkzT1PskuO5lu56ik7V9oATf39nwBRGMua1/vP95x6SJ/TzVN+W8FwbcnYxqgetvSJ2sHFg3532BAry3XufiYvP0bsWj+mxRvqFMasRch9RMs+ULzS2ylq86zchYOfBIhP8xAlR5w+3BFdFWJy/43ELcWOpogjs4O2gOf4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C764F2F4; Mon, 15 Apr 2024 09:37:37 -0700 (PDT) Received: from pluto.fritz.box (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 182BF3F64C; Mon, 15 Apr 2024 09:37:06 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org Cc: sudeep.holla@arm.com, james.quinlan@broadcom.com, f.fainelli@gmail.com, vincent.guittot@linaro.org, peng.fan@oss.nxp.com, michal.simek@amd.com, quic_sibis@quicinc.com, quic_nkela@quicinc.com, souvik.chakravarty@arm.com, mturquette@baylibre.com, sboyd@kernel.org, Cristian Marussi Subject: [PATCH v3 2/5] clk: scmi: Add support for state control restricted clocks Date: Mon, 15 Apr 2024 17:36:46 +0100 Message-ID: <20240415163649.895268-3-cristian.marussi@arm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240415163649.895268-1-cristian.marussi@arm.com> References: <20240415163649.895268-1-cristian.marussi@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Some exposed SCMI Clocks could be marked as non-supporting state changes. Configure a clk_ops descriptor which does not provide the state change callbacks for such clocks when registering with CLK framework. CC: Michael Turquette CC: Stephen Boyd CC: linux-clk@vger.kernel.org Signed-off-by: Cristian Marussi --- v2 -> v3 - using SCMI_CLK_STATE_CTRL_SUPPORTED instead of _FORBIDDEN --- drivers/clk/clk-scmi.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c index 4b6c43d7f5f3..e70708573965 100644 --- a/drivers/clk/clk-scmi.c +++ b/drivers/clk/clk-scmi.c @@ -19,6 +19,7 @@ enum scmi_clk_feats { SCMI_CLK_ATOMIC_SUPPORTED, + SCMI_CLK_STATE_CTRL_SUPPORTED, SCMI_CLK_FEATS_COUNT }; @@ -230,15 +231,19 @@ scmi_clk_ops_alloc(struct device *dev, unsigned long feats_key) * only the prepare/unprepare API, as allowed by the clock framework * when atomic calls are not available. */ - if (feats_key & BIT(SCMI_CLK_ATOMIC_SUPPORTED)) { - ops->enable = scmi_clk_atomic_enable; - ops->disable = scmi_clk_atomic_disable; - ops->is_enabled = scmi_clk_atomic_is_enabled; - } else { - ops->prepare = scmi_clk_enable; - ops->unprepare = scmi_clk_disable; + if (feats_key & BIT(SCMI_CLK_STATE_CTRL_SUPPORTED)) { + if (feats_key & BIT(SCMI_CLK_ATOMIC_SUPPORTED)) { + ops->enable = scmi_clk_atomic_enable; + ops->disable = scmi_clk_atomic_disable; + } else { + ops->prepare = scmi_clk_enable; + ops->unprepare = scmi_clk_disable; + } } + if (feats_key & BIT(SCMI_CLK_ATOMIC_SUPPORTED)) + ops->is_enabled = scmi_clk_atomic_is_enabled; + /* Rate ops */ ops->recalc_rate = scmi_clk_recalc_rate; ops->round_rate = scmi_clk_round_rate; @@ -294,6 +299,9 @@ scmi_clk_ops_select(struct scmi_clk *sclk, bool atomic_capable, if (atomic_capable && ci->enable_latency <= atomic_threshold_us) feats_key |= BIT(SCMI_CLK_ATOMIC_SUPPORTED); + if (!ci->state_ctrl_forbidden) + feats_key |= BIT(SCMI_CLK_STATE_CTRL_SUPPORTED); + if (WARN_ON(feats_key >= db_size)) return NULL; -- 2.44.0