1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2016-2022 NVIDIA Corporation
5 * Author: Thierry Reding <treding@nvidia.com>
6 * Dipen Patel <dpatel@nvidia.com>
9 #include <linux/gpio/driver.h>
10 #include <linux/hte.h>
11 #include <linux/interrupt.h>
12 #include <linux/irq.h>
13 #include <linux/module.h>
15 #include <linux/platform_device.h>
16 #include <linux/seq_file.h>
18 #include <dt-bindings/gpio/tegra186-gpio.h>
19 #include <dt-bindings/gpio/tegra194-gpio.h>
20 #include <dt-bindings/gpio/tegra234-gpio.h>
21 #include <dt-bindings/gpio/tegra241-gpio.h>
23 /* security registers */
24 #define TEGRA186_GPIO_CTL_SCR 0x0c
25 #define TEGRA186_GPIO_CTL_SCR_SEC_WEN BIT(28)
26 #define TEGRA186_GPIO_CTL_SCR_SEC_REN BIT(27)
28 #define TEGRA186_GPIO_INT_ROUTE_MAPPING(p, x) (0x14 + (p) * 0x20 + (x) * 4)
30 #define TEGRA186_GPIO_VM 0x00
31 #define TEGRA186_GPIO_VM_RW_MASK 0x03
32 #define TEGRA186_GPIO_SCR 0x04
33 #define TEGRA186_GPIO_SCR_PIN_SIZE 0x08
34 #define TEGRA186_GPIO_SCR_PORT_SIZE 0x40
35 #define TEGRA186_GPIO_SCR_SEC_WEN BIT(28)
36 #define TEGRA186_GPIO_SCR_SEC_REN BIT(27)
37 #define TEGRA186_GPIO_SCR_SEC_G1W BIT(9)
38 #define TEGRA186_GPIO_SCR_SEC_G1R BIT(1)
39 #define TEGRA186_GPIO_FULL_ACCESS (TEGRA186_GPIO_SCR_SEC_WEN | \
40 TEGRA186_GPIO_SCR_SEC_REN | \
41 TEGRA186_GPIO_SCR_SEC_G1R | \
42 TEGRA186_GPIO_SCR_SEC_G1W)
43 #define TEGRA186_GPIO_SCR_SEC_ENABLE (TEGRA186_GPIO_SCR_SEC_WEN | \
44 TEGRA186_GPIO_SCR_SEC_REN)
46 /* control registers */
47 #define TEGRA186_GPIO_ENABLE_CONFIG 0x00
48 #define TEGRA186_GPIO_ENABLE_CONFIG_ENABLE BIT(0)
49 #define TEGRA186_GPIO_ENABLE_CONFIG_OUT BIT(1)
50 #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_NONE (0x0 << 2)
51 #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_LEVEL (0x1 << 2)
52 #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_SINGLE_EDGE (0x2 << 2)
53 #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_DOUBLE_EDGE (0x3 << 2)
54 #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_MASK (0x3 << 2)
55 #define TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_LEVEL BIT(4)
56 #define TEGRA186_GPIO_ENABLE_CONFIG_DEBOUNCE BIT(5)
57 #define TEGRA186_GPIO_ENABLE_CONFIG_INTERRUPT BIT(6)
58 #define TEGRA186_GPIO_ENABLE_CONFIG_TIMESTAMP_FUNC BIT(7)
60 #define TEGRA186_GPIO_DEBOUNCE_CONTROL 0x04
61 #define TEGRA186_GPIO_DEBOUNCE_CONTROL_THRESHOLD(x) ((x) & 0xff)
63 #define TEGRA186_GPIO_INPUT 0x08
64 #define TEGRA186_GPIO_INPUT_HIGH BIT(0)
66 #define TEGRA186_GPIO_OUTPUT_CONTROL 0x0c
67 #define TEGRA186_GPIO_OUTPUT_CONTROL_FLOATED BIT(0)
69 #define TEGRA186_GPIO_OUTPUT_VALUE 0x10
70 #define TEGRA186_GPIO_OUTPUT_VALUE_HIGH BIT(0)
72 #define TEGRA186_GPIO_INTERRUPT_CLEAR 0x14
74 #define TEGRA186_GPIO_INTERRUPT_STATUS(x) (0x100 + (x) * 4)
76 struct tegra_gpio_port {
83 struct tegra186_pin_range {
88 struct tegra_gpio_soc {
89 const struct tegra_gpio_port *ports;
90 unsigned int num_ports;
92 unsigned int instance;
94 unsigned int num_irqs_per_bank;
96 const struct tegra186_pin_range *pin_ranges;
97 unsigned int num_pin_ranges;
104 struct gpio_chip gpio;
105 unsigned int num_irq;
108 const struct tegra_gpio_soc *soc;
109 unsigned int num_irqs_per_bank;
110 unsigned int num_banks;
112 void __iomem *secure;
116 static const struct tegra_gpio_port *
117 tegra186_gpio_get_port(struct tegra_gpio *gpio, unsigned int *pin)
119 unsigned int start = 0, i;
121 for (i = 0; i < gpio->soc->num_ports; i++) {
122 const struct tegra_gpio_port *port = &gpio->soc->ports[i];
124 if (*pin >= start && *pin < start + port->pins) {
135 static void __iomem *tegra186_gpio_get_base(struct tegra_gpio *gpio,
138 const struct tegra_gpio_port *port;
141 port = tegra186_gpio_get_port(gpio, &pin);
145 offset = port->bank * 0x1000 + port->port * 0x200;
147 return gpio->base + offset + pin * 0x20;
150 static void __iomem *tegra186_gpio_get_secure_base(struct tegra_gpio *gpio,
153 const struct tegra_gpio_port *port;
156 port = tegra186_gpio_get_port(gpio, &pin);
160 offset = port->bank * 0x1000 + port->port * TEGRA186_GPIO_SCR_PORT_SIZE;
162 return gpio->secure + offset + pin * TEGRA186_GPIO_SCR_PIN_SIZE;
165 static inline bool tegra186_gpio_is_accessible(struct tegra_gpio *gpio, unsigned int pin)
167 void __iomem *secure;
170 secure = tegra186_gpio_get_secure_base(gpio, pin);
172 if (gpio->soc->has_vm_support) {
173 value = readl(secure + TEGRA186_GPIO_VM);
174 if ((value & TEGRA186_GPIO_VM_RW_MASK) != TEGRA186_GPIO_VM_RW_MASK)
178 value = __raw_readl(secure + TEGRA186_GPIO_SCR);
180 if ((value & TEGRA186_GPIO_SCR_SEC_ENABLE) == 0)
183 if ((value & TEGRA186_GPIO_FULL_ACCESS) == TEGRA186_GPIO_FULL_ACCESS)
189 static int tegra186_init_valid_mask(struct gpio_chip *chip,
190 unsigned long *valid_mask, unsigned int ngpios)
192 struct tegra_gpio *gpio = gpiochip_get_data(chip);
195 for (j = 0; j < ngpios; j++) {
196 if (!tegra186_gpio_is_accessible(gpio, j))
197 clear_bit(j, valid_mask);
202 static int tegra186_gpio_get_direction(struct gpio_chip *chip,
205 struct tegra_gpio *gpio = gpiochip_get_data(chip);
209 base = tegra186_gpio_get_base(gpio, offset);
210 if (WARN_ON(base == NULL))
213 value = readl(base + TEGRA186_GPIO_ENABLE_CONFIG);
214 if (value & TEGRA186_GPIO_ENABLE_CONFIG_OUT)
215 return GPIO_LINE_DIRECTION_OUT;
217 return GPIO_LINE_DIRECTION_IN;
220 static int tegra186_gpio_direction_input(struct gpio_chip *chip,
223 struct tegra_gpio *gpio = gpiochip_get_data(chip);
227 base = tegra186_gpio_get_base(gpio, offset);
228 if (WARN_ON(base == NULL))
231 value = readl(base + TEGRA186_GPIO_OUTPUT_CONTROL);
232 value |= TEGRA186_GPIO_OUTPUT_CONTROL_FLOATED;
233 writel(value, base + TEGRA186_GPIO_OUTPUT_CONTROL);
235 value = readl(base + TEGRA186_GPIO_ENABLE_CONFIG);
236 value |= TEGRA186_GPIO_ENABLE_CONFIG_ENABLE;
237 value &= ~TEGRA186_GPIO_ENABLE_CONFIG_OUT;
238 writel(value, base + TEGRA186_GPIO_ENABLE_CONFIG);
243 static int tegra186_gpio_direction_output(struct gpio_chip *chip,
244 unsigned int offset, int level)
246 struct tegra_gpio *gpio = gpiochip_get_data(chip);
250 /* configure output level first */
251 chip->set(chip, offset, level);
253 base = tegra186_gpio_get_base(gpio, offset);
254 if (WARN_ON(base == NULL))
257 /* set the direction */
258 value = readl(base + TEGRA186_GPIO_OUTPUT_CONTROL);
259 value &= ~TEGRA186_GPIO_OUTPUT_CONTROL_FLOATED;
260 writel(value, base + TEGRA186_GPIO_OUTPUT_CONTROL);
262 value = readl(base + TEGRA186_GPIO_ENABLE_CONFIG);
263 value |= TEGRA186_GPIO_ENABLE_CONFIG_ENABLE;
264 value |= TEGRA186_GPIO_ENABLE_CONFIG_OUT;
265 writel(value, base + TEGRA186_GPIO_ENABLE_CONFIG);
270 #define HTE_BOTH_EDGES (HTE_RISING_EDGE_TS | HTE_FALLING_EDGE_TS)
272 static int tegra186_gpio_en_hw_ts(struct gpio_chip *gc, u32 offset,
275 struct tegra_gpio *gpio;
282 gpio = gpiochip_get_data(gc);
286 base = tegra186_gpio_get_base(gpio, offset);
287 if (WARN_ON(base == NULL))
290 value = readl(base + TEGRA186_GPIO_ENABLE_CONFIG);
291 value |= TEGRA186_GPIO_ENABLE_CONFIG_TIMESTAMP_FUNC;
293 if (flags == HTE_BOTH_EDGES) {
294 value |= TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_DOUBLE_EDGE;
295 } else if (flags == HTE_RISING_EDGE_TS) {
296 value |= TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_SINGLE_EDGE;
297 value |= TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_LEVEL;
298 } else if (flags == HTE_FALLING_EDGE_TS) {
299 value |= TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_SINGLE_EDGE;
302 writel(value, base + TEGRA186_GPIO_ENABLE_CONFIG);
307 static int tegra186_gpio_dis_hw_ts(struct gpio_chip *gc, u32 offset,
310 struct tegra_gpio *gpio;
317 gpio = gpiochip_get_data(gc);
321 base = tegra186_gpio_get_base(gpio, offset);
322 if (WARN_ON(base == NULL))
325 value = readl(base + TEGRA186_GPIO_ENABLE_CONFIG);
326 value &= ~TEGRA186_GPIO_ENABLE_CONFIG_TIMESTAMP_FUNC;
327 if (flags == HTE_BOTH_EDGES) {
328 value &= ~TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_DOUBLE_EDGE;
329 } else if (flags == HTE_RISING_EDGE_TS) {
330 value &= ~TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_SINGLE_EDGE;
331 value &= ~TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_LEVEL;
332 } else if (flags == HTE_FALLING_EDGE_TS) {
333 value &= ~TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_SINGLE_EDGE;
335 writel(value, base + TEGRA186_GPIO_ENABLE_CONFIG);
340 static int tegra186_gpio_get(struct gpio_chip *chip, unsigned int offset)
342 struct tegra_gpio *gpio = gpiochip_get_data(chip);
346 base = tegra186_gpio_get_base(gpio, offset);
347 if (WARN_ON(base == NULL))
350 value = readl(base + TEGRA186_GPIO_ENABLE_CONFIG);
351 if (value & TEGRA186_GPIO_ENABLE_CONFIG_OUT)
352 value = readl(base + TEGRA186_GPIO_OUTPUT_VALUE);
354 value = readl(base + TEGRA186_GPIO_INPUT);
356 return value & BIT(0);
359 static void tegra186_gpio_set(struct gpio_chip *chip, unsigned int offset,
362 struct tegra_gpio *gpio = gpiochip_get_data(chip);
366 base = tegra186_gpio_get_base(gpio, offset);
367 if (WARN_ON(base == NULL))
370 value = readl(base + TEGRA186_GPIO_OUTPUT_VALUE);
372 value &= ~TEGRA186_GPIO_OUTPUT_VALUE_HIGH;
374 value |= TEGRA186_GPIO_OUTPUT_VALUE_HIGH;
376 writel(value, base + TEGRA186_GPIO_OUTPUT_VALUE);
379 static int tegra186_gpio_set_config(struct gpio_chip *chip,
381 unsigned long config)
383 struct tegra_gpio *gpio = gpiochip_get_data(chip);
387 base = tegra186_gpio_get_base(gpio, offset);
391 if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE)
394 debounce = pinconf_to_config_argument(config);
397 * The Tegra186 GPIO controller supports a maximum of 255 ms debounce
400 if (debounce > 255000)
403 debounce = DIV_ROUND_UP(debounce, USEC_PER_MSEC);
405 value = TEGRA186_GPIO_DEBOUNCE_CONTROL_THRESHOLD(debounce);
406 writel(value, base + TEGRA186_GPIO_DEBOUNCE_CONTROL);
408 value = readl(base + TEGRA186_GPIO_ENABLE_CONFIG);
409 value |= TEGRA186_GPIO_ENABLE_CONFIG_DEBOUNCE;
410 writel(value, base + TEGRA186_GPIO_ENABLE_CONFIG);
415 static int tegra186_gpio_add_pin_ranges(struct gpio_chip *chip)
417 struct tegra_gpio *gpio = gpiochip_get_data(chip);
418 struct pinctrl_dev *pctldev;
419 struct device_node *np;
423 if (!gpio->soc->pinmux || gpio->soc->num_pin_ranges == 0)
426 np = of_find_compatible_node(NULL, NULL, gpio->soc->pinmux);
430 pctldev = of_pinctrl_get(np);
433 return -EPROBE_DEFER;
435 for (i = 0; i < gpio->soc->num_pin_ranges; i++) {
436 unsigned int pin = gpio->soc->pin_ranges[i].offset, port;
437 const char *group = gpio->soc->pin_ranges[i].group;
442 if (port >= gpio->soc->num_ports) {
443 dev_warn(chip->parent, "invalid port %u for %s\n",
448 for (j = 0; j < port; j++)
449 pin += gpio->soc->ports[j].pins;
451 err = gpiochip_add_pingroup_range(chip, pctldev, pin, group);
459 static int tegra186_gpio_of_xlate(struct gpio_chip *chip,
460 const struct of_phandle_args *spec,
463 struct tegra_gpio *gpio = gpiochip_get_data(chip);
464 unsigned int port, pin, i, offset = 0;
466 if (WARN_ON(chip->of_gpio_n_cells < 2))
469 if (WARN_ON(spec->args_count < chip->of_gpio_n_cells))
472 port = spec->args[0] / 8;
473 pin = spec->args[0] % 8;
475 if (port >= gpio->soc->num_ports) {
476 dev_err(chip->parent, "invalid port number: %u\n", port);
480 for (i = 0; i < port; i++)
481 offset += gpio->soc->ports[i].pins;
484 *flags = spec->args[1];
489 #define to_tegra_gpio(x) container_of((x), struct tegra_gpio, gpio)
491 static void tegra186_irq_ack(struct irq_data *data)
493 struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
494 struct tegra_gpio *gpio = to_tegra_gpio(gc);
497 base = tegra186_gpio_get_base(gpio, data->hwirq);
498 if (WARN_ON(base == NULL))
501 writel(1, base + TEGRA186_GPIO_INTERRUPT_CLEAR);
504 static void tegra186_irq_mask(struct irq_data *data)
506 struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
507 struct tegra_gpio *gpio = to_tegra_gpio(gc);
511 base = tegra186_gpio_get_base(gpio, data->hwirq);
512 if (WARN_ON(base == NULL))
515 value = readl(base + TEGRA186_GPIO_ENABLE_CONFIG);
516 value &= ~TEGRA186_GPIO_ENABLE_CONFIG_INTERRUPT;
517 writel(value, base + TEGRA186_GPIO_ENABLE_CONFIG);
519 gpiochip_disable_irq(&gpio->gpio, data->hwirq);
522 static void tegra186_irq_unmask(struct irq_data *data)
524 struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
525 struct tegra_gpio *gpio = to_tegra_gpio(gc);
529 base = tegra186_gpio_get_base(gpio, data->hwirq);
530 if (WARN_ON(base == NULL))
533 gpiochip_enable_irq(&gpio->gpio, data->hwirq);
535 value = readl(base + TEGRA186_GPIO_ENABLE_CONFIG);
536 value |= TEGRA186_GPIO_ENABLE_CONFIG_INTERRUPT;
537 writel(value, base + TEGRA186_GPIO_ENABLE_CONFIG);
540 static int tegra186_irq_set_type(struct irq_data *data, unsigned int type)
542 struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
543 struct tegra_gpio *gpio = to_tegra_gpio(gc);
547 base = tegra186_gpio_get_base(gpio, data->hwirq);
548 if (WARN_ON(base == NULL))
551 value = readl(base + TEGRA186_GPIO_ENABLE_CONFIG);
552 value &= ~TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_MASK;
553 value &= ~TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_LEVEL;
555 switch (type & IRQ_TYPE_SENSE_MASK) {
559 case IRQ_TYPE_EDGE_RISING:
560 value |= TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_SINGLE_EDGE;
561 value |= TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_LEVEL;
564 case IRQ_TYPE_EDGE_FALLING:
565 value |= TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_SINGLE_EDGE;
568 case IRQ_TYPE_EDGE_BOTH:
569 value |= TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_DOUBLE_EDGE;
572 case IRQ_TYPE_LEVEL_HIGH:
573 value |= TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_LEVEL;
574 value |= TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_LEVEL;
577 case IRQ_TYPE_LEVEL_LOW:
578 value |= TEGRA186_GPIO_ENABLE_CONFIG_TRIGGER_TYPE_LEVEL;
585 writel(value, base + TEGRA186_GPIO_ENABLE_CONFIG);
587 if ((type & IRQ_TYPE_EDGE_BOTH) == 0)
588 irq_set_handler_locked(data, handle_level_irq);
590 irq_set_handler_locked(data, handle_edge_irq);
592 if (data->parent_data)
593 return irq_chip_set_type_parent(data, type);
598 static int tegra186_irq_set_wake(struct irq_data *data, unsigned int on)
600 if (data->parent_data)
601 return irq_chip_set_wake_parent(data, on);
606 static void tegra186_irq_print_chip(struct irq_data *data, struct seq_file *p)
608 struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
610 seq_printf(p, dev_name(gc->parent));
613 static const struct irq_chip tegra186_gpio_irq_chip = {
614 .irq_ack = tegra186_irq_ack,
615 .irq_mask = tegra186_irq_mask,
616 .irq_unmask = tegra186_irq_unmask,
617 .irq_set_type = tegra186_irq_set_type,
618 .irq_set_wake = tegra186_irq_set_wake,
619 .irq_print_chip = tegra186_irq_print_chip,
620 .flags = IRQCHIP_IMMUTABLE,
621 GPIOCHIP_IRQ_RESOURCE_HELPERS,
624 static void tegra186_gpio_irq(struct irq_desc *desc)
626 struct tegra_gpio *gpio = irq_desc_get_handler_data(desc);
627 struct irq_domain *domain = gpio->gpio.irq.domain;
628 struct irq_chip *chip = irq_desc_get_chip(desc);
629 unsigned int parent = irq_desc_get_irq(desc);
630 unsigned int i, j, offset = 0;
632 chained_irq_enter(chip, desc);
634 for (i = 0; i < gpio->soc->num_ports; i++) {
635 const struct tegra_gpio_port *port = &gpio->soc->ports[i];
640 base = gpio->base + port->bank * 0x1000 + port->port * 0x200;
642 /* skip ports that are not associated with this bank */
643 for (j = 0; j < gpio->num_irqs_per_bank; j++) {
644 if (parent == gpio->irq[port->bank * gpio->num_irqs_per_bank + j])
648 if (j == gpio->num_irqs_per_bank)
651 value = readl(base + TEGRA186_GPIO_INTERRUPT_STATUS(1));
653 for_each_set_bit(pin, &value, port->pins) {
654 int ret = generic_handle_domain_irq(domain, offset + pin);
655 WARN_RATELIMIT(ret, "hwirq = %d", offset + pin);
659 offset += port->pins;
662 chained_irq_exit(chip, desc);
665 static int tegra186_gpio_irq_domain_translate(struct irq_domain *domain,
666 struct irq_fwspec *fwspec,
667 unsigned long *hwirq,
670 struct tegra_gpio *gpio = gpiochip_get_data(domain->host_data);
671 unsigned int port, pin, i, offset = 0;
673 if (WARN_ON(gpio->gpio.of_gpio_n_cells < 2))
676 if (WARN_ON(fwspec->param_count < gpio->gpio.of_gpio_n_cells))
679 port = fwspec->param[0] / 8;
680 pin = fwspec->param[0] % 8;
682 if (port >= gpio->soc->num_ports)
685 for (i = 0; i < port; i++)
686 offset += gpio->soc->ports[i].pins;
688 *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK;
689 *hwirq = offset + pin;
694 static int tegra186_gpio_populate_parent_fwspec(struct gpio_chip *chip,
695 union gpio_irq_fwspec *gfwspec,
696 unsigned int parent_hwirq,
697 unsigned int parent_type)
699 struct tegra_gpio *gpio = gpiochip_get_data(chip);
700 struct irq_fwspec *fwspec = &gfwspec->fwspec;
702 fwspec->fwnode = chip->irq.parent_domain->fwnode;
703 fwspec->param_count = 3;
704 fwspec->param[0] = gpio->soc->instance;
705 fwspec->param[1] = parent_hwirq;
706 fwspec->param[2] = parent_type;
711 static int tegra186_gpio_child_to_parent_hwirq(struct gpio_chip *chip,
714 unsigned int *parent_hwirq,
715 unsigned int *parent_type)
717 *parent_hwirq = chip->irq.child_offset_to_irq(chip, hwirq);
723 static unsigned int tegra186_gpio_child_offset_to_irq(struct gpio_chip *chip,
726 struct tegra_gpio *gpio = gpiochip_get_data(chip);
729 for (i = 0; i < gpio->soc->num_ports; i++) {
730 if (offset < gpio->soc->ports[i].pins)
733 offset -= gpio->soc->ports[i].pins;
736 return offset + i * 8;
739 static const struct of_device_id tegra186_pmc_of_match[] = {
740 { .compatible = "nvidia,tegra186-pmc" },
741 { .compatible = "nvidia,tegra194-pmc" },
742 { .compatible = "nvidia,tegra234-pmc" },
746 static void tegra186_gpio_init_route_mapping(struct tegra_gpio *gpio)
748 struct device *dev = gpio->gpio.parent;
752 for (i = 0; i < gpio->soc->num_ports; i++) {
753 const struct tegra_gpio_port *port = &gpio->soc->ports[i];
754 unsigned int offset, p = port->port;
757 base = gpio->secure + port->bank * 0x1000 + 0x800;
759 value = readl(base + TEGRA186_GPIO_CTL_SCR);
762 * For controllers that haven't been locked down yet, make
763 * sure to program the default interrupt route mapping.
765 if ((value & TEGRA186_GPIO_CTL_SCR_SEC_REN) == 0 &&
766 (value & TEGRA186_GPIO_CTL_SCR_SEC_WEN) == 0) {
768 * On Tegra194 and later, each pin can be routed to one or more
771 dev_dbg(dev, "programming default interrupt routing for port %s\n",
774 offset = TEGRA186_GPIO_INT_ROUTE_MAPPING(p, 0);
777 * By default we only want to route GPIO pins to IRQ 0. This works
778 * only under the assumption that we're running as the host kernel
779 * and hence all GPIO pins are owned by Linux.
781 * For cases where Linux is the guest OS, the hypervisor will have
782 * to configure the interrupt routing and pass only the valid
783 * interrupts via device tree.
785 value = readl(base + offset);
786 value = BIT(port->pins) - 1;
787 writel(value, base + offset);
792 static unsigned int tegra186_gpio_irqs_per_bank(struct tegra_gpio *gpio)
794 struct device *dev = gpio->gpio.parent;
796 if (gpio->num_irq > gpio->num_banks) {
797 if (gpio->num_irq % gpio->num_banks != 0)
801 if (gpio->num_irq < gpio->num_banks)
804 gpio->num_irqs_per_bank = gpio->num_irq / gpio->num_banks;
806 if (gpio->num_irqs_per_bank > gpio->soc->num_irqs_per_bank)
812 dev_err(dev, "invalid number of interrupts (%u) for %u banks\n",
813 gpio->num_irq, gpio->num_banks);
817 static int tegra186_gpio_probe(struct platform_device *pdev)
819 unsigned int i, j, offset;
820 struct gpio_irq_chip *irq;
821 struct tegra_gpio *gpio;
822 struct device_node *np;
826 gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
830 gpio->soc = device_get_match_data(&pdev->dev);
831 gpio->gpio.label = gpio->soc->name;
832 gpio->gpio.parent = &pdev->dev;
834 /* count the number of banks in the controller */
835 for (i = 0; i < gpio->soc->num_ports; i++)
836 if (gpio->soc->ports[i].bank > gpio->num_banks)
837 gpio->num_banks = gpio->soc->ports[i].bank;
841 /* get register apertures */
842 gpio->secure = devm_platform_ioremap_resource_byname(pdev, "security");
843 if (IS_ERR(gpio->secure)) {
844 gpio->secure = devm_platform_ioremap_resource(pdev, 0);
845 if (IS_ERR(gpio->secure))
846 return PTR_ERR(gpio->secure);
849 gpio->base = devm_platform_ioremap_resource_byname(pdev, "gpio");
850 if (IS_ERR(gpio->base)) {
851 gpio->base = devm_platform_ioremap_resource(pdev, 1);
852 if (IS_ERR(gpio->base))
853 return PTR_ERR(gpio->base);
856 err = platform_irq_count(pdev);
862 err = tegra186_gpio_irqs_per_bank(gpio);
866 gpio->irq = devm_kcalloc(&pdev->dev, gpio->num_irq, sizeof(*gpio->irq),
871 for (i = 0; i < gpio->num_irq; i++) {
872 err = platform_get_irq(pdev, i);
879 gpio->gpio.request = gpiochip_generic_request;
880 gpio->gpio.free = gpiochip_generic_free;
881 gpio->gpio.get_direction = tegra186_gpio_get_direction;
882 gpio->gpio.direction_input = tegra186_gpio_direction_input;
883 gpio->gpio.direction_output = tegra186_gpio_direction_output;
884 gpio->gpio.get = tegra186_gpio_get;
885 gpio->gpio.set = tegra186_gpio_set;
886 gpio->gpio.set_config = tegra186_gpio_set_config;
887 gpio->gpio.add_pin_ranges = tegra186_gpio_add_pin_ranges;
888 gpio->gpio.init_valid_mask = tegra186_init_valid_mask;
889 if (gpio->soc->has_gte) {
890 gpio->gpio.en_hw_timestamp = tegra186_gpio_en_hw_ts;
891 gpio->gpio.dis_hw_timestamp = tegra186_gpio_dis_hw_ts;
894 gpio->gpio.base = -1;
896 for (i = 0; i < gpio->soc->num_ports; i++)
897 gpio->gpio.ngpio += gpio->soc->ports[i].pins;
899 names = devm_kcalloc(gpio->gpio.parent, gpio->gpio.ngpio,
900 sizeof(*names), GFP_KERNEL);
904 for (i = 0, offset = 0; i < gpio->soc->num_ports; i++) {
905 const struct tegra_gpio_port *port = &gpio->soc->ports[i];
908 for (j = 0; j < port->pins; j++) {
909 name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL,
910 "P%s.%02x", port->name, j);
914 names[offset + j] = name;
917 offset += port->pins;
920 gpio->gpio.names = (const char * const *)names;
922 #if defined(CONFIG_OF_GPIO)
923 gpio->gpio.of_gpio_n_cells = 2;
924 gpio->gpio.of_xlate = tegra186_gpio_of_xlate;
925 #endif /* CONFIG_OF_GPIO */
927 irq = &gpio->gpio.irq;
928 gpio_irq_chip_set_chip(irq, &tegra186_gpio_irq_chip);
929 irq->fwnode = of_node_to_fwnode(pdev->dev.of_node);
930 irq->child_to_parent_hwirq = tegra186_gpio_child_to_parent_hwirq;
931 irq->populate_parent_alloc_arg = tegra186_gpio_populate_parent_fwspec;
932 irq->child_offset_to_irq = tegra186_gpio_child_offset_to_irq;
933 irq->child_irq_domain_ops.translate = tegra186_gpio_irq_domain_translate;
934 irq->handler = handle_simple_irq;
935 irq->default_type = IRQ_TYPE_NONE;
936 irq->parent_handler = tegra186_gpio_irq;
937 irq->parent_handler_data = gpio;
938 irq->num_parents = gpio->num_irq;
941 * To simplify things, use a single interrupt per bank for now. Some
942 * chips support up to 8 interrupts per bank, which can be useful to
943 * distribute the load and decrease the processing latency for GPIOs
944 * but it also requires a more complicated interrupt routing than we
947 if (gpio->num_irqs_per_bank > 1) {
948 irq->parents = devm_kcalloc(&pdev->dev, gpio->num_banks,
949 sizeof(*irq->parents), GFP_KERNEL);
953 for (i = 0; i < gpio->num_banks; i++)
954 irq->parents[i] = gpio->irq[i * gpio->num_irqs_per_bank];
956 irq->num_parents = gpio->num_banks;
958 irq->num_parents = gpio->num_irq;
959 irq->parents = gpio->irq;
962 if (gpio->soc->num_irqs_per_bank > 1)
963 tegra186_gpio_init_route_mapping(gpio);
965 np = of_find_matching_node(NULL, tegra186_pmc_of_match);
967 if (of_device_is_available(np)) {
968 irq->parent_domain = irq_find_host(np);
971 if (!irq->parent_domain)
972 return -EPROBE_DEFER;
978 irq->map = devm_kcalloc(&pdev->dev, gpio->gpio.ngpio,
979 sizeof(*irq->map), GFP_KERNEL);
983 for (i = 0, offset = 0; i < gpio->soc->num_ports; i++) {
984 const struct tegra_gpio_port *port = &gpio->soc->ports[i];
986 for (j = 0; j < port->pins; j++)
987 irq->map[offset + j] = irq->parents[port->bank];
989 offset += port->pins;
992 return devm_gpiochip_add_data(&pdev->dev, &gpio->gpio, gpio);
995 #define TEGRA186_MAIN_GPIO_PORT(_name, _bank, _port, _pins) \
996 [TEGRA186_MAIN_GPIO_PORT_##_name] = { \
1003 static const struct tegra_gpio_port tegra186_main_ports[] = {
1004 TEGRA186_MAIN_GPIO_PORT( A, 2, 0, 7),
1005 TEGRA186_MAIN_GPIO_PORT( B, 3, 0, 7),
1006 TEGRA186_MAIN_GPIO_PORT( C, 3, 1, 7),
1007 TEGRA186_MAIN_GPIO_PORT( D, 3, 2, 6),
1008 TEGRA186_MAIN_GPIO_PORT( E, 2, 1, 8),
1009 TEGRA186_MAIN_GPIO_PORT( F, 2, 2, 6),
1010 TEGRA186_MAIN_GPIO_PORT( G, 4, 1, 6),
1011 TEGRA186_MAIN_GPIO_PORT( H, 1, 0, 7),
1012 TEGRA186_MAIN_GPIO_PORT( I, 0, 4, 8),
1013 TEGRA186_MAIN_GPIO_PORT( J, 5, 0, 8),
1014 TEGRA186_MAIN_GPIO_PORT( K, 5, 1, 1),
1015 TEGRA186_MAIN_GPIO_PORT( L, 1, 1, 8),
1016 TEGRA186_MAIN_GPIO_PORT( M, 5, 3, 6),
1017 TEGRA186_MAIN_GPIO_PORT( N, 0, 0, 7),
1018 TEGRA186_MAIN_GPIO_PORT( O, 0, 1, 4),
1019 TEGRA186_MAIN_GPIO_PORT( P, 4, 0, 7),
1020 TEGRA186_MAIN_GPIO_PORT( Q, 0, 2, 6),
1021 TEGRA186_MAIN_GPIO_PORT( R, 0, 5, 6),
1022 TEGRA186_MAIN_GPIO_PORT( T, 0, 3, 4),
1023 TEGRA186_MAIN_GPIO_PORT( X, 1, 2, 8),
1024 TEGRA186_MAIN_GPIO_PORT( Y, 1, 3, 7),
1025 TEGRA186_MAIN_GPIO_PORT(BB, 2, 3, 2),
1026 TEGRA186_MAIN_GPIO_PORT(CC, 5, 2, 4),
1029 static const struct tegra_gpio_soc tegra186_main_soc = {
1030 .num_ports = ARRAY_SIZE(tegra186_main_ports),
1031 .ports = tegra186_main_ports,
1032 .name = "tegra186-gpio",
1034 .num_irqs_per_bank = 1,
1035 .has_vm_support = false,
1038 #define TEGRA186_AON_GPIO_PORT(_name, _bank, _port, _pins) \
1039 [TEGRA186_AON_GPIO_PORT_##_name] = { \
1046 static const struct tegra_gpio_port tegra186_aon_ports[] = {
1047 TEGRA186_AON_GPIO_PORT( S, 0, 1, 5),
1048 TEGRA186_AON_GPIO_PORT( U, 0, 2, 6),
1049 TEGRA186_AON_GPIO_PORT( V, 0, 4, 8),
1050 TEGRA186_AON_GPIO_PORT( W, 0, 5, 8),
1051 TEGRA186_AON_GPIO_PORT( Z, 0, 7, 4),
1052 TEGRA186_AON_GPIO_PORT(AA, 0, 6, 8),
1053 TEGRA186_AON_GPIO_PORT(EE, 0, 3, 3),
1054 TEGRA186_AON_GPIO_PORT(FF, 0, 0, 5),
1057 static const struct tegra_gpio_soc tegra186_aon_soc = {
1058 .num_ports = ARRAY_SIZE(tegra186_aon_ports),
1059 .ports = tegra186_aon_ports,
1060 .name = "tegra186-gpio-aon",
1062 .num_irqs_per_bank = 1,
1063 .has_vm_support = false,
1066 #define TEGRA194_MAIN_GPIO_PORT(_name, _bank, _port, _pins) \
1067 [TEGRA194_MAIN_GPIO_PORT_##_name] = { \
1074 static const struct tegra_gpio_port tegra194_main_ports[] = {
1075 TEGRA194_MAIN_GPIO_PORT( A, 1, 2, 8),
1076 TEGRA194_MAIN_GPIO_PORT( B, 4, 7, 2),
1077 TEGRA194_MAIN_GPIO_PORT( C, 4, 3, 8),
1078 TEGRA194_MAIN_GPIO_PORT( D, 4, 4, 4),
1079 TEGRA194_MAIN_GPIO_PORT( E, 4, 5, 8),
1080 TEGRA194_MAIN_GPIO_PORT( F, 4, 6, 6),
1081 TEGRA194_MAIN_GPIO_PORT( G, 4, 0, 8),
1082 TEGRA194_MAIN_GPIO_PORT( H, 4, 1, 8),
1083 TEGRA194_MAIN_GPIO_PORT( I, 4, 2, 5),
1084 TEGRA194_MAIN_GPIO_PORT( J, 5, 1, 6),
1085 TEGRA194_MAIN_GPIO_PORT( K, 3, 0, 8),
1086 TEGRA194_MAIN_GPIO_PORT( L, 3, 1, 4),
1087 TEGRA194_MAIN_GPIO_PORT( M, 2, 3, 8),
1088 TEGRA194_MAIN_GPIO_PORT( N, 2, 4, 3),
1089 TEGRA194_MAIN_GPIO_PORT( O, 5, 0, 6),
1090 TEGRA194_MAIN_GPIO_PORT( P, 2, 5, 8),
1091 TEGRA194_MAIN_GPIO_PORT( Q, 2, 6, 8),
1092 TEGRA194_MAIN_GPIO_PORT( R, 2, 7, 6),
1093 TEGRA194_MAIN_GPIO_PORT( S, 3, 3, 8),
1094 TEGRA194_MAIN_GPIO_PORT( T, 3, 4, 8),
1095 TEGRA194_MAIN_GPIO_PORT( U, 3, 5, 1),
1096 TEGRA194_MAIN_GPIO_PORT( V, 1, 0, 8),
1097 TEGRA194_MAIN_GPIO_PORT( W, 1, 1, 2),
1098 TEGRA194_MAIN_GPIO_PORT( X, 2, 0, 8),
1099 TEGRA194_MAIN_GPIO_PORT( Y, 2, 1, 8),
1100 TEGRA194_MAIN_GPIO_PORT( Z, 2, 2, 8),
1101 TEGRA194_MAIN_GPIO_PORT(FF, 3, 2, 2),
1102 TEGRA194_MAIN_GPIO_PORT(GG, 0, 0, 2)
1105 static const struct tegra186_pin_range tegra194_main_pin_ranges[] = {
1106 { TEGRA194_MAIN_GPIO(GG, 0), "pex_l5_clkreq_n_pgg0" },
1107 { TEGRA194_MAIN_GPIO(GG, 1), "pex_l5_rst_n_pgg1" },
1110 static const struct tegra_gpio_soc tegra194_main_soc = {
1111 .num_ports = ARRAY_SIZE(tegra194_main_ports),
1112 .ports = tegra194_main_ports,
1113 .name = "tegra194-gpio",
1115 .num_irqs_per_bank = 8,
1116 .num_pin_ranges = ARRAY_SIZE(tegra194_main_pin_ranges),
1117 .pin_ranges = tegra194_main_pin_ranges,
1118 .pinmux = "nvidia,tegra194-pinmux",
1119 .has_vm_support = true,
1122 #define TEGRA194_AON_GPIO_PORT(_name, _bank, _port, _pins) \
1123 [TEGRA194_AON_GPIO_PORT_##_name] = { \
1130 static const struct tegra_gpio_port tegra194_aon_ports[] = {
1131 TEGRA194_AON_GPIO_PORT(AA, 0, 3, 8),
1132 TEGRA194_AON_GPIO_PORT(BB, 0, 4, 4),
1133 TEGRA194_AON_GPIO_PORT(CC, 0, 1, 8),
1134 TEGRA194_AON_GPIO_PORT(DD, 0, 2, 3),
1135 TEGRA194_AON_GPIO_PORT(EE, 0, 0, 7)
1138 static const struct tegra_gpio_soc tegra194_aon_soc = {
1139 .num_ports = ARRAY_SIZE(tegra194_aon_ports),
1140 .ports = tegra194_aon_ports,
1141 .name = "tegra194-gpio-aon",
1143 .num_irqs_per_bank = 8,
1145 .has_vm_support = false,
1148 #define TEGRA234_MAIN_GPIO_PORT(_name, _bank, _port, _pins) \
1149 [TEGRA234_MAIN_GPIO_PORT_##_name] = { \
1156 static const struct tegra_gpio_port tegra234_main_ports[] = {
1157 TEGRA234_MAIN_GPIO_PORT( A, 0, 0, 8),
1158 TEGRA234_MAIN_GPIO_PORT( B, 0, 3, 1),
1159 TEGRA234_MAIN_GPIO_PORT( C, 5, 1, 8),
1160 TEGRA234_MAIN_GPIO_PORT( D, 5, 2, 4),
1161 TEGRA234_MAIN_GPIO_PORT( E, 5, 3, 8),
1162 TEGRA234_MAIN_GPIO_PORT( F, 5, 4, 6),
1163 TEGRA234_MAIN_GPIO_PORT( G, 4, 0, 8),
1164 TEGRA234_MAIN_GPIO_PORT( H, 4, 1, 8),
1165 TEGRA234_MAIN_GPIO_PORT( I, 4, 2, 7),
1166 TEGRA234_MAIN_GPIO_PORT( J, 5, 0, 6),
1167 TEGRA234_MAIN_GPIO_PORT( K, 3, 0, 8),
1168 TEGRA234_MAIN_GPIO_PORT( L, 3, 1, 4),
1169 TEGRA234_MAIN_GPIO_PORT( M, 2, 0, 8),
1170 TEGRA234_MAIN_GPIO_PORT( N, 2, 1, 8),
1171 TEGRA234_MAIN_GPIO_PORT( P, 2, 2, 8),
1172 TEGRA234_MAIN_GPIO_PORT( Q, 2, 3, 8),
1173 TEGRA234_MAIN_GPIO_PORT( R, 2, 4, 6),
1174 TEGRA234_MAIN_GPIO_PORT( X, 1, 0, 8),
1175 TEGRA234_MAIN_GPIO_PORT( Y, 1, 1, 8),
1176 TEGRA234_MAIN_GPIO_PORT( Z, 1, 2, 8),
1177 TEGRA234_MAIN_GPIO_PORT(AC, 0, 1, 8),
1178 TEGRA234_MAIN_GPIO_PORT(AD, 0, 2, 4),
1179 TEGRA234_MAIN_GPIO_PORT(AE, 3, 3, 2),
1180 TEGRA234_MAIN_GPIO_PORT(AF, 3, 4, 4),
1181 TEGRA234_MAIN_GPIO_PORT(AG, 3, 2, 8),
1184 static const struct tegra_gpio_soc tegra234_main_soc = {
1185 .num_ports = ARRAY_SIZE(tegra234_main_ports),
1186 .ports = tegra234_main_ports,
1187 .name = "tegra234-gpio",
1189 .num_irqs_per_bank = 8,
1190 .has_vm_support = true,
1193 #define TEGRA234_AON_GPIO_PORT(_name, _bank, _port, _pins) \
1194 [TEGRA234_AON_GPIO_PORT_##_name] = { \
1201 static const struct tegra_gpio_port tegra234_aon_ports[] = {
1202 TEGRA234_AON_GPIO_PORT(AA, 0, 4, 8),
1203 TEGRA234_AON_GPIO_PORT(BB, 0, 5, 4),
1204 TEGRA234_AON_GPIO_PORT(CC, 0, 2, 8),
1205 TEGRA234_AON_GPIO_PORT(DD, 0, 3, 3),
1206 TEGRA234_AON_GPIO_PORT(EE, 0, 0, 8),
1207 TEGRA234_AON_GPIO_PORT(GG, 0, 1, 1),
1210 static const struct tegra_gpio_soc tegra234_aon_soc = {
1211 .num_ports = ARRAY_SIZE(tegra234_aon_ports),
1212 .ports = tegra234_aon_ports,
1213 .name = "tegra234-gpio-aon",
1215 .num_irqs_per_bank = 8,
1217 .has_vm_support = false,
1220 #define TEGRA241_MAIN_GPIO_PORT(_name, _bank, _port, _pins) \
1221 [TEGRA241_MAIN_GPIO_PORT_##_name] = { \
1228 static const struct tegra_gpio_port tegra241_main_ports[] = {
1229 TEGRA241_MAIN_GPIO_PORT(A, 0, 0, 8),
1230 TEGRA241_MAIN_GPIO_PORT(B, 0, 1, 8),
1231 TEGRA241_MAIN_GPIO_PORT(C, 0, 2, 2),
1232 TEGRA241_MAIN_GPIO_PORT(D, 0, 3, 6),
1233 TEGRA241_MAIN_GPIO_PORT(E, 0, 4, 8),
1234 TEGRA241_MAIN_GPIO_PORT(F, 1, 0, 8),
1235 TEGRA241_MAIN_GPIO_PORT(G, 1, 1, 8),
1236 TEGRA241_MAIN_GPIO_PORT(H, 1, 2, 8),
1237 TEGRA241_MAIN_GPIO_PORT(J, 1, 3, 8),
1238 TEGRA241_MAIN_GPIO_PORT(K, 1, 4, 4),
1239 TEGRA241_MAIN_GPIO_PORT(L, 1, 5, 6),
1242 static const struct tegra_gpio_soc tegra241_main_soc = {
1243 .num_ports = ARRAY_SIZE(tegra241_main_ports),
1244 .ports = tegra241_main_ports,
1245 .name = "tegra241-gpio",
1247 .num_irqs_per_bank = 8,
1248 .has_vm_support = false,
1251 #define TEGRA241_AON_GPIO_PORT(_name, _bank, _port, _pins) \
1252 [TEGRA241_AON_GPIO_PORT_##_name] = { \
1259 static const struct tegra_gpio_port tegra241_aon_ports[] = {
1260 TEGRA241_AON_GPIO_PORT(AA, 0, 0, 8),
1261 TEGRA241_AON_GPIO_PORT(BB, 0, 0, 4),
1264 static const struct tegra_gpio_soc tegra241_aon_soc = {
1265 .num_ports = ARRAY_SIZE(tegra241_aon_ports),
1266 .ports = tegra241_aon_ports,
1267 .name = "tegra241-gpio-aon",
1269 .num_irqs_per_bank = 8,
1270 .has_vm_support = false,
1273 static const struct of_device_id tegra186_gpio_of_match[] = {
1275 .compatible = "nvidia,tegra186-gpio",
1276 .data = &tegra186_main_soc
1278 .compatible = "nvidia,tegra186-gpio-aon",
1279 .data = &tegra186_aon_soc
1281 .compatible = "nvidia,tegra194-gpio",
1282 .data = &tegra194_main_soc
1284 .compatible = "nvidia,tegra194-gpio-aon",
1285 .data = &tegra194_aon_soc
1287 .compatible = "nvidia,tegra234-gpio",
1288 .data = &tegra234_main_soc
1290 .compatible = "nvidia,tegra234-gpio-aon",
1291 .data = &tegra234_aon_soc
1296 MODULE_DEVICE_TABLE(of, tegra186_gpio_of_match);
1298 static const struct acpi_device_id tegra186_gpio_acpi_match[] = {
1299 { .id = "NVDA0108", .driver_data = (kernel_ulong_t)&tegra186_main_soc },
1300 { .id = "NVDA0208", .driver_data = (kernel_ulong_t)&tegra186_aon_soc },
1301 { .id = "NVDA0308", .driver_data = (kernel_ulong_t)&tegra194_main_soc },
1302 { .id = "NVDA0408", .driver_data = (kernel_ulong_t)&tegra194_aon_soc },
1303 { .id = "NVDA0508", .driver_data = (kernel_ulong_t)&tegra241_main_soc },
1304 { .id = "NVDA0608", .driver_data = (kernel_ulong_t)&tegra241_aon_soc },
1307 MODULE_DEVICE_TABLE(acpi, tegra186_gpio_acpi_match);
1309 static struct platform_driver tegra186_gpio_driver = {
1311 .name = "tegra186-gpio",
1312 .of_match_table = tegra186_gpio_of_match,
1313 .acpi_match_table = tegra186_gpio_acpi_match,
1315 .probe = tegra186_gpio_probe,
1317 module_platform_driver(tegra186_gpio_driver);
1319 MODULE_DESCRIPTION("NVIDIA Tegra186 GPIO controller driver");
1320 MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
1321 MODULE_LICENSE("GPL v2");