• Home
  • Raw
  • Download

Lines Matching +full:pin +full:- +full:switches

1 // SPDX-License-Identifier: GPL-2.0-only
9 * gpio-it8761e.c by Denis Turischev
10 * gpio-stmpe.c by Rabin Vincent
49 * struct it87_gpio - it87-specific GPIO chip
58 * switches on a subset of lines, whereas the others keep the
83 return -EBUSY; in superio_enter()
163 spin_lock(&it87_gpio->lock); in it87_gpio_request()
172 if (group < it87_gpio->simple_size) in it87_gpio_request()
173 superio_set_mask(mask, group + it87_gpio->simple_base); in it87_gpio_request()
175 /* clear output enable, setting the pin to input, as all the in it87_gpio_request()
176 * newly-exported GPIO interfaces are set to input. in it87_gpio_request()
178 superio_clear_mask(mask, group + it87_gpio->output_base); in it87_gpio_request()
183 spin_unlock(&it87_gpio->lock); in it87_gpio_request()
194 reg = (gpio_num / 8) + it87_gpio->io_base; in it87_gpio_get()
208 spin_lock(&it87_gpio->lock); in it87_gpio_direction_in()
215 superio_clear_mask(mask, group + it87_gpio->output_base); in it87_gpio_direction_in()
220 spin_unlock(&it87_gpio->lock); in it87_gpio_direction_in()
232 reg = (gpio_num / 8) + it87_gpio->io_base; in it87_gpio_set()
251 spin_lock(&it87_gpio->lock); in it87_gpio_direction_out()
258 superio_set_mask(mask, group + it87_gpio->output_base); in it87_gpio_direction_out()
265 spin_unlock(&it87_gpio->lock); in it87_gpio_direction_out()
277 .base = -1
297 it87_gpio->chip = it87_template_chip; in it87_gpio_init()
302 it87_gpio->io_size = 8; /* it8613 only needs 6, use 8 for alignment */ in it87_gpio_init()
303 it87_gpio->output_base = 0xc8; in it87_gpio_init()
304 it87_gpio->simple_base = 0xc0; in it87_gpio_init()
305 it87_gpio->simple_size = 6; in it87_gpio_init()
306 it87_gpio->chip.ngpio = 64; /* has 48, use 64 for convenient calc */ in it87_gpio_init()
311 it87_gpio->io_size = 11; in it87_gpio_init()
312 it87_gpio->output_base = 0xc8; in it87_gpio_init()
313 it87_gpio->simple_size = 0; in it87_gpio_init()
314 it87_gpio->chip.ngpio = 64; in it87_gpio_init()
322 it87_gpio->io_size = 8; in it87_gpio_init()
323 it87_gpio->output_base = 0xc8; in it87_gpio_init()
324 it87_gpio->simple_base = 0xc0; in it87_gpio_init()
325 it87_gpio->simple_size = 5; in it87_gpio_init()
326 it87_gpio->chip.ngpio = 64; in it87_gpio_init()
330 it87_gpio->io_size = 4; in it87_gpio_init()
331 it87_gpio->output_base = 0xf0; in it87_gpio_init()
332 it87_gpio->simple_size = 0; in it87_gpio_init()
333 it87_gpio->chip.ngpio = 16; in it87_gpio_init()
337 return -ENODEV; in it87_gpio_init()
341 return -ENODEV; in it87_gpio_init()
351 it87_gpio->io_base = superio_inw(gpio_ba_reg); in it87_gpio_init()
356 chip_type, chip_rev, it87_gpio->chip.ngpio, in it87_gpio_init()
357 it87_gpio->io_base); in it87_gpio_init()
359 if (!request_region(it87_gpio->io_base, it87_gpio->io_size, in it87_gpio_init()
361 return -EBUSY; in it87_gpio_init()
371 * to which GPIO pin we're referring to. in it87_gpio_init()
373 labels = kcalloc(it87_gpio->chip.ngpio, sizeof("it87_gpXY"), in it87_gpio_init()
375 labels_table = kcalloc(it87_gpio->chip.ngpio, sizeof(const char *), in it87_gpio_init()
379 rc = -ENOMEM; in it87_gpio_init()
383 for (i = 0; i < it87_gpio->chip.ngpio; i++) { in it87_gpio_init()
390 it87_gpio->chip.names = (const char *const*)labels_table; in it87_gpio_init()
392 rc = gpiochip_add_data(&it87_gpio->chip, it87_gpio); in it87_gpio_init()
401 release_region(it87_gpio->io_base, it87_gpio->io_size); in it87_gpio_init()
409 gpiochip_remove(&it87_gpio->chip); in it87_gpio_exit()
410 release_region(it87_gpio->io_base, it87_gpio->io_size); in it87_gpio_exit()
411 kfree(it87_gpio->chip.names[0]); in it87_gpio_exit()
412 kfree(it87_gpio->chip.names); in it87_gpio_exit()