drivers: ssd1306: fixup dts support
A few issues with the dts support for the SSD1306 display driver: 1. binding file mixed description & generation up together - rename most uses of generation to description and add proper generation field into yaml 2. Drop use of BASE_LABEL, this shouldn't be used by most bindings 3. dts defines that are being assumed in driver aren't correct. We should be using a dts_fixup.h in the sample to map the generated defines to those used in the driver. We remove the incorrect defines that the driver assumes right now. 4. Fixup 'segment-remap' and 'com-invdir' properties that are booleans in the binding file and associated code changes. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
ce4be3af86
commit
060b8c1512
3 changed files with 35 additions and 60 deletions
|
@ -17,59 +17,13 @@ LOG_MODULE_REGISTER(ssd1306);
|
||||||
#include "ssd1306_regs.h"
|
#include "ssd1306_regs.h"
|
||||||
#include <display/cfb.h>
|
#include <display/cfb.h>
|
||||||
|
|
||||||
#if !defined(CONFIG_SSD1306_I2C_MASTER_DEV_NAME)
|
#if CONFIG_SSD1306_PANEL_SEGMENT_REMAP == 1
|
||||||
#if defined(I2C_0_SSD1306_BUS_NAME)
|
|
||||||
#define CONFIG_SSD1306_I2C_MASTER_DEV_NAME I2C_0_SSD1306_BUS_NAME
|
|
||||||
#elif defined(I2C_1_SSD1306_BUS_NAME)
|
|
||||||
#define CONFIG_SSD1306_I2C_MASTER_DEV_NAME I2C_1_SSD1306_BUS_NAME
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(CONFIG_SSD1306_I2C_ADDR)
|
|
||||||
#if defined(I2C_0_SSD1306_BASE_ADDRESS)
|
|
||||||
#define CONFIG_SSD1306_I2C_ADDR I2C_0_SSD1306_BASE_ADDRESS
|
|
||||||
#elif defined(I2C_1_SSD1306_BASE_ADDRESS)
|
|
||||||
#define CONFIG_SSD1306_I2C_ADDR I2C_1_SSD1306_BASE_ADDRESS
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(CONFIG_SSD1306_DEV_NAME)
|
|
||||||
#if defined(I2C_0_SSD1306_LABEL)
|
|
||||||
#define CONFIG_SSD1306_DEV_NAME I2C_0_SSD1306_LABEL
|
|
||||||
#elif defined(I2C_1_SSD1306_LABEL)
|
|
||||||
#define CONFIG_SSD1306_DEV_NAME I2C_1_SSD1306_LABEL
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(I2C_0_SSD1306_HEIGHT)
|
|
||||||
#define SSD1306_PANEL_WIDTH I2C_0_SSD1306_WIDTH
|
|
||||||
#define SSD1306_PANEL_HEIGHT I2C_0_SSD1306_HEIGHT
|
|
||||||
#define SSD1306_PANEL_FIRST_SEG I2C_0_SSD1306_SEGMENT_OFFSET
|
|
||||||
#define SSD1306_PANEL_DISPLAY_OFFSET I2C_0_SSD1306_DISPLAY_OFFSET
|
|
||||||
#define SSD1306_PANEL_PAGE_OFFSET I2C_0_SSD1306_PAGE_OFFSET
|
|
||||||
#define SSD1306_PANEL_PRECHARGE_PERIOD I2C_0_SSD1306_PRECHARGEP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(I2C_1_SSD1306_HEIGHT)
|
|
||||||
#define SSD1306_PANEL_WIDTH I2C_1_SSD1306_WIDTH
|
|
||||||
#define SSD1306_PANEL_HEIGHT I2C_1_SSD1306_HEIGHT
|
|
||||||
#define SSD1306_PANEL_FIRST_SEG I2C_1_SSD1306_SEGMENT_OFFSET
|
|
||||||
#define SSD1306_PANEL_DISPLAY_OFFSET I2C_1_SSD1306_DISPLAY_OFFSET
|
|
||||||
#define SSD1306_PANEL_PAGE_OFFSET I2C_1_SSD1306_PAGE_OFFSET
|
|
||||||
#define SSD1306_PANEL_PRECHARGE_PERIOD I2C_1_SSD1306_PRECHARGEP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(I2C_0_SSD1306_SEGMENT_REMAP)
|
|
||||||
#define SSD1306_PANEL_SEGMENT_REMAP true
|
|
||||||
#elif defined(I2C_1_SSD1306_SEGMENT_REMAP)
|
|
||||||
#define SSD1306_PANEL_SEGMENT_REMAP true
|
#define SSD1306_PANEL_SEGMENT_REMAP true
|
||||||
#else
|
#else
|
||||||
#define SSD1306_PANEL_SEGMENT_REMAP false
|
#define SSD1306_PANEL_SEGMENT_REMAP false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(I2C_0_SSD1306_COM_INVDIR)
|
#if CONFIG_SSD1306_PANEL_COM_INVDIR == 1
|
||||||
#define SSD1306_PANEL_COM_INVDIR true
|
|
||||||
#elif defined(I2C_1_SSD1306_COM_INVDIR)
|
|
||||||
#define SSD1306_PANEL_COM_INVDIR true
|
#define SSD1306_PANEL_COM_INVDIR true
|
||||||
#else
|
#else
|
||||||
#define SSD1306_PANEL_COM_INVDIR false
|
#define SSD1306_PANEL_COM_INVDIR false
|
||||||
|
|
|
@ -20,48 +20,54 @@ properties:
|
||||||
height:
|
height:
|
||||||
type: int
|
type: int
|
||||||
category: required
|
category: required
|
||||||
generation: Height in pixel of the panel driven by the controller
|
description: Height in pixel of the panel driven by the controller
|
||||||
|
generation: define
|
||||||
|
|
||||||
width:
|
width:
|
||||||
type: int
|
type: int
|
||||||
category: required
|
category: required
|
||||||
generation: Width in pixel of the panel driven by the controller
|
description: Width in pixel of the panel driven by the controller
|
||||||
|
generation: define
|
||||||
|
|
||||||
segment-offset:
|
segment-offset:
|
||||||
type: int
|
type: int
|
||||||
category: required
|
category: required
|
||||||
generation: 8-bit column start address for Page Addressing Mode
|
description: 8-bit column start address for Page Addressing Mode
|
||||||
|
generation: define
|
||||||
|
|
||||||
page-offset:
|
page-offset:
|
||||||
type: int
|
type: int
|
||||||
category: required
|
category: required
|
||||||
generation: Start address for Page Addressing Mode
|
description: Start address for Page Addressing Mode
|
||||||
|
generation: define
|
||||||
|
|
||||||
display-offset:
|
display-offset:
|
||||||
type: int
|
type: int
|
||||||
category: required
|
category: required
|
||||||
generation: mapping of the display start line to one of COM0 .. COM63
|
description: mapping of the display start line to one of COM0 .. COM63
|
||||||
|
generation: define
|
||||||
|
|
||||||
segment-remap:
|
segment-remap:
|
||||||
type: string
|
type: boolean
|
||||||
category: optional
|
category: optional
|
||||||
generation: Last column address is mapped to first segment
|
description: Last column address is mapped to first segment
|
||||||
|
generation: define
|
||||||
|
|
||||||
com-invdir:
|
com-invdir:
|
||||||
type: string
|
type: boolean
|
||||||
category: optional
|
category: optional
|
||||||
generation: Scan direction is from last COM output to first COM output
|
description: Scan direction is from last COM output to first COM output
|
||||||
|
generation: define
|
||||||
|
|
||||||
prechargep:
|
prechargep:
|
||||||
type: int
|
type: int
|
||||||
category: required
|
category: required
|
||||||
generation: Duration of the pre-charge period
|
description: Duration of the pre-charge period
|
||||||
|
generation: define
|
||||||
|
|
||||||
reset-gpios:
|
reset-gpios:
|
||||||
type: compound
|
type: compound
|
||||||
category: optional
|
category: optional
|
||||||
generation: define, use-prop-name
|
generation: define, use-prop-name
|
||||||
|
|
||||||
base_label: SSD1306
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
15
samples/display/cfb/dts_fixup.h
Normal file
15
samples/display/cfb/dts_fixup.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#if defined(CONFIG_HAS_DTS_I2C) && defined(CONFIG_SSD1306)
|
||||||
|
|
||||||
|
#define CONFIG_SSD1306_I2C_ADDR NXP_KINETIS_I2C_40066000_SOLOMON_SSD1306FB_I2C_3C_BASE_ADDRESS
|
||||||
|
#define CONFIG_SSD1306_I2C_MASTER_DEV_NAME NXP_KINETIS_I2C_40066000_SOLOMON_SSD1306FB_I2C_3C_BUS_NAME
|
||||||
|
#define CONFIG_SSD1306_DEV_NAME NXP_KINETIS_I2C_40066000_SOLOMON_SSD1306FB_I2C_3C_LABEL
|
||||||
|
#define CONFIG_SSD1306_PANEL_COM_INVDIR NXP_KINETIS_I2C_40066000_SOLOMON_SSD1306FB_I2C_3C_COM_INVDIR
|
||||||
|
#define SSD1306_PANEL_DISPLAY_OFFSET NXP_KINETIS_I2C_40066000_SOLOMON_SSD1306FB_I2C_3C_DISPLAY_OFFSET
|
||||||
|
#define SSD1306_PANEL_HEIGHT NXP_KINETIS_I2C_40066000_SOLOMON_SSD1306FB_I2C_3C_HEIGHT
|
||||||
|
#define SSD1306_PANEL_PAGE_OFFSET NXP_KINETIS_I2C_40066000_SOLOMON_SSD1306FB_I2C_3C_PAGE_OFFSET
|
||||||
|
#define SSD1306_PANEL_PRECHARGE_PERIOD NXP_KINETIS_I2C_40066000_SOLOMON_SSD1306FB_I2C_3C_PRECHARGEP
|
||||||
|
#define SSD1306_PANEL_FIRST_SEG NXP_KINETIS_I2C_40066000_SOLOMON_SSD1306FB_I2C_3C_SEGMENT_OFFSET
|
||||||
|
#define CONFIG_SSD1306_PANEL_SEGMENT_REMAP NXP_KINETIS_I2C_40066000_SOLOMON_SSD1306FB_I2C_3C_SEGMENT_REMAP
|
||||||
|
#define SSD1306_PANEL_WIDTH NXP_KINETIS_I2C_40066000_SOLOMON_SSD1306FB_I2C_3C_WIDTH
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue