Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
5ffe70d8
Commit
5ffe70d8
authored
Jul 04, 2024
by
Lee Jones
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ib-mfd-leds-platform-6.11' into ibs-for-mfd-merged
parents
f5ace555
970c3a6b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
7 deletions
+54
-7
drivers/leds/led-class.c
drivers/leds/led-class.c
+5
-4
drivers/mfd/cros_ec_dev.c
drivers/mfd/cros_ec_dev.c
+9
-0
drivers/platform/chrome/Kconfig
drivers/platform/chrome/Kconfig
+1
-1
drivers/platform/chrome/cros_kbd_led_backlight.c
drivers/platform/chrome/cros_kbd_led_backlight.c
+38
-2
include/linux/leds.h
include/linux/leds.h
+1
-0
No files found.
drivers/leds/led-class.c
View file @
5ffe70d8
...
...
@@ -503,6 +503,11 @@ int led_classdev_register_ext(struct device *parent,
ret
=
led_classdev_next_name
(
proposed_name
,
final_name
,
sizeof
(
final_name
));
if
(
ret
<
0
)
return
ret
;
else
if
(
ret
&&
led_cdev
->
flags
&
LED_REJECT_NAME_CONFLICT
)
return
-
EEXIST
;
else
if
(
ret
)
dev_warn
(
parent
,
"Led %s renamed to %s due to name collision
\n
"
,
proposed_name
,
final_name
);
if
(
led_cdev
->
color
>=
LED_COLOR_ID_MAX
)
dev_warn
(
parent
,
"LED %s color identifier out of range
\n
"
,
final_name
);
...
...
@@ -518,10 +523,6 @@ int led_classdev_register_ext(struct device *parent,
if
(
init_data
&&
init_data
->
fwnode
)
device_set_node
(
led_cdev
->
dev
,
init_data
->
fwnode
);
if
(
ret
)
dev_warn
(
parent
,
"Led %s renamed to %s due to name collision"
,
proposed_name
,
dev_name
(
led_cdev
->
dev
));
if
(
led_cdev
->
flags
&
LED_BRIGHT_HW_CHANGED
)
{
ret
=
led_add_brightness_hw_changed
(
led_cdev
);
if
(
ret
)
{
...
...
drivers/mfd/cros_ec_dev.c
View file @
5ffe70d8
...
...
@@ -103,6 +103,10 @@ static const struct mfd_cell cros_ec_led_cells[] = {
{
.
name
=
"cros-ec-led"
,
},
};
static
const
struct
mfd_cell
cros_ec_keyboard_leds_cells
[]
=
{
{
.
name
=
"cros-keyboard-leds"
,
},
};
static
const
struct
cros_feature_to_cells
cros_subdevices
[]
=
{
{
.
id
=
EC_FEATURE_CEC
,
...
...
@@ -134,6 +138,11 @@ static const struct cros_feature_to_cells cros_subdevices[] = {
.
mfd_cells
=
cros_ec_led_cells
,
.
num_cells
=
ARRAY_SIZE
(
cros_ec_led_cells
),
},
{
.
id
=
EC_FEATURE_PWM_KEYB
,
.
mfd_cells
=
cros_ec_keyboard_leds_cells
,
.
num_cells
=
ARRAY_SIZE
(
cros_ec_keyboard_leds_cells
),
},
};
static
const
struct
mfd_cell
cros_ec_platform_cells
[]
=
{
...
...
drivers/platform/chrome/Kconfig
View file @
5ffe70d8
...
...
@@ -150,7 +150,7 @@ config CROS_EC_PROTO
config CROS_KBD_LED_BACKLIGHT
tristate "Backlight LED support for Chrome OS keyboards"
depends on LEDS_CLASS && (ACPI || CROS_EC)
depends on LEDS_CLASS && (ACPI || CROS_EC
|| MFD_CROS_EC_DEV
)
help
This option enables support for the keyboard backlight LEDs on
select Chrome OS systems.
...
...
drivers/platform/chrome/cros_kbd_led_backlight.c
View file @
5ffe70d8
...
...
@@ -9,6 +9,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/leds.h>
#include <linux/mfd/core.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of.h>
...
...
@@ -194,13 +195,46 @@ static const __maybe_unused struct keyboard_led_drvdata keyboard_led_drvdata_ec_
#endif
/* IS_ENABLED(CONFIG_CROS_EC) */
#if IS_ENABLED(CONFIG_MFD_CROS_EC_DEV)
static
int
keyboard_led_init_ec_pwm_mfd
(
struct
platform_device
*
pdev
)
{
struct
cros_ec_dev
*
ec_dev
=
dev_get_drvdata
(
pdev
->
dev
.
parent
);
struct
cros_ec_device
*
cros_ec
=
ec_dev
->
ec_dev
;
struct
keyboard_led
*
keyboard_led
=
platform_get_drvdata
(
pdev
);
keyboard_led
->
ec
=
cros_ec
;
return
0
;
}
static
const
struct
keyboard_led_drvdata
keyboard_led_drvdata_ec_pwm_mfd
=
{
.
init
=
keyboard_led_init_ec_pwm_mfd
,
.
brightness_set_blocking
=
keyboard_led_set_brightness_ec_pwm
,
.
brightness_get
=
keyboard_led_get_brightness_ec_pwm
,
.
max_brightness
=
KEYBOARD_BACKLIGHT_MAX
,
};
#else
/* IS_ENABLED(CONFIG_MFD_CROS_EC_DEV) */
static
const
struct
keyboard_led_drvdata
keyboard_led_drvdata_ec_pwm_mfd
=
{};
#endif
/* IS_ENABLED(CONFIG_MFD_CROS_EC_DEV) */
static
int
keyboard_led_is_mfd_device
(
struct
platform_device
*
pdev
)
{
return
IS_ENABLED
(
CONFIG_MFD_CROS_EC_DEV
)
&&
mfd_get_cell
(
pdev
);
}
static
int
keyboard_led_probe
(
struct
platform_device
*
pdev
)
{
const
struct
keyboard_led_drvdata
*
drvdata
;
struct
keyboard_led
*
keyboard_led
;
int
error
;
drvdata
=
device_get_match_data
(
&
pdev
->
dev
);
if
(
keyboard_led_is_mfd_device
(
pdev
))
drvdata
=
&
keyboard_led_drvdata_ec_pwm_mfd
;
else
drvdata
=
device_get_match_data
(
&
pdev
->
dev
);
if
(
!
drvdata
)
return
-
EINVAL
;
...
...
@@ -216,13 +250,15 @@ static int keyboard_led_probe(struct platform_device *pdev)
}
keyboard_led
->
cdev
.
name
=
"chromeos::kbd_backlight"
;
keyboard_led
->
cdev
.
flags
|=
LED_CORE_SUSPENDRESUME
;
keyboard_led
->
cdev
.
flags
|=
LED_CORE_SUSPENDRESUME
|
LED_REJECT_NAME_CONFLICT
;
keyboard_led
->
cdev
.
max_brightness
=
drvdata
->
max_brightness
;
keyboard_led
->
cdev
.
brightness_set
=
drvdata
->
brightness_set
;
keyboard_led
->
cdev
.
brightness_set_blocking
=
drvdata
->
brightness_set_blocking
;
keyboard_led
->
cdev
.
brightness_get
=
drvdata
->
brightness_get
;
error
=
devm_led_classdev_register
(
&
pdev
->
dev
,
&
keyboard_led
->
cdev
);
if
(
error
==
-
EEXIST
)
/* Already bound via other mechanism */
return
-
ENODEV
;
if
(
error
)
return
error
;
...
...
include/linux/leds.h
View file @
5ffe70d8
...
...
@@ -107,6 +107,7 @@ struct led_classdev {
#define LED_BRIGHT_HW_CHANGED BIT(21)
#define LED_RETAIN_AT_SHUTDOWN BIT(22)
#define LED_INIT_DEFAULT_TRIGGER BIT(23)
#define LED_REJECT_NAME_CONFLICT BIT(24)
/* set_brightness_work / blink_timer flags, atomic, private. */
unsigned
long
work_flags
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment