• Home
  • Raw
  • Download

Lines Matching refs:nr

117 static int ichx_write_bit(int reg, unsigned nr, int val, int verify)  in ichx_write_bit()  argument
121 int reg_nr = nr / 32; in ichx_write_bit()
122 int bit = nr & 0x1f; in ichx_write_bit()
152 static int ichx_read_bit(int reg, unsigned nr) in ichx_read_bit() argument
156 int reg_nr = nr / 32; in ichx_read_bit()
157 int bit = nr & 0x1f; in ichx_read_bit()
172 static bool ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr) in ichx_gpio_check_available() argument
174 return !!(ichx_priv.use_gpio & (1 << (nr / 32))); in ichx_gpio_check_available()
177 static int ichx_gpio_get_direction(struct gpio_chip *gpio, unsigned nr) in ichx_gpio_get_direction() argument
179 return ichx_read_bit(GPIO_IO_SEL, nr) ? GPIOF_DIR_IN : GPIOF_DIR_OUT; in ichx_gpio_get_direction()
182 static int ichx_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) in ichx_gpio_direction_input() argument
188 if (ichx_write_bit(GPIO_IO_SEL, nr, 1, 1)) in ichx_gpio_direction_input()
194 static int ichx_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, in ichx_gpio_direction_output() argument
198 if (nr < 32 && ichx_priv.desc->have_blink) in ichx_gpio_direction_output()
199 ichx_write_bit(GPO_BLINK, nr, 0, 0); in ichx_gpio_direction_output()
202 ichx_write_bit(GPIO_LVL, nr, val, 0); in ichx_gpio_direction_output()
208 if (ichx_write_bit(GPIO_IO_SEL, nr, 0, 1)) in ichx_gpio_direction_output()
214 static int ichx_gpio_get(struct gpio_chip *chip, unsigned nr) in ichx_gpio_get() argument
216 return ichx_read_bit(GPIO_LVL, nr); in ichx_gpio_get()
219 static int ich6_gpio_get(struct gpio_chip *chip, unsigned nr) in ich6_gpio_get() argument
228 if (nr < 16) { in ich6_gpio_get()
235 ICHX_WRITE(1 << (16 + nr), 0, ichx_priv.pm_base); in ich6_gpio_get()
240 return (data >> 16) & (1 << nr) ? 1 : 0; in ich6_gpio_get()
242 return ichx_gpio_get(chip, nr); in ich6_gpio_get()
246 static int ichx_gpio_request(struct gpio_chip *chip, unsigned nr) in ichx_gpio_request() argument
248 if (!ichx_gpio_check_available(chip, nr)) in ichx_gpio_request()
257 if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f))) in ichx_gpio_request()
260 return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV; in ichx_gpio_request()
263 static int ich6_gpio_request(struct gpio_chip *chip, unsigned nr) in ich6_gpio_request() argument
271 if (nr == 16 || nr == 17) in ich6_gpio_request()
272 nr -= 16; in ich6_gpio_request()
274 return ichx_gpio_request(chip, nr); in ich6_gpio_request()
277 static void ichx_gpio_set(struct gpio_chip *chip, unsigned nr, int val) in ichx_gpio_set() argument
279 ichx_write_bit(GPIO_LVL, nr, val, 0); in ichx_gpio_set()