Lines Matching full:pad

216 			  struct pmic_gpio_pad *pad, unsigned int addr)  in pmic_gpio_read()  argument
221 ret = regmap_read(state->map, pad->base + addr, &val); in pmic_gpio_read()
231 struct pmic_gpio_pad *pad, unsigned int addr, in pmic_gpio_write() argument
236 ret = regmap_write(state->map, pad->base + addr, val); in pmic_gpio_write()
296 struct pmic_gpio_pad *pad; in pmic_gpio_set_mux() local
305 pad = pctldev->desc->pins[pin].drv_data; in pmic_gpio_set_mux()
310 if (!pad->lv_mv_type) { in pmic_gpio_set_mux()
321 pad->function = function; in pmic_gpio_set_mux()
323 if (pad->analog_pass) in pmic_gpio_set_mux()
325 else if (pad->output_enabled && pad->input_enabled) in pmic_gpio_set_mux()
327 else if (pad->output_enabled) in pmic_gpio_set_mux()
332 if (pad->lv_mv_type) { in pmic_gpio_set_mux()
333 ret = pmic_gpio_write(state, pad, in pmic_gpio_set_mux()
338 val = pad->atest - 1; in pmic_gpio_set_mux()
339 ret = pmic_gpio_write(state, pad, in pmic_gpio_set_mux()
344 val = pad->out_value in pmic_gpio_set_mux()
346 val |= pad->function in pmic_gpio_set_mux()
348 ret = pmic_gpio_write(state, pad, in pmic_gpio_set_mux()
354 val |= pad->function << PMIC_GPIO_REG_MODE_FUNCTION_SHIFT; in pmic_gpio_set_mux()
355 val |= pad->out_value & PMIC_GPIO_REG_MODE_VALUE_SHIFT; in pmic_gpio_set_mux()
357 ret = pmic_gpio_write(state, pad, PMIC_GPIO_REG_MODE_CTL, val); in pmic_gpio_set_mux()
362 val = pad->is_enabled << PMIC_GPIO_REG_MASTER_EN_SHIFT; in pmic_gpio_set_mux()
364 return pmic_gpio_write(state, pad, PMIC_GPIO_REG_EN_CTL, val); in pmic_gpio_set_mux()
378 struct pmic_gpio_pad *pad; in pmic_gpio_config_get() local
381 pad = pctldev->desc->pins[pin].drv_data; in pmic_gpio_config_get()
385 if (pad->buffer_type != PMIC_GPIO_OUT_BUF_CMOS) in pmic_gpio_config_get()
390 if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS) in pmic_gpio_config_get()
395 if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS) in pmic_gpio_config_get()
400 if (pad->pullup != PMIC_GPIO_PULL_DOWN) in pmic_gpio_config_get()
405 if (pad->pullup != PMIC_GPIO_PULL_DISABLE) in pmic_gpio_config_get()
410 if (pad->pullup != PMIC_GPIO_PULL_UP_30) in pmic_gpio_config_get()
415 if (pad->is_enabled) in pmic_gpio_config_get()
420 arg = pad->power_source; in pmic_gpio_config_get()
423 if (!pad->input_enabled) in pmic_gpio_config_get()
428 arg = pad->out_value; in pmic_gpio_config_get()
431 arg = pad->pullup; in pmic_gpio_config_get()
434 arg = pad->strength; in pmic_gpio_config_get()
437 arg = pad->atest; in pmic_gpio_config_get()
440 arg = pad->analog_pass; in pmic_gpio_config_get()
443 arg = pad->dtest_buffer; in pmic_gpio_config_get()
457 struct pmic_gpio_pad *pad; in pmic_gpio_config_set() local
462 pad = pctldev->desc->pins[pin].drv_data; in pmic_gpio_config_set()
464 pad->is_enabled = true; in pmic_gpio_config_set()
471 pad->buffer_type = PMIC_GPIO_OUT_BUF_CMOS; in pmic_gpio_config_set()
474 if (!pad->have_buffer) in pmic_gpio_config_set()
476 pad->buffer_type = PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS; in pmic_gpio_config_set()
479 if (!pad->have_buffer) in pmic_gpio_config_set()
481 pad->buffer_type = PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS; in pmic_gpio_config_set()
484 pad->pullup = PMIC_GPIO_PULL_DISABLE; in pmic_gpio_config_set()
487 pad->pullup = PMIC_GPIO_PULL_UP_30; in pmic_gpio_config_set()
491 pad->pullup = PMIC_GPIO_PULL_DOWN; in pmic_gpio_config_set()
493 pad->pullup = PMIC_GPIO_PULL_DISABLE; in pmic_gpio_config_set()
496 pad->is_enabled = false; in pmic_gpio_config_set()
499 if (arg >= pad->num_sources) in pmic_gpio_config_set()
501 pad->power_source = arg; in pmic_gpio_config_set()
504 pad->input_enabled = arg ? true : false; in pmic_gpio_config_set()
507 pad->output_enabled = true; in pmic_gpio_config_set()
508 pad->out_value = arg; in pmic_gpio_config_set()
513 pad->pullup = arg; in pmic_gpio_config_set()
518 pad->strength = arg; in pmic_gpio_config_set()
521 if (!pad->lv_mv_type || arg > 4) in pmic_gpio_config_set()
523 pad->atest = arg; in pmic_gpio_config_set()
526 if (!pad->lv_mv_type) in pmic_gpio_config_set()
528 pad->analog_pass = true; in pmic_gpio_config_set()
533 pad->dtest_buffer = arg; in pmic_gpio_config_set()
540 val = pad->power_source << PMIC_GPIO_REG_VIN_SHIFT; in pmic_gpio_config_set()
542 ret = pmic_gpio_write(state, pad, PMIC_GPIO_REG_DIG_VIN_CTL, val); in pmic_gpio_config_set()
546 val = pad->pullup << PMIC_GPIO_REG_PULL_SHIFT; in pmic_gpio_config_set()
548 ret = pmic_gpio_write(state, pad, PMIC_GPIO_REG_DIG_PULL_CTL, val); in pmic_gpio_config_set()
552 val = pad->buffer_type << PMIC_GPIO_REG_OUT_TYPE_SHIFT; in pmic_gpio_config_set()
553 val |= pad->strength << PMIC_GPIO_REG_OUT_STRENGTH_SHIFT; in pmic_gpio_config_set()
555 ret = pmic_gpio_write(state, pad, PMIC_GPIO_REG_DIG_OUT_CTL, val); in pmic_gpio_config_set()
559 if (pad->dtest_buffer == 0) { in pmic_gpio_config_set()
562 if (pad->lv_mv_type) { in pmic_gpio_config_set()
563 val = pad->dtest_buffer - 1; in pmic_gpio_config_set()
566 val = BIT(pad->dtest_buffer - 1); in pmic_gpio_config_set()
569 ret = pmic_gpio_write(state, pad, PMIC_GPIO_REG_DIG_IN_CTL, val); in pmic_gpio_config_set()
573 if (pad->analog_pass) in pmic_gpio_config_set()
575 else if (pad->output_enabled && pad->input_enabled) in pmic_gpio_config_set()
577 else if (pad->output_enabled) in pmic_gpio_config_set()
582 if (pad->lv_mv_type) { in pmic_gpio_config_set()
583 ret = pmic_gpio_write(state, pad, in pmic_gpio_config_set()
588 val = pad->atest - 1; in pmic_gpio_config_set()
589 ret = pmic_gpio_write(state, pad, in pmic_gpio_config_set()
594 val = pad->out_value in pmic_gpio_config_set()
596 val |= pad->function in pmic_gpio_config_set()
598 ret = pmic_gpio_write(state, pad, in pmic_gpio_config_set()
604 val |= pad->function << PMIC_GPIO_REG_MODE_FUNCTION_SHIFT; in pmic_gpio_config_set()
605 val |= pad->out_value & PMIC_GPIO_REG_MODE_VALUE_SHIFT; in pmic_gpio_config_set()
607 ret = pmic_gpio_write(state, pad, PMIC_GPIO_REG_MODE_CTL, val); in pmic_gpio_config_set()
612 val = pad->is_enabled << PMIC_GPIO_REG_MASTER_EN_SHIFT; in pmic_gpio_config_set()
614 ret = pmic_gpio_write(state, pad, PMIC_GPIO_REG_EN_CTL, val); in pmic_gpio_config_set()
623 struct pmic_gpio_pad *pad; in pmic_gpio_config_dbg_show() local
637 pad = pctldev->desc->pins[pin].drv_data; in pmic_gpio_config_dbg_show()
641 val = pmic_gpio_read(state, pad, PMIC_GPIO_REG_EN_CTL); in pmic_gpio_config_dbg_show()
646 if (pad->input_enabled) { in pmic_gpio_config_dbg_show()
647 ret = pmic_gpio_read(state, pad, PMIC_MPP_REG_RT_STS); in pmic_gpio_config_dbg_show()
652 pad->out_value = ret; in pmic_gpio_config_dbg_show()
658 function = pad->function; in pmic_gpio_config_dbg_show()
659 if (!pad->lv_mv_type && in pmic_gpio_config_dbg_show()
660 pad->function >= PMIC_GPIO_FUNC_INDEX_FUNC3) in pmic_gpio_config_dbg_show()
664 if (pad->analog_pass) in pmic_gpio_config_dbg_show()
668 pad->output_enabled ? "out" : "in"); in pmic_gpio_config_dbg_show()
669 seq_printf(s, " %-4s", pad->out_value ? "high" : "low"); in pmic_gpio_config_dbg_show()
671 seq_printf(s, " vin-%d", pad->power_source); in pmic_gpio_config_dbg_show()
672 seq_printf(s, " %-27s", biases[pad->pullup]); in pmic_gpio_config_dbg_show()
673 seq_printf(s, " %-10s", buffer_types[pad->buffer_type]); in pmic_gpio_config_dbg_show()
674 seq_printf(s, " %-7s", strengths[pad->strength]); in pmic_gpio_config_dbg_show()
675 seq_printf(s, " atest-%d", pad->atest); in pmic_gpio_config_dbg_show()
676 seq_printf(s, " dtest-%d", pad->dtest_buffer); in pmic_gpio_config_dbg_show()
711 struct pmic_gpio_pad *pad; in pmic_gpio_get() local
714 pad = state->ctrl->desc->pins[pin].drv_data; in pmic_gpio_get()
716 if (!pad->is_enabled) in pmic_gpio_get()
719 if (pad->input_enabled) { in pmic_gpio_get()
720 ret = pmic_gpio_read(state, pad, PMIC_MPP_REG_RT_STS); in pmic_gpio_get()
724 pad->out_value = ret & PMIC_MPP_REG_RT_STS_VAL_MASK; in pmic_gpio_get()
727 return !!pad->out_value; in pmic_gpio_get()
776 struct pmic_gpio_pad *pad) in pmic_gpio_populate() argument
780 type = pmic_gpio_read(state, pad, PMIC_GPIO_REG_TYPE); in pmic_gpio_populate()
786 type, pad->base); in pmic_gpio_populate()
790 subtype = pmic_gpio_read(state, pad, PMIC_GPIO_REG_SUBTYPE); in pmic_gpio_populate()
796 pad->have_buffer = true; in pmic_gpio_populate()
799 pad->num_sources = 4; in pmic_gpio_populate()
802 pad->have_buffer = true; in pmic_gpio_populate()
805 pad->num_sources = 8; in pmic_gpio_populate()
808 pad->num_sources = 1; in pmic_gpio_populate()
809 pad->have_buffer = true; in pmic_gpio_populate()
810 pad->lv_mv_type = true; in pmic_gpio_populate()
813 pad->num_sources = 2; in pmic_gpio_populate()
814 pad->have_buffer = true; in pmic_gpio_populate()
815 pad->lv_mv_type = true; in pmic_gpio_populate()
822 if (pad->lv_mv_type) { in pmic_gpio_populate()
823 val = pmic_gpio_read(state, pad, in pmic_gpio_populate()
828 pad->out_value = !!(val & PMIC_GPIO_LV_MV_OUTPUT_INVERT); in pmic_gpio_populate()
829 pad->function = val & PMIC_GPIO_LV_MV_OUTPUT_SOURCE_SEL_MASK; in pmic_gpio_populate()
831 val = pmic_gpio_read(state, pad, PMIC_GPIO_REG_MODE_CTL); in pmic_gpio_populate()
837 val = pmic_gpio_read(state, pad, PMIC_GPIO_REG_MODE_CTL); in pmic_gpio_populate()
841 pad->out_value = val & PMIC_GPIO_REG_MODE_VALUE_SHIFT; in pmic_gpio_populate()
845 pad->function = val >> PMIC_GPIO_REG_MODE_FUNCTION_SHIFT; in pmic_gpio_populate()
846 pad->function &= PMIC_GPIO_REG_MODE_FUNCTION_MASK; in pmic_gpio_populate()
851 pad->input_enabled = true; in pmic_gpio_populate()
852 pad->output_enabled = false; in pmic_gpio_populate()
855 pad->input_enabled = false; in pmic_gpio_populate()
856 pad->output_enabled = true; in pmic_gpio_populate()
859 pad->input_enabled = true; in pmic_gpio_populate()
860 pad->output_enabled = true; in pmic_gpio_populate()
863 if (!pad->lv_mv_type) in pmic_gpio_populate()
865 pad->analog_pass = true; in pmic_gpio_populate()
872 val = pmic_gpio_read(state, pad, PMIC_GPIO_REG_DIG_VIN_CTL); in pmic_gpio_populate()
876 pad->power_source = val >> PMIC_GPIO_REG_VIN_SHIFT; in pmic_gpio_populate()
877 pad->power_source &= PMIC_GPIO_REG_VIN_MASK; in pmic_gpio_populate()
879 val = pmic_gpio_read(state, pad, PMIC_GPIO_REG_DIG_PULL_CTL); in pmic_gpio_populate()
883 pad->pullup = val >> PMIC_GPIO_REG_PULL_SHIFT; in pmic_gpio_populate()
884 pad->pullup &= PMIC_GPIO_REG_PULL_MASK; in pmic_gpio_populate()
886 val = pmic_gpio_read(state, pad, PMIC_GPIO_REG_DIG_IN_CTL); in pmic_gpio_populate()
890 if (pad->lv_mv_type && (val & PMIC_GPIO_LV_MV_DIG_IN_DTEST_EN)) in pmic_gpio_populate()
891 pad->dtest_buffer = in pmic_gpio_populate()
893 else if (!pad->lv_mv_type) in pmic_gpio_populate()
894 pad->dtest_buffer = ffs(val); in pmic_gpio_populate()
896 pad->dtest_buffer = 0; in pmic_gpio_populate()
898 val = pmic_gpio_read(state, pad, PMIC_GPIO_REG_DIG_OUT_CTL); in pmic_gpio_populate()
902 pad->strength = val >> PMIC_GPIO_REG_OUT_STRENGTH_SHIFT; in pmic_gpio_populate()
903 pad->strength &= PMIC_GPIO_REG_OUT_STRENGTH_MASK; in pmic_gpio_populate()
905 pad->buffer_type = val >> PMIC_GPIO_REG_OUT_TYPE_SHIFT; in pmic_gpio_populate()
906 pad->buffer_type &= PMIC_GPIO_REG_OUT_TYPE_MASK; in pmic_gpio_populate()
908 if (pad->lv_mv_type) { in pmic_gpio_populate()
909 val = pmic_gpio_read(state, pad, in pmic_gpio_populate()
913 pad->atest = (val & PMIC_GPIO_LV_MV_ANA_MUX_SEL_MASK) + 1; in pmic_gpio_populate()
917 pad->is_enabled = true; in pmic_gpio_populate()
965 struct pmic_gpio_pad *pad, *pads; in pmic_gpio_probe() local
1014 pad = &pads[i]; in pmic_gpio_probe()
1015 pindesc->drv_data = pad; in pmic_gpio_probe()
1019 pad->base = reg + i * PMIC_GPIO_ADDRESS_RANGE; in pmic_gpio_probe()
1021 ret = pmic_gpio_populate(state, pad); in pmic_gpio_probe()