Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/sitronix/st7571-i2c: move common structures to st7571.h

Move all structures that will be common for all interfaces (SPI/I2C) to
a separate header file.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Link: https://patch.msgid.link/20251215-st7571-split-v3-3-d5f3205c3138@gmail.com
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>

authored by

Marcus Folkesson and committed by
Javier Martinez Canillas
d93a4354 bc12f3e1

+111 -89
+1
MAINTAINERS
··· 8201 8201 F: Documentation/devicetree/bindings/display/sitronix,st7567.yaml 8202 8202 F: Documentation/devicetree/bindings/display/sitronix,st7571.yaml 8203 8203 F: drivers/gpu/drm/sitronix/st7571-i2c.c 8204 + F: drivers/gpu/drm/sitronix/st7571.h 8204 8205 8205 8206 DRM DRIVER FOR SITRONIX ST7701 PANELS 8206 8207 M: Jagan Teki <jagan@amarulasolutions.com>
+2 -89
drivers/gpu/drm/sitronix/st7571-i2c.c
··· 35 35 #include <video/display_timing.h> 36 36 #include <video/of_display_timing.h> 37 37 38 + #include "st7571.h" 39 + 38 40 #define ST7571_COMMAND_MODE (0x00) 39 41 #define ST7571_DATA_MODE (0x40) 40 42 ··· 79 77 #define DRIVER_DESC "ST7571 DRM driver" 80 78 #define DRIVER_MAJOR 1 81 79 #define DRIVER_MINOR 0 82 - 83 - enum st7571_color_mode { 84 - ST7571_COLOR_MODE_GRAY = 0, 85 - ST7571_COLOR_MODE_BLACKWHITE = 1, 86 - }; 87 - 88 - struct st7571_device; 89 - 90 - struct st7571_panel_constraints { 91 - u32 min_nlines; 92 - u32 max_nlines; 93 - u32 min_ncols; 94 - u32 max_ncols; 95 - bool support_grayscale; 96 - }; 97 - 98 - struct st7571_panel_data { 99 - int (*init)(struct st7571_device *st7571); 100 - int (*parse_dt)(struct st7571_device *st7571); 101 - struct st7571_panel_constraints constraints; 102 - }; 103 - 104 - struct st7571_panel_format { 105 - void (*prepare_buffer)(struct st7571_device *st7571, 106 - const struct iosys_map *vmap, 107 - struct drm_framebuffer *fb, 108 - struct drm_rect *rect, 109 - struct drm_format_conv_state *fmtcnv_state); 110 - int (*update_rect)(struct drm_framebuffer *fb, struct drm_rect *rect); 111 - enum st7571_color_mode mode; 112 - const u8 nformats; 113 - const u32 formats[]; 114 - }; 115 - 116 - struct st7571_device { 117 - struct drm_device drm; 118 - struct device *dev; 119 - 120 - struct drm_plane primary_plane; 121 - struct drm_crtc crtc; 122 - struct drm_encoder encoder; 123 - struct drm_connector connector; 124 - 125 - struct drm_display_mode mode; 126 - 127 - const struct st7571_panel_format *pformat; 128 - const struct st7571_panel_data *pdata; 129 - struct i2c_client *client; 130 - struct gpio_desc *reset; 131 - struct regmap *regmap; 132 - 133 - /* 134 - * Depending on the hardware design, the acknowledge signal may be hard to 135 - * recognize as a valid logic "0" level. 136 - * Therefor, ignore NAK if possible to stay compatible with most hardware designs 137 - * and off-the-shelf panels out there. 138 - * 139 - * From section 6.4 MICROPOCESSOR INTERFACE section in the datasheet: 140 - * 141 - * "By connecting SDA_OUT to SDA_IN externally, the SDA line becomes fully 142 - * I2C interface compatible. 143 - * Separating acknowledge-output from serial data 144 - * input is advantageous for chip-on-glass (COG) applications. In COG 145 - * applications, the ITO resistance and the pull-up resistor will form a 146 - * voltage divider, which affects acknowledge-signal level. Larger ITO 147 - * resistance will raise the acknowledged-signal level and system cannot 148 - * recognize this level as a valid logic “0” level. By separating SDA_IN from 149 - * SDA_OUT, the IC can be used in a mode that ignores the acknowledge-bit. 150 - * For applications which check acknowledge-bit, it is necessary to minimize 151 - * the ITO resistance of the SDA_OUT trace to guarantee a valid low level." 152 - * 153 - */ 154 - bool ignore_nak; 155 - 156 - bool grayscale; 157 - bool inverted; 158 - u32 height_mm; 159 - u32 width_mm; 160 - u32 startline; 161 - u32 nlines; 162 - u32 ncols; 163 - u32 bpp; 164 - 165 - /* Intermediate buffer in LCD friendly format */ 166 - u8 *hwbuf; 167 - 168 - /* Row of (transformed) pixels ready to be written to the display */ 169 - u8 *row; 170 - }; 171 80 172 81 static inline struct st7571_device *drm_to_st7571(struct drm_device *drm) 173 82 {
+108
drivers/gpu/drm/sitronix/st7571.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 + /* 3 + * Header file for: 4 + * Driver for Sitronix ST7571, a 4 level gray scale dot matrix LCD controller 5 + * 6 + * Copyright (C) 2025 Marcus Folkesson <marcus.folkesson@gmail.com> 7 + */ 8 + 9 + #ifndef __ST7571_H__ 10 + #define __ST7571_H__ 11 + 12 + #include <drm/drm_connector.h> 13 + #include <drm/drm_crtc.h> 14 + #include <drm/drm_drv.h> 15 + #include <drm/drm_encoder.h> 16 + 17 + #include <linux/regmap.h> 18 + 19 + enum st7571_color_mode { 20 + ST7571_COLOR_MODE_GRAY = 0, 21 + ST7571_COLOR_MODE_BLACKWHITE = 1, 22 + }; 23 + 24 + struct st7571_device; 25 + 26 + struct st7571_panel_constraints { 27 + u32 min_nlines; 28 + u32 max_nlines; 29 + u32 min_ncols; 30 + u32 max_ncols; 31 + bool support_grayscale; 32 + }; 33 + 34 + struct st7571_panel_data { 35 + int (*init)(struct st7571_device *st7571); 36 + int (*parse_dt)(struct st7571_device *st7571); 37 + struct st7571_panel_constraints constraints; 38 + }; 39 + 40 + struct st7571_panel_format { 41 + void (*prepare_buffer)(struct st7571_device *st7571, 42 + const struct iosys_map *vmap, 43 + struct drm_framebuffer *fb, 44 + struct drm_rect *rect, 45 + struct drm_format_conv_state *fmtcnv_state); 46 + int (*update_rect)(struct drm_framebuffer *fb, struct drm_rect *rect); 47 + enum st7571_color_mode mode; 48 + const u8 nformats; 49 + const u32 formats[]; 50 + }; 51 + 52 + struct st7571_device { 53 + struct drm_device drm; 54 + struct device *dev; 55 + 56 + struct drm_plane primary_plane; 57 + struct drm_crtc crtc; 58 + struct drm_encoder encoder; 59 + struct drm_connector connector; 60 + 61 + struct drm_display_mode mode; 62 + 63 + const struct st7571_panel_format *pformat; 64 + const struct st7571_panel_data *pdata; 65 + struct i2c_client *client; 66 + struct gpio_desc *reset; 67 + struct regmap *regmap; 68 + 69 + /* 70 + * Depending on the hardware design, the acknowledge signal may be hard to 71 + * recognize as a valid logic "0" level. 72 + * Therefor, ignore NAK if possible to stay compatible with most hardware designs 73 + * and off-the-shelf panels out there. 74 + * 75 + * From section 6.4 MICROPOCESSOR INTERFACE section in the datasheet: 76 + * 77 + * "By connecting SDA_OUT to SDA_IN externally, the SDA line becomes fully 78 + * I2C interface compatible. 79 + * Separating acknowledge-output from serial data 80 + * input is advantageous for chip-on-glass (COG) applications. In COG 81 + * applications, the ITO resistance and the pull-up resistor will form a 82 + * voltage divider, which affects acknowledge-signal level. Larger ITO 83 + * resistance will raise the acknowledged-signal level and system cannot 84 + * recognize this level as a valid logic “0” level. By separating SDA_IN from 85 + * SDA_OUT, the IC can be used in a mode that ignores the acknowledge-bit. 86 + * For applications which check acknowledge-bit, it is necessary to minimize 87 + * the ITO resistance of the SDA_OUT trace to guarantee a valid low level." 88 + * 89 + */ 90 + bool ignore_nak; 91 + 92 + bool grayscale; 93 + bool inverted; 94 + u32 height_mm; 95 + u32 width_mm; 96 + u32 startline; 97 + u32 nlines; 98 + u32 ncols; 99 + u32 bpp; 100 + 101 + /* Intermediate buffer in LCD friendly format */ 102 + u8 *hwbuf; 103 + 104 + /* Row of (transformed) pixels ready to be written to the display */ 105 + u8 *row; 106 + }; 107 + 108 + #endif /* __ST7571_H__ */