1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2013, Sony Mobile Communications AB.
4 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
7 #include <linux/delay.h>
9 #include <linux/gpio/driver.h>
10 #include <linux/interrupt.h>
12 #include <linux/log2.h>
13 #include <linux/module.h>
15 #include <linux/platform_device.h>
17 #include <linux/firmware/qcom/qcom_scm.h>
18 #include <linux/reboot.h>
19 #include <linux/seq_file.h>
20 #include <linux/slab.h>
21 #include <linux/spinlock.h>
23 #include <linux/pinctrl/machine.h>
24 #include <linux/pinctrl/pinconf-generic.h>
25 #include <linux/pinctrl/pinconf.h>
26 #include <linux/pinctrl/pinmux.h>
28 #include <linux/soc/qcom/irq.h>
31 #include "../pinconf.h"
32 #include "../pinctrl-utils.h"
34 #include "pinctrl-msm.h"
36 #define MAX_NR_GPIO 300
37 #define MAX_NR_TILES 4
38 #define PS_HOLD_OFFSET 0x820
41 * struct msm_pinctrl - state for a pinctrl-msm device
42 * @dev: device handle.
43 * @pctrl: pinctrl handle.
44 * @chip: gpiochip handle.
45 * @desc: pin controller descriptor
46 * @restart_nb: restart notifier block.
47 * @irq: parent irq for the TLMM irq_chip.
48 * @intr_target_use_scm: route irq to application cpu using scm calls
49 * @lock: Spinlock to protect register resources as well
50 * as msm_pinctrl data structures.
51 * @enabled_irqs: Bitmap of currently enabled irqs.
52 * @dual_edge_irqs: Bitmap of irqs that need sw emulated dual edge
54 * @skip_wake_irqs: Skip IRQs that are handled by wakeup interrupt controller
55 * @disabled_for_mux: These IRQs were disabled because we muxed away.
56 * @ever_gpio: This bit is set the first time we mux a pin to gpio_func.
57 * @soc: Reference to soc_data of platform specific data.
58 * @regs: Base addresses for the TLMM tiles.
59 * @phys_base: Physical base address
63 struct pinctrl_dev *pctrl;
64 struct gpio_chip chip;
65 struct pinctrl_desc desc;
66 struct notifier_block restart_nb;
70 bool intr_target_use_scm;
74 DECLARE_BITMAP(dual_edge_irqs, MAX_NR_GPIO);
75 DECLARE_BITMAP(enabled_irqs, MAX_NR_GPIO);
76 DECLARE_BITMAP(skip_wake_irqs, MAX_NR_GPIO);
77 DECLARE_BITMAP(disabled_for_mux, MAX_NR_GPIO);
78 DECLARE_BITMAP(ever_gpio, MAX_NR_GPIO);
80 const struct msm_pinctrl_soc_data *soc;
81 void __iomem *regs[MAX_NR_TILES];
82 u32 phys_base[MAX_NR_TILES];
85 #define MSM_ACCESSOR(name) \
86 static u32 msm_readl_##name(struct msm_pinctrl *pctrl, \
87 const struct msm_pingroup *g) \
89 return readl(pctrl->regs[g->tile] + g->name##_reg); \
91 static void msm_writel_##name(u32 val, struct msm_pinctrl *pctrl, \
92 const struct msm_pingroup *g) \
94 writel(val, pctrl->regs[g->tile] + g->name##_reg); \
99 MSM_ACCESSOR(intr_cfg)
100 MSM_ACCESSOR(intr_status)
101 MSM_ACCESSOR(intr_target)
103 static void msm_ack_intr_status(struct msm_pinctrl *pctrl,
104 const struct msm_pingroup *g)
106 u32 val = g->intr_ack_high ? BIT(g->intr_status_bit) : 0;
108 msm_writel_intr_status(val, pctrl, g);
111 static int msm_get_groups_count(struct pinctrl_dev *pctldev)
113 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
115 return pctrl->soc->ngroups;
118 static const char *msm_get_group_name(struct pinctrl_dev *pctldev,
121 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
123 return pctrl->soc->groups[group].grp.name;
126 static int msm_get_group_pins(struct pinctrl_dev *pctldev,
128 const unsigned **pins,
131 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
133 *pins = pctrl->soc->groups[group].grp.pins;
134 *num_pins = pctrl->soc->groups[group].grp.npins;
138 static const struct pinctrl_ops msm_pinctrl_ops = {
139 .get_groups_count = msm_get_groups_count,
140 .get_group_name = msm_get_group_name,
141 .get_group_pins = msm_get_group_pins,
142 .dt_node_to_map = pinconf_generic_dt_node_to_map_group,
143 .dt_free_map = pinctrl_utils_free_map,
146 static int msm_pinmux_request(struct pinctrl_dev *pctldev, unsigned offset)
148 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
149 struct gpio_chip *chip = &pctrl->chip;
151 return gpiochip_line_is_valid(chip, offset) ? 0 : -EINVAL;
154 static int msm_get_functions_count(struct pinctrl_dev *pctldev)
156 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
158 return pctrl->soc->nfunctions;
161 static const char *msm_get_function_name(struct pinctrl_dev *pctldev,
164 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
166 return pctrl->soc->functions[function].name;
169 static int msm_get_function_groups(struct pinctrl_dev *pctldev,
171 const char * const **groups,
172 unsigned * const num_groups)
174 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
176 *groups = pctrl->soc->functions[function].groups;
177 *num_groups = pctrl->soc->functions[function].ngroups;
181 static int msm_pinmux_set_mux(struct pinctrl_dev *pctldev,
185 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
186 struct gpio_chip *gc = &pctrl->chip;
187 unsigned int irq = irq_find_mapping(gc->irq.domain, group);
188 struct irq_data *d = irq_get_irq_data(irq);
189 unsigned int gpio_func = pctrl->soc->gpio_func;
190 unsigned int egpio_func = pctrl->soc->egpio_func;
191 const struct msm_pingroup *g;
196 g = &pctrl->soc->groups[group];
197 mask = GENMASK(g->mux_bit + order_base_2(g->nfuncs) - 1, g->mux_bit);
199 for (i = 0; i < g->nfuncs; i++) {
200 if (g->funcs[i] == function)
204 if (WARN_ON(i == g->nfuncs))
208 * If an GPIO interrupt is setup on this pin then we need special
209 * handling. Specifically interrupt detection logic will still see
210 * the pin twiddle even when we're muxed away.
212 * When we see a pin with an interrupt setup on it then we'll disable
213 * (mask) interrupts on it when we mux away until we mux back. Note
214 * that disable_irq() refcounts and interrupts are disabled as long as
215 * at least one disable_irq() has been called.
217 if (d && i != gpio_func &&
218 !test_and_set_bit(d->hwirq, pctrl->disabled_for_mux))
221 raw_spin_lock_irqsave(&pctrl->lock, flags);
223 val = msm_readl_ctl(pctrl, g);
226 * If this is the first time muxing to GPIO and the direction is
227 * output, make sure that we're not going to be glitching the pin
228 * by reading the current state of the pin and setting it as the
231 if (i == gpio_func && (val & BIT(g->oe_bit)) &&
232 !test_and_set_bit(group, pctrl->ever_gpio)) {
233 u32 io_val = msm_readl_io(pctrl, g);
235 if (io_val & BIT(g->in_bit)) {
236 if (!(io_val & BIT(g->out_bit)))
237 msm_writel_io(io_val | BIT(g->out_bit), pctrl, g);
239 if (io_val & BIT(g->out_bit))
240 msm_writel_io(io_val & ~BIT(g->out_bit), pctrl, g);
244 if (egpio_func && i == egpio_func) {
245 if (val & BIT(g->egpio_present))
246 val &= ~BIT(g->egpio_enable);
249 val |= i << g->mux_bit;
250 /* Claim ownership of pin if egpio capable */
251 if (egpio_func && val & BIT(g->egpio_present))
252 val |= BIT(g->egpio_enable);
255 msm_writel_ctl(val, pctrl, g);
257 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
259 if (d && i == gpio_func &&
260 test_and_clear_bit(d->hwirq, pctrl->disabled_for_mux)) {
262 * Clear interrupts detected while not GPIO since we only
265 if (d->parent_data && test_bit(d->hwirq, pctrl->skip_wake_irqs))
266 irq_chip_set_parent_state(d, IRQCHIP_STATE_PENDING, false);
268 msm_ack_intr_status(pctrl, g);
276 static int msm_pinmux_request_gpio(struct pinctrl_dev *pctldev,
277 struct pinctrl_gpio_range *range,
280 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
281 const struct msm_pingroup *g = &pctrl->soc->groups[offset];
283 /* No funcs? Probably ACPI so can't do anything here */
287 return msm_pinmux_set_mux(pctldev, g->funcs[pctrl->soc->gpio_func], offset);
290 static const struct pinmux_ops msm_pinmux_ops = {
291 .request = msm_pinmux_request,
292 .get_functions_count = msm_get_functions_count,
293 .get_function_name = msm_get_function_name,
294 .get_function_groups = msm_get_function_groups,
295 .gpio_request_enable = msm_pinmux_request_gpio,
296 .set_mux = msm_pinmux_set_mux,
299 static int msm_config_reg(struct msm_pinctrl *pctrl,
300 const struct msm_pingroup *g,
306 case PIN_CONFIG_BIAS_DISABLE:
307 case PIN_CONFIG_BIAS_PULL_DOWN:
308 case PIN_CONFIG_BIAS_BUS_HOLD:
309 case PIN_CONFIG_BIAS_PULL_UP:
313 *mask |= BIT(g->i2c_pull_bit) >> *bit;
315 case PIN_CONFIG_DRIVE_OPEN_DRAIN:
319 case PIN_CONFIG_DRIVE_STRENGTH:
323 case PIN_CONFIG_OUTPUT:
324 case PIN_CONFIG_INPUT_ENABLE:
325 case PIN_CONFIG_OUTPUT_ENABLE:
336 #define MSM_NO_PULL 0
337 #define MSM_PULL_DOWN 1
339 #define MSM_PULL_UP_NO_KEEPER 2
340 #define MSM_PULL_UP 3
341 #define MSM_I2C_STRONG_PULL_UP 2200
343 static unsigned msm_regval_to_drive(u32 val)
345 return (val + 1) * 2;
348 static int msm_config_group_get(struct pinctrl_dev *pctldev,
350 unsigned long *config)
352 const struct msm_pingroup *g;
353 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
354 unsigned param = pinconf_to_config_param(*config);
361 g = &pctrl->soc->groups[group];
363 ret = msm_config_reg(pctrl, g, param, &mask, &bit);
367 val = msm_readl_ctl(pctrl, g);
368 arg = (val >> bit) & mask;
370 /* Convert register value to pinconf value */
372 case PIN_CONFIG_BIAS_DISABLE:
373 if (arg != MSM_NO_PULL)
377 case PIN_CONFIG_BIAS_PULL_DOWN:
378 if (arg != MSM_PULL_DOWN)
382 case PIN_CONFIG_BIAS_BUS_HOLD:
383 if (pctrl->soc->pull_no_keeper)
386 if (arg != MSM_KEEPER)
390 case PIN_CONFIG_BIAS_PULL_UP:
391 if (pctrl->soc->pull_no_keeper)
392 arg = arg == MSM_PULL_UP_NO_KEEPER;
393 else if (arg & BIT(g->i2c_pull_bit))
394 arg = MSM_I2C_STRONG_PULL_UP;
396 arg = arg == MSM_PULL_UP;
400 case PIN_CONFIG_DRIVE_OPEN_DRAIN:
401 /* Pin is not open-drain */
406 case PIN_CONFIG_DRIVE_STRENGTH:
407 arg = msm_regval_to_drive(arg);
409 case PIN_CONFIG_OUTPUT:
410 /* Pin is not output */
414 val = msm_readl_io(pctrl, g);
415 arg = !!(val & BIT(g->in_bit));
417 case PIN_CONFIG_OUTPUT_ENABLE:
425 *config = pinconf_to_config_packed(param, arg);
430 static int msm_config_group_set(struct pinctrl_dev *pctldev,
432 unsigned long *configs,
433 unsigned num_configs)
435 const struct msm_pingroup *g;
436 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
446 g = &pctrl->soc->groups[group];
448 for (i = 0; i < num_configs; i++) {
449 param = pinconf_to_config_param(configs[i]);
450 arg = pinconf_to_config_argument(configs[i]);
452 ret = msm_config_reg(pctrl, g, param, &mask, &bit);
456 /* Convert pinconf values to register values */
458 case PIN_CONFIG_BIAS_DISABLE:
461 case PIN_CONFIG_BIAS_PULL_DOWN:
464 case PIN_CONFIG_BIAS_BUS_HOLD:
465 if (pctrl->soc->pull_no_keeper)
470 case PIN_CONFIG_BIAS_PULL_UP:
471 if (pctrl->soc->pull_no_keeper)
472 arg = MSM_PULL_UP_NO_KEEPER;
473 else if (g->i2c_pull_bit && arg == MSM_I2C_STRONG_PULL_UP)
474 arg = BIT(g->i2c_pull_bit) | MSM_PULL_UP;
478 case PIN_CONFIG_DRIVE_OPEN_DRAIN:
481 case PIN_CONFIG_DRIVE_STRENGTH:
482 /* Check for invalid values */
483 if (arg > 16 || arg < 2 || (arg % 2) != 0)
488 case PIN_CONFIG_OUTPUT:
489 /* set output value */
490 raw_spin_lock_irqsave(&pctrl->lock, flags);
491 val = msm_readl_io(pctrl, g);
493 val |= BIT(g->out_bit);
495 val &= ~BIT(g->out_bit);
496 msm_writel_io(val, pctrl, g);
497 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
502 case PIN_CONFIG_INPUT_ENABLE:
504 * According to pinctrl documentation this should
505 * actually be a no-op.
507 * The docs are explicit that "this does not affect
508 * the pin's ability to drive output" but what we do
509 * here is to modify the output enable bit. Thus, to
510 * follow the docs we should remove that.
512 * The docs say that we should enable any relevant
513 * input buffer, but TLMM there is no input buffer that
514 * can be enabled/disabled. It's always on.
516 * The points above, explain why this _should_ be a
517 * no-op. However, for historical reasons and to
518 * support old device trees, we'll violate the docs
519 * and still affect the output.
521 * It should further be noted that this old historical
522 * behavior actually overrides arg to 0. That means
523 * that "input-enable" and "input-disable" in a device
524 * tree would _both_ disable the output. We'll
525 * continue to preserve this behavior as well since
526 * we have no other use for this attribute.
530 case PIN_CONFIG_OUTPUT_ENABLE:
534 dev_err(pctrl->dev, "Unsupported config parameter: %x\n",
539 /* Range-check user-supplied value */
541 dev_err(pctrl->dev, "config %x: %x is invalid\n", param, arg);
545 raw_spin_lock_irqsave(&pctrl->lock, flags);
546 val = msm_readl_ctl(pctrl, g);
547 val &= ~(mask << bit);
549 msm_writel_ctl(val, pctrl, g);
550 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
556 static const struct pinconf_ops msm_pinconf_ops = {
558 .pin_config_group_get = msm_config_group_get,
559 .pin_config_group_set = msm_config_group_set,
562 static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
564 const struct msm_pingroup *g;
565 struct msm_pinctrl *pctrl = gpiochip_get_data(chip);
569 g = &pctrl->soc->groups[offset];
571 raw_spin_lock_irqsave(&pctrl->lock, flags);
573 val = msm_readl_ctl(pctrl, g);
574 val &= ~BIT(g->oe_bit);
575 msm_writel_ctl(val, pctrl, g);
577 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
582 static int msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value)
584 const struct msm_pingroup *g;
585 struct msm_pinctrl *pctrl = gpiochip_get_data(chip);
589 g = &pctrl->soc->groups[offset];
591 raw_spin_lock_irqsave(&pctrl->lock, flags);
593 val = msm_readl_io(pctrl, g);
595 val |= BIT(g->out_bit);
597 val &= ~BIT(g->out_bit);
598 msm_writel_io(val, pctrl, g);
600 val = msm_readl_ctl(pctrl, g);
601 val |= BIT(g->oe_bit);
602 msm_writel_ctl(val, pctrl, g);
604 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
609 static int msm_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
611 struct msm_pinctrl *pctrl = gpiochip_get_data(chip);
612 const struct msm_pingroup *g;
615 g = &pctrl->soc->groups[offset];
617 val = msm_readl_ctl(pctrl, g);
619 return val & BIT(g->oe_bit) ? GPIO_LINE_DIRECTION_OUT :
620 GPIO_LINE_DIRECTION_IN;
623 static int msm_gpio_get(struct gpio_chip *chip, unsigned offset)
625 const struct msm_pingroup *g;
626 struct msm_pinctrl *pctrl = gpiochip_get_data(chip);
629 g = &pctrl->soc->groups[offset];
631 val = msm_readl_io(pctrl, g);
632 return !!(val & BIT(g->in_bit));
635 static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
637 const struct msm_pingroup *g;
638 struct msm_pinctrl *pctrl = gpiochip_get_data(chip);
642 g = &pctrl->soc->groups[offset];
644 raw_spin_lock_irqsave(&pctrl->lock, flags);
646 val = msm_readl_io(pctrl, g);
648 val |= BIT(g->out_bit);
650 val &= ~BIT(g->out_bit);
651 msm_writel_io(val, pctrl, g);
653 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
656 #ifdef CONFIG_DEBUG_FS
658 static void msm_gpio_dbg_show_one(struct seq_file *s,
659 struct pinctrl_dev *pctldev,
660 struct gpio_chip *chip,
664 const struct msm_pingroup *g;
665 struct msm_pinctrl *pctrl = gpiochip_get_data(chip);
674 static const char * const pulls_keeper[] = {
681 static const char * const pulls_no_keeper[] = {
687 if (!gpiochip_line_is_valid(chip, offset))
690 g = &pctrl->soc->groups[offset];
691 ctl_reg = msm_readl_ctl(pctrl, g);
692 io_reg = msm_readl_io(pctrl, g);
694 is_out = !!(ctl_reg & BIT(g->oe_bit));
695 func = (ctl_reg >> g->mux_bit) & 7;
696 drive = (ctl_reg >> g->drv_bit) & 7;
697 pull = (ctl_reg >> g->pull_bit) & 3;
699 if (pctrl->soc->egpio_func && ctl_reg & BIT(g->egpio_present))
700 egpio_enable = !(ctl_reg & BIT(g->egpio_enable));
703 val = !!(io_reg & BIT(g->out_bit));
705 val = !!(io_reg & BIT(g->in_bit));
708 seq_printf(s, " %-8s: egpio\n", g->grp.name);
712 seq_printf(s, " %-8s: %-3s", g->grp.name, is_out ? "out" : "in");
713 seq_printf(s, " %-4s func%d", val ? "high" : "low", func);
714 seq_printf(s, " %dmA", msm_regval_to_drive(drive));
715 if (pctrl->soc->pull_no_keeper)
716 seq_printf(s, " %s", pulls_no_keeper[pull]);
718 seq_printf(s, " %s", pulls_keeper[pull]);
722 static void msm_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
724 unsigned gpio = chip->base;
727 for (i = 0; i < chip->ngpio; i++, gpio++)
728 msm_gpio_dbg_show_one(s, NULL, chip, i, gpio);
732 #define msm_gpio_dbg_show NULL
735 static int msm_gpio_init_valid_mask(struct gpio_chip *gc,
736 unsigned long *valid_mask,
739 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
742 const int *reserved = pctrl->soc->reserved_gpios;
745 /* Remove driver-provided reserved GPIOs from valid_mask */
747 for (i = 0; reserved[i] >= 0; i++) {
748 if (i >= ngpios || reserved[i] >= ngpios) {
749 dev_err(pctrl->dev, "invalid list of reserved GPIOs\n");
752 clear_bit(reserved[i], valid_mask);
758 /* The number of GPIOs in the ACPI tables */
759 len = ret = device_property_count_u16(pctrl->dev, "gpios");
766 tmp = kmalloc_array(len, sizeof(*tmp), GFP_KERNEL);
770 ret = device_property_read_u16_array(pctrl->dev, "gpios", tmp, len);
772 dev_err(pctrl->dev, "could not read list of GPIOs\n");
776 bitmap_zero(valid_mask, ngpios);
777 for (i = 0; i < len; i++)
778 set_bit(tmp[i], valid_mask);
785 static const struct gpio_chip msm_gpio_template = {
786 .direction_input = msm_gpio_direction_input,
787 .direction_output = msm_gpio_direction_output,
788 .get_direction = msm_gpio_get_direction,
791 .request = gpiochip_generic_request,
792 .free = gpiochip_generic_free,
793 .dbg_show = msm_gpio_dbg_show,
796 /* For dual-edge interrupts in software, since some hardware has no
799 * At appropriate moments, this function may be called to flip the polarity
800 * settings of both-edge irq lines to try and catch the next edge.
802 * The attempt is considered successful if:
803 * - the status bit goes high, indicating that an edge was caught, or
804 * - the input value of the gpio doesn't change during the attempt.
805 * If the value changes twice during the process, that would cause the first
806 * test to fail but would force the second, as two opposite
807 * transitions would cause a detection no matter the polarity setting.
809 * The do-loop tries to sledge-hammer closed the timing hole between
810 * the initial value-read and the polarity-write - if the line value changes
811 * during that window, an interrupt is lost, the new polarity setting is
812 * incorrect, and the first success test will fail, causing a retry.
814 * Algorithm comes from Google's msmgpio driver.
816 static void msm_gpio_update_dual_edge_pos(struct msm_pinctrl *pctrl,
817 const struct msm_pingroup *g,
820 int loop_limit = 100;
821 unsigned val, val2, intstat;
825 val = msm_readl_io(pctrl, g) & BIT(g->in_bit);
827 pol = msm_readl_intr_cfg(pctrl, g);
828 pol ^= BIT(g->intr_polarity_bit);
829 msm_writel_intr_cfg(pol, pctrl, g);
831 val2 = msm_readl_io(pctrl, g) & BIT(g->in_bit);
832 intstat = msm_readl_intr_status(pctrl, g);
833 if (intstat || (val == val2))
835 } while (loop_limit-- > 0);
836 dev_err(pctrl->dev, "dual-edge irq failed to stabilize, %#08x != %#08x\n",
840 static void msm_gpio_irq_mask(struct irq_data *d)
842 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
843 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
844 const struct msm_pingroup *g;
849 irq_chip_mask_parent(d);
851 if (test_bit(d->hwirq, pctrl->skip_wake_irqs))
854 g = &pctrl->soc->groups[d->hwirq];
856 raw_spin_lock_irqsave(&pctrl->lock, flags);
858 val = msm_readl_intr_cfg(pctrl, g);
860 * There are two bits that control interrupt forwarding to the CPU. The
861 * RAW_STATUS_EN bit causes the level or edge sensed on the line to be
862 * latched into the interrupt status register when the hardware detects
863 * an irq that it's configured for (either edge for edge type or level
864 * for level type irq). The 'non-raw' status enable bit causes the
865 * hardware to assert the summary interrupt to the CPU if the latched
866 * status bit is set. There's a bug though, the edge detection logic
867 * seems to have a problem where toggling the RAW_STATUS_EN bit may
868 * cause the status bit to latch spuriously when there isn't any edge
869 * so we can't touch that bit for edge type irqs and we have to keep
870 * the bit set anyway so that edges are latched while the line is masked.
872 * To make matters more complicated, leaving the RAW_STATUS_EN bit
873 * enabled all the time causes level interrupts to re-latch into the
874 * status register because the level is still present on the line after
875 * we ack it. We clear the raw status enable bit during mask here and
876 * set the bit on unmask so the interrupt can't latch into the hardware
879 if (irqd_get_trigger_type(d) & IRQ_TYPE_LEVEL_MASK)
880 val &= ~BIT(g->intr_raw_status_bit);
882 val &= ~BIT(g->intr_enable_bit);
883 msm_writel_intr_cfg(val, pctrl, g);
885 clear_bit(d->hwirq, pctrl->enabled_irqs);
887 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
890 static void msm_gpio_irq_unmask(struct irq_data *d)
892 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
893 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
894 const struct msm_pingroup *g;
899 irq_chip_unmask_parent(d);
901 if (test_bit(d->hwirq, pctrl->skip_wake_irqs))
904 g = &pctrl->soc->groups[d->hwirq];
906 raw_spin_lock_irqsave(&pctrl->lock, flags);
908 val = msm_readl_intr_cfg(pctrl, g);
909 val |= BIT(g->intr_raw_status_bit);
910 val |= BIT(g->intr_enable_bit);
911 msm_writel_intr_cfg(val, pctrl, g);
913 set_bit(d->hwirq, pctrl->enabled_irqs);
915 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
918 static void msm_gpio_irq_enable(struct irq_data *d)
920 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
921 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
923 gpiochip_enable_irq(gc, d->hwirq);
926 irq_chip_enable_parent(d);
928 if (!test_bit(d->hwirq, pctrl->skip_wake_irqs))
929 msm_gpio_irq_unmask(d);
932 static void msm_gpio_irq_disable(struct irq_data *d)
934 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
935 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
938 irq_chip_disable_parent(d);
940 if (!test_bit(d->hwirq, pctrl->skip_wake_irqs))
941 msm_gpio_irq_mask(d);
943 gpiochip_disable_irq(gc, d->hwirq);
947 * msm_gpio_update_dual_edge_parent() - Prime next edge for IRQs handled by parent.
950 * This is much like msm_gpio_update_dual_edge_pos() but for IRQs that are
951 * normally handled by the parent irqchip. The logic here is slightly
952 * different due to what's easy to do with our parent, but in principle it's
955 static void msm_gpio_update_dual_edge_parent(struct irq_data *d)
957 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
958 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
959 const struct msm_pingroup *g = &pctrl->soc->groups[d->hwirq];
960 int loop_limit = 100;
964 /* Read the value and make a guess about what edge we need to catch */
965 val = msm_readl_io(pctrl, g) & BIT(g->in_bit);
966 type = val ? IRQ_TYPE_EDGE_FALLING : IRQ_TYPE_EDGE_RISING;
969 /* Set the parent to catch the next edge */
970 irq_chip_set_type_parent(d, type);
973 * Possibly the line changed between when we last read "val"
974 * (and decided what edge we needed) and when set the edge.
975 * If the value didn't change (or changed and then changed
976 * back) then we're done.
978 val = msm_readl_io(pctrl, g) & BIT(g->in_bit);
979 if (type == IRQ_TYPE_EDGE_RISING) {
982 type = IRQ_TYPE_EDGE_FALLING;
983 } else if (type == IRQ_TYPE_EDGE_FALLING) {
986 type = IRQ_TYPE_EDGE_RISING;
988 } while (loop_limit-- > 0);
989 dev_warn_once(pctrl->dev, "dual-edge irq failed to stabilize\n");
992 static void msm_gpio_irq_ack(struct irq_data *d)
994 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
995 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
996 const struct msm_pingroup *g;
999 if (test_bit(d->hwirq, pctrl->skip_wake_irqs)) {
1000 if (test_bit(d->hwirq, pctrl->dual_edge_irqs))
1001 msm_gpio_update_dual_edge_parent(d);
1005 g = &pctrl->soc->groups[d->hwirq];
1007 raw_spin_lock_irqsave(&pctrl->lock, flags);
1009 msm_ack_intr_status(pctrl, g);
1011 if (test_bit(d->hwirq, pctrl->dual_edge_irqs))
1012 msm_gpio_update_dual_edge_pos(pctrl, g, d);
1014 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
1017 static void msm_gpio_irq_eoi(struct irq_data *d)
1022 d->chip->irq_eoi(d);
1025 static bool msm_gpio_needs_dual_edge_parent_workaround(struct irq_data *d,
1028 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1029 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
1031 return type == IRQ_TYPE_EDGE_BOTH &&
1032 pctrl->soc->wakeirq_dual_edge_errata && d->parent_data &&
1033 test_bit(d->hwirq, pctrl->skip_wake_irqs);
1036 static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type)
1038 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1039 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
1040 const struct msm_pingroup *g;
1041 u32 intr_target_mask = GENMASK(2, 0);
1042 unsigned long flags;
1046 if (msm_gpio_needs_dual_edge_parent_workaround(d, type)) {
1047 set_bit(d->hwirq, pctrl->dual_edge_irqs);
1048 irq_set_handler_locked(d, handle_fasteoi_ack_irq);
1049 msm_gpio_update_dual_edge_parent(d);
1054 irq_chip_set_type_parent(d, type);
1056 if (test_bit(d->hwirq, pctrl->skip_wake_irqs)) {
1057 clear_bit(d->hwirq, pctrl->dual_edge_irqs);
1058 irq_set_handler_locked(d, handle_fasteoi_irq);
1062 g = &pctrl->soc->groups[d->hwirq];
1064 raw_spin_lock_irqsave(&pctrl->lock, flags);
1067 * For hw without possibility of detecting both edges
1069 if (g->intr_detection_width == 1 && type == IRQ_TYPE_EDGE_BOTH)
1070 set_bit(d->hwirq, pctrl->dual_edge_irqs);
1072 clear_bit(d->hwirq, pctrl->dual_edge_irqs);
1074 /* Route interrupts to application cpu.
1075 * With intr_target_use_scm interrupts are routed to
1076 * application cpu using scm calls.
1078 if (g->intr_target_width)
1079 intr_target_mask = GENMASK(g->intr_target_width - 1, 0);
1081 if (pctrl->intr_target_use_scm) {
1082 u32 addr = pctrl->phys_base[0] + g->intr_target_reg;
1085 qcom_scm_io_readl(addr, &val);
1086 val &= ~(intr_target_mask << g->intr_target_bit);
1087 val |= g->intr_target_kpss_val << g->intr_target_bit;
1089 ret = qcom_scm_io_writel(addr, val);
1092 "Failed routing %lu interrupt to Apps proc",
1095 val = msm_readl_intr_target(pctrl, g);
1096 val &= ~(intr_target_mask << g->intr_target_bit);
1097 val |= g->intr_target_kpss_val << g->intr_target_bit;
1098 msm_writel_intr_target(val, pctrl, g);
1101 /* Update configuration for gpio.
1102 * RAW_STATUS_EN is left on for all gpio irqs. Due to the
1103 * internal circuitry of TLMM, toggling the RAW_STATUS
1104 * could cause the INTR_STATUS to be set for EDGE interrupts.
1106 val = msm_readl_intr_cfg(pctrl, g);
1107 was_enabled = val & BIT(g->intr_raw_status_bit);
1108 val |= BIT(g->intr_raw_status_bit);
1109 if (g->intr_detection_width == 2) {
1110 val &= ~(3 << g->intr_detection_bit);
1111 val &= ~(1 << g->intr_polarity_bit);
1113 case IRQ_TYPE_EDGE_RISING:
1114 val |= 1 << g->intr_detection_bit;
1115 val |= BIT(g->intr_polarity_bit);
1117 case IRQ_TYPE_EDGE_FALLING:
1118 val |= 2 << g->intr_detection_bit;
1119 val |= BIT(g->intr_polarity_bit);
1121 case IRQ_TYPE_EDGE_BOTH:
1122 val |= 3 << g->intr_detection_bit;
1123 val |= BIT(g->intr_polarity_bit);
1125 case IRQ_TYPE_LEVEL_LOW:
1127 case IRQ_TYPE_LEVEL_HIGH:
1128 val |= BIT(g->intr_polarity_bit);
1131 } else if (g->intr_detection_width == 1) {
1132 val &= ~(1 << g->intr_detection_bit);
1133 val &= ~(1 << g->intr_polarity_bit);
1135 case IRQ_TYPE_EDGE_RISING:
1136 val |= BIT(g->intr_detection_bit);
1137 val |= BIT(g->intr_polarity_bit);
1139 case IRQ_TYPE_EDGE_FALLING:
1140 val |= BIT(g->intr_detection_bit);
1142 case IRQ_TYPE_EDGE_BOTH:
1143 val |= BIT(g->intr_detection_bit);
1144 val |= BIT(g->intr_polarity_bit);
1146 case IRQ_TYPE_LEVEL_LOW:
1148 case IRQ_TYPE_LEVEL_HIGH:
1149 val |= BIT(g->intr_polarity_bit);
1155 msm_writel_intr_cfg(val, pctrl, g);
1158 * The first time we set RAW_STATUS_EN it could trigger an interrupt.
1159 * Clear the interrupt. This is safe because we have
1160 * IRQCHIP_SET_TYPE_MASKED.
1163 msm_ack_intr_status(pctrl, g);
1165 if (test_bit(d->hwirq, pctrl->dual_edge_irqs))
1166 msm_gpio_update_dual_edge_pos(pctrl, g, d);
1168 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
1170 if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
1171 irq_set_handler_locked(d, handle_level_irq);
1172 else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
1173 irq_set_handler_locked(d, handle_edge_irq);
1178 static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
1180 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1181 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
1184 * While they may not wake up when the TLMM is powered off,
1185 * some GPIOs would like to wakeup the system from suspend
1186 * when TLMM is powered on. To allow that, enable the GPIO
1187 * summary line to be wakeup capable at GIC.
1189 if (d->parent_data && test_bit(d->hwirq, pctrl->skip_wake_irqs))
1190 return irq_chip_set_wake_parent(d, on);
1192 return irq_set_irq_wake(pctrl->irq, on);
1195 static int msm_gpio_irq_reqres(struct irq_data *d)
1197 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1198 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
1201 if (!try_module_get(gc->owner))
1204 ret = msm_pinmux_request_gpio(pctrl->pctrl, NULL, d->hwirq);
1207 msm_gpio_direction_input(gc, d->hwirq);
1209 if (gpiochip_lock_as_irq(gc, d->hwirq)) {
1211 "unable to lock HW IRQ %lu for IRQ\n",
1218 * The disable / clear-enable workaround we do in msm_pinmux_set_mux()
1219 * only works if disable is not lazy since we only clear any bogus
1220 * interrupt in hardware. Explicitly mark the interrupt as UNLAZY.
1222 irq_set_status_flags(d->irq, IRQ_DISABLE_UNLAZY);
1226 module_put(gc->owner);
1230 static void msm_gpio_irq_relres(struct irq_data *d)
1232 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1234 gpiochip_unlock_as_irq(gc, d->hwirq);
1235 module_put(gc->owner);
1238 static int msm_gpio_irq_set_affinity(struct irq_data *d,
1239 const struct cpumask *dest, bool force)
1241 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1242 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
1244 if (d->parent_data && test_bit(d->hwirq, pctrl->skip_wake_irqs))
1245 return irq_chip_set_affinity_parent(d, dest, force);
1250 static int msm_gpio_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu_info)
1252 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1253 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
1255 if (d->parent_data && test_bit(d->hwirq, pctrl->skip_wake_irqs))
1256 return irq_chip_set_vcpu_affinity_parent(d, vcpu_info);
1261 static void msm_gpio_irq_handler(struct irq_desc *desc)
1263 struct gpio_chip *gc = irq_desc_get_handler_data(desc);
1264 const struct msm_pingroup *g;
1265 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
1266 struct irq_chip *chip = irq_desc_get_chip(desc);
1271 chained_irq_enter(chip, desc);
1274 * Each pin has it's own IRQ status register, so use
1275 * enabled_irq bitmap to limit the number of reads.
1277 for_each_set_bit(i, pctrl->enabled_irqs, pctrl->chip.ngpio) {
1278 g = &pctrl->soc->groups[i];
1279 val = msm_readl_intr_status(pctrl, g);
1280 if (val & BIT(g->intr_status_bit)) {
1281 generic_handle_domain_irq(gc->irq.domain, i);
1286 /* No interrupts were flagged */
1288 handle_bad_irq(desc);
1290 chained_irq_exit(chip, desc);
1293 static int msm_gpio_wakeirq(struct gpio_chip *gc,
1295 unsigned int child_type,
1296 unsigned int *parent,
1297 unsigned int *parent_type)
1299 struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
1300 const struct msm_gpio_wakeirq_map *map;
1303 *parent = GPIO_NO_WAKE_IRQ;
1304 *parent_type = IRQ_TYPE_EDGE_RISING;
1306 for (i = 0; i < pctrl->soc->nwakeirq_map; i++) {
1307 map = &pctrl->soc->wakeirq_map[i];
1308 if (map->gpio == child) {
1309 *parent = map->wakeirq;
1317 static bool msm_gpio_needs_valid_mask(struct msm_pinctrl *pctrl)
1319 if (pctrl->soc->reserved_gpios)
1322 return device_property_count_u16(pctrl->dev, "gpios") > 0;
1325 static const struct irq_chip msm_gpio_irq_chip = {
1327 .irq_enable = msm_gpio_irq_enable,
1328 .irq_disable = msm_gpio_irq_disable,
1329 .irq_mask = msm_gpio_irq_mask,
1330 .irq_unmask = msm_gpio_irq_unmask,
1331 .irq_ack = msm_gpio_irq_ack,
1332 .irq_eoi = msm_gpio_irq_eoi,
1333 .irq_set_type = msm_gpio_irq_set_type,
1334 .irq_set_wake = msm_gpio_irq_set_wake,
1335 .irq_request_resources = msm_gpio_irq_reqres,
1336 .irq_release_resources = msm_gpio_irq_relres,
1337 .irq_set_affinity = msm_gpio_irq_set_affinity,
1338 .irq_set_vcpu_affinity = msm_gpio_irq_set_vcpu_affinity,
1339 .flags = (IRQCHIP_MASK_ON_SUSPEND |
1340 IRQCHIP_SET_TYPE_MASKED |
1341 IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND |
1345 static int msm_gpio_init(struct msm_pinctrl *pctrl)
1347 struct gpio_chip *chip;
1348 struct gpio_irq_chip *girq;
1350 unsigned gpio, ngpio = pctrl->soc->ngpios;
1351 struct device_node *np;
1354 if (WARN_ON(ngpio > MAX_NR_GPIO))
1357 chip = &pctrl->chip;
1359 chip->ngpio = ngpio;
1360 chip->label = dev_name(pctrl->dev);
1361 chip->parent = pctrl->dev;
1362 chip->owner = THIS_MODULE;
1363 if (msm_gpio_needs_valid_mask(pctrl))
1364 chip->init_valid_mask = msm_gpio_init_valid_mask;
1366 np = of_parse_phandle(pctrl->dev->of_node, "wakeup-parent", 0);
1368 chip->irq.parent_domain = irq_find_matching_host(np,
1371 if (!chip->irq.parent_domain)
1372 return -EPROBE_DEFER;
1373 chip->irq.child_to_parent_hwirq = msm_gpio_wakeirq;
1375 * Let's skip handling the GPIOs, if the parent irqchip
1376 * is handling the direct connect IRQ of the GPIO.
1378 skip = irq_domain_qcom_handle_wakeup(chip->irq.parent_domain);
1379 for (i = 0; skip && i < pctrl->soc->nwakeirq_map; i++) {
1380 gpio = pctrl->soc->wakeirq_map[i].gpio;
1381 set_bit(gpio, pctrl->skip_wake_irqs);
1386 gpio_irq_chip_set_chip(girq, &msm_gpio_irq_chip);
1387 girq->parent_handler = msm_gpio_irq_handler;
1388 girq->fwnode = dev_fwnode(pctrl->dev);
1389 girq->num_parents = 1;
1390 girq->parents = devm_kcalloc(pctrl->dev, 1, sizeof(*girq->parents),
1394 girq->default_type = IRQ_TYPE_NONE;
1395 girq->handler = handle_bad_irq;
1396 girq->parents[0] = pctrl->irq;
1398 ret = gpiochip_add_data(&pctrl->chip, pctrl);
1400 dev_err(pctrl->dev, "Failed register gpiochip\n");
1405 * For DeviceTree-supported systems, the gpio core checks the
1406 * pinctrl's device node for the "gpio-ranges" property.
1407 * If it is present, it takes care of adding the pin ranges
1408 * for the driver. In this case the driver can skip ahead.
1410 * In order to remain compatible with older, existing DeviceTree
1411 * files which don't set the "gpio-ranges" property or systems that
1412 * utilize ACPI the driver has to call gpiochip_add_pin_range().
1414 if (!of_property_read_bool(pctrl->dev->of_node, "gpio-ranges")) {
1415 ret = gpiochip_add_pin_range(&pctrl->chip,
1416 dev_name(pctrl->dev), 0, 0, chip->ngpio);
1418 dev_err(pctrl->dev, "Failed to add pin range\n");
1419 gpiochip_remove(&pctrl->chip);
1427 static int msm_ps_hold_restart(struct notifier_block *nb, unsigned long action,
1430 struct msm_pinctrl *pctrl = container_of(nb, struct msm_pinctrl, restart_nb);
1432 writel(0, pctrl->regs[0] + PS_HOLD_OFFSET);
1437 static struct msm_pinctrl *poweroff_pctrl;
1439 static void msm_ps_hold_poweroff(void)
1441 msm_ps_hold_restart(&poweroff_pctrl->restart_nb, 0, NULL);
1444 static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl)
1447 const struct pinfunction *func = pctrl->soc->functions;
1449 for (i = 0; i < pctrl->soc->nfunctions; i++)
1450 if (!strcmp(func[i].name, "ps_hold")) {
1451 pctrl->restart_nb.notifier_call = msm_ps_hold_restart;
1452 pctrl->restart_nb.priority = 128;
1453 if (register_restart_handler(&pctrl->restart_nb))
1455 "failed to setup restart handler.\n");
1456 poweroff_pctrl = pctrl;
1457 pm_power_off = msm_ps_hold_poweroff;
1462 static __maybe_unused int msm_pinctrl_suspend(struct device *dev)
1464 struct msm_pinctrl *pctrl = dev_get_drvdata(dev);
1466 return pinctrl_force_sleep(pctrl->pctrl);
1469 static __maybe_unused int msm_pinctrl_resume(struct device *dev)
1471 struct msm_pinctrl *pctrl = dev_get_drvdata(dev);
1473 return pinctrl_force_default(pctrl->pctrl);
1476 SIMPLE_DEV_PM_OPS(msm_pinctrl_dev_pm_ops, msm_pinctrl_suspend,
1477 msm_pinctrl_resume);
1479 EXPORT_SYMBOL(msm_pinctrl_dev_pm_ops);
1481 int msm_pinctrl_probe(struct platform_device *pdev,
1482 const struct msm_pinctrl_soc_data *soc_data)
1484 struct msm_pinctrl *pctrl;
1485 struct resource *res;
1489 pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL);
1493 pctrl->dev = &pdev->dev;
1494 pctrl->soc = soc_data;
1495 pctrl->chip = msm_gpio_template;
1496 pctrl->intr_target_use_scm = of_device_is_compatible(
1497 pctrl->dev->of_node,
1498 "qcom,ipq8064-pinctrl");
1500 raw_spin_lock_init(&pctrl->lock);
1502 if (soc_data->tiles) {
1503 for (i = 0; i < soc_data->ntiles; i++) {
1504 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
1505 soc_data->tiles[i]);
1506 pctrl->regs[i] = devm_ioremap_resource(&pdev->dev, res);
1507 if (IS_ERR(pctrl->regs[i]))
1508 return PTR_ERR(pctrl->regs[i]);
1511 pctrl->regs[0] = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
1512 if (IS_ERR(pctrl->regs[0]))
1513 return PTR_ERR(pctrl->regs[0]);
1515 pctrl->phys_base[0] = res->start;
1518 msm_pinctrl_setup_pm_reset(pctrl);
1520 pctrl->irq = platform_get_irq(pdev, 0);
1524 pctrl->desc.owner = THIS_MODULE;
1525 pctrl->desc.pctlops = &msm_pinctrl_ops;
1526 pctrl->desc.pmxops = &msm_pinmux_ops;
1527 pctrl->desc.confops = &msm_pinconf_ops;
1528 pctrl->desc.name = dev_name(&pdev->dev);
1529 pctrl->desc.pins = pctrl->soc->pins;
1530 pctrl->desc.npins = pctrl->soc->npins;
1532 pctrl->pctrl = devm_pinctrl_register(&pdev->dev, &pctrl->desc, pctrl);
1533 if (IS_ERR(pctrl->pctrl)) {
1534 dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
1535 return PTR_ERR(pctrl->pctrl);
1538 ret = msm_gpio_init(pctrl);
1542 platform_set_drvdata(pdev, pctrl);
1544 dev_dbg(&pdev->dev, "Probed Qualcomm pinctrl driver\n");
1548 EXPORT_SYMBOL(msm_pinctrl_probe);
1550 void msm_pinctrl_remove(struct platform_device *pdev)
1552 struct msm_pinctrl *pctrl = platform_get_drvdata(pdev);
1554 gpiochip_remove(&pctrl->chip);
1556 unregister_restart_handler(&pctrl->restart_nb);
1558 EXPORT_SYMBOL(msm_pinctrl_remove);
1560 MODULE_DESCRIPTION("Qualcomm Technologies, Inc. TLMM driver");
1561 MODULE_LICENSE("GPL v2");