Lines Matching refs:nr

116 static int ichx_write_bit(int reg, unsigned nr, int val, int verify)  in ichx_write_bit()  argument
120 int reg_nr = nr / 32; in ichx_write_bit()
121 int bit = nr & 0x1f; in ichx_write_bit()
151 static int ichx_read_bit(int reg, unsigned nr) in ichx_read_bit() argument
155 int reg_nr = nr / 32; in ichx_read_bit()
156 int bit = nr & 0x1f; in ichx_read_bit()
171 static bool ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr) in ichx_gpio_check_available() argument
173 return !!(ichx_priv.use_gpio & (1 << (nr / 32))); in ichx_gpio_check_available()
176 static int ichx_gpio_get_direction(struct gpio_chip *gpio, unsigned nr) in ichx_gpio_get_direction() argument
178 return ichx_read_bit(GPIO_IO_SEL, nr) ? GPIOF_DIR_IN : GPIOF_DIR_OUT; in ichx_gpio_get_direction()
181 static int ichx_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) in ichx_gpio_direction_input() argument
187 if (ichx_write_bit(GPIO_IO_SEL, nr, 1, 1)) in ichx_gpio_direction_input()
193 static int ichx_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, in ichx_gpio_direction_output() argument
197 if (nr < 32 && ichx_priv.desc->have_blink) in ichx_gpio_direction_output()
198 ichx_write_bit(GPO_BLINK, nr, 0, 0); in ichx_gpio_direction_output()
201 ichx_write_bit(GPIO_LVL, nr, val, 0); in ichx_gpio_direction_output()
207 if (ichx_write_bit(GPIO_IO_SEL, nr, 0, 1)) in ichx_gpio_direction_output()
213 static int ichx_gpio_get(struct gpio_chip *chip, unsigned nr) in ichx_gpio_get() argument
215 return ichx_read_bit(GPIO_LVL, nr); in ichx_gpio_get()
218 static int ich6_gpio_get(struct gpio_chip *chip, unsigned nr) in ich6_gpio_get() argument
227 if (nr < 16) { in ich6_gpio_get()
234 ICHX_WRITE(1 << (16 + nr), 0, ichx_priv.pm_base); in ich6_gpio_get()
239 return (data >> 16) & (1 << nr) ? 1 : 0; in ich6_gpio_get()
241 return ichx_gpio_get(chip, nr); in ich6_gpio_get()
245 static int ichx_gpio_request(struct gpio_chip *chip, unsigned nr) in ichx_gpio_request() argument
247 if (!ichx_gpio_check_available(chip, nr)) in ichx_gpio_request()
256 if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f))) in ichx_gpio_request()
259 return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV; in ichx_gpio_request()
262 static int ich6_gpio_request(struct gpio_chip *chip, unsigned nr) in ich6_gpio_request() argument
270 if (nr == 16 || nr == 17) in ich6_gpio_request()
271 nr -= 16; in ich6_gpio_request()
273 return ichx_gpio_request(chip, nr); in ich6_gpio_request()
276 static void ichx_gpio_set(struct gpio_chip *chip, unsigned nr, int val) in ichx_gpio_set() argument
278 ichx_write_bit(GPIO_LVL, nr, val, 0); in ichx_gpio_set()