1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Siemens SIMATIC IPC driver for CMOS battery monitoring 4 * 5 * Copyright (c) Siemens AG, 2023 6 * 7 * Authors: 8 * Henning Schild <henning.schild@siemens.com> 9 */ 10 11 #include <linux/gpio/machine.h> 12 #include <linux/gpio/consumer.h> 13 #include <linux/kernel.h> 14 #include <linux/module.h> 15 #include <linux/platform_device.h> 16 17 #include "simatic-ipc-batt.h" 18 19 static struct gpiod_lookup_table simatic_ipc_batt_gpio_table_127e = { 20 .table = { 21 GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 55, NULL, 0, GPIO_ACTIVE_HIGH), 22 GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 61, NULL, 1, GPIO_ACTIVE_HIGH), 23 GPIO_LOOKUP_IDX("apollolake-pinctrl.1", 41, NULL, 2, GPIO_ACTIVE_HIGH), 24 {} /* Terminating entry */ 25 }, 26 }; 27 28 static void simatic_ipc_batt_apollolake_remove(struct platform_device *pdev) 29 { 30 simatic_ipc_batt_remove(pdev, &simatic_ipc_batt_gpio_table_127e); 31 } 32 33 static int simatic_ipc_batt_apollolake_probe(struct platform_device *pdev) 34 { 35 return simatic_ipc_batt_probe(pdev, &simatic_ipc_batt_gpio_table_127e); 36 } 37 38 static struct platform_driver simatic_ipc_batt_driver = { 39 .probe = simatic_ipc_batt_apollolake_probe, 40 .remove_new = simatic_ipc_batt_apollolake_remove, 41 .driver = { 42 .name = KBUILD_MODNAME, 43 }, 44 }; 45 46 module_platform_driver(simatic_ipc_batt_driver); 47 48 MODULE_DESCRIPTION("CMOS Battery monitoring for Simatic IPCs based on Apollo Lake GPIO"); 49 MODULE_LICENSE("GPL"); 50 MODULE_ALIAS("platform:" KBUILD_MODNAME); 51 MODULE_SOFTDEP("pre: simatic-ipc-batt platform:apollolake-pinctrl"); 52 MODULE_AUTHOR("Henning Schild <henning.schild@siemens.com>"); 53