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