Lines Matching +full:pmi8998 +full:- +full:gpio
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2012-2014, 2016-2021 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
7 #include <linux/gpio/driver.h>
19 #include <linux/pinctrl/pinconf-generic.h>
23 #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
26 #include "../pinctrl-utils.h"
34 /* GPIO peripheral type and subtype out_values */
99 * Output type - indicates pin should be configured as push-pull,
139 * struct pmic_gpio_pad - keep current GPIO settings
141 * @is_enabled: Set to false when GPIO should be put in high Z state.
143 * @have_buffer: Set to true if GPIO output could be configured in push-pull,
144 * open-drain or open-source mode.
145 * @output_enabled: Set to true if GPIO output logic is enabled.
146 * @input_enabled: Set to true if GPIO input buffer logic is enabled.
147 * @analog_pass: Set to true if GPIO is in analog-pass-through mode.
148 * @lv_mv_type: Set to true if GPIO subtype is GPIO_LV(0x10) or GPIO_MV(0x11).
149 * @num_sources: Number of power-sources supported by this GPIO.
150 * @power_source: Current power-source used.
151 * @buffer_type: Push-pull, open-drain or open-source.
152 * @pullup: Constant current which flow trough GPIO output buffer.
155 * @atest: the ATEST selection for GPIO analog-pass-through mode
187 {"qcom,pull-up-strength", PMIC_GPIO_CONF_PULL_UP, 0},
188 {"qcom,drive-strength", PMIC_GPIO_CONF_STRENGTH, 0},
190 {"qcom,analog-pass", PMIC_GPIO_CONF_ANALOG_PASS, 0},
191 {"qcom,dtest-buffer", PMIC_GPIO_CONF_DTEST_BUFFER, 0},
197 PCONFDUMP(PMIC_GPIO_CONF_STRENGTH, "drive-strength", NULL, true),
199 PCONFDUMP(PMIC_GPIO_CONF_ANALOG_PASS, "analog-pass", NULL, true),
200 PCONFDUMP(PMIC_GPIO_CONF_DTEST_BUFFER, "dtest-buffer", NULL, true),
231 ret = regmap_read(state->map, pad->base + addr, &val); in pmic_gpio_read()
233 dev_err(state->dev, "read 0x%x failed\n", addr); in pmic_gpio_read()
246 ret = regmap_write(state->map, pad->base + addr, val); in pmic_gpio_write()
248 dev_err(state->dev, "write 0x%x failed\n", addr); in pmic_gpio_write()
256 return pctldev->desc->npins; in pmic_gpio_get_groups_count()
262 return pctldev->desc->pins[pin].name; in pmic_gpio_get_group_name()
268 *pins = &pctldev->desc->pins[pin].number; in pmic_gpio_get_group_pins()
298 *num_qgroups = pctldev->desc->npins; in pmic_gpio_get_function_groups()
312 return -EINVAL; in pmic_gpio_set_mux()
315 pad = pctldev->desc->pins[pin].drv_data; in pmic_gpio_set_mux()
317 * Non-LV/MV subtypes only support 2 special functions, in pmic_gpio_set_mux()
320 if (!pad->lv_mv_type) { in pmic_gpio_set_mux()
324 return -EINVAL; in pmic_gpio_set_mux()
327 function -= (PMIC_GPIO_FUNC_INDEX_DTEST1 - in pmic_gpio_set_mux()
331 pad->function = function; in pmic_gpio_set_mux()
333 if (pad->analog_pass) in pmic_gpio_set_mux()
335 else if (pad->output_enabled && pad->input_enabled) in pmic_gpio_set_mux()
337 else if (pad->output_enabled) in pmic_gpio_set_mux()
342 if (pad->lv_mv_type) { in pmic_gpio_set_mux()
348 val = pad->atest - 1; in pmic_gpio_set_mux()
354 val = pad->out_value in pmic_gpio_set_mux()
356 val |= pad->function in pmic_gpio_set_mux()
364 val |= pad->function << PMIC_GPIO_REG_MODE_FUNCTION_SHIFT; in pmic_gpio_set_mux()
365 val |= pad->out_value & PMIC_GPIO_REG_MODE_VALUE_SHIFT; in pmic_gpio_set_mux()
372 val = pad->is_enabled << PMIC_GPIO_REG_MASTER_EN_SHIFT; in pmic_gpio_set_mux()
391 pad = pctldev->desc->pins[pin].drv_data; in pmic_gpio_config_get()
395 if (pad->buffer_type != PMIC_GPIO_OUT_BUF_CMOS) in pmic_gpio_config_get()
396 return -EINVAL; in pmic_gpio_config_get()
400 if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS) in pmic_gpio_config_get()
401 return -EINVAL; in pmic_gpio_config_get()
405 if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS) in pmic_gpio_config_get()
406 return -EINVAL; in pmic_gpio_config_get()
410 if (pad->pullup != PMIC_GPIO_PULL_DOWN) in pmic_gpio_config_get()
411 return -EINVAL; in pmic_gpio_config_get()
415 if (pad->pullup != PMIC_GPIO_PULL_DISABLE) in pmic_gpio_config_get()
416 return -EINVAL; in pmic_gpio_config_get()
420 if (pad->pullup != PMIC_GPIO_PULL_UP_30) in pmic_gpio_config_get()
421 return -EINVAL; in pmic_gpio_config_get()
425 if (pad->is_enabled) in pmic_gpio_config_get()
426 return -EINVAL; in pmic_gpio_config_get()
430 arg = pad->power_source; in pmic_gpio_config_get()
433 if (!pad->input_enabled) in pmic_gpio_config_get()
434 return -EINVAL; in pmic_gpio_config_get()
438 arg = pad->output_enabled; in pmic_gpio_config_get()
441 arg = pad->out_value; in pmic_gpio_config_get()
444 arg = pad->pullup; in pmic_gpio_config_get()
447 switch (pad->strength) { in pmic_gpio_config_get()
455 arg = pad->strength; in pmic_gpio_config_get()
460 arg = pad->atest; in pmic_gpio_config_get()
463 arg = pad->analog_pass; in pmic_gpio_config_get()
466 arg = pad->dtest_buffer; in pmic_gpio_config_get()
469 return -EINVAL; in pmic_gpio_config_get()
485 pad = pctldev->desc->pins[pin].drv_data; in pmic_gpio_config_set()
487 pad->is_enabled = true; in pmic_gpio_config_set()
494 pad->buffer_type = PMIC_GPIO_OUT_BUF_CMOS; in pmic_gpio_config_set()
497 if (!pad->have_buffer) in pmic_gpio_config_set()
498 return -EINVAL; in pmic_gpio_config_set()
499 pad->buffer_type = PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS; in pmic_gpio_config_set()
502 if (!pad->have_buffer) in pmic_gpio_config_set()
503 return -EINVAL; in pmic_gpio_config_set()
504 pad->buffer_type = PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS; in pmic_gpio_config_set()
507 pad->pullup = PMIC_GPIO_PULL_DISABLE; in pmic_gpio_config_set()
510 pad->pullup = PMIC_GPIO_PULL_UP_30; in pmic_gpio_config_set()
514 pad->pullup = PMIC_GPIO_PULL_DOWN; in pmic_gpio_config_set()
516 pad->pullup = PMIC_GPIO_PULL_DISABLE; in pmic_gpio_config_set()
519 pad->is_enabled = false; in pmic_gpio_config_set()
522 if (arg >= pad->num_sources) in pmic_gpio_config_set()
523 return -EINVAL; in pmic_gpio_config_set()
524 pad->power_source = arg; in pmic_gpio_config_set()
527 pad->input_enabled = arg ? true : false; in pmic_gpio_config_set()
530 pad->output_enabled = arg ? true : false; in pmic_gpio_config_set()
533 pad->output_enabled = true; in pmic_gpio_config_set()
534 pad->out_value = arg; in pmic_gpio_config_set()
538 return -EINVAL; in pmic_gpio_config_set()
539 pad->pullup = arg; in pmic_gpio_config_set()
543 return -EINVAL; in pmic_gpio_config_set()
546 pad->strength = PMIC_GPIO_OUT_STRENGTH_HIGH; in pmic_gpio_config_set()
549 pad->strength = PMIC_GPIO_OUT_STRENGTH_LOW; in pmic_gpio_config_set()
552 pad->strength = arg; in pmic_gpio_config_set()
557 if (!pad->lv_mv_type || arg > 4) in pmic_gpio_config_set()
558 return -EINVAL; in pmic_gpio_config_set()
559 pad->atest = arg; in pmic_gpio_config_set()
562 if (!pad->lv_mv_type) in pmic_gpio_config_set()
563 return -EINVAL; in pmic_gpio_config_set()
564 pad->analog_pass = true; in pmic_gpio_config_set()
568 return -EINVAL; in pmic_gpio_config_set()
569 pad->dtest_buffer = arg; in pmic_gpio_config_set()
572 return -EINVAL; in pmic_gpio_config_set()
576 val = pad->power_source << PMIC_GPIO_REG_VIN_SHIFT; in pmic_gpio_config_set()
582 val = pad->pullup << PMIC_GPIO_REG_PULL_SHIFT; in pmic_gpio_config_set()
588 val = pad->buffer_type << PMIC_GPIO_REG_OUT_TYPE_SHIFT; in pmic_gpio_config_set()
589 val |= pad->strength << PMIC_GPIO_REG_OUT_STRENGTH_SHIFT; in pmic_gpio_config_set()
595 if (pad->dtest_buffer == 0) { in pmic_gpio_config_set()
598 if (pad->lv_mv_type) { in pmic_gpio_config_set()
599 val = pad->dtest_buffer - 1; in pmic_gpio_config_set()
602 val = BIT(pad->dtest_buffer - 1); in pmic_gpio_config_set()
609 if (pad->analog_pass) in pmic_gpio_config_set()
611 else if (pad->output_enabled && pad->input_enabled) in pmic_gpio_config_set()
613 else if (pad->output_enabled) in pmic_gpio_config_set()
618 if (pad->lv_mv_type) { in pmic_gpio_config_set()
624 val = pad->atest - 1; in pmic_gpio_config_set()
630 val = pad->out_value in pmic_gpio_config_set()
632 val |= pad->function in pmic_gpio_config_set()
640 val |= pad->function << PMIC_GPIO_REG_MODE_FUNCTION_SHIFT; in pmic_gpio_config_set()
641 val |= pad->out_value & PMIC_GPIO_REG_MODE_VALUE_SHIFT; in pmic_gpio_config_set()
648 val = pad->is_enabled << PMIC_GPIO_REG_MASTER_EN_SHIFT; in pmic_gpio_config_set()
663 "pull-up 30uA", "pull-up 1.5uA", "pull-up 31.5uA", in pmic_gpio_config_dbg_show()
664 "pull-up 1.5uA + 30uA boost", "pull-down 10uA", "no pull" in pmic_gpio_config_dbg_show()
667 "push-pull", "open-drain", "open-source" in pmic_gpio_config_dbg_show()
673 pad = pctldev->desc->pins[pin].drv_data; in pmic_gpio_config_dbg_show()
675 seq_printf(s, " gpio%-2d:", pin + PMIC_GPIO_PHYSICAL_OFFSET); in pmic_gpio_config_dbg_show()
680 seq_puts(s, " ---"); in pmic_gpio_config_dbg_show()
682 if (pad->input_enabled) { in pmic_gpio_config_dbg_show()
688 pad->out_value = ret; in pmic_gpio_config_dbg_show()
691 * For the non-LV/MV subtypes only 2 special functions are in pmic_gpio_config_dbg_show()
694 function = pad->function; in pmic_gpio_config_dbg_show()
695 if (!pad->lv_mv_type && in pmic_gpio_config_dbg_show()
696 pad->function >= PMIC_GPIO_FUNC_INDEX_FUNC3) in pmic_gpio_config_dbg_show()
697 function += PMIC_GPIO_FUNC_INDEX_DTEST1 - in pmic_gpio_config_dbg_show()
700 if (pad->analog_pass) in pmic_gpio_config_dbg_show()
701 seq_puts(s, " analog-pass"); in pmic_gpio_config_dbg_show()
703 seq_printf(s, " %-4s", in pmic_gpio_config_dbg_show()
704 pad->output_enabled ? "out" : "in"); in pmic_gpio_config_dbg_show()
705 seq_printf(s, " %-4s", pad->out_value ? "high" : "low"); in pmic_gpio_config_dbg_show()
706 seq_printf(s, " %-7s", pmic_gpio_functions[function]); in pmic_gpio_config_dbg_show()
707 seq_printf(s, " vin-%d", pad->power_source); in pmic_gpio_config_dbg_show()
708 seq_printf(s, " %-27s", biases[pad->pullup]); in pmic_gpio_config_dbg_show()
709 seq_printf(s, " %-10s", buffer_types[pad->buffer_type]); in pmic_gpio_config_dbg_show()
710 seq_printf(s, " %-7s", strengths[pad->strength]); in pmic_gpio_config_dbg_show()
711 seq_printf(s, " atest-%d", pad->atest); in pmic_gpio_config_dbg_show()
712 seq_printf(s, " dtest-%d", pad->dtest_buffer); in pmic_gpio_config_dbg_show()
730 return pmic_gpio_config_set(state->ctrl, pin, &config, 1); in pmic_gpio_direction_input()
741 return pmic_gpio_config_set(state->ctrl, pin, &config, 1); in pmic_gpio_direction_output()
750 pad = state->ctrl->desc->pins[pin].drv_data; in pmic_gpio_get()
752 if (!pad->is_enabled) in pmic_gpio_get()
753 return -EINVAL; in pmic_gpio_get()
755 if (pad->input_enabled) { in pmic_gpio_get()
760 pad->out_value = ret & PMIC_MPP_REG_RT_STS_VAL_MASK; in pmic_gpio_get()
763 return !!pad->out_value; in pmic_gpio_get()
773 pmic_gpio_config_set(state->ctrl, pin, &config, 1); in pmic_gpio_set()
780 if (chip->of_gpio_n_cells < 2) in pmic_gpio_of_xlate()
781 return -EINVAL; in pmic_gpio_of_xlate()
784 *flags = gpio_desc->args[1]; in pmic_gpio_of_xlate()
786 return gpio_desc->args[0] - PMIC_GPIO_PHYSICAL_OFFSET; in pmic_gpio_of_xlate()
794 for (i = 0; i < chip->ngpio; i++) { in pmic_gpio_dbg_show()
795 pmic_gpio_config_dbg_show(state->ctrl, s, i); in pmic_gpio_dbg_show()
821 dev_err(state->dev, "incorrect block type 0x%x at 0x%x\n", in pmic_gpio_populate()
822 type, pad->base); in pmic_gpio_populate()
823 return -ENODEV; in pmic_gpio_populate()
832 pad->have_buffer = true; in pmic_gpio_populate()
835 pad->num_sources = 4; in pmic_gpio_populate()
838 pad->have_buffer = true; in pmic_gpio_populate()
841 pad->num_sources = 8; in pmic_gpio_populate()
844 pad->num_sources = 1; in pmic_gpio_populate()
845 pad->have_buffer = true; in pmic_gpio_populate()
846 pad->lv_mv_type = true; in pmic_gpio_populate()
849 pad->num_sources = 2; in pmic_gpio_populate()
850 pad->have_buffer = true; in pmic_gpio_populate()
851 pad->lv_mv_type = true; in pmic_gpio_populate()
854 pad->num_sources = 2; in pmic_gpio_populate()
855 pad->have_buffer = true; in pmic_gpio_populate()
856 pad->lv_mv_type = true; in pmic_gpio_populate()
859 pad->num_sources = 3; in pmic_gpio_populate()
860 pad->have_buffer = true; in pmic_gpio_populate()
861 pad->lv_mv_type = true; in pmic_gpio_populate()
864 dev_err(state->dev, "unknown GPIO type 0x%x\n", subtype); in pmic_gpio_populate()
865 return -ENODEV; in pmic_gpio_populate()
868 if (pad->lv_mv_type) { in pmic_gpio_populate()
874 pad->out_value = !!(val & PMIC_GPIO_LV_MV_OUTPUT_INVERT); in pmic_gpio_populate()
875 pad->function = val & PMIC_GPIO_LV_MV_OUTPUT_SOURCE_SEL_MASK; in pmic_gpio_populate()
887 pad->out_value = val & PMIC_GPIO_REG_MODE_VALUE_SHIFT; in pmic_gpio_populate()
891 pad->function = val >> PMIC_GPIO_REG_MODE_FUNCTION_SHIFT; in pmic_gpio_populate()
892 pad->function &= PMIC_GPIO_REG_MODE_FUNCTION_MASK; in pmic_gpio_populate()
897 pad->input_enabled = true; in pmic_gpio_populate()
898 pad->output_enabled = false; in pmic_gpio_populate()
901 pad->input_enabled = false; in pmic_gpio_populate()
902 pad->output_enabled = true; in pmic_gpio_populate()
905 pad->input_enabled = true; in pmic_gpio_populate()
906 pad->output_enabled = true; in pmic_gpio_populate()
909 if (!pad->lv_mv_type) in pmic_gpio_populate()
910 return -ENODEV; in pmic_gpio_populate()
911 pad->analog_pass = true; in pmic_gpio_populate()
914 dev_err(state->dev, "unknown GPIO direction\n"); in pmic_gpio_populate()
915 return -ENODEV; in pmic_gpio_populate()
922 pad->power_source = val >> PMIC_GPIO_REG_VIN_SHIFT; in pmic_gpio_populate()
923 pad->power_source &= PMIC_GPIO_REG_VIN_MASK; in pmic_gpio_populate()
929 pad->pullup = val >> PMIC_GPIO_REG_PULL_SHIFT; in pmic_gpio_populate()
930 pad->pullup &= PMIC_GPIO_REG_PULL_MASK; in pmic_gpio_populate()
936 if (pad->lv_mv_type && (val & PMIC_GPIO_LV_MV_DIG_IN_DTEST_EN)) in pmic_gpio_populate()
937 pad->dtest_buffer = in pmic_gpio_populate()
939 else if (!pad->lv_mv_type) in pmic_gpio_populate()
940 pad->dtest_buffer = ffs(val); in pmic_gpio_populate()
942 pad->dtest_buffer = 0; in pmic_gpio_populate()
948 pad->strength = val >> PMIC_GPIO_REG_OUT_STRENGTH_SHIFT; in pmic_gpio_populate()
949 pad->strength &= PMIC_GPIO_REG_OUT_STRENGTH_MASK; in pmic_gpio_populate()
951 pad->buffer_type = val >> PMIC_GPIO_REG_OUT_TYPE_SHIFT; in pmic_gpio_populate()
952 pad->buffer_type &= PMIC_GPIO_REG_OUT_TYPE_MASK; in pmic_gpio_populate()
954 if (pad->lv_mv_type) { in pmic_gpio_populate()
959 pad->atest = (val & PMIC_GPIO_LV_MV_ANA_MUX_SEL_MASK) + 1; in pmic_gpio_populate()
963 pad->is_enabled = true; in pmic_gpio_populate()
972 struct pmic_gpio_state *state = container_of(domain->host_data, in pmic_gpio_domain_translate()
976 if (fwspec->param_count != 2 || in pmic_gpio_domain_translate()
977 fwspec->param[0] < 1 || fwspec->param[0] > state->chip.ngpio) in pmic_gpio_domain_translate()
978 return -EINVAL; in pmic_gpio_domain_translate()
980 *hwirq = fwspec->param[0] - PMIC_GPIO_PHYSICAL_OFFSET; in pmic_gpio_domain_translate()
981 *type = fwspec->param[1]; in pmic_gpio_domain_translate()
1000 *parent_hwirq = child_hwirq + state->pid_base; in pmic_gpio_child_to_parent_hwirq()
1012 struct irq_fwspec *fwspec = &gfwspec->fwspec; in pmic_gpio_populate_parent_fwspec()
1014 fwspec->fwnode = chip->irq.parent_domain->fwnode; in pmic_gpio_populate_parent_fwspec()
1016 fwspec->param_count = 4; in pmic_gpio_populate_parent_fwspec()
1017 fwspec->param[0] = state->usid; in pmic_gpio_populate_parent_fwspec()
1018 fwspec->param[1] = parent_hwirq; in pmic_gpio_populate_parent_fwspec()
1020 fwspec->param[3] = parent_type; in pmic_gpio_populate_parent_fwspec()
1030 gpiochip_disable_irq(gc, data->hwirq); in pmic_gpio_irq_mask()
1037 gpiochip_enable_irq(gc, data->hwirq); in pmic_gpio_irq_unmask()
1042 .name = "spmi-gpio",
1056 struct device *dev = &pdev->dev; in pmic_gpio_probe()
1066 ret = of_property_read_u32(dev->of_node, "reg", ®); in pmic_gpio_probe()
1072 npins = (uintptr_t) device_get_match_data(&pdev->dev); in pmic_gpio_probe()
1076 return -ENOMEM; in pmic_gpio_probe()
1080 state->dev = &pdev->dev; in pmic_gpio_probe()
1081 state->map = dev_get_regmap(dev->parent, NULL); in pmic_gpio_probe()
1082 parent_spmi_dev = to_spmi_device(dev->parent); in pmic_gpio_probe()
1083 state->usid = parent_spmi_dev->usid; in pmic_gpio_probe()
1084 state->pid_base = reg >> 8; in pmic_gpio_probe()
1088 return -ENOMEM; in pmic_gpio_probe()
1092 return -ENOMEM; in pmic_gpio_probe()
1096 return -ENOMEM; in pmic_gpio_probe()
1098 pctrldesc->pctlops = &pmic_gpio_pinctrl_ops; in pmic_gpio_probe()
1099 pctrldesc->pmxops = &pmic_gpio_pinmux_ops; in pmic_gpio_probe()
1100 pctrldesc->confops = &pmic_gpio_pinconf_ops; in pmic_gpio_probe()
1101 pctrldesc->owner = THIS_MODULE; in pmic_gpio_probe()
1102 pctrldesc->name = dev_name(dev); in pmic_gpio_probe()
1103 pctrldesc->pins = pindesc; in pmic_gpio_probe()
1104 pctrldesc->npins = npins; in pmic_gpio_probe()
1105 pctrldesc->num_custom_params = ARRAY_SIZE(pmic_gpio_bindings); in pmic_gpio_probe()
1106 pctrldesc->custom_params = pmic_gpio_bindings; in pmic_gpio_probe()
1108 pctrldesc->custom_conf_items = pmic_conf_items; in pmic_gpio_probe()
1113 pindesc->drv_data = pad; in pmic_gpio_probe()
1114 pindesc->number = i; in pmic_gpio_probe()
1115 pindesc->name = pmic_gpio_groups[i]; in pmic_gpio_probe()
1117 pad->base = reg + i * PMIC_GPIO_ADDRESS_RANGE; in pmic_gpio_probe()
1124 state->chip = pmic_gpio_gpio_template; in pmic_gpio_probe()
1125 state->chip.parent = dev; in pmic_gpio_probe()
1126 state->chip.base = -1; in pmic_gpio_probe()
1127 state->chip.ngpio = npins; in pmic_gpio_probe()
1128 state->chip.label = dev_name(dev); in pmic_gpio_probe()
1129 state->chip.of_gpio_n_cells = 2; in pmic_gpio_probe()
1130 state->chip.can_sleep = false; in pmic_gpio_probe()
1132 state->ctrl = devm_pinctrl_register(dev, pctrldesc, state); in pmic_gpio_probe()
1133 if (IS_ERR(state->ctrl)) in pmic_gpio_probe()
1134 return PTR_ERR(state->ctrl); in pmic_gpio_probe()
1136 parent_node = of_irq_find_parent(state->dev->of_node); in pmic_gpio_probe()
1138 return -ENXIO; in pmic_gpio_probe()
1143 return -ENXIO; in pmic_gpio_probe()
1145 girq = &state->chip.irq; in pmic_gpio_probe()
1147 girq->default_type = IRQ_TYPE_NONE; in pmic_gpio_probe()
1148 girq->handler = handle_level_irq; in pmic_gpio_probe()
1149 girq->fwnode = dev_fwnode(state->dev); in pmic_gpio_probe()
1150 girq->parent_domain = parent_domain; in pmic_gpio_probe()
1151 girq->child_to_parent_hwirq = pmic_gpio_child_to_parent_hwirq; in pmic_gpio_probe()
1152 girq->populate_parent_alloc_arg = pmic_gpio_populate_parent_fwspec; in pmic_gpio_probe()
1153 girq->child_offset_to_irq = pmic_gpio_child_offset_to_irq; in pmic_gpio_probe()
1154 girq->child_irq_domain_ops.translate = pmic_gpio_domain_translate; in pmic_gpio_probe()
1156 ret = gpiochip_add_data(&state->chip, state); in pmic_gpio_probe()
1158 dev_err(state->dev, "can't add gpio chip\n"); in pmic_gpio_probe()
1163 * For DeviceTree-supported systems, the gpio core checks the in pmic_gpio_probe()
1164 * pinctrl's device node for the "gpio-ranges" property. in pmic_gpio_probe()
1169 * files which don't set the "gpio-ranges" property or systems that in pmic_gpio_probe()
1172 if (!of_property_read_bool(dev->of_node, "gpio-ranges")) { in pmic_gpio_probe()
1173 ret = gpiochip_add_pin_range(&state->chip, dev_name(dev), 0, 0, in pmic_gpio_probe()
1184 gpiochip_remove(&state->chip); in pmic_gpio_probe()
1192 gpiochip_remove(&state->chip); in pmic_gpio_remove()
1196 { .compatible = "qcom,pm2250-gpio", .data = (void *) 10 },
1198 { .compatible = "qcom,pm660-gpio", .data = (void *) 13 },
1200 { .compatible = "qcom,pm660l-gpio", .data = (void *) 12 },
1201 { .compatible = "qcom,pm6125-gpio", .data = (void *) 9 },
1202 { .compatible = "qcom,pm6150-gpio", .data = (void *) 10 },
1203 { .compatible = "qcom,pm6150l-gpio", .data = (void *) 12 },
1204 { .compatible = "qcom,pm6350-gpio", .data = (void *) 9 },
1205 { .compatible = "qcom,pm6450-gpio", .data = (void *) 9 },
1206 { .compatible = "qcom,pm7250b-gpio", .data = (void *) 12 },
1207 { .compatible = "qcom,pm7325-gpio", .data = (void *) 10 },
1208 { .compatible = "qcom,pm7550ba-gpio", .data = (void *) 8},
1209 { .compatible = "qcom,pm8005-gpio", .data = (void *) 4 },
1210 { .compatible = "qcom,pm8019-gpio", .data = (void *) 6 },
1212 { .compatible = "qcom,pm8150-gpio", .data = (void *) 10 },
1213 { .compatible = "qcom,pmc8180-gpio", .data = (void *) 10 },
1215 { .compatible = "qcom,pm8150b-gpio", .data = (void *) 12 },
1217 { .compatible = "qcom,pm8150l-gpio", .data = (void *) 12 },
1218 { .compatible = "qcom,pmc8180c-gpio", .data = (void *) 12 },
1219 { .compatible = "qcom,pm8226-gpio", .data = (void *) 8 },
1220 { .compatible = "qcom,pm8350-gpio", .data = (void *) 10 },
1221 { .compatible = "qcom,pm8350b-gpio", .data = (void *) 8 },
1222 { .compatible = "qcom,pm8350c-gpio", .data = (void *) 9 },
1223 { .compatible = "qcom,pm8450-gpio", .data = (void *) 4 },
1224 { .compatible = "qcom,pm8550-gpio", .data = (void *) 12 },
1225 { .compatible = "qcom,pm8550b-gpio", .data = (void *) 12 },
1226 { .compatible = "qcom,pm8550ve-gpio", .data = (void *) 8 },
1227 { .compatible = "qcom,pm8550vs-gpio", .data = (void *) 6 },
1228 { .compatible = "qcom,pm8916-gpio", .data = (void *) 4 },
1229 { .compatible = "qcom,pm8941-gpio", .data = (void *) 36 },
1231 { .compatible = "qcom,pm8950-gpio", .data = (void *) 8 },
1233 { .compatible = "qcom,pm8953-gpio", .data = (void *) 8 },
1234 { .compatible = "qcom,pm8994-gpio", .data = (void *) 22 },
1235 { .compatible = "qcom,pm8998-gpio", .data = (void *) 26 },
1236 { .compatible = "qcom,pma8084-gpio", .data = (void *) 22 },
1237 { .compatible = "qcom,pmc8380-gpio", .data = (void *) 10 },
1238 { .compatible = "qcom,pmd8028-gpio", .data = (void *) 4 },
1239 { .compatible = "qcom,pmi632-gpio", .data = (void *) 8 },
1240 { .compatible = "qcom,pmi8950-gpio", .data = (void *) 2 },
1241 { .compatible = "qcom,pmi8994-gpio", .data = (void *) 10 },
1242 { .compatible = "qcom,pmi8998-gpio", .data = (void *) 14 },
1243 { .compatible = "qcom,pmih0108-gpio", .data = (void *) 18 },
1244 { .compatible = "qcom,pmk8350-gpio", .data = (void *) 4 },
1245 { .compatible = "qcom,pmk8550-gpio", .data = (void *) 6 },
1246 { .compatible = "qcom,pmm8155au-gpio", .data = (void *) 10 },
1247 { .compatible = "qcom,pmm8654au-gpio", .data = (void *) 12 },
1249 { .compatible = "qcom,pmp8074-gpio", .data = (void *) 12 },
1250 { .compatible = "qcom,pmr735a-gpio", .data = (void *) 4 },
1251 { .compatible = "qcom,pmr735b-gpio", .data = (void *) 4 },
1252 { .compatible = "qcom,pmr735d-gpio", .data = (void *) 2 },
1254 { .compatible = "qcom,pms405-gpio", .data = (void *) 12 },
1256 { .compatible = "qcom,pmx55-gpio", .data = (void *) 11 },
1257 { .compatible = "qcom,pmx65-gpio", .data = (void *) 16 },
1258 { .compatible = "qcom,pmx75-gpio", .data = (void *) 16 },
1259 { .compatible = "qcom,pmxr2230-gpio", .data = (void *) 12 },
1267 .name = "qcom-spmi-gpio",
1276 MODULE_AUTHOR("Ivan T. Ivanov <iivanov@mm-sol.com>");
1277 MODULE_DESCRIPTION("Qualcomm SPMI PMIC GPIO pin control driver");
1278 MODULE_ALIAS("platform:qcom-spmi-gpio");