Lines Matching +full:gpio +full:- +full:config

1 // SPDX-License-Identifier: GPL-2.0-only
4 National Semiconductor common GPIO device-file/VFS methods.
5 Allows a user space process to control the GPIO pins.
7 Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
25 /* retrieve current config w/o changing it */ in nsc_gpio_dump()
26 u32 config = amp->gpio_config(index, ~0, 0); in nsc_gpio_dump() local
29 dev_info(amp->dev, "io%02u: 0x%04x %s %s %s %s %s %s %s\tio:%d/%d\n", in nsc_gpio_dump()
30 index, config, in nsc_gpio_dump()
31 (config & 1) ? "OE" : "TS", /* output-enabled/tristate */ in nsc_gpio_dump()
32 (config & 2) ? "PP" : "OD", /* push pull / open drain */ in nsc_gpio_dump()
33 (config & 4) ? "PUE" : "PUD", /* pull up enabled/disabled */ in nsc_gpio_dump()
34 (config & 8) ? "LOCKED" : "", /* locked / unlocked */ in nsc_gpio_dump()
35 (config & 16) ? "LEVEL" : "EDGE",/* level/edge input */ in nsc_gpio_dump()
36 (config & 32) ? "HI" : "LO", /* trigger on rise/fall edge */ in nsc_gpio_dump()
37 (config & 64) ? "DEBOUNCE" : "", /* debounce */ in nsc_gpio_dump()
39 amp->gpio_get(index), amp->gpio_current(index)); in nsc_gpio_dump()
46 struct nsc_gpio_ops *amp = file->private_data; in nsc_gpio_write()
47 struct device *dev = amp->dev; in nsc_gpio_write()
54 return -EFAULT; in nsc_gpio_write()
57 amp->gpio_set(m, 0); in nsc_gpio_write()
60 amp->gpio_set(m, 1); in nsc_gpio_write()
63 dev_dbg(dev, "GPIO%d output enabled\n", m); in nsc_gpio_write()
64 amp->gpio_config(m, ~1, 1); in nsc_gpio_write()
67 dev_dbg(dev, "GPIO%d output disabled\n", m); in nsc_gpio_write()
68 amp->gpio_config(m, ~1, 0); in nsc_gpio_write()
71 dev_dbg(dev, "GPIO%d output is push pull\n", m); in nsc_gpio_write()
72 amp->gpio_config(m, ~2, 2); in nsc_gpio_write()
75 dev_dbg(dev, "GPIO%d output is open drain\n", m); in nsc_gpio_write()
76 amp->gpio_config(m, ~2, 0); in nsc_gpio_write()
79 dev_dbg(dev, "GPIO%d pull up enabled\n", m); in nsc_gpio_write()
80 amp->gpio_config(m, ~4, 4); in nsc_gpio_write()
83 dev_dbg(dev, "GPIO%d pull up disabled\n", m); in nsc_gpio_write()
84 amp->gpio_config(m, ~4, 0); in nsc_gpio_write()
88 amp->gpio_dump(amp, m); in nsc_gpio_write()
100 return -EINVAL; /* full string handled, report error */ in nsc_gpio_write()
110 struct nsc_gpio_ops *amp = file->private_data; in nsc_gpio_read()
112 value = amp->gpio_get(m); in nsc_gpio_read()
114 return -EFAULT; in nsc_gpio_read()
119 /* common file-ops routines for both scx200_gpio and pc87360_gpio */
139 MODULE_DESCRIPTION("NatSemi GPIO Common Methods");