[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240711164709.GA286955@bhelgaas>
Date: Thu, 11 Jul 2024 11:47:09 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Krishna chaitanya chundru <quic_krichai@...cinc.com>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Jonathan Corbet <corbet@....net>, Jingoo Han <jingoohan1@...il.com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Rob Herring <robh@...nel.org>, linux-pci@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org, mhi@...ts.linux.dev,
quic_vbadigan@...cinc.com, quic_ramkri@...cinc.com,
quic_nitegupt@...cinc.com, quic_skananth@...cinc.com,
quic_parass@...cinc.com
Subject: Re: [PATCH v6 5/5] bus: mhi: ep: wake up host if the MHI state is in
M3
On Wed, Jul 10, 2024 at 04:46:12PM +0530, Krishna chaitanya chundru wrote:
> If the MHI state is in M3 then most probably the host kept the
> device in D3 hot or D3 cold, due to that endpoint transactions will not
> reach the host, endpoint needs to wakes up the host to bring the host
> to D0 which eventually bring back the MHI state to M0.
s/needs to wakes up/needs to wake up/
s/D3 hot/D3hot/
s/D3 cold/D3cold/
to match other uses and make grep more effective.
> while queueing packets if the MHI state is in M3 wakeup host to bring
> back link to M0.
s/while/While/
s/MHI state is in M3/MHI is in M3/ (twice)
> Signed-off-by: Krishna chaitanya chundru <quic_krichai@...cinc.com>
> ---
> drivers/bus/mhi/ep/main.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
> index b3eafcf2a2c5..b8713e5c1e1a 100644
> --- a/drivers/bus/mhi/ep/main.c
> +++ b/drivers/bus/mhi/ep/main.c
> @@ -25,6 +25,26 @@ static DEFINE_IDA(mhi_ep_cntrl_ida);
> static int mhi_ep_create_device(struct mhi_ep_cntrl *mhi_cntrl, u32 ch_id);
> static int mhi_ep_destroy_device(struct device *dev, void *data);
>
> +static int mhi_ep_wake_host(struct mhi_ep_cntrl *mhi_cntrl)
> +{
> + enum mhi_state state;
> + bool mhi_reset;
> + u32 count = 0;
> +
> + mhi_cntrl->wakeup_host(mhi_cntrl);
> +
> + /* Wait for Host to set the M0 state */
> + while (count++ < M0_WAIT_COUNT) {
> + msleep(M0_WAIT_DELAY_MS);
Tangent: the "M0_WAIT_DELAY_MS" name suggests that is the maximum
delay, but it seems the actual maximum delay is
M0_WAIT_DELAY_MS * M0_WAIT_COUNT.
Tangent 2: unless there's a reason to be different, it would be nice
to use the same loop structure as the similar delay in mhi_ep_enable().
> + mhi_ep_mmio_get_mhi_state(mhi_cntrl, &state, &mhi_reset);
> + if (state == MHI_STATE_M0)
> + return 0;
> + }
> +
> + return -ENODEV;
> +}
Powered by blists - more mailing lists