1*835a0c10SLee Jones // SPDX-License-Identifier: GPL-2.0 2*835a0c10SLee Jones /* 3*835a0c10SLee Jones * Siemens SIMATIC IPC driver for GPIO based LEDs 4*835a0c10SLee Jones * 5*835a0c10SLee Jones * Copyright (c) Siemens AG, 2023 6*835a0c10SLee Jones * 7*835a0c10SLee Jones * Author: 8*835a0c10SLee Jones * Henning Schild <henning.schild@siemens.com> 9*835a0c10SLee Jones */ 10*835a0c10SLee Jones 11*835a0c10SLee Jones #include <linux/gpio/machine.h> 12*835a0c10SLee Jones #include <linux/gpio/consumer.h> 13*835a0c10SLee Jones #include <linux/leds.h> 14*835a0c10SLee Jones #include <linux/module.h> 15*835a0c10SLee Jones #include <linux/platform_device.h> 16*835a0c10SLee Jones #include <linux/platform_data/x86/simatic-ipc-base.h> 17*835a0c10SLee Jones 18*835a0c10SLee Jones #include "simatic-ipc-leds-gpio.h" 19*835a0c10SLee Jones 20*835a0c10SLee Jones static struct gpiod_lookup_table simatic_ipc_led_gpio_table = { 21*835a0c10SLee Jones .dev_id = "leds-gpio", 22*835a0c10SLee Jones .table = { 23*835a0c10SLee Jones GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 52, NULL, 0, GPIO_ACTIVE_LOW), 24*835a0c10SLee Jones GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 53, NULL, 1, GPIO_ACTIVE_LOW), 25*835a0c10SLee Jones GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 57, NULL, 2, GPIO_ACTIVE_LOW), 26*835a0c10SLee Jones GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 58, NULL, 3, GPIO_ACTIVE_LOW), 27*835a0c10SLee Jones GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 60, NULL, 4, GPIO_ACTIVE_LOW), 28*835a0c10SLee Jones GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 51, NULL, 5, GPIO_ACTIVE_LOW), 29*835a0c10SLee Jones {} /* Terminating entry */ 30*835a0c10SLee Jones }, 31*835a0c10SLee Jones }; 32*835a0c10SLee Jones 33*835a0c10SLee Jones static struct gpiod_lookup_table simatic_ipc_led_gpio_table_extra = { 34*835a0c10SLee Jones .dev_id = NULL, /* Filled during initialization */ 35*835a0c10SLee Jones .table = { 36*835a0c10SLee Jones GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 56, NULL, 6, GPIO_ACTIVE_LOW), 37*835a0c10SLee Jones GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 59, NULL, 7, GPIO_ACTIVE_HIGH), 38*835a0c10SLee Jones {} /* Terminating entry */ 39*835a0c10SLee Jones }, 40*835a0c10SLee Jones }; 41*835a0c10SLee Jones 42*835a0c10SLee Jones static int simatic_ipc_leds_gpio_apollolake_probe(struct platform_device *pdev) 43*835a0c10SLee Jones { 44*835a0c10SLee Jones return simatic_ipc_leds_gpio_probe(pdev, &simatic_ipc_led_gpio_table, 45*835a0c10SLee Jones &simatic_ipc_led_gpio_table_extra); 46*835a0c10SLee Jones } 47*835a0c10SLee Jones 48*835a0c10SLee Jones static void simatic_ipc_leds_gpio_apollolake_remove(struct platform_device *pdev) 49*835a0c10SLee Jones { 50*835a0c10SLee Jones simatic_ipc_leds_gpio_remove(pdev, &simatic_ipc_led_gpio_table, 51*835a0c10SLee Jones &simatic_ipc_led_gpio_table_extra); 52*835a0c10SLee Jones } 53*835a0c10SLee Jones 54*835a0c10SLee Jones static struct platform_driver simatic_ipc_led_gpio_apollolake_driver = { 55*835a0c10SLee Jones .probe = simatic_ipc_leds_gpio_apollolake_probe, 56*835a0c10SLee Jones .remove = simatic_ipc_leds_gpio_apollolake_remove, 57*835a0c10SLee Jones .driver = { 58*835a0c10SLee Jones .name = KBUILD_MODNAME, 59*835a0c10SLee Jones }, 60*835a0c10SLee Jones }; 61*835a0c10SLee Jones module_platform_driver(simatic_ipc_led_gpio_apollolake_driver); 62*835a0c10SLee Jones 63*835a0c10SLee Jones MODULE_DESCRIPTION("LED driver for Siemens Simatic IPCs based on Intel Apollo Lake GPIO"); 64*835a0c10SLee Jones MODULE_LICENSE("GPL v2"); 65*835a0c10SLee Jones MODULE_ALIAS("platform:" KBUILD_MODNAME); 66*835a0c10SLee Jones MODULE_SOFTDEP("pre: simatic-ipc-leds-gpio-core platform:apollolake-pinctrl"); 67*835a0c10SLee Jones MODULE_AUTHOR("Henning Schild <henning.schild@siemens.com>"); 68