/*1* Registration of Cobalt LED platform device.2*3* Copyright (C) 2007 Yoichi Yuasa <[email protected]>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/19#include <linux/errno.h>20#include <linux/init.h>21#include <linux/ioport.h>22#include <linux/platform_device.h>2324#include <cobalt.h>2526static struct resource cobalt_led_resource __initdata = {27.start = 0x1c000000,28.end = 0x1c000000,29.flags = IORESOURCE_MEM,30};3132static __init int cobalt_led_add(void)33{34struct platform_device *pdev;35int retval;3637if (cobalt_board_id == COBALT_BRD_ID_QUBE1 ||38cobalt_board_id == COBALT_BRD_ID_QUBE2)39pdev = platform_device_alloc("cobalt-qube-leds", -1);40else41pdev = platform_device_alloc("cobalt-raq-leds", -1);4243if (!pdev)44return -ENOMEM;4546retval = platform_device_add_resources(pdev, &cobalt_led_resource, 1);47if (retval)48goto err_free_device;4950retval = platform_device_add(pdev);51if (retval)52goto err_free_device;5354return 0;5556err_free_device:57platform_device_put(pdev);5859return retval;60}61device_initcall(cobalt_led_add);626364