linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <Alexander.Levin@microsoft.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Andrey Gusakov <andrey.gusakov@cogentembedded.com>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Sasha Levin <Alexander.Levin@microsoft.com>
Subject: [PATCH AUTOSEL for 4.14 083/100] drm/bridge: tc358767: fix timing calculations
Date: Wed, 24 Jan 2018 04:15:08 +0000	[thread overview]
Message-ID: <20180124041414.32065-83-alexander.levin@microsoft.com> (raw)
In-Reply-To: <20180124041414.32065-1-alexander.levin@microsoft.com>

From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>

[ Upstream commit 66d1c3b94d5d59e4325e61a78d520f92c043d645 ]

Fields in HTIM01 and HTIM02 regs should be even.
Recomended thresh_dly value is max_tu_symbol.
Remove set of VPCTRL0.VSDELAY as it is related to DSI input
interface. Currently driver supports only DPI.

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1510073785-16108-5-git-send-email-andrey.gusakov@cogentembedded.com
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
---
 drivers/gpu/drm/bridge/tc358767.c | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index 7334cb2121a3..b916346b933a 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -659,6 +659,14 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)
 	int lower_margin = mode->vsync_start - mode->vdisplay;
 	int vsync_len = mode->vsync_end - mode->vsync_start;
 
+	/*
+	 * Recommended maximum number of symbols transferred in a transfer unit:
+	 * DIV_ROUND_UP((input active video bandwidth in bytes) * tu_size,
+	 *              (output active video bandwidth in bytes))
+	 * Must be less than tu_size.
+	 */
+	max_tu_symbol = TU_SIZE_RECOMMENDED - 1;
+
 	dev_dbg(tc->dev, "set mode %dx%d\n",
 		mode->hdisplay, mode->vdisplay);
 	dev_dbg(tc->dev, "H margin %d,%d sync %d\n",
@@ -668,13 +676,18 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)
 	dev_dbg(tc->dev, "total: %dx%d\n", mode->htotal, mode->vtotal);
 
 
-	/* LCD Ctl Frame Size */
-	tc_write(VPCTRL0, (0x40 << 20) /* VSDELAY */ |
+	/*
+	 * LCD Ctl Frame Size
+	 * datasheet is not clear of vsdelay in case of DPI
+	 * assume we do not need any delay when DPI is a source of
+	 * sync signals
+	 */
+	tc_write(VPCTRL0, (0 << 20) /* VSDELAY */ |
 		 OPXLFMT_RGB888 | FRMSYNC_DISABLED | MSF_DISABLED);
-	tc_write(HTIM01, (left_margin << 16) |		/* H back porch */
-			 (hsync_len << 0));		/* Hsync */
-	tc_write(HTIM02, (right_margin << 16) |		/* H front porch */
-			 (mode->hdisplay << 0));	/* width */
+	tc_write(HTIM01, (ALIGN(left_margin, 2) << 16) | /* H back porch */
+			 (ALIGN(hsync_len, 2) << 0));	 /* Hsync */
+	tc_write(HTIM02, (ALIGN(right_margin, 2) << 16) |  /* H front porch */
+			 (ALIGN(mode->hdisplay, 2) << 0)); /* width */
 	tc_write(VTIM01, (upper_margin << 16) |		/* V back porch */
 			 (vsync_len << 0));		/* Vsync */
 	tc_write(VTIM02, (lower_margin << 16) |		/* V front porch */
@@ -693,7 +706,7 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)
 	/* DP Main Stream Attributes */
 	vid_sync_dly = hsync_len + left_margin + mode->hdisplay;
 	tc_write(DP0_VIDSYNCDELAY,
-		 (0x003e << 16) |	/* thresh_dly */
+		 (max_tu_symbol << 16) |	/* thresh_dly */
 		 (vid_sync_dly << 0));
 
 	tc_write(DP0_TOTALVAL, (mode->vtotal << 16) | (mode->htotal));
@@ -709,13 +722,6 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)
 	tc_write(DPIPXLFMT, VS_POL_ACTIVE_LOW | HS_POL_ACTIVE_LOW |
 		 DE_POL_ACTIVE_HIGH | SUB_CFG_TYPE_CONFIG1 | DPI_BPP_RGB888);
 
