Commit fc6a6da6 authored by Konrad Dybcio's avatar Konrad Dybcio Committed by Lee Jones
Browse files

leds: rgb: leds-qcom-lpg: Allow LED_COLOR_ID_MULTI



There's nothing special about RGB multi-led instances. Allow any color
combinations by simply extending the "if _RGB" checks.

Signed-off-by: default avatarKonrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: default avatarBjorn Andersson <andersson@kernel.org>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: default avatarDavid Heidelberg <david@ixit.cz>
Link: https://patch.msgid.link/20251117-topic-lpg_multi-v1-1-05604374a2dd@oss.qualcomm.com


Signed-off-by: default avatarLee Jones <lee@kernel.org>
parent c7a2e5ee
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1382,7 +1382,7 @@ static int lpg_add_led(struct lpg *lpg, struct device_node *np)
		return dev_err_probe(lpg->dev, ret,
			      "failed to parse \"color\" of %pOF\n", np);

	if (color == LED_COLOR_ID_RGB)
	if (color == LED_COLOR_ID_RGB || color == LED_COLOR_ID_MULTI)
		num_channels = of_get_available_child_count(np);
	else
		num_channels = 1;
@@ -1394,7 +1394,7 @@ static int lpg_add_led(struct lpg *lpg, struct device_node *np)
	led->lpg = lpg;
	led->num_channels = num_channels;

	if (color == LED_COLOR_ID_RGB) {
	if (color == LED_COLOR_ID_RGB || color == LED_COLOR_ID_MULTI) {
		info = devm_kcalloc(lpg->dev, num_channels, sizeof(*info), GFP_KERNEL);
		if (!info)
			return -ENOMEM;
@@ -1454,7 +1454,7 @@ static int lpg_add_led(struct lpg *lpg, struct device_node *np)

	init_data.fwnode = of_fwnode_handle(np);

	if (color == LED_COLOR_ID_RGB)
	if (color == LED_COLOR_ID_RGB || color == LED_COLOR_ID_MULTI)
		ret = devm_led_classdev_multicolor_register_ext(lpg->dev, &led->mcdev, &init_data);
	else
		ret = devm_led_classdev_register_ext(lpg->dev, &led->cdev, &init_data);