diff mbox series

[v5,3/4] PCI: qcom-ep: Update the D-state log

Message ID 1690948281-2143-4-git-send-email-quic_krichai@quicinc.com
State New
Headers show
Series PCI: endpoint: add D-state change notifier support | expand

Commit Message

Krishna chaitanya chundru Aug. 2, 2023, 3:51 a.m. UTC
Now that the state event is stored as pci_power_t, let's use the PCI helper
pci_power_name() to print the state event.

Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bjorn Helgaas Aug. 3, 2023, 5:58 p.m. UTC | #1
In subject:

  PCI: qcom-ep: Print D-state name to distinguish D3hot/D3cold

("Update" doesn't give any hint about what the change does.)

On Wed, Aug 02, 2023 at 09:21:20AM +0530, Krishna chaitanya chundru wrote:
> Now that the state event is stored as pci_power_t, let's use the PCI helper
> pci_power_name() to print the state event.

s/let's use/use/

The main change is this, right?

  D3 -> D3hot
  D4 -> D3cold

> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
> ---
>  drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> index 22545ff..0c69a61 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> @@ -583,7 +583,6 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
>  	} else if (FIELD_GET(PARF_INT_ALL_DSTATE_CHANGE, status)) {
>  		dstate = dw_pcie_readl_dbi(pci, DBI_CON_STATUS) &
>  					   DBI_CON_STATUS_POWER_STATE_MASK;
> -		dev_dbg(dev, "Received D%d state event\n", dstate);
>  		state = dstate;
>  		if (dstate == 3) {

Can this check for "state == PCI_D3hot" to be clearer?

>  			val = readl_relaxed(pcie_ep->parf + PARF_PM_CTRL);
> @@ -594,6 +593,7 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
>  			if (gpiod_get_value(pcie_ep->reset))
>  				state = PCI_D3cold;
>  		}
> +		dev_dbg(dev, "Received %s event\n", pci_power_name(state));

Not really sure why this needs to be moved (the diff would be clearer
if it stayed in the same spot), but it doesn't look like it really
matters.

>  		pci_epc_dstate_notify(pci->ep.epc, state);
>  	} else if (FIELD_GET(PARF_INT_ALL_LINK_UP, status)) {
>  		dev_dbg(dev, "Received Linkup event. Enumeration complete!\n");
> -- 
> 2.7.4
>
Krishna chaitanya chundru Sept. 8, 2023, 4:43 a.m. UTC | #2
On 8/3/2023 11:28 PM, Bjorn Helgaas wrote:
> In subject:
>
>    PCI: qcom-ep: Print D-state name to distinguish D3hot/D3cold
>
> ("Update" doesn't give any hint about what the change does.)
I will update it as suggested.
> On Wed, Aug 02, 2023 at 09:21:20AM +0530, Krishna chaitanya chundru wrote:
>> Now that the state event is stored as pci_power_t, let's use the PCI helper
>> pci_power_name() to print the state event.
> s/let's use/use/
>
> The main change is this, right?
>
>    D3 -> D3hot
>    D4 -> D3cold
Yes this is the main change.
>> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
>> ---
>>   drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
>> index 22545ff..0c69a61 100644
>> --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
>> +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
>> @@ -583,7 +583,6 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
>>   	} else if (FIELD_GET(PARF_INT_ALL_DSTATE_CHANGE, status)) {
>>   		dstate = dw_pcie_readl_dbi(pci, DBI_CON_STATUS) &
>>   					   DBI_CON_STATUS_POWER_STATE_MASK;
>> -		dev_dbg(dev, "Received D%d state event\n", dstate);
>>   		state = dstate;
>>   		if (dstate == 3) {
> Can this check for "state == PCI_D3hot" to be clearer?
I will modify this.
>
>>   			val = readl_relaxed(pcie_ep->parf + PARF_PM_CTRL);
>> @@ -594,6 +593,7 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
>>   			if (gpiod_get_value(pcie_ep->reset))
>>   				state = PCI_D3cold;
>>   		}
>> +		dev_dbg(dev, "Received %s event\n", pci_power_name(state));
> Not really sure why this needs to be moved (the diff would be clearer
> if it stayed in the same spot), but it doesn't look like it really
> matters.

As we know if the link is in D3hot or D3cold moving the log here so that 
we can log correct Dstate.

- KC

>>   		pci_epc_dstate_notify(pci->ep.epc, state);
>>   	} else if (FIELD_GET(PARF_INT_ALL_LINK_UP, status)) {
>>   		dev_dbg(dev, "Received Linkup event. Enumeration complete!\n");
>> -- 
>> 2.7.4
>>
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 22545ff..0c69a61 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -583,7 +583,6 @@  static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
 	} else if (FIELD_GET(PARF_INT_ALL_DSTATE_CHANGE, status)) {
 		dstate = dw_pcie_readl_dbi(pci, DBI_CON_STATUS) &
 					   DBI_CON_STATUS_POWER_STATE_MASK;
-		dev_dbg(dev, "Received D%d state event\n", dstate);
 		state = dstate;
 		if (dstate == 3) {
 			val = readl_relaxed(pcie_ep->parf + PARF_PM_CTRL);
@@ -594,6 +593,7 @@  static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
 			if (gpiod_get_value(pcie_ep->reset))
 				state = PCI_D3cold;
 		}
+		dev_dbg(dev, "Received %s event\n", pci_power_name(state));
 		pci_epc_dstate_notify(pci->ep.epc, state);
 	} else if (FIELD_GET(PARF_INT_ALL_LINK_UP, status)) {
 		dev_dbg(dev, "Received Linkup event. Enumeration complete!\n");