drivers: display: ili9340: move VCOM parameters to DT
Move VCOM control 1/2 register values to DT. Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
parent
a1ce0c851d
commit
4895620eb0
8 changed files with 40 additions and 30 deletions
|
@ -53,6 +53,8 @@
|
||||||
spi-max-frequency = <12000000>;
|
spi-max-frequency = <12000000>;
|
||||||
label = "DISPLAY";
|
label = "DISPLAY";
|
||||||
pwctrl1 = [1b 00];
|
pwctrl1 = [1b 00];
|
||||||
|
vmctrl1 = [3f 3c];
|
||||||
|
vmctrl2 = [b7];
|
||||||
pgamctrl = [0f 2a 28 08 0e 08 54 a9 43 0a 0f 00 00 00 00];
|
pgamctrl = [0f 2a 28 08 0e 08 54 a9 43 0a 0f 00 00 00 00];
|
||||||
ngamctrl = [00 15 17 07 11 06 2b 56 3c 05 10 0f 3f 3f 0f];
|
ngamctrl = [00 15 17 07 11 06 2b 56 3c 05 10 0f 3f 3f 0f];
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
pixel-format = <ILI9340_PIXEL_FORMAT_RGB888>;
|
pixel-format = <ILI9340_PIXEL_FORMAT_RGB888>;
|
||||||
rotation = <90>;
|
rotation = <90>;
|
||||||
pwctrl1 = [23 00];
|
pwctrl1 = [23 00];
|
||||||
|
vmctrl1 = [3e 28];
|
||||||
|
vmctrl2 = [86];
|
||||||
pgamctrl = [0f 31 2b 0c 0e 08 4e f1 37 07 10 03 0e 09 00];
|
pgamctrl = [0f 31 2b 0c 0e 08 4e f1 37 07 10 03 0e 09 00];
|
||||||
ngamctrl = [00 0e 14 03 11 07 31 c1 48 08 0f 0c 31 36 0f];
|
ngamctrl = [00 0e 14 03 11 07 31 c1 48 08 0f 0c 31 36 0f];
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
pixel-format = <ILI9340_PIXEL_FORMAT_RGB565>;
|
pixel-format = <ILI9340_PIXEL_FORMAT_RGB565>;
|
||||||
rotation = <0>;
|
rotation = <0>;
|
||||||
pwctrl1 = [23 00];
|
pwctrl1 = [23 00];
|
||||||
|
vmctrl1 = [3e 28];
|
||||||
|
vmctrl2 = [86];
|
||||||
pgamctrl = [0f 31 2b 0c 0e 08 4e f1 37 07 10 03 0e 09 00];
|
pgamctrl = [0f 31 2b 0c 0e 08 4e f1 37 07 10 03 0e 09 00];
|
||||||
ngamctrl = [00 0e 14 03 11 07 31 c1 48 08 0f 0c 31 36 0f];
|
ngamctrl = [00 0e 14 03 11 07 31 c1 48 08 0f 0c 31 36 0f];
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,6 +39,8 @@ struct ili9340_config {
|
||||||
uint8_t gamset[ILI9340_GAMSET_LEN];
|
uint8_t gamset[ILI9340_GAMSET_LEN];
|
||||||
uint8_t pwctrl1[ILI9340_PWCTRL1_LEN];
|
uint8_t pwctrl1[ILI9340_PWCTRL1_LEN];
|
||||||
uint8_t pwctrl2[ILI9340_PWCTRL2_LEN];
|
uint8_t pwctrl2[ILI9340_PWCTRL2_LEN];
|
||||||
|
uint8_t vmctrl1[ILI9340_VMCTRL1_LEN];
|
||||||
|
uint8_t vmctrl2[ILI9340_VMCTRL2_LEN];
|
||||||
uint8_t pgamctrl[ILI9340_PGAMCTRL_LEN];
|
uint8_t pgamctrl[ILI9340_PGAMCTRL_LEN];
|
||||||
uint8_t ngamctrl[ILI9340_NGAMCTRL_LEN];
|
uint8_t ngamctrl[ILI9340_NGAMCTRL_LEN];
|
||||||
};
|
};
|
||||||
|
@ -390,6 +392,22 @@ static int ili9340_configure(const struct device *dev)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_HEXDUMP_DBG(config->vmctrl1, ILI9340_VMCTRL1_LEN, "VMCTRL1");
|
||||||
|
memcpy(tx_data, config->vmctrl1, ILI9340_VMCTRL1_LEN);
|
||||||
|
r = ili9340_transmit(dev, ILI9340_CMD_VCOM_CTRL_1, tx_data,
|
||||||
|
ILI9340_VMCTRL1_LEN);
|
||||||
|
if (r < 0) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_HEXDUMP_DBG(config->vmctrl2, ILI9340_VMCTRL2_LEN, "VMCTRL2");
|
||||||
|
memcpy(tx_data, config->vmctrl2, ILI9340_VMCTRL2_LEN);
|
||||||
|
r = ili9340_transmit(dev, ILI9340_CMD_VCOM_CTRL_2, tx_data,
|
||||||
|
ILI9340_VMCTRL2_LEN);
|
||||||
|
if (r < 0) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
LOG_HEXDUMP_DBG(config->pgamctrl, ILI9340_PGAMCTRL_LEN, "PGAMCTRL");
|
LOG_HEXDUMP_DBG(config->pgamctrl, ILI9340_PGAMCTRL_LEN, "PGAMCTRL");
|
||||||
memcpy(tx_data, config->pgamctrl, ILI9340_PGAMCTRL_LEN);
|
memcpy(tx_data, config->pgamctrl, ILI9340_PGAMCTRL_LEN);
|
||||||
r = ili9340_transmit(dev, ILI9340_CMD_POSITIVE_GAMMA_CORRECTION,
|
r = ili9340_transmit(dev, ILI9340_CMD_POSITIVE_GAMMA_CORRECTION,
|
||||||
|
@ -527,6 +545,8 @@ static const struct display_driver_api ili9340_api = {
|
||||||
.gamset = DT_INST_PROP(index, gamset), \
|
.gamset = DT_INST_PROP(index, gamset), \
|
||||||
.pwctrl1 = DT_INST_PROP(index, pwctrl1), \
|
.pwctrl1 = DT_INST_PROP(index, pwctrl1), \
|
||||||
.pwctrl2 = DT_INST_PROP(index, pwctrl2), \
|
.pwctrl2 = DT_INST_PROP(index, pwctrl2), \
|
||||||
|
.vmctrl1 = DT_INST_PROP(index, vmctrl1), \
|
||||||
|
.vmctrl2 = DT_INST_PROP(index, vmctrl2), \
|
||||||
.pgamctrl = DT_INST_PROP(index, pgamctrl), \
|
.pgamctrl = DT_INST_PROP(index, pgamctrl), \
|
||||||
.ngamctrl = DT_INST_PROP(index, ngamctrl), \
|
.ngamctrl = DT_INST_PROP(index, ngamctrl), \
|
||||||
}; \
|
}; \
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
#define ILI9340_GAMSET_LEN 1U
|
#define ILI9340_GAMSET_LEN 1U
|
||||||
#define ILI9340_PWCTRL1_LEN 2U
|
#define ILI9340_PWCTRL1_LEN 2U
|
||||||
#define ILI9340_PWCTRL2_LEN 1U
|
#define ILI9340_PWCTRL2_LEN 1U
|
||||||
|
#define ILI9340_VMCTRL1_LEN 2U
|
||||||
|
#define ILI9340_VMCTRL2_LEN 1U
|
||||||
#define ILI9340_PGAMCTRL_LEN 15U
|
#define ILI9340_PGAMCTRL_LEN 15U
|
||||||
#define ILI9340_NGAMCTRL_LEN 15U
|
#define ILI9340_NGAMCTRL_LEN 15U
|
||||||
|
|
||||||
|
|
|
@ -11,19 +11,6 @@ int ili9340_lcd_init(const struct device *dev)
|
||||||
int r;
|
int r;
|
||||||
uint8_t tx_data[15];
|
uint8_t tx_data[15];
|
||||||
|
|
||||||
tx_data[0] = 0x3e;
|
|
||||||
tx_data[1] = 0x28;
|
|
||||||
r = ili9340_transmit(dev, ILI9340_CMD_VCOM_CTRL_1, tx_data, 2);
|
|
||||||
if (r < 0) {
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
tx_data[0] = 0x86;
|
|
||||||
r = ili9340_transmit(dev, ILI9340_CMD_VCOM_CTRL_2, tx_data, 1);
|
|
||||||
if (r < 0) {
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
tx_data[0] = 0x00;
|
tx_data[0] = 0x00;
|
||||||
tx_data[1] = 0x18;
|
tx_data[1] = 0x18;
|
||||||
r = ili9340_transmit(dev, ILI9340_CMD_FRAME_CTRL_NORMAL_MODE, tx_data, 2);
|
r = ili9340_transmit(dev, ILI9340_CMD_FRAME_CTRL_NORMAL_MODE, tx_data, 2);
|
||||||
|
|
|
@ -82,23 +82,6 @@ int ili9340_lcd_init(const struct device *dev)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* VCM control */
|
|
||||||
cmd = ILI9340_CMD_VCOM_CTRL_1;
|
|
||||||
data[0] = 0x3FU;
|
|
||||||
data[1] = 0x3CU;
|
|
||||||
r = ili9340_transmit(dev, cmd, data, 2);
|
|
||||||
if (r < 0) {
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* VCM control2 */
|
|
||||||
cmd = ILI9340_CMD_VCOM_CTRL_2;
|
|
||||||
data[0] = 0xB7U;
|
|
||||||
r = ili9340_transmit(dev, cmd, data, 1);
|
|
||||||
if (r < 0) {
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Frame Rate */
|
/* Frame Rate */
|
||||||
cmd = ILI9340_CMD_FRAME_CTRL_NORMAL_MODE;
|
cmd = ILI9340_CMD_FRAME_CTRL_NORMAL_MODE;
|
||||||
data[0] = 0x00U;
|
data[0] = 0x00U;
|
||||||
|
|
|
@ -66,6 +66,18 @@ properties:
|
||||||
description:
|
description:
|
||||||
Power control 2 (PWCTRL2) register values.
|
Power control 2 (PWCTRL2) register values.
|
||||||
|
|
||||||
|
vmctrl1:
|
||||||
|
type: uint8-array
|
||||||
|
default: [0x31, 0x3c]
|
||||||
|
description:
|
||||||
|
VCOM control 1 (VMCTRL1) register values.
|
||||||
|
|
||||||
|
vmctrl2:
|
||||||
|
type: uint8-array
|
||||||
|
default: [0xc0]
|
||||||
|
description:
|
||||||
|
VCOM control 2 (VMCTRL2) register values.
|
||||||
|
|
||||||
pgamctrl:
|
pgamctrl:
|
||||||
type: uint8-array
|
type: uint8-array
|
||||||
default: [
|
default: [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue