#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/mfd/88pm860x.h>
#include <linux/module.h>
#define LED_PWM_MASK (0x1F)
#define LED_CURRENT_MASK (0x07 << 5)
#define LED_BLINK_MASK (0x7F)
#define LED_ON_CONTINUOUS (0x0F << 3)
#define LED1_BLINK_EN (1 << 1)
#define LED2_BLINK_EN (1 << 2)
struct led_classdev cdev;
struct pm860x_chip *chip;
char name[MFD_NAME_SIZE];
unsigned char brightness;
unsigned char current_brightness;
static int led_power_set(struct pm860x_chip *chip, int port, int on)
ret = on ? pm8606_osc_enable(chip, RGB1_ENABLE) :
pm8606_osc_disable(chip, RGB1_ENABLE);
ret = on ? pm8606_osc_enable(chip, RGB2_ENABLE) :
pm8606_osc_disable(chip, RGB2_ENABLE);
static int pm860x_led_set(struct led_classdev *cdev,
enum led_brightness value)
struct pm860x_led *led = container_of(cdev, struct pm860x_led, cdev);
struct pm860x_chip *chip;
led->brightness = value >> 3;
if ((led->current_brightness == 0) && led->brightness) {
led_power_set(chip, led->port, 1);
pm860x_set_bits(led->i2c, led->reg_control,
LED_CURRENT_MASK, led->iset);
pm860x_set_bits(led->i2c, led->reg_blink,
LED_BLINK_MASK, LED_ON_CONTINUOUS);
pm860x_set_bits(led->i2c, PM8606_WLED3B, led->blink_mask,