forked from luck/tmp_suning_uos_patched
leds: netxbig: remove legacy board-file support
Since commit ebc278f157
("ARM: mvebu: remove static LED setup for
netxbig boards"), no one in upstream passes in the platform data to
this driver.
Squash leds-kirkwood-netxbig.h into the driver, and remove the legacy
board-file support.
Link: https://lkml.org/lkml/2019/7/20/83
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
This commit is contained in:
parent
246eab59ee
commit
156189a6d7
|
@ -590,6 +590,7 @@ config LEDS_NETXBIG
|
|||
tristate "LED support for Big Network series LEDs"
|
||||
depends on LEDS_CLASS
|
||||
depends on MACH_KIRKWOOD
|
||||
depends on OF_GPIO
|
||||
default y
|
||||
help
|
||||
This option enables support for LEDs found on the LaCie 2Big
|
||||
|
|
|
@ -15,7 +15,48 @@
|
|||
#include <linux/gpio.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/platform_data/leds-kirkwood-netxbig.h>
|
||||
|
||||
struct netxbig_gpio_ext {
|
||||
unsigned int *addr;
|
||||
int num_addr;
|
||||
unsigned int *data;
|
||||
int num_data;
|
||||
unsigned int enable;
|
||||
};
|
||||
|
||||
enum netxbig_led_mode {
|
||||
NETXBIG_LED_OFF,
|
||||
NETXBIG_LED_ON,
|
||||
NETXBIG_LED_SATA,
|
||||
NETXBIG_LED_TIMER1,
|
||||
NETXBIG_LED_TIMER2,
|
||||
NETXBIG_LED_MODE_NUM,
|
||||
};
|
||||
|
||||
#define NETXBIG_LED_INVALID_MODE NETXBIG_LED_MODE_NUM
|
||||
|
||||
struct netxbig_led_timer {
|
||||
unsigned long delay_on;
|
||||
unsigned long delay_off;
|
||||
enum netxbig_led_mode mode;
|
||||
};
|
||||
|
||||
struct netxbig_led {
|
||||
const char *name;
|
||||
const char *default_trigger;
|
||||
int mode_addr;
|
||||
int *mode_val;
|
||||
int bright_addr;
|
||||
int bright_max;
|
||||
};
|
||||
|
||||
struct netxbig_led_platform_data {
|
||||
struct netxbig_gpio_ext *gpio_ext;
|
||||
struct netxbig_led_timer *timer;
|
||||
int num_timer;
|
||||
struct netxbig_led *leds;
|
||||
int num_leds;
|
||||
};
|
||||
|
||||
/*
|
||||
* GPIO extension bus.
|
||||
|
@ -306,7 +347,6 @@ static int create_netxbig_led(struct platform_device *pdev,
|
|||
return devm_led_classdev_register(&pdev->dev, &led_dat->cdev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF_GPIO
|
||||
static int gpio_ext_get_of_pdata(struct device *dev, struct device_node *np,
|
||||
struct netxbig_gpio_ext *gpio_ext)
|
||||
{
|
||||
|
@ -522,30 +562,20 @@ static const struct of_device_id of_netxbig_leds_match[] = {
|
|||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_netxbig_leds_match);
|
||||
#else
|
||||
static inline int
|
||||
netxbig_leds_get_of_pdata(struct device *dev,
|
||||
struct netxbig_led_platform_data *pdata)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif /* CONFIG_OF_GPIO */
|
||||
|
||||
static int netxbig_led_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct netxbig_led_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||
struct netxbig_led_platform_data *pdata;
|
||||
struct netxbig_led_data *leds_data;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
if (!pdata) {
|
||||
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
|
||||
if (!pdata)
|
||||
return -ENOMEM;
|
||||
ret = netxbig_leds_get_of_pdata(&pdev->dev, pdata);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
|
||||
if (!pdata)
|
||||
return -ENOMEM;
|
||||
ret = netxbig_leds_get_of_pdata(&pdev->dev, pdata);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
leds_data = devm_kcalloc(&pdev->dev,
|
||||
pdata->num_leds, sizeof(*leds_data),
|
||||
|
@ -571,7 +601,7 @@ static struct platform_driver netxbig_led_driver = {
|
|||
.probe = netxbig_led_probe,
|
||||
.driver = {
|
||||
.name = "leds-netxbig",
|
||||
.of_match_table = of_match_ptr(of_netxbig_leds_match),
|
||||
.of_match_table = of_netxbig_leds_match,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* Platform data structure for netxbig LED driver
|
||||
*
|
||||
* This file is licensed under the terms of the GNU General Public
|
||||
* License version 2. This program is licensed "as is" without any
|
||||
* warranty of any kind, whether express or implied.
|
||||
*/
|
||||
|
||||
#ifndef __LEDS_KIRKWOOD_NETXBIG_H
|
||||
#define __LEDS_KIRKWOOD_NETXBIG_H
|
||||
|
||||
struct netxbig_gpio_ext {
|
||||
unsigned *addr;
|
||||
int num_addr;
|
||||
unsigned *data;
|
||||
int num_data;
|
||||
unsigned enable;
|
||||
};
|
||||
|
||||
enum netxbig_led_mode {
|
||||
NETXBIG_LED_OFF,
|
||||
NETXBIG_LED_ON,
|
||||
NETXBIG_LED_SATA,
|
||||
NETXBIG_LED_TIMER1,
|
||||
NETXBIG_LED_TIMER2,
|
||||
NETXBIG_LED_MODE_NUM,
|
||||
};
|
||||
|
||||
#define NETXBIG_LED_INVALID_MODE NETXBIG_LED_MODE_NUM
|
||||
|
||||
struct netxbig_led_timer {
|
||||
unsigned long delay_on;
|
||||
unsigned long delay_off;
|
||||
enum netxbig_led_mode mode;
|
||||
};
|
||||
|
||||
struct netxbig_led {
|
||||
const char *name;
|
||||
const char *default_trigger;
|
||||
int mode_addr;
|
||||
int *mode_val;
|
||||
int bright_addr;
|
||||
int bright_max;
|
||||
};
|
||||
|
||||
struct netxbig_led_platform_data {
|
||||
struct netxbig_gpio_ext *gpio_ext;
|
||||
struct netxbig_led_timer *timer;
|
||||
int num_timer;
|
||||
struct netxbig_led *leds;
|
||||
int num_leds;
|
||||
};
|
||||
|
||||
#endif /* __LEDS_KIRKWOOD_NETXBIG_H */
|
Loading…
Reference in New Issue
Block a user