Lines Matching defs:offset
45 static unsigned int to_reg(unsigned int reg, unsigned int offset)
47 return reg + (offset > 7);
50 static int xra1403_direction_input(struct gpio_chip *chip, unsigned int offset)
54 return regmap_update_bits(xra->regmap, to_reg(XRA_GCR, offset),
55 BIT(offset % 8), BIT(offset % 8));
58 static int xra1403_direction_output(struct gpio_chip *chip, unsigned int offset,
64 ret = regmap_update_bits(xra->regmap, to_reg(XRA_GCR, offset),
65 BIT(offset % 8), 0);
69 ret = regmap_update_bits(xra->regmap, to_reg(XRA_OCR, offset),
70 BIT(offset % 8), value ? BIT(offset % 8) : 0);
75 static int xra1403_get_direction(struct gpio_chip *chip, unsigned int offset)
81 ret = regmap_read(xra->regmap, to_reg(XRA_GCR, offset), &val);
85 if (val & BIT(offset % 8))
91 static int xra1403_get(struct gpio_chip *chip, unsigned int offset)
97 ret = regmap_read(xra->regmap, to_reg(XRA_GSR, offset), &val);
101 return !!(val & BIT(offset % 8));
104 static void xra1403_set(struct gpio_chip *chip, unsigned int offset, int value)
109 ret = regmap_update_bits(xra->regmap, to_reg(XRA_OCR, offset),
110 BIT(offset % 8), value ? BIT(offset % 8) : 0);
113 offset, ret);