13197059aSPhilip A. Prindeville /* 23197059aSPhilip A. Prindeville * System Specific setup for Traverse Technologies GEOS. 33197059aSPhilip A. Prindeville * At the moment this means setup of GPIO control of LEDs. 43197059aSPhilip A. Prindeville * 53197059aSPhilip A. Prindeville * Copyright (C) 2008 Constantin Baranov <const@mimas.ru> 63197059aSPhilip A. Prindeville * Copyright (C) 2011 Ed Wildgoose <kernel@wildgooses.com> 73197059aSPhilip A. Prindeville * and Philip Prindeville <philipp@redfish-solutions.com> 83197059aSPhilip A. Prindeville * 93197059aSPhilip A. Prindeville * TODO: There are large similarities with leds-net5501.c 103197059aSPhilip A. Prindeville * by Alessandro Zummo <a.zummo@towertech.it> 113197059aSPhilip A. Prindeville * In the future leds-net5501.c should be migrated over to platform 123197059aSPhilip A. Prindeville * 133197059aSPhilip A. Prindeville * This program is free software; you can redistribute it and/or modify 143197059aSPhilip A. Prindeville * it under the terms of the GNU General Public License version 2 153197059aSPhilip A. Prindeville * as published by the Free Software Foundation. 163197059aSPhilip A. Prindeville */ 173197059aSPhilip A. Prindeville 183197059aSPhilip A. Prindeville #include <linux/kernel.h> 193197059aSPhilip A. Prindeville #include <linux/init.h> 203197059aSPhilip A. Prindeville #include <linux/io.h> 213197059aSPhilip A. Prindeville #include <linux/string.h> 223197059aSPhilip A. Prindeville #include <linux/leds.h> 233197059aSPhilip A. Prindeville #include <linux/platform_device.h> 243197059aSPhilip A. Prindeville #include <linux/gpio.h> 253197059aSPhilip A. Prindeville #include <linux/input.h> 263197059aSPhilip A. Prindeville #include <linux/gpio_keys.h> 273197059aSPhilip A. Prindeville #include <linux/dmi.h> 283197059aSPhilip A. Prindeville 293197059aSPhilip A. Prindeville #include <asm/geode.h> 303197059aSPhilip A. Prindeville 313197059aSPhilip A. Prindeville static struct gpio_keys_button geos_gpio_buttons[] = { 323197059aSPhilip A. Prindeville { 333197059aSPhilip A. Prindeville .code = KEY_RESTART, 343197059aSPhilip A. Prindeville .gpio = 3, 353197059aSPhilip A. Prindeville .active_low = 1, 363197059aSPhilip A. Prindeville .desc = "Reset button", 373197059aSPhilip A. Prindeville .type = EV_KEY, 383197059aSPhilip A. Prindeville .wakeup = 0, 393197059aSPhilip A. Prindeville .debounce_interval = 100, 403197059aSPhilip A. Prindeville .can_disable = 0, 413197059aSPhilip A. Prindeville } 423197059aSPhilip A. Prindeville }; 433197059aSPhilip A. Prindeville static struct gpio_keys_platform_data geos_buttons_data = { 443197059aSPhilip A. Prindeville .buttons = geos_gpio_buttons, 453197059aSPhilip A. Prindeville .nbuttons = ARRAY_SIZE(geos_gpio_buttons), 463197059aSPhilip A. Prindeville .poll_interval = 20, 473197059aSPhilip A. Prindeville }; 483197059aSPhilip A. Prindeville 493197059aSPhilip A. Prindeville static struct platform_device geos_buttons_dev = { 503197059aSPhilip A. Prindeville .name = "gpio-keys-polled", 513197059aSPhilip A. Prindeville .id = 1, 523197059aSPhilip A. Prindeville .dev = { 533197059aSPhilip A. Prindeville .platform_data = &geos_buttons_data, 543197059aSPhilip A. Prindeville } 553197059aSPhilip A. Prindeville }; 563197059aSPhilip A. Prindeville 573197059aSPhilip A. Prindeville static struct gpio_led geos_leds[] = { 583197059aSPhilip A. Prindeville { 593197059aSPhilip A. Prindeville .name = "geos:1", 603197059aSPhilip A. Prindeville .gpio = 6, 613197059aSPhilip A. Prindeville .default_trigger = "default-on", 623197059aSPhilip A. Prindeville .active_low = 1, 633197059aSPhilip A. Prindeville }, 643197059aSPhilip A. Prindeville { 653197059aSPhilip A. Prindeville .name = "geos:2", 663197059aSPhilip A. Prindeville .gpio = 25, 673197059aSPhilip A. Prindeville .default_trigger = "default-off", 683197059aSPhilip A. Prindeville .active_low = 1, 693197059aSPhilip A. Prindeville }, 703197059aSPhilip A. Prindeville { 713197059aSPhilip A. Prindeville .name = "geos:3", 723197059aSPhilip A. Prindeville .gpio = 27, 733197059aSPhilip A. Prindeville .default_trigger = "default-off", 743197059aSPhilip A. Prindeville .active_low = 1, 753197059aSPhilip A. Prindeville }, 763197059aSPhilip A. Prindeville }; 773197059aSPhilip A. Prindeville 783197059aSPhilip A. Prindeville static struct gpio_led_platform_data geos_leds_data = { 793197059aSPhilip A. Prindeville .num_leds = ARRAY_SIZE(geos_leds), 803197059aSPhilip A. Prindeville .leds = geos_leds, 813197059aSPhilip A. Prindeville }; 823197059aSPhilip A. Prindeville 833197059aSPhilip A. Prindeville static struct platform_device geos_leds_dev = { 843197059aSPhilip A. Prindeville .name = "leds-gpio", 853197059aSPhilip A. Prindeville .id = -1, 863197059aSPhilip A. Prindeville .dev.platform_data = &geos_leds_data, 873197059aSPhilip A. Prindeville }; 883197059aSPhilip A. Prindeville 89a6d30e0fSBartlomiej Zolnierkiewicz static struct platform_device *geos_devs[] __initdata = { 903197059aSPhilip A. Prindeville &geos_buttons_dev, 913197059aSPhilip A. Prindeville &geos_leds_dev, 923197059aSPhilip A. Prindeville }; 933197059aSPhilip A. Prindeville 943197059aSPhilip A. Prindeville static void __init register_geos(void) 953197059aSPhilip A. Prindeville { 963197059aSPhilip A. Prindeville /* Setup LED control through leds-gpio driver */ 973197059aSPhilip A. Prindeville platform_add_devices(geos_devs, ARRAY_SIZE(geos_devs)); 983197059aSPhilip A. Prindeville } 993197059aSPhilip A. Prindeville 1003197059aSPhilip A. Prindeville static int __init geos_init(void) 1013197059aSPhilip A. Prindeville { 1023197059aSPhilip A. Prindeville const char *vendor, *product; 1033197059aSPhilip A. Prindeville 1043197059aSPhilip A. Prindeville if (!is_geode()) 1053197059aSPhilip A. Prindeville return 0; 1063197059aSPhilip A. Prindeville 1073197059aSPhilip A. Prindeville vendor = dmi_get_system_info(DMI_SYS_VENDOR); 1083197059aSPhilip A. Prindeville if (!vendor || strcmp(vendor, "Traverse Technologies")) 1093197059aSPhilip A. Prindeville return 0; 1103197059aSPhilip A. Prindeville 1113197059aSPhilip A. Prindeville product = dmi_get_system_info(DMI_PRODUCT_NAME); 1123197059aSPhilip A. Prindeville if (!product || strcmp(product, "Geos")) 1133197059aSPhilip A. Prindeville return 0; 1143197059aSPhilip A. Prindeville 1153197059aSPhilip A. Prindeville printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n", 1163197059aSPhilip A. Prindeville KBUILD_MODNAME, vendor, product); 1173197059aSPhilip A. Prindeville 1183197059aSPhilip A. Prindeville register_geos(); 1193197059aSPhilip A. Prindeville 1203197059aSPhilip A. Prindeville return 0; 1213197059aSPhilip A. Prindeville } 122*eb61aee7SPaul Gortmaker device_initcall(geos_init); 123