hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/gpio/gpio-xgene-sb.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * AppliedMicro X-Gene SoC GPIO-Standby Driver
34 *
....@@ -5,29 +6,17 @@
56 * Author: Tin Huynh <tnhuynh@apm.com>.
67 * Y Vo <yvo@apm.com>.
78 * 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/>.
219 */
2210
2311 #include <linux/module.h>
2412 #include <linux/io.h>
13
+#include <linux/of.h>
2514 #include <linux/platform_device.h>
26
-#include <linux/of_gpio.h>
2715 #include <linux/gpio/driver.h>
2816 #include <linux/acpi.h>
2917
3018 #include "gpiolib.h"
19
+#include "gpiolib-acpi.h"
3120
3221 /* Common property names */
3322 #define XGENE_NIRQ_PROPERTY "apm,nr-irqs"
....@@ -133,7 +122,7 @@
133122 fwspec.fwnode = gc->parent->fwnode;
134123 fwspec.param_count = 2;
135124 fwspec.param[0] = GPIO_TO_HWIRQ(priv, gpio);
136
- fwspec.param[1] = IRQ_TYPE_NONE;
125
+ fwspec.param[1] = IRQ_TYPE_EDGE_RISING;
137126 return irq_create_fwspec_mapping(&fwspec);
138127 }
139128
....@@ -229,7 +218,6 @@
229218 {
230219 struct xgene_gpio_sb *priv;
231220 int ret;
232
- struct resource *res;
233221 void __iomem *regs;
234222 struct irq_domain *parent_domain = NULL;
235223 u32 val32;
....@@ -238,8 +226,7 @@
238226 if (!priv)
239227 return -ENOMEM;
240228
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);
243230 if (IS_ERR(regs))
244231 return PTR_ERR(regs);
245232
....@@ -303,10 +290,8 @@
303290
304291 dev_info(&pdev->dev, "X-Gene GPIO Standby driver registered\n");
305292
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);
310295
311296 return ret;
312297 }
....@@ -315,9 +300,7 @@
315300 {
316301 struct xgene_gpio_sb *priv = platform_get_drvdata(pdev);
317302
318
- if (priv->nirq > 0) {
319
- acpi_gpiochip_free_interrupts(&priv->gc);
320
- }
303
+ acpi_gpiochip_free_interrupts(&priv->gc);
321304
322305 irq_domain_remove(priv->irq_domain);
323306