Commit b5daad2f authored by Maxim Levitsky's avatar Maxim Levitsky Committed by Mauro Carvalho Chehab

[media] ene_ir: disable the device if wake is disabled

It doesn't hurt and on my notebook despite clearing the
wake flag the remote still wakes up the system.

This way it doesn't.
Signed-off-by: default avatarMaxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 1de6ebba
...@@ -476,7 +476,7 @@ static void ene_rx_setup(struct ene_device *dev) ...@@ -476,7 +476,7 @@ static void ene_rx_setup(struct ene_device *dev)
} }
/* Enable the device for receive */ /* Enable the device for receive */
static void ene_rx_enable(struct ene_device *dev) static void ene_rx_enable_hw(struct ene_device *dev)
{ {
u8 reg_value; u8 reg_value;
...@@ -504,11 +504,17 @@ static void ene_rx_enable(struct ene_device *dev) ...@@ -504,11 +504,17 @@ static void ene_rx_enable(struct ene_device *dev)
/* enter idle mode */ /* enter idle mode */
ir_raw_event_set_idle(dev->rdev, true); ir_raw_event_set_idle(dev->rdev, true);
}
/* Enable the device for receive - wrapper to track the state*/
static void ene_rx_enable(struct ene_device *dev)
{
ene_rx_enable_hw(dev);
dev->rx_enabled = true; dev->rx_enabled = true;
} }
/* Disable the device receiver */ /* Disable the device receiver */
static void ene_rx_disable(struct ene_device *dev) static void ene_rx_disable_hw(struct ene_device *dev)
{ {
/* disable inputs */ /* disable inputs */
ene_rx_enable_cir_engine(dev, false); ene_rx_enable_cir_engine(dev, false);
...@@ -516,8 +522,13 @@ static void ene_rx_disable(struct ene_device *dev) ...@@ -516,8 +522,13 @@ static void ene_rx_disable(struct ene_device *dev)
/* disable hardware IRQ and firmware flag */ /* disable hardware IRQ and firmware flag */
ene_clear_reg_mask(dev, ENE_FW1, ENE_FW1_ENABLE | ENE_FW1_IRQ); ene_clear_reg_mask(dev, ENE_FW1, ENE_FW1_ENABLE | ENE_FW1_IRQ);
ir_raw_event_set_idle(dev->rdev, true); ir_raw_event_set_idle(dev->rdev, true);
}
/* Disable the device receiver - wrapper to track the state */
static void ene_rx_disable(struct ene_device *dev)
{
ene_rx_disable_hw(dev);
dev->rx_enabled = false; dev->rx_enabled = false;
} }
...@@ -1124,9 +1135,8 @@ static void ene_remove(struct pnp_dev *pnp_dev) ...@@ -1124,9 +1135,8 @@ static void ene_remove(struct pnp_dev *pnp_dev)
} }
/* enable wake on IR (wakes on specific button on original remote) */ /* enable wake on IR (wakes on specific button on original remote) */
static void ene_enable_wake(struct ene_device *dev, int enable) static void ene_enable_wake(struct ene_device *dev, bool enable)
{ {
enable = enable && device_may_wakeup(&dev->pnp_dev->dev);
dbg("wake on IR %s", enable ? "enabled" : "disabled"); dbg("wake on IR %s", enable ? "enabled" : "disabled");
ene_set_clear_reg_mask(dev, ENE_FW1, ENE_FW1_WAKE, enable); ene_set_clear_reg_mask(dev, ENE_FW1, ENE_FW1_WAKE, enable);
} }
...@@ -1135,9 +1145,12 @@ static void ene_enable_wake(struct ene_device *dev, int enable) ...@@ -1135,9 +1145,12 @@ static void ene_enable_wake(struct ene_device *dev, int enable)
static int ene_suspend(struct pnp_dev *pnp_dev, pm_message_t state) static int ene_suspend(struct pnp_dev *pnp_dev, pm_message_t state)
{ {
struct ene_device *dev = pnp_get_drvdata(pnp_dev); struct ene_device *dev = pnp_get_drvdata(pnp_dev);
ene_enable_wake(dev, true); bool wake = device_may_wakeup(&dev->pnp_dev->dev);
if (!wake && dev->rx_enabled)
ene_rx_disable_hw(dev);
/* TODO: add support for wake pattern */ ene_enable_wake(dev, wake);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment