Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp1655615rwe; Sat, 15 Apr 2023 03:42:27 -0700 (PDT) X-Google-Smtp-Source: AKy350Yq1oPHYCw6xKuZnigEJ3MVWjL2FWTe0/Y8iBpLAqGKANuyqZXDMnAGowJVhic6frBu8/Wk X-Received: by 2002:a17:90a:b88c:b0:246:b973:de35 with SMTP id o12-20020a17090ab88c00b00246b973de35mr8659023pjr.4.1681555347725; Sat, 15 Apr 2023 03:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681555347; cv=none; d=google.com; s=arc-20160816; b=fMNIIdA/qVVWIDWEFPOJbvjSH/myvhJVY5qt42+9xTrv331jER+55bAotx8xCUFa23 WkWYaWVatqNIxCQNgdM902Ny7l11CObaD5BeRDeOFRlNRAFCZ2lbUckp3Cu9rAkeqDr+ +bnWKC0XZeWOqVh0VAPKHWsD169kxxC8kOGMt12hqckAAdRjZJfzOXtq88QnC6rLjZ1r 16K08rzl7aUu3u/hFSgLTDDhifNDLlWzrf/lHekaNwa14dSxeVWJYZM0d8z9mZtbcfsA cB69P9cuXtUAY1VFrypDxQGtOYr6XigPB/CpAytqiGx2zTDv/LC8X46ZqA19k11xG4X7 hRow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dtFFKmwY6AVZaivGUGeBXmlxV0WshHisjIf4olqGXlk=; b=nqf+XLUk5PeuE3XfB3wJyU9D4xoWHEYqrMTJGBNRNo5Ar8qJJY6OMN3vcRA1QypvKN bBHzpXdzR5JBdLMbR8gDKO9WTMZwLDDtjFhSuoa6Fz2g/nKjgyA4jh+K2KZlgOsFTmK0 b9MG0cUcnQ6JGyqrGAq0LxQ/LfBJXFNfpFgD8Ch1ZXDXPuz/Ru9VMxxLMdbw4yEvU0kO MqyrE/rLh4k/bY+0tk8grZJrGtl8qq8jChiFWQe66AqXGSm3gdglQS5y4JyAo3x85S8q q8DFjsQf8orjKAAUjWqhkuJ241n9PPZt6wZ+xAshfYjTakkD6WUT84qcJ8V6QFBZB7+E wtGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="oL6X1i8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i71-20020a63874a000000b0050f66d4e070si4762207pge.417.2023.04.15.03.42.16; Sat, 15 Apr 2023 03:42:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="oL6X1i8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229924AbjDOKlj (ORCPT + 99 others); Sat, 15 Apr 2023 06:41:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbjDOKl1 (ORCPT ); Sat, 15 Apr 2023 06:41:27 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8C915B93; Sat, 15 Apr 2023 03:41:24 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-760c5522520so79413939f.2; Sat, 15 Apr 2023 03:41:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681555284; x=1684147284; 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=dtFFKmwY6AVZaivGUGeBXmlxV0WshHisjIf4olqGXlk=; b=oL6X1i8/kjCWm/1yiymDM94a0njyMbG9HTxP6ejrDG7ZtExirgBlCbJ0hJrZEL0w20 nuhCPKvLwSDiQ14eICBJgwALXNAeZT404BHs1u9WKpHsUVZJyCeLHpCFthF0uiaFAnS2 Zu7wBi42hG7hRgKlP9BwSgxVY/kX4j31smJWTVlmcL9KfbTR8RQvNNbIWus0nM47u0iL COZC6yOIDhepC15FBWAId35YzFu2uZt2gqEOLpfzvP0AwZ67Fk/XxaVh4m6j0SFP8F7m 1BdnNafSJs1yK1VQnsmvS3G178egs+eeAie4bDJyPGXCZHTYRc/UdZ25dwN2bQiMFcGW IVDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681555284; x=1684147284; 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=dtFFKmwY6AVZaivGUGeBXmlxV0WshHisjIf4olqGXlk=; b=eJaFCMniBmhCukurqqromx9ZEpZgZb+rPvSwr6yenKzbM/7Rb2wJFwYrfXdJXJYtl5 aayB1qfSZjuYPkkl0wqwiIdbPgGH3SKGl2bLntpNkFl3x6fh7PKdVKbO0V/8D3kwRCdh Vfe674/yHZGUKHmM206YuMuoQ5i0ozVZtTU4+3CQvF/JX0rq7I69E204Cpu7CSVAIcpE LxR+w+htVnfWHt5OeQ2ol7RqR7/rbPpMhZIzDshtqp0WsREZETmmZa/wP+dRtw/FW/wG dp4qE8Igqyx10aEn6dLsRfmZbySxm5O3UpUTT6aymBSrVqmkKWp7kqf7VEdQrCzhLbkz KNpw== X-Gm-Message-State: AAQBX9fxkFVQKKYreMOIgZDL5GISxaCNcpINqA/rVsqTpC438uI/RYoF jnDAcUAl6vDLEzkDHi0QNfc= X-Received: by 2002:a92:d690:0:b0:326:2bb3:5f9a with SMTP id p16-20020a92d690000000b003262bb35f9amr6437030iln.6.1681555283888; Sat, 15 Apr 2023 03:41:23 -0700 (PDT) Received: from aford-B741.lan ([2601:447:d001:897f:40bb:6fe6:ddbc:cc9a]) by smtp.gmail.com with ESMTPSA id bp11-20020a056638440b00b0040b38102b79sm246536jab.82.2023.04.15.03.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 03:41:23 -0700 (PDT) From: Adam Ford To: dri-devel@lists.freedesktop.org Cc: m.szyprowski@samsung.com, marex@denx.de, aford@beaconembedded.com, Adam Ford , Rob Herring , Krzysztof Kozlowski , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Inki Dae , Jagan Teki , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Frieder Schrempf , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] drm: bridge: samsung-dsim: Support non-burst mode Date: Sat, 15 Apr 2023 05:41:02 -0500 Message-Id: <20230415104104.5537-5-aford173@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230415104104.5537-1-aford173@gmail.com> References: <20230415104104.5537-1-aford173@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The high-speed clock is hard-coded to the burst-clock frequency specified in the device tree. However, when using devices like certain bridge chips without burst mode and varying resolutions and refresh rates, it may be necessary to set the high-speed clock dynamically based on the desired pixel clock for the connected device. Signed-off-by: Adam Ford --- drivers/gpu/drm/bridge/samsung-dsim.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index c48db27adafe..5aa3a44f15ec 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -659,11 +659,21 @@ static unsigned long samsung_dsim_set_pll(struct samsung_dsim *dsi, static int samsung_dsim_enable_clock(struct samsung_dsim *dsi) { - unsigned long hs_clk, byte_clk, esc_clk; + unsigned long hs_clk, byte_clk, esc_clk, pix_clk; unsigned long esc_div; u32 reg; + struct drm_display_mode *m = &dsi->mode; + int bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); + + /* m->clock is in KHz */ + pix_clk = m->clock * 1000; + + /* Use burst_clk_rate for burst mode, otherwise use the pix_clk */ + if ((dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) && dsi->burst_clk_rate) + hs_clk = samsung_dsim_set_pll(dsi, dsi->burst_clk_rate); + else + hs_clk = samsung_dsim_set_pll(dsi, DIV_ROUND_UP(pix_clk * bpp, dsi->lanes)); - hs_clk = samsung_dsim_set_pll(dsi, dsi->burst_clk_rate); if (!hs_clk) { dev_err(dsi->dev, "failed to configure DSI PLL\n"); return -EFAULT; -- 2.39.2