forked from sonic-net/sonic-linux-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0044-leds-mlxreg-Add-support-for-new-flavour-of-capabilit.patch
More file actions
62 lines (54 loc) · 2.07 KB
/
Copy path0044-leds-mlxreg-Add-support-for-new-flavour-of-capabilit.patch
File metadata and controls
62 lines (54 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 242233be3adcd06398d728b2e793d9e40e6fbc3d Mon Sep 17 00:00:00 2001
From: Vadim Pasternak <vadimp@nvidia.com>
Date: Thu, 20 Jul 2023 11:01:56 +0000
Subject: [PATCH v6.1 25/81] leds: mlxreg: Add support for new flavour of
capability register
LED platform data is common across the various systems, while LED
driver should be able to apply only the LED instances relevant
to specific system.
For example, platform data might contain descriptions for fan1,
fan2, ..., fan{n} LEDs, while some systems equipped with all 'n' fan
LEDs, others with less.
For detection of the real number of equipped LEDs special capability
register is used.
This register used to indicate presence of LED through the bitmap.
For some new big modular systems this register will provide presence
data by counter.
Use slot parameter to distinct whether capability register contains
bitmask or counter.
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
---
drivers/leds/leds-mlxreg.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/leds/leds-mlxreg.c b/drivers/leds/leds-mlxreg.c
index b7855c93bd72..161195de78ba 100644
--- a/drivers/leds/leds-mlxreg.c
+++ b/drivers/leds/leds-mlxreg.c
@@ -206,16 +206,22 @@ static int mlxreg_led_config(struct mlxreg_led_priv_data *priv)
dev_err(&priv->pdev->dev, "Failed to query capability register\n");
return err;
}
- if (!(regval & data->bit))
+ /*
+ * If slot is specified - validate if slot is equipped on system.
+ * In case slot is specified in platform data, capability register
+ * comtains the counter of untits.
+ */
+ if (data->slot && data->slot > regval)
+ continue;
+ else if (!(regval & data->bit) && !data->slot)
continue;
/*
* Field "bit" can contain one capability bit in 0 byte
* and offset bit in 1-3 bytes. Clear capability bit and
- * keep only offset bit.
+ * contains the counter of units.
*/
data->bit &= MLXREG_LED_CAPABILITY_CLEAR;
}
-
led_cdev = &led_data->led_cdev;
led_data->data_parent = priv;
if (strstr(data->label, "red") ||
--
2.20.1