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

From: Konrad Dybcio

Date: Wed Dec 03 2025 - 06:15:05 EST


On 12/3/25 9:36 AM, Krishna Kurapati wrote:
> Add support for overriding Squelch Detect parameter.
>
> Signed-off-by: Krishna Kurapati <krishna.kurapati@xxxxxxxxxxxxxxxx>
> ---

[...]

> 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,14 @@ 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 < 8; i++) {
> + if (squelch_detector[i] == dt_val)
> + val = i;
> + }
> + regmap_write(regmap, base + EUSB2_TUNE_SQUELCH_U, val);


How about:

if (!of_property..) {
for (i = 0; i < ARRAY_SIZE(squelch_detector); i++) {
if (squelch_detector[i] == dt_val) {
regmap_write()
break;
}
}
}

We could also validate the value (if none found but property present, error
out), but the dt checker already lists all the available values so that may
not be necessary

Konrad