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

Commit fd523541 authored by Sujeev Dias's avatar Sujeev Dias Committed by Gerrit - the friendly Code Review server
Browse files

mhi_bus: core: add support to reset DB mode when processing M0



Per MHI specification, certain MHI channels require switching
to DB mode whenever MHI host transition to M0 state. This change
add support for such requirement.

CRs-Fixed: 2215567
Change-Id: I012573c519b132d0b901cdbe869246cfa1011fc6
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent 8e8b850c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ Main node properties:
		notifications.
		BIT(1) : Offload channel, MHI host only involved in setting up
		the data pipe. Not involved in active data transfer.
		BIT(2) : Must switch to doorbell mode whenever MHI M0 state
		transition happens.

- mhi,chan-names
  Usage: required
+3 −0
Original line number Diff line number Diff line
@@ -821,6 +821,9 @@ static int of_parse_ch_cfg(struct mhi_controller *mhi_cntrl,

		mhi_chan->lpm_notify = !!(bit_cfg & MHI_CH_CFG_BIT_LPM_NOTIFY);
		mhi_chan->offload_ch = !!(bit_cfg & MHI_CH_CFG_BIT_OFFLOAD_CH);
		mhi_chan->db_cfg.reset_req =
			!!(bit_cfg & MHI_CH_CFG_BIT_DBMODE_RESET_CH);

		ret = of_property_read_string_index(of_node, "mhi,chan-names",
						    i, &mhi_chan->name);
		if (ret)
+2 −0
Original line number Diff line number Diff line
@@ -338,6 +338,7 @@ enum MHI_CH_CFG {

#define MHI_CH_CFG_BIT_LPM_NOTIFY BIT(0) /* require LPM notification */
#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 */

enum MHI_EV_CFG {
	MHI_EV_CFG_ELEMENTS = 0,
@@ -466,6 +467,7 @@ enum MHI_ER_TYPE {
};

struct db_cfg {
	bool reset_req;
	bool db_mode;
	u32 pollcfg;
	enum MHI_BRSTMODE brstmode;
+3 −0
Original line number Diff line number Diff line
@@ -360,6 +360,9 @@ int mhi_pm_m0_transition(struct mhi_controller *mhi_cntrl)
		struct mhi_ring *tre_ring = &mhi_chan->tre_ring;

		write_lock_irq(&mhi_chan->lock);
		if (mhi_chan->db_cfg.reset_req)
			mhi_chan->db_cfg.db_mode = true;

		/* only ring DB if ring is not empty */
		if (tre_ring->base && tre_ring->wp  != tre_ring->rp)
			mhi_ring_chan_db(mhi_cntrl, mhi_chan);