aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorChristophe RICARD <christophe.ricard@gmail.com>2015-12-23 17:25:33 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-12-31 21:20:25 -0500
commit55a93417c27c6ad1022d5f1121004c494735e8fa (patch)
treed3f5fb535947491c12973a43a474f44f07f80463 /drivers/acpi
parent74bf8efb5fa6e958d2d7c7917b8bb672085ec0c6 (diff)
ACPI: Rename acpi_gsi_get_irq_type to acpi_dev_get_irq_type and export symbol
acpi_gsi_get_irq_type could be use out of GSI purpose. Rename and make it available as a resource function. Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/gsi.c21
-rw-r--r--drivers/acpi/resource.c26
2 files changed, 27 insertions, 20 deletions
diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c
index fa4585a6914e..ee9e0f27b2bf 100644
--- a/drivers/acpi/gsi.c
+++ b/drivers/acpi/gsi.c
@@ -17,25 +17,6 @@ enum acpi_irq_model_id acpi_irq_model;
17 17
18static struct fwnode_handle *acpi_gsi_domain_id; 18static struct fwnode_handle *acpi_gsi_domain_id;
19 19
20static unsigned int acpi_gsi_get_irq_type(int trigger, int polarity)
21{
22 switch (polarity) {
23 case ACPI_ACTIVE_LOW:
24 return trigger == ACPI_EDGE_SENSITIVE ?
25 IRQ_TYPE_EDGE_FALLING :
26 IRQ_TYPE_LEVEL_LOW;
27 case ACPI_ACTIVE_HIGH:
28 return trigger == ACPI_EDGE_SENSITIVE ?
29 IRQ_TYPE_EDGE_RISING :
30 IRQ_TYPE_LEVEL_HIGH;
31 case ACPI_ACTIVE_BOTH:
32 if (trigger == ACPI_EDGE_SENSITIVE)
33 return IRQ_TYPE_EDGE_BOTH;
34 default:
35 return IRQ_TYPE_NONE;
36 }
37}
38
39/** 20/**
40 * acpi_gsi_to_irq() - Retrieve the linux irq number for a given GSI 21 * acpi_gsi_to_irq() - Retrieve the linux irq number for a given GSI
41 * @gsi: GSI IRQ number to map 22 * @gsi: GSI IRQ number to map
@@ -82,7 +63,7 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger,
82 63
83 fwspec.fwnode = acpi_gsi_domain_id; 64 fwspec.fwnode = acpi_gsi_domain_id;
84 fwspec.param[0] = gsi; 65 fwspec.param[0] = gsi;
85 fwspec.param[1] = acpi_gsi_get_irq_type(trigger, polarity); 66 fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity);
86 fwspec.param_count = 2; 67 fwspec.param_count = 2;
87 68
88 return irq_create_fwspec_mapping(&fwspec); 69 return irq_create_fwspec_mapping(&fwspec);
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index cdc5c2599beb..d02fd53042a5 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -23,6 +23,7 @@
23#include <linux/export.h> 23#include <linux/export.h>
24#include <linux/ioport.h> 24#include <linux/ioport.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/irq.h>
26 27
27#ifdef CONFIG_X86 28#ifdef CONFIG_X86
28#define valid_IRQ(i) (((i) != 0) && ((i) != 2)) 29#define valid_IRQ(i) (((i) != 0) && ((i) != 2))
@@ -336,6 +337,31 @@ unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable)
336} 337}
337EXPORT_SYMBOL_GPL(acpi_dev_irq_flags); 338EXPORT_SYMBOL_GPL(acpi_dev_irq_flags);
338 339
340/**
341 * acpi_dev_get_irq_type - Determine irq type.
342 * @triggering: Triggering type as provided by ACPI.
343 * @polarity: Interrupt polarity as provided by ACPI.
344 */
345unsigned int acpi_dev_get_irq_type(int triggering, int polarity)
346{
347 switch (polarity) {
348 case ACPI_ACTIVE_LOW:
349 return triggering == ACPI_EDGE_SENSITIVE ?
350 IRQ_TYPE_EDGE_FALLING :
351 IRQ_TYPE_LEVEL_LOW;
352 case ACPI_ACTIVE_HIGH:
353 return triggering == ACPI_EDGE_SENSITIVE ?
354 IRQ_TYPE_EDGE_RISING :
355 IRQ_TYPE_LEVEL_HIGH;
356 case ACPI_ACTIVE_BOTH:
357 if (triggering == ACPI_EDGE_SENSITIVE)
358 return IRQ_TYPE_EDGE_BOTH;
359 default:
360 return IRQ_TYPE_NONE;
361 }
362}
363EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type);
364
339static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi) 365static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi)
340{ 366{
341 res->start = gsi; 367 res->start = gsi;