From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Stephen Warren <swarren@nvidia.com>,
George Cherian <george.cherian@ti.com>,
Aaro Koskinen <aaro.koskinen@iki.fi>,
Lars Poeschel <poeschel@lemonage.de>,
Kevin Hilman <khilman@linaro.org>,
Santosh Shilimkar <santosh.shilimkar@ti.com>,
Tony Lindgren <tony@atomide.com>,
Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
Linus Walleij <linus.walleij@linaro.org>
Subject: [ 045/110] gpio/omap: maintain GPIO and IRQ usage separately
Date: Fri, 11 Oct 2013 12:38:25 -0700 [thread overview]
Message-ID: <20131011193812.727680420@linuxfoundation.org> (raw)
In-Reply-To: <20131011193807.584188672@linuxfoundation.org>
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
commit fa365e4d729065b5e85165df3dc9699ed47489cc upstream.
The GPIO OMAP controller pins can be used as IRQ and GPIO
independently so is necessary to keep track GPIO pins and
IRQ lines usage separately to make sure that the bank will
always be enabled while being used.
Also move gpio_is_input() definition in preparation for the
next patch that setups the controller's irq_chip driver when
a caller requests an interrupt line.
Acked-by: Stephen Warren <swarren@nvidia.com>
Tested-by: George Cherian <george.cherian@ti.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Tested-by: Lars Poeschel <poeschel@lemonage.de>
Reviewed-by: Kevin Hilman <khilman@linaro.org>
Tested-by: Kevin Hilman <khilman@linaro.org>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-omap.c | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -63,6 +63,7 @@ struct gpio_bank {
struct gpio_chip chip;
struct clk *dbck;
u32 mod_usage;
+ u32 irq_usage;
u32 dbck_enable_mask;
bool dbck_enabled;
struct device *dev;
@@ -86,6 +87,9 @@ struct gpio_bank {
#define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio))
#define GPIO_MOD_CTRL_BIT BIT(0)
+#define BANK_USED(bank) (bank->mod_usage || bank->irq_usage)
+#define LINE_USED(line, offset) (line & (1 << offset))
+
static int irq_to_gpio(struct gpio_bank *bank, unsigned int gpio_irq)
{
return bank->chip.base + gpio_irq;
@@ -420,6 +424,13 @@ static int _set_gpio_triggering(struct g
return 0;
}
+static int gpio_is_input(struct gpio_bank *bank, int mask)
+{
+ void __iomem *reg = bank->base + bank->regs->direction;
+
+ return __raw_readl(reg) & mask;
+}
+
static int gpio_irq_type(struct irq_data *d, unsigned type)
{
struct gpio_bank *bank = irq_data_get_irq_chip_data(d);
@@ -427,7 +438,7 @@ static int gpio_irq_type(struct irq_data
int retval;
unsigned long flags;
- if (WARN_ON(!bank->mod_usage))
+ if (WARN_ON(!BANK_USED(bank)))
return -EINVAL;
#ifdef CONFIG_ARCH_OMAP1
@@ -447,6 +458,7 @@ static int gpio_irq_type(struct irq_data
spin_lock_irqsave(&bank->lock, flags);
retval = _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), type);
+ bank->irq_usage |= 1 << GPIO_INDEX(bank, gpio);
spin_unlock_irqrestore(&bank->lock, flags);
if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
@@ -603,7 +615,7 @@ static int omap_gpio_request(struct gpio
* If this is the first gpio_request for the bank,
* enable the bank module.
*/
- if (!bank->mod_usage)
+ if (!BANK_USED(bank))
pm_runtime_get_sync(bank->dev);
spin_lock_irqsave(&bank->lock, flags);
@@ -619,7 +631,7 @@ static int omap_gpio_request(struct gpio
__raw_writel(__raw_readl(reg) | (1 << offset), reg);
}
- if (bank->regs->ctrl && !bank->mod_usage) {
+ if (bank->regs->ctrl && !BANK_USED(bank)) {
void __iomem *reg = bank->base + bank->regs->ctrl;
u32 ctrl;
@@ -654,7 +666,7 @@ static void omap_gpio_free(struct gpio_c
bank->mod_usage &= ~(1 << offset);
- if (bank->regs->ctrl && !bank->mod_usage) {
+ if (bank->regs->ctrl && !BANK_USED(bank)) {
void __iomem *reg = bank->base + bank->regs->ctrl;
u32 ctrl;
@@ -672,7 +684,7 @@ static void omap_gpio_free(struct gpio_c
* If this is the last gpio to be freed in the bank,
* disable the bank module.
*/
- if (!bank->mod_usage)
+ if (!BANK_USED(bank))
pm_runtime_put(bank->dev);
}
@@ -762,8 +774,10 @@ static void gpio_irq_shutdown(struct irq
struct gpio_bank *bank = irq_data_get_irq_chip_data(d);
unsigned int gpio = irq_to_gpio(bank, d->hwirq);
unsigned long flags;
+ unsigned offset = GPIO_INDEX(bank, gpio);
spin_lock_irqsave(&bank->lock, flags);
+ bank->irq_usage &= ~(1 << offset);
_reset_gpio(bank, gpio);
spin_unlock_irqrestore(&bank->lock, flags);
}
@@ -897,13 +911,6 @@ static int gpio_input(struct gpio_chip *
return 0;
}
-static int gpio_is_input(struct gpio_bank *bank, int mask)
-{
- void __iomem *reg = bank->base + bank->regs->direction;
-
- return __raw_readl(reg) & mask;
-}
-
static int gpio_get(struct gpio_chip *chip, unsigned offset)
{
struct gpio_bank *bank;
@@ -1400,7 +1407,7 @@ void omap2_gpio_prepare_for_idle(int pwr
struct gpio_bank *bank;
list_for_each_entry(bank, &omap_gpio_list, node) {
- if (!bank->mod_usage || !bank->loses_context)
+ if (!BANK_USED(bank) || !bank->loses_context)
continue;
bank->power_mode = pwr_mode;
@@ -1414,7 +1421,7 @@ void omap2_gpio_resume_after_idle(void)
struct gpio_bank *bank;
list_for_each_entry(bank, &omap_gpio_list, node) {
- if (!bank->mod_usage || !bank->loses_context)
+ if (!BANK_USED(bank) || !bank->loses_context)
continue;
pm_runtime_get_sync(bank->dev);
next prev parent reply other threads:[~2013-10-11 19:38 UTC|newest]
Thread overview: 114+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 19:37 [ 000/110] 3.10.16-stable review Greg Kroah-Hartman
2013-10-11 19:37 ` [ 001/110] mwifiex: fix memory corruption when unsetting multicast list Greg Kroah-Hartman
2013-10-11 19:37 ` [ 002/110] cpqarray: fix info leak in ida_locked_ioctl() Greg Kroah-Hartman
2013-10-11 19:37 ` [ 003/110] cciss: fix info leak in cciss_ioctl32_passthru() Greg Kroah-Hartman
2013-10-11 19:37 ` [ 004/110] HID: fix data access in implement() Greg Kroah-Hartman
2013-10-11 19:37 ` [ 005/110] HID: fix unused rsize usage Greg Kroah-Hartman
2013-10-11 19:37 ` [ 006/110] caif: Add missing braces to multiline if in cfctrl_linkup_request Greg Kroah-Hartman
2013-10-11 19:37 ` [ 007/110] tcp: Add missing braces to do_tcp_setsockopt Greg Kroah-Hartman
2013-10-11 19:37 ` [ 008/110] ipv6/exthdrs: accept tlv which includes only padding Greg Kroah-Hartman
2013-10-11 19:37 ` [ 009/110] net: fib: fib6_add: fix potential NULL pointer dereference Greg Kroah-Hartman
2013-10-11 19:37 ` [ 010/110] net: sctp: fix bug in sctp_poll for SOCK_SELECT_ERR_QUEUE Greg Kroah-Hartman
2013-10-11 19:37 ` [ 011/110] net: sctp: fix smatch warning in sctp_send_asconf_del_ip Greg Kroah-Hartman
2013-10-11 19:37 ` [ 012/110] net: fix multiqueue selection Greg Kroah-Hartman
2013-10-11 19:37 ` [ 013/110] net: flow_dissector: fix thoff for IPPROTO_AH Greg Kroah-Hartman
2013-10-11 19:37 ` [ 014/110] net_sched: htb: fix a typo in htb_change_class() Greg Kroah-Hartman
2013-10-11 19:37 ` [ 015/110] r8169: enforce RX_MULTI_EN for the 8168f Greg Kroah-Hartman
2013-10-11 19:37 ` [ 016/110] netpoll: Should handle ETH_P_ARP other than ETH_P_IP in netpoll_neigh_reply Greg Kroah-Hartman
2013-10-11 19:37 ` [ 017/110] netpoll: fix NULL pointer dereference in netpoll_cleanup Greg Kroah-Hartman
2013-10-11 19:37 ` [ 018/110] tuntap: correctly handle error in tun_set_iff() Greg Kroah-Hartman
2013-10-11 19:37 ` [ 019/110] net: sctp: fix ipv6 ipsec encryption bug in sctp_v6_xmit Greg Kroah-Hartman
2013-10-11 19:38 ` [ 020/110] xen-netback: count number required slots for an skb more carefully Greg Kroah-Hartman
2013-10-11 19:38 ` [ 021/110] resubmit bridge: fix message_age_timer calculation Greg Kroah-Hartman
2013-10-11 19:38 ` [ 022/110] bridge: Clamp forward_delay when enabling STP Greg Kroah-Hartman
2013-10-11 19:38 ` [ 023/110] bridge: use br_port_get_rtnl within rtnl lock Greg Kroah-Hartman
2013-10-11 19:38 ` [ 024/110] bridge: fix NULL pointer deref of br_port_get_rcu Greg Kroah-Hartman
2013-10-11 19:38 ` [ 025/110] ip6_tunnels: raddr and laddr are inverted in nl msg Greg Kroah-Hartman
2013-10-11 19:38 ` [ 026/110] net: sctp: rfc4443: do not report ICMP redirects to user space Greg Kroah-Hartman
2013-10-11 19:38 ` [ 027/110] net:dccp: " Greg Kroah-Hartman
2013-10-11 19:38 ` [ 028/110] ip: use ip_hdr() in __ip_make_skb() to retrieve IP header Greg Kroah-Hartman
2013-10-11 19:38 ` [ 029/110] ip: generate unique IP identificator if local fragmentation is allowed Greg Kroah-Hartman
2013-10-11 19:38 ` [ 030/110] ipv6: udp packets following an UFO enqueued packet need also be handled by UFO Greg Kroah-Hartman
2013-10-11 19:38 ` [ 031/110] via-rhine: fix VLAN priority field (PCP, IEEE 802.1p) Greg Kroah-Hartman
2013-10-11 19:38 ` [ 032/110] IPv6 NAT: Do not drop DNATed 6to4/6rd packets Greg Kroah-Hartman
2013-10-11 19:38 ` [ 033/110] net: net_secret should not depend on TCP Greg Kroah-Hartman
2013-10-11 19:38 ` [ 034/110] dm9601: fix IFF_ALLMULTI handling Greg Kroah-Hartman
2013-10-11 19:38 ` [ 035/110] bonding: Fix broken promiscuity reference counting issue Greg Kroah-Hartman
2013-10-11 19:38 ` [ 036/110] ipv6: gre: correct calculation of max_headroom Greg Kroah-Hartman
2013-10-11 19:38 ` [ 037/110] ipv4 igmp: use in_dev_put in timer handlers instead of __in_dev_put Greg Kroah-Hartman
2013-10-11 19:38 ` [ 038/110] ipv6 mcast: use in6_dev_put in timer handlers instead of __in6_dev_put Greg Kroah-Hartman
2013-10-11 19:38 ` [ 039/110] ll_temac: Reset dma descriptors indexes on ndo_open Greg Kroah-Hartman
2013-10-11 19:38 ` [ 040/110] ip_tunnel: Fix a memory corruption in ip_tunnel_xmit Greg Kroah-Hartman
2013-10-11 19:38 ` [ 041/110] sit: allow to use rtnl ops on fb tunnel Greg Kroah-Hartman
2013-10-11 19:38 ` [ 042/110] ip6tnl: " Greg Kroah-Hartman
2013-10-11 19:38 ` [ 043/110] avr32: fix clockevents kernel warning Greg Kroah-Hartman
2013-10-11 19:38 ` [ 044/110] fs/binfmt_elf.c: prevent a coredump with a large vm_map_count from Oopsing Greg Kroah-Hartman
2013-10-11 19:38 ` Greg Kroah-Hartman [this message]
2013-10-11 19:38 ` [ 046/110] gpio/omap: auto-setup a GPIO when used as an IRQ Greg Kroah-Hartman
2013-10-11 19:38 ` [ 047/110] ASoC: max98095: a couple array underflows Greg Kroah-Hartman
2013-10-11 19:38 ` [ 048/110] ASoC: 88pm860x: array overflow in snd_soc_put_volsw_2r_st() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 049/110] ASoC: ab8500-codec: info leak in anc_status_control_put() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 050/110] powerpc/iommu: Use GFP_KERNEL instead of GFP_ATOMIC in iommu_init_table() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 051/110] powerpc/perf: Fix handling of FAB events Greg Kroah-Hartman
2013-10-11 19:38 ` [ 052/110] powerpc/tm: Switch out userspace PPR and DSCR sooner Greg Kroah-Hartman
2013-10-11 19:38 ` [ 053/110] powerpc/vio: Fix modalias_show return values Greg Kroah-Hartman
2013-10-11 19:38 ` [ 054/110] powerpc: Fix parameter clobber in csum_partial_copy_generic() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 055/110] powerpc/sysfs: Disable writing to PURR in guest mode Greg Kroah-Hartman
2013-10-11 19:38 ` [ 056/110] powerpc: Restore registers on error exit from csum_partial_copy_generic() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 057/110] fuse: wait for writeback in fuse_file_fallocate() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 058/110] fuse: fix fallocate vs. ftruncate race Greg Kroah-Hartman
2013-10-11 19:38 ` [ 059/110] brcmfmac: obtain platform data upon module initialization Greg Kroah-Hartman
2013-10-11 19:38 ` [ 060/110] Bluetooth: Fix security level for peripheral role Greg Kroah-Hartman
2013-10-11 19:38 ` [ 061/110] Bluetooth: Fix encryption key size " Greg Kroah-Hartman
2013-10-11 19:38 ` [ 062/110] Bluetooth: Add a new PID/VID 0cf3/e005 for AR3012 Greg Kroah-Hartman
2013-10-11 19:38 ` [ 063/110] Bluetooth: Add support for BCM20702A0 [0b05, 17cb] Greg Kroah-Hartman
2013-10-11 19:38 ` [ 064/110] Bluetooth: Introduce a new HCI_RFKILLED flag Greg Kroah-Hartman
2013-10-11 19:38 ` [ 065/110] Bluetooth: Fix rfkill functionality during the HCI setup stage Greg Kroah-Hartman
2013-10-11 19:38 ` [ 066/110] nilfs2: fix issue with race condition of competition between segments for dirty blocks Greg Kroah-Hartman
2013-10-11 19:38 ` [ 067/110] esp_scsi: Fix tag state corruption when autosensing Greg Kroah-Hartman
2013-10-11 19:38 ` [ 068/110] sparc64: Fix ITLB handler of null page Greg Kroah-Hartman
2013-10-11 19:38 ` [ 069/110] sparc64: Remove RWSEM export leftovers Greg Kroah-Hartman
2013-10-11 19:38 ` [ 070/110] sparc64: Fix buggy strlcpy() conversion in ldom_reboot() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 071/110] sparc: fix ldom_reboot buffer overflow harder Greg Kroah-Hartman
2013-10-11 19:38 ` [ 072/110] sparc64: Fix off by one in trampoline TLB mapping installation loop Greg Kroah-Hartman
2013-10-11 19:38 ` [ 073/110] sparc64: Fix not SRAed %o5 in 32-bit traced syscall Greg Kroah-Hartman
2013-10-11 19:38 ` [ 074/110] sparc32: Fix exit flag passed from traced sys_sigreturn Greg Kroah-Hartman
2013-10-11 19:38 ` [ 075/110] mm: Fix generic hugetlb pte check return type Greg Kroah-Hartman
2013-10-11 19:38 ` [ 076/110] mm/bounce.c: fix a regression where MS_SNAP_STABLE (stable pages snapshotting) was ignored Greg Kroah-Hartman
2013-10-11 19:38 ` [ 077/110] kernel/kmod.c: check for NULL in call_usermodehelper_exec() Greg Kroah-Hartman
2013-10-11 22:36 ` Tetsuo Handa
2013-10-11 19:38 ` [ 078/110] staging: comedi: ni_65xx: (bug fix) confine insn_bits to one subdevice Greg Kroah-Hartman
2013-10-11 19:38 ` [ 079/110] NFSv4.1: nfs4_fl_prepare_ds - fix bugs when the connect attempt fails Greg Kroah-Hartman
2013-10-11 19:39 ` [ 080/110] mwifiex: fix NULL pointer dereference in usb suspend handler Greg Kroah-Hartman
2013-10-11 19:39 ` [ 081/110] mwifiex: fix hang issue for USB chipsets Greg Kroah-Hartman
2013-10-11 19:39 ` [ 082/110] mwifiex: fix PCIe hs_cfg cancel cmd timeout Greg Kroah-Hartman
2013-10-11 19:39 ` [ 083/110] USB: serial: option: Ignore card reader interface on Huawei E1750 Greg Kroah-Hartman
2013-10-11 19:39 ` [ 084/110] xen/hvc: allow xenboot console to be used again Greg Kroah-Hartman
2013-10-11 19:39 ` [ 085/110] ib_srpt: Destroy cm_id before destroying QP Greg Kroah-Hartman
2013-10-11 19:39 ` [ 086/110] ib_srpt: always set response for task management Greg Kroah-Hartman
2013-10-11 19:39 ` [ 087/110] rtlwifi: Align private space in rtl_priv struct Greg Kroah-Hartman
2013-10-11 19:39 ` [ 088/110] p54usb: add USB ID for Corega WLUSB2GTST USB adapter Greg Kroah-Hartman
2013-10-11 19:39 ` [ 089/110] mm: avoid reinserting isolated balloon pages into LRU lists Greg Kroah-Hartman
2013-10-11 19:39 ` [ 090/110] iscsi-target: Only perform wait_for_tasks when performing shutdown Greg Kroah-Hartman
2013-10-11 19:39 ` [ 091/110] net: Update the sysctl permissions handler to test effective uid/gid Greg Kroah-Hartman
2013-10-11 19:39 ` [ 092/110] irq: Force hardirq exits softirq processing on its own stack Greg Kroah-Hartman
2013-10-11 19:39 ` [ 093/110] Revert "drm/radeon: add missing hdmi callbacks for rv6xx" Greg Kroah-Hartman
2013-10-11 19:39 ` [ 094/110] dmaengine: imx-dma: fix lockdep issue between irqhandler and tasklet Greg Kroah-Hartman
2013-10-11 19:39 ` [ 095/110] dmaengine: imx-dma: fix callback path in tasklet Greg Kroah-Hartman
2013-10-11 19:39 ` [ 096/110] dmaengine: imx-dma: fix slow path issue in prep_dma_cyclic Greg Kroah-Hartman
2013-10-11 19:39 ` [ 097/110] ACPI / IPMI: Fix atomic context requirement of ipmi_msg_handler() Greg Kroah-Hartman
2013-10-11 19:39 ` [ 098/110] xfs: fix node forward in xfs_node_toosmall Greg Kroah-Hartman
2013-10-11 19:39 ` [ 099/110] drm/nouveau/bios/init: stub opcode 0xaa Greg Kroah-Hartman
2013-10-11 19:39 ` [ 100/110] ALSA: hda - Fix GPIO for Acer Aspire 3830TG Greg Kroah-Hartman
2013-10-11 19:39 ` [ 101/110] tile: use a more conservative __my_cpu_offset in CONFIG_PREEMPT Greg Kroah-Hartman
2013-10-11 19:39 ` [ 102/110] s390: fix system call restart after inferior call Greg Kroah-Hartman
2013-10-11 19:39 ` [ 103/110] Btrfs: change how we queue blocks for backref checking Greg Kroah-Hartman
2013-10-11 19:39 ` [ 104/110] Btrfs: skip subvol entries when checking if weve created a dir already Greg Kroah-Hartman
2013-10-11 19:39 ` [ 105/110] Btrfs: remove ourselves from the cluster list under lock Greg Kroah-Hartman
2013-10-11 19:39 ` [ 106/110] HID: roccat: add support for KonePureOptical v2 Greg Kroah-Hartman
2013-10-11 19:39 ` [ 107/110] HID: uhid: add devname module alias Greg Kroah-Hartman
2013-10-11 19:39 ` [ 108/110] HID: uhid: allocate static minor Greg Kroah-Hartman
2013-10-11 19:39 ` [ 109/110] net: qmi_wwan: add new Qualcomm devices Greg Kroah-Hartman
2013-10-11 19:39 ` [ 110/110] bcache: Fix a null ptr deref regression Greg Kroah-Hartman
2013-10-11 21:49 ` [ 000/110] 3.10.16-stable review Guenter Roeck
2013-10-11 22:08 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131011193812.727680420@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=aaro.koskinen@iki.fi \
--cc=george.cherian@ti.com \
--cc=javier.martinez@collabora.co.uk \
--cc=khilman@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=poeschel@lemonage.de \
--cc=santosh.shilimkar@ti.com \
--cc=stable@vger.kernel.org \
--cc=swarren@nvidia.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).