// SPDX-License-Identifier: GPL-2.0-only /* * GPIO interface for IT87xx Super I/O chips * * Author: Diego Elio Pettenò <flameeyes@flameeyes.eu> * Copyright (c) 2017 Google, Inc. * * Based on it87_wdt.c by Oliver Schuster * gpio-it8761e.c by Denis Turischev * gpio-stmpe.c by Rabin Vincent
*/
/** * struct it87_gpio - it87-specific GPIO chip * @chip: the underlying gpio_chip structure * @lock: a lock to avoid races between operations * @io_base: base address for gpio ports * @io_size: size of the port rage starting from io_base. * @output_base: Super I/O register address for Output Enable register * @simple_base: Super I/O 'Simple I/O' Enable register * @simple_size: Super IO 'Simple I/O' Enable register size; this is * required because IT87xx chips might only provide Simple I/O * switches on a subset of lines, whereas the others keep the * same status all time.
*/ struct it87_gpio { struct gpio_chip chip;
spinlock_t lock;
u16 io_base;
u16 io_size;
u8 output_base;
u8 simple_base;
u8 simple_size;
};
/* not all the IT87xx chips support Simple I/O and not all of * them allow all the lines to be set/unset to Simple I/O.
*/ if (group < it87_gpio->simple_size)
superio_set_mask(mask, group + it87_gpio->simple_base);
/* clear output enable, setting the pin to input, as all the * newly-exported GPIO interfaces are set to input.
*/
superio_clear_mask(mask, group + it87_gpio->output_base);
if (!request_region(it87_gpio->io_base, it87_gpio->io_size,
KBUILD_MODNAME)) return -EBUSY;
/* Set up aliases for the GPIO connection. * * ITE documentation for recent chips such as the IT8728F * refers to the GPIO lines as GPxy, with a coordinates system * where x is the GPIO group (starting from 1) and y is the * bit within the group. * * By creating these aliases, we make it easier to understand * to which GPIO pin we're referring to.
*/
labels = kcalloc(it87_gpio->chip.ngpio, sizeof("it87_gpXY"),
GFP_KERNEL);
labels_table = kcalloc(it87_gpio->chip.ngpio, sizeof(constchar *),
GFP_KERNEL);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.