From 94e0855d93f184e42af7319c5ae0c47ace94b84f Mon Sep 17 00:00:00 2001 From: prokrypt Date: Thu, 17 Aug 2023 18:26:57 -0700 Subject: [PATCH 01/13] Enable dithering along with toggle --- sharp.dts | 2 +- src/drm_iface.c | 69 ++++++++++++++++++++++++++++++++++++++++++++-- src/params_iface.c | 4 +++ src/params_iface.h | 1 + 4 files changed, 72 insertions(+), 4 deletions(-) diff --git a/sharp.dts b/sharp.dts index 2e16032..4ec16e8 100644 --- a/sharp.dts +++ b/sharp.dts @@ -53,7 +53,7 @@ disp-gpios = <&gpio 22 0>; spi-cs-high = <1>; - spi-max-frequency = <8000000>; + spi-max-frequency = <2000000>; buswidth = <8>; debug = <0>; }; diff --git a/src/drm_iface.c b/src/drm_iface.c index 1014905..120bcd9 100644 --- a/src/drm_iface.c +++ b/src/drm_iface.c @@ -38,6 +38,13 @@ #define CMD_WRITE_LINE 0b10000000 #define CMD_CLEAR_SCREEN 0b00100000 +static int ditherMatrix[4][4] = { + { 15, 195, 60, 240 }, + { 135, 75, 180, 120 }, + { 45, 225, 30, 210 }, + { 165, 105, 150, 90 } +}; + struct sharp_memory_panel { struct drm_device drm; struct drm_simple_display_pipe pipe; @@ -177,6 +184,56 @@ static void draw_indicators(struct sharp_memory_panel *panel, u8* buf, int width } } +static size_t sharp_memory_gray8_to_mono_tagged_dither(u8 *buf, int width, int height, int y0) +{ + int line, b8, b1; + unsigned char d; + int const tagged_line_len = 2 + width / 8; + + // Iterate over lines from [0, height) + for (line = 0; line < height; line++) { + + // Iterate over chunks of 8 source grayscale bytes + // Each 8-byte source chunk will map to one destination mono byte + for (b8 = 0; b8 < width; b8 += 8) { + d = 0; + + // Iterate over each of the 8 grayscale bytes in the chunk + // Build up the destination mono byte + for (b1 = 0; b1 < 8; b1++) { + + // Apply dithering + if (buf[(line * width) + b8 + b1] >= ditherMatrix[((line * width) + b8 + b1) % 4][line % 4]) { + d |= 0b10000000 >> b1; + } + } + + // Apply inversion + if (g_param_mono_invert) { + d = ~d; + } + + // Without the line number and trailer tags, each destination + // mono line would have a length `width / 8`. However, we are + // inserting the line number at the beginning of the line and + // the zero-byte trailer at the end. + // So the destination mono line is at index + // `line * tagged_line_len = line * (2 + width / 8)` + // The destination mono byte is offset by 1 to make room for + // the line tag, written at the end of converting the current + // line. + buf[(line * tagged_line_len) + 1 + (b8 / 8)] = d; + } + + // Write the line number and trailer tags + buf[line * tagged_line_len] = sharp_memory_reverse_byte((u8)(y0 + 1)); // Indexed from 1 + buf[(line * tagged_line_len) + tagged_line_len - 1] = 0; + y0++; + } + + return height * tagged_line_len; +} + static size_t sharp_memory_gray8_to_mono_tagged(u8 *buf, int width, int height, int y0) { int line, b8, b1; @@ -265,9 +322,15 @@ static int sharp_memory_clip_mono_tagged(struct sharp_memory_panel* panel, size_ } } - // Convert in-place from 8-bit grayscale to mono - *result_len = sharp_memory_gray8_to_mono_tagged(buf, - (clip->x2 - clip->x1), (clip->y2 - clip->y1), clip->y1); + if (g_param_dither) { + // Convert in-place from 8-bit grayscale to dithered mono + *result_len = sharp_memory_gray8_to_mono_tagged_dither(buf, + (clip->x2 - clip->x1), (clip->y2 - clip->y1), clip->y1); + } else { + // Convert in-place from 8-bit grayscale to mono + *result_len = sharp_memory_gray8_to_mono_tagged(buf, + (clip->x2 - clip->x1), (clip->y2 - clip->y1), clip->y1); + } // Success return 0; diff --git a/src/params_iface.c b/src/params_iface.c index 630a933..59de37c 100644 --- a/src/params_iface.c +++ b/src/params_iface.c @@ -8,6 +8,7 @@ int g_param_mono_cutoff = 32; int g_param_mono_invert = 0; int g_param_indicators = 1; +int g_param_dither = 0; static int set_param_u8(const char *val, const struct kernel_param *kp) { @@ -41,6 +42,9 @@ MODULE_PARM_DESC(mono_invert, "0 for no inversion, 1 for inversion"); module_param_cb(indicators, &u8_param_ops, &g_param_indicators, 0660); MODULE_PARM_DESC(indicators, "0 for no indicators, 1 for indicators"); +module_param_cb(dither, &u8_param_ops, &g_param_mono_cutoff, 0660); +MODULE_PARM_DESC(dither, "0 for no dithering, 1 for dithering"); + int params_probe(void) { return 0; diff --git a/src/params_iface.h b/src/params_iface.h index 2d15730..80d8029 100644 --- a/src/params_iface.h +++ b/src/params_iface.h @@ -4,6 +4,7 @@ extern int g_param_mono_cutoff; extern int g_param_mono_invert; extern int g_param_indicators; +extern int g_param_dither; int params_probe(void); void params_remove(void); From 3fa8406394749d7c8dac31f894276d2022e134e3 Mon Sep 17 00:00:00 2001 From: prokrypt Date: Thu, 17 Aug 2023 18:33:06 -0700 Subject: [PATCH 02/13] Oops I edit bad --- src/params_iface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/params_iface.c b/src/params_iface.c index 59de37c..57ed10d 100644 --- a/src/params_iface.c +++ b/src/params_iface.c @@ -42,7 +42,7 @@ MODULE_PARM_DESC(mono_invert, "0 for no inversion, 1 for inversion"); module_param_cb(indicators, &u8_param_ops, &g_param_indicators, 0660); MODULE_PARM_DESC(indicators, "0 for no indicators, 1 for indicators"); -module_param_cb(dither, &u8_param_ops, &g_param_mono_cutoff, 0660); +module_param_cb(dither, &u8_param_ops, &g_param_dither, 0660); MODULE_PARM_DESC(dither, "0 for no dithering, 1 for dithering"); int params_probe(void) From 5020f2b389ac15e5f3f75f0bfab63d9d2af015cb Mon Sep 17 00:00:00 2001 From: prokrypt Date: Thu, 17 Aug 2023 18:59:07 -0700 Subject: [PATCH 03/13] SPI speed 2MHz->3MHz. Trying to strike balance between stability and refresh rate --- sharp.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sharp.dts b/sharp.dts index 4ec16e8..e303b18 100644 --- a/sharp.dts +++ b/sharp.dts @@ -53,7 +53,7 @@ disp-gpios = <&gpio 22 0>; spi-cs-high = <1>; - spi-max-frequency = <2000000>; + spi-max-frequency = <3000000>; buswidth = <8>; debug = <0>; }; From eaae0311448b3b15747b6b05d304d2c30708a024 Mon Sep 17 00:00:00 2001 From: prokrypt Date: Thu, 17 Aug 2023 19:50:52 -0700 Subject: [PATCH 04/13] Add more dithering options --- src/drm_iface.c | 21 +++++++++++++++++++-- src/params_iface.c | 3 ++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/drm_iface.c b/src/drm_iface.c index 120bcd9..aa88949 100644 --- a/src/drm_iface.c +++ b/src/drm_iface.c @@ -38,7 +38,17 @@ #define CMD_WRITE_LINE 0b10000000 #define CMD_CLEAR_SCREEN 0b00100000 -static int ditherMatrix[4][4] = { +static int ditherMatrix1[2][2] = { + { 128, 179 }, + { 204, 153 }, +}; + +static int ditherMatrix2[2][2] = { + { 51, 204 }, + { 153, 102 }, +}; + +static int ditherMatrix4[4][4] = { { 15, 195, 60, 240 }, { 135, 75, 180, 120 }, { 45, 225, 30, 210 }, @@ -203,7 +213,14 @@ static size_t sharp_memory_gray8_to_mono_tagged_dither(u8 *buf, int width, int h for (b1 = 0; b1 < 8; b1++) { // Apply dithering - if (buf[(line * width) + b8 + b1] >= ditherMatrix[((line * width) + b8 + b1) % 4][line % 4]) { + if (g_param_dither == 1) { + if (buf[(line * width) + b8 + b1] >= ditherMatrix1[((line * width) + b8 + b1) % 2][line % 2]) + d |= 0b10000000 >> b1; + } else if (g_param_dither == 2) { + if (buf[(line * width) + b8 + b1] >= ditherMatrix2[((line * width) + b8 + b1) % 2][line % 2]) + d |= 0b10000000 >> b1; + } else { + if (buf[(line * width) + b8 + b1] >= ditherMatrix4[((line * width) + b8 + b1) % 4][line % 4]) d |= 0b10000000 >> b1; } } diff --git a/src/params_iface.c b/src/params_iface.c index 57ed10d..765051f 100644 --- a/src/params_iface.c +++ b/src/params_iface.c @@ -43,7 +43,8 @@ module_param_cb(indicators, &u8_param_ops, &g_param_indicators, 0660); MODULE_PARM_DESC(indicators, "0 for no indicators, 1 for indicators"); module_param_cb(dither, &u8_param_ops, &g_param_dither, 0660); -MODULE_PARM_DESC(dither, "0 for no dithering, 1 for dithering"); +MODULE_PARM_DESC(dither, + "0 for no dithering, 1 for limited 2x2 dithering, 2 for full range 2x2, 3 for 4x4"); int params_probe(void) { From 6391446a775d8e47fc1344011bcbd7e560618c6d Mon Sep 17 00:00:00 2001 From: prokrypt Date: Thu, 17 Aug 2023 19:52:13 -0700 Subject: [PATCH 05/13] Disable refresh on parameter change for stability --- src/params_iface.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/params_iface.c b/src/params_iface.c index 765051f..3bc9d3b 100644 --- a/src/params_iface.c +++ b/src/params_iface.c @@ -21,8 +21,8 @@ static int set_param_u8(const char *val, const struct kernel_param *kp) rc = param_set_int(val, kp); - // Refresh framebuffer - (void)drm_refresh(); + // Refresh framebuffer (disabled for stability) + //(void)drm_refresh(); return rc; } @@ -60,6 +60,6 @@ void params_set_mono_invert(int setting) { g_param_mono_invert = setting; - // Refresh framebuffer - (void)drm_refresh(); + // Refresh framebuffer (disabled for stability) + //(void)drm_refresh(); } From fc218e2d0a33efbf63b6898c5aabc30d7a5de991 Mon Sep 17 00:00:00 2001 From: prokrypt Date: Thu, 17 Aug 2023 20:19:51 -0700 Subject: [PATCH 06/13] More dithering options --- src/drm_iface.c | 17 +++++++++++++++++ src/params_iface.c | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/drm_iface.c b/src/drm_iface.c index aa88949..e0456dc 100644 --- a/src/drm_iface.c +++ b/src/drm_iface.c @@ -38,16 +38,30 @@ #define CMD_WRITE_LINE 0b10000000 #define CMD_CLEAR_SCREEN 0b00100000 +/* static int ditherMatrix1[2][2] = { { 128, 179 }, { 204, 153 }, }; +*/ + +static int ditherMatrix1[2][2] = { + { 1, 154 }, + { 103, 52 }, +}; static int ditherMatrix2[2][2] = { { 51, 204 }, { 153, 102 }, }; +static int ditherMatrix3[4][4] = { + { 1, 83, 21, 103 }, + { 123, 42, 143, 62 }, + { 32, 113, 11, 93 }, + { 154, 72, 134, 52 } +}; + static int ditherMatrix4[4][4] = { { 15, 195, 60, 240 }, { 135, 75, 180, 120 }, @@ -219,6 +233,9 @@ static size_t sharp_memory_gray8_to_mono_tagged_dither(u8 *buf, int width, int h } else if (g_param_dither == 2) { if (buf[(line * width) + b8 + b1] >= ditherMatrix2[((line * width) + b8 + b1) % 2][line % 2]) d |= 0b10000000 >> b1; + } else if (g_param_dither == 3) { + if (buf[(line * width) + b8 + b1] >= ditherMatrix3[((line * width) + b8 + b1) % 4][line % 4]) + d |= 0b10000000 >> b1; } else { if (buf[(line * width) + b8 + b1] >= ditherMatrix4[((line * width) + b8 + b1) % 4][line % 4]) d |= 0b10000000 >> b1; diff --git a/src/params_iface.c b/src/params_iface.c index 3bc9d3b..880b674 100644 --- a/src/params_iface.c +++ b/src/params_iface.c @@ -44,7 +44,7 @@ MODULE_PARM_DESC(indicators, "0 for no indicators, 1 for indicators"); module_param_cb(dither, &u8_param_ops, &g_param_dither, 0660); MODULE_PARM_DESC(dither, - "0 for no dithering, 1 for limited 2x2 dithering, 2 for full range 2x2, 3 for 4x4"); + "0: no dithering, 1: limited 2x2, 3: full 2x2, 3: limited 4x4, 4: full 4x4"); int params_probe(void) { From a9e9266c42d05ce6232c659915d31deb48497411 Mon Sep 17 00:00:00 2001 From: prokrypt Date: Thu, 17 Aug 2023 20:32:42 -0700 Subject: [PATCH 07/13] Code formatting... --- src/drm_iface.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/drm_iface.c b/src/drm_iface.c index e0456dc..d628567 100644 --- a/src/drm_iface.c +++ b/src/drm_iface.c @@ -40,30 +40,30 @@ /* static int ditherMatrix1[2][2] = { - { 128, 179 }, + { 128, 179 }, { 204, 153 }, }; */ static int ditherMatrix1[2][2] = { - { 1, 154 }, + { 1, 154 }, { 103, 52 }, }; static int ditherMatrix2[2][2] = { - { 51, 204 }, + { 51, 204 }, { 153, 102 }, }; static int ditherMatrix3[4][4] = { - { 1, 83, 21, 103 }, + { 1, 83, 21, 103 }, { 123, 42, 143, 62 }, { 32, 113, 11, 93 }, { 154, 72, 134, 52 } }; static int ditherMatrix4[4][4] = { - { 15, 195, 60, 240 }, + { 15, 195, 60, 240 }, { 135, 75, 180, 120 }, { 45, 225, 30, 210 }, { 165, 105, 150, 90 } From 65215a17b8498cee8c5b1ea74d7695fcf5590d37 Mon Sep 17 00:00:00 2001 From: prokrypt Date: Fri, 18 Aug 2023 12:08:17 -0700 Subject: [PATCH 08/13] Initial attempt at code cleanup/optimization --- src/drm_iface.c | 60 ++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/src/drm_iface.c b/src/drm_iface.c index d628567..765fb30 100644 --- a/src/drm_iface.c +++ b/src/drm_iface.c @@ -38,35 +38,28 @@ #define CMD_WRITE_LINE 0b10000000 #define CMD_CLEAR_SCREEN 0b00100000 -/* -static int ditherMatrix1[2][2] = { - { 128, 179 }, - { 204, 153 }, -}; -*/ - -static int ditherMatrix1[2][2] = { - { 1, 154 }, - { 103, 52 }, +static int ditherMatrix1[4] = { + 1, 154, + 103, 52 }; -static int ditherMatrix2[2][2] = { - { 51, 204 }, - { 153, 102 }, +static int ditherMatrix2[4] = { + 51, 204, + 153, 102 }; -static int ditherMatrix3[4][4] = { - { 1, 83, 21, 103 }, - { 123, 42, 143, 62 }, - { 32, 113, 11, 93 }, - { 154, 72, 134, 52 } +static int ditherMatrix3[16] = { + 1, 83, 21, 103, + 123, 42, 143, 62, + 32, 113, 11, 93, + 154, 72, 134, 52 }; -static int ditherMatrix4[4][4] = { - { 15, 195, 60, 240 }, - { 135, 75, 180, 120 }, - { 45, 225, 30, 210 }, - { 165, 105, 150, 90 } +static int ditherMatrix4[16] = { + 15, 195, 60, 240, + 135, 75, 180, 120, + 45, 225, 30, 210, + 165, 105, 150, 90 }; struct sharp_memory_panel { @@ -210,10 +203,21 @@ static void draw_indicators(struct sharp_memory_panel *panel, u8* buf, int width static size_t sharp_memory_gray8_to_mono_tagged_dither(u8 *buf, int width, int height, int y0) { - int line, b8, b1; + int line, b8, b1, msize, *dM; unsigned char d; int const tagged_line_len = 2 + width / 8; + if (g_param_dither == 1) { + *dM=ditherMatrix1; + } else if (g_param_dither == 2) { + *dM=ditherMatrix2; + } else if (g_param_dither == 3) { + *dM=ditherMatrix3; + } else { + *dM=ditherMatrix4; + } + msize=sizeof(dM); + // Iterate over lines from [0, height) for (line = 0; line < height; line++) { @@ -228,16 +232,16 @@ static size_t sharp_memory_gray8_to_mono_tagged_dither(u8 *buf, int width, int h // Apply dithering if (g_param_dither == 1) { - if (buf[(line * width) + b8 + b1] >= ditherMatrix1[((line * width) + b8 + b1) % 2][line % 2]) + if (buf[line * width + b8 + b1] >= ditherMatrix1[(b8 + b1) % 2 + line % 2 * 2]) d |= 0b10000000 >> b1; } else if (g_param_dither == 2) { - if (buf[(line * width) + b8 + b1] >= ditherMatrix2[((line * width) + b8 + b1) % 2][line % 2]) + if (buf[line * width + b8 + b1] >= ditherMatrix2[(b8 + b1) % 2 + line % 2 * 2]) d |= 0b10000000 >> b1; } else if (g_param_dither == 3) { - if (buf[(line * width) + b8 + b1] >= ditherMatrix3[((line * width) + b8 + b1) % 4][line % 4]) + if (buf[line * width + b8 + b1] >= ditherMatrix3[(b8 + b1) % 4 + line % 4 * 4]) d |= 0b10000000 >> b1; } else { - if (buf[(line * width) + b8 + b1] >= ditherMatrix4[((line * width) + b8 + b1) % 4][line % 4]) + if (buf[line * width + b8 + b1] >= ditherMatrix4[(b8 + b1) % 4 + line % 4 * 4]) d |= 0b10000000 >> b1; } } From 881497a4acfe3a35c30cf38a627f432373f1f856 Mon Sep 17 00:00:00 2001 From: prokrypt Date: Fri, 18 Aug 2023 13:19:42 -0700 Subject: [PATCH 09/13] Oops forgot some stuff --- src/drm_iface.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/drm_iface.c b/src/drm_iface.c index 765fb30..f15974d 100644 --- a/src/drm_iface.c +++ b/src/drm_iface.c @@ -216,7 +216,7 @@ static size_t sharp_memory_gray8_to_mono_tagged_dither(u8 *buf, int width, int h } else { *dM=ditherMatrix4; } - msize=sizeof(dM); + msize=sqrt(sizeof(dM)); // Iterate over lines from [0, height) for (line = 0; line < height; line++) { @@ -231,19 +231,8 @@ static size_t sharp_memory_gray8_to_mono_tagged_dither(u8 *buf, int width, int h for (b1 = 0; b1 < 8; b1++) { // Apply dithering - if (g_param_dither == 1) { - if (buf[line * width + b8 + b1] >= ditherMatrix1[(b8 + b1) % 2 + line % 2 * 2]) - d |= 0b10000000 >> b1; - } else if (g_param_dither == 2) { - if (buf[line * width + b8 + b1] >= ditherMatrix2[(b8 + b1) % 2 + line % 2 * 2]) - d |= 0b10000000 >> b1; - } else if (g_param_dither == 3) { - if (buf[line * width + b8 + b1] >= ditherMatrix3[(b8 + b1) % 4 + line % 4 * 4]) + if (buf[line * width + b8 + b1] >= dM[(b8 + b1) % msize + line % msize * msize]) d |= 0b10000000 >> b1; - } else { - if (buf[line * width + b8 + b1] >= ditherMatrix4[(b8 + b1) % 4 + line % 4 * 4]) - d |= 0b10000000 >> b1; - } } // Apply inversion From d29aba278d521bde21ed69f5af20f9c39d57e829 Mon Sep 17 00:00:00 2001 From: prokrypt Date: Fri, 18 Aug 2023 13:28:01 -0700 Subject: [PATCH 10/13] Add comments to dithering matrix definitions --- src/drm_iface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/drm_iface.c b/src/drm_iface.c index f15974d..563bc42 100644 --- a/src/drm_iface.c +++ b/src/drm_iface.c @@ -38,16 +38,19 @@ #define CMD_WRITE_LINE 0b10000000 #define CMD_CLEAR_SCREEN 0b00100000 +// Whiter whites static int ditherMatrix1[4] = { 1, 154, 103, 52 }; +// Uniform range static int ditherMatrix2[4] = { 51, 204, 153, 102 }; +// Whiter whites static int ditherMatrix3[16] = { 1, 83, 21, 103, 123, 42, 143, 62, @@ -55,6 +58,7 @@ static int ditherMatrix3[16] = { 154, 72, 134, 52 }; +// Uniform range static int ditherMatrix4[16] = { 15, 195, 60, 240, 135, 75, 180, 120, From 4b943867b65ee4d266c17c611af3e68f133458ef Mon Sep 17 00:00:00 2001 From: prokrypt Date: Fri, 18 Aug 2023 19:14:48 -0700 Subject: [PATCH 11/13] Remove sqrt() :| --- src/drm_iface.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/drm_iface.c b/src/drm_iface.c index 563bc42..fa3b5c8 100644 --- a/src/drm_iface.c +++ b/src/drm_iface.c @@ -213,14 +213,17 @@ static size_t sharp_memory_gray8_to_mono_tagged_dither(u8 *buf, int width, int h if (g_param_dither == 1) { *dM=ditherMatrix1; + msize=2; } else if (g_param_dither == 2) { *dM=ditherMatrix2; + msize=2; } else if (g_param_dither == 3) { *dM=ditherMatrix3; + msize=4; } else { *dM=ditherMatrix4; + msize=4; } - msize=sqrt(sizeof(dM)); // Iterate over lines from [0, height) for (line = 0; line < height; line++) { From 70f55a17c31dabfa9f379b34d5bfc3c6c0590757 Mon Sep 17 00:00:00 2001 From: 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 Date: Sun, 21 Jul 2024 18:54:17 -0700 Subject: [PATCH 12/13] typo! --- src/params_iface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/params_iface.c b/src/params_iface.c index 880b674..ee6e64f 100644 --- a/src/params_iface.c +++ b/src/params_iface.c @@ -44,7 +44,7 @@ MODULE_PARM_DESC(indicators, "0 for no indicators, 1 for indicators"); module_param_cb(dither, &u8_param_ops, &g_param_dither, 0660); MODULE_PARM_DESC(dither, - "0: no dithering, 1: limited 2x2, 3: full 2x2, 3: limited 4x4, 4: full 4x4"); + "0: no dithering, 1: limited 2x2, 2: full 2x2, 3: limited 4x4, 4: full 4x4"); int params_probe(void) { From 2708d7c279edd62fe312532102b9b8cdbccd5970 Mon Sep 17 00:00:00 2001 From: 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 Date: Sun, 21 Jul 2024 18:58:02 -0700 Subject: [PATCH 13/13] actually set vcom_setting. oops --- src/drm_iface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drm_iface.c b/src/drm_iface.c index fa3b5c8..a9ef21d 100644 --- a/src/drm_iface.c +++ b/src/drm_iface.c @@ -105,7 +105,7 @@ static void vcom_timer_callback(struct timer_list *t) // Toggle the GPIO pin vcom_setting = (vcom_setting) ? 0 : 1; - gpiod_set_value(panel->gpio_vcom, 1); + gpiod_set_value(panel->gpio_vcom, vcom_setting); // Reschedule the timer mod_timer(&panel->vcom_timer, jiffies + msecs_to_jiffies(1000));