Lines Matching refs:pad

178 			 struct pmic_mpp_pad *pad, unsigned int addr)  in pmic_mpp_read()  argument
183 ret = regmap_read(state->map, pad->base + addr, &val); in pmic_mpp_read()
193 struct pmic_mpp_pad *pad, unsigned int addr, in pmic_mpp_write() argument
198 ret = regmap_write(state->map, pad->base + addr, val); in pmic_mpp_write()
256 struct pmic_mpp_pad *pad) in pmic_mpp_write_mode_ctl() argument
263 switch (pad->function) { in pmic_mpp_write_mode_ctl()
265 if (pad->input_enabled && pad->output_enabled) in pmic_mpp_write_mode_ctl()
267 else if (pad->input_enabled) in pmic_mpp_write_mode_ctl()
273 if (pad->input_enabled && pad->output_enabled) in pmic_mpp_write_mode_ctl()
275 else if (pad->input_enabled) in pmic_mpp_write_mode_ctl()
286 if (pad->dtest) in pmic_mpp_write_mode_ctl()
287 sel = PMIC_MPP_SELECTOR_DTEST_FIRST + pad->dtest - 1; in pmic_mpp_write_mode_ctl()
288 else if (pad->paired) in pmic_mpp_write_mode_ctl()
293 en = !!pad->out_value; in pmic_mpp_write_mode_ctl()
299 return pmic_mpp_write(state, pad, PMIC_MPP_REG_MODE_CTL, val); in pmic_mpp_write_mode_ctl()
306 struct pmic_mpp_pad *pad; in pmic_mpp_set_mux() local
310 pad = pctldev->desc->pins[pin].drv_data; in pmic_mpp_set_mux()
312 pad->function = function; in pmic_mpp_set_mux()
314 ret = pmic_mpp_write_mode_ctl(state, pad); in pmic_mpp_set_mux()
318 val = pad->is_enabled << PMIC_MPP_REG_MASTER_EN_SHIFT; in pmic_mpp_set_mux()
320 return pmic_mpp_write(state, pad, PMIC_MPP_REG_EN_CTL, val); in pmic_mpp_set_mux()
334 struct pmic_mpp_pad *pad; in pmic_mpp_config_get() local
337 pad = pctldev->desc->pins[pin].drv_data; in pmic_mpp_config_get()
341 if (pad->pullup != PMIC_MPP_PULL_UP_OPEN) in pmic_mpp_config_get()
346 switch (pad->pullup) { in pmic_mpp_config_get()
361 if (pad->is_enabled) in pmic_mpp_config_get()
366 arg = pad->power_source; in pmic_mpp_config_get()
369 if (!pad->input_enabled) in pmic_mpp_config_get()
374 arg = pad->out_value; in pmic_mpp_config_get()
377 arg = pad->dtest; in pmic_mpp_config_get()
380 arg = pad->amux_input; in pmic_mpp_config_get()
383 if (!pad->paired) in pmic_mpp_config_get()
388 arg = pad->drive_strength; in pmic_mpp_config_get()
391 arg = pad->aout_level; in pmic_mpp_config_get()
406 struct pmic_mpp_pad *pad; in pmic_mpp_config_set() local
411 pad = pctldev->desc->pins[pin].drv_data; in pmic_mpp_config_set()
414 pad->is_enabled = true; in pmic_mpp_config_set()
422 pad->pullup = PMIC_MPP_PULL_UP_OPEN; in pmic_mpp_config_set()
427 pad->pullup = PMIC_MPP_PULL_UP_0P6KOHM; in pmic_mpp_config_set()
430 pad->pullup = PMIC_MPP_PULL_UP_10KOHM; in pmic_mpp_config_set()
433 pad->pullup = PMIC_MPP_PULL_UP_30KOHM; in pmic_mpp_config_set()
440 pad->is_enabled = false; in pmic_mpp_config_set()
443 if (arg >= pad->num_sources) in pmic_mpp_config_set()
445 pad->power_source = arg; in pmic_mpp_config_set()
448 pad->input_enabled = arg ? true : false; in pmic_mpp_config_set()
451 pad->output_enabled = true; in pmic_mpp_config_set()
452 pad->out_value = arg; in pmic_mpp_config_set()
455 pad->dtest = arg; in pmic_mpp_config_set()
458 pad->drive_strength = arg; in pmic_mpp_config_set()
463 pad->amux_input = arg; in pmic_mpp_config_set()
466 pad->aout_level = arg; in pmic_mpp_config_set()
469 pad->paired = !!arg; in pmic_mpp_config_set()
476 val = pad->power_source << PMIC_MPP_REG_VIN_SHIFT; in pmic_mpp_config_set()
478 ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_DIG_VIN_CTL, val); in pmic_mpp_config_set()
482 if (pad->has_pullup) { in pmic_mpp_config_set()
483 val = pad->pullup << PMIC_MPP_REG_PULL_SHIFT; in pmic_mpp_config_set()
485 ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_DIG_PULL_CTL, in pmic_mpp_config_set()
491 val = pad->amux_input & PMIC_MPP_REG_AIN_ROUTE_MASK; in pmic_mpp_config_set()
493 ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_AIN_CTL, val); in pmic_mpp_config_set()
497 ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_AOUT_CTL, pad->aout_level); in pmic_mpp_config_set()
501 ret = pmic_mpp_write_mode_ctl(state, pad); in pmic_mpp_config_set()
505 ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_SINK_CTL, pad->drive_strength); in pmic_mpp_config_set()
509 val = pad->is_enabled << PMIC_MPP_REG_MASTER_EN_SHIFT; in pmic_mpp_config_set()
511 return pmic_mpp_write(state, pad, PMIC_MPP_REG_EN_CTL, val); in pmic_mpp_config_set()
518 struct pmic_mpp_pad *pad; in pmic_mpp_config_dbg_show() local
525 pad = pctldev->desc->pins[pin].drv_data; in pmic_mpp_config_dbg_show()
529 if (!pad->is_enabled) { in pmic_mpp_config_dbg_show()
533 if (pad->input_enabled) { in pmic_mpp_config_dbg_show()
534 ret = pmic_mpp_read(state, pad, PMIC_MPP_REG_RT_STS); in pmic_mpp_config_dbg_show()
539 pad->out_value = ret; in pmic_mpp_config_dbg_show()
542 seq_printf(s, " %-4s", pad->output_enabled ? "out" : "in"); in pmic_mpp_config_dbg_show()
543 seq_printf(s, " %-7s", pmic_mpp_functions[pad->function]); in pmic_mpp_config_dbg_show()
544 seq_printf(s, " vin-%d", pad->power_source); in pmic_mpp_config_dbg_show()
545 seq_printf(s, " %d", pad->aout_level); in pmic_mpp_config_dbg_show()
546 if (pad->has_pullup) in pmic_mpp_config_dbg_show()
547 seq_printf(s, " %-8s", biases[pad->pullup]); in pmic_mpp_config_dbg_show()
548 seq_printf(s, " %-4s", pad->out_value ? "high" : "low"); in pmic_mpp_config_dbg_show()
549 if (pad->dtest) in pmic_mpp_config_dbg_show()
550 seq_printf(s, " dtest%d", pad->dtest); in pmic_mpp_config_dbg_show()
551 if (pad->paired) in pmic_mpp_config_dbg_show()
587 struct pmic_mpp_pad *pad; in pmic_mpp_get() local
590 pad = state->ctrl->desc->pins[pin].drv_data; in pmic_mpp_get()
592 if (pad->input_enabled) { in pmic_mpp_get()
593 ret = pmic_mpp_read(state, pad, PMIC_MPP_REG_RT_STS); in pmic_mpp_get()
597 pad->out_value = ret & PMIC_MPP_REG_RT_STS_VAL_MASK; in pmic_mpp_get()
600 return !!pad->out_value; in pmic_mpp_get()
649 struct pmic_mpp_pad *pad) in pmic_mpp_populate() argument
654 type = pmic_mpp_read(state, pad, PMIC_MPP_REG_TYPE); in pmic_mpp_populate()
660 type, pad->base); in pmic_mpp_populate()
664 subtype = pmic_mpp_read(state, pad, PMIC_MPP_REG_SUBTYPE); in pmic_mpp_populate()
674 pad->num_sources = 4; in pmic_mpp_populate()
677 pad->num_sources = 8; in pmic_mpp_populate()
681 subtype, pad->base); in pmic_mpp_populate()
685 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_MODE_CTL); in pmic_mpp_populate()
689 pad->out_value = val & PMIC_MPP_REG_MODE_VALUE_MASK; in pmic_mpp_populate()
696 pad->input_enabled = true; in pmic_mpp_populate()
697 pad->output_enabled = false; in pmic_mpp_populate()
698 pad->function = PMIC_MPP_DIGITAL; in pmic_mpp_populate()
701 pad->input_enabled = false; in pmic_mpp_populate()
702 pad->output_enabled = true; in pmic_mpp_populate()
703 pad->function = PMIC_MPP_DIGITAL; in pmic_mpp_populate()
706 pad->input_enabled = true; in pmic_mpp_populate()
707 pad->output_enabled = true; in pmic_mpp_populate()
708 pad->function = PMIC_MPP_DIGITAL; in pmic_mpp_populate()
711 pad->input_enabled = true; in pmic_mpp_populate()
712 pad->output_enabled = true; in pmic_mpp_populate()
713 pad->function = PMIC_MPP_ANALOG; in pmic_mpp_populate()
716 pad->input_enabled = true; in pmic_mpp_populate()
717 pad->output_enabled = false; in pmic_mpp_populate()
718 pad->function = PMIC_MPP_ANALOG; in pmic_mpp_populate()
721 pad->input_enabled = false; in pmic_mpp_populate()
722 pad->output_enabled = true; in pmic_mpp_populate()
723 pad->function = PMIC_MPP_ANALOG; in pmic_mpp_populate()
726 pad->input_enabled = false; in pmic_mpp_populate()
727 pad->output_enabled = true; in pmic_mpp_populate()
728 pad->function = PMIC_MPP_SINK; in pmic_mpp_populate()
739 pad->dtest = sel + 1; in pmic_mpp_populate()
741 pad->paired = true; in pmic_mpp_populate()
743 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_DIG_VIN_CTL); in pmic_mpp_populate()
747 pad->power_source = val >> PMIC_MPP_REG_VIN_SHIFT; in pmic_mpp_populate()
748 pad->power_source &= PMIC_MPP_REG_VIN_MASK; in pmic_mpp_populate()
752 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_DIG_PULL_CTL); in pmic_mpp_populate()
756 pad->pullup = val >> PMIC_MPP_REG_PULL_SHIFT; in pmic_mpp_populate()
757 pad->pullup &= PMIC_MPP_REG_PULL_MASK; in pmic_mpp_populate()
758 pad->has_pullup = true; in pmic_mpp_populate()
761 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_AIN_CTL); in pmic_mpp_populate()
765 pad->amux_input = val >> PMIC_MPP_REG_AIN_ROUTE_SHIFT; in pmic_mpp_populate()
766 pad->amux_input &= PMIC_MPP_REG_AIN_ROUTE_MASK; in pmic_mpp_populate()
768 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_SINK_CTL); in pmic_mpp_populate()
772 pad->drive_strength = val; in pmic_mpp_populate()
774 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_AOUT_CTL); in pmic_mpp_populate()
778 pad->aout_level = val; in pmic_mpp_populate()
780 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_EN_CTL); in pmic_mpp_populate()
784 pad->is_enabled = !!val; in pmic_mpp_populate()
833 struct pmic_mpp_pad *pad, *pads; in pmic_mpp_probe() local
885 pad = &pads[i]; in pmic_mpp_probe()
886 pindesc->drv_data = pad; in pmic_mpp_probe()
890 pad->base = reg + i * PMIC_MPP_ADDRESS_RANGE; in pmic_mpp_probe()
892 ret = pmic_mpp_populate(state, pad); in pmic_mpp_probe()