]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
3b31fabf DES |
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 | ||
675b5d86 DES |
9 | #include <asm/mach-types.h> |
10 | ||
3b31fabf DES |
11 | static 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 | ||
22 | static struct gpio_keys_platform_data csb701_gpio_keys_data = { | |
23 | .buttons = csb701_buttons, | |
24 | .nbuttons = ARRAY_SIZE(csb701_buttons), | |
25 | }; | |
26 | ||
27 | static 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 | ||
36 | static struct platform_device csb701_gpio_keys = { | |
37 | .name = "gpio-keys", | |
38 | .id = -1, | |
39 | .dev.platform_data = &csb701_gpio_keys_data, | |
40 | }; | |
41 | ||
42 | static struct gpio_led_platform_data csb701_leds_gpio_data = { | |
43 | .leds = csb701_leds, | |
44 | .num_leds = ARRAY_SIZE(csb701_leds), | |
45 | }; | |
46 | ||
47 | static struct platform_device csb701_leds_gpio = { | |
48 | .name = "leds-gpio", | |
49 | .id = -1, | |
50 | .dev.platform_data = &csb701_leds_gpio_data, | |
51 | }; | |
52 | ||
53 | static struct platform_device *devices[] __initdata = { | |
54 | &csb701_gpio_keys, | |
55 | &csb701_leds_gpio, | |
56 | }; | |
57 | ||
58 | static int __init csb701_init(void) | |
59 | { | |
675b5d86 DES |
60 | if (!machine_is_csb726()) |
61 | return -ENODEV; | |
62 | ||
3b31fabf DES |
63 | return platform_add_devices(devices, ARRAY_SIZE(devices)); |
64 | } | |
65 | ||
66 | module_init(csb701_init); | |
67 |