Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b48d7bc authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mhi: core: add support to start channels automatically"

parents 2b1dcbe4 2294dae7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ Main node properties:
		BIT(3) : MHI bus driver pre-allocate buffer for this channel.
		If set, clients not allowed to queue buffers. Valid only for DL
		direction.
		BIT(4) : MHI host driver to automatically start channels once
		mhi device driver probe is complete.

- mhi,chan-names
  Usage: required
+11 −1
Original line number Diff line number Diff line
@@ -836,6 +836,7 @@ static int of_parse_ch_cfg(struct mhi_controller *mhi_cntrl,
		mhi_chan->db_cfg.reset_req =
			!!(bit_cfg & MHI_CH_CFG_BIT_DBMODE_RESET_CH);
		mhi_chan->pre_alloc = !!(bit_cfg & MHI_CH_CFG_BIT_PRE_ALLOC);
		mhi_chan->auto_start = !!(bit_cfg & MHI_CH_CFG_BIT_AUTO_START);

		if (mhi_chan->pre_alloc &&
		    (mhi_chan->dir != DMA_FROM_DEVICE ||
@@ -1139,6 +1140,8 @@ static int mhi_driver_probe(struct device *dev)
	struct mhi_event *mhi_event;
	struct mhi_chan *ul_chan = mhi_dev->ul_chan;
	struct mhi_chan *dl_chan = mhi_dev->dl_chan;
	bool auto_start = false;
	int ret;


	if (ul_chan) {
@@ -1151,6 +1154,7 @@ static int mhi_driver_probe(struct device *dev)

		ul_chan->xfer_cb = mhi_drv->ul_xfer_cb;
		mhi_dev->status_cb = mhi_drv->status_cb;
		auto_start = ul_chan->auto_start;
	}

	if (dl_chan) {
@@ -1174,9 +1178,15 @@ static int mhi_driver_probe(struct device *dev)

		/* ul & dl uses same status cb */
		mhi_dev->status_cb = mhi_drv->status_cb;
		auto_start = (auto_start || dl_chan->auto_start);
	}

	return mhi_drv->probe(mhi_dev, mhi_dev->id);
	ret = mhi_drv->probe(mhi_dev, mhi_dev->id);

	if (!ret && auto_start)
		mhi_prepare_for_transfer(mhi_dev);

	return ret;
}

static int mhi_driver_remove(struct device *dev)
+2 −0
Original line number Diff line number Diff line
@@ -340,6 +340,7 @@ enum MHI_CH_CFG {
#define MHI_CH_CFG_BIT_OFFLOAD_CH BIT(1) /* satellite mhi devices */
#define MHI_CH_CFG_BIT_DBMODE_RESET_CH BIT(2) /* require db mode to reset */
#define MHI_CH_CFG_BIT_PRE_ALLOC BIT(3) /* host allocate buffers for DL */
#define MHI_CH_CFG_BIT_AUTO_START BIT(4) /* host auto start channels */

enum MHI_EV_CFG {
	MHI_EV_CFG_ELEMENTS = 0,
@@ -567,6 +568,7 @@ struct mhi_chan {
	bool configured;
	bool offload_ch;
	bool pre_alloc;
	bool auto_start;
	/* functions that generate the transfer ring elements */
	int (*gen_tre)(struct mhi_controller *, struct mhi_chan *, void *,
		       void *, size_t, enum MHI_FLAGS);