Lines Matching full:pin

88  * struct pm8xxx_pin_data - dynamic configuration for a pin
90 * @mode: operating mode for the pin (digital, analog or current sink)
91 * @input: pin is input
92 * @output: pin is output
93 * @high_z: pin is floating
166 struct pm8xxx_pin_data *pin) in pm8xxx_mpp_update() argument
174 switch (pin->mode) { in pm8xxx_mpp_update()
176 if (pin->dtest) { in pm8xxx_mpp_update()
178 ctrl = pin->dtest - 1; in pm8xxx_mpp_update()
179 } else if (pin->input && pin->output) { in pm8xxx_mpp_update()
181 if (pin->high_z) in pm8xxx_mpp_update()
183 else if (pin->pullup == 600) in pm8xxx_mpp_update()
185 else if (pin->pullup == 10000) in pm8xxx_mpp_update()
189 } else if (pin->input) { in pm8xxx_mpp_update()
191 if (pin->dtest) in pm8xxx_mpp_update()
192 ctrl = pin->dtest; in pm8xxx_mpp_update()
197 ctrl = !!pin->output_value; in pm8xxx_mpp_update()
198 if (pin->paired) in pm8xxx_mpp_update()
202 level = pin->power_source; in pm8xxx_mpp_update()
205 if (pin->output) { in pm8xxx_mpp_update()
207 level = pin->aout_level; in pm8xxx_mpp_update()
208 ctrl = pin->output_value; in pm8xxx_mpp_update()
209 if (pin->paired) in pm8xxx_mpp_update()
213 level = pin->amux; in pm8xxx_mpp_update()
218 level = (pin->drive_strength / 5) - 1; in pm8xxx_mpp_update()
219 if (pin->dtest) { in pm8xxx_mpp_update()
221 ctrl = pin->dtest - 1; in pm8xxx_mpp_update()
224 ctrl = pin->output_value; in pm8xxx_mpp_update()
225 if (pin->paired) in pm8xxx_mpp_update()
234 ret = regmap_write(pctrl->regmap, pin->reg, val); in pm8xxx_mpp_update()
304 struct pm8xxx_pin_data *pin = pctrl->desc.pins[group].drv_data; in pm8xxx_pinmux_set_mux() local
306 pin->mode = function; in pm8xxx_pinmux_set_mux()
307 pm8xxx_mpp_update(pctrl, pin); in pm8xxx_pinmux_set_mux()
324 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_pin_config_get() local
330 arg = pin->pullup; in pm8xxx_pin_config_get()
333 arg = pin->high_z; in pm8xxx_pin_config_get()
336 arg = pin->input; in pm8xxx_pin_config_get()
339 arg = pin->output_value; in pm8xxx_pin_config_get()
342 arg = pin->power_source; in pm8xxx_pin_config_get()
345 arg = pin->drive_strength; in pm8xxx_pin_config_get()
348 arg = pin->dtest; in pm8xxx_pin_config_get()
351 arg = pin->amux; in pm8xxx_pin_config_get()
354 arg = pin->aout_level; in pm8xxx_pin_config_get()
357 arg = pin->paired; in pm8xxx_pin_config_get()
374 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_pin_config_set() local
385 pin->pullup = arg; in pm8xxx_pin_config_set()
388 pin->high_z = true; in pm8xxx_pin_config_set()
391 pin->input = true; in pm8xxx_pin_config_set()
394 pin->output = true; in pm8xxx_pin_config_set()
395 pin->output_value = !!arg; in pm8xxx_pin_config_set()
398 pin->power_source = arg; in pm8xxx_pin_config_set()
401 pin->drive_strength = arg; in pm8xxx_pin_config_set()
404 pin->dtest = arg; in pm8xxx_pin_config_set()
407 pin->amux = arg; in pm8xxx_pin_config_set()
410 pin->aout_level = arg; in pm8xxx_pin_config_set()
413 pin->paired = !!arg; in pm8xxx_pin_config_set()
423 pm8xxx_mpp_update(pctrl, pin); in pm8xxx_pin_config_set()
446 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_mpp_direction_input() local
448 switch (pin->mode) { in pm8xxx_mpp_direction_input()
450 pin->input = true; in pm8xxx_mpp_direction_input()
453 pin->input = true; in pm8xxx_mpp_direction_input()
454 pin->output = true; in pm8xxx_mpp_direction_input()
460 pm8xxx_mpp_update(pctrl, pin); in pm8xxx_mpp_direction_input()
470 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_mpp_direction_output() local
472 switch (pin->mode) { in pm8xxx_mpp_direction_output()
474 pin->output = true; in pm8xxx_mpp_direction_output()
477 pin->input = false; in pm8xxx_mpp_direction_output()
478 pin->output = true; in pm8xxx_mpp_direction_output()
481 pin->input = false; in pm8xxx_mpp_direction_output()
482 pin->output = true; in pm8xxx_mpp_direction_output()
486 pm8xxx_mpp_update(pctrl, pin); in pm8xxx_mpp_direction_output()
494 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_mpp_get() local
498 if (!pin->input) in pm8xxx_mpp_get()
499 return !!pin->output_value; in pm8xxx_mpp_get()
515 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_mpp_set() local
517 pin->output_value = !!value; in pm8xxx_mpp_set()
519 pm8xxx_mpp_update(pctrl, pin); in pm8xxx_mpp_set()
546 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_mpp_dbg_show_one() local
560 switch (pin->mode) { in pm8xxx_mpp_dbg_show_one()
563 if (pin->dtest) { in pm8xxx_mpp_dbg_show_one()
564 seq_printf(s, "dtest%d\n", pin->dtest); in pm8xxx_mpp_dbg_show_one()
565 } else if (pin->input && pin->output) { in pm8xxx_mpp_dbg_show_one()
566 if (pin->high_z) in pm8xxx_mpp_dbg_show_one()
569 seq_printf(s, "bi-dir %dOhm", pin->pullup); in pm8xxx_mpp_dbg_show_one()
570 } else if (pin->input) { in pm8xxx_mpp_dbg_show_one()
571 if (pin->dtest) in pm8xxx_mpp_dbg_show_one()
572 seq_printf(s, "in dtest%d", pin->dtest); in pm8xxx_mpp_dbg_show_one()
575 } else if (pin->output) { in pm8xxx_mpp_dbg_show_one()
578 if (!pin->paired) { in pm8xxx_mpp_dbg_show_one()
579 seq_puts(s, pin->output_value ? in pm8xxx_mpp_dbg_show_one()
582 seq_puts(s, pin->output_value ? in pm8xxx_mpp_dbg_show_one()
589 if (pin->output) { in pm8xxx_mpp_dbg_show_one()
590 seq_printf(s, "out %s ", aout_lvls[pin->aout_level]); in pm8xxx_mpp_dbg_show_one()
591 if (!pin->paired) { in pm8xxx_mpp_dbg_show_one()
592 seq_puts(s, pin->output_value ? in pm8xxx_mpp_dbg_show_one()
595 seq_puts(s, pin->output_value ? in pm8xxx_mpp_dbg_show_one()
599 seq_printf(s, "input mux %s", amuxs[pin->amux]); in pm8xxx_mpp_dbg_show_one()
603 seq_printf(s, " sink %dmA ", pin->drive_strength); in pm8xxx_mpp_dbg_show_one()
604 if (pin->dtest) { in pm8xxx_mpp_dbg_show_one()
605 seq_printf(s, "dtest%d", pin->dtest); in pm8xxx_mpp_dbg_show_one()
607 if (!pin->paired) { in pm8xxx_mpp_dbg_show_one()
608 seq_puts(s, pin->output_value ? in pm8xxx_mpp_dbg_show_one()
611 seq_puts(s, pin->output_value ? in pm8xxx_mpp_dbg_show_one()
645 struct pm8xxx_pin_data *pin) in pm8xxx_pin_populate() argument
653 ret = regmap_read(pctrl->regmap, pin->reg, &val); in pm8xxx_pin_populate()
665 pin->mode = PM8XXX_MPP_DIGITAL; in pm8xxx_pin_populate()
666 pin->input = true; in pm8xxx_pin_populate()
667 pin->power_source = level; in pm8xxx_pin_populate()
668 pin->dtest = ctrl; in pm8xxx_pin_populate()
671 pin->mode = PM8XXX_MPP_DIGITAL; in pm8xxx_pin_populate()
672 pin->output = true; in pm8xxx_pin_populate()
673 pin->power_source = level; in pm8xxx_pin_populate()
674 pin->output_value = !!(ctrl & BIT(0)); in pm8xxx_pin_populate()
675 pin->paired = !!(ctrl & BIT(1)); in pm8xxx_pin_populate()
678 pin->mode = PM8XXX_MPP_DIGITAL; in pm8xxx_pin_populate()
679 pin->input = true; in pm8xxx_pin_populate()
680 pin->output = true; in pm8xxx_pin_populate()
681 pin->power_source = level; in pm8xxx_pin_populate()
684 pin->pullup = 600; in pm8xxx_pin_populate()
687 pin->high_z = true; in pm8xxx_pin_populate()
690 pin->pullup = 10000; in pm8xxx_pin_populate()
693 pin->pullup = 30000; in pm8xxx_pin_populate()
698 pin->mode = PM8XXX_MPP_ANALOG; in pm8xxx_pin_populate()
699 pin->input = true; in pm8xxx_pin_populate()
700 pin->amux = level; in pm8xxx_pin_populate()
703 pin->mode = PM8XXX_MPP_ANALOG; in pm8xxx_pin_populate()
704 pin->output = true; in pm8xxx_pin_populate()
705 pin->aout_level = level; in pm8xxx_pin_populate()
706 pin->output_value = !!(ctrl & BIT(0)); in pm8xxx_pin_populate()
707 pin->paired = !!(ctrl & BIT(1)); in pm8xxx_pin_populate()
710 pin->mode = PM8XXX_MPP_SINK; in pm8xxx_pin_populate()
711 pin->drive_strength = 5 * (level + 1); in pm8xxx_pin_populate()
712 pin->output_value = !!(ctrl & BIT(0)); in pm8xxx_pin_populate()
713 pin->paired = !!(ctrl & BIT(1)); in pm8xxx_pin_populate()
716 pin->mode = PM8XXX_MPP_SINK; in pm8xxx_pin_populate()
717 pin->dtest = ctrl + 1; in pm8xxx_pin_populate()
718 pin->drive_strength = 5 * (level + 1); in pm8xxx_pin_populate()
721 pin->mode = PM8XXX_MPP_DIGITAL; in pm8xxx_pin_populate()
722 pin->power_source = level; in pm8xxx_pin_populate()
724 pin->dtest = ctrl; in pm8xxx_pin_populate()
903 dev_err(pctrl->dev, "failed to add pin range\n"); in pm8xxx_mpp_probe()