Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
d7f8504
Documentation
arch
block
certs
crypto
drivers
accessibility
acpi
acpica
apei
pmic
Kconfig
Makefile
ac.c
acpi_apd.c
acpi_cmos_rtc.c
acpi_extlog.c
acpi_ipmi.c
acpi_lpat.c
acpi_lpss.c
acpi_memhotplug.c
acpi_pad.c
acpi_platform.c
acpi_pnp.c
acpi_processor.c
acpi_video.c
battery.c
battery.h
bgrt.c
blacklist.c
bus.c
button.c
cm_sbs.c
container.c
custom_method.c
debugfs.c
device_pm.c
device_sysfs.c
dock.c
ec.c
ec_sys.c
event.c
fan.c
glue.c
gsi.c
hed.c
int340x_thermal.c
internal.h
ioapic.c
nfit.c
nfit.h
numa.c
nvs.c
osl.c
pci_irq.c
pci_link.c
pci_root.c
pci_slot.c
power.c
proc.c
processor_core.c
processor_driver.c
processor_idle.c
processor_pdc.c
processor_perflib.c
processor_thermal.c
processor_throttling.c
property.c
reboot.c
resource.c
sbs.c
sbshc.c
sbshc.h
scan.c
sleep.c
sleep.h
sysfs.c
tables.c
thermal.c
utils.c
video_detect.c
wakeup.c
amba
android
ata
atm
auxdisplay
base
bcma
block
bluetooth
bus
cdrom
char
clk
clocksource
connector
cpufreq
cpuidle
crypto
dca
devfreq
dio
dma-buf
dma
edac
eisa
extcon
firewire
firmware
fmc
gpio
gpu
hid
hsi
hv
hwmon
hwspinlock
hwtracing
i2c
ide
idle
iio
infiniband
input
iommu
ipack
irqchip
isdn
leds
lguest
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc
mmc
mtd
net
nfc
ntb
nubus
nvdimm
nvmem
of
oprofile
parisc
parport
pci
pcmcia
perf
phy
pinctrl
platform
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi
sfi
sh
sn
soc
spi
spmi
ssb
staging
target
tc
thermal
thunderbolt
tty
uio
usb
uwb
vfio
vhost
video
virt
virtio
vlynq
vme
w1
watchdog
xen
zorro
Kconfig
Makefile
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.get_maintainer.ignore
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
drivers
/
acpi
/
gsi.c
Blame
Blame
Latest commit
History
History
105 lines (95 loc) · 2.78 KB
Breadcrumbs
linux
/
drivers
/
acpi
/
gsi.c
Top
File metadata and controls
Code
Blame
105 lines (95 loc) · 2.78 KB
Raw
/* * ACPI GSI IRQ layer * * Copyright (C) 2015 ARM Ltd. * Author: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/acpi.h> #include <linux/irq.h> #include <linux/irqdomain.h> #include <linux/of.h> enum acpi_irq_model_id acpi_irq_model; static struct fwnode_handle *acpi_gsi_domain_id; static unsigned int acpi_gsi_get_irq_type(int trigger, int polarity) { switch (polarity) { case ACPI_ACTIVE_LOW: return trigger == ACPI_EDGE_SENSITIVE ? IRQ_TYPE_EDGE_FALLING : IRQ_TYPE_LEVEL_LOW; case ACPI_ACTIVE_HIGH: return trigger == ACPI_EDGE_SENSITIVE ? IRQ_TYPE_EDGE_RISING : IRQ_TYPE_LEVEL_HIGH; case ACPI_ACTIVE_BOTH: if (trigger == ACPI_EDGE_SENSITIVE) return IRQ_TYPE_EDGE_BOTH; default: return IRQ_TYPE_NONE; } } /** * acpi_gsi_to_irq() - Retrieve the linux irq number for a given GSI * @gsi: GSI IRQ number to map * @irq: pointer where linux IRQ number is stored * * irq location updated with irq value [>0 on success, 0 on failure] * * Returns: linux IRQ number on success (>0) * -EINVAL on failure */ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) { struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id, DOMAIN_BUS_ANY); *irq = irq_find_mapping(d, gsi); /* * *irq == 0 means no mapping, that should * be reported as a failure */ return (*irq > 0) ? *irq : -EINVAL; } EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); /** * acpi_register_gsi() - Map a GSI to a linux IRQ number * @dev: device for which IRQ has to be mapped * @gsi: GSI IRQ number * @trigger: trigger type of the GSI number to be mapped * @polarity: polarity of the GSI to be mapped * * Returns: a valid linux IRQ number on success * -EINVAL on failure */ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) { unsigned int irq; unsigned int irq_type = acpi_gsi_get_irq_type(trigger, polarity); struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id, DOMAIN_BUS_ANY); irq = irq_create_mapping(d, gsi); if (!irq) return -EINVAL; /* Set irq type if specified and different than the current one */ if (irq_type != IRQ_TYPE_NONE && irq_type != irq_get_trigger_type(irq)) irq_set_irq_type(irq, irq_type); return irq; } EXPORT_SYMBOL_GPL(acpi_register_gsi); /** * acpi_unregister_gsi() - Free a GSI<->linux IRQ number mapping * @gsi: GSI IRQ number */ void acpi_unregister_gsi(u32 gsi) { struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id, DOMAIN_BUS_ANY); int irq = irq_find_mapping(d, gsi); irq_dispose_mapping(irq); } EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
You can’t perform that action at this time.