Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c71d7430 authored by Hanumant Singh's avatar Hanumant Singh
Browse files

gpio: msm: Add support for configuring subsystem id



The id of the subsystem to which gpio interrupts are routed
can vary from one SOC to the next. Generally for a given TLMM
block this id remains constant. Allow device tree to override
processor id, if different from default value.

CRs-fixed: 554403
Change-Id: I76b4f08affc5f2df1d66bb33052acbffc501f92c
Signed-off-by: default avatarHanumant Singh <hanumant@codeaurora.org>
parent 62b084ce
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@ Required properties:
- ngpio : Specify the number of MSM GPIOs
- qcom,direct-connect-irqs : Specifies the number of GPIOs that can be used as
  direct connect interrupts
Optional properties:
- qcom,subsys-id: subsystem id to which gpio interrupts must be routed

Example:

+4 −0
Original line number Diff line number Diff line
@@ -684,6 +684,7 @@ int __init msm_gpio_of_init(struct device_node *node,
			    struct device_node *parent)
{
	int ngpio, ret;
	u32 subsys_id;

	ret = of_property_read_u32(node, "ngpio", &ngpio);
	if (ret) {
@@ -696,6 +697,9 @@ int __init msm_gpio_of_init(struct device_node *node,
		WARN(1, "Cannot allocate irq_domain\n");
		return -ENOMEM;
	}
	ret = of_property_read_u32(node, "qcom,subsys-id", &subsys_id);
	if (!ret)
		__msm_gpio_set_subsys_id(subsys_id);
	return 0;
}
#endif
+10 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -27,4 +27,13 @@ void __msm_gpio_set_intr_cfg_type(unsigned gpio, unsigned type);
void __gpio_tlmm_config(unsigned config);
void __msm_gpio_install_direct_irq(unsigned gpio, unsigned irq,
					unsigned int input_polarity);
#ifdef CONFIG_OF
void __msm_gpio_set_subsys_id(unsigned id);
#else
static inline void __msm_gpio_set_subsys_id(unsigned id)
{
	return;
}
#endif
#endif
+9 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -62,6 +62,8 @@ enum {
	DC_POLARITY_BIT	= 8,
};

/* Default id of application processor subsystem */
static unsigned subsys_id = 4;
/*
 * When a GPIO triggers, two separate decisions are made, controlled
 * by two separate flags.
@@ -80,7 +82,7 @@ enum {
#define INTR_DIR_CONN_EN   BIT(INTR_DIR_CONN_EN_BIT)
#define DC_POLARITY_HI     BIT(DC_POLARITY_BIT)

#define INTR_TARGET_PROC_APPS    (4 << INTR_TARGET_PROC_BIT)
#define INTR_TARGET_PROC_APPS    (subsys_id << INTR_TARGET_PROC_BIT)
#define INTR_TARGET_PROC_NONE    (7 << INTR_TARGET_PROC_BIT)

#define INTR_DECT_CTL_LEVEL      (0 << INTR_DECT_CTL_BIT)
@@ -202,6 +204,11 @@ void __msm_gpio_set_intr_cfg_type(unsigned gpio, unsigned type)
	udelay(5);
}

void __msm_gpio_set_subsys_id(unsigned id)
{
	subsys_id = id;
}

void __gpio_tlmm_config(unsigned config)
{
	unsigned flags;