simatic-ipc-leds-gpio-elkhartlake.c 1.8 KB

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