Skip to content

Commit 7be56b6

Browse files
committed
driver: Choose brightness function according to bit width
MIPI panels with 16-bit brightness communicate it in big endian, while the original brightness functions handle it in little endian. For 16-bit brightness, variants of these functions should be used. Use these variants for panels with a maximum brightness greater than or equal to 256 (more than 8 bits), while still using the original function for 8-bit (max < 256) brightness. Link: https://lore.kernel.org/dri-devel/[email protected]/ Signed-off-by: Richard Acayan <[email protected]>
1 parent 518c67b commit 7be56b6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

driver.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ def generate_backlight(p: Panel, options: Options) -> str:
235235
if p.max_brightness > 255:
236236
brightness_mask = ''
237237

238+
brightness_variant = ''
239+
if p.max_brightness > 255:
240+
brightness_variant = '_large'
241+
238242
s = f'''\
239243
static int {p.short_id}_bl_update_status(struct backlight_device *bl)
240244
{{
@@ -256,7 +260,7 @@ def generate_backlight(p: Panel, options: Options) -> str:
256260
s += f'''
257261
dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
258262
259-
ret = mipi_dsi_dcs_set_display_brightness(dsi, brightness);
263+
ret = mipi_dsi_dcs_set_display_brightness{brightness_variant}(dsi, brightness);
260264
if (ret < 0)
261265
return ret;
262266
@@ -278,7 +282,7 @@ def generate_backlight(p: Panel, options: Options) -> str:
278282
279283
dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
280284
281-
ret = mipi_dsi_dcs_get_display_brightness(dsi, &brightness);
285+
ret = mipi_dsi_dcs_get_display_brightness{brightness_variant}(dsi, &brightness);
282286
if (ret < 0)
283287
return ret;
284288

0 commit comments

Comments
 (0)