From bd9c71ab0af29f22eda516b3c3541e83aa51b908 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Mon, 16 Oct 2023 06:11:21 +0000 Subject: [PATCH] fix(sensors): Avoid duplicate Kconfig/DTS name. * Upstream added an equivalent fuel gauge driver, so namespace our Kconfig symbol and DTS compatible for the MAX17048 driver. --- app/module/drivers/sensor/CMakeLists.txt | 2 +- app/module/drivers/sensor/max17048/CMakeLists.txt | 4 ++-- app/module/drivers/sensor/max17048/Kconfig | 10 ++++------ app/module/drivers/sensor/max17048/max17048.c | 2 +- .../{maxim,max17048.yml => zmk,maxim-max17048.yml} | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) rename app/module/dts/bindings/sensor/{maxim,max17048.yml => zmk,maxim-max17048.yml} (85%) diff --git a/app/module/drivers/sensor/CMakeLists.txt b/app/module/drivers/sensor/CMakeLists.txt index 9654600a..cd1a1c45 100644 --- a/app/module/drivers/sensor/CMakeLists.txt +++ b/app/module/drivers/sensor/CMakeLists.txt @@ -3,4 +3,4 @@ add_subdirectory_ifdef(CONFIG_ZMK_BATTERY battery) add_subdirectory_ifdef(CONFIG_EC11 ec11) -add_subdirectory_ifdef(CONFIG_MAX17048 max17048) +add_subdirectory_ifdef(CONFIG_ZMK_MAX17048 max17048) diff --git a/app/module/drivers/sensor/max17048/CMakeLists.txt b/app/module/drivers/sensor/max17048/CMakeLists.txt index e895fa11..43b7af4d 100644 --- a/app/module/drivers/sensor/max17048/CMakeLists.txt +++ b/app/module/drivers/sensor/max17048/CMakeLists.txt @@ -5,5 +5,5 @@ zephyr_include_directories(.) zephyr_library() -zephyr_library_sources_ifdef(CONFIG_MAX17048 max17048.c) -zephyr_library_sources_ifndef(CONFIG_MAX17048 ${ZEPHYR_BASE}/misc/empty_file.c) +zephyr_library_sources_ifdef(CONFIG_ZMK_MAX17048 max17048.c) +zephyr_library_sources_ifndef(CONFIG_ZMK_MAX17048 ${ZEPHYR_BASE}/misc/empty_file.c) diff --git a/app/module/drivers/sensor/max17048/Kconfig b/app/module/drivers/sensor/max17048/Kconfig index 8a7ec16e..432949a2 100644 --- a/app/module/drivers/sensor/max17048/Kconfig +++ b/app/module/drivers/sensor/max17048/Kconfig @@ -1,18 +1,16 @@ # Copyright (c) 2022 The ZMK Contributors # SPDX-License-Identifier: MIT -DT_COMPAT_MAXIM_MAX17048 := maxim,max17048 - -menuconfig MAX17048 +menuconfig ZMK_MAX17048 bool "MAX17048/9 I2C-based Fuel Gauge" - default $(dt_compat_enabled,$(DT_COMPAT_MAXIM_MAX17048)) - depends on I2C + default y + depends on DT_HAS_ZMK_MAXIM_MAX17048_ENABLED && I2C select ZMK_BATTERY help Enable driver for MAX17048/9 I2C-based Fuel Gauge. Supports measuring battery voltage and state-of-charge. -if MAX17048 +if ZMK_MAX17048 config SENSOR_MAX17048_INIT_PRIORITY int "Init priority" diff --git a/app/module/drivers/sensor/max17048/max17048.c b/app/module/drivers/sensor/max17048/max17048.c index 24cfe093..43b30af1 100644 --- a/app/module/drivers/sensor/max17048/max17048.c +++ b/app/module/drivers/sensor/max17048/max17048.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#define DT_DRV_COMPAT maxim_max17048 +#define DT_DRV_COMPAT zmk_maxim_max17048 #include #include diff --git a/app/module/dts/bindings/sensor/maxim,max17048.yml b/app/module/dts/bindings/sensor/zmk,maxim-max17048.yml similarity index 85% rename from app/module/dts/bindings/sensor/maxim,max17048.yml rename to app/module/dts/bindings/sensor/zmk,maxim-max17048.yml index 786f4b86..765aeee5 100644 --- a/app/module/dts/bindings/sensor/maxim,max17048.yml +++ b/app/module/dts/bindings/sensor/zmk,maxim-max17048.yml @@ -7,6 +7,6 @@ description: > This is a representation of the Maxim max17048 I2C Fuel Gauge. -compatible: "maxim,max17048" +compatible: "zmk,maxim-max17048" include: [i2c-device.yaml]