leds: leds-qpnp: correct various coding style issues
Correct warnings flagged by checkpatch. In particular, modify the following: - Add 'const' to the type of a struct of_device_id variable. - Remove unnecessary out-of-memory error messages. - Restructure conditionals to avoid else after return. - Replace kzalloc() with kcalloc() for arrays. - Replace strncmp() with strcmp(). - Join strings that are wrapped across two lines. - Correct the format of block comments. - Remove 'return' from the end of void functions. - Remove unnecessary parentheses. - Remove unnecessary line continuations. - Call usleep_range() with max > min. - Update the LEDS_QPNP Kconfig entry and the device tree documentation to use the name: 'Qualcomm Technologies, Inc.' - Expand the description of the LEDS_QPNP config option. - Correct the spelling of 'controlled'. Change-Id: Id29de0da18aa1ce75a0c7604b8c0ecd1633fcaf3 Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
parent
16655a9266
commit
e51b33d808
3 changed files with 105 additions and 135 deletions
|
@ -1,10 +1,10 @@
|
|||
Qualcomm QPNP Leds
|
||||
Qualcomm Technologies, Inc. QPNP LEDs
|
||||
|
||||
QPNP (Qualcomm Plug N Play) LEDs driver is used for
|
||||
controlling LEDs that are part of PMIC on Qualcomm reference
|
||||
platforms. The PMIC is connected to Host processor via
|
||||
SPMI bus. This driver supports various LED modules such as
|
||||
Keypad backlight, WLED (white LED), RGB LED and flash LED.
|
||||
Qualcomm Technologies, Inc. Plug N Play (QPNP) LED modules
|
||||
are used for controlling LEDs that are connected to a QPNP PMIC.
|
||||
The PMIC is connected to a host processor via the SPMI bus. Various
|
||||
LED modules are supported such as Keypad backlight, WLED (white LED),
|
||||
RGB LED and flash LED.
|
||||
|
||||
Each LED module is represented as a node of "leds-qpnp". This
|
||||
node will further contain the type of LED supported and its
|
||||
|
@ -83,7 +83,7 @@ Optional properties for RGB led:
|
|||
- qcom,turn-off-delay-ms: delay in millisecond for turning off the led when its default-state is "on". Value is being ignored in case default-state is "off".
|
||||
- qcom,use-blink: Use blink sysfs entry for switching into lpg mode. For optimal use, set default mode to pwm. All required lpg parameters must be supplied.
|
||||
|
||||
MPP LED is an LED controled through a Multi Purpose Pin.
|
||||
MPP LED is an LED controlled through a Multi Purpose Pin.
|
||||
|
||||
Optional properties for MPP LED:
|
||||
- linux,default-trigger: trigger the led from external modules such as display
|
||||
|
|
|
@ -591,11 +591,10 @@ config LEDS_QPNP
|
|||
tristate "Support for QPNP LEDs"
|
||||
depends on LEDS_CLASS && SPMI
|
||||
help
|
||||
This driver supports the leds functionality of Qualcomm PNP PMIC. It
|
||||
includes RGB Leds, WLED and Flash Led.
|
||||
|
||||
To compile this driver as a module, choose M here: the module will
|
||||
be called leds-qpnp.
|
||||
This driver supports the LED functionality of Qualcomm Technologies,
|
||||
Inc. QPNP PMICs. It primarily supports controlling tri-color RGB
|
||||
LEDs in both PWM and light pattern generator (LPG) modes. For older
|
||||
PMICs, it also supports WLEDs and flash LEDs.
|
||||
|
||||
config LEDS_QPNP_FLASH
|
||||
tristate "Support for QPNP Flash LEDs"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2015, 2017, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -666,7 +666,7 @@ static int qpnp_wled_set(struct qpnp_led_data *led)
|
|||
return rc;
|
||||
}
|
||||
|
||||
usleep_range(WLED_OVP_DELAY, WLED_OVP_DELAY);
|
||||
usleep_range(WLED_OVP_DELAY, WLED_OVP_DELAY + 10);
|
||||
} else if (led->wled_cfg->pmic_version == PMIC_VER_8941) {
|
||||
if (led->wled_cfg->num_physical_strings <=
|
||||
WLED_THREE_STRINGS) {
|
||||
|
@ -696,7 +696,8 @@ static int qpnp_wled_set(struct qpnp_led_data *led)
|
|||
"WLED write sink reg failed");
|
||||
return rc;
|
||||
}
|
||||
usleep_range(WLED_OVP_DELAY, WLED_OVP_DELAY);
|
||||
usleep_range(WLED_OVP_DELAY,
|
||||
WLED_OVP_DELAY + 10);
|
||||
} else {
|
||||
val = WLED_DISABLE_ALL_SINKS;
|
||||
rc = regmap_write(led->regmap,
|
||||
|
@ -724,7 +725,8 @@ static int qpnp_wled_set(struct qpnp_led_data *led)
|
|||
msleep(WLED_OVP_DELAY_LOOP);
|
||||
tries++;
|
||||
}
|
||||
usleep_range(WLED_OVP_DELAY, WLED_OVP_DELAY);
|
||||
usleep_range(WLED_OVP_DELAY,
|
||||
WLED_OVP_DELAY + 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -859,9 +861,7 @@ static int qpnp_mpp_set(struct qpnp_led_data *led)
|
|||
led->mpp_cfg->enable = true;
|
||||
|
||||
if (led->cdev.brightness < led->mpp_cfg->min_brightness) {
|
||||
dev_warn(&led->pdev->dev,
|
||||
"brightness is less than supported..." \
|
||||
"set to minimum supported\n");
|
||||
dev_warn(&led->pdev->dev, "brightness is less than supported, set to minimum supported\n");
|
||||
led->cdev.brightness = led->mpp_cfg->min_brightness;
|
||||
}
|
||||
|
||||
|
@ -940,9 +940,7 @@ static int qpnp_mpp_set(struct qpnp_led_data *led)
|
|||
LED_MPP_EN_CTRL(led->base), LED_MPP_EN_MASK,
|
||||
LED_MPP_EN_ENABLE);
|
||||
if (rc) {
|
||||
dev_err(&led->pdev->dev,
|
||||
"Failed to write led enable " \
|
||||
"reg\n");
|
||||
dev_err(&led->pdev->dev, "Failed to write led enable reg\n");
|
||||
goto err_mpp_reg_write;
|
||||
}
|
||||
} else {
|
||||
|
@ -1102,30 +1100,27 @@ static int qpnp_flash_regulator_operate(struct qpnp_led_data *led, bool on)
|
|||
led_array[i].flash_cfg->
|
||||
flash_wa_reg);
|
||||
if (rc) {
|
||||
dev_err(&led->pdev->dev,
|
||||
"Flash wa regulator"
|
||||
"enable failed(%d)\n",
|
||||
dev_err(&led->pdev->dev, "Flash wa regulator enable failed(%d)\n",
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
rc = regulator_enable(
|
||||
led_array[i].flash_cfg->\
|
||||
flash_boost_reg);
|
||||
led_array[i].flash_cfg->flash_boost_reg);
|
||||
if (rc) {
|
||||
if (led_array[i].flash_cfg->
|
||||
flash_wa_reg_get)
|
||||
/* Disable flash wa regulator
|
||||
/*
|
||||
* Disable flash wa regulator
|
||||
* when flash boost regulator
|
||||
* enable fails
|
||||
*/
|
||||
regulator_disable(
|
||||
led_array[i].flash_cfg->
|
||||
flash_wa_reg);
|
||||
dev_err(&led->pdev->dev,
|
||||
"Flash boost regulator enable"
|
||||
"failed(%d)\n", rc);
|
||||
dev_err(&led->pdev->dev, "Flash boost regulator enable failed(%d)\n",
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
led->flash_cfg->flash_on = true;
|
||||
|
@ -1150,12 +1145,11 @@ regulator_turn_off:
|
|||
rc);
|
||||
}
|
||||
|
||||
rc = regulator_disable(led_array[i].flash_cfg->\
|
||||
flash_boost_reg);
|
||||
rc = regulator_disable(
|
||||
led_array[i].flash_cfg->flash_boost_reg);
|
||||
if (rc) {
|
||||
dev_err(&led->pdev->dev,
|
||||
"Flash boost regulator disable"
|
||||
"failed(%d)\n", rc);
|
||||
dev_err(&led->pdev->dev, "Flash boost regulator disable failed(%d)\n",
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
if (led_array[i].flash_cfg->flash_wa_reg_get) {
|
||||
|
@ -1163,9 +1157,7 @@ regulator_turn_off:
|
|||
led_array[i].flash_cfg->
|
||||
flash_wa_reg);
|
||||
if (rc) {
|
||||
dev_err(&led->pdev->dev,
|
||||
"Flash_wa regulator"
|
||||
"disable failed(%d)\n",
|
||||
dev_err(&led->pdev->dev, "Flash_wa regulator disable failed(%d)\n",
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
|
@ -1416,7 +1408,8 @@ static int qpnp_flash_set(struct qpnp_led_data *led)
|
|||
/*
|
||||
* Add 1ms delay for bharger enter stable state
|
||||
*/
|
||||
usleep_range(FLASH_RAMP_UP_DELAY_US, FLASH_RAMP_UP_DELAY_US);
|
||||
usleep_range(FLASH_RAMP_UP_DELAY_US,
|
||||
FLASH_RAMP_UP_DELAY_US + 10);
|
||||
|
||||
if (!led->flash_cfg->strobe_type)
|
||||
led->flash_cfg->trigger_flash &=
|
||||
|
@ -1480,7 +1473,8 @@ static int qpnp_flash_set(struct qpnp_led_data *led)
|
|||
* Disable module after ramp down complete for stable
|
||||
* behavior
|
||||
*/
|
||||
usleep_range(FLASH_RAMP_UP_DELAY_US, FLASH_RAMP_UP_DELAY_US);
|
||||
usleep_range(FLASH_RAMP_UP_DELAY_US,
|
||||
FLASH_RAMP_UP_DELAY_US + 10);
|
||||
|
||||
rc = qpnp_led_masked_write(led,
|
||||
FLASH_ENABLE_CONTROL(led->base),
|
||||
|
@ -1658,9 +1652,7 @@ static int qpnp_kpdbl_set(struct qpnp_led_data *led)
|
|||
KPDBL_MODULE_EN_MASK,
|
||||
KPDBL_MODULE_DIS);
|
||||
if (rc) {
|
||||
dev_err(&led->pdev->dev,
|
||||
"Failed to write led"
|
||||
" enable reg\n");
|
||||
dev_err(&led->pdev->dev, "Failed to write led enable reg\n");
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
@ -1854,8 +1846,6 @@ static void qpnp_led_work(struct work_struct *work)
|
|||
struct qpnp_led_data, work);
|
||||
|
||||
__qpnp_led_work(led, led->cdev.brightness);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int qpnp_led_set_max_brightness(struct qpnp_led_data *led)
|
||||
|
@ -1942,7 +1932,7 @@ static int qpnp_wled_init(struct qpnp_led_data *led)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((led->max_current > WLED_MAX_CURR)) {
|
||||
if (led->max_current > WLED_MAX_CURR) {
|
||||
dev_err(&led->pdev->dev, "Invalid max current\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -3048,7 +3038,7 @@ static int qpnp_get_common_configs(struct qpnp_led_data *led,
|
|||
rc = of_property_read_string(node, "qcom,default-state",
|
||||
&temp_string);
|
||||
if (!rc) {
|
||||
if (strncmp(temp_string, "on", sizeof("on")) == 0)
|
||||
if (strcmp(temp_string, "on") == 0)
|
||||
led->default_on = true;
|
||||
} else if (rc != -EINVAL)
|
||||
return rc;
|
||||
|
@ -3075,10 +3065,8 @@ static int qpnp_get_config_wled(struct qpnp_led_data *led,
|
|||
|
||||
led->wled_cfg = devm_kzalloc(&led->pdev->dev,
|
||||
sizeof(struct wled_config_data), GFP_KERNEL);
|
||||
if (!led->wled_cfg) {
|
||||
dev_err(&led->pdev->dev, "Unable to allocate memory\n");
|
||||
if (!led->wled_cfg)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
rc = regmap_read(led->regmap, PMIC_VERSION_REG, &tmp);
|
||||
if (rc) {
|
||||
|
@ -3161,10 +3149,8 @@ static int qpnp_get_config_flash(struct qpnp_led_data *led,
|
|||
|
||||
led->flash_cfg = devm_kzalloc(&led->pdev->dev,
|
||||
sizeof(struct flash_config_data), GFP_KERNEL);
|
||||
if (!led->flash_cfg) {
|
||||
dev_err(&led->pdev->dev, "Unable to allocate memory\n");
|
||||
if (!led->flash_cfg)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
rc = regmap_read(led->regmap, FLASH_PERIPHERAL_SUBTYPE(led->base),
|
||||
&tmp);
|
||||
|
@ -3297,23 +3283,23 @@ static int qpnp_get_config_flash(struct qpnp_led_data *led,
|
|||
}
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
rc = of_property_read_u32(node, "qcom,duration", &val);
|
||||
if (!rc)
|
||||
led->flash_cfg->duration = (u8)((val - 10) / 10);
|
||||
else if (rc == -EINVAL)
|
||||
led->flash_cfg->duration = FLASH_DURATION_200ms;
|
||||
else
|
||||
goto error_get_flash_reg;
|
||||
|
||||
rc = of_property_read_u32(node, "qcom,current", &val);
|
||||
if (!rc)
|
||||
led->flash_cfg->current_prgm = (val *
|
||||
FLASH_MAX_LEVEL / led->max_current);
|
||||
else
|
||||
goto error_get_flash_reg;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(node, "qcom,duration", &val);
|
||||
if (!rc)
|
||||
led->flash_cfg->duration = (u8)((val - 10) / 10);
|
||||
else if (rc == -EINVAL)
|
||||
led->flash_cfg->duration = FLASH_DURATION_200ms;
|
||||
else
|
||||
goto error_get_flash_reg;
|
||||
|
||||
rc = of_property_read_u32(node, "qcom,current", &val);
|
||||
if (!rc)
|
||||
led->flash_cfg->current_prgm = val * FLASH_MAX_LEVEL
|
||||
/ led->max_current;
|
||||
else
|
||||
goto error_get_flash_reg;
|
||||
|
||||
rc = of_property_read_u32(node, "qcom,headroom", &val);
|
||||
if (!rc)
|
||||
led->flash_cfg->headroom = (u8) val;
|
||||
|
@ -3512,11 +3498,11 @@ bad_lpg_params:
|
|||
|
||||
static int qpnp_led_get_mode(const char *mode)
|
||||
{
|
||||
if (strncmp(mode, "manual", strlen(mode)) == 0)
|
||||
if (strcmp(mode, "manual") == 0)
|
||||
return MANUAL_MODE;
|
||||
else if (strncmp(mode, "pwm", strlen(mode)) == 0)
|
||||
else if (strcmp(mode, "pwm") == 0)
|
||||
return PWM_MODE;
|
||||
else if (strncmp(mode, "lpg", strlen(mode)) == 0)
|
||||
else if (strcmp(mode, "lpg") == 0)
|
||||
return LPG_MODE;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
@ -3532,10 +3518,8 @@ static int qpnp_get_config_kpdbl(struct qpnp_led_data *led,
|
|||
|
||||
led->kpdbl_cfg = devm_kzalloc(&led->pdev->dev,
|
||||
sizeof(struct kpdbl_config_data), GFP_KERNEL);
|
||||
if (!led->kpdbl_cfg) {
|
||||
dev_err(&led->pdev->dev, "Unable to allocate memory\n");
|
||||
if (!led->kpdbl_cfg)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
rc = of_property_read_string(node, "qcom,mode", &mode);
|
||||
if (!rc) {
|
||||
|
@ -3547,11 +3531,9 @@ static int qpnp_get_config_kpdbl(struct qpnp_led_data *led,
|
|||
led->kpdbl_cfg->pwm_cfg = devm_kzalloc(&led->pdev->dev,
|
||||
sizeof(struct pwm_config_data),
|
||||
GFP_KERNEL);
|
||||
if (!led->kpdbl_cfg->pwm_cfg) {
|
||||
dev_err(&led->pdev->dev,
|
||||
"Unable to allocate memory\n");
|
||||
if (!led->kpdbl_cfg->pwm_cfg)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
led->kpdbl_cfg->pwm_cfg->mode = led_mode;
|
||||
led->kpdbl_cfg->pwm_cfg->default_mode = led_mode;
|
||||
} else {
|
||||
|
@ -3589,10 +3571,8 @@ static int qpnp_get_config_rgb(struct qpnp_led_data *led,
|
|||
|
||||
led->rgb_cfg = devm_kzalloc(&led->pdev->dev,
|
||||
sizeof(struct rgb_config_data), GFP_KERNEL);
|
||||
if (!led->rgb_cfg) {
|
||||
dev_err(&led->pdev->dev, "Unable to allocate memory\n");
|
||||
if (!led->rgb_cfg)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (led->id == QPNP_ID_RGB_RED)
|
||||
led->rgb_cfg->enable = RGB_LED_ENABLE_RED;
|
||||
|
@ -3641,10 +3621,8 @@ static int qpnp_get_config_mpp(struct qpnp_led_data *led,
|
|||
|
||||
led->mpp_cfg = devm_kzalloc(&led->pdev->dev,
|
||||
sizeof(struct mpp_config_data), GFP_KERNEL);
|
||||
if (!led->mpp_cfg) {
|
||||
dev_err(&led->pdev->dev, "Unable to allocate memory\n");
|
||||
if (!led->mpp_cfg)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (of_find_property(of_get_parent(node), "mpp-power-supply", NULL)) {
|
||||
led->mpp_cfg->mpp_reg =
|
||||
|
@ -3770,11 +3748,8 @@ static int qpnp_get_config_gpio(struct qpnp_led_data *led,
|
|||
|
||||
led->gpio_cfg = devm_kzalloc(&led->pdev->dev,
|
||||
sizeof(struct gpio_config_data), GFP_KERNEL);
|
||||
if (!led->gpio_cfg) {
|
||||
dev_err(&led->pdev->dev,
|
||||
"Unable to allocate memory gpio struct\n");
|
||||
if (!led->gpio_cfg)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
led->gpio_cfg->source_sel = LED_GPIO_SOURCE_SEL_DEFAULT;
|
||||
rc = of_property_read_u32(node, "qcom,source-sel", &val);
|
||||
|
@ -3823,12 +3798,10 @@ static int qpnp_leds_probe(struct platform_device *pdev)
|
|||
if (!num_leds)
|
||||
return -ECHILD;
|
||||
|
||||
led_array = devm_kzalloc(&pdev->dev,
|
||||
(sizeof(struct qpnp_led_data) * num_leds), GFP_KERNEL);
|
||||
if (!led_array) {
|
||||
dev_err(&pdev->dev, "Unable to allocate memory\n");
|
||||
led_array = devm_kcalloc(&pdev->dev, num_leds, sizeof(*led_array),
|
||||
GFP_KERNEL);
|
||||
if (!led_array)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
for_each_child_of_node(node, temp) {
|
||||
led = &led_array[parsed_leds];
|
||||
|
@ -3881,24 +3854,22 @@ static int qpnp_leds_probe(struct platform_device *pdev)
|
|||
|
||||
rc = qpnp_get_common_configs(led, temp);
|
||||
if (rc) {
|
||||
dev_err(&led->pdev->dev,
|
||||
"Failure reading common led configuration," \
|
||||
" rc = %d\n", rc);
|
||||
dev_err(&led->pdev->dev, "Failure reading common led configuration, rc = %d\n",
|
||||
rc);
|
||||
goto fail_id_check;
|
||||
}
|
||||
|
||||
led->cdev.brightness_set = qpnp_led_set;
|
||||
led->cdev.brightness_get = qpnp_led_get;
|
||||
|
||||
if (strncmp(led_label, "wled", sizeof("wled")) == 0) {
|
||||
if (strcmp(led_label, "wled") == 0) {
|
||||
rc = qpnp_get_config_wled(led, temp);
|
||||
if (rc < 0) {
|
||||
dev_err(&led->pdev->dev,
|
||||
"Unable to read wled config data\n");
|
||||
goto fail_id_check;
|
||||
}
|
||||
} else if (strncmp(led_label, "flash", sizeof("flash"))
|
||||
== 0) {
|
||||
} else if (strcmp(led_label, "flash") == 0) {
|
||||
if (!of_find_property(node, "flash-boost-supply", NULL))
|
||||
regulator_probe = true;
|
||||
rc = qpnp_get_config_flash(led, temp, ®ulator_probe);
|
||||
|
@ -3907,14 +3878,14 @@ static int qpnp_leds_probe(struct platform_device *pdev)
|
|||
"Unable to read flash config data\n");
|
||||
goto fail_id_check;
|
||||
}
|
||||
} else if (strncmp(led_label, "rgb", sizeof("rgb")) == 0) {
|
||||
} else if (strcmp(led_label, "rgb") == 0) {
|
||||
rc = qpnp_get_config_rgb(led, temp);
|
||||
if (rc < 0) {
|
||||
dev_err(&led->pdev->dev,
|
||||
"Unable to read rgb config data\n");
|
||||
goto fail_id_check;
|
||||
}
|
||||
} else if (strncmp(led_label, "mpp", sizeof("mpp")) == 0) {
|
||||
} else if (strcmp(led_label, "mpp") == 0) {
|
||||
rc = qpnp_get_config_mpp(led, temp);
|
||||
if (rc < 0) {
|
||||
dev_err(&led->pdev->dev,
|
||||
|
@ -3928,7 +3899,7 @@ static int qpnp_leds_probe(struct platform_device *pdev)
|
|||
"Unable to read gpio config data\n");
|
||||
goto fail_id_check;
|
||||
}
|
||||
} else if (strncmp(led_label, "kpdbl", sizeof("kpdbl")) == 0) {
|
||||
} else if (strcmp(led_label, "kpdbl") == 0) {
|
||||
bitmap_zero(kpdbl_leds_in_use, NUM_KPDBL_LEDS);
|
||||
is_kpdbl_master_turn_on = false;
|
||||
rc = qpnp_get_config_kpdbl(led, temp);
|
||||
|
@ -4113,8 +4084,8 @@ static int qpnp_leds_remove(struct platform_device *pdev)
|
|||
case QPNP_ID_FLASH1_LED0:
|
||||
case QPNP_ID_FLASH1_LED1:
|
||||
if (led_array[i].flash_cfg->flash_reg_get)
|
||||
regulator_put(led_array[i].flash_cfg-> \
|
||||
flash_boost_reg);
|
||||
regulator_put(
|
||||
led_array[i].flash_cfg->flash_boost_reg);
|
||||
if (led_array[i].flash_cfg->torch_enable)
|
||||
if (!led_array[i].flash_cfg->no_smbb_support)
|
||||
regulator_put(led_array[i].
|
||||
|
@ -4126,49 +4097,49 @@ static int qpnp_leds_remove(struct platform_device *pdev)
|
|||
case QPNP_ID_RGB_GREEN:
|
||||
case QPNP_ID_RGB_BLUE:
|
||||
if (led_array[i].rgb_cfg->pwm_cfg->mode == PWM_MODE)
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->\
|
||||
kobj, &pwm_attr_group);
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->kobj,
|
||||
&pwm_attr_group);
|
||||
if (led_array[i].rgb_cfg->pwm_cfg->use_blink) {
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->\
|
||||
kobj, &blink_attr_group);
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->\
|
||||
kobj, &lpg_attr_group);
|
||||
} else if (led_array[i].rgb_cfg->pwm_cfg->mode\
|
||||
== LPG_MODE)
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->\
|
||||
kobj, &lpg_attr_group);
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->kobj,
|
||||
&blink_attr_group);
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->kobj,
|
||||
&lpg_attr_group);
|
||||
} else if (led_array[i].rgb_cfg->pwm_cfg->mode
|
||||
== LPG_MODE)
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->kobj,
|
||||
&lpg_attr_group);
|
||||
break;
|
||||
case QPNP_ID_LED_MPP:
|
||||
if (!led_array[i].mpp_cfg->pwm_cfg)
|
||||
break;
|
||||
if (led_array[i].mpp_cfg->pwm_cfg->mode == PWM_MODE)
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->\
|
||||
kobj, &pwm_attr_group);
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->kobj,
|
||||
&pwm_attr_group);
|
||||
if (led_array[i].mpp_cfg->pwm_cfg->use_blink) {
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->\
|
||||
kobj, &blink_attr_group);
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->\
|
||||
kobj, &lpg_attr_group);
|
||||
} else if (led_array[i].mpp_cfg->pwm_cfg->mode\
|
||||
== LPG_MODE)
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->\
|
||||
kobj, &lpg_attr_group);
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->kobj,
|
||||
&blink_attr_group);
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->kobj,
|
||||
&lpg_attr_group);
|
||||
} else if (led_array[i].mpp_cfg->pwm_cfg->mode
|
||||
== LPG_MODE)
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->kobj,
|
||||
&lpg_attr_group);
|
||||
if (led_array[i].mpp_cfg->mpp_reg)
|
||||
regulator_put(led_array[i].mpp_cfg->mpp_reg);
|
||||
break;
|
||||
case QPNP_ID_KPDBL:
|
||||
if (led_array[i].kpdbl_cfg->pwm_cfg->mode == PWM_MODE)
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->
|
||||
kobj, &pwm_attr_group);
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->kobj,
|
||||
&pwm_attr_group);
|
||||
if (led_array[i].kpdbl_cfg->pwm_cfg->use_blink) {
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->
|
||||
kobj, &blink_attr_group);
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->
|
||||
kobj, &lpg_attr_group);
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->kobj,
|
||||
&blink_attr_group);
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->kobj,
|
||||
&lpg_attr_group);
|
||||
} else if (led_array[i].kpdbl_cfg->pwm_cfg->mode
|
||||
== LPG_MODE)
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->
|
||||
kobj, &lpg_attr_group);
|
||||
== LPG_MODE)
|
||||
sysfs_remove_group(&led_array[i].cdev.dev->kobj,
|
||||
&lpg_attr_group);
|
||||
break;
|
||||
default:
|
||||
dev_err(&led_array->pdev->dev,
|
||||
|
@ -4182,7 +4153,7 @@ static int qpnp_leds_remove(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static struct of_device_id spmi_match_table[] = {
|
||||
static const struct of_device_id spmi_match_table[] = {
|
||||
{ .compatible = "qcom,leds-qpnp",},
|
||||
{ },
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue