From mboxrd@z Thu Jan 1 00:00:00 1970 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 AC2E0C001DE for ; Sun, 6 Aug 2023 13:48:38 +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=U6RE/szVT4h9gs9AYdcgjDfyhcMDyQlp75JEYfOcMLs=; b=YjDwtMQW6pHTwB pm5AGmsWIvU+yUj95DENC0fq2kkmlOlV5T+JYbgdCFDNmn5H4VIQZf3Pc7xwSREMPSgGBtTnVzwRw hj/++5NZqWFYIlDxqZcGzeHuhJ/CN4hezJky9gb/Z9TU3io4vUmjigGLtRBgdy1P1bnfRdXU7cMyB DYV1tS5GDBRhuAIhpHObtb5hwf8d6fEf/0D+zmYQ+9lEJjPnHwHXYW4SSXAwGAbEfaecFNRx5s8J8 0mSUamzlaHjyJhBuhPUya84uHYCKvDGKCRQHbk4j8IP8hw9kEl9JoKr02fWWrYVWaCpRX+Hm+Jagp pVRSbZk1o4g03D0hVRhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qSe7C-00FTSn-2Q; Sun, 06 Aug 2023 13:48:14 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qSe7A-00FTRR-0m for linux-arm-kernel@lists.infradead.org; Sun, 06 Aug 2023 13:48:13 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-977e0fbd742so503638066b.2 for ; Sun, 06 Aug 2023 06:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691329690; x=1691934490; 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=j+Xsg9YY5Dq6KDm40Wq5sVdBaVtBYpXspCdRFB3jlUc=; b=cW1U6kol2AVYOcg2TqCC4Wew5k3K69d4xm1LCQ8g2gzInHi8Q2Eh2pcMazj/ZOYgeu EBjYTMj4HzMlW8M8JU4cgRq4JaNek6tYN5E7NtM9g3nBHPwbBnRn4OcZRzQNFPz3YFfa BuATZYDVCYVI39obMpAT/vkiZy2u0X7EI4vqqqeBdEZ64UGGJVwu4I8TCBwUr4SfY/Nf 9QLSCpnVtc53LjzACQNojWDzAOcAk7TC3zzR+3AWuVgOvLiXL9VEZ4kQuumZerXRdjno 4IGQUCcvj8sn4jKvtJwND/UmNn7MVlUjNhkNzxEX+nSrHmIV3frjaN+wgGkESy3k17oW NDjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691329690; x=1691934490; 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=j+Xsg9YY5Dq6KDm40Wq5sVdBaVtBYpXspCdRFB3jlUc=; b=EVkubcSOMFLPMionFyZUWAX4TlifR78Wf8W5mUTBxJUGLFzAMXAJM0zNqPegiUsbvR fmIOPQzj1xmugXcA4Klj2iH8pcZCCKKuFv/uhcegqTNYq5+K827kjrZivAingJED9F2D 0tgrfaI6HdRwQa8OcitfmZgOV0l+im+fEpJwaNQoY8Jx0R+9zuxHmbudkSzjtR5KQOaD OmSGmcc3rM8UPLikAjqGWN9ompkaVzUBvVWTFbze9OiDK8QHqlTyDvtYPUTtge0Pr6gN u7t1g2312jEay2iubS9pt2vHQTP7Q8F4l9niCSOh5YAkJMHzLhUTrDHNQVQHS5d/s1Pq Bbtg== X-Gm-Message-State: AOJu0Yzb1hzwhwkj8dN7OX45YScQTQp6wntgPHg82kUc1+oXvIR+nWAX Hv+GvjvUtX9M6094S2zzOCs= X-Google-Smtp-Source: AGHT+IEIvAXs0DV7ge7oOrAiLcptXmsCx2UmaHjaSTPXZOkGHv+2G25/3DKb5m3MRtq98l+13U/scQ== X-Received: by 2002:a17:906:3082:b0:99b:f4fa:805f with SMTP id 2-20020a170906308200b0099bf4fa805fmr5782462ejv.28.1691329690189; Sun, 06 Aug 2023 06:48:10 -0700 (PDT) Received: from jernej-laptop.localnet (82-149-1-233.dynamic.telemach.net. [82.149.1.233]) by smtp.gmail.com with ESMTPSA id r13-20020a170906704d00b0098e34446464sm3946765ejj.25.2023.08.06.06.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Aug 2023 06:48:09 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Maxime Ripard , Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Samuel Holland , Andre Przywara , Roman Beranek , Frank Oltmanns Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Frank Oltmanns Subject: Re: [PATCH v5 10/11] clk: sunxi-ng: a64: select closest rate for pll-video0 Date: Sun, 06 Aug 2023 15:48:08 +0200 Message-ID: <2162023.Icojqenx9y@jernej-laptop> In-Reply-To: <20230806-pll-mipi_set_rate_parent-v5-10-db4f5ca33fc3@oltmanns.dev> References: <20230806-pll-mipi_set_rate_parent-v5-0-db4f5ca33fc3@oltmanns.dev> <20230806-pll-mipi_set_rate_parent-v5-10-db4f5ca33fc3@oltmanns.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230806_064812_349879_ED791A91 X-CRM114-Status: GOOD ( 18.22 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Dne nedelja, 06. avgust 2023 ob 15:06:55 CEST je Frank Oltmanns napisal(a): > Selecting the closest rate for pll-video0 instead of the closest rate > that is less than the requested rate has no downside for this clock, > while allowing for selecting a more suitable rate, e.g. for the > connected panels. > > Furthermore, the algorithm that sets an NKM clock's parent benefits from > the closest rate. Without it, the NKM clock's rate might drift away from > the requested rate in the multiple successive calls to > ccu_nkm_determine_rate that the clk framework performs when setting a > clock rate. > > Therefore, configure pll-video0 and, in consequence, all of its > descendents to select the closest rate. > > Acked-by: Maxime Ripard > Signed-off-by: Frank Oltmanns Reviewed-by: Jernej Skrabec Best regards, Jernej > --- > drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 33 > ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 > deletions(-) > > diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c > b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c index a139a5c438d4..73c84d20f3ee > 100644 > --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c > +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c > @@ -68,7 +68,7 @@ static SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, > "pll-audio-base", BIT(28), /* lock */ > CLK_SET_RATE_UNGATE); > > -static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX(pll_video0_clk, > "pll-video0", +static > SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, > "pll-video0", "osc24M", 0x010, > 192000000, /* Minimum rate */ > 1008000000, /* Maximum rate */ > @@ -181,6 +181,7 @@ static struct ccu_nkm pll_mipi_clk = { > .hw.init = CLK_HW_INIT("pll-mipi", "pll-video0", > &ccu_nkm_ops, > CLK_SET_RATE_UNGATE | CLK_SET_RATE_PARENT), > + .features = CCU_FEATURE_CLOSEST_RATE, > }, > }; > > @@ -531,24 +532,18 @@ static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", > de_parents, > > static const char * const tcon0_parents[] = { "pll-mipi", "pll-video0-2x" > }; static const u8 tcon0_table[] = { 0, 2, }; > -static SUNXI_CCU_MUX_TABLE_WITH_GATE(tcon0_clk, "tcon0", tcon0_parents, > +static SUNXI_CCU_MUX_TABLE_WITH_GATE_CLOSEST(tcon0_clk, "tcon0", > tcon0_parents, tcon0_table, 0x118, 24, 3, BIT(31), > CLK_SET_RATE_PARENT); > > static const char * const tcon1_parents[] = { "pll-video0", "pll-video1" }; > static const u8 tcon1_table[] = { 0, 2, }; > -static struct ccu_div tcon1_clk = { > - .enable = BIT(31), > - .div = _SUNXI_CCU_DIV(0, 4), > - .mux = _SUNXI_CCU_MUX_TABLE(24, 2, tcon1_table), > - .common = { > - .reg = 0x11c, > - .hw.init = CLK_HW_INIT_PARENTS("tcon1", > - tcon1_parents, > - &ccu_div_ops, > - CLK_SET_RATE_PARENT), > - }, > -}; > +static SUNXI_CCU_M_WITH_MUX_TABLE_GATE_CLOSEST(tcon1_clk, "tcon1", > tcon1_parents, + tcon1_table, 0x11c, > + 0, 4, /* M */ > + 24, 2, /* mux */ > + BIT(31), /* gate */ > + CLK_SET_RATE_PARENT); > > static const char * const deinterlace_parents[] = { "pll-periph0", > "pll-periph1" }; static SUNXI_CCU_M_WITH_MUX_GATE(deinterlace_clk, > "deinterlace", deinterlace_parents, @@ -578,8 +573,8 @@ static > SUNXI_CCU_GATE(avs_clk, "avs", "osc24M", 0x144, BIT(31), 0); > > static const char * const hdmi_parents[] = { "pll-video0", "pll-video1" }; > -static SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", hdmi_parents, > - 0x150, 0, 4, 24, 2, BIT(31), CLK_SET_RATE_PARENT); > +static SUNXI_CCU_M_WITH_MUX_GATE_CLOSEST(hdmi_clk, "hdmi", hdmi_parents, > + 0x150, 0, 4, 24, 2, BIT(31), CLK_SET_RATE_PARENT); > > static SUNXI_CCU_GATE(hdmi_ddc_clk, "hdmi-ddc", "osc24M", > 0x154, BIT(31), 0); > @@ -591,9 +586,9 @@ static SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", > mbus_parents, > > static const char * const dsi_dphy_parents[] = { "pll-video0", > "pll-periph0" }; static const u8 dsi_dphy_table[] = { 0, 2, }; > -static SUNXI_CCU_M_WITH_MUX_TABLE_GATE(dsi_dphy_clk, "dsi-dphy", > - dsi_dphy_parents, dsi_dphy_table, > - 0x168, 0, 4, 8, 2, BIT(15), CLK_SET_RATE_PARENT); > +static SUNXI_CCU_M_WITH_MUX_TABLE_GATE_CLOSEST(dsi_dphy_clk, "dsi-dphy", > + dsi_dphy_parents, dsi_dphy_table, > + 0x168, 0, 4, 8, 2, BIT(15), CLK_SET_RATE_PARENT); > > static SUNXI_CCU_M_WITH_GATE(gpu_clk, "gpu", "pll-gpu", > 0x1a0, 0, 3, BIT(31), CLK_SET_RATE_PARENT); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel