1 // SPDX-License-Identifier: GPL-2.0-only
3 * System Specific setup for Traverse Technologies GEOS.
4 * At the moment this means setup of GPIO control of LEDs.
6 * Copyright (C) 2008 Constantin Baranov <const@mimas.ru>
7 * Copyright (C) 2011 Ed Wildgoose <kernel@wildgooses.com>
8 * and Philip Prindeville <philipp@redfish-solutions.com>
10 * TODO: There are large similarities with leds-net5501.c
11 * by Alessandro Zummo <a.zummo@towertech.it>
12 * In the future leds-net5501.c should be migrated over to platform
15 #include <linux/kernel.h>
16 #include <linux/init.h>
18 #include <linux/string.h>
19 #include <linux/leds.h>
20 #include <linux/platform_device.h>
21 #include <linux/input.h>
22 #include <linux/gpio_keys.h>
23 #include <linux/gpio/machine.h>
24 #include <linux/dmi.h>
26 #include <asm/geode.h>
28 static struct gpio_keys_button geos_gpio_buttons[] = {
33 .desc = "Reset button",
36 .debounce_interval = 100,
40 static struct gpio_keys_platform_data geos_buttons_data = {
41 .buttons = geos_gpio_buttons,
42 .nbuttons = ARRAY_SIZE(geos_gpio_buttons),
46 static struct platform_device geos_buttons_dev = {
47 .name = "gpio-keys-polled",
50 .platform_data = &geos_buttons_data,
54 static struct gpio_led geos_leds[] = {
57 .default_trigger = "default-on",
61 .default_trigger = "default-off",
65 .default_trigger = "default-off",
69 static struct gpio_led_platform_data geos_leds_data = {
70 .num_leds = ARRAY_SIZE(geos_leds),
74 static struct gpiod_lookup_table geos_leds_gpio_table = {
75 .dev_id = "leds-gpio",
77 /* The Geode GPIOs should be on the CS5535 companion chip */
78 GPIO_LOOKUP_IDX("cs5535-gpio", 6, NULL, 0, GPIO_ACTIVE_LOW),
79 GPIO_LOOKUP_IDX("cs5535-gpio", 25, NULL, 1, GPIO_ACTIVE_LOW),
80 GPIO_LOOKUP_IDX("cs5535-gpio", 27, NULL, 2, GPIO_ACTIVE_LOW),
85 static struct platform_device geos_leds_dev = {
88 .dev.platform_data = &geos_leds_data,
91 static struct platform_device *geos_devs[] __initdata = {
96 static void __init register_geos(void)
98 /* Setup LED control through leds-gpio driver */
99 gpiod_add_lookup_table(&geos_leds_gpio_table);
100 platform_add_devices(geos_devs, ARRAY_SIZE(geos_devs));
103 static int __init geos_init(void)
105 const char *vendor, *product;
110 vendor = dmi_get_system_info(DMI_SYS_VENDOR);
111 if (!vendor || strcmp(vendor, "Traverse Technologies"))
114 product = dmi_get_system_info(DMI_PRODUCT_NAME);
115 if (!product || strcmp(product, "Geos"))
118 printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n",
119 KBUILD_MODNAME, vendor, product);
125 device_initcall(geos_init);