Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm/dsi: Simplify the code to get the number of read byte

During cmd rx, only new versions of H/W provide register to read back
the real number of byte returned by panel. For the old versions, reading
this register will not get the right number. In fact, we only need to
assume the returned data is the same size as we expected, because later
we will check the data type to detect error.

Signed-off-by: Hai Li <hali@codeaurora.org>

authored by

Hai Li and committed by
Rob Clark
ec1936eb 6f6b2879

+4 -10
+4 -10
drivers/gpu/drm/msm/dsi/dsi_host.c
··· 1093 1093 { 1094 1094 u32 *lp, *temp, data; 1095 1095 int i, j = 0, cnt; 1096 - bool ack_error = false; 1097 1096 u32 read_cnt; 1098 1097 u8 reg[16]; 1099 1098 int repeated_bytes = 0; ··· 1104 1105 if (cnt > 4) 1105 1106 cnt = 4; /* 4 x 32 bits registers only */ 1106 1107 1107 - /* Calculate real read data count */ 1108 - read_cnt = dsi_read(msm_host, 0x1d4) >> 16; 1109 - 1110 - ack_error = (rx_byte == 4) ? 1111 - (read_cnt == 8) : /* short pkt + 4-byte error pkt */ 1112 - (read_cnt == (pkt_size + 6 + 4)); /* long pkt+4-byte error pkt*/ 1113 - 1114 - if (ack_error) 1115 - read_cnt -= 4; /* Remove 4 byte error pkt */ 1108 + if (rx_byte == 4) 1109 + read_cnt = 4; 1110 + else 1111 + read_cnt = pkt_size + 6; 1116 1112 1117 1113 /* 1118 1114 * In case of multiple reads from the panel, after the first read, there