mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krishna Chaitanya Chundru <quic_krichai@quicinc.com>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: manivannan.sadhasivam@linaro.org, helgaas@kernel.org,
	linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, quic_vbadigan@quicinc.com,
	quic_nitegupt@quicinc.com, quic_skananth@quicinc.com,
	quic_ramkri@quicinc.com, krzysztof.kozlowski@linaro.org,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Jeffrey Hugo" <quic_jhugo@quicinc.com>,
	"open list:MHI BUS" <mhi@lists.linux.dev>
Subject: Re: [PATCH v2 7/8] PCI: epf-mhi: Add wakeup host op
Date: Fri, 7 Jul 2023 16:30:46 +0530	[thread overview]
Message-ID: <1d0bdd8d-0d6f-418a-e219-de71850d847a@quicinc.com> (raw)
In-Reply-To: <20230707061448.GF6001@thinkpad>


On 7/7/2023 11:44 AM, Manivannan Sadhasivam wrote:
> On Fri, Jun 30, 2023 at 04:22:10PM +0530, Krishna chaitanya chundru wrote:
>> Add wakeup host op for MHI EPF.
>> If the D-state is in D3cold toggle wake signal, otherwise send PME.
>>
>> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
>> ---
>>   drivers/pci/endpoint/functions/pci-epf-mhi.c | 19 +++++++++++++++++++
>>   include/linux/mhi_ep.h                       |  1 +
>>   2 files changed, 20 insertions(+)
>>
>> diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c
>> index 64ff37d..deb742c 100644
>> --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c
>> +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c
>> @@ -237,6 +237,24 @@ static int pci_epf_mhi_write_to_host(struct mhi_ep_cntrl *mhi_cntrl,
>>   	return 0;
>>   }
>>   
>> +static int pci_epf_mhi_wakeup_host(struct mhi_ep_cntrl *mhi_cntrl)
>> +{
>> +	struct pci_epf_mhi *epf_mhi = to_epf_mhi(mhi_cntrl);
>> +	struct pci_epf *epf = epf_mhi->epf;
>> +	struct pci_epc *epc = epf->epc;
>> +	int ret;
>> +
>> +	if (mhi_cntrl->dstate == PCI_D3cold)
>> +		ret = pci_epc_wakeup_host(epc, epf->func_no,
>> +					epf->vfunc_no, PCI_WAKEUP_TOGGLE_WAKE);
>> +	else
>> +		ret = pci_epc_wakeup_host(epc, epf->func_no,
>> +					epf->vfunc_no, PCI_WAKEUP_SEND_PME);
>> +
> If the wakeup argument is of type bool (ie. bool use_pme), then
>
> 	wakeup = (mhi_cntrl->dstate == PCI_D3cold) ? false : true;
>
> 	return pci_epc_wakeup_host(epc, epf->func_no, epf->vfunc_no, state);
>
> - Mani

better to use type as it as it has more readability

but I have taken your inputs here and will change the code as suggetsed.

- KC

>> +	return ret;
>> +
>> +}
>> +
>>   static int pci_epf_mhi_core_init(struct pci_epf *epf)
>>   {
>>   	struct pci_epf_mhi *epf_mhi = epf_get_drvdata(epf);
>> @@ -293,6 +311,7 @@ static int pci_epf_mhi_link_up(struct pci_epf *epf)
>>   	mhi_cntrl->unmap_free = pci_epf_mhi_unmap_free;
>>   	mhi_cntrl->read_from_host = pci_epf_mhi_read_from_host;
>>   	mhi_cntrl->write_to_host = pci_epf_mhi_write_to_host;
>> +	mhi_cntrl->wakeup_host = pci_epf_mhi_wakeup_host;
>>   
>>   	/* Register the MHI EP controller */
>>   	ret = mhi_ep_register_controller(mhi_cntrl, info->config);
>> diff --git a/include/linux/mhi_ep.h b/include/linux/mhi_ep.h
>> index c3a0685..e353c429 100644
>> --- a/include/linux/mhi_ep.h
>> +++ b/include/linux/mhi_ep.h
>> @@ -137,6 +137,7 @@ struct mhi_ep_cntrl {
>>   			   void __iomem *virt, size_t size);
>>   	int (*read_from_host)(struct mhi_ep_cntrl *mhi_cntrl, u64 from, void *to, size_t size);
>>   	int (*write_to_host)(struct mhi_ep_cntrl *mhi_cntrl, void *from, u64 to, size_t size);
>> +	int (*wakeup_host)(struct mhi_ep_cntrl *mhi_cntrl);
>>   
>>   	enum mhi_state mhi_state;
>>   
>> -- 
>> 2.7.4
>>

  reply	other threads:[~2023-07-07 11:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30 10:52 [PATCH v2 0/8] PCCI: EPC: Add support to wake up host from D3 states Krishna chaitanya chundru
2023-06-30 10:52 ` [PATCH v2 1/8] PCI: endpoint: Add dstate change notifier support Krishna chaitanya chundru
2023-07-07  5:44   ` Manivannan Sadhasivam
2023-07-07 10:52     ` Krishna Chaitanya Chundru
2023-06-30 10:52 ` [PATCH v2 2/8] PCI: qcom-ep: Add support for D-state change notification Krishna chaitanya chundru
2023-07-07  5:51   ` Manivannan Sadhasivam
2023-07-07 10:54     ` Krishna Chaitanya Chundru
2023-07-13 20:04   ` kernel test robot
2023-06-30 10:52 ` [PATCH v2 3/8] PCI: epf-mhi: Add dtate change op Krishna chaitanya chundru
2023-07-07  5:59   ` Manivannan Sadhasivam
2023-07-07 10:55     ` Krishna Chaitanya Chundru
2023-06-30 10:52 ` [PATCH v2 4/8] PCI: endpoint: Add wakeup host API to EPC core Krishna chaitanya chundru
2023-07-07  6:04   ` Manivannan Sadhasivam
2023-07-07 10:57     ` Krishna Chaitanya Chundru
2023-06-30 10:52 ` [PATCH v2 5/8] pci: dwc: Add wakeup host op to pci_epc_ops Krishna chaitanya chundru
2023-06-30 10:52 ` [PATCH v2 6/8] PCI: qcom: ep: Add wake up host op to dw_pcie_ep_ops Krishna chaitanya chundru
2023-07-07  6:10   ` Manivannan Sadhasivam
2023-07-07 10:58     ` Krishna Chaitanya Chundru
2023-06-30 10:52 ` [PATCH v2 7/8] PCI: epf-mhi: Add wakeup host op Krishna chaitanya chundru
2023-07-07  6:14   ` Manivannan Sadhasivam
2023-07-07 11:00     ` Krishna Chaitanya Chundru [this message]
2023-06-30 10:52 ` [PATCH v2 8/8] bus: mhi: ep: wake up host is the MHI state is in M3 Krishna chaitanya chundru
2023-07-07  6:20   ` Manivannan Sadhasivam
2023-07-07 11:01     ` Krishna Chaitanya Chundru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1d0bdd8d-0d6f-418a-e219-de71850d847a@quicinc.com \
    --to=quic_krichai@quicinc.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=kishon@kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=kw@linux.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mhi@lists.linux.dev \
    --cc=quic_jhugo@quicinc.com \
    --cc=quic_nitegupt@quicinc.com \
    --cc=quic_ramkri@quicinc.com \
    --cc=quic_skananth@quicinc.com \
    --cc=quic_vbadigan@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®