gpiobus.c (f31030ba6102f12ce96f42e9ac37a0bee85e43ae) gpiobus.c (ff3468ac94597efdcbc56f372528dfc98b114dac)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2009 Oleksandr Tymoshenko <gonzo@freebsd.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 129 unchanged lines hidden (view full) ---

138 flags &= caps;
139
140 /* Cannot mix input/output together. */
141 if (flags & GPIO_PIN_INPUT && flags & GPIO_PIN_OUTPUT)
142 return (EINVAL);
143 /* Cannot mix pull-up/pull-down together. */
144 if (flags & GPIO_PIN_PULLUP && flags & GPIO_PIN_PULLDOWN)
145 return (EINVAL);
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2009 Oleksandr Tymoshenko <gonzo@freebsd.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 129 unchanged lines hidden (view full) ---

138 flags &= caps;
139
140 /* Cannot mix input/output together. */
141 if (flags & GPIO_PIN_INPUT && flags & GPIO_PIN_OUTPUT)
142 return (EINVAL);
143 /* Cannot mix pull-up/pull-down together. */
144 if (flags & GPIO_PIN_PULLUP && flags & GPIO_PIN_PULLDOWN)
145 return (EINVAL);
146 /* Cannot mix output and interrupt flags together */
147 if (flags & GPIO_PIN_OUTPUT && flags & GPIO_INTR_MASK)
148 return (EINVAL);
149 /* Only one interrupt flag can be defined at once */
150 if ((flags & GPIO_INTR_MASK) & ((flags & GPIO_INTR_MASK) - 1))
151 return (EINVAL);
152 /* The interrupt attached flag cannot be set */
153 if (flags & GPIO_INTR_ATTACHED)
154 return (EINVAL);
146
147 return (0);
148}
149
150int
151gpio_pin_get_by_bus_pinnum(device_t busdev, uint32_t pinnum, gpio_pin_t *ppin)
152{
153 gpio_pin_t pin;

--- 980 unchanged lines hidden ---
155
156 return (0);
157}
158
159int
160gpio_pin_get_by_bus_pinnum(device_t busdev, uint32_t pinnum, gpio_pin_t *ppin)
161{
162 gpio_pin_t pin;

--- 980 unchanged lines hidden ---