diff options
author | 2025-03-08 22:04:20 +0800 | |
---|---|---|
committer | 2025-03-08 22:04:20 +0800 | |
commit | a07bb8fd1299070229f0e8f3dcb57ffd5ef9870a (patch) | |
tree | 84f21bd0bf7071bc5fc7dd989e77d7ceb5476682 /arch/mips/cobalt/led.c | |
download | ohosKernel-a07bb8fd1299070229f0e8f3dcb57ffd5ef9870a.tar.gz ohosKernel-a07bb8fd1299070229f0e8f3dcb57ffd5ef9870a.zip |
Initial commit: OpenHarmony-v4.0-ReleaseOpenHarmony-v4.0-Release
Diffstat (limited to 'arch/mips/cobalt/led.c')
-rw-r--r-- | arch/mips/cobalt/led.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/mips/cobalt/led.c b/arch/mips/cobalt/led.c new file mode 100644 index 000000000..196660cac --- /dev/null +++ b/arch/mips/cobalt/led.c | |||
@@ -0,0 +1,49 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
2 | /* | ||
3 | * Registration of Cobalt LED platform device. | ||
4 | * | ||
5 | * Copyright (C) 2007 Yoichi Yuasa <yuasa@linux-mips.org> | ||
6 | */ | ||
7 | #include <linux/errno.h> | ||
8 | #include <linux/init.h> | ||
9 | #include <linux/ioport.h> | ||
10 | #include <linux/platform_device.h> | ||
11 | |||
12 | #include <cobalt.h> | ||
13 | |||
14 | static struct resource cobalt_led_resource __initdata = { | ||
15 | .start = 0x1c000000, | ||
16 | .end = 0x1c000000, | ||
17 | .flags = IORESOURCE_MEM, | ||
18 | }; | ||
19 | |||
20 | static __init int cobalt_led_add(void) | ||
21 | { | ||
22 | struct platform_device *pdev; | ||
23 | int retval; | ||
24 | |||
25 | if (cobalt_board_id == COBALT_BRD_ID_QUBE1 || | ||
26 | cobalt_board_id == COBALT_BRD_ID_QUBE2) | ||
27 | pdev = platform_device_alloc("cobalt-qube-leds", -1); | ||
28 | else | ||
29 | pdev = platform_device_alloc("cobalt-raq-leds", -1); | ||
30 | |||
31 | if (!pdev) | ||
32 | return -ENOMEM; | ||
33 | |||
34 | retval = platform_device_add_resources(pdev, &cobalt_led_resource, 1); | ||
35 | if (retval) | ||
36 | goto err_free_device; | ||
37 | |||
38 | retval = platform_device_add(pdev); | ||
39 | if (retval) | ||
40 | goto err_free_device; | ||
41 | |||
42 | return 0; | ||
43 | |||
44 | err_free_device: | ||
45 | platform_device_put(pdev); | ||
46 | |||
47 | return retval; | ||
48 | } | ||
49 | device_initcall(cobalt_led_add); | ||