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()
628 struct pmic_mpp_pad *pad; in pmic_mpp_to_irq() local
630 pad = state->ctrl->desc->pins[pin].drv_data; in pmic_mpp_to_irq()
632 return pad->irq; in pmic_mpp_to_irq()
659 struct pmic_mpp_pad *pad) in pmic_mpp_populate() argument
664 type = pmic_mpp_read(state, pad, PMIC_MPP_REG_TYPE); in pmic_mpp_populate()
670 type, pad->base); in pmic_mpp_populate()
674 subtype = pmic_mpp_read(state, pad, PMIC_MPP_REG_SUBTYPE); in pmic_mpp_populate()
684 pad->num_sources = 4; in pmic_mpp_populate()
687 pad->num_sources = 8; in pmic_mpp_populate()
691 subtype, pad->base); in pmic_mpp_populate()
695 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_MODE_CTL); in pmic_mpp_populate()
699 pad->out_value = val & PMIC_MPP_REG_MODE_VALUE_MASK; in pmic_mpp_populate()
706 pad->input_enabled = true; in pmic_mpp_populate()
707 pad->output_enabled = false; in pmic_mpp_populate()
708 pad->function = PMIC_MPP_DIGITAL; in pmic_mpp_populate()
711 pad->input_enabled = false; in pmic_mpp_populate()
712 pad->output_enabled = true; in pmic_mpp_populate()
713 pad->function = PMIC_MPP_DIGITAL; in pmic_mpp_populate()
716 pad->input_enabled = true; in pmic_mpp_populate()
717 pad->output_enabled = true; in pmic_mpp_populate()
718 pad->function = PMIC_MPP_DIGITAL; in pmic_mpp_populate()
721 pad->input_enabled = true; 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 = true; in pmic_mpp_populate()
727 pad->output_enabled = false; in pmic_mpp_populate()
728 pad->function = PMIC_MPP_ANALOG; in pmic_mpp_populate()
731 pad->input_enabled = false; in pmic_mpp_populate()
732 pad->output_enabled = true; in pmic_mpp_populate()
733 pad->function = PMIC_MPP_ANALOG; in pmic_mpp_populate()
736 pad->input_enabled = false; in pmic_mpp_populate()
737 pad->output_enabled = true; in pmic_mpp_populate()
738 pad->function = PMIC_MPP_SINK; in pmic_mpp_populate()
749 pad->dtest = sel + 1; in pmic_mpp_populate()
751 pad->paired = true; in pmic_mpp_populate()
753 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_DIG_VIN_CTL); in pmic_mpp_populate()
757 pad->power_source = val >> PMIC_MPP_REG_VIN_SHIFT; in pmic_mpp_populate()
758 pad->power_source &= PMIC_MPP_REG_VIN_MASK; in pmic_mpp_populate()
762 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_DIG_PULL_CTL); in pmic_mpp_populate()
766 pad->pullup = val >> PMIC_MPP_REG_PULL_SHIFT; in pmic_mpp_populate()
767 pad->pullup &= PMIC_MPP_REG_PULL_MASK; in pmic_mpp_populate()
768 pad->has_pullup = true; in pmic_mpp_populate()
771 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_AIN_CTL); in pmic_mpp_populate()
775 pad->amux_input = val >> PMIC_MPP_REG_AIN_ROUTE_SHIFT; in pmic_mpp_populate()
776 pad->amux_input &= PMIC_MPP_REG_AIN_ROUTE_MASK; in pmic_mpp_populate()
778 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_SINK_CTL); in pmic_mpp_populate()
782 pad->drive_strength = val; in pmic_mpp_populate()
784 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_AOUT_CTL); in pmic_mpp_populate()
788 pad->aout_level = val; in pmic_mpp_populate()
790 val = pmic_mpp_read(state, pad, PMIC_MPP_REG_EN_CTL); in pmic_mpp_populate()
794 pad->is_enabled = !!val; in pmic_mpp_populate()
804 struct pmic_mpp_pad *pad, *pads; in pmic_mpp_probe() local
859 pad = &pads[i]; in pmic_mpp_probe()
860 pindesc->drv_data = pad; in pmic_mpp_probe()
864 pad->irq = platform_get_irq(pdev, i); in pmic_mpp_probe()
865 if (pad->irq < 0) in pmic_mpp_probe()
866 return pad->irq; in pmic_mpp_probe()
868 pad->base = reg + i * PMIC_MPP_ADDRESS_RANGE; in pmic_mpp_probe()
870 ret = pmic_mpp_populate(state, pad); in pmic_mpp_probe()