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>; reset-gpios = <&gpio0 15 0>;
dc-gpios = <&gpio0 16 0>; dc-gpios = <&gpio0 16 0>;
busy-gpios = <&gpio0 14 0>; busy-gpios = <&gpio0 14 0>;
gdv-a = <0x10>; gdv = [10 0a];
gdv-b = <0x0a>; sdv = [19];
sdv = <0x19>;
vcom = <0xa8>; vcom = <0xa8>;
border-waveform = <0x71>; 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; u8_t scan_mode;
}; };
#if defined(DT_INST_0_GD_GDE0213B1) static u8_t ssd16xx_lut_initial[] = DT_INST_0_SOLOMON_SSD16XXFB_LUT_INITIAL;
static u8_t ssd16xx_lut_initial[] = { static u8_t ssd16xx_lut_default[] = DT_INST_0_SOLOMON_SSD16XXFB_LUT_DEFAULT;
0x22, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x11, #if defined(DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, static u8_t ssd16xx_softstart[] = DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART;
0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, #endif
0x01, 0x00, 0x00, 0x00, 0x00 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[] = { #ifndef DT_INST_0_SOLOMON_SSD16XXFB_LUT_INITIAL
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, #error "No initial waveform look up table (LUT) selected!"
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, #endif
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
};
static u8_t ssd16xx_lut_default[] = { #ifndef DT_INST_0_SOLOMON_SSD16XXFB_LUT_DEFAULT
0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00, #error "No default waveform look up table (LUT) selected!"
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!"
#endif #endif
static inline int ssd16xx_write_cmd(struct ssd16xx_data *driver, static inline int ssd16xx_write_cmd(struct ssd16xx_data *driver,
@ -500,29 +470,22 @@ static int ssd16xx_controller_init(struct device *dev)
return err; return err;
} }
#if defined(DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART_1) #if defined(DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART)
tmp[0] = DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART_1; err = ssd16xx_write_cmd(driver, SSD16XX_CMD_SOFTSTART,
tmp[1] = DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART_2; ssd16xx_softstart, sizeof(ssd16xx_softstart));
tmp[2] = DT_INST_0_SOLOMON_SSD16XXFB_SOFTSTART_3;
err = ssd16xx_write_cmd(driver, SSD16XX_CMD_SOFTSTART, tmp, 3);
if (err < 0) { if (err < 0) {
return err; return err;
} }
#endif #endif
tmp[0] = DT_INST_0_SOLOMON_SSD16XXFB_GDV_A; err = ssd16xx_write_cmd(driver, SSD16XX_CMD_GDV_CTRL, ssd16xx_gdv,
#if defined(DT_INST_0_SOLOMON_SSD16XXFB_GDV_B) sizeof(ssd16xx_gdv));
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
if (err < 0) { if (err < 0) {
return err; return err;
} }
tmp[0] = DT_INST_0_SOLOMON_SSD16XXFB_SDV; err = ssd16xx_write_cmd(driver, SSD16XX_CMD_SDV_CTRL, ssd16xx_sdv,
err = ssd16xx_write_cmd(driver, SSD16XX_CMD_SDV_CTRL, tmp, 1); sizeof(ssd16xx_sdv));
if (err < 0) { if (err < 0) {
return err; return err;
} }

View file

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