The imx_keypad driver is set wake capable in the imx_keypad_probe(),
but it doesn't implement suspend and reusme callback interface.
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>
---
Validated this patch both on i.MX51 PDK and i.MX31 PDK
drivers/input/keyboard/imx_keypad.c | 42 +++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
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>
---
Validated this patch both on i.MX51 PDK and i.MX31 PDK
drivers/input/keyboard/imx_keypad.c | 42 +++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
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>
---
Validated this patch both on i.MX51 PDK and i.MX31 PDK
drivers/input/keyboard/imx_keypad.c | 42 +++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
struct input_dev *input_dev = kbd->input_dev;
if (device_may_wakeup(dev)) {
enable_irq_wake(kdb->irq);
} else {
mutex_lock(&input_dev->mutex);
if (input_dev->users)
clk_disable(kbd->clk);
mutex_unlock(&input_dev->mutex);
}
right?
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.
"
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.
"
struct input_dev *input_dev = kbd->input_dev;
if (device_may_wakeup(dev)) {
disable_irq_wake(kdb->irq);
} else {
mutex_lock(&input_dev->mutex);
if (input_dev->users)
clk_enable(kbd->clk);
mutex_unlock(&input_dev->mutex);
}
So, if we unconditionally disable kpp clock in the suspend, we don't
need above logic as well in the resume.
We should not unconditionally disable clock in suspend, you need to check
if there are any users (or drop check in resume), otherwise you'll get
unbalanced count in clk (suspend - decrement, resume - not enabling clk
if device is not being used).
Also locking is needed in suspend.
Thanks.
--
Dmitry
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
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.
"
struct input_dev *input_dev = kbd->input_dev;
if (device_may_wakeup(dev)) {
disable_irq_wake(kdb->irq);
} else {
mutex_lock(&input_dev->mutex);
if (input_dev->users)
clk_enable(kbd->clk);
mutex_unlock(&input_dev->mutex);
}
So, if we unconditionally disable kpp clock in the suspend, we don't
need above logic as well in the resume.
We should not unconditionally disable clock in suspend, you need to check
if there are any users (or drop check in resume), otherwise you'll get
unbalanced count in clk (suspend - decrement, resume - not enabling clk
if device is not being used).
Also locking is needed in suspend.