#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/platform_data/leds-s3c24xx.h>
#include <mach/regs-gpio.h>
#include <plat/gpio-cfg.h>
struct s3c24xx_gpio_led {
struct led_classdev cdev;
struct s3c24xx_led_platdata *pdata;
static inline struct s3c24xx_gpio_led *to_gpio(struct led_classdev *led_cdev)
return container_of(led_cdev, struct s3c24xx_gpio_led, cdev);
static void s3c24xx_led_set(struct led_classdev *led_cdev,
enum led_brightness value)
struct s3c24xx_gpio_led *led = to_gpio(led_cdev);
struct s3c24xx_led_platdata *pd = led->pdata;
int state = (value ? 1 : 0) ^ (pd->flags & S3C24XX_LEDF_ACTLOW);
gpio_set_value(pd->gpio, state);
if (pd->flags & S3C24XX_LEDF_TRISTATE) {
gpio_direction_output(pd->gpio, state);
gpio_direction_input(pd->gpio);
static int s3c24xx_led_probe(struct platform_device *dev)
struct s3c24xx_led_platdata *pdata = dev_get_platdata(&dev->dev);
struct s3c24xx_gpio_led *led;
led = devm_kzalloc(&dev->dev, sizeof(struct s3c24xx_gpio_led),