Lines Matching +full:super +full:- +full:set

1 // SPDX-License-Identifier: GPL-2.0-only
3 * GPIO interface for IT87xx Super I/O chips
9 * gpio-it8761e.c by Denis Turischev
10 * gpio-stmpe.c by Rabin Vincent
49 * struct it87_gpio - it87-specific GPIO chip
54 * @output_base: Super I/O register address for Output Enable register
55 * @simple_base: Super I/O 'Simple I/O' Enable register
56 * @simple_size: Super IO 'Simple I/O' Enable register size; this is
83 return -EBUSY; in superio_enter()
155 spin_lock(&it87_gpio->lock); in it87_gpio_request()
162 * them allow all the lines to be set/unset to Simple I/O. in it87_gpio_request()
164 if (group < it87_gpio->simple_size) in it87_gpio_request()
165 superio_set_mask(mask, group + it87_gpio->simple_base); in it87_gpio_request()
168 * newly-exported GPIO interfaces are set to input. in it87_gpio_request()
170 superio_clear_mask(mask, group + it87_gpio->output_base); in it87_gpio_request()
175 spin_unlock(&it87_gpio->lock); in it87_gpio_request()
186 reg = (gpio_num / 8) + it87_gpio->io_base; in it87_gpio_get()
200 spin_lock(&it87_gpio->lock); in it87_gpio_direction_in()
207 superio_clear_mask(mask, group + it87_gpio->output_base); in it87_gpio_direction_in()
212 spin_unlock(&it87_gpio->lock); in it87_gpio_direction_in()
224 reg = (gpio_num / 8) + it87_gpio->io_base; in it87_gpio_set()
243 spin_lock(&it87_gpio->lock); in it87_gpio_direction_out()
249 /* set the output enable bit */ in it87_gpio_direction_out()
250 superio_set_mask(mask, group + it87_gpio->output_base); in it87_gpio_direction_out()
257 spin_unlock(&it87_gpio->lock); in it87_gpio_direction_out()
267 .set = it87_gpio_set,
269 .base = -1
289 it87_gpio->chip = it87_template_chip; in it87_gpio_init()
294 it87_gpio->io_size = 8; /* it8613 only needs 6, use 8 for alignment */ in it87_gpio_init()
295 it87_gpio->output_base = 0xc8; in it87_gpio_init()
296 it87_gpio->simple_base = 0xc0; in it87_gpio_init()
297 it87_gpio->simple_size = 6; in it87_gpio_init()
298 it87_gpio->chip.ngpio = 64; /* has 48, use 64 for convenient calc */ in it87_gpio_init()
303 it87_gpio->io_size = 11; in it87_gpio_init()
304 it87_gpio->output_base = 0xc8; in it87_gpio_init()
305 it87_gpio->simple_size = 0; in it87_gpio_init()
306 it87_gpio->chip.ngpio = 64; in it87_gpio_init()
314 it87_gpio->io_size = 8; in it87_gpio_init()
315 it87_gpio->output_base = 0xc8; in it87_gpio_init()
316 it87_gpio->simple_base = 0xc0; in it87_gpio_init()
317 it87_gpio->simple_size = 5; in it87_gpio_init()
318 it87_gpio->chip.ngpio = 64; in it87_gpio_init()
322 it87_gpio->io_size = 4; in it87_gpio_init()
323 it87_gpio->output_base = 0xf0; in it87_gpio_init()
324 it87_gpio->simple_size = 0; in it87_gpio_init()
325 it87_gpio->chip.ngpio = 16; in it87_gpio_init()
329 return -ENODEV; in it87_gpio_init()
333 return -ENODEV; in it87_gpio_init()
343 it87_gpio->io_base = superio_inw(gpio_ba_reg); in it87_gpio_init()
348 chip_type, chip_rev, it87_gpio->chip.ngpio, in it87_gpio_init()
349 it87_gpio->io_base); in it87_gpio_init()
351 if (!request_region(it87_gpio->io_base, it87_gpio->io_size, in it87_gpio_init()
353 return -EBUSY; in it87_gpio_init()
355 /* Set up aliases for the GPIO connection. in it87_gpio_init()
365 labels = kcalloc(it87_gpio->chip.ngpio, sizeof("it87_gpXY"), in it87_gpio_init()
367 labels_table = kcalloc(it87_gpio->chip.ngpio, sizeof(const char *), in it87_gpio_init()
371 rc = -ENOMEM; in it87_gpio_init()
375 for (i = 0; i < it87_gpio->chip.ngpio; i++) { in it87_gpio_init()
382 it87_gpio->chip.names = (const char *const*)labels_table; in it87_gpio_init()
384 rc = gpiochip_add_data(&it87_gpio->chip, it87_gpio); in it87_gpio_init()
393 release_region(it87_gpio->io_base, it87_gpio->io_size); in it87_gpio_init()
401 gpiochip_remove(&it87_gpio->chip); in it87_gpio_exit()
402 release_region(it87_gpio->io_base, it87_gpio->io_size); in it87_gpio_exit()
403 kfree(it87_gpio->chip.names[0]); in it87_gpio_exit()
404 kfree(it87_gpio->chip.names); in it87_gpio_exit()
411 MODULE_DESCRIPTION("GPIO interface for IT87xx Super I/O chips");