Lines Matching +full:out +full:- +full:gpios

1 // SPDX-License-Identifier: GPL-2.0
20 #include <linux/hwmon-sysfs.h>
25 #include <linux/platform_data/x86/simatic-ipc-base.h>
28 #include "simatic-ipc-batt.h"
39 struct gpio_desc *gpios[3]; member
47 if (priv.gpios[2]) { in simatic_ipc_batt_read_gpio()
48 gpiod_set_value(priv.gpios[2], 1); in simatic_ipc_batt_read_gpio()
52 if (gpiod_get_value_cansleep(priv.gpios[0])) in simatic_ipc_batt_read_gpio()
54 else if (gpiod_get_value_cansleep(priv.gpios[1])) in simatic_ipc_batt_read_gpio()
57 if (priv.gpios[2]) in simatic_ipc_batt_read_gpio()
58 gpiod_set_value(priv.gpios[2], 0); in simatic_ipc_batt_read_gpio()
73 if (!request_muxed_region(res->start, resource_size(res), res->name)) { in simatic_ipc_batt_read_io()
75 return -EBUSY; in simatic_ipc_batt_read_io()
119 return -EOPNOTSUPP; in simatic_ipc_batt_read()
158 struct device *dev = &pdev->dev; in simatic_ipc_batt_probe()
163 plat = pdev->dev.platform_data; in simatic_ipc_batt_probe()
164 priv.devmode = plat->devmode; in simatic_ipc_batt_probe()
172 table->dev_id = dev_name(dev); in simatic_ipc_batt_probe()
178 return -ENODEV; in simatic_ipc_batt_probe()
181 priv.gpios[0] = devm_gpiod_get_index(dev, "CMOSBattery empty", 0, GPIOD_IN); in simatic_ipc_batt_probe()
182 if (IS_ERR(priv.gpios[0])) { in simatic_ipc_batt_probe()
183 err = PTR_ERR(priv.gpios[0]); in simatic_ipc_batt_probe()
184 priv.gpios[0] = NULL; in simatic_ipc_batt_probe()
185 goto out; in simatic_ipc_batt_probe()
187 priv.gpios[1] = devm_gpiod_get_index(dev, "CMOSBattery low", 1, GPIOD_IN); in simatic_ipc_batt_probe()
188 if (IS_ERR(priv.gpios[1])) { in simatic_ipc_batt_probe()
189 err = PTR_ERR(priv.gpios[1]); in simatic_ipc_batt_probe()
190 priv.gpios[1] = NULL; in simatic_ipc_batt_probe()
191 goto out; in simatic_ipc_batt_probe()
194 if (table->table[2].key) { in simatic_ipc_batt_probe()
199 priv.gpios[2] = devm_gpiod_get_index(dev, "CMOSBattery meter", 2, flags); in simatic_ipc_batt_probe()
200 if (IS_ERR(priv.gpios[2])) { in simatic_ipc_batt_probe()
201 err = PTR_ERR(priv.gpios[2]); in simatic_ipc_batt_probe()
202 priv.gpios[2] = NULL; in simatic_ipc_batt_probe()
203 goto out; in simatic_ipc_batt_probe()
206 priv.gpios[2] = NULL; in simatic_ipc_batt_probe()
216 goto out; in simatic_ipc_batt_probe()
223 out: in simatic_ipc_batt_probe()