Lines Matching full:pin
57 * struct pm8xxx_pin_data - dynamic configuration for a pin
61 * @mode: operating mode for the pin (input/output)
68 * @disable: pin disabled / configured as tristate
70 * @inverted: pin logic is inverted
126 struct pm8xxx_pin_data *pin, int bank) in pm8xxx_read_bank() argument
131 ret = regmap_write(pctrl->regmap, pin->reg, val); in pm8xxx_read_bank()
137 ret = regmap_read(pctrl->regmap, pin->reg, &val); in pm8xxx_read_bank()
147 struct pm8xxx_pin_data *pin, in pm8xxx_write_bank() argument
156 ret = regmap_write(pctrl->regmap, pin->reg, val); in pm8xxx_write_bank()
226 struct pm8xxx_pin_data *pin = pctrl->desc.pins[group].drv_data; in pm8xxx_pinmux_set_mux() local
229 pin->function = function; in pm8xxx_pinmux_set_mux()
230 val = pin->function << 1; in pm8xxx_pinmux_set_mux()
232 pm8xxx_write_bank(pctrl, pin, 4, val); in pm8xxx_pinmux_set_mux()
249 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_pin_config_get() local
255 if (pin->bias != PM8XXX_GPIO_BIAS_NP) in pm8xxx_pin_config_get()
260 if (pin->bias != PM8XXX_GPIO_BIAS_PD) in pm8xxx_pin_config_get()
265 if (pin->bias > PM8XXX_GPIO_BIAS_PU_1P5_30) in pm8xxx_pin_config_get()
270 arg = pin->pull_up_strength; in pm8xxx_pin_config_get()
273 if (!pin->disable) in pm8xxx_pin_config_get()
278 if (pin->mode != PM8XXX_GPIO_MODE_INPUT) in pm8xxx_pin_config_get()
283 if (pin->mode & PM8XXX_GPIO_MODE_OUTPUT) in pm8xxx_pin_config_get()
284 arg = pin->output_value; in pm8xxx_pin_config_get()
289 arg = pin->power_source; in pm8xxx_pin_config_get()
292 arg = pin->output_strength; in pm8xxx_pin_config_get()
295 if (pin->open_drain) in pm8xxx_pin_config_get()
300 if (!pin->open_drain) in pm8xxx_pin_config_get()
319 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_pin_config_set() local
332 pin->bias = PM8XXX_GPIO_BIAS_NP; in pm8xxx_pin_config_set()
334 pin->disable = 0; in pm8xxx_pin_config_set()
338 pin->bias = PM8XXX_GPIO_BIAS_PD; in pm8xxx_pin_config_set()
340 pin->disable = 0; in pm8xxx_pin_config_set()
348 pin->pull_up_strength = arg; in pm8xxx_pin_config_set()
351 pin->bias = pin->pull_up_strength; in pm8xxx_pin_config_set()
353 pin->disable = 0; in pm8xxx_pin_config_set()
357 pin->disable = 1; in pm8xxx_pin_config_set()
361 pin->mode = PM8XXX_GPIO_MODE_INPUT; in pm8xxx_pin_config_set()
365 pin->mode = PM8XXX_GPIO_MODE_OUTPUT; in pm8xxx_pin_config_set()
366 pin->output_value = !!arg; in pm8xxx_pin_config_set()
370 pin->power_source = arg; in pm8xxx_pin_config_set()
378 pin->output_strength = arg; in pm8xxx_pin_config_set()
382 pin->open_drain = 0; in pm8xxx_pin_config_set()
386 pin->open_drain = 1; in pm8xxx_pin_config_set()
398 val = pin->power_source << 1; in pm8xxx_pin_config_set()
400 pm8xxx_write_bank(pctrl, pin, 0, val); in pm8xxx_pin_config_set()
404 val = pin->mode << 2; in pm8xxx_pin_config_set()
405 val |= pin->open_drain << 1; in pm8xxx_pin_config_set()
406 val |= pin->output_value; in pm8xxx_pin_config_set()
407 pm8xxx_write_bank(pctrl, pin, 1, val); in pm8xxx_pin_config_set()
411 val = pin->bias << 1; in pm8xxx_pin_config_set()
412 pm8xxx_write_bank(pctrl, pin, 2, val); in pm8xxx_pin_config_set()
416 val = pin->output_strength << 2; in pm8xxx_pin_config_set()
417 val |= pin->disable; in pm8xxx_pin_config_set()
418 pm8xxx_write_bank(pctrl, pin, 3, val); in pm8xxx_pin_config_set()
422 val = pin->function << 1; in pm8xxx_pin_config_set()
423 pm8xxx_write_bank(pctrl, pin, 4, val); in pm8xxx_pin_config_set()
428 if (!pin->inverted) in pm8xxx_pin_config_set()
430 pm8xxx_write_bank(pctrl, pin, 5, val); in pm8xxx_pin_config_set()
454 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_direction_input() local
457 pin->mode = PM8XXX_GPIO_MODE_INPUT; in pm8xxx_gpio_direction_input()
458 val = pin->mode << 2; in pm8xxx_gpio_direction_input()
460 pm8xxx_write_bank(pctrl, pin, 1, val); in pm8xxx_gpio_direction_input()
470 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_direction_output() local
473 pin->mode = PM8XXX_GPIO_MODE_OUTPUT; in pm8xxx_gpio_direction_output()
474 pin->output_value = !!value; in pm8xxx_gpio_direction_output()
476 val = pin->mode << 2; in pm8xxx_gpio_direction_output()
477 val |= pin->open_drain << 1; in pm8xxx_gpio_direction_output()
478 val |= pin->output_value; in pm8xxx_gpio_direction_output()
480 pm8xxx_write_bank(pctrl, pin, 1, val); in pm8xxx_gpio_direction_output()
488 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_get() local
492 if (pin->mode == PM8XXX_GPIO_MODE_OUTPUT) in pm8xxx_gpio_get()
493 return pin->output_value; in pm8xxx_gpio_get()
510 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_set() local
513 pin->output_value = !!value; in pm8xxx_gpio_set()
515 val = pin->mode << 2; in pm8xxx_gpio_set()
516 val |= pin->open_drain << 1; in pm8xxx_gpio_set()
517 val |= pin->output_value; in pm8xxx_gpio_set()
519 pm8xxx_write_bank(pctrl, pin, 1, val); in pm8xxx_gpio_set()
546 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_dbg_show_one() local
563 if (pin->disable) { in pm8xxx_gpio_dbg_show_one()
566 seq_printf(s, " %-4s", modes[pin->mode]); in pm8xxx_gpio_dbg_show_one()
567 seq_printf(s, " %-7s", pm8xxx_gpio_functions[pin->function]); in pm8xxx_gpio_dbg_show_one()
568 seq_printf(s, " VIN%d", pin->power_source); in pm8xxx_gpio_dbg_show_one()
569 seq_printf(s, " %-27s", biases[pin->bias]); in pm8xxx_gpio_dbg_show_one()
570 seq_printf(s, " %-10s", buffer_types[pin->open_drain]); in pm8xxx_gpio_dbg_show_one()
571 seq_printf(s, " %-4s", pin->output_value ? "high" : "low"); in pm8xxx_gpio_dbg_show_one()
572 seq_printf(s, " %-7s", strengths[pin->output_strength]); in pm8xxx_gpio_dbg_show_one()
573 if (pin->inverted) in pm8xxx_gpio_dbg_show_one()
604 struct pm8xxx_pin_data *pin) in pm8xxx_pin_populate() argument
608 val = pm8xxx_read_bank(pctrl, pin, 0); in pm8xxx_pin_populate()
612 pin->power_source = (val >> 1) & 0x7; in pm8xxx_pin_populate()
614 val = pm8xxx_read_bank(pctrl, pin, 1); in pm8xxx_pin_populate()
618 pin->mode = (val >> 2) & 0x3; in pm8xxx_pin_populate()
619 pin->open_drain = !!(val & BIT(1)); in pm8xxx_pin_populate()
620 pin->output_value = val & BIT(0); in pm8xxx_pin_populate()
622 val = pm8xxx_read_bank(pctrl, pin, 2); in pm8xxx_pin_populate()
626 pin->bias = (val >> 1) & 0x7; in pm8xxx_pin_populate()
627 if (pin->bias <= PM8XXX_GPIO_BIAS_PU_1P5_30) in pm8xxx_pin_populate()
628 pin->pull_up_strength = pin->bias; in pm8xxx_pin_populate()
630 pin->pull_up_strength = PM8XXX_GPIO_BIAS_PU_30; in pm8xxx_pin_populate()
632 val = pm8xxx_read_bank(pctrl, pin, 3); in pm8xxx_pin_populate()
636 pin->output_strength = (val >> 2) & 0x3; in pm8xxx_pin_populate()
637 pin->disable = val & BIT(0); in pm8xxx_pin_populate()
639 val = pm8xxx_read_bank(pctrl, pin, 4); in pm8xxx_pin_populate()
643 pin->function = (val >> 1) & 0x7; in pm8xxx_pin_populate()
645 val = pm8xxx_read_bank(pctrl, pin, 5); in pm8xxx_pin_populate()
649 pin->inverted = !(val & BIT(3)); in pm8xxx_pin_populate()
809 * If it is present, it takes care of adding the pin ranges in pm8xxx_gpio_probe()
820 dev_err(pctrl->dev, "failed to add pin range\n"); in pm8xxx_gpio_probe()