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