-	/*
-	 * Recommended maximum number of symbols transferred in a transfer unit:
-	 * DIV_ROUND_UP((input active video bandwidth in bytes) * tu_size,
-	 *              (output active video bandwidth in bytes))
-	 * Must be less than tu_size.
-	 */
-	max_tu_symbol = TU_SIZE_RECOMMENDED - 1;
 	tc_write(DP0_MISC, (max_tu_symbol << 23) | (TU_SIZE_RECOMMENDED << 16) |
 			   BPC_8);
 
-- 
2.11.0

  parent reply	other threads:[~2018-01-24  4:48 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24  4:14 [PATCH AUTOSEL for 4.14 001/100] drm/vc4: Account for interrupts in flight Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 002/100] btrfs: Fix transaction abort during failure in btrfs_rm_dev_item Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 003/100] Btrfs: bail out gracefully rather than BUG_ON Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 004/100] cpupowerutils: bench - Fix cpu online check Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 005/100] cpupower : Fix cpupower working when cpu0 is offline Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 006/100] KVM: nVMX/nSVM: Don't intercept #UD when running L2 Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 007/100] KVM: x86: emulator: Return to user-mode on L1 CPL=0 emulation failure Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 009/100] KVM: X86: Fix operand/address-size during instruction decoding Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 008/100] KVM: x86: Don't re-execute instruction when not passing CR2 value Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 010/100] KVM: nVMX: Fix mmu context after VMLAUNCH/VMRESUME failure Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 012/100] KVM: x86: ioapic: Fix level-triggered EOI and IOAPIC reconfigure race Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 011/100] KVM: x86: fix em_fxstor() sleeping while in atomic Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 014/100] KVM: x86: ioapic: Preserve read-only values in the redirection table Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 013/100] KVM: x86: ioapic: Clear Remote IRR when entry is switched to edge-triggered Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 015/100] KVM: nVMX: Fix vmx_check_nested_events() return value in case an event was reinjected to L2 Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 016/100] KVM: x86: Fix CPUID function for word 6 (80000001_ECX) Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 017/100] nvme-fabrics: introduce init command check for a queue that is not alive Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 019/100] nvme-loop: check if queue is ready in queue_rq Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 018/100] nvme-fc: " Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 020/100] nvme-pci: disable APST on Samsung SSD 960 EVO + ASUS PRIME B350M-A Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 022/100] nvmet-fc: correct ref counting error when deferred rcv used Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 021/100] nvme-pci: avoid hmb desc array idx out-of-bound when hmmaxd set Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 024/100] s390/zcrypt: Fix wrong comparison leading to strange load balancing Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 023/100] s390/topology: fix compile error in file arch/s390/kernel/smp.c Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 025/100] ACPI / bus: Leave modalias empty for devices which are not present Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 027/100] null_blk: fix dev->badblocks leak Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 026/100] cpufreq: Add Loongson machine dependencies Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 029/100] rxrpc: The mutex lock returned by rxrpc_accept_call() needs releasing Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 028/100] s390: fix alloc_pgste check in init_new_context again Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 031/100] rxrpc: Fix service endpoint expiry Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 030/100] rxrpc: Provide a different lockdep key for call->user_mutex for kernel calls Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 032/100] bcache: check return value of register_shrinker Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 033/100] drm/amdgpu: Fix SDMA load/unload sequence on HWS disabled mode Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 034/100] drm/amdkfd: Fix SDMA ring buffer size calculation Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 035/100] drm/amdkfd: Fix SDMA oversubsription handling Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 036/100] uapi: fix linux/kfd_ioctl.h userspace compilation errors Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 037/100] nvme-rdma: don't complete requests before a send work request has completed Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 038/100] openvswitch: fix the incorrect flow action alloc size Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 039/100] drm/rockchip: dw-mipi-dsi: fix possible un-balanced runtime PM enable Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 040/100] mac80211: use QoS NDP for AP probing Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 041/100] mac80211: fix the update of path metric for RANN frame Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 043/100] sctp: only allow the asoc reset when the asoc outq is empty Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 042/100] btrfs: fix deadlock when writing out space cache Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 044/100] sctp: avoid flushing unsent queue when doing asoc reset Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 045/100] sctp: set sender next_tsn for the old result with ctsn_ack_point plus 1 Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 047/100] KVM: X86: Fix softlockup when get the current kvmclock Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 046/100] reiserfs: remove unneeded i_version bump Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 048/100] KVM: VMX: Fix rflags cache during vCPU reset Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 050/100] KVM: Let KVM_SET_SIGNAL_MASK work as advertised Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 049/100] Btrfs: fix list_add corruption and soft lockups in fsync Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 051/100] xfs: always free inline data before resetting inode fork during ifree Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 052/100] xfs: log recovery should replay deferred ops in order Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 053/100] i2c: i2c-boardinfo: fix memory leaks on devinfo Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 054/100] xen-netfront: remove warning when unloading module Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 055/100] auxdisplay: img-ascii-lcd: Only build on archs that have IOMEM Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 057/100] nfsd: Ensure we don't recognise lock stateids after freeing them Sasha Levin
