diff mbox series

[07/11] Input: iqs7222 - set all ULP entry masks by default

Message ID 20220908131548.48120-8-jeff@labundy.com
State Accepted
Commit d56111ed58482de0045e1e1201122e6e71516945
Headers show
Series [01/11] Input: iqs7222 - drop unused device node references | expand

Commit Message

Jeff LaBundy Sept. 8, 2022, 1:15 p.m. UTC
Some devices expose an ultra-low-power (ULP) mode entry mask for
each channel. If the mask is set, the device cannot enter ULP so
long as the corresponding channel remains in an active state.

The vendor has advised setting the mask for any disabled channel.
To accommodate this suggestion, initially set all masks and then
clear them only if specified in the device tree.

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

Comments

Dmitry Torokhov Sept. 14, 2022, 10:10 a.m. UTC | #1
On Thu, Sep 08, 2022 at 08:15:44AM -0500, Jeff LaBundy wrote:
> Some devices expose an ultra-low-power (ULP) mode entry mask for
> each channel. If the mask is set, the device cannot enter ULP so
> long as the corresponding channel remains in an active state.
> 
> The vendor has advised setting the mask for any disabled channel.
> To accommodate this suggestion, initially set all masks and then
> clear them only if specified in the device tree.
> 
> Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C")
> Signed-off-by: Jeff LaBundy <jeff@labundy.com>

Applied, thank you.
diff mbox series

Patch

diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c
index 00c73a920ab2..d1a4ab3c95d3 100644
--- a/drivers/input/misc/iqs7222.c
+++ b/drivers/input/misc/iqs7222.c
@@ -1777,11 +1777,9 @@  static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, int chan_index)
 	if (!chan_node)
 		return 0;
 
-	if (dev_desc->allow_offset) {
-		sys_setup[dev_desc->allow_offset] |= BIT(chan_index);
-		if (fwnode_property_present(chan_node, "azoteq,ulp-allow"))
-			sys_setup[dev_desc->allow_offset] &= ~BIT(chan_index);
-	}
+	if (dev_desc->allow_offset &&
+	    fwnode_property_present(chan_node, "azoteq,ulp-allow"))
+		sys_setup[dev_desc->allow_offset] &= ~BIT(chan_index);
 
 	chan_setup[0] |= IQS7222_CHAN_SETUP_0_CHAN_EN;
 
@@ -2304,6 +2302,9 @@  static int iqs7222_parse_all(struct iqs7222_private *iqs7222)
 	u16 *sys_setup = iqs7222->sys_setup;
 	int error, i;
 
+	if (dev_desc->allow_offset)
+		sys_setup[dev_desc->allow_offset] = U16_MAX;
+
 	if (dev_desc->event_offset)
 		sys_setup[dev_desc->event_offset] = IQS7222_EVENT_MASK_ATI;