Linux Audio

Check our new training course

Loading...
v6.2
 1// SPDX-License-Identifier: GPL-2.0
 2#include <linux/kernel.h>
 3#include <linux/module.h>
 4#include <linux/platform_device.h>
 5#include <linux/gpio_keys.h>
 6#include <linux/input.h>
 7#include <linux/leds.h>
 8
 9#include <asm/mach-types.h>
10
11static struct gpio_keys_button csb701_buttons[] = {
12	{
13		.code	= 0x7,
14		.gpio	= 1,
15		.active_low = 1,
16		.desc	= "SW2",
17		.type	= EV_SW,
18		.wakeup = 1,
19	},
20};
21
22static struct gpio_keys_platform_data csb701_gpio_keys_data = {
23	.buttons = csb701_buttons,
24	.nbuttons = ARRAY_SIZE(csb701_buttons),
25};
26
27static struct gpio_led csb701_leds[] = {
28	{
29		.name	= "csb701:yellow:heartbeat",
30		.default_trigger = "heartbeat",
31		.gpio	= 11,
32		.active_low = 1,
33	},
34};
35
36static struct platform_device csb701_gpio_keys = {
37	.name		= "gpio-keys",
38	.id		= -1,
39	.dev.platform_data = &csb701_gpio_keys_data,
40};
41
42static struct gpio_led_platform_data csb701_leds_gpio_data = {
43	.leds		= csb701_leds,
44	.num_leds	= ARRAY_SIZE(csb701_leds),
45};
46
47static struct platform_device csb701_leds_gpio = {
48	.name		= "leds-gpio",
49	.id		= -1,
50	.dev.platform_data = &csb701_leds_gpio_data,
51};
52
53static struct platform_device *devices[] __initdata = {
54	&csb701_gpio_keys,
55	&csb701_leds_gpio,
56};
57
58static int __init csb701_init(void)
59{
60	if (!machine_is_csb726())
61		return -ENODEV;
62
63	return platform_add_devices(devices, ARRAY_SIZE(devices));
64}
65
66module_init(csb701_init);
67
v5.14.15
 1// SPDX-License-Identifier: GPL-2.0
 2#include <linux/kernel.h>
 3#include <linux/module.h>
 4#include <linux/platform_device.h>
 5#include <linux/gpio_keys.h>
 6#include <linux/input.h>
 7#include <linux/leds.h>
 8
 9#include <asm/mach-types.h>
10
11static struct gpio_keys_button csb701_buttons[] = {
12	{
13		.code	= 0x7,
14		.gpio	= 1,
15		.active_low = 1,
16		.desc	= "SW2",
17		.type	= EV_SW,
18		.wakeup = 1,
19	},
20};
21
22static struct gpio_keys_platform_data csb701_gpio_keys_data = {
23	.buttons = csb701_buttons,
24	.nbuttons = ARRAY_SIZE(csb701_buttons),
25};
26
27static struct gpio_led csb701_leds[] = {
28	{
29		.name	= "csb701:yellow:heartbeat",
30		.default_trigger = "heartbeat",
31		.gpio	= 11,
32		.active_low = 1,
33	},
34};
35
36static struct platform_device csb701_gpio_keys = {
37	.name		= "gpio-keys",
38	.id		= -1,
39	.dev.platform_data = &csb701_gpio_keys_data,
40};
41
42static struct gpio_led_platform_data csb701_leds_gpio_data = {
43	.leds		= csb701_leds,
44	.num_leds	= ARRAY_SIZE(csb701_leds),
45};
46
47static struct platform_device csb701_leds_gpio = {
48	.name		= "leds-gpio",
49	.id		= -1,
50	.dev.platform_data = &csb701_leds_gpio_data,
51};
52
53static struct platform_device *devices[] __initdata = {
54	&csb701_gpio_keys,
55	&csb701_leds_gpio,
56};
57
58static int __init csb701_init(void)
59{
60	if (!machine_is_csb726())
61		return -ENODEV;
62
63	return platform_add_devices(devices, ARRAY_SIZE(devices));
64}
65
66module_init(csb701_init);
67