| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * AppliedMicro X-Gene SoC GPIO-Standby Driver |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * Author: Tin Huynh <tnhuynh@apm.com>. |
|---|
| 6 | 7 | * Y Vo <yvo@apm.com>. |
|---|
| 7 | 8 | * Quan Nguyen <qnguyen@apm.com>. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 10 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 11 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 12 | | - * option) any later version. |
|---|
| 13 | | - * |
|---|
| 14 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 17 | | - * GNU General Public License for more details. |
|---|
| 18 | | - * |
|---|
| 19 | | - * You should have received a copy of the GNU General Public License |
|---|
| 20 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 21 | 9 | */ |
|---|
| 22 | 10 | |
|---|
| 23 | 11 | #include <linux/module.h> |
|---|
| 24 | 12 | #include <linux/io.h> |
|---|
| 13 | +#include <linux/of.h> |
|---|
| 25 | 14 | #include <linux/platform_device.h> |
|---|
| 26 | | -#include <linux/of_gpio.h> |
|---|
| 27 | 15 | #include <linux/gpio/driver.h> |
|---|
| 28 | 16 | #include <linux/acpi.h> |
|---|
| 29 | 17 | |
|---|
| 30 | 18 | #include "gpiolib.h" |
|---|
| 19 | +#include "gpiolib-acpi.h" |
|---|
| 31 | 20 | |
|---|
| 32 | 21 | /* Common property names */ |
|---|
| 33 | 22 | #define XGENE_NIRQ_PROPERTY "apm,nr-irqs" |
|---|
| .. | .. |
|---|
| 133 | 122 | fwspec.fwnode = gc->parent->fwnode; |
|---|
| 134 | 123 | fwspec.param_count = 2; |
|---|
| 135 | 124 | fwspec.param[0] = GPIO_TO_HWIRQ(priv, gpio); |
|---|
| 136 | | - fwspec.param[1] = IRQ_TYPE_NONE; |
|---|
| 125 | + fwspec.param[1] = IRQ_TYPE_EDGE_RISING; |
|---|
| 137 | 126 | return irq_create_fwspec_mapping(&fwspec); |
|---|
| 138 | 127 | } |
|---|
| 139 | 128 | |
|---|
| .. | .. |
|---|
| 229 | 218 | { |
|---|
| 230 | 219 | struct xgene_gpio_sb *priv; |
|---|
| 231 | 220 | int ret; |
|---|
| 232 | | - struct resource *res; |
|---|
| 233 | 221 | void __iomem *regs; |
|---|
| 234 | 222 | struct irq_domain *parent_domain = NULL; |
|---|
| 235 | 223 | u32 val32; |
|---|
| .. | .. |
|---|
| 238 | 226 | if (!priv) |
|---|
| 239 | 227 | return -ENOMEM; |
|---|
| 240 | 228 | |
|---|
| 241 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 242 | | - regs = devm_ioremap_resource(&pdev->dev, res); |
|---|
| 229 | + regs = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 243 | 230 | if (IS_ERR(regs)) |
|---|
| 244 | 231 | return PTR_ERR(regs); |
|---|
| 245 | 232 | |
|---|
| .. | .. |
|---|
| 303 | 290 | |
|---|
| 304 | 291 | dev_info(&pdev->dev, "X-Gene GPIO Standby driver registered\n"); |
|---|
| 305 | 292 | |
|---|
| 306 | | - if (priv->nirq > 0) { |
|---|
| 307 | | - /* Register interrupt handlers for gpio signaled acpi events */ |
|---|
| 308 | | - acpi_gpiochip_request_interrupts(&priv->gc); |
|---|
| 309 | | - } |
|---|
| 293 | + /* Register interrupt handlers for GPIO signaled ACPI Events */ |
|---|
| 294 | + acpi_gpiochip_request_interrupts(&priv->gc); |
|---|
| 310 | 295 | |
|---|
| 311 | 296 | return ret; |
|---|
| 312 | 297 | } |
|---|
| .. | .. |
|---|
| 315 | 300 | { |
|---|
| 316 | 301 | struct xgene_gpio_sb *priv = platform_get_drvdata(pdev); |
|---|
| 317 | 302 | |
|---|
| 318 | | - if (priv->nirq > 0) { |
|---|
| 319 | | - acpi_gpiochip_free_interrupts(&priv->gc); |
|---|
| 320 | | - } |
|---|
| 303 | + acpi_gpiochip_free_interrupts(&priv->gc); |
|---|
| 321 | 304 | |
|---|
| 322 | 305 | irq_domain_remove(priv->irq_domain); |
|---|
| 323 | 306 | |
|---|