From patchwork Mon Aug 11 10:56:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Masney X-Patchwork-Id: 1254 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 E665A28C024 for ; Mon, 11 Aug 2025 10:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754909811; cv=none; b=d5vFD8027ZF+L16hFcWAaKkL/isn0rWhDBcH8kK3TM+3nS9JT+DguRS0k0lPmvENrXtupeMxZS0L4UmPnSUwD4BP5nfpWwPQfUxJ0u3ePezseNp3wGIJwp9qWYQz0HCXvXFs1CkAmUOe08F7rTwUVFYWLdWfmqsinL9QkAzoemY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754909811; c=relaxed/simple; bh=TQX7y0WLJPoT2FXW3ljOONLbYB3hMMDCH4wBpr8HvE4=; h=From:Date:Subject:MIME-Version:Message-Id:References:In-Reply-To: To:Cc:Content-Type; b=Kl/vADmFwfLmnEXESDiH9A68fXDpQZCIcnEB3xegwJJawNqSX2ywDmMS/gj2jp9X8C1jBzlMNEmCfUkwvk2Q653Ef9hL/nwOEsjSjgerYvbu32Frx92/AWn89tySoEko6XRFTKnxol2amdai5vfdfzdL0uChrS70ajM3aex6oOM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JxyH2NLM; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JxyH2NLM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1754909808; 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=fe1/zFdrNglpQdcc7DcZ0ub2lnvduP/lEo2aekbxLh4=; b=JxyH2NLM6rCFUYRYUd0H/na4W/KeEI81Z9a/ypUPJ4oM9nR8OOx5FanmE8tsbDgy6K8rPD b/ExwlOjIo5xFGVvIOv6O8DJ7J2wScHaIPio42FF0sySFdqJn8z+pxcs0rd/wJ8RFkpI3e QRI+XyXJvHWUaKjGACfgnqSi2hwbV2s= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-214-HjKUHbPePFqwXE8MIf6KFQ-1; Mon, 11 Aug 2025 06:56:45 -0400 X-MC-Unique: HjKUHbPePFqwXE8MIf6KFQ-1 X-Mimecast-MFC-AGG-ID: HjKUHbPePFqwXE8MIf6KFQ_1754909805 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4b0de38c71fso7806571cf.3 for ; Mon, 11 Aug 2025 03:56:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754909805; x=1755514605; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fe1/zFdrNglpQdcc7DcZ0ub2lnvduP/lEo2aekbxLh4=; b=nEL8AL9r7yA4j2mgVuoF1KMOiIKVy9GTzzCrDWQ+e4M3xHf0hRc6mZWvK7S8ARGhSQ 0aj3tIS3r5abwceLLMCc+0vW131Se5aH1HHD9GcDwKVZXNLyxKXh6C8cobXrPtJl1yr1 /gCU5NU4r7H2LvOcXy2cDBrKXvSw6JIEEoz5pmVPLZHFZIftQVYynd29fE8YfcXmak5V EbCM4Q13srBpY/Z+/vfc3cI02net5ExYbz9YEw9/2AzulpbXSdExBweBWrWaIYiu3Ubo AjpDXJzXkQKZN6lHdPka/gkPFknnY3xMBWQXyKhAZO3CW1b+pySliNrUOVjtoMXleXcb iBEA== X-Forwarded-Encrypted: i=1; AJvYcCUg9FUTRpk4iOI9k18sqFv4o2XYWnisR0/O4VRDAjHAb0QG4sivM09UX7pLjQOlMwxOAbwPiYXSrIHPQQ==@lists.linux.dev X-Gm-Message-State: AOJu0YwvgUxgoYa6aNE1Zxr5f5ole2MGaRBKk0CdyjAzkR+v/3g81A25 mxrx5Z9oL2snwVk0EhFmBHU9W7OAMm+3pL9twuk0I//+9EPnLkpnf5S/qqr2wgeUhZR7m5FlIQ6 AjuqYwrqgdWkpA1IhDgYgAB6PudpDM662pqclE7vlBZ3MPtzrM6oilPYTGXk/botM X-Gm-Gg: ASbGnctCvOCVAlOs8d+v7eySaqfRn5Ih5ra4uDxQV4CarfrZCFkzzflhTY0gerhHJMB MtzBeDF8t/73pc0AE8HolEJgz3boTuFhWQ27ycVGOkxQvncO/1OyIYXfcA1123Q6kJalvsDu2+c QDfAPnYgbgJimeDZbyE9gi55T2HNyu4F7clJlQUHmUjcjR+zzbrq+X9vhltKa/I4bkR4B2iVdDV FaeAPjfghC9kRVvFn1scWajJ60DF82ao6zOi8Jl26w96NOdXQmUPmtj8dqSUiFLYMUHBnmLopQx F4c2uIuZfq7LH82TX4z5Dt62RtteTBEdp1R9pdD9Yom7SHgk5As+GAHtUyS64oPuQ6amTatoLCY MNYA= X-Received: by 2002:a05:622a:164b:b0:4ab:81c7:b992 with SMTP id d75a77b69052e-4b0aee0416fmr177626441cf.41.1754909805221; Mon, 11 Aug 2025 03:56:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH84pkBd6GJf8XCR9+s0wYsjRXbW3CjMG1+xiMebELRnnC0y+m6C0KXWBUqdNOSAQDFJQ+q/g== X-Received: by 2002:a05:622a:164b:b0:4ab:81c7:b992 with SMTP id d75a77b69052e-4b0aee0416fmr177626021cf.41.1754909804709; Mon, 11 Aug 2025 03:56:44 -0700 (PDT) Received: from [192.168.1.15] (c-73-183-52-120.hsd1.pa.comcast.net. [73.183.52.120]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7e698de2df7sm1273446485a.80.2025.08.11.03.56.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Aug 2025 03:56:44 -0700 (PDT) From: Brian Masney Date: Mon, 11 Aug 2025 06:56:10 -0400 Subject: [PATCH v2 6/9] drm/stm/dw_mipi_dsi-stm: convert from round_rate() to determine_rate() Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250811-drm-clk-round-rate-v2-6-4a91ccf239cf@redhat.com> References: <20250811-drm-clk-round-rate-v2-0-4a91ccf239cf@redhat.com> In-Reply-To: <20250811-drm-clk-round-rate-v2-0-4a91ccf239cf@redhat.com> To: Philipp Zabel , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Linus Walleij , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , Yannick Fertre , Raphael Gallais-Pou , Philippe Cornu , Maxime Coquelin , Alexandre Torgue , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Stephen Boyd Cc: linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-stm32@st-md-mailman.stormreply.com, linux-sunxi@lists.linux.dev, Brian Masney X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1754909781; l=2470; i=bmasney@redhat.com; s=20250528; h=from:subject:message-id; bh=TQX7y0WLJPoT2FXW3ljOONLbYB3hMMDCH4wBpr8HvE4=; b=lgrz8b1APu4kFbIpIygfaPAMyZa9PSq0qCqlA9d2JnXNchMfPplzKOoa7IYJs93TVO9unUYBZ Y9qrAO5hmIoCqBBrlG0p/QgoeneH78eck1EdJ9ad2HPr3tup0+0Nd5I X-Developer-Key: i=bmasney@redhat.com; a=ed25519; pk=x20f2BQYftANnik+wvlm4HqLqAlNs/npfVcbhHPOK2U= X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: opfjkC4EMVczsVoe_AAJwiQBLqOMBhVTcqz1ncn8AG8_1754909805 X-Mimecast-Originator: redhat.com Status: O The round_rate() clk ops is deprecated, so migrate this driver from round_rate() to determine_rate() using the Coccinelle semantic patch on the cover letter of this series. Acked-by: Raphael Gallais-Pou Signed-off-by: Brian Masney --- drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c index 2c7bc064bc66c6a58903a207cbe8091a14231c2b..58eae6804cc82d174323744206be7046568b905c 100644 --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c @@ -274,8 +274,8 @@ static unsigned long dw_mipi_dsi_clk_recalc_rate(struct clk_hw *hw, return (unsigned long)pll_out_khz * 1000; } -static long dw_mipi_dsi_clk_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int dw_mipi_dsi_clk_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct dw_mipi_dsi_stm *dsi = clk_to_dw_mipi_dsi_stm(hw); unsigned int idf, ndiv, odf, pll_in_khz, pll_out_khz; @@ -283,14 +283,14 @@ static long dw_mipi_dsi_clk_round_rate(struct clk_hw *hw, unsigned long rate, DRM_DEBUG_DRIVER("\n"); - pll_in_khz = (unsigned int)(*parent_rate / 1000); + pll_in_khz = (unsigned int)(req->best_parent_rate / 1000); /* Compute best pll parameters */ idf = 0; ndiv = 0; odf = 0; - ret = dsi_pll_get_params(dsi, pll_in_khz, rate / 1000, + ret = dsi_pll_get_params(dsi, pll_in_khz, req->rate / 1000, &idf, &ndiv, &odf); if (ret) DRM_WARN("Warning dsi_pll_get_params(): bad params\n"); @@ -298,7 +298,9 @@ static long dw_mipi_dsi_clk_round_rate(struct clk_hw *hw, unsigned long rate, /* Get the adjusted pll out value */ pll_out_khz = dsi_pll_get_clkout_khz(pll_in_khz, idf, ndiv, odf); - return pll_out_khz * 1000; + req->rate = pll_out_khz * 1000; + + return 0; } static int dw_mipi_dsi_clk_set_rate(struct clk_hw *hw, unsigned long rate, @@ -351,7 +353,7 @@ static const struct clk_ops dw_mipi_dsi_stm_clk_ops = { .disable = dw_mipi_dsi_clk_disable, .is_enabled = dw_mipi_dsi_clk_is_enabled, .recalc_rate = dw_mipi_dsi_clk_recalc_rate, - .round_rate = dw_mipi_dsi_clk_round_rate, + .determine_rate = dw_mipi_dsi_clk_determine_rate, .set_rate = dw_mipi_dsi_clk_set_rate, };