2018-01-24 15:47   ` J. Bruce Fields
2018-01-24 17:28     ` Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 056/100] nfsd: CLOSE SHOULD return the invalid special stateid for NFSv4.x (x>0) Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 058/100] nfsd: Ensure we check stateid validity in the seqid operation checks Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 059/100] grace: replace BUG_ON by WARN_ONCE in exit_net hook Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 061/100] race of lockd inetaddr notifiers vs nlmsvc_rqst change Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 060/100] nfsd: check for use of the closed special stateid Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 062/100] lockd: fix "list_add double add" caused by legacy signal interface Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 063/100] hwmon: (pmbus) Use 64bit math for DIRECT format values Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 064/100] quota: propagate error from __dquot_initialize Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 066/100] net: mvpp2: do not disable GMAC padding Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 065/100] net: mvpp2: fix the txq_init error path Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 067/100] net: phy: marvell10g: fix the PHY id mask Sasha Levin
2018-01-24  4:14 ` [PATCH AUTOSEL for 4.14 068/100] bnxt_en: Fix an error handling path in 'bnxt_get_module_eeprom()' Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 069/100] Btrfs: incremental send, fix wrong unlink path after renaming file Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 070/100] nvme-pci: fix NULL pointer dereference in nvme_free_host_mem() Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 072/100] drm/amdgpu: don't try to move pinned BOs Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 071/100] xfs: fortify xfs_alloc_buftarg error handling Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 073/100] net: ethernet: xilinx: Mark XILINX_LL_TEMAC broken on 64-bit Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 074/100] quota: Check for register_shrinker() failure Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 075/100] SUNRPC: Allow connect to return EHOSTUNREACH Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 077/100] fs/mbcache.c: make count_objects() more robust Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 076/100] scripts/faddr2line: extend usage on generic arch Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 078/100] kmemleak: add scheduling point to kmemleak_scan() Sasha Levin
2018-01-24  7:46   ` Yisheng Xie
2018-01-24 17:24     ` Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 079/100] drm/bridge: Fix lvds-encoder since the panel_bridge rework Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 080/100] drm/bridge: tc358767: do no fail on hi-res displays Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 082/100] drm/bridge: tc358767: fix DP0_MISC register set Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 081/100] drm/bridge: tc358767: filter out too high modes Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 084/100] drm/bridge: tc358767: fix AUXDATAn registers access Sasha Levin
2018-01-24  4:15 ` Sasha Levin [this message]
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 085/100] drm/bridge: tc358767: fix 1-lane behavior Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 086/100] drm/omap: Fix error handling path in 'omap_dmm_probe()' Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 087/100] drm/omap: displays: panel-dpi: add backlight dependency Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 088/100] xfs: ubsan fixes Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 089/100] xfs: Properly retry failed dquot items in case of error during buffer writeback Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 091/100] scsi: aacraid: Prevent crash in case of free interrupt during scsi EH path Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 090/100] perf/core: Fix memory leak triggered by perf --namespace Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 092/100] scsi: ufs: ufshcd: fix potential NULL pointer dereference in ufshcd_config_vreg Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 093/100] iwlwifi: mvm: fix the TX queue hang timeout for MONITOR vif type Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 094/100] iwlwifi: fix access to prph when transport is stopped Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 096/100] ARM: dts: NSP: Fix PPI interrupt types Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 095/100] ARM: dts: NSP: Disable AHCI controller for HR NSP boards Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 097/100] media: usbtv: add a new usbid Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 098/100] x86/xen: Support early interrupts in xen pv guests Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 099/100] usb: gadget: don't dereference g until after it has been null checked Sasha Levin
2018-01-24  4:15 ` [PATCH AUTOSEL for 4.14 100/100] staging: rtl8188eu: Fix incorrect response to SIOCGIWESSID Sasha Levin
2018-01-25  3:30 ` [PATCH AUTOSEL for 4.14 001/100] drm/vc4: Account for interrupts in flight Eric Anholt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180124041414.32065-83-alexander.levin@microsoft.com \
    --to=alexander.levin@microsoft.com \
    --cc=a.hajda@samsung.com \
    --cc=andrey.gusakov@cogentembedded.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).