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:
Kumar Gala 2018-10-18 16:58:53 -05:00 committed by Anas Nashif
commit 060b8c1512
3 changed files with 35 additions and 60 deletions

View file

@ -17,59 +17,13 @@ LOG_MODULE_REGISTER(ssd1306);
#include "ssd1306_regs.h"
#include <display/cfb.h>
#if !defined(CONFIG_SSD1306_I2C_MASTER_DEV_NAME)
#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)
#if CONFIG_SSD1306_PANEL_SEGMENT_REMAP == 1
#define SSD1306_PANEL_SEGMENT_REMAP true
#else
#define SSD1306_PANEL_SEGMENT_REMAP false
#endif
#if defined(I2C_0_SSD1306_COM_INVDIR)
#define SSD1306_PANEL_COM_INVDIR true
#elif defined(I2C_1_SSD1306_COM_INVDIR)
#if CONFIG_SSD1306_PANEL_COM_INVDIR == 1
#define SSD1306_PANEL_COM_INVDIR true
#else
#define SSD1306_PANEL_COM_INVDIR false