Lines Matching +full:write +full:- +full:cmd
4 * SPDX-License-Identifier: Apache-2.0
27 uint8_t cmd; member
30 /* CMD Mode switch, select manufacture command set page 0 */
31 {.cmd = 0xFE, .param = 0x01},
32 {.cmd = 0x06, .param = 0x62},
33 {.cmd = 0x0E, .param = 0x80},
34 {.cmd = 0x0F, .param = 0x80},
35 {.cmd = 0x10, .param = 0x71},
36 {.cmd = 0x13, .param = 0x81},
37 {.cmd = 0x14, .param = 0x81},
38 {.cmd = 0x15, .param = 0x82},
39 {.cmd = 0x16, .param = 0x82},
40 {.cmd = 0x18, .param = 0x88},
41 {.cmd = 0x19, .param = 0x55},
42 {.cmd = 0x1A, .param = 0x10},
43 {.cmd = 0x1C, .param = 0x99},
44 {.cmd = 0x1D, .param = 0x03},
45 {.cmd = 0x1E, .param = 0x03},
46 {.cmd = 0x1F, .param = 0x03},
47 {.cmd = 0x20, .param = 0x03},
48 {.cmd = 0x25, .param = 0x03},
49 {.cmd = 0x26, .param = 0x8D},
50 {.cmd = 0x2A, .param = 0x03},
51 {.cmd = 0x2B, .param = 0x8D},
52 {.cmd = 0x36, .param = 0x00},
53 {.cmd = 0x37, .param = 0x10},
54 {.cmd = 0x3A, .param = 0x00},
55 {.cmd = 0x3B, .param = 0x00},
56 {.cmd = 0x3D, .param = 0x20},
57 {.cmd = 0x3F, .param = 0x3A},
58 {.cmd = 0x40, .param = 0x30},
59 {.cmd = 0x41, .param = 0x30},
60 {.cmd = 0x42, .param = 0x33},
61 {.cmd = 0x43, .param = 0x22},
62 {.cmd = 0x44, .param = 0x11},
63 {.cmd = 0x45, .param = 0x66},
64 {.cmd = 0x46, .param = 0x55},
65 {.cmd = 0x47, .param = 0x44},
66 {.cmd = 0x4C, .param = 0x33},
67 {.cmd = 0x4D, .param = 0x22},
68 {.cmd = 0x4E, .param = 0x11},
69 {.cmd = 0x4F, .param = 0x66},
70 {.cmd = 0x50, .param = 0x55},
71 {.cmd = 0x51, .param = 0x44},
72 {.cmd = 0x57, .param = 0xB3},
73 {.cmd = 0x6B, .param = 0x19},
74 {.cmd = 0x70, .param = 0x55},
75 {.cmd = 0x74, .param = 0x0C},
78 {.cmd = 0xFE, .param = 0x02},
79 {.cmd = 0x9B, .param = 0x40},
80 {.cmd = 0x9C, .param = 0x67},
81 {.cmd = 0x9D, .param = 0x20},
84 {.cmd = 0xFE, .param = 0x03},
85 {.cmd = 0x9B, .param = 0x40},
86 {.cmd = 0x9C, .param = 0x67},
87 {.cmd = 0x9D, .param = 0x20},
90 {.cmd = 0xFE, .param = 0x04},
91 {.cmd = 0x5D, .param = 0x10},
94 {.cmd = 0xFE, .param = 0x04},
95 {.cmd = 0x00, .param = 0x8D},
96 {.cmd = 0x01, .param = 0x00},
97 {.cmd = 0x02, .param = 0x01},
98 {.cmd = 0x03, .param = 0x01},
99 {.cmd = 0x04, .param = 0x10},
100 {.cmd = 0x05, .param = 0x01},
101 {.cmd = 0x06, .param = 0xA7},
102 {.cmd = 0x07, .param = 0x20},
103 {.cmd = 0x08, .param = 0x00},
106 {.cmd = 0xFE, .param = 0x04},
107 {.cmd = 0x09, .param = 0xC2},
108 {.cmd = 0x0A, .param = 0x00},
109 {.cmd = 0x0B, .param = 0x02},
110 {.cmd = 0x0C, .param = 0x01},
111 {.cmd = 0x0D, .param = 0x40},
112 {.cmd = 0x0E, .param = 0x06},
113 {.cmd = 0x0F, .param = 0x01},
114 {.cmd = 0x10, .param = 0xA7},
115 {.cmd = 0x11, .param = 0x00},
118 {.cmd = 0xFE, .param = 0x04},
119 {.cmd = 0x12, .param = 0xC2},
120 {.cmd = 0x13, .param = 0x00},
121 {.cmd = 0x14, .param = 0x02},
122 {.cmd = 0x15, .param = 0x01},
123 {.cmd = 0x16, .param = 0x40},
124 {.cmd = 0x17, .param = 0x07},
125 {.cmd = 0x18, .param = 0x01},
126 {.cmd = 0x19, .param = 0xA7},
127 {.cmd = 0x1A, .param = 0x00},
130 {.cmd = 0xFE, .param = 0x04},
131 {.cmd = 0x1B, .param = 0x82},
132 {.cmd = 0x1C, .param = 0x00},
133 {.cmd = 0x1D, .param = 0xFF},
134 {.cmd = 0x1E, .param = 0x05},
135 {.cmd = 0x1F, .param = 0x60},
136 {.cmd = 0x20, .param = 0x02},
137 {.cmd = 0x21, .param = 0x01},
138 {.cmd = 0x22, .param = 0x7C},
139 {.cmd = 0x23, .param = 0x00},
142 {.cmd = 0xFE, .param = 0x04},
143 {.cmd = 0x24, .param = 0xC2},
144 {.cmd = 0x25, .param = 0x00},
145 {.cmd = 0x26, .param = 0x04},
146 {.cmd = 0x27, .param = 0x02},
147 {.cmd = 0x28, .param = 0x70},
148 {.cmd = 0x29, .param = 0x05},
149 {.cmd = 0x2A, .param = 0x74},
150 {.cmd = 0x2B, .param = 0x8D},
151 {.cmd = 0x2D, .param = 0x00},
154 {.cmd = 0xFE, .param = 0x04},
155 {.cmd = 0x2F, .param = 0xC2},
156 {.cmd = 0x30, .param = 0x00},
157 {.cmd = 0x31, .param = 0x04},
158 {.cmd = 0x32, .param = 0x02},
159 {.cmd = 0x33, .param = 0x70},
160 {.cmd = 0x34, .param = 0x07},
161 {.cmd = 0x35, .param = 0x74},
162 {.cmd = 0x36, .param = 0x8D},
163 {.cmd = 0x37, .param = 0x00},
166 {.cmd = 0xFE, .param = 0x04},
167 {.cmd = 0x5E, .param = 0x20},
168 {.cmd = 0x5F, .param = 0x31},
169 {.cmd = 0x60, .param = 0x54},
170 {.cmd = 0x61, .param = 0x76},
171 {.cmd = 0x62, .param = 0x98},
174 /* ELVSS -2.4V(RT4723). 0x15: RT4723. 0x01: RT4723B. 0x17: STAM1332. */
175 {.cmd = 0xFE, .param = 0x05},
176 {.cmd = 0x05, .param = 0x15},
177 {.cmd = 0x2A, .param = 0x04},
178 {.cmd = 0x91, .param = 0x00},
181 {.cmd = 0xFE, .param = 0x00},
182 /* Set tearing effect signal to only output at V-blank*/
183 {.cmd = 0x35, .param = 0x00},
210 k_sem_give(&data->te_sem); in rm67162_te_isr_handler()
215 const struct rm67162_config *config = dev->config; in rm67162_init()
216 struct rm67162_data *data = dev->data; in rm67162_init()
220 uint8_t cmd, param; in rm67162_init() local
223 mdev.data_lanes = config->num_of_lanes; in rm67162_init()
224 mdev.pixfmt = data->pixel_format; in rm67162_init()
226 ret = mipi_dsi_attach(config->mipi_dsi, config->channel, &mdev); in rm67162_init()
228 LOG_ERR("Could not attach to MIPI-DSI host"); in rm67162_init()
232 if (config->reset_gpio.port != NULL) { in rm67162_init()
233 ret = gpio_pin_configure_dt(&config->reset_gpio, GPIO_OUTPUT_INACTIVE); in rm67162_init()
246 ret = gpio_pin_set_dt(&config->reset_gpio, 0); in rm67162_init()
253 gpio_pin_set_dt(&config->reset_gpio, 1); in rm67162_init()
267 /* Now, write initialization settings for display, running at 400x392 */ in rm67162_init()
269 cmd = rm67162_init_400x392[i].cmd; in rm67162_init()
271 ret = mipi_dsi_dcs_write(config->mipi_dsi, config->channel, in rm67162_init()
272 cmd, ¶m, 1); in rm67162_init()
279 if (data->pixel_format == MIPI_DSI_PIXFMT_RGB888) { in rm67162_init()
281 data->bytes_per_pixel = 3; in rm67162_init()
282 } else if (data->pixel_format == MIPI_DSI_PIXFMT_RGB565) { in rm67162_init()
284 data->bytes_per_pixel = 2; in rm67162_init()
288 return -ENOTSUP; in rm67162_init()
290 ret = mipi_dsi_dcs_write(config->mipi_dsi, config->channel, in rm67162_init()
298 ret = mipi_dsi_dcs_write(config->mipi_dsi, config->channel, in rm67162_init()
311 if (config->bl_gpio.port != NULL) { in rm67162_init()
312 ret = gpio_pin_configure_dt(&config->bl_gpio, GPIO_OUTPUT_ACTIVE); in rm67162_init()
319 if (config->te_gpio.port != NULL) { in rm67162_init()
321 ret = gpio_pin_configure_dt(&config->te_gpio, GPIO_INPUT); in rm67162_init()
327 ret = gpio_pin_interrupt_configure_dt(&config->te_gpio, in rm67162_init()
335 gpio_init_callback(&data->te_gpio_cb, rm67162_te_isr_handler, in rm67162_init()
336 BIT(config->te_gpio.pin)); in rm67162_init()
337 ret = gpio_add_callback(config->te_gpio.port, &data->te_gpio_cb); in rm67162_init()
344 k_sem_init(&data->te_sem, 0, 1); in rm67162_init()
348 return mipi_dsi_dcs_write(config->mipi_dsi, config->channel, in rm67162_init()
352 /* Helper to write framebuffer data to rm67162 via MIPI interface. */
356 const struct rm67162_config *config = dev->config; in rm67162_write_fb()
360 /* Note- we need to set custom flags on the DCS message, in rm67162_write_fb()
364 msg.cmd = MIPI_DCS_WRITE_MEMORY_START; in rm67162_write_fb()
366 msg.cmd = MIPI_DCS_WRITE_MEMORY_CONTINUE; in rm67162_write_fb()
373 wlen = mipi_dsi_transfer(config->mipi_dsi, config->channel, &msg); in rm67162_write_fb()
379 len -= wlen; in rm67162_write_fb()
381 msg.cmd = MIPI_DCS_WRITE_MEMORY_CONTINUE; in rm67162_write_fb()
391 const struct rm67162_config *config = dev->config; in rm67162_write()
392 struct rm67162_data *data = dev->data; in rm67162_write()
399 LOG_DBG("W=%d, H=%d @%d,%d", desc->width, desc->height, x, y); in rm67162_write()
403 * to write to the video memory buffer on the RM67162 control IC, in rm67162_write()
410 end = x + desc->width - 1; in rm67162_write()
414 ret = mipi_dsi_dcs_write(config->mipi_dsi, config->channel, in rm67162_write()
424 end = y + desc->height - 1; in rm67162_write()
428 ret = mipi_dsi_dcs_write(config->mipi_dsi, config->channel, in rm67162_write()
436 * Now, write the framebuffer. If the tearing effect GPIO is present, in rm67162_write()
440 if (config->te_gpio.port != NULL) { in rm67162_write()
446 k_sem_take(&data->te_sem, K_FOREVER); in rm67162_write()
453 if (desc->pitch == desc->width) { in rm67162_write()
456 desc->height * desc->width * data->bytes_per_pixel); in rm67162_write()
458 /* Buffer is not contiguous, we must write each line separately */ in rm67162_write()
459 for (h_idx = 0; h_idx < desc->height; h_idx++) { in rm67162_write()
461 desc->width * data->bytes_per_pixel); in rm67162_write()
464 src += data->bytes_per_pixel * (desc->pitch - desc->width); in rm67162_write()
474 const struct rm67162_config *config = dev->config; in rm67162_get_capabilities()
475 const struct rm67162_data *data = dev->data; in rm67162_get_capabilities()
478 capabilities->x_resolution = config->panel_width; in rm67162_get_capabilities()
479 capabilities->y_resolution = config->panel_height; in rm67162_get_capabilities()
480 capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_565 | in rm67162_get_capabilities()
482 switch (data->pixel_format) { in rm67162_get_capabilities()
484 capabilities->current_pixel_format = PIXEL_FORMAT_RGB_565; in rm67162_get_capabilities()
487 capabilities->current_pixel_format = PIXEL_FORMAT_RGB_888; in rm67162_get_capabilities()
494 capabilities->current_orientation = DISPLAY_ORIENTATION_ROTATED_90; in rm67162_get_capabilities()
499 const struct rm67162_config *config = dev->config; in rm67162_blanking_off()
501 if (config->bl_gpio.port != NULL) { in rm67162_blanking_off()
502 return gpio_pin_set_dt(&config->bl_gpio, 1); in rm67162_blanking_off()
504 return -ENOTSUP; in rm67162_blanking_off()
510 const struct rm67162_config *config = dev->config; in rm67162_blanking_on()
512 if (config->bl_gpio.port != NULL) { in rm67162_blanking_on()
513 return gpio_pin_set_dt(&config->bl_gpio, 0); in rm67162_blanking_on()
515 return -ENOTSUP; in rm67162_blanking_on()
522 const struct rm67162_config *config = dev->config; in rm67162_set_pixel_format()
523 struct rm67162_data *data = dev->data; in rm67162_set_pixel_format()
528 data->pixel_format = MIPI_DSI_PIXFMT_RGB565; in rm67162_set_pixel_format()
530 data->bytes_per_pixel = 2; in rm67162_set_pixel_format()
533 data->pixel_format = MIPI_DSI_PIXFMT_RGB888; in rm67162_set_pixel_format()
535 data->bytes_per_pixel = 3; in rm67162_set_pixel_format()
539 return -ENOTSUP; in rm67162_set_pixel_format()
541 return mipi_dsi_dcs_write(config->mipi_dsi, config->channel, in rm67162_set_pixel_format()
552 return -ENOTSUP; in rm67162_set_orientation()
560 const struct rm67162_config *config = dev->config; in rm67162_pm_action()
561 struct rm67162_data *data = dev->data; in rm67162_pm_action()
564 mdev.data_lanes = config->num_of_lanes; in rm67162_pm_action()
565 mdev.pixfmt = data->pixel_format; in rm67162_pm_action()
570 return mipi_dsi_detach(config->mipi_dsi, config->channel, &mdev); in rm67162_pm_action()
572 return mipi_dsi_attach(config->mipi_dsi, config->channel, &mdev); in rm67162_pm_action()
574 return -ENOTSUP; in rm67162_pm_action()
584 .write = rm67162_write,