diff --git a/drivers/display/Kconfig.ssd1306 b/drivers/display/Kconfig.ssd1306 index 413e32d8f334be..f067f572371d11 100644 --- a/drivers/display/Kconfig.ssd1306 +++ b/drivers/display/Kconfig.ssd1306 @@ -6,9 +6,11 @@ menuconfig SSD1306 bool "SSD1306 display driver" default y - depends on DT_HAS_SOLOMON_SSD1306FB_ENABLED || DT_HAS_SINOWEALTH_SH1106_ENABLED + depends on DT_HAS_SOLOMON_SSD1306FB_ENABLED || DT_HAS_SOLOMON_SSD1309FB_ENABLED || DT_HAS_SINOWEALTH_SH1106_ENABLED select I2C if $(dt_compat_on_bus,$(DT_COMPAT_SOLOMON_SSD1306FB),i2c) select SPI if $(dt_compat_on_bus,$(DT_COMPAT_SOLOMON_SSD1306FB),spi) + select I2C if $(dt_compat_on_bus,$(DT_COMPAT_SOLOMON_SSD1309FB),i2c) + select SPI if $(dt_compat_on_bus,$(DT_COMPAT_SOLOMON_SSD1309FB),spi) select I2C if $(dt_compat_on_bus,$(DT_COMPAT_SINOWEALTH_SH1106),i2c) select SPI if $(dt_compat_on_bus,$(DT_COMPAT_SINOWEALTH_SH1106),spi) help diff --git a/drivers/display/ssd1306.c b/drivers/display/ssd1306.c index 7d01b4fbd4ec03..d16e12bdc1ba20 100644 --- a/drivers/display/ssd1306.c +++ b/drivers/display/ssd1306.c @@ -23,6 +23,8 @@ LOG_MODULE_REGISTER(ssd1306, CONFIG_DISPLAY_LOG_LEVEL); #define SSD1306_PANEL_VCOM_DESEL_LEVEL 0x20 #define SSD1306_PANEL_PUMP_VOLTAGE SSD1306_SET_PUMP_VOLTAGE_90 +#define SSD1306_PANEL_VCOM_DESEL_LEVEL_SSD1309 0x34 + #ifndef SSD1306_ADDRESSING_MODE #define SSD1306_ADDRESSING_MODE (SSD1306_SET_MEM_ADDRESSING_HORIZONTAL) #endif @@ -55,6 +57,7 @@ struct ssd1306_config { bool com_invdir; bool com_sequential; bool color_inversion; + bool ssd1309_compatible; bool sh1106_compatible; int ready_time_ms; bool use_internal_iref; @@ -65,6 +68,7 @@ struct ssd1306_data { }; #if (DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(solomon_ssd1306fb, i2c) || \ + DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(solomon_ssd1309fb, i2c) || \ DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(sinowealth_sh1106, i2c)) static bool ssd1306_bus_ready_i2c(const struct device *dev) { @@ -92,6 +96,7 @@ static const char *ssd1306_bus_name_i2c(const struct device *dev) #endif #if (DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(solomon_ssd1306fb, spi) || \ + DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(solomon_ssd1309fb, spi) || \ DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(sinowealth_sh1106, spi)) static bool ssd1306_bus_ready_spi(const struct device *dev) { @@ -167,7 +172,8 @@ static inline int ssd1306_set_timing_setting(const struct device *dev) SSD1306_SET_CHARGE_PERIOD, config->prechargep, SSD1306_SET_VCOM_DESELECT_LEVEL, - SSD1306_PANEL_VCOM_DESEL_LEVEL}; + config->ssd1309_compatible ? SSD1306_PANEL_VCOM_DESEL_LEVEL_SSD1309 : + SSD1306_PANEL_VCOM_DESEL_LEVEL}; return ssd1306_write_bus(dev, cmd_buf, sizeof(cmd_buf), true); } @@ -428,12 +434,14 @@ static int ssd1306_init_device(const struct device *dev) return -EIO; } - if (ssd1306_set_charge_pump(dev)) { - return -EIO; - } + if (!config->ssd1309_compatible) { + if (ssd1306_set_charge_pump(dev)) { + return -EIO; + } - if (ssd1306_set_iref_mode(dev)) { - return -EIO; + if (ssd1306_set_iref_mode(dev)) { + return -EIO; + } } if (ssd1306_write_bus(dev, cmd_buf, sizeof(cmd_buf), true)) { @@ -517,6 +525,7 @@ static DEVICE_API(display, ssd1306_driver_api) = { .com_sequential = DT_PROP(node_id, com_sequential), \ .prechargep = DT_PROP(node_id, prechargep), \ .color_inversion = DT_PROP(node_id, inversion_on), \ + .ssd1309_compatible = DT_NODE_HAS_COMPAT(node_id, solomon_ssd1309fb), \ .sh1106_compatible = DT_NODE_HAS_COMPAT(node_id, sinowealth_sh1106), \ .ready_time_ms = DT_PROP(node_id, ready_time_ms), \ .use_internal_iref = DT_PROP(node_id, use_internal_iref), \ @@ -528,4 +537,5 @@ static DEVICE_API(display, ssd1306_driver_api) = { POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, &ssd1306_driver_api); DT_FOREACH_STATUS_OKAY(solomon_ssd1306fb, SSD1306_DEFINE) +DT_FOREACH_STATUS_OKAY(solomon_ssd1309fb, SSD1306_DEFINE) DT_FOREACH_STATUS_OKAY(sinowealth_sh1106, SSD1306_DEFINE) diff --git a/dts/bindings/display/solomon,ssd1309fb-i2c.yaml b/dts/bindings/display/solomon,ssd1309fb-i2c.yaml new file mode 100644 index 00000000000000..ee953a07cc49b7 --- /dev/null +++ b/dts/bindings/display/solomon,ssd1309fb-i2c.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2025, Marcio Ribeiro +# SPDX-License-Identifier: Apache-2.0 + +description: SSD1309 128x64 dot-matrix display controller on I2C bus + +compatible: "solomon,ssd1309fb" + +include: ["solomon,ssd1306fb-common.yaml", "i2c-device.yaml"] diff --git a/dts/bindings/display/solomon,ssd1309fb-spi.yaml b/dts/bindings/display/solomon,ssd1309fb-spi.yaml new file mode 100644 index 00000000000000..4a24a35d7cdc17 --- /dev/null +++ b/dts/bindings/display/solomon,ssd1309fb-spi.yaml @@ -0,0 +1,14 @@ +# Copyright (c) 2025, Marcio Ribeiro +# SPDX-License-Identifier: Apache-2.0 + +description: SSD1309 128x64 dot-matrix display controller on SPI bus + +compatible: "solomon,ssd1309fb" + +include: ["solomon,ssd1306fb-common.yaml", "spi-device.yaml"] + +properties: + data_cmd-gpios: + type: phandle-array + required: true + description: D/C# pin.