1 /*
2 * Copyright (c) 2020 Teslabs Engineering S.L.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include "display_ili9488.h"
8 #include "display_ili9xxx.h"
9
10 #include <zephyr/logging/log.h>
11 LOG_MODULE_REGISTER(display_ili9488, CONFIG_DISPLAY_LOG_LEVEL);
12
ili9488_regs_init(const struct device * dev)13 int ili9488_regs_init(const struct device *dev)
14 {
15 const struct ili9xxx_config *config = dev->config;
16 const struct ili9488_regs *regs = config->regs;
17
18 int r;
19
20 LOG_HEXDUMP_DBG(regs->frmctr1, ILI9488_FRMCTR1_LEN, "FRMCTR1");
21 r = ili9xxx_transmit(dev, ILI9488_FRMCTR1, regs->frmctr1,
22 ILI9488_FRMCTR1_LEN);
23 if (r < 0) {
24 return r;
25 }
26
27 LOG_HEXDUMP_DBG(regs->disctrl, ILI9488_DISCTRL_LEN, "DISCTRL");
28 r = ili9xxx_transmit(dev, ILI9488_DISCTRL, regs->disctrl,
29 ILI9488_DISCTRL_LEN);
30 if (r < 0) {
31 return r;
32 }
33
34 LOG_HEXDUMP_DBG(regs->pwctrl1, ILI9488_PWCTRL1_LEN, "PWCTRL1");
35 r = ili9xxx_transmit(dev, ILI9488_PWCTRL1, regs->pwctrl1,
36 ILI9488_PWCTRL1_LEN);
37 if (r < 0) {
38 return r;
39 }
40
41 LOG_HEXDUMP_DBG(regs->pwctrl2, ILI9488_PWCTRL2_LEN, "PWCTRL2");
42 r = ili9xxx_transmit(dev, ILI9488_PWCTRL2, regs->pwctrl2,
43 ILI9488_PWCTRL2_LEN);
44 if (r < 0) {
45 return r;
46 }
47
48 LOG_HEXDUMP_DBG(regs->vmctrl, ILI9488_VMCTRL_LEN, "VMCTRL");
49 r = ili9xxx_transmit(dev, ILI9488_VMCTRL, regs->vmctrl,
50 ILI9488_VMCTRL_LEN);
51 if (r < 0) {
52 return r;
53 }
54
55 LOG_HEXDUMP_DBG(regs->pgamctrl, ILI9488_PGAMCTRL_LEN, "PGAMCTRL");
56 r = ili9xxx_transmit(dev, ILI9488_PGAMCTRL, regs->pgamctrl,
57 ILI9488_PGAMCTRL_LEN);
58 if (r < 0) {
59 return r;
60 }
61
62 LOG_HEXDUMP_DBG(regs->ngamctrl, ILI9488_NGAMCTRL_LEN, "NGAMCTRL");
63 r = ili9xxx_transmit(dev, ILI9488_NGAMCTRL, regs->ngamctrl,
64 ILI9488_NGAMCTRL_LEN);
65 if (r < 0) {
66 return r;
67 }
68
69 return 0;
70 }
71