leds-qpnp: revert changes made by op

Change-Id: I80c710dbee8f57fe522a82f4b5bd0c6e09c0553f
This commit is contained in:
codeworkx 2018-12-14 18:07:27 +01:00
parent aa79d2f01e
commit dc9467f236

View file

@ -251,8 +251,6 @@
#define NUM_KPDBL_LEDS 4 #define NUM_KPDBL_LEDS 4
#define KPDBL_MASTER_BIT_INDEX 0 #define KPDBL_MASTER_BIT_INDEX 0
static u8 shutdown_enable = 0;
/** /**
* enum qpnp_leds - QPNP supported led ids * enum qpnp_leds - QPNP supported led ids
* @QPNP_ID_WLED - White led backlight * @QPNP_ID_WLED - White led backlight
@ -2563,12 +2561,11 @@ static ssize_t duty_pcts_store(struct device *dev,
struct led_classdev *led_cdev = dev_get_drvdata(dev); struct led_classdev *led_cdev = dev_get_drvdata(dev);
char *buffer; char *buffer;
ssize_t ret; ssize_t ret;
int rets; int i = 0;
//int i = 0;
int max_duty_pcts; int max_duty_pcts;
struct pwm_config_data *pwm_cfg; struct pwm_config_data *pwm_cfg;
u32 previous_num_duty_pcts; u32 previous_num_duty_pcts;
//int value; int value;
int *previous_duty_pcts; int *previous_duty_pcts;
led = container_of(led_cdev, struct qpnp_led_data, cdev); led = container_of(led_cdev, struct qpnp_led_data, cdev);
@ -2599,24 +2596,16 @@ static ssize_t duty_pcts_store(struct device *dev,
buffer = (char *)buf; buffer = (char *)buf;
rets= sscanf((const char *)buffer, for (i = 0; i < max_duty_pcts; i++) {
"bean %x %x %x %x %x %x %x %x %x %x %x ", if (buffer == NULL)
&pwm_cfg->old_duty_pcts[0], &pwm_cfg->old_duty_pcts[1], break;
&pwm_cfg->old_duty_pcts[2], &pwm_cfg->old_duty_pcts[3], ret = sscanf((const char *)buffer, "%u,%s", &value, buffer);
&pwm_cfg->old_duty_pcts[4], &pwm_cfg->old_duty_pcts[5], pwm_cfg->old_duty_pcts[i] = value;
&pwm_cfg->old_duty_pcts[6],&pwm_cfg->old_duty_pcts[7], num_duty_pcts++;
&pwm_cfg->old_duty_pcts[8], &pwm_cfg->old_duty_pcts[9], if (ret <= 1)
&pwm_cfg->old_duty_pcts[10]); break;
printk("bean set rets = %d\n",rets);
if(rets != 11)
{
pr_err("duty_pcts_store: Invalid paramter:%d\n", rets);
return -1;
} }
num_duty_pcts = 11;
if (num_duty_pcts >= max_duty_pcts) { if (num_duty_pcts >= max_duty_pcts) {
dev_err(&led->pdev->dev, dev_err(&led->pdev->dev,
"Number of duty pcts given exceeds max (%d)\n", "Number of duty pcts given exceeds max (%d)\n",
@ -2744,41 +2733,6 @@ static ssize_t blink_store(struct device *dev,
return count; return count;
} }
static ssize_t shutdown_enable_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return sprintf(buf, "%d\n", shutdown_enable);
}
static ssize_t shutdown_enable_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
if (count < 1)
return -EINVAL;
switch (buf[0]) {
case '0':
shutdown_enable = 0;
break;
case '3':
shutdown_enable = 3;
break;
case '4':
shutdown_enable = 4;
break;
case '5':
shutdown_enable = 5;
break;
default:
return -EINVAL;
}
return count;
}
static inline void rgb_lock_leds(struct rgb_sync *rgb) static inline void rgb_lock_leds(struct rgb_sync *rgb)
{ {
int i; int i;
@ -2913,7 +2867,6 @@ static DEVICE_ATTR(ramp_step_ms, 0664, NULL, ramp_step_ms_store);
static DEVICE_ATTR(lut_flags, 0664, NULL, lut_flags_store); static DEVICE_ATTR(lut_flags, 0664, NULL, lut_flags_store);
static DEVICE_ATTR(duty_pcts, 0664, NULL, duty_pcts_store); static DEVICE_ATTR(duty_pcts, 0664, NULL, duty_pcts_store);
static DEVICE_ATTR(blink, 0664, NULL, blink_store); static DEVICE_ATTR(blink, 0664, NULL, blink_store);
static DEVICE_ATTR(enable, 0644, shutdown_enable_show, shutdown_enable_store);
static DEVICE_ATTR(rgb_blink, 0664, NULL, rgb_blink_store); static DEVICE_ATTR(rgb_blink, 0664, NULL, rgb_blink_store);
static struct attribute *led_attrs[] = { static struct attribute *led_attrs[] = {
@ -2933,7 +2886,6 @@ static struct attribute *rgb_blink_attrs[] = {
static struct attribute *pwm_attrs[] = { static struct attribute *pwm_attrs[] = {
&dev_attr_pwm_us.attr, &dev_attr_pwm_us.attr,
&dev_attr_enable.attr,
NULL NULL
}; };
@ -4463,37 +4415,6 @@ static int qpnp_leds_remove(struct platform_device *pdev)
return 0; return 0;
} }
static void qpnp_leds_shutdown(struct platform_device *pdev)
{
struct qpnp_led_data *led_array = dev_get_drvdata(&pdev->dev);
int i, parsed_leds = led_array->num_leds;
for (i = 0; i < parsed_leds; i++) {
if(led_array[i].id == QPNP_ID_RGB_RED){
if(shutdown_enable == QPNP_ID_RGB_RED)
led_array[i].cdev.brightness = LED_FULL;
else
led_array[i].cdev.brightness = LED_OFF;
}
else if(led_array[i].id == QPNP_ID_RGB_GREEN){
if(shutdown_enable == QPNP_ID_RGB_GREEN)
led_array[i].cdev.brightness = LED_FULL;
else
led_array[i].cdev.brightness = LED_OFF;
}
else if(led_array[i].id == QPNP_ID_RGB_BLUE){
if(shutdown_enable == QPNP_ID_RGB_BLUE)
led_array[i].cdev.brightness = LED_FULL;
else
led_array[i].cdev.brightness = LED_OFF;
}
else
led_array[i].cdev.brightness = LED_OFF;
__qpnp_led_work(led_array+i, led_array[i].cdev.brightness);
}
}
#ifdef CONFIG_OF #ifdef CONFIG_OF
static const struct of_device_id spmi_match_table[] = { static const struct of_device_id spmi_match_table[] = {
{ .compatible = "qcom,leds-qpnp",}, { .compatible = "qcom,leds-qpnp",},
@ -4510,7 +4431,6 @@ static struct platform_driver qpnp_leds_driver = {
}, },
.probe = qpnp_leds_probe, .probe = qpnp_leds_probe,
.remove = qpnp_leds_remove, .remove = qpnp_leds_remove,
.shutdown = qpnp_leds_shutdown,
}; };
static int __init qpnp_led_init(void) static int __init qpnp_led_init(void)