Skip to content

Commit 1f97fa9

Browse files
skandinaffaescolar
authored andcommitted
drivers: display: ssd16xx: enable SSD1680 RAM ping-pong
SSD1680 supports RAM ping-pong for display mode 2 through the display option register. Enable F[6] when switching to the partial refresh profile so partial updates can use the controller's buffer swap behavior. Expose this as a "ram-ping-pong-mode2" devicetree property on the SSD1680-specific binding. Signed-off-by: Aleksandrs Sevastjanovs <sevalks@gmail.com>
1 parent 64d250c commit 1f97fa9

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

drivers/display/ssd16xx.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(ssd16xx);
1717
#include <zephyr/drivers/gpio.h>
1818
#include <zephyr/drivers/mipi_dbi.h>
1919
#include <zephyr/sys/byteorder.h>
20+
#include <zephyr/sys/util.h>
2021

2122
#include <zephyr/display/ssd16xx.h>
2223
#include "ssd16xx_regs.h"
@@ -31,6 +32,9 @@ LOG_MODULE_REGISTER(ssd16xx);
3132
#define SSD16XX_PIXELS_PER_BYTE 8
3233
#define SSD16XX_DEFAULT_TR_VALUE 25U
3334
#define SSD16XX_TR_SCALE_FACTOR 256U
35+
#define SSD16XX_DISPLAY_OPTION_LEN 10U
36+
#define SSD16XX_DISPLAY_OPTION_F 5U
37+
#define SSD16XX_DISPLAY_OPTION_RAM_PINGPONG BIT(6)
3438

3539

3640
enum ssd16xx_profile_type {
@@ -104,6 +108,7 @@ struct ssd16xx_config {
104108
uint16_t rotation;
105109
uint16_t height;
106110
uint16_t width;
111+
bool ram_ping_pong_mode2;
107112
uint8_t tssv;
108113
};
109114

@@ -732,6 +737,18 @@ static int ssd16xx_load_lut(const struct device *dev,
732737
}
733738
}
734739

740+
static int ssd16xx_enable_ram_pingpong(const struct device *dev)
741+
{
742+
uint8_t display_option[SSD16XX_DISPLAY_OPTION_LEN] = { 0 };
743+
744+
/* F[6] enables RAM ping-pong for display mode 2. */
745+
display_option[SSD16XX_DISPLAY_OPTION_F] =
746+
SSD16XX_DISPLAY_OPTION_RAM_PINGPONG;
747+
748+
return ssd16xx_write_cmd(dev, SSD16XX_CMD_OTP_SELECTION_CTRL,
749+
display_option, sizeof(display_option));
750+
}
751+
735752
static int ssd16xx_set_profile(const struct device *dev,
736753
enum ssd16xx_profile_type type)
737754
{
@@ -843,6 +860,13 @@ static int ssd16xx_set_profile(const struct device *dev,
843860
}
844861
}
845862

863+
if (type == SSD16XX_PROFILE_PARTIAL && config->ram_ping_pong_mode2) {
864+
err = ssd16xx_enable_ram_pingpong(dev);
865+
if (err < 0) {
866+
return err;
867+
}
868+
}
869+
846870
err = ssd16xx_write_uint8(dev, SSD16XX_CMD_ENTRY_MODE, data->scan_mode);
847871
if (err < 0) {
848872
return err;
@@ -1071,6 +1095,7 @@ static struct ssd16xx_quirks quirks_solomon_ssd1681 = {
10711095
.quirks = quirks_ptr, \
10721096
.height = DT_PROP(n, height), \
10731097
.width = DT_PROP(n, width), \
1098+
.ram_ping_pong_mode2 = DT_PROP_OR(n, ram_ping_pong_mode2, false), \
10741099
.rotation = DT_PROP(n, rotation), \
10751100
.tssv = DT_PROP_OR(n, tssv, 0), \
10761101
.softstart = SSD16XX_ASSIGN_ARRAY(n, softstart), \

dts/bindings/display/solomon,ssd1680.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ description: Solomon Systech SSD1680 296x176 EPD display controller
66
compatible: "solomon,ssd1680"
77

88
include: solomon,ssd16xx-common.yaml
9+
10+
properties:
11+
ram-ping-pong-mode2:
12+
type: boolean
13+
description:
14+
Enable RAM ping-pong for display mode 2 by setting F[6] in the
15+
display option register.

tests/drivers/build_all/display/app.overlay

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
width = <250>;
116116
height = <122>;
117117
busy-gpios = <&test_gpio 0 0>;
118+
ram-ping-pong-mode2;
118119
};
119120

120121
test_uc8176_waveshare_epaper_gdew042t2: uc8176@5 {

0 commit comments

Comments
 (0)