gpio-xlp.c (c39f2d9db0fd81ea20bb5cce9b3f082ca63753e2) gpio-xlp.c (c7e66e48c05ac2de729999148daa56b563c30b2f)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2003-2015 Broadcom Corporation
4 * All Rights Reserved
5 */
6
7#include <linux/gpio/driver.h>
8#include <linux/platform_device.h>

--- 276 unchanged lines hidden (view full) ---

285 },
286 { /* sentinel */ },
287};
288MODULE_DEVICE_TABLE(of, xlp_gpio_of_ids);
289
290static int xlp_gpio_probe(struct platform_device *pdev)
291{
292 struct gpio_chip *gc;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2003-2015 Broadcom Corporation
4 * All Rights Reserved
5 */
6
7#include <linux/gpio/driver.h>
8#include <linux/platform_device.h>

--- 276 unchanged lines hidden (view full) ---

285 },
286 { /* sentinel */ },
287};
288MODULE_DEVICE_TABLE(of, xlp_gpio_of_ids);
289
290static int xlp_gpio_probe(struct platform_device *pdev)
291{
292 struct gpio_chip *gc;
293 struct gpio_irq_chip *girq;
293 struct xlp_gpio_priv *priv;
294 void __iomem *gpio_base;
295 int irq_base, irq, err;
296 int ngpio;
297 u32 soc_type;
298
299 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
300 if (!priv)

--- 89 unchanged lines hidden (view full) ---

390 if (irq_base < 0) {
391 dev_err(&pdev->dev, "Failed to allocate IRQ numbers\n");
392 return irq_base;
393 }
394 } else {
395 irq_base = 0;
396 }
397
294 struct xlp_gpio_priv *priv;
295 void __iomem *gpio_base;
296 int irq_base, irq, err;
297 int ngpio;
298 u32 soc_type;
299
300 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
301 if (!priv)

--- 89 unchanged lines hidden (view full) ---

391 if (irq_base < 0) {
392 dev_err(&pdev->dev, "Failed to allocate IRQ numbers\n");
393 return irq_base;
394 }
395 } else {
396 irq_base = 0;
397 }
398
399 girq = &gc->irq;
400 girq->chip = &xlp_gpio_irq_chip;
401 girq->parent_handler = xlp_gpio_generic_handler;
402 girq->num_parents = 1;
403 girq->parents = devm_kcalloc(&pdev->dev, 1,
404 sizeof(*girq->parents),
405 GFP_KERNEL);
406 if (!girq->parents)
407 return -ENOMEM;
408 girq->parents[0] = irq;
409 girq->first = irq_base;
410 girq->default_type = IRQ_TYPE_NONE;
411 girq->handler = handle_level_irq;
412
398 err = gpiochip_add_data(gc, priv);
399 if (err < 0)
400 return err;
401
413 err = gpiochip_add_data(gc, priv);
414 if (err < 0)
415 return err;
416
402 err = gpiochip_irqchip_add(gc, &xlp_gpio_irq_chip, irq_base,
403 handle_level_irq, IRQ_TYPE_NONE);
404 if (err) {
405 dev_err(&pdev->dev, "Could not connect irqchip to gpiochip!\n");
406 goto out_gpio_remove;
407 }
408
409 gpiochip_set_chained_irqchip(gc, &xlp_gpio_irq_chip, irq,
410 xlp_gpio_generic_handler);
411
412 dev_info(&pdev->dev, "registered %d GPIOs\n", gc->ngpio);
413
414 return 0;
417 dev_info(&pdev->dev, "registered %d GPIOs\n", gc->ngpio);
418
419 return 0;
415
416out_gpio_remove:
417 gpiochip_remove(gc);
418 return err;
419}
420
421#ifdef CONFIG_ACPI
422static const struct acpi_device_id xlp_gpio_acpi_match[] = {
423 { "BRCM9006", GPIO_VARIANT_VULCAN },
424 { "CAV9006", GPIO_VARIANT_VULCAN },
425 {},
426};

--- 17 unchanged lines hidden ---
420}
421
422#ifdef CONFIG_ACPI
423static const struct acpi_device_id xlp_gpio_acpi_match[] = {
424 { "BRCM9006", GPIO_VARIANT_VULCAN },
425 { "CAV9006", GPIO_VARIANT_VULCAN },
426 {},
427};

--- 17 unchanged lines hidden ---