mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] bus: mhi: host: pci_generic: Add autosuspend_delay customized support
@ 2026-09-19  9:55 Slark Xiao
  2026-09-22  4:12 ` Krishna Chaitanya Chundru
  0 siblings, 1 reply; 5+ messages in thread
From: Slark Xiao @ 2026-09-19  9:55 UTC (permalink / raw)
  To: mani, jeff.hugo; +Cc: mhi, linux-arm-msm, linux-kernel, Slark Xiao

For some WWAN device, it may get a SYS ERROR issue when resuming
from suspend state frequently. Refer to the Qualcomm Windows
driver, the default value of autosuspend_delay_ms is set as 5000
ms. But in Linux side, all WWAN device were set as 2000ms. We
tried to set this value to 5000ms and we can get a positive test
result.

So we add a support to allow vendor to set a difference value for
specific WWAN device.

BTW, based on the principle of structure alignment, I moved the
location of 'trigger_edl'.

Signed-off-by: Slark Xiao <slark_xiao@163.com>
---
 drivers/bus/mhi/host/pci_generic.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
index b636e2c23b4d..3339b9b2d16d 100644
--- a/drivers/bus/mhi/host/pci_generic.c
+++ b/drivers/bus/mhi/host/pci_generic.c
@@ -23,6 +23,8 @@
 
 #define HEALTH_CHECK_PERIOD (HZ * 2)
 
+#define AUTOSUSPEND_DELAY_MS 2000
+
 /* PCI VID definitions */
 #define PCI_VENDOR_ID_THALES	0x1269
 #define PCI_VENDOR_ID_QUECTEL	0x1eac
@@ -38,11 +40,12 @@
  * @name: name of the PCI module
  * @fw: firmware path (if any)
  * @edl: emergency download mode firmware path (if any)
- * @edl_trigger: capable of triggering EDL mode in the device (if supported)
  * @bar_num: PCI base address register to use for MHI MMIO register space
  * @dma_data_width: DMA transfer word size (32 or 64 bits)
  * @vf_dma_data_width: DMA transfer word size for VF's (optional)
  * @mru_default: default MRU size for MBIM network packets
+ * @autosuspend_delay: customized autosuspend_delay_ms value for specific mhi device
+ * @edl_trigger: capable of triggering EDL mode in the device (if supported)
  * @sideband_wake: Devices using dedicated sideband GPIO for wakeup instead
  *		   of inband wake support (such as sdx24)
  * @no_m3: M3 not supported
@@ -54,11 +57,12 @@ struct mhi_pci_dev_info {
 	const char *name;
 	const char *fw;
 	const char *edl;
-	bool edl_trigger;
 	unsigned int bar_num;
 	unsigned int dma_data_width;
 	unsigned int vf_dma_data_width;
 	unsigned int mru_default;
+	unsigned int autosuspend_delay;
+	bool edl_trigger;
 	bool sideband_wake;
 	bool no_m3;
 	bool reset_on_remove;
@@ -1369,6 +1373,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	struct mhi_pci_device *mhi_pdev;
 	struct mhi_controller *mhi_cntrl;
 	unsigned int dma_data_width;
+	unsigned int autosuspend_delay;
 	int err;
 
 	dev_info(&pdev->dev, "MHI PCI device found: %s\n", info->name);
@@ -1394,6 +1399,9 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	dma_data_width = (pdev->is_virtfn && info->vf_dma_data_width) ?
 			  info->vf_dma_data_width : info->dma_data_width;
 
+	autosuspend_delay = info->autosuspend_delay ? info->autosuspend_delay :
+			  AUTOSUSPEND_DELAY_MS;
+
 	mhi_cntrl->cntrl_dev = &pdev->dev;
 	mhi_cntrl->iova_start = 0;
 	mhi_cntrl->iova_stop = (dma_addr_t)DMA_BIT_MASK(dma_data_width);
@@ -1463,7 +1471,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	/* Allow runtime suspend only if both PME from D3Hot and M3 are supported */
 	if (pci_pme_capable(pdev, PCI_D3hot) && !(info->no_m3)) {
-		pm_runtime_set_autosuspend_delay(&pdev->dev, 2000);
+		pm_runtime_set_autosuspend_delay(&pdev->dev, autosuspend_delay);
 		pm_runtime_use_autosuspend(&pdev->dev);
 		pm_runtime_mark_last_busy(&pdev->dev);
 		pm_runtime_put_noidle(&pdev->dev);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bus: mhi: host: pci_generic: Add autosuspend_delay customized support
  2026-09-19  9:55 [PATCH] bus: mhi: host: pci_generic: Add autosuspend_delay customized support Slark Xiao
@ 2026-09-22  4:12 ` Krishna Chaitanya Chundru
  2026-09-22 11:39   ` Slark Xiao
  0 siblings, 1 reply; 5+ messages in thread
From: Krishna Chaitanya Chundru @ 2026-09-22  4:12 UTC (permalink / raw)
  To: Slark Xiao, mani, jeff.hugo; +Cc: mhi, linux-arm-msm, linux-kernel



On 9/19/2026 3:25 PM, Slark Xiao wrote:
> For some WWAN device, it may get a SYS ERROR issue when resuming
> from suspend state frequently. Refer to the Qualcomm Windows
> driver, the default value of autosuspend_delay_ms is set as 5000
> ms. But in Linux side, all WWAN device were set as 2000ms. We
> tried to set this value to 5000ms and we can get a positive test
> result.
>
> So we add a support to allow vendor to set a difference value for
> specific WWAN device.
you can change auto suspend delay from sysfs, please use that way instead of
doing in the driver.

- Krishna Chaitanya.
> BTW, based on the principle of structure alignment, I moved the
> location of 'trigger_edl'.
>
> Signed-off-by: Slark Xiao <slark_xiao@163.com>
> ---
>  drivers/bus/mhi/host/pci_generic.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
> index b636e2c23b4d..3339b9b2d16d 100644
> --- a/drivers/bus/mhi/host/pci_generic.c
> +++ b/drivers/bus/mhi/host/pci_generic.c
> @@ -23,6 +23,8 @@
>  
>  #define HEALTH_CHECK_PERIOD (HZ * 2)
>  
> +#define AUTOSUSPEND_DELAY_MS 2000
> +
>  /* PCI VID definitions */
>  #define PCI_VENDOR_ID_THALES	0x1269
>  #define PCI_VENDOR_ID_QUECTEL	0x1eac
> @@ -38,11 +40,12 @@
>   * @name: name of the PCI module
>   * @fw: firmware path (if any)
>   * @edl: emergency download mode firmware path (if any)
> - * @edl_trigger: capable of triggering EDL mode in the device (if supported)
>   * @bar_num: PCI base address register to use for MHI MMIO register space
>   * @dma_data_width: DMA transfer word size (32 or 64 bits)
>   * @vf_dma_data_width: DMA transfer word size for VF's (optional)
>   * @mru_default: default MRU size for MBIM network packets
> + * @autosuspend_delay: customized autosuspend_delay_ms value for specific mhi device
> + * @edl_trigger: capable of triggering EDL mode in the device (if supported)
>   * @sideband_wake: Devices using dedicated sideband GPIO for wakeup instead
>   *		   of inband wake support (such as sdx24)
>   * @no_m3: M3 not supported
> @@ -54,11 +57,12 @@ struct mhi_pci_dev_info {
>  	const char *name;
>  	const char *fw;
>  	const char *edl;
> -	bool edl_trigger;
>  	unsigned int bar_num;
>  	unsigned int dma_data_width;
>  	unsigned int vf_dma_data_width;
>  	unsigned int mru_default;
> +	unsigned int autosuspend_delay;
> +	bool edl_trigger;
>  	bool sideband_wake;
>  	bool no_m3;
>  	bool reset_on_remove;
> @@ -1369,6 +1373,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  	struct mhi_pci_device *mhi_pdev;
>  	struct mhi_controller *mhi_cntrl;
>  	unsigned int dma_data_width;
> +	unsigned int autosuspend_delay;
>  	int err;
>  
>  	dev_info(&pdev->dev, "MHI PCI device found: %s\n", info->name);
> @@ -1394,6 +1399,9 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  	dma_data_width = (pdev->is_virtfn && info->vf_dma_data_width) ?
>  			  info->vf_dma_data_width : info->dma_data_width;
>  
> +	autosuspend_delay = info->autosuspend_delay ? info->autosuspend_delay :
> +			  AUTOSUSPEND_DELAY_MS;
> +
>  	mhi_cntrl->cntrl_dev = &pdev->dev;
>  	mhi_cntrl->iova_start = 0;
>  	mhi_cntrl->iova_stop = (dma_addr_t)DMA_BIT_MASK(dma_data_width);
> @@ -1463,7 +1471,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  
>  	/* Allow runtime suspend only if both PME from D3Hot and M3 are supported */
>  	if (pci_pme_capable(pdev, PCI_D3hot) && !(info->no_m3)) {
> -		pm_runtime_set_autosuspend_delay(&pdev->dev, 2000);
> +		pm_runtime_set_autosuspend_delay(&pdev->dev, autosuspend_delay);
>  		pm_runtime_use_autosuspend(&pdev->dev);
>  		pm_runtime_mark_last_busy(&pdev->dev);
>  		pm_runtime_put_noidle(&pdev->dev);


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re:Re: [PATCH] bus: mhi: host: pci_generic: Add autosuspend_delay customized support
  2026-09-22  4:12 ` Krishna Chaitanya Chundru
