Lines Matching full:pad
177 struct pmic_mpp_pad *pad, unsigned int addr) in pmic_mpp_read() argument
182 ret = regmap_read(state->map, pad->base + addr, &val); in pmic_mpp_read()
192 struct pmic_mpp_pad *pad, unsigned int addr, in pmic_mpp_write() argument
197 ret = regmap_write(state->map, pad->base + addr, val); in pmic_mpp_write()
255 struct pmic_mpp_pad *pad) in pmic_mpp_write_mode_ctl() argument
262 switch (pad->function) { in pmic_mpp_write_mode_ctl()
264 if (pad->input_enabled && pad->output_enabled) in pmic_mpp_write_mode_ctl()
266 else if (pad->input_enabled) in pmic_mpp_write_mode_ctl()
272 if (pad->input_enabled && pad->output_enabled) in pmic_mpp_write_mode_ctl()
274 else if (pad->input_enabled) in pmic_mpp_write_mode_ctl()
285 if (pad->dtest) in pmic_mpp_write_mode_ctl()
286 sel = PMIC_MPP_SELECTOR_DTEST_FIRST + pad->dtest - 1; in pmic_mpp_write_mode_ctl()
287 else if (pad->paired) in pmic_mpp_write_mode_ctl()
292 en = !!pad->out_value; in pmic_mpp_write_mode_ctl()
298 return pmic_mpp_write(state, pad, PMIC_MPP_REG_MODE_CTL, val); in pmic_mpp_write_mode_ctl()
305 struct pmic_mpp_pad *pad; in pmic_mpp_set_mux() local
309 pad = pctldev->desc->pins[pin].drv_data; in pmic_mpp_set_mux()
311 pad->function = function; in pmic_mpp_set_mux()
313 ret = pmic_mpp_write_mode_ctl(state, pad); in pmic_mpp_set_mux()
317 val = pad->is_enabled << PMIC_MPP_REG_MASTER_EN_SHIFT; in pmic_mpp_set_mux()
319 return pmic_mpp_write(state, pad, PMIC_MPP_REG_EN_CTL, val); in pmic_mpp_set_mux()
333 struct pmic_mpp_pad *pad; in pmic_mpp_config_get() local
336 pad = pctldev->desc->pins[pin].drv_data; in pmic_mpp_config_get()
340 if (pad->pullup != PMIC_MPP_PULL_UP_OPEN) in pmic_mpp_config_get()
345 switch (pad->pullup) { in pmic_mpp_config_get()
360 if (pad->is_enabled) in pmic_mpp_config_get()
365 arg = pad->power_source; in pmic_mpp_config_get()
368 if (!pad->input_enabled) in pmic_mpp_config_get()
373 arg = pad->out_value; in pmic_mpp_config_get()
376 arg = pad->dtest; in pmic_mpp_config_get()
379 arg = pad->amux_input; in pmic_mpp_config_get()
382 if (!pad->paired) in pmic_mpp_config_get()
387 arg = pad->drive_strength; in pmic_mpp_config_get()
390 arg = pad->aout_level; in pmic_mpp_config_get()
405 struct pmic_mpp_pad *pad; in pmic_mpp_config_set() local
410 pad = pctldev->desc->pins[pin].drv_data; in pmic_mpp_config_set()
413 pad->is_enabled = true; in pmic_mpp_config_set()
421 pad->pullup = PMIC_MPP_PULL_UP_OPEN; in pmic_mpp_config_set()
426 pad->pullup = PMIC_MPP_PULL_UP_0P6KOHM; in pmic_mpp_config_set()
429 pad->pullup = PMIC_MPP_PULL_UP_10KOHM; in pmic_mpp_config_set()
432 pad->pullup = PMIC_MPP_PULL_UP_30KOHM; in pmic_mpp_config_set()
439 pad->is_enabled = false; in pmic_mpp_config_set()
442 if (arg >= pad->num_sources) in pmic_mpp_config_set()
444 pad->power_source = arg; in pmic_mpp_config_set()
447 pad->input_enabled = arg ? true : false; in pmic_mpp_config_set()
450 pad->output_enabled = true; in pmic_mpp_config_set()
451 pad->out_value = arg; in pmic_mpp_config_set()
454 pad->dtest = arg; in pmic_mpp_config_set()
457 pad->drive_strength = arg; in pmic_mpp_config_set()
462 pad->amux_input = arg; in pmic_mpp_config_set()
465 pad->aout_level = arg; in pmic_mpp_config_set()
468 pad->paired = !!arg; in pmic_mpp_config_set()
475 val = pad->power_source << PMIC_MPP_REG_VIN_SHIFT; in pmic_mpp_config_set()
477 ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_DIG_VIN_CTL, val); in pmic_mpp_config_set()
481 if (pad->has_pullup) { in pmic_mpp_config_set()
482 val = pad->pullup << PMIC_MPP_REG_PULL_SHIFT; in pmic_mpp_config_set()
484 ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_DIG_PULL_CTL, in pmic_mpp_config_set()
490 val = pad->amux_input & PMIC_MPP_REG_AIN_ROUTE_MASK; in pmic_mpp_config_set()
492 ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_AIN_CTL, val); in pmic_mpp_config_set()
496 ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_AOUT_CTL, pad->aout_level); in pmic_mpp_config_set()
500 ret = pmic_mpp_write_mode_ctl(state, pad); in pmic_mpp_config_set()
504 ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_SINK_CTL, pad->drive_strength); in pmic_mpp_config_set()
508 val = pad->is_enabled << PMIC_MPP_REG_MASTER_EN_SHIFT; in pmic_mpp_config_set()
510 return pmic_mpp_write(state, pad, PMIC_MPP_REG_EN_CTL, val); in pmic_mpp_config_set()
517 struct pmic_mpp_pad *pad; in pmic_mpp_config_dbg_show() local
524 pad = pctldev->desc->pins[pin].drv_data; in pmic_mpp_config_dbg_show()
528 if (!pad->is_enabled) { in pmic_mpp_config_dbg_show()
532 if (pad->input_enabled) { in pmic_mpp_config_dbg_show()
533 ret = pmic_mpp_read(state, pad, PMIC_MPP_REG_RT_STS); in pmic_mpp_config_dbg_show()
538 pad->out_value = ret; in pmic_mpp_config_dbg_show()
541 seq_printf(s, " %-4s", pad->output_enabled ? "out" : "in"); in pmic_mpp_config_dbg_show()
542 seq_printf(s, " %-7s", pmic_mpp_functions[pad->function]); in pmic_mpp_config_dbg_show()
543 seq_printf(s, " vin-%d", pad->power_source); in pmic_mpp_config_dbg_show()
544 seq_printf(s, " %d", pad->aout_level); in pmic_mpp_config_dbg_show()
545 if (pad->has_pullup) in pmic_mpp_config_dbg_show()
546 seq_printf(s, " %-8s", biases[pad->pullup]); in pmic_mpp_config_dbg_show()
547 seq_printf(s, " %-4s", pad->out_value ? "high" : "low"); in pmic_mpp_config_dbg_show()
548 if (pad->dtest) in pmic_mpp_config_dbg_show()
549 seq_printf(s, " dtest%d", pad->dtest); in pmic_mpp_config_dbg_show()
550 if (pad->paired) in pmic_mpp_config_dbg_show()
586 struct pmic_mpp_pad *pad; in pmic_mpp_get() local
589 pad = state->ctrl->desc->pins[pin].drv_data; in pmic_mpp_get()
591 if (pad->input_enabled) { in pmic_mpp_get()
592 ret = pmic_mpp_read(state, pad, PMIC_MPP_REG_RT_STS); in pmic_mpp_get()
596 pad->out_value = ret & PMIC_MPP_REG_RT_STS_VAL_MASK; in pmic_mpp_get()
599 return !!pad->out_value; in pmic_mpp_get()
648 struct pmic_mpp_pad *pad) in pmic_mpp_populate() argument
653 type = pmic_mpp_read(state, pad, PMIC_MPP_REG_TYPE); in pmic_mpp_populate()
659 type, pad->base); in pmic_mpp_populate()
663 subtype = pmic_mpp_read(state, pad, PMIC_MPP_REG_SUBTYPE); in pmic_mpp_populate()
673 pad->num_sources = 4; in pmic_mpp_populate()
676 pad->num_sources = 8; in pmic_mpp_populate()
680 subtype, pad->base); in pmic_mpp_populate()
684 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_MODE_CTL); in pmic_mpp_populate()
688 pad->out_value = val & PMIC_MPP_REG_MODE_VALUE_MASK; in pmic_mpp_populate()
695 pad->input_enabled = true; in pmic_mpp_populate()
696 pad->output_enabled = false; in pmic_mpp_populate()
697 pad->function = PMIC_MPP_DIGITAL; in pmic_mpp_populate()
700 pad->input_enabled = false; in pmic_mpp_populate()
701 pad->output_enabled = true; in pmic_mpp_populate()
702 pad->function = PMIC_MPP_DIGITAL; in pmic_mpp_populate()
705 pad->input_enabled = true; in pmic_mpp_populate()
706 pad->output_enabled = true; in pmic_mpp_populate()
707 pad->function = PMIC_MPP_DIGITAL; in pmic_mpp_populate()
710 pad->input_enabled = true; in pmic_mpp_populate()
711 pad->output_enabled = true; in pmic_mpp_populate()
712 pad->function = PMIC_MPP_ANALOG; in pmic_mpp_populate()
715 pad->input_enabled = true; in pmic_mpp_populate()
716 pad->output_enabled = false; in pmic_mpp_populate()
717 pad->function = PMIC_MPP_ANALOG; in pmic_mpp_populate()
720 pad->input_enabled = false; in pmic_mpp_populate()
721 pad->output_enabled = true; in pmic_mpp_populate()
722 pad->function = PMIC_MPP_ANALOG; in pmic_mpp_populate()
725 pad->input_enabled = false; in pmic_mpp_populate()
726 pad->output_enabled = true; in pmic_mpp_populate()
727 pad->function = PMIC_MPP_SINK; in pmic_mpp_populate()
738 pad->dtest = sel + 1; in pmic_mpp_populate()
740 pad->paired = true; in pmic_mpp_populate()
742 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_DIG_VIN_CTL); in pmic_mpp_populate()
746 pad->power_source = val >> PMIC_MPP_REG_VIN_SHIFT; in pmic_mpp_populate()
747 pad->power_source &= PMIC_MPP_REG_VIN_MASK; in pmic_mpp_populate()
751 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_DIG_PULL_CTL); in pmic_mpp_populate()
755 pad->pullup = val >> PMIC_MPP_REG_PULL_SHIFT; in pmic_mpp_populate()
756 pad->pullup &= PMIC_MPP_REG_PULL_MASK; in pmic_mpp_populate()
757 pad->has_pullup = true; in pmic_mpp_populate()
760 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_AIN_CTL); in pmic_mpp_populate()
764 pad->amux_input = val >> PMIC_MPP_REG_AIN_ROUTE_SHIFT; in pmic_mpp_populate()
765 pad->amux_input &= PMIC_MPP_REG_AIN_ROUTE_MASK; in pmic_mpp_populate()
767 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_SINK_CTL); in pmic_mpp_populate()
771 pad->drive_strength = val; in pmic_mpp_populate()
773 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_AOUT_CTL); in pmic_mpp_populate()
777 pad->aout_level = val; in pmic_mpp_populate()
779 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_EN_CTL); in pmic_mpp_populate()
783 pad->is_enabled = !!val; in pmic_mpp_populate()
859 struct pmic_mpp_pad *pad, *pads; in pmic_mpp_probe() local
911 pad = &pads[i]; in pmic_mpp_probe()
912 pindesc->drv_data = pad; in pmic_mpp_probe()
916 pad->base = reg + i * PMIC_MPP_ADDRESS_RANGE; in pmic_mpp_probe()
918 ret = pmic_mpp_populate(state, pad); in pmic_mpp_probe()