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-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *  Cobalt buttons platform device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *  Copyright (C) 2007  Yoichi Yuasa <yuasa@linux-mips.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) static struct resource cobalt_buttons_resource __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	.start	= 0x1d000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	.end	= 0x1d000003,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	.flags	= IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static __init int cobalt_add_buttons(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	struct platform_device *pd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	pd = platform_device_alloc("Cobalt buttons", -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	if (!pd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	error = platform_device_add_resources(pd, &cobalt_buttons_resource, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 		goto err_free_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	error = platform_device_add(pd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		goto err_free_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)  err_free_device:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	platform_device_put(pd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) device_initcall(cobalt_add_buttons);