@ 2026-09-22 11:39   ` Slark Xiao
  2026-09-23  3:54     ` Krishna Chaitanya Chundru
  0 siblings, 1 reply; 5+ messages in thread
From: Slark Xiao @ 2026-09-22 11:39 UTC (permalink / raw)
  To: Krishna Chaitanya Chundru
  Cc: mani, jeff.hugo, mhi, linux-arm-msm, linux-kernel


At 2026-09-22 12:12:35, "Krishna Chaitanya Chundru" <krishna.chundru@oss.qualcomm.com> wrote:
>
>
>On 9/19/2026 3:25 PM, Slark Xiao wrote:
>> For some WWAN device, it may get a SYS ERROR issue when resuming
>> from suspend state frequently. Refer to the Qualcomm Windows
>> driver, the default value of autosuspend_delay_ms is set as 5000
>> ms. But in Linux side, all WWAN device were set as 2000ms. We
>> tried to set this value to 5000ms and we can get a positive test
>> result.
>>
>> So we add a support to allow vendor to set a difference value for
>> specific WWAN device.
>you can change auto suspend delay from sysfs, please use that way instead of
>doing in the driver.
>
>- Krishna Chaitanya.
Yes, we can do this by setting the sysfs API . However, not all users 
are aware of this method. Additionally, this approach is only
effective for a single instance; it requires reconfiguration after each
restart, which is quite inconvenient.

