drivers: ssd16xx: use bytestring property for LUT and parameters

Use bytestring property for LUT, gdv, sdv and
softstart parameter.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
This commit is contained in:
Johann Fischer 2019-07-08 15:05:12 +02:00 committed by Maureen Helm
commit 8dcd06ff7c
3 changed files with 49 additions and 82 deletions

View file

@ -163,11 +163,22 @@ arduino_i2c: &i2c0 {
reset-gpios = <&gpio0 15 0>;
dc-gpios = <&gpio0 16 0>;
busy-gpios = <&gpio0 14 0>;
gdv-a = <0x10>;
gdv-b = <0x0a>;
sdv = <0x19>;
gdv = [10 0a];
sdv = [19];
vcom = <0xa8>;
border-waveform = <0x71>;
lut-initial = [
22 55 AA 55 AA 55 AA 11
00 00 00 00 00 00 00 00
1E 1E 1E 1E 1E 1E 1E 1E
01 00 00 00 00
];
lut-default = [
18 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
0F 01 00 00 00 00 00 00
00 00 00 00 00
];
};
};

View file

@ -62,50 +62,20 @@ struct ssd16xx_data {
u8_t scan_mode;
};
#if defined(DT_INST_0_GD_GDE0213B1)
static u8_t ssd16xx_lut_initial[] = {
0x22, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x11,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E,
0x01, 0x00, 0x00, 0x00, 0x00
};
static u8_t ssd16xx_lut_initial[] = DT_INST_0_SOLOMON_SSD16XXFB_LUT_INITIAL;
static u8_t ssd16xx_lut_default[] = DT_INST_0_SOLOMON_SSD16XXFB_LUT_DEFAULT;
#if defined(DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART)
static u8_t ssd16xx_softstart[] = DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART;
#endif
static u8_t ssd16xx_gdv[] = DT_INST_0_SOLOMON_SSD16XXFB_GDV;
static u8_t ssd16xx_sdv[] = DT_INST_0_SOLOMON_SSD16XXFB_SDV;
static u8_t ssd16xx_lut_default[] = {
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00
};
#elif defined(DT_INST_0_GD_GDE029A1)
static u8_t ssd16xx_lut_initial[] = {
0x50, 0xAA, 0x55, 0xAA, 0x11, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x1F, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
#ifndef DT_INST_0_SOLOMON_SSD16XXFB_LUT_INITIAL
#error "No initial waveform look up table (LUT) selected!"
#endif
static u8_t ssd16xx_lut_default[] = {
0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
#elif defined(DT_INST_0_HINK_E0154A05)
static u8_t ssd16xx_lut_initial[] = {
0x02, 0x02, 0x01, 0x11, 0x12, 0x12, 0x22, 0x22,
0x66, 0x69, 0x69, 0x59, 0x58, 0x99, 0x99, 0x88,
0x00, 0x00, 0x00, 0x00, 0xF8, 0xB4, 0x13, 0x51,
0x35, 0x51, 0x51, 0x19, 0x01, 0x00
};
static u8_t ssd16xx_lut_default[] = {
0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
#else
#error "No waveform look up table (LUT) selected!"
#ifndef DT_INST_0_SOLOMON_SSD16XXFB_LUT_DEFAULT
#error "No default waveform look up table (LUT) selected!"
#endif
static inline int ssd16xx_write_cmd(struct ssd16xx_data *driver,
@ -500,29 +470,22 @@ static int ssd16xx_controller_init(struct device *dev)
return err;
}
#if defined(DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART_1)
tmp[0] = DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART_1;
tmp[1] = DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART_2;
tmp[2] = DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART_3;
err = ssd16xx_write_cmd(driver, SSD16XX_CMD_SOFTSTART, tmp, 3);
#if defined(DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART)
err = ssd16xx_write_cmd(driver, SSD16XX_CMD_SOFTSTART,
ssd16xx_softstart, sizeof(ssd16xx_softstart));
if (err < 0) {
return err;
}
#endif
tmp[0] = DT_INST_0_SOLOMON_SSD16XXFB_GDV_A;
#if defined(DT_INST_0_SOLOMON_SSD16XXFB_GDV_B)
tmp[1] = DT_INST_0_SOLOMON_SSD16XXFB_GDV_B;
err = ssd16xx_write_cmd(driver, SSD16XX_CMD_GDV_CTRL, tmp, 2);
#else
err = ssd16xx_write_cmd(driver, SSD16XX_CMD_GDV_CTRL, tmp, 1);
#endif
err = ssd16xx_write_cmd(driver, SSD16XX_CMD_GDV_CTRL, ssd16xx_gdv,
sizeof(ssd16xx_gdv));
if (err < 0) {
return err;
}
tmp[0] = DT_INST_0_SOLOMON_SSD16XXFB_SDV;
err = ssd16xx_write_cmd(driver, SSD16XX_CMD_SDV_CTRL, tmp, 1);
err = ssd16xx_write_cmd(driver, SSD16XX_CMD_SDV_CTRL, ssd16xx_sdv,
sizeof(ssd16xx_sdv));
if (err < 0) {
return err;
}

View file

@ -31,20 +31,15 @@ properties:
required: true
description: Number of bits used for the width parameters
gdv-a:
type: int
gdv:
type: uint8-array
required: true
description: Gate driving voltage (A value)
gdv-b:
type: int
required: false
description: Gate driving voltage (B value)
description: Gate driving voltage values
sdv:
type: int
type: uint8-array
required: true
description: Source driving voltage
description: Source driving voltage values
vcom:
type: int
@ -56,20 +51,10 @@ properties:
required: true
description: Border waveform
softstart-1:
type: int
softstart:
type: uint8-array
required: false
description: Booster soft start phase 1
softstart-2:
type: int
required: false
description: Booster soft start phase 2
softstart-3:
type: int
required: false
description: Booster soft start phase 3
description: Booster soft start values
orientation-flipped:
type: boolean
@ -87,3 +72,11 @@ properties:
busy-gpios:
type: phandle-array
required: true
lut-initial:
type: uint8-array
required: true
lut-default:
type: uint8-array
required: true