a10_gpio.c (273799) | a10_gpio.c (274670) |
---|---|
1/*- 2 * Copyright (c) 2013 Ganbold Tsagaankhuu <ganbold@freebsd.org> 3 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org> 4 * Copyright (c) 2012 Luiz Otavio O Souza. 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 --- 13 unchanged lines hidden (view full) --- 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 */ 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2013 Ganbold Tsagaankhuu <ganbold@freebsd.org> 3 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org> 4 * Copyright (c) 2012 Luiz Otavio O Souza. 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 --- 13 unchanged lines hidden (view full) --- 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 */ 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/arm/allwinner/a10_gpio.c 273799 2014-10-28 18:33:59Z loos $"); | 30__FBSDID("$FreeBSD: head/sys/arm/allwinner/a10_gpio.c 274670 2014-11-18 17:22:08Z loos $"); |
31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/bus.h> 35 36#include <sys/kernel.h> 37#include <sys/module.h> 38#include <sys/rman.h> --- 258 unchanged lines hidden (view full) --- 297 for (i = 0; i < sc->sc_gpio_npins; i++) { 298 if (sc->sc_gpio_pins[i].gp_pin == pin) 299 break; 300 } 301 302 if (i >= sc->sc_gpio_npins) 303 return (EINVAL); 304 | 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/bus.h> 35 36#include <sys/kernel.h> 37#include <sys/module.h> 38#include <sys/rman.h> --- 258 unchanged lines hidden (view full) --- 297 for (i = 0; i < sc->sc_gpio_npins; i++) { 298 if (sc->sc_gpio_pins[i].gp_pin == pin) 299 break; 300 } 301 302 if (i >= sc->sc_gpio_npins) 303 return (EINVAL); 304 |
305 /* Check for unwanted flags. */ 306 if ((flags & sc->sc_gpio_pins[i].gp_caps) != flags) 307 return (EINVAL); 308 309 /* Can't mix input/output together. */ 310 if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) == 311 (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) 312 return (EINVAL); 313 314 /* Can't mix pull-up/pull-down together. */ 315 if ((flags & (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) == 316 (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) 317 return (EINVAL); 318 | |
319 a10_gpio_pin_configure(sc, &sc->sc_gpio_pins[i], flags); 320 321 return (0); 322} 323 324static int 325a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) 326{ --- 216 unchanged lines hidden --- | 305 a10_gpio_pin_configure(sc, &sc->sc_gpio_pins[i], flags); 306 307 return (0); 308} 309 310static int 311a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) 312{ --- 216 unchanged lines hidden --- |