Lines Matching +full:write +full:- +full:cmd
4 * SPDX-License-Identifier: Apache-2.0
7 * https://github.com/STMicroelectronics/stm32-nt35510/blob/main/nt35510.c
73 uint8_t cmd[5]; member
78 {.reg = 0xf0, .cmd_len = 5, .cmd = {0x55, 0xaa, 0x52, 0x08, 0x01}},
80 {.reg = 0xb0, .cmd_len = 3, .cmd = {0x03, 0x03, 0x03}},
82 {.reg = 0xb6, .cmd_len = 3, .cmd = {0x46, 0x46, 0x46}},
83 /* AVEE: -5.2V */
84 {.reg = 0xb1, .cmd_len = 3, .cmd = {0x03, 0x03, 0x03}},
86 {.reg = 0xb7, .cmd_len = 3, .cmd = {0x36, 0x36, 0x36}},
87 /* VCL: -2.5V */
88 {.reg = 0xb2, .cmd_len = 3, .cmd = {0x00, 0x00, 0x02}},
90 {.reg = 0xb8, .cmd_len = 3, .cmd = {0x26, 0x26, 0x26}},
92 {.reg = 0xbf, .cmd_len = 1, .cmd = {0x01}},
94 {.reg = 0xb3, .cmd_len = 3, .cmd = {0x09, 0x09, 0x09}},
96 {.reg = 0xb9, .cmd_len = 3, .cmd = {0x36, 0x36, 0x36}},
97 /* VGL_REG: -10V */
98 {.reg = 0xb5, .cmd_len = 3, .cmd = {0x08, 0x08, 0x08}},
100 {.reg = 0xba, .cmd_len = 3, .cmd = {0x26, 0x26, 0x26}},
102 {.reg = 0xbc, .cmd_len = 3, .cmd = {0x00, 0x80, 0x00}},
103 /* VGMN/VGSN:-4.5V/0V */
104 {.reg = 0xbd, .cmd_len = 3, .cmd = {0x00, 0x80, 0x00}},
105 /* VCOM: -1.325V */
106 {.reg = 0xbe, .cmd_len = 2, .cmd = {0x00, 0x50}},
109 {.reg = 0xf0, .cmd_len = 5, .cmd = {0x55, 0xaa, 0x52, 0x08, 0x00}},
111 {.reg = 0xb1, .cmd_len = 2, .cmd = {0xfc, 0x00}},
113 {.reg = 0xb6, .cmd_len = 1, .cmd = {0x03}},
115 {.reg = 0xb5, .cmd_len = 1, .cmd = {0x51}},
117 {.reg = 0xb7, .cmd_len = 2, .cmd = {0x00, 0x00}},
119 {.reg = 0xb8, .cmd_len = 4, .cmd = {0x01, 0x02, 0x02, 0x02}},
121 {.reg = 0xbc, .cmd_len = 3, .cmd = {0x00, 0x00, 0x00}},
123 {.reg = 0xcc, .cmd_len = 3, .cmd = {0x03, 0x00, 0x00}},
125 {.reg = 0xba, .cmd_len = 1, .cmd = {0x01}}};
128 {.reg = NT35510_CMD_MADCTL, .cmd_len = 1, .cmd = {0x00}},
129 {.reg = NT35510_CMD_CASET, .cmd_len = 4, .cmd = {0x00, 0x00, 0x01, 0xdf}},
130 {.reg = NT35510_CMD_RASET, .cmd_len = 4, .cmd = {0x00, 0x00, 0x03, 0x1f}}};
133 {.reg = NT35510_CMD_MADCTL, .cmd_len = 1, .cmd = {0x60}},
134 {.reg = NT35510_CMD_CASET, .cmd_len = 4, .cmd = {0x00, 0x00, 0x03, 0x1f}},
135 {.reg = NT35510_CMD_RASET, .cmd_len = 4, .cmd = {0x00, 0x00, 0x01, 0xdf}}};
139 {.reg = NT35510_CMD_WRDISBV, .cmd_len = 1, .cmd = {0x7f}},
141 {.reg = NT35510_CMD_WRCTRLD, .cmd_len = 1, .cmd = {0x2c}},
143 {.reg = NT35510_CMD_WRCABC, .cmd_len = 1, .cmd = {0x02}},
145 {.reg = NT35510_CMD_WRCABCMB, .cmd_len = 1, .cmd = {0xff}},
147 {.reg = MIPI_DCS_SET_DISPLAY_ON, .cmd_len = 0, .cmd = {}},
148 /* Send Command GRAM memory write (no parameters)
149 * this initiates frame write via other DSI commands sent by
152 {.reg = NT35510_CMD_RAMWR, .cmd_len = 0, .cmd = {}},
155 /* Write data buffer to LCD register */
159 const struct nt35510_config *cfg = dev->config; in nt35510_write_reg()
161 ret = mipi_dsi_dcs_write(cfg->mipi_dsi, cfg->channel, reg, buf, len); in nt35510_write_reg()
169 /* Write an 8-bit value to a register */
175 /* Write a list of commands to registers */
176 static int nt35510_write_sequence(const struct device *dev, const struct nt35510_init_cmd *cmd, in nt35510_write_sequence() argument
183 ret = nt35510_write_reg(dev, cmd->reg, cmd->cmd, cmd->cmd_len); in nt35510_write_sequence()
184 cmd++; in nt35510_write_sequence()
192 struct nt35510_data *data = dev->data; in nt35510_config()
203 if (data->orientation == DISPLAY_ORIENTATION_NORMAL) { in nt35510_config()
222 data->pixel_format == PIXEL_FORMAT_RGB_565 in nt35510_config()
236 const struct nt35510_config *cfg = dev->config; in nt35510_blanking_on()
239 if (cfg->backlight.port != NULL) { in nt35510_blanking_on()
240 ret = gpio_pin_set_dt(&cfg->backlight, 0); in nt35510_blanking_on()
251 const struct nt35510_config *cfg = dev->config; in nt35510_blanking_off()
254 if (cfg->backlight.port != NULL) { in nt35510_blanking_off()
255 ret = gpio_pin_set_dt(&cfg->backlight, 1); in nt35510_blanking_off()
272 const struct nt35510_config *cfg = dev->config; in nt35510_get_capabilities()
273 struct nt35510_data *data = dev->data; in nt35510_get_capabilities()
276 capabilities->x_resolution = cfg->width; in nt35510_get_capabilities()
277 capabilities->y_resolution = cfg->height; in nt35510_get_capabilities()
278 capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_565 | PIXEL_FORMAT_RGB_888; in nt35510_get_capabilities()
279 capabilities->current_pixel_format = data->pixel_format; in nt35510_get_capabilities()
280 capabilities->current_orientation = data->orientation; in nt35510_get_capabilities()
286 struct nt35510_data *data = dev->data; in nt35510_set_pixel_format()
289 data->pixel_format = pixel_format; in nt35510_set_pixel_format()
293 return -ENOTSUP; in nt35510_set_pixel_format()
298 const struct nt35510_config *cfg = dev->config; in nt35510_check_id()
302 ret = mipi_dsi_dcs_read(cfg->mipi_dsi, cfg->channel, NT35510_CMD_RDID2, &id, 1); in nt35510_check_id()
305 return -EIO; in nt35510_check_id()
310 return -EINVAL; in nt35510_check_id()
317 const struct nt35510_config *cfg = dev->config; in nt35510_init()
318 struct nt35510_data *data = dev->data; in nt35510_init()
322 if (cfg->reset.port) { in nt35510_init()
323 if (!gpio_is_ready_dt(&cfg->reset)) { in nt35510_init()
325 return -ENODEV; in nt35510_init()
327 ret = gpio_pin_configure_dt(&cfg->reset, GPIO_OUTPUT_INACTIVE); in nt35510_init()
333 ret = gpio_pin_set_dt(&cfg->reset, 1); in nt35510_init()
342 if (cfg->rotation == 0) { in nt35510_init()
343 data->xres = cfg->width; in nt35510_init()
344 data->yres = cfg->height; in nt35510_init()
345 data->orientation = DISPLAY_ORIENTATION_NORMAL; in nt35510_init()
346 } else if (cfg->rotation == 90) { in nt35510_init()
347 data->xres = cfg->height; in nt35510_init()
348 data->yres = cfg->width; in nt35510_init()
349 data->orientation = DISPLAY_ORIENTATION_ROTATED_90; in nt35510_init()
350 } else if (cfg->rotation == 180) { in nt35510_init()
351 data->xres = cfg->width; in nt35510_init()
352 data->yres = cfg->height; in nt35510_init()
353 data->orientation = DISPLAY_ORIENTATION_ROTATED_180; in nt35510_init()
354 } else if (cfg->rotation == 270) { in nt35510_init()
355 data->xres = cfg->height; in nt35510_init()
356 data->yres = cfg->width; in nt35510_init()
357 data->orientation = DISPLAY_ORIENTATION_ROTATED_270; in nt35510_init()
360 /* Attach to MIPI-DSI host */ in nt35510_init()
361 mdev.data_lanes = cfg->data_lanes; in nt35510_init()
364 if (data->pixel_format == PIXEL_FORMAT_RGB_565) { in nt35510_init()
370 mdev.timings.hactive = data->xres; in nt35510_init()
374 mdev.timings.vactive = data->yres; in nt35510_init()
379 ret = mipi_dsi_attach(cfg->mipi_dsi, cfg->channel, &mdev); in nt35510_init()
381 LOG_ERR("MIPI-DSI attach failed! (%d)", ret); in nt35510_init()
391 ret = gpio_pin_configure_dt(&cfg->backlight, GPIO_OUTPUT_ACTIVE); in nt35510_init()