1 // SPDX-License-Identifier: GPL-2.0
3 // Audio Mute LED trigger
6 #include <linux/kernel.h>
7 #include <linux/leds.h>
8 #include <linux/module.h>
10 static struct led_trigger
*ledtrig_audio
[NUM_AUDIO_LEDS
];
11 static enum led_brightness audio_state
[NUM_AUDIO_LEDS
];
13 enum led_brightness
ledtrig_audio_get(enum led_audio type
)
15 return audio_state
[type
];
17 EXPORT_SYMBOL_GPL(ledtrig_audio_get
);
19 void ledtrig_audio_set(enum led_audio type
, enum led_brightness state
)
21 audio_state
[type
] = state
;
22 led_trigger_event(ledtrig_audio
[type
], state
);
24 EXPORT_SYMBOL_GPL(ledtrig_audio_set
);
26 static int __init
ledtrig_audio_init(void)
28 led_trigger_register_simple("audio-mute",
29 &ledtrig_audio
[LED_AUDIO_MUTE
]);
30 led_trigger_register_simple("audio-micmute",
31 &ledtrig_audio
[LED_AUDIO_MICMUTE
]);
34 module_init(ledtrig_audio_init
);
36 static void __exit
ledtrig_audio_exit(void)
38 led_trigger_unregister_simple(ledtrig_audio
[LED_AUDIO_MUTE
]);
39 led_trigger_unregister_simple(ledtrig_audio
[LED_AUDIO_MICMUTE
]);
41 module_exit(ledtrig_audio_exit
);
43 MODULE_DESCRIPTION("LED trigger for audio mute control");
44 MODULE_LICENSE("GPL v2");