[PATCH 08/11] Input: iqs7222 - allow 'linux,code' to be optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Event nodes might be defined solely for the purpose of mapping a
GPIO, without needing to report the event to the input core. Add
support for this use-case by making 'linux,code' optional.

This change relieves the burden for reference channels having to
specify KEY_RESERVED for their corresponding key code. The check
that skips events specified with KEY_RESERVED can be dropped, as
input_register_device() already blocks this event.

Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C")
Signed-off-by: Jeff LaBundy <jeff@xxxxxxxxxxx>
---
 drivers/input/misc/iqs7222.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c
index d1a4ab3c95d3..ac810b8ab69f 100644
--- a/drivers/input/misc/iqs7222.c
+++ b/drivers/input/misc/iqs7222.c
@@ -1963,6 +1963,11 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, int chan_index)
 			*setup |= (val / 500 << i * 8);
 		}
 
+		if (!fwnode_property_present(event_node, "linux,code")) {
+			fwnode_handle_put(event_node);
+			continue;
+		}
+
 		error = fwnode_property_read_u32(event_node, "linux,code",
 						 &val);
 		if (error) {
@@ -1999,20 +2004,12 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, int chan_index)
 			iqs7222->kp_type[chan_index][i] = val;
 		}
 
-		fwnode_handle_put(event_node);
-
-		/*
-		 * Reference channels can opt out of event reporting by using
-		 * KEY_RESERVED in place of a true key or switch code.
-		 */
-		if (iqs7222->kp_type[chan_index][i] == EV_KEY &&
-		    iqs7222->kp_code[chan_index][i] == KEY_RESERVED)
-			continue;
-
 		input_set_capability(iqs7222->keypad,
 				     iqs7222->kp_type[chan_index][i],
 				     iqs7222->kp_code[chan_index][i]);
 
+		fwnode_handle_put(event_node);
+
 		if (!dev_desc->event_offset)
 			continue;
 
@@ -2249,6 +2246,11 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, int sldr_index)
 		if (!reg_offset)
 			sldr_setup[9] |= iqs7222_sl_events[i].enable;
 
+		if (!fwnode_property_present(event_node, "linux,code")) {
+			fwnode_handle_put(event_node);
+			continue;
+		}
+
 		error = fwnode_property_read_u32(event_node, "linux,code",
 						 &val);
 		if (error) {
-- 
2.25.1




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux