display: ssd1673: Convert to new DT_<COMPAT>_<INSTANCE> defines

Convert ssd1673 display driver to use new defines so we can remove
the dts_fixup.h code for it.  Also dropped "-spi" from compatible.

Fix up references in reel_board dts and sample.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2019-01-29 10:17:07 -06:00 committed by Kumar Gala
commit 3b42943fe7
6 changed files with 27 additions and 42 deletions

View file

@ -38,7 +38,7 @@ struct ssd1673_data {
struct device *busy;
struct device *spi_dev;
struct spi_config spi_config;
#if defined(DT_SSD1673_SPI_GPIO_CS_DRV_NAME)
#if defined(DT_SOLOMON_SSD1673FB_0_CS_GPIO_CONTROLLER)
struct spi_cs_control cs_ctrl;
#endif
u8_t scan_mode;
@ -69,7 +69,7 @@ static inline int ssd1673_write_cmd(struct ssd1673_data *driver,
struct spi_buf buf = {.buf = &cmd, .len = sizeof(cmd)};
struct spi_buf_set buf_set = {.buffers = &buf, .count = 1};
gpio_pin_write(driver->dc, DT_SSD1673_DC_PIN, 0);
gpio_pin_write(driver->dc, DT_SOLOMON_SSD1673FB_0_DC_GPIOS_PIN, 0);
err = spi_write(driver->spi_dev, &driver->spi_config, &buf_set);
if (err < 0) {
return err;
@ -78,7 +78,7 @@ static inline int ssd1673_write_cmd(struct ssd1673_data *driver,
if (data != NULL) {
buf.buf = data;
buf.len = len;
gpio_pin_write(driver->dc, DT_SSD1673_DC_PIN, 1);
gpio_pin_write(driver->dc, DT_SOLOMON_SSD1673FB_0_DC_GPIOS_PIN, 1);
err = spi_write(driver->spi_dev, &driver->spi_config, &buf_set);
if (err < 0) {
return err;
@ -92,10 +92,10 @@ static inline void ssd1673_busy_wait(struct ssd1673_data *driver)
{
u32_t val = 0U;
gpio_pin_read(driver->busy, DT_SSD1673_BUSY_PIN, &val);
gpio_pin_read(driver->busy, DT_SOLOMON_SSD1673FB_0_BUSY_GPIOS_PIN, &val);
while (val) {
k_busy_wait(SSD1673_BUSY_DELAY);
gpio_pin_read(driver->busy, DT_SSD1673_BUSY_PIN, &val);
gpio_pin_read(driver->busy, DT_SOLOMON_SSD1673FB_0_BUSY_GPIOS_PIN, &val);
}
}
@ -140,7 +140,7 @@ static inline int ssd1673_set_ram_ptr(struct ssd1673_data *driver,
static void ssd1673_set_orientation_internall(struct ssd1673_data *driver)
{
#if DT_SSD1673_ORIENTATION_FLIPPED == 1
#if DT_SOLOMON_SSD1673FB_0_ORIENTATION_FLIPPED == 1
driver->scan_mode = SSD1673_DATA_ENTRY_XIYDY;
#else
driver->scan_mode = SSD1673_DATA_ENTRY_XDYIY;
@ -387,7 +387,7 @@ static int ssd1673_clear_and_write_buffer(struct device *dev)
return err;
}
gpio_pin_write(driver->dc, DT_SSD1673_DC_PIN, 0);
gpio_pin_write(driver->dc, DT_SOLOMON_SSD1673FB_0_DC_GPIOS_PIN, 0);
tmp = SSD1673_CMD_WRITE_RAM;
sbuf.buf = &tmp;
@ -397,7 +397,7 @@ static int ssd1673_clear_and_write_buffer(struct device *dev)
return err;
}
gpio_pin_write(driver->dc, DT_SSD1673_DC_PIN, 1);
gpio_pin_write(driver->dc, DT_SOLOMON_SSD1673FB_0_DC_GPIOS_PIN, 1);
memset(clear_page, 0xff, sizeof(clear_page));
sbuf.buf = clear_page;
@ -420,9 +420,9 @@ static int ssd1673_controller_init(struct device *dev)
LOG_DBG("");
gpio_pin_write(driver->reset, DT_SSD1673_RESET_PIN, 0);
gpio_pin_write(driver->reset, DT_SOLOMON_SSD1673FB_0_RESET_GPIOS_PIN, 0);
k_sleep(SSD1673_RESET_DELAY);
gpio_pin_write(driver->reset, DT_SSD1673_RESET_PIN, 1);
gpio_pin_write(driver->reset, DT_SOLOMON_SSD1673FB_0_RESET_GPIOS_PIN, 1);
k_sleep(SSD1673_RESET_DELAY);
ssd1673_busy_wait(driver);
@ -502,53 +502,53 @@ static int ssd1673_init(struct device *dev)
LOG_DBG("");
driver->spi_dev = device_get_binding(DT_SSD1673_SPI_DEV_NAME);
driver->spi_dev = device_get_binding(DT_SOLOMON_SSD1673FB_0_BUS_NAME);
if (driver->spi_dev == NULL) {
LOG_ERR("Could not get SPI device for SSD1673");
return -EIO;
}
driver->spi_config.frequency = DT_SSD1673_SPI_FREQ;
driver->spi_config.frequency = DT_SOLOMON_SSD1673FB_0_SPI_MAX_FREQUENCY;
driver->spi_config.operation = SPI_OP_MODE_MASTER | SPI_WORD_SET(8);
driver->spi_config.slave = DT_SSD1673_SPI_SLAVE_NUMBER;
driver->spi_config.slave = DT_SOLOMON_SSD1673FB_0_BASE_ADDRESS;
driver->spi_config.cs = NULL;
driver->reset = device_get_binding(DT_SSD1673_RESET_GPIO_PORT_NAME);
driver->reset = device_get_binding(DT_SOLOMON_SSD1673FB_0_RESET_GPIOS_CONTROLLER);
if (driver->reset == NULL) {
LOG_ERR("Could not get GPIO port for SSD1673 reset");
return -EIO;
}
gpio_pin_configure(driver->reset, DT_SSD1673_RESET_PIN,
gpio_pin_configure(driver->reset, DT_SOLOMON_SSD1673FB_0_RESET_GPIOS_PIN,
GPIO_DIR_OUT);
driver->dc = device_get_binding(DT_SSD1673_DC_GPIO_PORT_NAME);
driver->dc = device_get_binding(DT_SOLOMON_SSD1673FB_0_DC_GPIOS_CONTROLLER);
if (driver->dc == NULL) {
LOG_ERR("Could not get GPIO port for SSD1673 DC signal");
return -EIO;
}
gpio_pin_configure(driver->dc, DT_SSD1673_DC_PIN,
gpio_pin_configure(driver->dc, DT_SOLOMON_SSD1673FB_0_DC_GPIOS_PIN,
GPIO_DIR_OUT);
driver->busy = device_get_binding(DT_SSD1673_BUSY_GPIO_PORT_NAME);
driver->busy = device_get_binding(DT_SOLOMON_SSD1673FB_0_BUSY_GPIOS_CONTROLLER);
if (driver->busy == NULL) {
LOG_ERR("Could not get GPIO port for SSD1673 busy signal");
return -EIO;
}
gpio_pin_configure(driver->busy, DT_SSD1673_BUSY_PIN,
gpio_pin_configure(driver->busy, DT_SOLOMON_SSD1673FB_0_BUSY_GPIOS_PIN,
GPIO_DIR_IN);
#if defined(DT_SSD1673_SPI_GPIO_CS_DRV_NAME)
#if defined(DT_SOLOMON_SSD1673FB_0_CS_GPIO_CONTROLLER)
driver->cs_ctrl.gpio_dev = device_get_binding(
DT_SSD1673_SPI_GPIO_CS_DRV_NAME);
DT_SOLOMON_SSD1673FB_0_CS_GPIO_CONTROLLER);
if (!driver->cs_ctrl.gpio_dev) {
LOG_ERR("Unable to get SPI GPIO CS device");
return -EIO;
}
driver->cs_ctrl.gpio_pin = DT_SSD1673_SPI_GPIO_CS_PIN;
driver->cs_ctrl.gpio_pin = DT_SOLOMON_SSD1673FB_0_CS_GPIO_PIN;
driver->cs_ctrl.delay = 0;
driver->spi_config.cs = &driver->cs_ctrl;
#endif
@ -572,7 +572,7 @@ static struct display_driver_api ssd1673_driver_api = {
};
DEVICE_AND_API_INIT(ssd1673, DT_SSD1673_DEV_NAME, ssd1673_init,
DEVICE_AND_API_INIT(ssd1673, DT_SOLOMON_SSD1673FB_0_LABEL, ssd1673_init,
&ssd1673_driver, NULL,
POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY,
&ssd1673_driver_api);