mirror of
https://github.com/hardkernel/kernel_common_drivers.git
synced 2026-06-25 12:03:48 +09:00
led: combine led modules [1/1]
PD#SWPL-95684 Problem: combine led modules Solution: result: amlogic-led.ko original: amlogic-led-tlc59116.ko amlogic-led-aw9523b.ko amlogic-led-state.ko Verify: Detail info Change-Id: I856b5ff0754e8d2da859969b9fc1b5e9a114b6dc Signed-off-by: qinglin.li <qinglin.li@amlogic.com>
This commit is contained in:
@@ -204,17 +204,11 @@ CONFIG_AMLOGIC_GKI_TOOL=m
|
||||
# amlogic-pwm.ko
|
||||
CONFIG_AMLOGIC_PWM_MESON=m
|
||||
|
||||
# support led
|
||||
CONFIG_AMLOGIC_LED=y
|
||||
|
||||
# leds-tlc59116.ko
|
||||
CONFIG_AMLOGIC_LEDS_TLC59116=m
|
||||
|
||||
# leds_state.ko
|
||||
CONFIG_AMLOGIC_LEDS_STATE=m
|
||||
|
||||
# leds-aw9523b.ko
|
||||
CONFIG_AMLOGIC_LEDS_AW9523B=m
|
||||
# amlogic-led.ko
|
||||
CONFIG_AMLOGIC_LED=m
|
||||
CONFIG_AMLOGIC_LEDS_TLC59116=y
|
||||
CONFIG_AMLOGIC_LEDS_STATE=y
|
||||
CONFIG_AMLOGIC_LEDS_AW9523B=y
|
||||
|
||||
# pwm-regulator.ko
|
||||
CONFIG_REGULATOR_PWM=m
|
||||
|
||||
@@ -205,17 +205,11 @@ CONFIG_AMLOGIC_GKI_TOOL=m
|
||||
# amlogic-pwm.ko
|
||||
CONFIG_AMLOGIC_PWM_MESON=m
|
||||
|
||||
# support led
|
||||
CONFIG_AMLOGIC_LED=y
|
||||
|
||||
# leds-tlc59116.ko
|
||||
CONFIG_AMLOGIC_LEDS_TLC59116=m
|
||||
|
||||
# leds_state.ko
|
||||
CONFIG_AMLOGIC_LEDS_STATE=m
|
||||
|
||||
# leds-aw9523b.ko
|
||||
CONFIG_AMLOGIC_LEDS_AW9523B=m
|
||||
# amlogic-led.ko
|
||||
CONFIG_AMLOGIC_LED=m
|
||||
CONFIG_AMLOGIC_LEDS_TLC59116=y
|
||||
CONFIG_AMLOGIC_LEDS_STATE=y
|
||||
CONFIG_AMLOGIC_LEDS_AW9523B=y
|
||||
|
||||
# pwm-regulator.ko
|
||||
CONFIG_REGULATOR_PWM=m
|
||||
|
||||
+11
-9
@@ -1,22 +1,24 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
#
|
||||
# LED drivers configuration
|
||||
#
|
||||
|
||||
menuconfig AMLOGIC_LED
|
||||
bool "Amlogic LED Support"
|
||||
config AMLOGIC_LED
|
||||
tristate "Amlogic LED Support"
|
||||
default n
|
||||
help
|
||||
Say Y here to get to see options for led drivers.
|
||||
amlogic led support
|
||||
select y for built-in
|
||||
select m for ko
|
||||
select n for disable
|
||||
This option alone does not add any kernel code.
|
||||
|
||||
If you say N, all options in this submenu will be
|
||||
skipped and disabled.
|
||||
|
||||
|
||||
if AMLOGIC_LED
|
||||
|
||||
config AMLOGIC_LEDS_TLC59116
|
||||
tristate "LED Support for the TLC59116"
|
||||
bool "LED Support for the TLC59116"
|
||||
depends on LEDS_CLASS
|
||||
default n
|
||||
help
|
||||
@@ -24,7 +26,7 @@ config AMLOGIC_LEDS_TLC59116
|
||||
TLC59116.
|
||||
|
||||
config AMLOGIC_LEDS_AW9523B
|
||||
tristate "LED Support for the AW9523B"
|
||||
bool "LED Support for the AW9523B"
|
||||
depends on LEDS_CLASS
|
||||
default n
|
||||
help
|
||||
@@ -32,11 +34,11 @@ config AMLOGIC_LEDS_AW9523B
|
||||
AW9523B.
|
||||
|
||||
config AMLOGIC_LEDS_STATE
|
||||
tristate "LED state support"
|
||||
bool "LED state support"
|
||||
depends on LEDS_CLASS
|
||||
default n
|
||||
help
|
||||
Choose this option if you want to use the LED state
|
||||
and led function
|
||||
and led function
|
||||
|
||||
endif
|
||||
|
||||
+9
-18
@@ -1,22 +1,13 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
|
||||
TLC_MODULE_NAME = amlogic-led-tlc59116
|
||||
obj-$(CONFIG_AMLOGIC_LEDS_TLC59116) += $(TLC_MODULE_NAME).o
|
||||
$(TLC_MODULE_NAME)-y += leds-tlc59116.o
|
||||
PR_FMT_TLC = $(subst amlogic-,,$(TLC_MODULE_NAME))
|
||||
PR_FMT_DEFINE_TLC="-Dpr_fmt(fmt)= \"[$(PR_FMT_TLC)]: \" fmt"
|
||||
CFLAGS_leds-tlc59116.o += $(PR_FMT_DEFINE_TLC)
|
||||
MODULE_NAME = amlogic-led
|
||||
|
||||
AW_MODULE_NAME = amlogic-led-aw9523b
|
||||
obj-$(CONFIG_AMLOGIC_LEDS_AW9523B) += $(AW_MODULE_NAME).o
|
||||
$(AW_MODULE_NAME)-y += leds-aw9523b.o
|
||||
PR_FMT_AW = $(subst amlogic-,,$(AW_MODULE_NAME))
|
||||
PR_FMT_DEFINE_AW="-Dpr_fmt(fmt)= \"[$(PR_FMT_AW)]: \" fmt"
|
||||
CFLAGS_leds-aw9523b.o += $(PR_FMT_DEFINE_AW)
|
||||
PR_FMT = $(subst amlogic-,,$(MODULE_NAME))
|
||||
PR_FMT_DEFINE="-Dpr_fmt(fmt)= \"[$(PR_FMT)]: \" fmt"
|
||||
ccflags-y += $(PR_FMT_DEFINE)
|
||||
|
||||
STATE_MODULE_NAME = amlogic-led-state
|
||||
obj-$(CONFIG_AMLOGIC_LEDS_STATE) += $(STATE_MODULE_NAME).o
|
||||
$(STATE_MODULE_NAME)-y += leds_state.o
|
||||
PR_FMT_STATE = $(subst amlogic-,,$(STATE_MODULE_NAME))
|
||||
PR_FMT_DEFINE_STATE="-Dpr_fmt(fmt)= \"[$(PR_FMT_STATE)]: \" fmt"
|
||||
CFLAGS_leds_state.o += $(PR_FMT_DEFINE_STATE)
|
||||
obj-$(CONFIG_AMLOGIC_LED) = $(MODULE_NAME).o
|
||||
$(MODULE_NAME)-y = main.o
|
||||
$(MODULE_NAME)-$(CONFIG_AMLOGIC_LEDS_TLC59116) += leds-tlc59116.o
|
||||
$(MODULE_NAME)-$(CONFIG_AMLOGIC_LEDS_AW9523B) += leds-aw9523b.o
|
||||
$(MODULE_NAME)-$(CONFIG_AMLOGIC_LEDS_STATE) += leds_state.o
|
||||
@@ -991,8 +991,12 @@ static struct i2c_driver meson_aw9523_driver = {
|
||||
.id_table = aw9523_i2c_id,
|
||||
};
|
||||
|
||||
module_i2c_driver(meson_aw9523_driver);
|
||||
int __init led_aw9523_init(void)
|
||||
{
|
||||
return i2c_add_driver(&meson_aw9523_driver);
|
||||
}
|
||||
|
||||
MODULE_AUTHOR("Tiger Hu <huyh@seirobotics.net>");
|
||||
MODULE_DESCRIPTION("AW9523 LED Driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
void __exit led_aw9523_exit(void)
|
||||
{
|
||||
return i2c_del_driver(&meson_aw9523_driver);
|
||||
}
|
||||
|
||||
@@ -771,7 +771,12 @@ static struct i2c_driver meson_tlc59116_driver = {
|
||||
.id_table = meson_tlc59116_i2c_id,
|
||||
};
|
||||
|
||||
module_i2c_driver(meson_tlc59116_driver);
|
||||
MODULE_AUTHOR("Bichao Zheng <bichao.zheng@amlogic.com>");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_DESCRIPTION("TLC59116 LED Driver");
|
||||
int __init led_tlc59116_init(void)
|
||||
{
|
||||
return i2c_add_driver(&meson_tlc59116_driver);
|
||||
}
|
||||
|
||||
void __exit led_tlc59116_exit(void)
|
||||
{
|
||||
return i2c_del_driver(&meson_tlc59116_driver);
|
||||
}
|
||||
|
||||
@@ -385,8 +385,12 @@ static struct platform_driver led_state_driver = {
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(led_state_driver);
|
||||
int __init led_state_init(void)
|
||||
{
|
||||
return platform_driver_register(&led_state_driver);
|
||||
}
|
||||
|
||||
MODULE_AUTHOR("Bichao Zheng <bichao.zheng@amlogic.com>");
|
||||
MODULE_DESCRIPTION("LED STATE driver for amlogic");
|
||||
MODULE_LICENSE("GPL");
|
||||
void __exit led_state_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&led_state_driver);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
/*
|
||||
* Copyright (c) 2019 Amlogic, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
//#define DEBUG
|
||||
#include <linux/module.h>
|
||||
#include <linux/amlogic/module_merge.h>
|
||||
#include "main.h"
|
||||
|
||||
static int __init led_main_init(void)
|
||||
{
|
||||
pr_debug("### %s() start\n", __func__);
|
||||
call_sub_init(led_tlc59116_init);
|
||||
call_sub_init(led_aw9523_init);
|
||||
call_sub_init(led_state_init);
|
||||
pr_debug("### %s() end\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit led_main_exit(void)
|
||||
{
|
||||
led_state_exit();
|
||||
led_aw9523_init();
|
||||
led_tlc59116_init();
|
||||
}
|
||||
|
||||
module_init(led_main_init);
|
||||
module_exit(led_main_exit);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
@@ -0,0 +1,51 @@
|
||||
/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
|
||||
/*
|
||||
* Copyright (c) 2019 Amlogic, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __LED_MAIN_H_
|
||||
#define __LED_MAIN_H_
|
||||
|
||||
#if IS_ENABLED(CONFIG_AMLOGIC_LEDS_STATE)
|
||||
int led_state_init(void);
|
||||
void led_state_exit(void);
|
||||
#else
|
||||
static inline void led_state_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int led_state_exit(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_AMLOGIC_LEDS_AW9523B)
|
||||
int led_aw9523_init(void);
|
||||
void led_aw9523_exit(void);
|
||||
#else
|
||||
static inline int led_aw9523_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void led_aw9523_exit(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_AMLOGIC_LEDS_TLC59116)
|
||||
int led_tlc59116_init(void);
|
||||
void led_tlc59116_exit(void);
|
||||
#else
|
||||
static inline int led_tlc59116_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void led_tlc59116_exit(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__LED_MAIN_H_*/
|
||||
Reference in New Issue
Block a user