drivers: misc: grove_lcd: port to Devicetree

The driver was never migrated to Devicetree, this patch converts the
driver to a proper Devicetree based device.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-01-29 11:24:15 +01:00 committed by Marti Bolivar
commit 0bb486aa29
3 changed files with 20 additions and 11 deletions

View file

@ -1,9 +1,12 @@
/* /*
* Copyright (c) 2015 Intel Corporation * Copyright (c) 2015 Intel Corporation
* Copyright (c) 2022 Nordic Semiconductor ASA
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#define DT_DRV_COMPAT seeed_grove_lcd_rgb
#include <errno.h> #include <errno.h>
#include <kernel.h> #include <kernel.h>
#include <init.h> #include <init.h>
@ -335,14 +338,6 @@ static struct glcd_data grove_lcd_driver = {
.function = 0, .function = 0,
}; };
/* Since device_get_binding() will not return any DEVICE_DT_INST_DEFINE(0, glcd_initialize, NULL, &grove_lcd_driver,
* reference to a driver instance if driver_api &grove_lcd_config, POST_KERNEL,
* is NULL and grove_lcd does not have any API struct, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, NULL);
* just populate it with some magic number
* so grove_lcd can be referenced.
* since grove_lcd_driver struct is available, populating with it
*/
DEVICE_DEFINE(grove_lcd, GROVE_LCD_NAME, glcd_initialize,
NULL, &grove_lcd_driver, &grove_lcd_config,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
(void *)&grove_lcd_driver);

View file

@ -0,0 +1,8 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
description: Seeed Grove LCD RGB
compatible: "seeed,grove-lcd-rgb"
include: i2c-device.yaml

View file

@ -28,4 +28,10 @@
/delete-property/ current-speed; /delete-property/ current-speed;
/delete-property/ rxpo; /delete-property/ rxpo;
/delete-property/ txpo; /delete-property/ txpo;
glcd: glcd@3e {
compatible = "seeed,grove-lcd-rgb";
label = "GLCD";
reg = <0x3e>;
};
}; };