[PATCH 05/11] bus: mhi: host: Add support for both DL and Ul chan for poll

Sivareddy Surasani posted 11 patches 2 months ago
[PATCH 05/11] bus: mhi: host: Add support for both DL and Ul chan for poll
Posted by Sivareddy Surasani 2 months ago
From: Vivek Pernamitta <vivek.pernamitta@oss.qualcomm.com>

Add support for both DL and Ul chan in mhi_poll.

Signed-off-by: Vivek Pernamitta <vivek.pernamitta@oss.qualcomm.com>
Signed-off-by: Sivareddy Surasani <sivareddy.surasani@oss.qualcomm.com>
---
 drivers/bus/mhi/host/main.c | 4 ++--
 include/linux/mhi.h         | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c
index 5d50f6ebf6f9..53bb93da4017 100644
--- a/drivers/bus/mhi/host/main.c
+++ b/drivers/bus/mhi/host/main.c
@@ -1859,10 +1859,10 @@ int mhi_get_channel_doorbell_offset(struct mhi_controller *mhi_cntrl, u32 *chdb_
 }
 EXPORT_SYMBOL_GPL(mhi_get_channel_doorbell_offset);
 
-int mhi_poll(struct mhi_device *mhi_dev, u32 budget)
+int mhi_poll(struct mhi_device *mhi_dev, u32 budget, enum dma_data_direction dir)
 {
 	struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl;
-	struct mhi_chan *mhi_chan = mhi_dev->dl_chan;
+	struct mhi_chan *mhi_chan = (dir == DMA_TO_DEVICE) ? mhi_dev->ul_chan : mhi_dev->dl_chan;
 	struct mhi_event *mhi_event = &mhi_cntrl->mhi_event[mhi_chan->er_index];
 	int ret;
 
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index 360770ddef70..299216b5e4de 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -780,8 +780,9 @@ void mhi_unprepare_from_transfer(struct mhi_device *mhi_dev);
  * mhi_poll - Poll for any available data in DL direction
  * @mhi_dev: Device associated with the channels
  * @budget: # of events to process
+ * @dir: Set direction whether for DMA_TO_DVICE or DMA_FROM_DEVICE
  */
-int mhi_poll(struct mhi_device *mhi_dev, u32 budget);
+int mhi_poll(struct mhi_device *mhi_dev, u32 budget, enum dma_data_direction dir);
 
 /**
  * mhi_queue_buf - Send or receive raw buffers from client device over MHI

-- 
2.34.1