[PATCH v2 2/3] phy: qualcomm: phy-qcom-eusb2-repeater: Add squelch detect param update

Krishna Kurapati posted 3 patches 2 weeks, 1 day ago
There is a newer version of this series
[PATCH v2 2/3] phy: qualcomm: phy-qcom-eusb2-repeater: Add squelch detect param update
Posted by Krishna Kurapati 2 weeks, 1 day ago
Add support for overriding Squelch Detect parameter.

Signed-off-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
---
 .../phy/qualcomm/phy-qcom-eusb2-repeater.c    | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
index 651a12b59bc8..a75b37d4e16d 100644
--- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
+++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
@@ -37,6 +37,17 @@
 #define EUSB2_TUNE_EUSB_EQU		0x5A
 #define EUSB2_TUNE_EUSB_HS_COMP_CUR	0x5B
 
+static const int squelch_detector[] = {
+	[0] = -6000,
+	[1] = -5000,
+	[2] = -4000,
+	[3] = -3000,
+	[4] = -2000,
+	[5] = -1000,
+	[6] = 0,
+	[7] = 1000,
+};
+
 struct eusb2_repeater_init_tbl_reg {
 	unsigned int reg;
 	unsigned int value;
@@ -120,7 +131,9 @@ static int eusb2_repeater_init(struct phy *phy)
 	struct regmap *regmap = rptr->regmap;
 	u32 base = rptr->base;
 	u32 poll_val;
+	s32 dt_val;
 	int ret;
+	int i;
 	u8 val;
 
 	ret = regulator_bulk_enable(rptr->cfg->num_vregs, rptr->vregs);
@@ -147,6 +160,15 @@ static int eusb2_repeater_init(struct phy *phy)
 	if (!of_property_read_u8(np, "qcom,tune-res-fsdif", &val))
 		regmap_write(regmap, base + EUSB2_TUNE_RES_FSDIF, val);
 
+	if (!of_property_read_s32(np, "qcom,squelch-detector-bp", &dt_val)) {
+		for (i = 0; i < ARRAY_SIZE(squelch_detector); i++) {
+			if (squelch_detector[i] == dt_val) {
+				regmap_write(regmap, base + EUSB2_TUNE_SQUELCH_U, i);
+				break;
+			}
+		}
+	}
+
 	/* Wait for status OK */
 	ret = regmap_read_poll_timeout(regmap, base + EUSB2_RPTR_STATUS, poll_val,
 				       poll_val & RPTR_OK, 10, 5);
-- 
2.34.1
Re: [PATCH v2 2/3] phy: qualcomm: phy-qcom-eusb2-repeater: Add squelch detect param update
Posted by Konrad Dybcio 2 weeks ago
On 12/4/25 5:46 AM, Krishna Kurapati wrote:
> Add support for overriding Squelch Detect parameter.
> 
> Signed-off-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
> ---
>  .../phy/qualcomm/phy-qcom-eusb2-repeater.c    | 22 +++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
> index 651a12b59bc8..a75b37d4e16d 100644
> --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
> +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
> @@ -37,6 +37,17 @@
>  #define EUSB2_TUNE_EUSB_EQU		0x5A
>  #define EUSB2_TUNE_EUSB_HS_COMP_CUR	0x5B
>  
> +static const int squelch_detector[] = {
> +	[0] = -6000,
> +	[1] = -5000,
> +	[2] = -4000,
> +	[3] = -3000,
> +	[4] = -2000,
> +	[5] = -1000,
> +	[6] = 0,
> +	[7] = 1000,
> +};

I forgot to ask, do these values apply to all of the supported repeaters?

i.e.

PM8550B
PMIV0104
SMB2360

Konrad
Re: [PATCH v2 2/3] phy: qualcomm: phy-qcom-eusb2-repeater: Add squelch detect param update
Posted by Krishna Kurapati 1 week, 6 days ago

On 12/5/2025 7:01 PM, Konrad Dybcio wrote:
> On 12/4/25 5:46 AM, Krishna Kurapati wrote:
>> Add support for overriding Squelch Detect parameter.
>>
>> Signed-off-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
>> ---
>>   .../phy/qualcomm/phy-qcom-eusb2-repeater.c    | 22 +++++++++++++++++++
>>   1 file changed, 22 insertions(+)
>>
>> diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
>> index 651a12b59bc8..a75b37d4e16d 100644
>> --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
>> +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
>> @@ -37,6 +37,17 @@
>>   #define EUSB2_TUNE_EUSB_EQU		0x5A
>>   #define EUSB2_TUNE_EUSB_HS_COMP_CUR	0x5B
>>   
>> +static const int squelch_detector[] = {
>> +	[0] = -6000,
>> +	[1] = -5000,
>> +	[2] = -4000,
>> +	[3] = -3000,
>> +	[4] = -2000,
>> +	[5] = -1000,
>> +	[6] = 0,
>> +	[7] = 1000,
>> +};
> 
> I forgot to ask, do these values apply to all of the supported repeaters?
> 

I checked smb2360/pmih010x_eusb2_repeater and pm8550b repeaters 
(SM8{5/6/7}50/ Kaanapali/ Hamoa). For all of them, the above table is same.

Regards,
Krishna,

> i.e.
> 
> PM8550B
> PMIV0104
> SMB2360
> 
> Konrad
Re: [PATCH v2 2/3] phy: qualcomm: phy-qcom-eusb2-repeater: Add squelch detect param update
Posted by Konrad Dybcio 1 week, 4 days ago
On 12/6/25 5:12 PM, Krishna Kurapati wrote:
> 
> 
> On 12/5/2025 7:01 PM, Konrad Dybcio wrote:
>> On 12/4/25 5:46 AM, Krishna Kurapati wrote:
>>> Add support for overriding Squelch Detect parameter.
>>>
>>> Signed-off-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
>>> ---
>>>   .../phy/qualcomm/phy-qcom-eusb2-repeater.c    | 22 +++++++++++++++++++
>>>   1 file changed, 22 insertions(+)
>>>
>>> diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
>>> index 651a12b59bc8..a75b37d4e16d 100644
>>> --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
>>> +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
>>> @@ -37,6 +37,17 @@
>>>   #define EUSB2_TUNE_EUSB_EQU        0x5A
>>>   #define EUSB2_TUNE_EUSB_HS_COMP_CUR    0x5B
>>>   +static const int squelch_detector[] = {
>>> +    [0] = -6000,
>>> +    [1] = -5000,
>>> +    [2] = -4000,
>>> +    [3] = -3000,
>>> +    [4] = -2000,
>>> +    [5] = -1000,
>>> +    [6] = 0,
>>> +    [7] = 1000,
>>> +};
>>
>> I forgot to ask, do these values apply to all of the supported repeaters?
>>
> 
> I checked smb2360/pmih010x_eusb2_repeater and pm8550b repeaters (SM8{5/6/7}50/ Kaanapali/ Hamoa). For all of them, the above table is same.

Thanks

Konrad