^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 LCD platform device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2008 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) static struct resource cobalt_lcd_resource __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) .start = 0x1f000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) .end = 0x1f00001f,
^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_lcd_add(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct platform_device *pdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) pdev = platform_device_alloc("cobalt-lcd", -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) if (!pdev)
^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) retval = platform_device_add_resources(pdev, &cobalt_lcd_resource, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) if (retval)
^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) retval = platform_device_add(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) if (retval)
^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(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) return retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) device_initcall(cobalt_lcd_add);