Lines Matching refs:pin
128 struct pm8xxx_pin_data *pin, int bank) in pm8xxx_read_bank() argument
133 ret = regmap_write(pctrl->regmap, pin->reg, val); in pm8xxx_read_bank()
139 ret = regmap_read(pctrl->regmap, pin->reg, &val); in pm8xxx_read_bank()
149 struct pm8xxx_pin_data *pin, in pm8xxx_write_bank() argument
158 ret = regmap_write(pctrl->regmap, pin->reg, val); in pm8xxx_write_bank()
228 struct pm8xxx_pin_data *pin = pctrl->desc.pins[group].drv_data; in pm8xxx_pinmux_set_mux() local
231 pin->function = function; in pm8xxx_pinmux_set_mux()
232 val = pin->function << 1; in pm8xxx_pinmux_set_mux()
234 pm8xxx_write_bank(pctrl, pin, 4, val); in pm8xxx_pinmux_set_mux()
251 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_pin_config_get() local
257 if (pin->bias != PM8XXX_GPIO_BIAS_NP) in pm8xxx_pin_config_get()
262 if (pin->bias != PM8XXX_GPIO_BIAS_PD) in pm8xxx_pin_config_get()
267 if (pin->bias > PM8XXX_GPIO_BIAS_PU_1P5_30) in pm8xxx_pin_config_get()
272 arg = pin->pull_up_strength; in pm8xxx_pin_config_get()
275 if (!pin->disable) in pm8xxx_pin_config_get()
280 if (pin->mode != PM8XXX_GPIO_MODE_INPUT) in pm8xxx_pin_config_get()
285 if (pin->mode & PM8XXX_GPIO_MODE_OUTPUT) in pm8xxx_pin_config_get()
286 arg = pin->output_value; in pm8xxx_pin_config_get()
291 arg = pin->power_source; in pm8xxx_pin_config_get()
294 arg = pin->output_strength; in pm8xxx_pin_config_get()
297 if (pin->open_drain) in pm8xxx_pin_config_get()
302 if (!pin->open_drain) in pm8xxx_pin_config_get()
321 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_pin_config_set() local
334 pin->bias = PM8XXX_GPIO_BIAS_NP; in pm8xxx_pin_config_set()
336 pin->disable = 0; in pm8xxx_pin_config_set()
340 pin->bias = PM8XXX_GPIO_BIAS_PD; in pm8xxx_pin_config_set()
342 pin->disable = 0; in pm8xxx_pin_config_set()
350 pin->pull_up_strength = arg; in pm8xxx_pin_config_set()
353 pin->bias = pin->pull_up_strength; in pm8xxx_pin_config_set()
355 pin->disable = 0; in pm8xxx_pin_config_set()
359 pin->disable = 1; in pm8xxx_pin_config_set()
363 pin->mode = PM8XXX_GPIO_MODE_INPUT; in pm8xxx_pin_config_set()
367 pin->mode = PM8XXX_GPIO_MODE_OUTPUT; in pm8xxx_pin_config_set()
368 pin->output_value = !!arg; in pm8xxx_pin_config_set()
372 pin->power_source = arg; in pm8xxx_pin_config_set()
380 pin->output_strength = arg; in pm8xxx_pin_config_set()
384 pin->open_drain = 0; in pm8xxx_pin_config_set()
388 pin->open_drain = 1; in pm8xxx_pin_config_set()
400 val = pin->power_source << 1; in pm8xxx_pin_config_set()
402 pm8xxx_write_bank(pctrl, pin, 0, val); in pm8xxx_pin_config_set()
406 val = pin->mode << 2; in pm8xxx_pin_config_set()
407 val |= pin->open_drain << 1; in pm8xxx_pin_config_set()
408 val |= pin->output_value; in pm8xxx_pin_config_set()
409 pm8xxx_write_bank(pctrl, pin, 1, val); in pm8xxx_pin_config_set()
413 val = pin->bias << 1; in pm8xxx_pin_config_set()
414 pm8xxx_write_bank(pctrl, pin, 2, val); in pm8xxx_pin_config_set()
418 val = pin->output_strength << 2; in pm8xxx_pin_config_set()
419 val |= pin->disable; in pm8xxx_pin_config_set()
420 pm8xxx_write_bank(pctrl, pin, 3, val); in pm8xxx_pin_config_set()
424 val = pin->function << 1; in pm8xxx_pin_config_set()
425 pm8xxx_write_bank(pctrl, pin, 4, val); in pm8xxx_pin_config_set()
430 if (!pin->inverted) in pm8xxx_pin_config_set()
432 pm8xxx_write_bank(pctrl, pin, 5, val); in pm8xxx_pin_config_set()
456 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_direction_input() local
459 pin->mode = PM8XXX_GPIO_MODE_INPUT; in pm8xxx_gpio_direction_input()
460 val = pin->mode << 2; in pm8xxx_gpio_direction_input()
462 pm8xxx_write_bank(pctrl, pin, 1, val); in pm8xxx_gpio_direction_input()
472 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_direction_output() local
475 pin->mode = PM8XXX_GPIO_MODE_OUTPUT; in pm8xxx_gpio_direction_output()
476 pin->output_value = !!value; in pm8xxx_gpio_direction_output()
478 val = pin->mode << 2; in pm8xxx_gpio_direction_output()
479 val |= pin->open_drain << 1; in pm8xxx_gpio_direction_output()
480 val |= pin->output_value; in pm8xxx_gpio_direction_output()
482 pm8xxx_write_bank(pctrl, pin, 1, val); in pm8xxx_gpio_direction_output()
490 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_get() local
494 if (pin->mode == PM8XXX_GPIO_MODE_OUTPUT) in pm8xxx_gpio_get()
495 return pin->output_value; in pm8xxx_gpio_get()
512 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_set() local
515 pin->output_value = !!value; in pm8xxx_gpio_set()
517 val = pin->mode << 2; in pm8xxx_gpio_set()
518 val |= pin->open_drain << 1; in pm8xxx_gpio_set()
519 val |= pin->output_value; in pm8xxx_gpio_set()
521 pm8xxx_write_bank(pctrl, pin, 1, val); in pm8xxx_gpio_set()
547 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_dbg_show_one() local
564 if (pin->disable) { in pm8xxx_gpio_dbg_show_one()
567 seq_printf(s, " %-4s", modes[pin->mode]); in pm8xxx_gpio_dbg_show_one()
568 seq_printf(s, " %-7s", pm8xxx_gpio_functions[pin->function]); in pm8xxx_gpio_dbg_show_one()
569 seq_printf(s, " VIN%d", pin->power_source); in pm8xxx_gpio_dbg_show_one()
570 seq_printf(s, " %-27s", biases[pin->bias]); in pm8xxx_gpio_dbg_show_one()
571 seq_printf(s, " %-10s", buffer_types[pin->open_drain]); in pm8xxx_gpio_dbg_show_one()
572 seq_printf(s, " %-4s", pin->output_value ? "high" : "low"); in pm8xxx_gpio_dbg_show_one()
573 seq_printf(s, " %-7s", strengths[pin->output_strength]); in pm8xxx_gpio_dbg_show_one()
574 if (pin->inverted) in pm8xxx_gpio_dbg_show_one()
605 struct pm8xxx_pin_data *pin) in pm8xxx_pin_populate() argument
609 val = pm8xxx_read_bank(pctrl, pin, 0); in pm8xxx_pin_populate()
613 pin->power_source = (val >> 1) & 0x7; in pm8xxx_pin_populate()
615 val = pm8xxx_read_bank(pctrl, pin, 1); in pm8xxx_pin_populate()
619 pin->mode = (val >> 2) & 0x3; in pm8xxx_pin_populate()
620 pin->open_drain = !!(val & BIT(1)); in pm8xxx_pin_populate()
621 pin->output_value = val & BIT(0); in pm8xxx_pin_populate()
623 val = pm8xxx_read_bank(pctrl, pin, 2); in pm8xxx_pin_populate()
627 pin->bias = (val >> 1) & 0x7; in pm8xxx_pin_populate()
628 if (pin->bias <= PM8XXX_GPIO_BIAS_PU_1P5_30) in pm8xxx_pin_populate()
629 pin->pull_up_strength = pin->bias; in pm8xxx_pin_populate()
631 pin->pull_up_strength = PM8XXX_GPIO_BIAS_PU_30; in pm8xxx_pin_populate()
633 val = pm8xxx_read_bank(pctrl, pin, 3); in pm8xxx_pin_populate()
637 pin->output_strength = (val >> 2) & 0x3; in pm8xxx_pin_populate()
638 pin->disable = val & BIT(0); in pm8xxx_pin_populate()
640 val = pm8xxx_read_bank(pctrl, pin, 4); in pm8xxx_pin_populate()
644 pin->function = (val >> 1) & 0x7; in pm8xxx_pin_populate()
646 val = pm8xxx_read_bank(pctrl, pin, 5); in pm8xxx_pin_populate()
650 pin->inverted = !(val & BIT(3)); in pm8xxx_pin_populate()