Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2510339lqt; Mon, 22 Apr 2024 12:48:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCViEKpFmldGa/6PYdCs2778uXES+GO/m1h2zyPp4ZiRw53tAAIskPTRZwnFLRBTZNxZklWLvZxuZM3G6PXQEkd07JqEUDUy/UgJt8aw0w== X-Google-Smtp-Source: AGHT+IGK7bDqFzGEnkJxlO6+WfmmtgGuxam8T753EEgWoy8uviicmA47CHZmT4VDyFAFFdSA3I+9 X-Received: by 2002:a17:902:d581:b0:1e9:9ffb:85b1 with SMTP id k1-20020a170902d58100b001e99ffb85b1mr5498719plh.41.1713815324348; Mon, 22 Apr 2024 12:48:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713815324; cv=pass; d=google.com; s=arc-20160816; b=WIPU0Kv36uXEIPFM5cfBkgo9Bk1h1pMi/SZC6wsd3cyx7UqtDbFXxMh8mzE22WC7a6 MNFVeMbqYrnzPjQ3v6tHu0jx6FBq4LMCo3ZQbXguQ71uUEtlUA42Z69NB0sHDP78Xivt s07WpAi+dQoluAhKkiDAdlhBaw+TEDf/8fA48gL+smfPAneqcTeahmDsCstOUsq7V5l5 CoXz7pnxe8ddN6FcNnEDSU8cLCQ0j/65vPhU1MUi0/hJeG9Qx4R5vwiPM8fRF+KwSNGh lIilGlgRMwxg0Smw+4kNNL1QjnS9qo9zwkOT782pKw30B+KVhnUk1K/fqHIFWa7ulZlC oZJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=d6DTcCkviDP0v1O7ttuxDHJ02Adt5DLSxBw0N/2grEc=; fh=Rgujh6R7IRxW4UtyLIfJtBFQxYvkK2un5d9bHYP5EiA=; b=W40VjNfC48sMFRDFQ33dKDvyQfTEL2oxOjYDmI1MPw14VswcgaQJqr+MeepBw3BTc2 zivdrRKSCWd/yrW6l07hLm1kTjW9ohQlNPMkWC9XQSsnervugJWukst+G3o1grNsUvQR lXunFtpSnSxZ1aUddqoKegldUU8527GhA65xDMjdxqAUcwG+E+t6iLy9GNw7KgCtbnwS vS9JSmVsF6UVCsuMqHqp8Mg2JZpndeqW8vM3gIMPghckAHQX6S/F7vfzbxYNJdJjpFdt qXx4OeMS5GU8eD7M5p6LkhlfXGhiDuwolhdMQJbiKAXM4JvVMicBqVa0qx1y8NMMDtzP TFDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=FAgAEY2V; arc=pass (i=1 spf=pass spfdomain=denx.de dkim=pass dkdomain=denx.de dmarc=pass fromdomain=denx.de); spf=pass (google.com: domain of linux-kernel+bounces-153940-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153940-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=denx.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f12-20020a170902684c00b001e0d65a7fcbsi7989238pln.631.2024.04.22.12.48.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 12:48:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153940-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=FAgAEY2V; arc=pass (i=1 spf=pass spfdomain=denx.de dkim=pass dkdomain=denx.de dmarc=pass fromdomain=denx.de); spf=pass (google.com: domain of linux-kernel+bounces-153940-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153940-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=denx.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F35B9281869 for ; Mon, 22 Apr 2024 19:48:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD983155356; Mon, 22 Apr 2024 19:48:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.b="FAgAEY2V" Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA7AC154453 for ; Mon, 22 Apr 2024 19:48:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=85.214.62.61 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713815316; cv=none; b=Jp2EHT97RUoskZSwPextT2R7sUxIoeMQ6xJ9BbUSiBXzbnnpi7JgRbm+nEJ95biSkdeNzHB/YSK0CwYtfJfCCeI5/clrQL2OlVKrtq6Jm7CW1TFgP3MqXL0Nyrd0MqmrzesseusPhA9PLRyjyE4HUzE3uzleADWNDhJq6VB6GQM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713815316; c=relaxed/simple; bh=tJsTWMos/KbnhOL3mT5W+BoEa4DAfoSFZEU1tL6Mmqg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MvVXyw+6m6xiWe98KgKNl67Uy82Uf0YVglIhX0V2DSu/vaJwnIoAZbGQHn9/SrE4qDA5c1Y0yobRQfm4am6C+09Au26VXn4wg6BEU0yu+SZ5KapBYfZ/rVDmyF80GI70xBBBb8tZrO+yc9rf/8lB92sVZXoh4hXDUhAszVGmObA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=denx.de; spf=pass smtp.mailfrom=denx.de; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.b=FAgAEY2V; arc=none smtp.client-ip=85.214.62.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=denx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=denx.de Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 264E2889CE; Mon, 22 Apr 2024 21:48:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1713815313; bh=d6DTcCkviDP0v1O7ttuxDHJ02Adt5DLSxBw0N/2grEc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=FAgAEY2V9WPgM2z1fh7FrcvgPCb7VGCTa6eJqNa6fO4umeCVtnVEYMFKXllD9mzjT 1py8nC1swpmWJl3FZ8NfACOdoCgrNAFfsbtkdphoXIUl3aLyZutfCwluwTHplJY1kD bmP3nOF43K1ZCn4/p5NfS8TpG8udK/uqVMTiZgz95jRy7xWxCCAONny6AHG7iq3e+Q WdWFOec2qMBMXieCwlVrr3npE5SQTo4+VRDm2JegwnOnXHGbu9liZQq72bbSEUN78H xGBLsYNapWiH7rbSkSFRnFxDENRf7O6nbsr6bX1PvLxuLydpQDWovUuFGC8Md0L5nX 9oVYktCpH9sYA== Message-ID: <75006c7a-34e4-40a6-9336-b1e2e2d966d4@denx.de> Date: Mon, 22 Apr 2024 21:43:13 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V2 2/2] drm/bridge: samsung-dsim: Fix porch calcalcuation rounding To: Adam Ford Cc: dri-devel@lists.freedesktop.org, aford@beaconembedded.com, 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 , Marco Felsch , Michael Tretter , linux-kernel@vger.kernel.org References: <20240211230931.188194-1-aford173@gmail.com> <20240211230931.188194-2-aford173@gmail.com> <6111fe04-4ecb-428e-9a0c-dc02cadfe3e7@denx.de> <47b26a19-9aba-4380-9d05-f06bd8bc20b1@denx.de> Content-Language: en-US From: Marek Vasut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On 4/22/24 3:04 PM, Adam Ford wrote: > On Mon, Apr 22, 2024 at 8:01 AM Marek Vasut wrote: >> >> On 4/22/24 2:09 PM, Adam Ford wrote: >>> On Sun, Apr 21, 2024 at 9:36 AM Marek Vasut wrote: >>>> >>>> On 2/12/24 12:09 AM, Adam Ford wrote: >>>>> 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 >>>>> --- >>>>> V2: No changes >>>>> >>>>> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c >>>>> index 8476650c477c..52939211fe93 100644 >>>>> --- a/drivers/gpu/drm/bridge/samsung-dsim.c >>>>> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c >>>>> @@ -1606,6 +1606,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) { >>>> >>>> Does this also apply to mode with sync events (I suspect it does), so >>>> the condition here should likely be if (!...burst mode) , right ? >>> >>> Thanks for the review! >>> >>> I was only able to test it with the DSI->ADV6535 bridge, and I'll >>> admit I don't know a lot about DSI interface since I don't have a copy >>> of the spec to read. >>> >>> Are you proposing this should be: >>> >>> if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) && dsi->lanes > 1) { >>> >>> I just want to make sure I understand what you're requesting. >> >> Yes, exactly this. > > Do you think it should also include checks for > MIPI_DSI_MODE_VIDEO_NO_HFP, MIPI_DSI_MODE_VIDEO_NO_HBP or > MIPI_DSI_MODE_VIDEO_NO_HSA? > > It seems like if any of these are set, we should skip this rounding stuff. Now that you ask this question, shouldn't this actually apply unconditionally , no matter which mode is in use ?