@@ -399,6 +399,7 @@ static int cfhsi_rx_desc(struct cfhsi_desc *desc, struct cfhsi *cfhsi)
netif_rx(skb);
else
netif_rx_ni(skb);
+ cfhsi_notify_rx(cfhsi);
/* Update network statistics. */
cfhsi->ndev->stats.rx_packets++;
@@ -500,6 +501,7 @@ static int cfhsi_rx_pld(struct cfhsi_desc *desc, struct cfhsi *cfhsi)
netif_rx(skb);
else
netif_rx_ni(skb);
+ cfhsi_notify_rx(cfhsi);
/* Update network statistics. */
cfhsi->ndev->stats.rx_packets++;
@@ -787,6 +789,9 @@ static void cfhsi_wake_down(struct work_struct *work)
if (test_bit(CFHSI_SHUTDOWN, &cfhsi->bits))
return;
+ /* Clear spurious states (if any) */
+ WARN_ON(test_and_clear_bit(CFHSI_WAKE_DOWN_ACK, &cfhsi->bits));
+
/* Deactivate wake line. */
cfhsi->dev->cfhsi_wake_down(cfhsi->dev);
@@ -836,6 +841,10 @@ static void cfhsi_wake_down(struct work_struct *work)
/* Cancel pending RX requests. */
cfhsi->dev->cfhsi_rx_cancel(cfhsi->dev);
+ spin_lock_bh(&cfhsi->lock);
+ if (!test_bit(CFHSI_WAKE_UP, &cfhsi->bits))
+ cfhsi_wakeline_released(cfhsi);
+ spin_unlock_bh(&cfhsi->lock);
}
static void cfhsi_out_of_sync(struct work_struct *work)
@@ -864,8 +873,12 @@ static void cfhsi_wake_up_cb(struct cfhsi_drv *drv)
return;
/* Schedule wake up work queue if the peer initiates. */
- if (!test_and_set_bit(CFHSI_WAKE_UP, &cfhsi->bits))
+ spin_lock_bh(&cfhsi->lock);
+ if (!test_and_set_bit(CFHSI_WAKE_UP, &cfhsi->bits)) {
+ cfhsi_wakeline_aquired(cfhsi);
queue_work(cfhsi->wq, &cfhsi->wake_up_work);
+ }
+ spin_unlock_bh(&cfhsi->lock);
}
static void cfhsi_wake_down_cb(struct cfhsi_drv *drv)
@@ -944,8 +957,12 @@ static int cfhsi_xmit(struct sk_buff *skb, struct net_device *dev)
}
} else {
/* Schedule wake up work queue if the we initiate. */
- if (!test_and_set_bit(CFHSI_WAKE_UP, &cfhsi->bits))
+ spin_lock_bh(&cfhsi->lock);
+ if (!test_and_set_bit(CFHSI_WAKE_UP, &cfhsi->bits)) {
+ cfhsi_wakeline_aquired(cfhsi);
queue_work(cfhsi->wq, &cfhsi->wake_up_work);
+ }
+ spin_unlock_bh(&cfhsi->lock);
}
return 0;
@@ -1099,6 +1116,8 @@ int cfhsi_probe(struct platform_device *pdev)
cfhsi->rx_slowpath_timer.data = (unsigned long)cfhsi;
cfhsi->rx_slowpath_timer.function = cfhsi_rx_slowpath;
+ cfhsi_wakeline_init();
+
/* Add CAIF HSI device to list. */
spin_lock(&cfhsi_list_lock);
list_add_tail(&cfhsi->list, &cfhsi_list);
@@ -1180,6 +1199,8 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi)
/* Deactivate interface */
cfhsi->dev->cfhsi_down(cfhsi->dev);
+ cfhsi_wakeline_deinit();
+
/* Finally unregister the network device. */
unregister_netdev(cfhsi->ndev);
@@ -157,4 +157,12 @@ struct cfhsi {
extern struct platform_driver cfhsi_driver;
+#ifndef CFHSI_WAKELOCKS
+#define cfhsi_wakeline_aquired(dev)
+#define cfhsi_wakeline_released(dev)
+#define cfhsi_notify_rx(dev)
+#define cfhsi_wakeline_init(dev)
+#define cfhsi_wakeline_deinit(dev)
+#endif
+
#endif /* CAIF_HSI_H_ */
Add initial support for tracking of wake-line status so we at any time know when we have a timer running and HSI wake-line high. The cfhsi_notify_rx, and cfhsi_wakeline_aquired/released are dummies for now. Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com> --- drivers/net/caif/caif_hsi.c | 25 +++++++++++++++++++++++-- include/net/caif/caif_hsi.h | 8 ++++++++ 2 files changed, 31 insertions(+), 2 deletions(-)