Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4396715rdb; Mon, 11 Dec 2023 19:33:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJ/yb3x8JENxLXmpE9BEEFVUE61UhoEes0EiUay6lXUMuWLArAwb7QxqwT/CVvcDxJGCeS X-Received: by 2002:a05:6a20:3d93:b0:190:5faf:ea71 with SMTP id s19-20020a056a203d9300b001905fafea71mr6892122pzi.49.1702352013857; Mon, 11 Dec 2023 19:33:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702352013; cv=none; d=google.com; s=arc-20160816; b=njAxWTeu5NYMWb13bNAS4PbdauxLnfdn/EapetaEIHt2CiZ4NHvN4r9H/cQeg980UT 2rI1PCXbkiGdi2l9xsNIsblIsFTltaA47cnL40LPlovDF25KrMHRHG+7d2m+vUDvKp/r 0QKxEIAyX4Iymm33prACIM+gX3gnZweemWky761bN8uDnsnmHMMdN8+mTzUroEcJaGyp kyVxBxW0/KJ7is5ZRhbHaZRIHKKmw2oEWYLzI/YDMG5EPrL8N+/Wm99USmHWvfxFwiu1 KqdnTbAQTGD1MlGEjtVK8T0U9oOvQwJU7+s5m0A+HwsczPXaggtrzDCqbE9BHH9r84i7 OzcA== 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=nYInYE6vgyZ8xggSLq7h777qBlps2bVu+HQMH76x0n0=; fh=9VTGxy7dmFtvjNXbJI8jvBMy/4r8PRlLrFbMT19D6hU=; b=QpsMFj4gKzLjgXbOp4AYo3j57FiF/1kHzxCoj4lnqadi2WvUfLwB53ITmrEkL/hIN2 1CXJEacL3FY3jksfi39HTEeb3U3PinZaJ2+4bGhuR7EddpQrVJDZ5LwQPmMpt15bzT0M kHTP8qUo5hbJzHbB1WnDes20Dcdc7bNPGKfLf20RvDZWUaaQJnBXv9XmNwgE40Af/1dr Dg1xVYYJ5sfszz+tDE8XtSBPobo0cHzDNxH+RgHOB3V+g6oclCcrmcHzShUFkGPLpJsg sp87wUzsIUvWOtp7RnRhVc1tGixOe3eEHO4rDPCCplz76tpw/RuIc5g2hmtVHwc4d2D7 fy3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PlZ5rd0I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id h16-20020a656390000000b005b86142ee56si6816107pgv.277.2023.12.11.19.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 19:33:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PlZ5rd0I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 474B3809FA18; Mon, 11 Dec 2023 19:33:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345863AbjLLDdP (ORCPT + 99 others); Mon, 11 Dec 2023 22:33:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbjLLDdN (ORCPT ); Mon, 11 Dec 2023 22:33:13 -0500 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD811B3 for ; Mon, 11 Dec 2023 19:33:16 -0800 (PST) Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-7b70de199f6so141209639f.2 for ; Mon, 11 Dec 2023 19:33:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702351996; x=1702956796; darn=vger.kernel.org; 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=nYInYE6vgyZ8xggSLq7h777qBlps2bVu+HQMH76x0n0=; b=PlZ5rd0IhGJ/2tsh47RU7PeKgHw9f8gjT9AWvlikDH8j7OlOMGe6BWu0KrZ76o37WP SOBnhNFQ2tCHZ2i8F2skYXEqjLtVowWaX/QkAhSZZ8XlyChOZk48OXN/bSkeQz9v8mdU hTui88FsIyRZmBjqIa13xdPLBhvkqyJeiwxA7XPC29unGCAhY8lGeYx3Yngcq1NoQ/ha CCEnW1090eR2h2c5NHoVWAwSMAqREnvu9OvrvklCnHVX6Th/dbeM3FKXSpDNrzu41xaB LZYNaM+TQsYWywfZgUOY1tpoCD9P4iCQXnYOy1I651vebebb1mtND8tma0eH6DNcjPGX 7tuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702351996; x=1702956796; 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=nYInYE6vgyZ8xggSLq7h777qBlps2bVu+HQMH76x0n0=; b=V6gelAQZ0JlJzNg3fHAQ3S4f17R/AgnX/KkAPDUrke3i0hG++AlaE4r2UtkN9gkWZA eDRmfAaibrRuzq1/R2KxNCbF+e+BMFyYqQMZxL32PVC8N8vqRH7g3WVl2n2x9d4FCyNj mrDxHAhVvFpiilPLj6jezY8h2RhOpmYxWdpHnHeq4r46yr8e3+yoZ+dj7lPI/DGqrHHZ cjqOgv/mWH6KX8eWKl1a4nqm7UMy0YCtOA3Hh3MvP8amEzGYfkHNVhokrL4MXbAukH+a Lu5IIcdi+MFLyRbE6xHsLQu04dgJgAdOklbfuSvMInAmWBhAqjkrIAkGPE4432m2Mf1p 191g== X-Gm-Message-State: AOJu0YwaJQgNuJEjs+5Geu0AmNunKYLx4ixC+/53/CybD1NJ0bOV1qX/ j02QaT34vNXGp8AE+deQ40I= X-Received: by 2002:a5e:a916:0:b0:7b7:19e3:a645 with SMTP id c22-20020a5ea916000000b007b719e3a645mr5176094iod.20.1702351995800; Mon, 11 Dec 2023 19:33:15 -0800 (PST) Received: from aford-System-Version.lan ([2601:447:d002:5be:6068:4690:ab38:4373]) by smtp.gmail.com with ESMTPSA id y23-20020a5e8717000000b007b457153a6bsm2590049ioj.28.2023.12.11.19.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 19:33:15 -0800 (PST) From: Adam Ford To: dri-devel@lists.freedesktop.org Cc: aford@beaconembedded.com, Adam Ford , Frieder Schrempf , Inki Dae , Jagan Teki , Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Michael Tretter , Marco Felsch , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] drm/bridge: samsung-dsim: Fix porch calcalcuation rounding Date: Mon, 11 Dec 2023 21:32:59 -0600 Message-Id: <20231212033259.189718-2-aford173@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231212033259.189718-1-aford173@gmail.com> References: <20231212033259.189718-1-aford173@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 11 Dec 2023 19:33:31 -0800 (PST) When using video sync pulses, the HFP, HBP, and HSA are divided between the available lanes if there is more than one lane. For certain timings and lane configurations, the HFP may not be evenly divisible. If the HFP is rounded down, it ends up being too small which can cause some monitors to not sync properly. In these instances, adjust htotal and hsync to round the HFP up, and recalculate the htotal. Tested-by: Frieder Schrempf # Kontron BL i.MX8MM with HDMI monitor Signed-off-by: Adam Ford diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 239d253a7d71..f5795da1d8bb 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1628,6 +1628,27 @@ static int samsung_dsim_atomic_check(struct drm_bridge *bridge, adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); } + /* + * When using video sync pulses, the HFP, HBP, and HSA are divided between + * the available lanes if there is more than one lane. For certain + * timings and lane configurations, the HFP may not be evenly divisible. + * If the HFP is rounded down, it ends up being too small which can cause + * some monitors to not sync properly. In these instances, adjust htotal + * and hsync to round the HFP up, and recalculate the htotal. Through trial + * and error, it appears that the HBP and HSA do not appearto need the same + * correction that HFP does. + */ + if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE && dsi->lanes > 1) { + int hfp = adjusted_mode->hsync_start - adjusted_mode->hdisplay; + int remainder = hfp % dsi->lanes; + + if (remainder) { + adjusted_mode->hsync_start += remainder; + adjusted_mode->hsync_end += remainder; + adjusted_mode->htotal += remainder; + } + } + return 0; } -- 2.40.1