Lines Matching +full:irq +full:- +full:push +full:- +full:pull
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.
12 #include <linux/pinctrl/pinconf-generic.h>
21 #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
24 #include "../pinctrl-utils.h"
97 * Output type - indicates pin should be configured as push-pull,
137 * struct pmic_gpio_pad - keep current GPIO settings
141 * @have_buffer: Set to true if GPIO output could be configured in push-pull,
142 * open-drain or open-source mode.
145 * @analog_pass: Set to true if GPIO is in analog-pass-through mode.
147 * @num_sources: Number of power-sources supported by this GPIO.
148 * @power_source: Current power-source used.
149 * @buffer_type: Push-pull, open-drain or open-source.
153 * @atest: the ATEST selection for GPIO analog-pass-through mode
185 {"qcom,pull-up-strength", PMIC_GPIO_CONF_PULL_UP, 0},
186 {"qcom,drive-strength", PMIC_GPIO_CONF_STRENGTH, 0},
188 {"qcom,analog-pass", PMIC_GPIO_CONF_ANALOG_PASS, 0},
189 {"qcom,dtest-buffer", PMIC_GPIO_CONF_DTEST_BUFFER, 0},
194 PCONFDUMP(PMIC_GPIO_CONF_PULL_UP, "pull up strength", NULL, true),
195 PCONFDUMP(PMIC_GPIO_CONF_STRENGTH, "drive-strength", NULL, true),
197 PCONFDUMP(PMIC_GPIO_CONF_ANALOG_PASS, "analog-pass", NULL, true),
198 PCONFDUMP(PMIC_GPIO_CONF_DTEST_BUFFER, "dtest-buffer", NULL, true),
229 ret = regmap_read(state->map, pad->base + addr, &val); in pmic_gpio_read()
231 dev_err(state->dev, "read 0x%x failed\n", addr); in pmic_gpio_read()
244 ret = regmap_write(state->map, pad->base + addr, val); in pmic_gpio_write()
246 dev_err(state->dev, "write 0x%x failed\n", addr); in pmic_gpio_write()
254 return pctldev->desc->npins; in pmic_gpio_get_groups_count()
260 return pctldev->desc->pins[pin].name; in pmic_gpio_get_group_name()
266 *pins = &pctldev->desc->pins[pin].number; in pmic_gpio_get_group_pins()
296 *num_qgroups = pctldev->desc->npins; in pmic_gpio_get_function_groups()
310 return -EINVAL; in pmic_gpio_set_mux()
313 pad = pctldev->desc->pins[pin].drv_data; in pmic_gpio_set_mux()
315 * Non-LV/MV subtypes only support 2 special functions, in pmic_gpio_set_mux()
318 if (!pad->lv_mv_type) { in pmic_gpio_set_mux()
322 return -EINVAL; in pmic_gpio_set_mux()
325 function -= (PMIC_GPIO_FUNC_INDEX_DTEST1 - in pmic_gpio_set_mux()
329 pad->function = function; in pmic_gpio_set_mux()
331 if (pad->analog_pass) in pmic_gpio_set_mux()
333 else if (pad->output_enabled && pad->input_enabled) in pmic_gpio_set_mux()
335 else if (pad->output_enabled) in pmic_gpio_set_mux()
340 if (pad->lv_mv_type) { in pmic_gpio_set_mux()
346 val = pad->atest - 1; in pmic_gpio_set_mux()
352 val = pad->out_value in pmic_gpio_set_mux()
354 val |= pad->function in pmic_gpio_set_mux()
362 val |= pad->function << PMIC_GPIO_REG_MODE_FUNCTION_SHIFT; in pmic_gpio_set_mux()
363 val |= pad->out_value & PMIC_GPIO_REG_MODE_VALUE_SHIFT; in pmic_gpio_set_mux()
370 val = pad->is_enabled << PMIC_GPIO_REG_MASTER_EN_SHIFT; in pmic_gpio_set_mux()
389 pad = pctldev->desc->pins[pin].drv_data; in pmic_gpio_config_get()
393 if (pad->buffer_type != PMIC_GPIO_OUT_BUF_CMOS) in pmic_gpio_config_get()
394 return -EINVAL; in pmic_gpio_config_get()
398 if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS) in pmic_gpio_config_get()
399 return -EINVAL; in pmic_gpio_config_get()
403 if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS) in pmic_gpio_config_get()
404 return -EINVAL; in pmic_gpio_config_get()
408 if (pad->pullup != PMIC_GPIO_PULL_DOWN) in pmic_gpio_config_get()
409 return -EINVAL; in pmic_gpio_config_get()
413 if (pad->pullup != PMIC_GPIO_PULL_DISABLE) in pmic_gpio_config_get()
414 return -EINVAL; in pmic_gpio_config_get()
418 if (pad->pullup != PMIC_GPIO_PULL_UP_30) in pmic_gpio_config_get()
419 return -EINVAL; in pmic_gpio_config_get()
423 if (pad->is_enabled) in pmic_gpio_config_get()
424 return -EINVAL; in pmic_gpio_config_get()
428 arg = pad->power_source; in pmic_gpio_config_get()
431 if (!pad->input_enabled) in pmic_gpio_config_get()
432 return -EINVAL; in pmic_gpio_config_get()
436 arg = pad->output_enabled; in pmic_gpio_config_get()
439 arg = pad->out_value; in pmic_gpio_config_get()
442 arg = pad->pullup; in pmic_gpio_config_get()
445 switch (pad->strength) { in pmic_gpio_config_get()
453 arg = pad->strength; in pmic_gpio_config_get()
458 arg = pad->atest; in pmic_gpio_config_get()
461 arg = pad->analog_pass; in pmic_gpio_config_get()
464 arg = pad->dtest_buffer; in pmic_gpio_config_get()
467 return -EINVAL; in pmic_gpio_config_get()
483 pad = pctldev->desc->pins[pin].drv_data; in pmic_gpio_config_set()
485 pad->is_enabled = true; in pmic_gpio_config_set()
492 pad->buffer_type = PMIC_GPIO_OUT_BUF_CMOS; in pmic_gpio_config_set()
495 if (!pad->have_buffer) in pmic_gpio_config_set()
496 return -EINVAL; in pmic_gpio_config_set()
497 pad->buffer_type = PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS; in pmic_gpio_config_set()
500 if (!pad->have_buffer) in pmic_gpio_config_set()
501 return -EINVAL; in pmic_gpio_config_set()
502 pad->buffer_type = PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS; in pmic_gpio_config_set()
505 pad->pullup = PMIC_GPIO_PULL_DISABLE; in pmic_gpio_config_set()
508 pad->pullup = PMIC_GPIO_PULL_UP_30; in pmic_gpio_config_set()
512 pad->pullup = PMIC_GPIO_PULL_DOWN; in pmic_gpio_config_set()
514 pad->pullup = PMIC_GPIO_PULL_DISABLE; in pmic_gpio_config_set()
517 pad->is_enabled = false; in pmic_gpio_config_set()
520 if (arg >= pad->num_sources) in pmic_gpio_config_set()
521 return -EINVAL; in pmic_gpio_config_set()
522 pad->power_source = arg; in pmic_gpio_config_set()
525 pad->input_enabled = arg ? true : false; in pmic_gpio_config_set()
528 pad->output_enabled = arg ? true : false; in pmic_gpio_config_set()
531 pad->output_enabled = true; in pmic_gpio_config_set()
532 pad->out_value = arg; in pmic_gpio_config_set()
536 return -EINVAL; in pmic_gpio_config_set()
537 pad->pullup = arg; in pmic_gpio_config_set()
541 return -EINVAL; in pmic_gpio_config_set()
544 pad->strength = PMIC_GPIO_OUT_STRENGTH_HIGH; in pmic_gpio_config_set()
547 pad->strength = PMIC_GPIO_OUT_STRENGTH_LOW; in pmic_gpio_config_set()
550 pad->strength = arg; in pmic_gpio_config_set()
555 if (!pad->lv_mv_type || arg > 4) in pmic_gpio_config_set()
556 return -EINVAL; in pmic_gpio_config_set()
557 pad->atest = arg; in pmic_gpio_config_set()
560 if (!pad->lv_mv_type) in pmic_gpio_config_set()
561 return -EINVAL; in pmic_gpio_config_set()
562 pad->analog_pass = true; in pmic_gpio_config_set()
566 return -EINVAL; in pmic_gpio_config_set()
567 pad->dtest_buffer = arg; in pmic_gpio_config_set()
570 return -EINVAL; in pmic_gpio_config_set()
574 val = pad->power_source << PMIC_GPIO_REG_VIN_SHIFT; in pmic_gpio_config_set()
580 val = pad->pullup << PMIC_GPIO_REG_PULL_SHIFT; in pmic_gpio_config_set()
586 val = pad->buffer_type << PMIC_GPIO_REG_OUT_TYPE_SHIFT; in pmic_gpio_config_set()
587 val |= pad->strength << PMIC_GPIO_REG_OUT_STRENGTH_SHIFT; in pmic_gpio_config_set()
593 if (pad->dtest_buffer == 0) { in pmic_gpio_config_set()
596 if (pad->lv_mv_type) { in pmic_gpio_config_set()
597 val = pad->dtest_buffer - 1; in pmic_gpio_config_set()
600 val = BIT(pad->dtest_buffer - 1); in pmic_gpio_config_set()
607 if (pad->analog_pass) in pmic_gpio_config_set()
609 else if (pad->output_enabled && pad->input_enabled) in pmic_gpio_config_set()
611 else if (pad->output_enabled) in pmic_gpio_config_set()
616 if (pad->lv_mv_type) { in pmic_gpio_config_set()
622 val = pad->atest - 1; in pmic_gpio_config_set()
628 val = pad->out_value in pmic_gpio_config_set()
630 val |= pad->function in pmic_gpio_config_set()
638 val |= pad->function << PMIC_GPIO_REG_MODE_FUNCTION_SHIFT; in pmic_gpio_config_set()
639 val |= pad->out_value & PMIC_GPIO_REG_MODE_VALUE_SHIFT; in pmic_gpio_config_set()
646 val = pad->is_enabled << PMIC_GPIO_REG_MASTER_EN_SHIFT; in pmic_gpio_config_set()
661 "pull-up 30uA", "pull-up 1.5uA", "pull-up 31.5uA", in pmic_gpio_config_dbg_show()
662 "pull-up 1.5uA + 30uA boost", "pull-down 10uA", "no pull" in pmic_gpio_config_dbg_show()
665 "push-pull", "open-drain", "open-source" in pmic_gpio_config_dbg_show()
671 pad = pctldev->desc->pins[pin].drv_data; in pmic_gpio_config_dbg_show()
673 seq_printf(s, " gpio%-2d:", pin + PMIC_GPIO_PHYSICAL_OFFSET); in pmic_gpio_config_dbg_show()
678 seq_puts(s, " ---"); in pmic_gpio_config_dbg_show()
680 if (pad->input_enabled) { in pmic_gpio_config_dbg_show()
686 pad->out_value = ret; in pmic_gpio_config_dbg_show()
689 * For the non-LV/MV subtypes only 2 special functions are in pmic_gpio_config_dbg_show()
692 function = pad->function; in pmic_gpio_config_dbg_show()
693 if (!pad->lv_mv_type && in pmic_gpio_config_dbg_show()
694 pad->function >= PMIC_GPIO_FUNC_INDEX_FUNC3) in pmic_gpio_config_dbg_show()
695 function += PMIC_GPIO_FUNC_INDEX_DTEST1 - in pmic_gpio_config_dbg_show()
698 if (pad->analog_pass) in pmic_gpio_config_dbg_show()
699 seq_puts(s, " analog-pass"); in pmic_gpio_config_dbg_show()
701 seq_printf(s, " %-4s", in pmic_gpio_config_dbg_show()
702 pad->output_enabled ? "out" : "in"); in pmic_gpio_config_dbg_show()
703 seq_printf(s, " %-4s", pad->out_value ? "high" : "low"); in pmic_gpio_config_dbg_show()
704 seq_printf(s, " %-7s", pmic_gpio_functions[function]); in pmic_gpio_config_dbg_show()
705 seq_printf(s, " vin-%d", pad->power_source); in pmic_gpio_config_dbg_show()
706 seq_printf(s, " %-27s", biases[pad->pullup]); in pmic_gpio_config_dbg_show()
707 seq_printf(s, " %-10s", buffer_types[pad->buffer_type]); in pmic_gpio_config_dbg_show()
708 seq_printf(s, " %-7s", strengths[pad->strength]); in pmic_gpio_config_dbg_show()
709 seq_printf(s, " atest-%d", pad->atest); in pmic_gpio_config_dbg_show()
710 seq_printf(s, " dtest-%d", pad->dtest_buffer); in pmic_gpio_config_dbg_show()
728 return pmic_gpio_config_set(state->ctrl, pin, &config, 1); in pmic_gpio_direction_input()
739 return pmic_gpio_config_set(state->ctrl, pin, &config, 1); in pmic_gpio_direction_output()
748 pad = state->ctrl->desc->pins[pin].drv_data; in pmic_gpio_get()
750 if (!pad->is_enabled) in pmic_gpio_get()
751 return -EINVAL; in pmic_gpio_get()
753 if (pad->input_enabled) { in pmic_gpio_get()
758 pad->out_value = ret & PMIC_MPP_REG_RT_STS_VAL_MASK; in pmic_gpio_get()
761 return !!pad->out_value; in pmic_gpio_get()
771 pmic_gpio_config_set(state->ctrl, pin, &config, 1); in pmic_gpio_set()
778 if (chip->of_gpio_n_cells < 2) in pmic_gpio_of_xlate()
779 return -EINVAL; in pmic_gpio_of_xlate()
782 *flags = gpio_desc->args[1]; in pmic_gpio_of_xlate()
784 return gpio_desc->args[0] - PMIC_GPIO_PHYSICAL_OFFSET; in pmic_gpio_of_xlate()
792 for (i = 0; i < chip->ngpio; i++) { in pmic_gpio_dbg_show()
793 pmic_gpio_config_dbg_show(state->ctrl, s, i); in pmic_gpio_dbg_show()
819 dev_err(state->dev, "incorrect block type 0x%x at 0x%x\n", in pmic_gpio_populate()
820 type, pad->base); in pmic_gpio_populate()
821 return -ENODEV; in pmic_gpio_populate()
830 pad->have_buffer = true; in pmic_gpio_populate()
833 pad->num_sources = 4; in pmic_gpio_populate()
836 pad->have_buffer = true; in pmic_gpio_populate()
839 pad->num_sources = 8; in pmic_gpio_populate()
842 pad->num_sources = 1; in pmic_gpio_populate()
843 pad->have_buffer = true; in pmic_gpio_populate()
844 pad->lv_mv_type = true; in pmic_gpio_populate()
847 pad->num_sources = 2; in pmic_gpio_populate()
848 pad->have_buffer = true; in pmic_gpio_populate()
849 pad->lv_mv_type = true; in pmic_gpio_populate()
852 pad->num_sources = 2; in pmic_gpio_populate()
853 pad->have_buffer = true; in pmic_gpio_populate()
854 pad->lv_mv_type = true; in pmic_gpio_populate()
857 pad->num_sources = 3; in pmic_gpio_populate()
858 pad->have_buffer = true; in pmic_gpio_populate()
859 pad->lv_mv_type = true; in pmic_gpio_populate()
862 dev_err(state->dev, "unknown GPIO type 0x%x\n", subtype); in pmic_gpio_populate()
863 return -ENODEV; in pmic_gpio_populate()
866 if (pad->lv_mv_type) { in pmic_gpio_populate()
872 pad->out_value = !!(val & PMIC_GPIO_LV_MV_OUTPUT_INVERT); in pmic_gpio_populate()
873 pad->function = val & PMIC_GPIO_LV_MV_OUTPUT_SOURCE_SEL_MASK; in pmic_gpio_populate()
885 pad->out_value = val & PMIC_GPIO_REG_MODE_VALUE_SHIFT; in pmic_gpio_populate()
889 pad->function = val >> PMIC_GPIO_REG_MODE_FUNCTION_SHIFT; in pmic_gpio_populate()
890 pad->function &= PMIC_GPIO_REG_MODE_FUNCTION_MASK; in pmic_gpio_populate()
895 pad->input_enabled = true; in pmic_gpio_populate()
896 pad->output_enabled = false; in pmic_gpio_populate()
899 pad->input_enabled = false; in pmic_gpio_populate()
900 pad->output_enabled = true; in pmic_gpio_populate()
903 pad->input_enabled = true; in pmic_gpio_populate()
904 pad->output_enabled = true; in pmic_gpio_populate()
907 if (!pad->lv_mv_type) in pmic_gpio_populate()
908 return -ENODEV; in pmic_gpio_populate()
909 pad->analog_pass = true; in pmic_gpio_populate()
912 dev_err(state->dev, "unknown GPIO direction\n"); in pmic_gpio_populate()
913 return -ENODEV; in pmic_gpio_populate()
920 pad->power_source = val >> PMIC_GPIO_REG_VIN_SHIFT; in pmic_gpio_populate()
921 pad->power_source &= PMIC_GPIO_REG_VIN_MASK; in pmic_gpio_populate()
927 pad->pullup = val >> PMIC_GPIO_REG_PULL_SHIFT; in pmic_gpio_populate()
928 pad->pullup &= PMIC_GPIO_REG_PULL_MASK; in pmic_gpio_populate()
934 if (pad->lv_mv_type && (val & PMIC_GPIO_LV_MV_DIG_IN_DTEST_EN)) in pmic_gpio_populate()
935 pad->dtest_buffer = in pmic_gpio_populate()
937 else if (!pad->lv_mv_type) in pmic_gpio_populate()
938 pad->dtest_buffer = ffs(val); in pmic_gpio_populate()
940 pad->dtest_buffer = 0; in pmic_gpio_populate()
946 pad->strength = val >> PMIC_GPIO_REG_OUT_STRENGTH_SHIFT; in pmic_gpio_populate()
947 pad->strength &= PMIC_GPIO_REG_OUT_STRENGTH_MASK; in pmic_gpio_populate()
949 pad->buffer_type = val >> PMIC_GPIO_REG_OUT_TYPE_SHIFT; in pmic_gpio_populate()
950 pad->buffer_type &= PMIC_GPIO_REG_OUT_TYPE_MASK; in pmic_gpio_populate()
952 if (pad->lv_mv_type) { in pmic_gpio_populate()
957 pad->atest = (val & PMIC_GPIO_LV_MV_ANA_MUX_SEL_MASK) + 1; in pmic_gpio_populate()
961 pad->is_enabled = true; in pmic_gpio_populate()
970 struct pmic_gpio_state *state = container_of(domain->host_data, in pmic_gpio_domain_translate()
974 if (fwspec->param_count != 2 || in pmic_gpio_domain_translate()
975 fwspec->param[0] < 1 || fwspec->param[0] > state->chip.ngpio) in pmic_gpio_domain_translate()
976 return -EINVAL; in pmic_gpio_domain_translate()
978 *hwirq = fwspec->param[0] - PMIC_GPIO_PHYSICAL_OFFSET; in pmic_gpio_domain_translate()
979 *type = fwspec->param[1]; in pmic_gpio_domain_translate()
998 *parent_hwirq = child_hwirq + state->pid_base; in pmic_gpio_child_to_parent_hwirq()
1010 struct irq_fwspec *fwspec = &gfwspec->fwspec; in pmic_gpio_populate_parent_fwspec()
1012 fwspec->fwnode = chip->irq.parent_domain->fwnode; in pmic_gpio_populate_parent_fwspec()
1014 fwspec->param_count = 4; in pmic_gpio_populate_parent_fwspec()
1015 fwspec->param[0] = state->usid; in pmic_gpio_populate_parent_fwspec()
1016 fwspec->param[1] = parent_hwirq; in pmic_gpio_populate_parent_fwspec()
1018 fwspec->param[3] = parent_type; in pmic_gpio_populate_parent_fwspec()
1028 gpiochip_disable_irq(gc, data->hwirq); in pmic_gpio_irq_mask()
1035 gpiochip_enable_irq(gc, data->hwirq); in pmic_gpio_irq_unmask()
1040 .name = "spmi-gpio",
1054 struct device *dev = &pdev->dev; in pmic_gpio_probe()
1064 ret = of_property_read_u32(dev->of_node, "reg", ®); in pmic_gpio_probe()
1070 npins = (uintptr_t) device_get_match_data(&pdev->dev); in pmic_gpio_probe()
1074 return -ENOMEM; in pmic_gpio_probe()
1078 state->dev = &pdev->dev; in pmic_gpio_probe()
1079 state->map = dev_get_regmap(dev->parent, NULL); in pmic_gpio_probe()
1080 parent_spmi_dev = to_spmi_device(dev->parent); in pmic_gpio_probe()
1081 state->usid = parent_spmi_dev->usid; in pmic_gpio_probe()
1082 state->pid_base = reg >> 8; in pmic_gpio_probe()
1086 return -ENOMEM; in pmic_gpio_probe()
1090 return -ENOMEM; in pmic_gpio_probe()
1094 return -ENOMEM; in pmic_gpio_probe()
1096 pctrldesc->pctlops = &pmic_gpio_pinctrl_ops; in pmic_gpio_probe()
1097 pctrldesc->pmxops = &pmic_gpio_pinmux_ops; in pmic_gpio_probe()
1098 pctrldesc->confops = &pmic_gpio_pinconf_ops; in pmic_gpio_probe()
1099 pctrldesc->owner = THIS_MODULE; in pmic_gpio_probe()
1100 pctrldesc->name = dev_name(dev); in pmic_gpio_probe()
1101 pctrldesc->pins = pindesc; in pmic_gpio_probe()
1102 pctrldesc->npins = npins; in pmic_gpio_probe()
1103 pctrldesc->num_custom_params = ARRAY_SIZE(pmic_gpio_bindings); in pmic_gpio_probe()
1104 pctrldesc->custom_params = pmic_gpio_bindings; in pmic_gpio_probe()
1106 pctrldesc->custom_conf_items = pmic_conf_items; in pmic_gpio_probe()
1111 pindesc->drv_data = pad; in pmic_gpio_probe()
1112 pindesc->number = i; in pmic_gpio_probe()
1113 pindesc->name = pmic_gpio_groups[i]; in pmic_gpio_probe()
1115 pad->base = reg + i * PMIC_GPIO_ADDRESS_RANGE; in pmic_gpio_probe()
1122 state->chip = pmic_gpio_gpio_template; in pmic_gpio_probe()
1123 state->chip.parent = dev; in pmic_gpio_probe()
1124 state->chip.base = -1; in pmic_gpio_probe()
1125 state->chip.ngpio = npins; in pmic_gpio_probe()
1126 state->chip.label = dev_name(dev); in pmic_gpio_probe()
1127 state->chip.of_gpio_n_cells = 2; in pmic_gpio_probe()
1128 state->chip.can_sleep = false; in pmic_gpio_probe()
1130 state->ctrl = devm_pinctrl_register(dev, pctrldesc, state); in pmic_gpio_probe()
1131 if (IS_ERR(state->ctrl)) in pmic_gpio_probe()
1132 return PTR_ERR(state->ctrl); in pmic_gpio_probe()
1134 parent_node = of_irq_find_parent(state->dev->of_node); in pmic_gpio_probe()
1136 return -ENXIO; in pmic_gpio_probe()
1141 return -ENXIO; in pmic_gpio_probe()
1143 girq = &state->chip.irq; in pmic_gpio_probe()
1145 girq->default_type = IRQ_TYPE_NONE; in pmic_gpio_probe()
1146 girq->handler = handle_level_irq; in pmic_gpio_probe()
1147 girq->fwnode = of_node_to_fwnode(state->dev->of_node); in pmic_gpio_probe()
1148 girq->parent_domain = parent_domain; in pmic_gpio_probe()
1149 girq->child_to_parent_hwirq = pmic_gpio_child_to_parent_hwirq; in pmic_gpio_probe()
1150 girq->populate_parent_alloc_arg = pmic_gpio_populate_parent_fwspec; in pmic_gpio_probe()
1151 girq->child_offset_to_irq = pmic_gpio_child_offset_to_irq; in pmic_gpio_probe()
1152 girq->child_irq_domain_ops.translate = pmic_gpio_domain_translate; in pmic_gpio_probe()
1154 ret = gpiochip_add_data(&state->chip, state); in pmic_gpio_probe()
1156 dev_err(state->dev, "can't add gpio chip\n"); in pmic_gpio_probe()
1161 * For DeviceTree-supported systems, the gpio core checks the in pmic_gpio_probe()
1162 * pinctrl's device node for the "gpio-ranges" property. in pmic_gpio_probe()
1167 * files which don't set the "gpio-ranges" property or systems that in pmic_gpio_probe()
1170 if (!of_property_read_bool(dev->of_node, "gpio-ranges")) { in pmic_gpio_probe()
1171 ret = gpiochip_add_pin_range(&state->chip, dev_name(dev), 0, 0, in pmic_gpio_probe()
1182 gpiochip_remove(&state->chip); in pmic_gpio_probe()
1190 gpiochip_remove(&state->chip); in pmic_gpio_remove()
1195 { .compatible = "qcom,pm2250-gpio", .data = (void *) 10 },
1197 { .compatible = "qcom,pm660-gpio", .data = (void *) 13 },
1199 { .compatible = "qcom,pm660l-gpio", .data = (void *) 12 },
1200 { .compatible = "qcom,pm6125-gpio", .data = (void *) 9 },
1201 { .compatible = "qcom,pm6150-gpio", .data = (void *) 10 },
1202 { .compatible = "qcom,pm6150l-gpio", .data = (void *) 12 },
1203 { .compatible = "qcom,pm6350-gpio", .data = (void *) 9 },
1204 { .compatible = "qcom,pm7250b-gpio", .data = (void *) 12 },
1205 { .compatible = "qcom,pm7325-gpio", .data = (void *) 10 },
1206 { .compatible = "qcom,pm8005-gpio", .data = (void *) 4 },
1207 { .compatible = "qcom,pm8008-gpio", .data = (void *) 2 },
1208 { .compatible = "qcom,pm8019-gpio", .data = (void *) 6 },
1210 { .compatible = "qcom,pm8150-gpio", .data = (void *) 10 },
1211 { .compatible = "qcom,pmc8180-gpio", .data = (void *) 10 },
1213 { .compatible = "qcom,pm8150b-gpio", .data = (void *) 12 },
1215 { .compatible = "qcom,pm8150l-gpio", .data = (void *) 12 },
1216 { .compatible = "qcom,pmc8180c-gpio", .data = (void *) 12 },
1217 { .compatible = "qcom,pm8226-gpio", .data = (void *) 8 },
1218 { .compatible = "qcom,pm8350-gpio", .data = (void *) 10 },
1219 { .compatible = "qcom,pm8350b-gpio", .data = (void *) 8 },
1220 { .compatible = "qcom,pm8350c-gpio", .data = (void *) 9 },
1221 { .compatible = "qcom,pm8450-gpio", .data = (void *) 4 },
1222 { .compatible = "qcom,pm8916-gpio", .data = (void *) 4 },
1223 { .compatible = "qcom,pm8941-gpio", .data = (void *) 36 },
1225 { .compatible = "qcom,pm8950-gpio", .data = (void *) 8 },
1226 { .compatible = "qcom,pm8994-gpio", .data = (void *) 22 },
1227 { .compatible = "qcom,pm8998-gpio", .data = (void *) 26 },
1228 { .compatible = "qcom,pma8084-gpio", .data = (void *) 22 },
1229 { .compatible = "qcom,pmi8950-gpio", .data = (void *) 2 },
1230 { .compatible = "qcom,pmi8994-gpio", .data = (void *) 10 },
1231 { .compatible = "qcom,pmi8998-gpio", .data = (void *) 14 },
1232 { .compatible = "qcom,pmk8350-gpio", .data = (void *) 4 },
1233 { .compatible = "qcom,pmm8155au-gpio", .data = (void *) 10 },
1235 { .compatible = "qcom,pmp8074-gpio", .data = (void *) 12 },
1236 { .compatible = "qcom,pmr735a-gpio", .data = (void *) 4 },
1237 { .compatible = "qcom,pmr735b-gpio", .data = (void *) 4 },
1239 { .compatible = "qcom,pms405-gpio", .data = (void *) 12 },
1241 { .compatible = "qcom,pmx55-gpio", .data = (void *) 11 },
1242 { .compatible = "qcom,pmx65-gpio", .data = (void *) 16 },
1250 .name = "qcom-spmi-gpio",
1259 MODULE_AUTHOR("Ivan T. Ivanov <iivanov@mm-sol.com>");
1261 MODULE_ALIAS("platform:qcom-spmi-gpio");