Thread (7 messages) flat view 7 messages, 3 authors, 2011-10-09

Re: [PATCH] input/imx_keypad: add pm suspend and resume functions

From: Wanlong Gao <hidden>
Date: 2011-09-30 09:06:50

On 09/30/2011 04:59 PM, Hui Wang wrote:
Wanlong Gao wrote:
quoted
On 09/30/2011 03:54 PM, Hui Wang wrote:

  
quoted
The imx_keypad driver is set wake capable in the imx_keypad_probe(),
but it doesn't implement suspend and reusme callback interface.
quoted
From the i.MX series MCU Reference Manual, the kpp (keypad port) is
a major wake up source which can detect any key press even in low
power modes and even when there is no clock.

Now add suspend and resume callback functions for this driver.

Signed-off-by: Hui Wang <redacted>
---
quoted
  
The i.MX series kpp is not like other normal kpps on other platforms, 
the kpp on the i.MX can detect key event and wake up system from low 
power mode even we disable kpp clock. So i choose to unconditionally 
disable its clock. I have explain it the commit header.

"From the i.MX series MCU Reference Manual, the kpp (keypad port) is

a major wake up source which can detect any key press even in low
power modes and even when there is no clock.
"

I see.
quoted
quoted
+
+static int imx_kbd_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct imx_keypad *kbd = platform_get_drvdata(pdev);
+	struct input_dev *input_dev = kbd->input_dev;
+
+	mutex_lock(&input_dev->mutex);
+
+	if (device_may_wakeup(&pdev->dev))
+		disable_irq_wake(kbd->irq);
+
+	if (input_dev->users)
+		clk_enable(kbd->clk);
+
+	mutex_unlock(&input_dev->mutex);
+
+	return 0;
+}

But is it need to hold a mutex lock also when *disable_irq_wake()* here ?

Thanks
-Wanlong Gao
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help