1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 2009 MIPS Technologies, Inc. 7 * written by Chris Dearman (chris@mips.com) 8 * 9 * Probe driver for the SEAD3 LED devices 10 * 11 */ 12#include <linux/module.h> 13#include <linux/init.h> 14#include <linux/platform_device.h> 15#include <linux/leds.h> 16#include <irq.h> 17 18 19#define LEDFLAGS(bits, shift) \ 20 ((bits << 8) | (shift << 8)) 21 22#define LEDBITS(id, shift, bits) \ 23 .name = id #shift, \ 24 .flags = LEDFLAGS(bits, shift) 25 26struct led_info led_data_info[] = { 27 { LEDBITS("bit", 0, 1) }, 28 { LEDBITS("bit", 1, 1) }, 29 { LEDBITS("bit", 2, 1) }, 30 { LEDBITS("bit", 3, 1) }, 31 { LEDBITS("bit", 4, 1) }, 32 { LEDBITS("bit", 5, 1) }, 33 { LEDBITS("bit", 6, 1) }, 34 { LEDBITS("bit", 7, 1) }, 35 { LEDBITS("all", 0, 8) }, 36}; 37 38static struct led_platform_data led_data = { 39 .num_leds = ARRAY_SIZE(led_data_info), 40 .leds = led_data_info 41}; 42 43static struct resource pled_resources[] = { 44 { 45 .start = 0x1F000210, 46 .end = 0x1F000217, 47 .flags = IORESOURCE_MEM 48 } 49}; 50 51static struct platform_device pled_device = { 52 .name = "sead3::pled", 53 .id = 0, 54 .dev = { 55 .platform_data = &led_data, 56 }, 57 .num_resources = ARRAY_SIZE(pled_resources), 58 .resource = pled_resources 59}; 60 61 62static struct resource fled_resources[] = { 63 { 64 .start = 0x1F000218, 65 .end = 0x1F00021f, 66 .flags = IORESOURCE_MEM 67 } 68}; 69 70static struct platform_device fled_device = { 71 .name = "sead3::fled", 72 .id = 0, 73 .dev = { 74 .platform_data = &led_data, 75 }, 76 .num_resources = ARRAY_SIZE(fled_resources), 77 .resource = fled_resources 78}; 79 80 81static int __init led_init(void) 82{ 83 platform_device_register(&pled_device); 84 return platform_device_register(&fled_device); 85} 86 87module_init(led_init); 88 89MODULE_AUTHOR("Chris Dearman <chris@mips.com>"); 90MODULE_LICENSE("GPL"); 91MODULE_DESCRIPTION("LED probe driver for SEAD3"); 92