#define DEFAULT_PIN_NUMBER 32 /* * Register bits used by the GPIO device * Some boards, such as TS-7970 do not have a separate input bit
*/ #define TS4900_GPIO_OE 0x01 #define TS4900_GPIO_OUT 0x02 #define TS4900_GPIO_IN 0x04 #define TS7970_GPIO_IN 0x02
/* * Only clear the OE bit here, requires a RMW. Prevents a potential issue * with OE and DAT getting to the physical pin at different times.
*/ return regmap_update_bits(priv->regmap, offset, TS4900_GPIO_OE, 0);
}
staticint ts4900_gpio_direction_output(struct gpio_chip *chip, unsignedint offset, int value)
{ struct ts4900_gpio_priv *priv = gpiochip_get_data(chip); unsignedint reg; int ret;
/* * If changing from an input to an output, we need to first set the * GPIO's DAT bit to what is requested and then set the OE bit. This * prevents a glitch that can occur on the IO line.
*/
regmap_read(priv->regmap, offset, ®); if (!(reg & TS4900_GPIO_OE)) { if (value)
reg = TS4900_GPIO_OUT; else
reg &= ~TS4900_GPIO_OUT;
regmap_write(priv->regmap, offset, reg);
}
if (value)
ret = regmap_write(priv->regmap, offset, TS4900_GPIO_OE |
TS4900_GPIO_OUT); else
ret = regmap_write(priv->regmap, offset, TS4900_GPIO_OE);
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.