|
81 | 81 | #define SSD130X_SET_PRECHARGE_PERIOD2_MASK GENMASK(7, 4)
|
82 | 82 | #define SSD130X_SET_PRECHARGE_PERIOD2_SET(val) FIELD_PREP(SSD130X_SET_PRECHARGE_PERIOD2_MASK, (val))
|
83 | 83 | #define SSD130X_SET_COM_PINS_CONFIG1_MASK GENMASK(4, 4)
|
84 |
| -#define SSD130X_SET_COM_PINS_CONFIG1_SET(val) FIELD_PREP(SSD130X_SET_COM_PINS_CONFIG1_MASK, !(val)) |
| 84 | +#define SSD130X_SET_COM_PINS_CONFIG1_SET(val) FIELD_PREP(SSD130X_SET_COM_PINS_CONFIG1_MASK, (val)) |
85 | 85 | #define SSD130X_SET_COM_PINS_CONFIG2_MASK GENMASK(5, 5)
|
86 | 86 | #define SSD130X_SET_COM_PINS_CONFIG2_SET(val) FIELD_PREP(SSD130X_SET_COM_PINS_CONFIG2_MASK, (val))
|
87 | 87 |
|
@@ -298,6 +298,7 @@ static void ssd130x_power_off(struct ssd130x_device *ssd130x)
|
298 | 298 | static int ssd130x_init(struct ssd130x_device *ssd130x)
|
299 | 299 | {
|
300 | 300 | u32 precharge, dclk, com_invdir, compins, chargepump, seg_remap;
|
| 301 | + bool scan_mode; |
301 | 302 | int ret;
|
302 | 303 |
|
303 | 304 | /* Set initial contrast */
|
@@ -360,7 +361,13 @@ static int ssd130x_init(struct ssd130x_device *ssd130x)
|
360 | 361 |
|
361 | 362 | /* Set COM pins configuration */
|
362 | 363 | compins = BIT(1);
|
363 |
| - compins |= (SSD130X_SET_COM_PINS_CONFIG1_SET(ssd130x->com_seq) | |
| 364 | + /* |
| 365 | + * The COM scan mode field values are the inverse of the boolean DT |
| 366 | + * property "solomon,com-seq". The value 0b means scan from COM0 to |
| 367 | + * COM[N - 1] while 1b means scan from COM[N - 1] to COM0. |
| 368 | + */ |
| 369 | + scan_mode = !ssd130x->com_seq; |
| 370 | + compins |= (SSD130X_SET_COM_PINS_CONFIG1_SET(scan_mode) | |
364 | 371 | SSD130X_SET_COM_PINS_CONFIG2_SET(ssd130x->com_lrremap));
|
365 | 372 | ret = ssd130x_write_cmd(ssd130x, 2, SSD130X_SET_COM_PINS_CONFIG, compins);
|
366 | 373 | if (ret < 0)
|
|
0 commit comments