Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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