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)  *  Registration of Cobalt LED 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) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/ioport.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <cobalt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) static struct resource cobalt_led_resource __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	.start	= 0x1c000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	.end	= 0x1c000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	.flags	= IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static __init int cobalt_led_add(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	struct platform_device *pdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	int retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	if (cobalt_board_id == COBALT_BRD_ID_QUBE1 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	    cobalt_board_id == COBALT_BRD_ID_QUBE2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 		pdev = platform_device_alloc("cobalt-qube-leds", -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 		pdev = platform_device_alloc("cobalt-raq-leds", -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	if (!pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	retval = platform_device_add_resources(pdev, &cobalt_led_resource, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	if (retval)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 		goto err_free_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	retval = platform_device_add(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	if (retval)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 		goto err_free_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) err_free_device:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	platform_device_put(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	return retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) device_initcall(cobalt_led_add);