Skip to content

Add support for CH1115 Controller

Nicolás Antinori dri-devel linux-devicetree linux-kernel-mentees lkml sashiko-reviews 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest3 patches 1 replyIn review
  2. v53 patches 0 repliesSuperseded
  3. v43 patches 0 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v33 patches2 repliesSuperseded
v23 patches1 replySuperseded
v13 patches2 repliesSuperseded

Changes in v6 from the cover letter · 21 lines

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]/

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3dt-bindings: display: add Chipwealth CH1115 OLED ControllerDocumentation/devicetree/bindings/display/chipwealth,ch1115.yaml+81 -00 replies
2/3drm/ch1115: add support for Chipwealth CH1115 OLED controllerdrivers/gpu/drm/tiny/Kconfig drivers/gpu/drm/tiny/Makefile drivers/gpu/drm/tiny/ch1115-i2c.c+877 -01 reply
3/3MAINTAINERS: add entry for Chipwealth CH1115 OLED ControllerMAINTAINERS+6 -00 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchKrzysztof Kozlowski
1/3R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/3] 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.

Changelog:

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
MAINTAINERS: add entry 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             | 859 ++++++++++++++++++
 5 files changed, 964 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/chipwealth,ch1115.yaml
 create mode 100644 drivers/gpu/drm/tiny/ch1115-i2c.c

--
2.47.3