From patchwork Thu Mar 23 23:01:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 13186141 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3543C6FD1C for ; Thu, 23 Mar 2023 23:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Uu8IcIt8sV4ypBj8sFkjnR5G6YNm+JEyB7EPKGIUIMc=; b=ea7j3++t8ojJcs ZNrPeRAyrMluacsy1n+ZOcIRCIl50HkRtqxCcFY1aOEiK3KgpI6XN0GYS9ckyAaGwuAf4HSe5/eph bVlkstZnNJka+he1zJZS79k3Sv3Lwwa6ZjSYPmxYbaJSt5UxfNlK0K6bYsTuUSy7UGUD1muPUl8Mq aXEtfokcWSAq9MWi+i/iUJLU+GDGGtXTykMm6VvEnAWdBGw9S9f9f6wDBjS/uzeMP/LPPhUybI3nh yzMJ/bPnNs1T6ab59eV+9oUkS33kNlfivyWk85EbcZs4PqeBV9LaBsd4qUqr2X3lfq6YxWMBLJ9Ud HFRcNWACn2YIPn61isBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pfTw8-0039GT-2R; Thu, 23 Mar 2023 23:01:36 +0000 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pfTw5-0039FB-0E for linux-arm-kernel@lists.infradead.org; Thu, 23 Mar 2023 23:01:34 +0000 Received: by mail-il1-x131.google.com with SMTP id l15so112449ilv.4 for ; Thu, 23 Mar 2023 16:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679612491; 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=xoCYglyZRXBAsXij28ODxM/pUlkw5MAovi/FF2CLHQ8=; b=EuLUTSOXPcNUYVeKnTB4g9KwdaJWobchhRiVJyyhfD91KWS+b0MlS4OMpooyKBAgdV xzItG1xrsWtlkihU9MEE62fZDbxXLWsB1oyAZ9l81RR09vJtVXDgKzfNUfItxVgzgEER KkH1kc77ClORzJv+QgH0phBb8q1NHPyuTQPTdjiUg8DiHZdDgl4uuudjhHPPxK1tUqT7 Bto8XS+HZJogUJF/gclufOTDTb8E3lCnvPY40uH/UjHICTRruzl6NXH9LGXfEQz8iDvy DDDfQhNRw83hx23TMXfD9o9aWYobLjqDkO6EYD3g32v5cuEfY8Nw+hiyMC3N0sYaBkq4 npiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679612491; 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=xoCYglyZRXBAsXij28ODxM/pUlkw5MAovi/FF2CLHQ8=; b=f17QIpxF7vvZ03yIxBx8hz53RP6HRxnKMoefsUYFAIrOJldDfTpg7rnqjBzMHspVhl BqfH45UwY186E47hNd65wU3+ZeLZczyqSNGgW4IXAIBe6u4j6vkgFuJyV48SDIJgVqB5 mXh1+D3o25RXpVw7UUGA1EvgLtd4mhy3TjI7qeE/LzedrW7+/0JkLFrT/d+225F8cA0b tWmDCPUlt4fwZxoz5UjREVRVSAwIh84n2oUG1zdvE3JjegwKXy4Dh3LEAr9BiHWjwoLp vz1a7R0kL8FAhbr+wzdU+YuykmSF7mQ4jxlwUWKYe42BSYJFaQ9Ap64bXG11y4pRK8Kc g6OA== X-Gm-Message-State: AAQBX9dIDhsxt/Yw2fGPDzBLUcNuVTJGpeY3Aeh17Jhyu7M0pZ/RKyQT waRUJ0tmLERm9U1ScRlL2Ug= X-Google-Smtp-Source: AKy350aB8mG/RWYSizA0hQrtNJ+VzeQIYF95T4UM+86HtnAts5iISqBLXr56ECHs23F+T51U/wzZWw== X-Received: by 2002:a92:cb47:0:b0:325:da54:ae8b with SMTP id f7-20020a92cb47000000b00325da54ae8bmr703358ilq.9.1679612491131; Thu, 23 Mar 2023 16:01:31 -0700 (PDT) Received: from aford-IdeaCentre-A730.lan ([2601:447:d001:897f:f38d:f05d:4666:1249]) by smtp.gmail.com with ESMTPSA id w20-20020a056e0213f400b00314201bcbdfsm5405492ilj.3.2023.03.23.16.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 16:01:30 -0700 (PDT) From: Adam Ford To: linux-clk@vger.kernel.org Cc: aford@beaconembedded.com, Adam Ford , Peng Fan , Fabio Estevam , Abel Vesa , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 1/4] clk: imx: composite-8m: Add support to determine_rate Date: Thu, 23 Mar 2023 18:01:24 -0500 Message-Id: <20230323230127.120883-2-aford173@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230323230127.120883-1-aford173@gmail.com> References: <20230323230127.120883-1-aford173@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230323_160133_108002_E7BE38E6 X-CRM114-Status: GOOD ( 11.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Similar to imx/clk-composite-93 and imx/clk-divider-gate, the imx8m_clk_composite_divider_ops can support determine_rate. Without this the parent clocks are set to a fixed value, and if a consumer needs a slower reate, the clock is divided, but the division is only as good as the parent clock rate. With this added, the system can attempt to adjust the parent rate if the proper flags are set which can lead to a more precise clock value. Signed-off-by: Adam Ford Reviewed-by: Peng Fan Reviewed-by: Fabio Estevam --- V4: Sorry for the noise. I forgot to 'git ammend' What V3 was supposed to be. V3: Change name clk_divider_determine_rate to imx8m_clk_divider_determine_rate to match naming convention V2: No Change diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c index cbf0d7955a00..6883a8199b6c 100644 --- a/drivers/clk/imx/clk-composite-8m.c +++ b/drivers/clk/imx/clk-composite-8m.c @@ -119,10 +119,17 @@ static int imx8m_clk_composite_divider_set_rate(struct clk_hw *hw, return ret; } +static int imx8m_clk_divider_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) +{ + return clk_divider_ops.determine_rate(hw, req); +} + static const struct clk_ops imx8m_clk_composite_divider_ops = { .recalc_rate = imx8m_clk_composite_divider_recalc_rate, .round_rate = imx8m_clk_composite_divider_round_rate, .set_rate = imx8m_clk_composite_divider_set_rate, + .determine_rate = imx8m_clk_divider_determine_rate, }; static u8 imx8m_clk_composite_mux_get_parent(struct clk_hw *hw) From patchwork Thu Mar 23 23:01:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 13186143 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 588FFC6FD1C for ; Thu, 23 Mar 2023 23:02:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=G/JoXi+JB/7oP+beMu++/ayx/gikrpNZ7Tk8Ko1RAgM=; b=rSAsaLdW/EQWBi cZyHpV5Bl/t/ksgrBlfOKLMo1ON+qGUn2mEJw569xCWXkbCVHmes5uUNA5n51SlpHdsBYdCeNDit1 SoYTM20DuArn1t2+9Bk4Emz2E7tdMYz4k4uaNPrhuIU3JAFO3dHS3zbKP5i7CRLG2iFcMNWkhF8x9 eAtnr7LyDXr2Z+5OmsNDhh/hDOEm3xpFNvZLf0kgmhUmeWyGM+DhfoRYEVQsTXsbC405ZeHSxC/Ij xmCrdV4OEZ9N1KDwlMuHLszbHcJSPJAApeEqzytkALGHY2qoAghBamw0vBN8n+Q9rg+FmHiIfmFm5 I7kDJNcPU1ptJUh0uolA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pfTwN-0039JD-0p; Thu, 23 Mar 2023 23:01:51 +0000 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pfTw8-0039Fb-0f for linux-arm-kernel@lists.infradead.org; Thu, 23 Mar 2023 23:01:37 +0000 Received: by mail-il1-x134.google.com with SMTP id l9so121006iln.1 for ; Thu, 23 Mar 2023 16:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679612493; 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=RB081nZVc8dV6VyELhQ3vJcnmVLV2KlhEV8rp6VNfxY=; b=X6UBU55JTHWlJqMB3S20dS+Wy+yffRoBqr+j3zoDuWC0/Mi4B4FuCuIWN4McJwLwTm wNOeVDKR3MMRFr4lDsfweYTODJz32M5fWi7wDAFuOwxF1tS0CuT08O5UdpozWSUmwNK8 yqt3bISWBB/0zrnvFXUtxhdxruhcLK4nmJoeHsXX6WI0v8447WCou5u9cAAPHtV4hFwp IR+5fy8SSv1jVeBPB/1TEtptRXWd7ZOzj7DpCSlNzLeL8uAREwnInAnZExQcMVJ3LmoE HrUhlZqqb1KwoXuYRYrgUuHzEKbzMB45JlBDeGjNnA0VVF2Gv46TjKf3K4jk7UjJ444j cuRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679612493; 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=RB081nZVc8dV6VyELhQ3vJcnmVLV2KlhEV8rp6VNfxY=; b=pp2GcugrcCAy5bQ5v7No5zerfta/9mnd5n8/82nVlksZRukdQAjUQIWy7pK7WmVRgC F652mCI3wiqMvVb0q61aoYBUpvmiruO7ayhcU6PPh5g3tu7qTRZY/rd4jSAOiG1fXYMa gxMBJkqziD1jLpnzR3W1wnxmmuIQe+hCiftfe4bgRIh7UrrGovVdogyjyQjCNQCTv2Es xuap3x/Z6HPemYyW5NuTDv7IS8SylzMqgeRN1glXJ8i4v+POLm+31sCP/1fFyt6pmrnQ 74HdTSzPyv4RrsnJYo4UjBk0LSvCiNF2cy6T1jLQGXvM52pOzJwWvGFxZUy/rv0AH6lP 6mHg== X-Gm-Message-State: AAQBX9dR9qIFw/OU52JcXTgNlpCXW8LwJwR4eIEjQrUDIcdyVrgb9BRQ 6+7pC6jJnsBKnSTdfNefjq4= X-Google-Smtp-Source: AKy350bCXvTy/YRdJXkCgkE98FughAgIeIl5gAg2lVjYZrSOt6dZAG/XykJ6Fo8r/E9EmWO1Cr561g== X-Received: by 2002:a92:ce06:0:b0:325:cf0c:e578 with SMTP id b6-20020a92ce06000000b00325cf0ce578mr1001324ilo.12.1679612492744; Thu, 23 Mar 2023 16:01:32 -0700 (PDT) Received: from aford-IdeaCentre-A730.lan ([2601:447:d001:897f:f38d:f05d:4666:1249]) by smtp.gmail.com with ESMTPSA id w20-20020a056e0213f400b00314201bcbdfsm5405492ilj.3.2023.03.23.16.01.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 16:01:32 -0700 (PDT) From: Adam Ford To: linux-clk@vger.kernel.org Cc: aford@beaconembedded.com, Adam Ford , Fabio Estevam , Abel Vesa , Peng Fan , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 2/4] clk: imx: Add imx8m_clk_hw_composite_flags macro Date: Thu, 23 Mar 2023 18:01:25 -0500 Message-Id: <20230323230127.120883-3-aford173@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230323230127.120883-1-aford173@gmail.com> References: <20230323230127.120883-1-aford173@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230323_160136_249877_2F3F365C X-CRM114-Status: UNSURE ( 8.06 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In order to set custom flags to imx8m_clk_hw_composite, split it off into a separate macro which can accept additional flags. Signed-off-by: Adam Ford Reviewed-by: Fabio Estevam diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 3d94722bbf99..621b0e84ef27 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -417,6 +417,10 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name, _imx8m_clk_hw_composite(name, parent_names, reg, \ 0, IMX_COMPOSITE_CLK_FLAGS_DEFAULT) +#define imx8m_clk_hw_composite_flags(name, parent_names, reg, flags) \ + _imx8m_clk_hw_composite(name, parent_names, reg, \ + 0, IMX_COMPOSITE_CLK_FLAGS_DEFAULT | flags) + #define imx8m_clk_hw_composite_critical(name, parent_names, reg) \ _imx8m_clk_hw_composite(name, parent_names, reg, \ 0, IMX_COMPOSITE_CLK_FLAGS_CRITICAL) From patchwork Thu Mar 23 23:01:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 13186144 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B192CC7619A for ; Thu, 23 Mar 2023 23:02:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=d8DRONv98VoykfJRyFVuI1b86tgVElQ3mi3IpPNil8s=; b=KOpkl6qu+aYNP3 7IVQr5w92fBiJxQvu2Rq+OC4ZN+Qxg4ogt2JAymy2kmTnUwUx0qNjuUAWItrsQ3YRY69eXsJQiryO KBwjsidqBe/bTmfY2UgsjlNEEuUFzE2Hz5NrGInQjj4wc87wA1hALT6B9/+MoSUqBmxNQp9X8SvvG WGvn5LkRd06wrKiWwPvPdveqombzmwfnj+RbnTJqKuPjuAXZNiR3JITI2oDNCoIFaDKDvcem5jY6V VqrlSWV798D5WXdty3pRzgUiYPIpUMJZtOSIHj8PmRkwlKul3MEgIa+Or/Nukkv0/WZzEyfC1OSZe YLqD1KM/phBWTQg73M8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pfTwO-0039Jc-0v; Thu, 23 Mar 2023 23:01:52 +0000 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pfTw8-0039Fz-0f for linux-arm-kernel@lists.infradead.org; Thu, 23 Mar 2023 23:01:38 +0000 Received: by mail-il1-x12d.google.com with SMTP id u8so117873ilb.2 for ; Thu, 23 Mar 2023 16:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679612494; 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=g/Q6xa6hn+k+lfvS3cph2ZGvXNMdvP6vRrG80AxIr6U=; b=PvnomUgwJhFFGVd77ArauD7bqMvzE1OYSjS9WYvf8/bzz9nXv12fSe+z9+pR4ncTJA hiq2WqRoiJ3etczBYlNNUzckpD74VJbCWJZJXNEkBGaUjZcw4mbrYUr+SQ4c7uKseN4U H5T+m7AHTZmN00OUqUNnUgRziFRiNCJRzjfaEu7jRdWBttETEPtUsu3kJ6o5fOnPzxU1 Tb8xPYcwP+3xhL9b4tfCDZGpbSh7GAWBKWI9oGwP8fU4WMaRgRgzbVaf243v/Y0EzCpc SOCCxzK23qu1blumomrhdEr9Wmfm8Qz3ez0lwfacVogdBZzB07fd4PjkJIDvbydRprmZ EG9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679612494; 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=g/Q6xa6hn+k+lfvS3cph2ZGvXNMdvP6vRrG80AxIr6U=; b=lXuQd4M2r13+nPAaR2lkwvPqDiKIf81sdrtebNYKI4XlKyUGAqnpd5SvuXDqiYfNCS F/4ecbF0iLHsFyJlLKKSLfM0jyyovP0p5h2G6+nQGuqqHzYFUpcEponIrKkJG9ZjxBN7 vsckh6Zk+a5yuWnaLRTm0AMe/tMYvmd0cI8O8vqZJZ2PdRRoaJMOqH4tQycQQDdhPuRV LTS59QYwr9nJqb//FjtC4VepeNoGldcGxopdE5PJu9mFU9GWeKITNSsEmMIG40Y79/Ft 6jdtDUdHVq1TB6x0NaT4cJyIDNGTf9U9wVTry2xUVp2yu+l/1U50fce6gJj4OsO9bQb5 20Dw== X-Gm-Message-State: AAQBX9fAvc0ZdQJUZiyAuDRH0JMsnwjDAoFN9si/fVXSl0uyCQe9no7L KyDaTKixbChSo/4pcGDIMSo= X-Google-Smtp-Source: AKy350Zu7vFYu8YnzXAXL+VgxNGS+TQ/V7MzyBfsmY5bmH5svzZC3FbmUUPldLCXwQJFji1aQJQLGw== X-Received: by 2002:a92:4b0d:0:b0:323:ec3:49b7 with SMTP id m13-20020a924b0d000000b003230ec349b7mr908478ilg.11.1679612494427; Thu, 23 Mar 2023 16:01:34 -0700 (PDT) Received: from aford-IdeaCentre-A730.lan ([2601:447:d001:897f:f38d:f05d:4666:1249]) by smtp.gmail.com with ESMTPSA id w20-20020a056e0213f400b00314201bcbdfsm5405492ilj.3.2023.03.23.16.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 16:01:34 -0700 (PDT) From: Adam Ford To: linux-clk@vger.kernel.org Cc: aford@beaconembedded.com, Adam Ford , Fabio Estevam , Abel Vesa , Peng Fan , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 3/4] clk: imx8mm: Let IMX8MM_CLK_LCDIF_PIXEL set parent rate Date: Thu, 23 Mar 2023 18:01:26 -0500 Message-Id: <20230323230127.120883-4-aford173@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230323230127.120883-1-aford173@gmail.com> References: <20230323230127.120883-1-aford173@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230323_160136_269108_770F6B24 X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org By default the display pixel clock needs to be evenly divide down from 594MHz which rules out a significant number of resolution and refresh rates. The current clock tree looks something like: video_pll1 594000000 video_pll1_bypass 594000000 video_pll1_out 594000000 lcdif_pixel 148500000 Now that composite-8m supports determine_rate, we can allow lcdif_pixel to set the parent rate which then switches every clock in the chain to a new frequency when lcdif_pixel cannot evenly divide from video_pll1_out. Signed-off-by: Adam Ford Reviewed-by: Fabio Estevam diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c index b618892170f2..075f643e3f35 100644 --- a/drivers/clk/imx/clk-imx8mm.c +++ b/drivers/clk/imx/clk-imx8mm.c @@ -468,7 +468,7 @@ static int imx8mm_clocks_probe(struct platform_device *pdev) hws[IMX8MM_CLK_PCIE1_PHY] = imx8m_clk_hw_composite("pcie1_phy", imx8mm_pcie1_phy_sels, base + 0xa380); hws[IMX8MM_CLK_PCIE1_AUX] = imx8m_clk_hw_composite("pcie1_aux", imx8mm_pcie1_aux_sels, base + 0xa400); hws[IMX8MM_CLK_DC_PIXEL] = imx8m_clk_hw_composite("dc_pixel", imx8mm_dc_pixel_sels, base + 0xa480); - hws[IMX8MM_CLK_LCDIF_PIXEL] = imx8m_clk_hw_composite("lcdif_pixel", imx8mm_lcdif_pixel_sels, base + 0xa500); + hws[IMX8MM_CLK_LCDIF_PIXEL] = imx8m_clk_hw_composite_flags("lcdif_pixel", imx8mm_lcdif_pixel_sels, base + 0xa500, CLK_SET_RATE_PARENT); hws[IMX8MM_CLK_SAI1] = imx8m_clk_hw_composite("sai1", imx8mm_sai1_sels, base + 0xa580); hws[IMX8MM_CLK_SAI2] = imx8m_clk_hw_composite("sai2", imx8mm_sai2_sels, base + 0xa600); hws[IMX8MM_CLK_SAI3] = imx8m_clk_hw_composite("sai3", imx8mm_sai3_sels, base + 0xa680); From patchwork Thu Mar 23 23:01:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 13186145 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98D99C74A5B for ; Thu, 23 Mar 2023 23:02:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=No2ZpiiO/R1CFmiLIvJfYlcbHwfhOAXSS8JnlgKLMgo=; b=xx/dbZuNY15nUq Ot3syCT3qfHU/NVVzuyAbUdZMQOnGXpYjBX/1cR9wGdKngpu83FaJwkh+JB84ljnLjCebr8VG/9/W PoXOXJHcMPvJre6orswegqnTQRuepxf3soK7rmDOmEqExJeJ+gWM0RIassbZwr/NB+KCSS4swANHC 3WnE6oZqjnmLMvLJSAFzy4WUkP8n8fJ2O63ThLuO4g0hGjtCTIzJBBeH9alfU3TfLfcz4DStHRcO0 2ZUGbRL4XTYmi9vd+FQX70D8w679ICGRJTqMgaFqq0aKq9aHlmbzN/y9K7RNcResRDorkcw3gflyj 2SMueTGylm+6Lrsl6e6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pfTwP-0039KE-1M; Thu, 23 Mar 2023 23:01:53 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pfTwA-0039GS-03 for linux-arm-kernel@lists.infradead.org; Thu, 23 Mar 2023 23:01:39 +0000 Received: by mail-il1-x129.google.com with SMTP id h7so108951ila.5 for ; Thu, 23 Mar 2023 16:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679612496; 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=ZKi3A+dV0/tXsD8Az45Lpy5Jn7qD/QNBqF2DDHsjptI=; b=bbrVRFpgVq8Z3pBppHqtnNOI941pkMlpAPmDFti9VxOgzynxQt3tR06ysjKU2+DzfF UtoOufG2ylJ67O3C9L44T2wOHLLSGe9sIUvTRYah+xjdDwPYySLoOIY3VeCFqHhDFvTR cR4lbDtUHfWKEaOvGE6kQzp0szas1ks5+lblONRTAohv97yAmBp8yuwC56A9p3r8aAj2 B4EZOQmM/l+YMe3/coS9LKmKgaoCNSO2gWSYSTshdYHNYkGKJeu9K8wCaESQn6dGr3ew 6QlvLIFTpOHx6cSpbupE8aeVEvZvjX+b9ugcwp1gbWemJ/Ycfbp6amoCzKEoEm7d8+2l WUdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679612496; 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=ZKi3A+dV0/tXsD8Az45Lpy5Jn7qD/QNBqF2DDHsjptI=; b=jtp1BYHMZTb122EuPY+MC6fqm/SRuvFDfLotgeyN1wzhdyQvDkw1mJLj6mv3UyM6Bo JsUWiCVJYGSFOD7Kb5qZzn7Jc5lsb+yl0p+or05Uit8/hRXU3beQyh6aDZQJ3G1EDurl 0auShyWzD+1sbNb4aH4jHqz+SCN9ZLNpRkddrLmUx5+eTQFHL3NuFqRXc9nuNAGywkua cEy0Jb+JHvf8W7mBurirxAsG1mmpc9sWIIxqiAjg1FtgrafQR60np+kvehBUJOIIJjmV WQinykJhiSb2D3M90SsNJ3U13cO09V9KUZZBUZSgQezUk/9vswaxNf/CtujDsZSD0FdI 8L7Q== X-Gm-Message-State: AAQBX9cX94+j0UwgN8X9NLMS1FTWl/KtEH5GSsSxykASbIPlC0An79zm GXrGvbvSZNtTYiUyNceAF8U= X-Google-Smtp-Source: AKy350YVoWYfxzjzrJIZa0sUyA0VhekNp7+yIqqBVCM5Wett6PZZYMup1lS9ba5KWjGP4UqlIqq0DA== X-Received: by 2002:a92:d48a:0:b0:325:b96e:66fb with SMTP id p10-20020a92d48a000000b00325b96e66fbmr916084ilg.1.1679612496050; Thu, 23 Mar 2023 16:01:36 -0700 (PDT) Received: from aford-IdeaCentre-A730.lan ([2601:447:d001:897f:f38d:f05d:4666:1249]) by smtp.gmail.com with ESMTPSA id w20-20020a056e0213f400b00314201bcbdfsm5405492ilj.3.2023.03.23.16.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 16:01:35 -0700 (PDT) From: Adam Ford To: linux-clk@vger.kernel.org Cc: aford@beaconembedded.com, Adam Ford , Fabio Estevam , Abel Vesa , Peng Fan , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 4/4] clk: imx: Let IMX8MN_CLK_DISP_PIXEL set parent rate Date: Thu, 23 Mar 2023 18:01:27 -0500 Message-Id: <20230323230127.120883-5-aford173@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230323230127.120883-1-aford173@gmail.com> References: <20230323230127.120883-1-aford173@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230323_160138_049281_E54D8E27 X-CRM114-Status: UNSURE ( 9.72 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org By default the display pixel clock needs to be evenly divide down from the video_pll_out clock which rules out a significant number of resolution and refresh rates. The current clock tree looks something like: video_pll 594000000 video_pll_bypass 594000000 video_pll_out 594000000 disp_pixel 148500000 disp_pixel_clk 148500000 Now that composite-8m supports determine_rate, we can allow disp_pixel to set the parent rate which then switches every clock in the chain to a new frequency when disp_pixel cannot evenly divide from video_pll_out. Signed-off-by: Adam Ford Reviewed-by: Fabio Estevam diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index a042ed3a9d6c..4b23a4648600 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -470,7 +470,7 @@ static int imx8mn_clocks_probe(struct platform_device *pdev) hws[IMX8MN_CLK_DRAM_ALT] = imx8m_clk_hw_fw_managed_composite("dram_alt", imx8mn_dram_alt_sels, base + 0xa000); hws[IMX8MN_CLK_DRAM_APB] = imx8m_clk_hw_fw_managed_composite_critical("dram_apb", imx8mn_dram_apb_sels, base + 0xa080); - hws[IMX8MN_CLK_DISP_PIXEL] = imx8m_clk_hw_composite("disp_pixel", imx8mn_disp_pixel_sels, base + 0xa500); + hws[IMX8MN_CLK_DISP_PIXEL] = imx8m_clk_hw_composite_flags("disp_pixel", imx8mn_disp_pixel_sels, base + 0xa500, CLK_SET_RATE_PARENT); hws[IMX8MN_CLK_SAI2] = imx8m_clk_hw_composite("sai2", imx8mn_sai2_sels, base + 0xa600); hws[IMX8MN_CLK_SAI3] = imx8m_clk_hw_composite("sai3", imx8mn_sai3_sels, base + 0xa680); hws[IMX8MN_CLK_SAI5] = imx8m_clk_hw_composite("sai5", imx8mn_sai5_sels, base + 0xa780);