Skip to content

Commit eeda150

Browse files
aford173gregkh
authored andcommitted
drm/bridge: adv7533: Fix adv7533_mode_valid for adv7533 and adv7535
[ Upstream commit ee0285e ] When dynamically switching lanes was removed, the intent of the code was to check to make sure that higher speed items used 4 lanes, but it had the unintended consequence of removing the slower speeds for 4-lane users. This attempts to remedy this by doing a check to see that the max frequency doesn't exceed the chip limit, and a second check to make sure that the max bit-rate doesn't exceed the number of lanes * max bit rate / lane. Fixes: 9a0cdcd ("drm/bridge: adv7533: remove dynamic lane switching from adv7533 bridge") Reviewed-by: Robert Foss <rfoss@kernel.org> Signed-off-by: Adam Ford <aford173@gmail.com> Signed-off-by: Robert Foss <rfoss@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230319125524.58803-1-aford173@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c63b5ea commit eeda150

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

drivers/gpu/drm/bridge/adv7511/adv7533.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,19 @@ void adv7533_dsi_power_off(struct adv7511 *adv)
103103
enum drm_mode_status adv7533_mode_valid(struct adv7511 *adv,
104104
const struct drm_display_mode *mode)
105105
{
106-
int lanes;
106+
unsigned long max_lane_freq;
107107
struct mipi_dsi_device *dsi = adv->dsi;
108+
u8 bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
108109

109-
if (mode->clock > 80000)
110-
lanes = 4;
111-
else
112-
lanes = 3;
113-
114-
/*
115-
* TODO: add support for dynamic switching of lanes
116-
* by using the bridge pre_enable() op . Till then filter
117-
* out the modes which shall need different number of lanes
118-
* than what was configured in the device tree.
119-
*/
120-
if (lanes != dsi->lanes)
121-
return MODE_BAD;
110+
/* Check max clock for either 7533 or 7535 */
111+
if (mode->clock > (adv->type == ADV7533 ? 80000 : 148500))
112+
return MODE_CLOCK_HIGH;
113+
114+
/* Check max clock for each lane */
115+
max_lane_freq = (adv->type == ADV7533 ? 800000 : 891000);
116+
117+
if (mode->clock * bpp > max_lane_freq * adv->num_dsi_lanes)
118+
return MODE_CLOCK_HIGH;
122119

123120
return MODE_OK;
124121
}

0 commit comments

Comments
 (0)