Add support for CH1115 Controller
Subsystems (3)
v7 cover Add support for CH1115 Controller
This series add support for the CH1115 Controller [1]. It is a monochrome dot matrix OLED controller that supports several interfaces such as SPI and I2C.
This driver only supports the I2C interface, but all common parts could easily be put into a common file to be used with other interfaces. I only have I2C to test with.
This is the first driver I write. The work is based on the driver located at:
- drivers/gpu/drm/sitronix/st7571-i2c.c
- drivers/gpu/drm/sitronix/st7571.c
Tested with Raspberry Pi 3b+ on:
- Linux 7.4-rc1.
- Linux 7.4-rc3.
Note: rc-3 was tested by pulling the changes of drm-next into the rpi-7.4.y branch of the Raspberry Pi tree. rc-1 used the Raspberry Pi tree as it was at the time of rc-1.
Patchwork Link: https://patchwork.freedesktop.org/series/171799/
Changelog:
v7:
General:
- Patch series based on drm-next branch
commit 601c30449c80 ("Merge tag 'drm-misc-next-2026-11-13' of
https://gitlab.freedesktop.org/drm/misc/kernel into drm-next")
Driver:
- Changed default contrast value to 0x80: It was 127 (0x7f) by my mistake (0x80 is the default in the datasheet).
- Added sleep (100ms) just right after sending the screen on command (AF). This is stated in the datasheet but I missed that before.
- Dismissed Sashiko review: "[Medium] drm/ch1115: out-of-range display offset 64 sent in ch1115_oled_init()": This is a false positive, the datasheet [1] states that the formula for this command (D3) is 64 - n, where n is a 6 bit number in the range [0, 63]. I did not use a mask for this because the unused bits get ignored and the value is constrained to that range.
- Fixed Sashiko review: "[Medium] drm/ch1115: missing DC-DC disable in ch1115_encoder_atomic_disable()"
- Modifying MAINTAINERS file in the driver patch (removed patch 3 of the series).
Link to last Sashiko report: https://sashiko.dev/#/patchset/[email protected]?part=2
Link to v6: https://lore.kernel.org/dri-devel/[email protected]/
v6:
General:
- Patch series based on 7.4-rc1
Driver:
- Fixed KConfig dependencies: added depends on MMU because of DRM_GEM_SHMEM_HELPER select
- Removed unused constant CH1115_MAX_PAGES.
- Removed unused ch1115 struct member pages.
- Fixed width and height checks error messages
- drm connector: use atomic_create_state and remove drm_atomic_helper_connector_reset: This change is because of [3]
- drm CRTC: use drm_atomic_helper_crtc_create_state and remove drm_atomic_helper_crtc_reset. This change is the because of [5] [6]
[7] [8]
- Replaced devm_regmap_init(...) with devm_regmap_init_i2c(...). Deleted related unused code. In this driver I2C_M_IGNORE_NAK is not used.
The way of communicating was carried from an old version of st7571 driver (and me not understanding better). This change is because of [4].
- Early exit on failure in ch1115_encoder_atomic_enable
- Removed "CH1115_CMD_ALL_ON" in shutdown sequence. This was a misunderstanding of what this command did.
- Fixed Sashiko report from v5: "[High] core: uninitialized variable
bl used in IS_ERR check". Apologies for this, my LSP did not highlight the problem and I overlooked it.
- Fixed Sashiko report from v5: "[High] drm: out-of-bounds heap read in ch1115_transform_xy()".
- Fixed Sashiko report from v5: "[Medium] sysfs: unprotected state modification on registered I2C device"
Dt-binding:
- Removed adding Chipwealth to vendor-prefixes.yml. This was added in commit 058ee00216a1 ("dt-bindings: vendor-prefixes: Add Chip Wealth Technology")
Link to v5: https://lore.kernel.org/all/[email protected]/
Note: Sashiko keeps complaining that i2c transfers are called in atomic_update callback stating that it is forbidden to call sleeping functions there because we are in an atomic context. AFAIK this atomic context is not that the kernel is in a non-sleepable state, but refers to the DRM way of working by doing check -> commit. In fact, the driver I based this driver (st7571 [9] -> [10]) and others (ssd103x) do i2c transfer in an atomic plane update. Am I missing something?
v5:
General:
- Patch series based on 7.3-rc1
Driver:
- Fixed KConfig dependencies (OF and BACKLIGHT_CLASS_DEVICE)
- Initializing baclight with backlight_properties struct
- Moved driver from drivers/gpu/drm/chipwealth to drivers/gpu/drm/tiny
- Fixed allocation for hwbuf if width or height are not multiple of 8.
I was allocating less memory than needed in those cases.
- Fixed damage rect horizontal alignment.
Link to v4: https://lore.kernel.org/all/[email protected]/
Note: The last two fixes listed were pointed out by Sashiko in some occasions but when I checked them I dismissed them for false positives because I misunderstood them.
v4:
General:
- Patch series based in kernel v7.3-rc1
Driver:
- Fixed nits found by Christophe JAILLET.
- Fixed max_width and max_height in modeset to avoid having bigger framebuffers than resolution.
Link to v3: https://lore.kernel.org/all/[email protected]/
v3:
- General:
- Patch series based in kernel v7.2
- In dt-bindings:
- Removed "chipwealth,contrast" property (added backlight_device support in driver's code)
- Renamed "chipwealth,invert" -> "chipwealth,inverted"
- Added default value to "chipwealth,offset"
- Removed 'status = "okay"' from example
- Indented example with 4 spaces as stated in the documentation [2]
- In driver code:
- Added support for backlight_device
- Replaced drm_dev_unregister with drm_dev_unplug to cover the dt overlay unload case
- Executing drm shutdown operations before turning off the display
- Checking that the width (panel-timing.hactive) and height (panel-timing.vactive) parameters are greater than 0
Link to v2: https://lore.kernel.org/all/[email protected]/
v2:
- General:
- Patch series based in kernel v7.2
- In dt-bindings:
- Fixed linter problems
- Replaced first_page property with offset
- In driver code:
- Fixed dst_pitch calculation
- Renamed file from ch1115.c to ch1115-i2c.c
- Support flip-vertical and flip-horizontal dt properties
- Fixed several things found by sashiko-ai
Link to v1: https://lore.kernel.org/all/[email protected]/
[1] https://datasheet4u.com/download/1576606/CH1115.html
[2] https://docs.kernel.org/devicetree/bindings/writing-schema.html#annotated-example-schema
[3] https://lore.kernel.org/dri-devel/20261022-drm-no-more-connector-reset-v2-26-0b7e4e85b1e8@kernel.org/
[4] https://lore.kernel.org/dri-devel/[email protected]/
[5] https://lore.kernel.org/all/[email protected]/
[6] https://lore.kernel.org/all/[email protected]/
[7] https://lore.kernel.org/all/[email protected]/
[8] https://lore.kernel.org/all/[email protected]/
[9] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/sitronix/st7571.c#n371
[10] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/sitronix/st7571.c#n224
Nicolás Antinori (3):
dt-bindings: display: add Chipwealth CH1115 OLED Controller drm/ch1115: add support for Chipwealth CH1115 OLED controller
.../bindings/display/chipwealth,ch1115.yaml | 81 ++ MAINTAINERS | 6 + drivers/gpu/drm/tiny/Kconfig | 17 + drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/tiny/ch1115-i2c.c | 862 ++++++++++++++++++ 5 files changed, 967 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/chipwealth,ch1115.yaml create mode 100644 drivers/gpu/drm/tiny/ch1115-i2c.c
base-commit: 601c30449c80926947d4820d50cec974687d1d11 --
2.47.3
PATCH v7 1/2 dt-bindings: display: add Chipwealth CH1115 OLED Controller
Chipwealth CH1115 is a controller for monochrome dot matrix OLED panels.
---
Note: Carried "Reviewed-by: Krzysztof Kozlowski <...>" from v3 since the only change was the removal of adding Chipwealth to vendor-prefixes.yml. This was added in commit 058ee00216a1 ("dt-bindings: vendor-prefixes:
Add Chip Wealth Technology").
Note: Based on drm-next commit 601c30449c80 ("Merge tag 'drm-misc-next-2026-11-13' of
https://gitlab.freedesktop.org/drm/misc/kernel into drm-next") to avoid conflicts when applying the series.
.../bindings/display/chipwealth,ch1115.yaml | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/chipwealth,ch1115.yaml
Documentation/devicetree/bindings/display/chipwealth,ch1115.yaml new file +81 -0
@@ -0,0 +1,81 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/chipwealth,ch1115.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Chipwealth CH1115 Display Controller + +maintainers: + - Nicolás Antinori <[email protected]> + +description: + Chipwealth CH1115 is a controller for monochrome dot matrix OLED + panels. + + https://datasheet4u.com/download/1576606/CH1115.html + +allOf: + - $ref: panel/panel-common.yaml# + +properties: + compatible: + const: chipwealth,ch1115 + + reg: + maxItems: 1 + + chipwealth,inverted: + type: boolean + description: + Display pixels are inverted, i.e. 0 is white and 1 is black. + + chipwealth,offset: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 63 + default: 0 + description: + Display start line offset. Specifies the vertical alignment and row shift + along the Y-coordinate. + + width-mm: true + height-mm: true + flip-horizontal: true + flip-vertical: true + panel-timing: true + +required: + - compatible + - reg + - width-mm + - height-mm + - panel-timing + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + display@3c { + compatible = "chipwealth,ch1115"; + reg = <0x3c>; + width-mm = <12>; + height-mm = <8>; + chipwealth,offset = <8>; + panel-timing { + clock-frequency = <0>; + hactive = <88>; + vactive = <48>; + hfront-porch = <0>; + hback-porch = <0>; + hsync-len = <0>; + vsync-len = <0>; + vfront-porch = <0>; + vback-porch = <0>; + }; + }; + };
Signature · 1 line
2.47.3
PATCH v7 2/2 drm/ch1115: add support for Chipwealth CH1115 OLED controller
In reply to Nicolás AntinoriChipwealth CH1115 is a controller for monochrome dot matrix OLED panels.
Add DRM support for this chip using i2c bus and the MAINTAINERS entry for this driver.
--- MAINTAINERS | 6 + drivers/gpu/drm/tiny/Kconfig | 17 + drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/tiny/ch1115-i2c.c | 862 ++++++++++++++++++++++++++++++ 4 files changed, 886 insertions(+) create mode 100644 drivers/gpu/drm/tiny/ch1115-i2c.c
MAINTAINERS +6 -0
@@ -8292,6 +8292,12 @@ S: Maintained F: Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml F: drivers/gpu/drm/bridge/chipone-icn6211.c +DRM DRIVER FOR CHIPWEALTH CH1115 PANELS +M: Nicolás Antinori <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/display/chipwealth,ch1115.yaml +F: drivers/gpu/drm/tiny/ch1115-i2c.c + DRM DRIVER FOR EBBG FT8719 PANEL M: Joel Selvaraj <[email protected]> S: Maintained
drivers/gpu/drm/tiny/Kconfig +17 -0
@@ -36,6 +36,23 @@ config DRM_BOCHS If M is selected the module will be called bochs. +config DRM_CH1115_I2C + tristate "DRM support for CH1115 OLED panels (I2C BUS)" + depends on DRM && MMU && I2C && OF + select BACKLIGHT_CLASS_DEVICE + select DRM_CLIENT_SELECTION + select DRM_GEM_SHMEM_HELPER + select DRM_KMS_HELPER + select REGMAP_I2C + select VIDEOMODE_HELPERS + help + Chipwealth CH1115 is a controller for monochrome dot matrix OLED + panels. + + DRM driver for CH1115 OLED panels connected via I2C. + + If M is selected the module will be called ch1115-i2c. + config DRM_CIRRUS_QEMU tristate "Cirrus driver for QEMU emulated device" depends on DRM && PCI
drivers/gpu/drm/tiny/Makefile +1 -0
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_APPLETBDRM) += appletbdrm.o obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o obj-$(CONFIG_DRM_BOCHS) += bochs.o +obj-$(CONFIG_DRM_CH1115_I2C) += ch1115-i2c.o obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus-qemu.o obj-$(CONFIG_DRM_GLANDA) += glandagpu.o obj-$(CONFIG_DRM_GM12U320) += gm12u320.o
drivers/gpu/drm/tiny/ch1115-i2c.c new file +862 -0
862 lines not on this page · raw message
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH v7 2/2] drm/ch1115: add support for Chipwealth CH1115 OLED controller
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] drm/ch1115: out-of-range display offset 64 sent in ch1115_oled_init() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] drm/ch1115: out-of-range display offset 64 sent in ch1115_oled_init()
--
commit 267a026ef99b05c8104e1fd889562214c3da0086
Author: Nicolás Antinori <[email protected]>
drm/ch1115: add support for Chipwealth CH1115 OLED controller
This commit adds a DRM driver for Chipwealth CH1115 monochrome dot matrix OLED panels connected over I2C, along with its Kconfig, Makefile, and MAINTAINERS entries.
Quoted 5 lines
drivers/gpu/drm/tiny/ch1115-i2c.c new file +0
-0
[ ... ]
Quoted 6 lines
drivers/gpu/drm/tiny/ch1115-i2c.c new file +6
-0+static int ch1115_oled_init (struct ch1115_device *ch1115) +{ +u8 commands[] = { +CH1115_CMD_OFF , + +CH1115_CMD_CLOCK_DIVIDE_RATIO ,
drivers/gpu/drm/tiny/ch1115-i2c.c line 206
Quoted 10 lines
drivers/gpu/drm/tiny/ch1115-i2c.c new file +10
-0+CH1115_VAL_CLOCK_DIVIDE_RATIO (CH1115_VAL_CLOCK_OSC_FREQ , +CH1115_VAL_CLOCK_DIV_RATIO ), + +CH1115_CMD_MUX_RATIO , + ch1115->height -1 , + +CH1115_CMD_OFFSET , + ch1115->flip_vertical + ? ch1115->y_start_offset + : CH1115_MAX_HEIGHT - ch1115->y_start_offset,
[Severity: Medium]
Does CH1115_CMD_OFFSET send an out-of-range value of 64 (0x40) when flip_vertical is false and y_start_offset is 0?
ch1115_parse_dt() defaults y_start_offset to 0 when "chipwealth,offset" is omitted and restricts explicit values to [0, CH1115_MAX_HEIGHT - 1] (0 to
63) to fit the controller's 6-bit vertical offset field. With the default offset of 0 and flip_vertical disabled, CH1115_MAX_HEIGHT - ch1115->y_start_offset evaluates to 64 instead of wrapping modulo CH1115_MAX_HEIGHT to 0.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2