58 lines · c
1// SPDX-License-Identifier: GPL-2.02/*3 * Siemens SIMATIC IPC driver for GPIO based LEDs4 *5 * Copyright (c) Siemens AG, 20236 *7 * Author:8 * Henning Schild <henning.schild@siemens.com>9 */10 11#include <linux/gpio/machine.h>12#include <linux/gpio/consumer.h>13#include <linux/leds.h>14#include <linux/module.h>15#include <linux/platform_device.h>16#include <linux/platform_data/x86/simatic-ipc-base.h>17 18#include "simatic-ipc-leds-gpio.h"19 20static struct gpiod_lookup_table simatic_ipc_led_gpio_table = {21 .dev_id = "leds-gpio",22 .table = {23 GPIO_LOOKUP_IDX("INTC1020:04", 72, NULL, 0, GPIO_ACTIVE_HIGH),24 GPIO_LOOKUP_IDX("INTC1020:04", 77, NULL, 1, GPIO_ACTIVE_HIGH),25 GPIO_LOOKUP_IDX("INTC1020:04", 78, NULL, 2, GPIO_ACTIVE_HIGH),26 GPIO_LOOKUP_IDX("INTC1020:04", 58, NULL, 3, GPIO_ACTIVE_HIGH),27 GPIO_LOOKUP_IDX("INTC1020:04", 60, NULL, 4, GPIO_ACTIVE_HIGH),28 GPIO_LOOKUP_IDX("INTC1020:04", 62, NULL, 5, GPIO_ACTIVE_HIGH),29 {} /* Terminating entry */30 },31};32 33static int simatic_ipc_leds_gpio_elkhartlake_probe(struct platform_device *pdev)34{35 return simatic_ipc_leds_gpio_probe(pdev, &simatic_ipc_led_gpio_table,36 NULL);37}38 39static void simatic_ipc_leds_gpio_elkhartlake_remove(struct platform_device *pdev)40{41 simatic_ipc_leds_gpio_remove(pdev, &simatic_ipc_led_gpio_table, NULL);42}43 44static struct platform_driver simatic_ipc_led_gpio_elkhartlake_driver = {45 .probe = simatic_ipc_leds_gpio_elkhartlake_probe,46 .remove_new = simatic_ipc_leds_gpio_elkhartlake_remove,47 .driver = {48 .name = KBUILD_MODNAME,49 },50};51module_platform_driver(simatic_ipc_led_gpio_elkhartlake_driver);52 53MODULE_DESCRIPTION("LED driver for Siemens Simatic IPCs based on Intel Elkhart Lake GPIO");54MODULE_LICENSE("GPL v2");55MODULE_ALIAS("platform:" KBUILD_MODNAME);56MODULE_SOFTDEP("pre: simatic-ipc-leds-gpio-core platform:elkhartlake-pinctrl");57MODULE_AUTHOR("Henning Schild <henning.schild@siemens.com>");58