Lines Matching defs:offset

83 static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset,
86 if (offset < 16)
88 outl(1 << offset, chip->base + reg);
91 errata_outl(chip, 1 << (offset - 16), reg);
94 void cs5535_gpio_set(unsigned offset, unsigned int reg)
100 __cs5535_gpio_set(chip, offset, reg);
105 static void __cs5535_gpio_clear(struct cs5535_gpio_chip *chip, unsigned offset,
108 if (offset < 16)
110 outl(1 << (offset + 16), chip->base + reg);
113 errata_outl(chip, 1 << offset, reg);
116 void cs5535_gpio_clear(unsigned offset, unsigned int reg)
122 __cs5535_gpio_clear(chip, offset, reg);
127 int cs5535_gpio_isset(unsigned offset, unsigned int reg)
134 if (offset < 16)
140 offset -= 16;
144 return (val & (1 << offset)) ? 1 : 0;
165 void cs5535_gpio_setup_event(unsigned offset, int pair, int pme)
168 uint32_t shift = (offset % 8) * 4;
172 if (offset >= 24)
173 offset = GPIO_MAP_W;
174 else if (offset >= 16)
175 offset = GPIO_MAP_Z;
176 else if (offset >= 8)
177 offset = GPIO_MAP_Y;
179 offset = GPIO_MAP_X;
182 val = inl(chip->base + offset);
194 outl(val, chip->base + offset);
203 static int chip_gpio_request(struct gpio_chip *c, unsigned offset)
211 if ((mask & (1 << offset)) == 0) {
213 "pin %u is not available (check mask)\n", offset);
219 __cs5535_gpio_clear(chip, offset, GPIO_OUTPUT_AUX1);
220 __cs5535_gpio_clear(chip, offset, GPIO_OUTPUT_AUX2);
223 __cs5535_gpio_clear(chip, offset, GPIO_INPUT_AUX1);
230 static int chip_gpio_get(struct gpio_chip *chip, unsigned offset)
232 return cs5535_gpio_isset(offset, GPIO_READ_BACK);
235 static void chip_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
238 cs5535_gpio_set(offset, GPIO_OUTPUT_VAL);
240 cs5535_gpio_clear(offset, GPIO_OUTPUT_VAL);
243 static int chip_direction_input(struct gpio_chip *c, unsigned offset)
249 __cs5535_gpio_set(chip, offset, GPIO_INPUT_ENABLE);
250 __cs5535_gpio_clear(chip, offset, GPIO_OUTPUT_ENABLE);
256 static int chip_direction_output(struct gpio_chip *c, unsigned offset, int val)
263 __cs5535_gpio_set(chip, offset, GPIO_INPUT_ENABLE);
264 __cs5535_gpio_set(chip, offset, GPIO_OUTPUT_ENABLE);
266 __cs5535_gpio_set(chip, offset, GPIO_OUTPUT_VAL);
268 __cs5535_gpio_clear(chip, offset, GPIO_OUTPUT_VAL);