Though I want to set the default value from 2000 to 5000, refer to
the Qualcomm Windows driver, I don't want this change to affect
the default configuration of other vendors. 

This attribute should belong to specific WWAN devices, such as
SDX65, SDX72 or QDU100, rather than to the same category of
devices, like all MHI devices sharing a single setting.

BTW, I saw some one add 'no_m3' flag for their SDX7X device.
Why can they disable suspend on the same SDX7X device, while
I can't adjust the suspend delay time? That's curious.

Thanks
>> BTW, based on the principle of structure alignment, I moved the
>> location of 'trigger_edl'.
>>
>> Signed-off-by: Slark Xiao <slark_xiao@163.com>
>> ---
>>  drivers/bus/mhi/host/pci_generic.c | 14 +++++++++++---
>>  1 file changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
>> index b636e2c23b4d..3339b9b2d16d 100644
>> --- a/drivers/bus/mhi/host/pci_generic.c
>> +++ b/drivers/bus/mhi/host/pci_generic.c
>> @@ -23,6 +23,8 @@
>>  
>>  #define HEALTH_CHECK_PERIOD (HZ * 2)
>>  
>> +#define AUTOSUSPEND_DELAY_MS 2000
>> +
>>  /* PCI VID definitions */
>>  #define PCI_VENDOR_ID_THALES	0x1269
>>  #define PCI_VENDOR_ID_QUECTEL	0x1eac
>> @@ -38,11 +40,12 @@
>>   * @name: name of the PCI module
>>   * @fw: firmware path (if any)
>>   * @edl: emergency download mode firmware path (if any)
>> - * @edl_trigger: capable of triggering EDL mode in the device (if supported)
>>   * @bar_num: PCI base address register to use for MHI MMIO register space
>>   * @dma_data_width: DMA transfer word size (32 or 64 bits)
>>   * @vf_dma_data_width: DMA transfer word size for VF's (optional)
>>   * @mru_default: default MRU size for MBIM network packets
>> + * @autosuspend_delay: customized autosuspend_delay_ms value for specific mhi device
>> + * @edl_trigger: capable of triggering EDL mode in the device (if supported)
>>   * @sideband_wake: Devices using dedicated sideband GPIO for wakeup instead
>>   *		   of inband wake support (such as sdx24)
>>   * @no_m3: M3 not supported
>> @@ -54,11 +57,12 @@ struct mhi_pci_dev_info {
>>  	const char *name;
>>  	const char *fw;
>>  	const char *edl;
>> -	bool edl_trigger;
>>  	unsigned int bar_num;
>>  	unsigned int dma_data_width;
>>  	unsigned int vf_dma_data_width;
>>  	unsigned int mru_default;
>> +	unsigned int autosuspend_delay;
>> +	bool edl_trigger;
>>  	bool sideband_wake;
>>  	bool no_m3;
>>  	bool reset_on_remove;
>> @@ -1369,6 +1373,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>  	struct mhi_pci_device *mhi_pdev;
>>  	struct mhi_controller *mhi_cntrl;
>>  	unsigned int dma_data_width;
>> +	unsigned int autosuspend_delay;
>>  	int err;
>>  
>>  	dev_info(&pdev->dev, "MHI PCI device found: %s\n", info->name);
>> @@ -1394,6 +1399,9 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>  	dma_data_width = (pdev->is_virtfn && info->vf_dma_data_width) ?
>>  			  info->vf_dma_data_width : info->dma_data_width;
>>  
>> +	autosuspend_delay = info->autosuspend_delay ? info->autosuspend_delay :
>> +			  AUTOSUSPEND_DELAY_MS;
>> +
>>  	mhi_cntrl->cntrl_dev = &pdev->dev;
>>  	mhi_cntrl->iova_start = 0;
>>  	mhi_cntrl->iova_stop = (dma_addr_t)DMA_BIT_MASK(dma_data_width);
>> @@ -1463,7 +1471,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>  
>>  	/* Allow runtime suspend only if both PME from D3Hot and M3 are supported */
>>  	if (pci_pme_capable(pdev, PCI_D3hot) && !(info->no_m3)) {
>> -		pm_runtime_set_autosuspend_delay(&pdev->dev, 2000);
>> +		pm_runtime_set_autosuspend_delay(&pdev->dev, autosuspend_delay);
>>  		pm_runtime_use_autosuspend(&pdev->dev);
>>  		pm_runtime_mark_last_busy(&pdev->dev);
>>  		pm_runtime_put_noidle(&pdev->dev);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bus: mhi: host: pci_generic: Add autosuspend_delay customized support
  2026-09-22 11:39   ` Slark Xiao
@ 2026-09-23  3:54     ` Krishna Chaitanya Chundru
  2026-09-23  9:49       ` Slark Xiao
  0 siblings, 1 reply; 5+ messages in thread
From: Krishna Chaitanya Chundru @ 2026-09-23  3:54 UTC (permalink / raw)
  To: Slark Xiao; +Cc: mani, jeff.hugo, mhi, linux-arm-msm, linux-kernel



On 9/22/2026 5:09 PM, Slark Xiao wrote:
> At 2026-09-22 12:12:35, "Krishna Chaitanya Chundru" <krishna.chundru@oss.qualcomm.com> wrote:
>>
>> On 9/19/2026 3:25 PM, Slark Xiao wrote:
>>> For some WWAN device, it may get a SYS ERROR issue when resuming
>>> from suspend state frequently. Refer to the Qualcomm Windows
>>> driver, the default value of autosuspend_delay_ms is set as 5000
>>> ms. But in Linux side, all WWAN device were set as 2000ms. We
>>> tried to set this value to 5000ms and we can get a positive test
>>> result.
>>>
>>> So we add a support to allow vendor to set a difference value for
>>> specific WWAN device.
>> you can change auto suspend delay from sysfs, please use that way instead of
>> doing in the driver.
>>
>> - Krishna Chaitanya.
> Yes, we can do this by setting the sysfs API . However, not all users 
> are aware of this method. Additionally, this approach is only
> effective for a single instance; it requires reconfiguration after each
> restart, which is quite inconvenient.
you can have udev rule to set this without any user intervention.
> Though I want to set the default value from 2000 to 5000, refer to
> the Qualcomm Windows driver, I don't want this change to affect
> the default configuration of other vendors. 
>
> This attribute should belong to specific WWAN devices, such as
> SDX65, SDX72 or QDU100, rather than to the same category of
> devices, like all MHI devices sharing a single setting.
>
> BTW, I saw some one add 'no_m3' flag for their SDX7X device.
> Why can they disable suspend on the same SDX7X device, while
> I can't adjust the suspend delay time? That's curious.
no_m3 flag is for qdu100 target, where the target itself will not support M3.
It is not just disabling suspend but also make sure device never enters m3 even
in system suspend case. 

There is already support from sysfs to change the time, doing again that in
the driver is just duplication of work.

- Krishna Chaitanya.
>
> Thanks
>>> BTW, based on the principle of structure alignment, I moved the
>>> location of 'trigger_edl'.
>>>
>>> Signed-off-by: Slark Xiao <slark_xiao@163.com>
>>> ---
>>>  drivers/bus/mhi/host/pci_generic.c | 14 +++++++++++---
>>>  1 file changed, 11 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
>>> index b636e2c23b4d..3339b9b2d16d 100644
>>> --- a/drivers/bus/mhi/host/pci_generic.c
>>> +++ b/drivers/bus/mhi/host/pci_generic.c
>>> @@ -23,6 +23,8 @@
>>>  
>>>  #define HEALTH_CHECK_PERIOD (HZ * 2)
>>>  
>>> +#define AUTOSUSPEND_DELAY_MS 2000
>>> +
>>>  /* PCI VID definitions */
>>>  #define PCI_VENDOR_ID_THALES	0x1269
>>>  #define PCI_VENDOR_ID_QUECTEL	0x1eac
>>> @@ -38,11 +40,12 @@
>>>   * @name: name of the PCI module
>>>   * @fw: firmware path (if any)
>>>   * @edl: emergency download mode firmware path (if any)
>>> - * @edl_trigger: capable of triggering EDL mode in the device (if supported)
>>>   * @bar_num: PCI base address register to use for MHI MMIO register space
>>>   * @dma_data_width: DMA transfer word size (32 or 64 bits)
>>>   * @vf_dma_data_width: DMA transfer word size for VF's (optional)
>>>   * @mru_default: default MRU size for MBIM network packets
>>> + * @autosuspend_delay: customized autosuspend_delay_ms value for specific mhi device
>>> + * @edl_trigger: capable of triggering EDL mode in the device (if supported)
>>>   * @sideband_wake: Devices using dedicated sideband GPIO for wakeup instead
>>>   *		   of inband wake support (such as sdx24)
>>>   * @no_m3: M3 not supported
>>> @@ -54,11 +57,12 @@ struct mhi_pci_dev_info {
>>>  	const char *name;
>>>  	const char *fw;
>>>  	const char *edl;
>>> -	bool edl_trigger;
>>>  	unsigned int bar_num;
>>>  	unsigned int dma_data_width;
>>>  	unsigned int vf_dma_data_width;
>>>  	unsigned int mru_default;
>>> +	unsigned int autosuspend_delay;
>>> +	bool edl_trigger;
>>>  	bool sideband_wake;
>>>  	bool no_m3;
>>>  	bool reset_on_remove;
>>> @@ -1369,6 +1373,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>>  	struct mhi_pci_device *mhi_pdev;
>>>  	struct mhi_controller *mhi_cntrl;
>>>  	unsigned int dma_data_width;
>>> +	unsigned int autosuspend_delay;
>>>  	int err;
>>>  
>>>  	dev_info(&pdev->dev, "MHI PCI device found: %s\n", info->name);
>>> @@ -1394,6 +1399,9 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>>  	dma_data_width = (pdev->is_virtfn && info->vf_dma_data_width) ?
>>>  			  info->vf_dma_data_width : info->dma_data_width;
>>>  
>>> +	autosuspend_delay = info->autosuspend_delay ? info->autosuspend_delay :
>>> +			  AUTOSUSPEND_DELAY_MS;
>>> +
>>>  	mhi_cntrl->cntrl_dev = &pdev->dev;
>>>  	mhi_cntrl->iova_start = 0;
>>>  	mhi_cntrl->iova_stop = (dma_addr_t)DMA_BIT_MASK(dma_data_width);
>>> @@ -1463,7 +1471,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>>  
>>>  	/* Allow runtime suspend only if both PME from D3Hot and M3 are supported */
>>>  	if (pci_pme_capable(pdev, PCI_D3hot) && !(info->no_m3)) {
>>> -		pm_runtime_set_autosuspend_delay(&pdev->dev, 2000);
>>> +		pm_runtime_set_autosuspend_delay(&pdev->dev, autosuspend_delay);
>>>  		pm_runtime_use_autosuspend(&pdev->dev);
>>>  		pm_runtime_mark_last_busy(&pdev->dev);
>>>  		pm_runtime_put_noidle(&pdev->dev);


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re:Re: [PATCH] bus: mhi: host: pci_generic: Add autosuspend_delay customized support
  2026-09-23  3:54     ` Krishna Chaitanya Chundru
@ 2026-09-23  9:49       ` Slark Xiao
  0 siblings, 0 replies; 5+ messages in thread
From: Slark Xiao @ 2026-09-23  9:49 UTC (permalink / raw)
  To: Krishna Chaitanya Chundru
  Cc: mani, jeff.hugo, mhi, linux-arm-msm, linux-kernel


At 2026-09-23 11:54:55, "Krishna Chaitanya Chundru" <krishna.chundru@oss.qualcomm.com> wrote:
>
>
>On 9/22/2026 5:09 PM, Slark Xiao wrote:
>> At 2026-09-22 12:12:35, "Krishna Chaitanya Chundru" <krishna.chundru@oss.qualcomm.com> wrote:
>>>
>>> On 9/19/2026 3:25 PM, Slark Xiao wrote:
>>>> For some WWAN device, it may get a SYS ERROR issue when resuming
>>>> from suspend state frequently. Refer to the Qualcomm Windows
>>>> driver, the default value of autosuspend_delay_ms is set as 5000
>>>> ms. But in Linux side, all WWAN device were set as 2000ms. We
>>>> tried to set this value to 5000ms and we can get a positive test
>>>> result.
>>>>
>>>> So we add a support to allow vendor to set a difference value for
>>>> specific WWAN device.
>>> you can change auto suspend delay from sysfs, please use that way instead of
>>> doing in the driver.
>>>
>>> - Krishna Chaitanya.
>> Yes, we can do this by setting the sysfs API . However, not all users 
>> are aware of this method. Additionally, this approach is only
>> effective for a single instance; it requires reconfiguration after each
>> restart, which is quite inconvenient.
>you can have udev rule to set this without any user intervention.
>> Though I want to set the default value from 2000 to 5000, refer to
>> the Qualcomm Windows driver, I don't want this change to affect
>> the default configuration of other vendors. 
>>
>> This attribute should belong to specific WWAN devices, such as
>> SDX65, SDX72 or QDU100, rather than to the same category of
>> devices, like all MHI devices sharing a single setting.
>>
>> BTW, I saw some one add 'no_m3' flag for their SDX7X device.
>> Why can they disable suspend on the same SDX7X device, while
>> I can't adjust the suspend delay time? That's curious.
>no_m3 flag is for qdu100 target, where the target itself will not support M3.
>It is not just disabling suspend but also make sure device never enters m3 even
>in system suspend case. 
>
>There is already support from sysfs to change the time, doing again that in
>the driver is just duplication of work.
>
>- Krishna Chaitanya.
I mean another device, you can refer to below link:
https://lore.kernel.org/mhi/20260701095344.309409-1-zwq2226404116@163.com/

Anyway, if the kernel design is not allowed vendor to set the autosuspend 
delay as a customized item, I will follow this.

Oh wait, I am not sure if you have been confused by the title. You may think that
this customized support method has conflicted with the sysfs API. But actually, 
this patch would not be the only patch for this feature. We may provide more
settings for our device, like we set the T99W696 as 2000ms, DW5934e as 5000
ms.....
This customization is for different WWAN device(with different default settings), 
not for a single device during different scenario.

I hope the above explanation helps you understand the intention behind
my submitted patch. Thank you once again!

>>
>> Thanks
>>>> BTW, based on the principle of structure alignment, I moved the
>>>> location of 'trigger_edl'.
>>>>
>>>> Signed-off-by: Slark Xiao <slark_xiao@163.com>
>>>> ---
>>>>  drivers/bus/mhi/host/pci_generic.c | 14 +++++++++++---
>>>>  1 file changed, 11 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
>>>> index b636e2c23b4d..3339b9b2d16d 100644
>>>> --- a/drivers/bus/mhi/host/pci_generic.c
>>>> +++ b/drivers/bus/mhi/host/pci_generic.c
>>>> @@ -23,6 +23,8 @@
>>>>  
>>>>  #define HEALTH_CHECK_PERIOD (HZ * 2)
>>>>  
>>>> +#define AUTOSUSPEND_DELAY_MS 2000
>>>> +
>>>>  /* PCI VID definitions */
>>>>  #define PCI_VENDOR_ID_THALES	0x1269
>>>>  #define PCI_VENDOR_ID_QUECTEL	0x1eac
>>>> @@ -38,11 +40,12 @@
>>>>   * @name: name of the PCI module
>>>>   * @fw: firmware path (if any)
>>>>   * @edl: emergency download mode firmware path (if any)
>>>> - * @edl_trigger: capable of triggering EDL mode in the device (if supported)
>>>>   * @bar_num: PCI base address register to use for MHI MMIO register space
>>>>   * @dma_data_width: DMA transfer word size (32 or 64 bits)
>>>>   * @vf_dma_data_width: DMA transfer word size for VF's (optional)
>>>>   * @mru_default: default MRU size for MBIM network packets
>>>> + * @autosuspend_delay: customized autosuspend_delay_ms value for specific mhi device
>>>> + * @edl_trigger: capable of triggering EDL mode in the device (if supported)
>>>>   * @sideband_wake: Devices using dedicated sideband GPIO for wakeup instead
>>>>   *		   of inband wake support (such as sdx24)
>>>>   * @no_m3: M3 not supported
>>>> @@ -54,11 +57,12 @@ struct mhi_pci_dev_info {
>>>>  	const char *name;
>>>>  	const char *fw;
>>>>  	const char *edl;
>>>> -	bool edl_trigger;
>>>>  	unsigned int bar_num;
>>>>  	unsigned int dma_data_width;
>>>>  	unsigned int vf_dma_data_width;
>>>>  	unsigned int mru_default;
>>>> +	unsigned int autosuspend_delay;
>>>> +	bool edl_trigger;
>>>>  	bool sideband_wake;
>>>>  	bool no_m3;
>>>>  	bool reset_on_remove;
>>>> @@ -1369,6 +1373,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>>>  	struct mhi_pci_device *mhi_pdev;
>>>>  	struct mhi_controller *mhi_cntrl;
>>>>  	unsigned int dma_data_width;
>>>> +	unsigned int autosuspend_delay;
>>>>  	int err;
>>>>  
>>>>  	dev_info(&pdev->dev, "MHI PCI device found: %s\n", info->name);
>>>> @@ -1394,6 +1399,9 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>>>  	dma_data_width = (pdev->is_virtfn && info->vf_dma_data_width) ?
>>>>  			  info->vf_dma_data_width : info->dma_data_width;
>>>>  
>>>> +	autosuspend_delay = info->autosuspend_delay ? info->autosuspend_delay :
>>>> +			  AUTOSUSPEND_DELAY_MS;
>>>> +
>>>>  	mhi_cntrl->cntrl_dev = &pdev->dev;
>>>>  	mhi_cntrl->iova_start = 0;
>>>>  	mhi_cntrl->iova_stop = (dma_addr_t)DMA_BIT_MASK(dma_data_width);
>>>> @@ -1463,7 +1471,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>>>  
>>>>  	/* Allow runtime suspend only if both PME from D3Hot and M3 are supported */
>>>>  	if (pci_pme_capable(pdev, PCI_D3hot) && !(info->no_m3)) {
>>>> -		pm_runtime_set_autosuspend_delay(&pdev->dev, 2000);
>>>> +		pm_runtime_set_autosuspend_delay(&pdev->dev, autosuspend_delay);
>>>>  		pm_runtime_use_autosuspend(&pdev->dev);
>>>>  		pm_runtime_mark_last_busy(&pdev->dev);
>>>>  		pm_runtime_put_noidle(&pdev->dev);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-23  9:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-19  9:55 [PATCH] bus: mhi: host: pci_generic: Add autosuspend_delay customized support Slark Xiao
2026-09-22  4:12 ` Krishna Chaitanya Chundru
2026-09-22 11:39   ` Slark Xiao
2026-09-23  3:54     ` Krishna Chaitanya Chundru
2026-09-23  9:49       ` Slark Xiao

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®