Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit fa3532b

Browse files
konradybciogregkh
authored andcommitted
phy: qualcomm: phy-qcom-eusb2-repeater: Add tuning overrides
[ Upstream commit 56156a7 ] There are devices in the wild, like the Sony Xperia 1 V that *require* different tuning than the base design for USB to work. Add support for overriding the necessary tuning values. Signed-off-by: Konrad Dybcio <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]> Stable-dep-of: 734550d ("phy: qualcomm: eusb2-repeater: Rework init to drop redundant zero-out loop") Signed-off-by: Sasha Levin <[email protected]>
1 parent e905bc7 commit fa3532b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ static int eusb2_repeater_init(struct phy *phy)
142142
{
143143
struct reg_field *regfields = eusb2_repeater_tune_reg_fields;
144144
struct eusb2_repeater *rptr = phy_get_drvdata(phy);
145-
const u32 *init_tbl = rptr->cfg->init_tbl;
145+
struct device_node *np = rptr->dev->of_node;
146+
u32 init_tbl[F_NUM_TUNE_FIELDS] = { 0 };
147+
u8 override;
146148
u32 val;
147149
int ret;
148150
int i;
@@ -163,6 +165,19 @@ static int eusb2_repeater_init(struct phy *phy)
163165
regmap_field_update_bits(rptr->regs[i], mask, 0);
164166
}
165167
}
168+
memcpy(init_tbl, rptr->cfg->init_tbl, sizeof(init_tbl));
169+
170+
if (!of_property_read_u8(np, "qcom,tune-usb2-amplitude", &override))
171+
init_tbl[F_TUNE_IUSB2] = override;
172+
173+
if (!of_property_read_u8(np, "qcom,tune-usb2-disc-thres", &override))
174+
init_tbl[F_TUNE_HSDISC] = override;
175+
176+
if (!of_property_read_u8(np, "qcom,tune-usb2-preem", &override))
177+
init_tbl[F_TUNE_USB2_PREEM] = override;
178+
179+
for (i = 0; i < F_NUM_TUNE_FIELDS; i++)
180+
regmap_field_update_bits(rptr->regs[i], init_tbl[i], init_tbl[i]);
166181

167182
ret = regmap_field_read_poll_timeout(rptr->regs[F_RPTR_STATUS],
168183
val, val & RPTR_OK, 10, 5);

0 commit comments

Comments
 (0)