Skip to content

Commit ee81f2e

Browse files
jhovoldvinodkoul
authored andcommitted
phy: qcom-qmp-combo: drop redundant clock structure
Drop the unnecessary DP clock structure and instead store the clocks directly in the driver data. Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 0dd521d commit ee81f2e

File tree

1 file changed

+17
-35
lines changed

1 file changed

+17
-35
lines changed

drivers/phy/qualcomm/phy-qcom-qmp-combo.c

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -859,12 +859,6 @@ struct qmp_phy_cfg {
859859

860860
};
861861

862-
struct qmp_phy_dp_clks {
863-
struct qmp_combo *qmp;
864-
struct clk_hw dp_link_hw;
865-
struct clk_hw dp_pixel_hw;
866-
};
867-
868862
struct qmp_combo {
869863
struct device *dev;
870864

@@ -900,7 +894,9 @@ struct qmp_combo {
900894
struct phy *dp_phy;
901895
unsigned int dp_aux_cfg;
902896
struct phy_configure_opts_dp dp_opts;
903-
struct qmp_phy_dp_clks *dp_clks;
897+
898+
struct clk_hw dp_link_hw;
899+
struct clk_hw dp_pixel_hw;
904900
};
905901

906902
static void qmp_v3_dp_aux_init(struct qmp_combo *qmp);
@@ -1387,7 +1383,6 @@ static bool qmp_combo_configure_dp_mode(struct qmp_combo *qmp)
13871383

13881384
static int qmp_v3_configure_dp_phy(struct qmp_combo *qmp)
13891385
{
1390-
const struct qmp_phy_dp_clks *dp_clks = qmp->dp_clks;
13911386
const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;
13921387
u32 phy_vco_div, status;
13931388
unsigned long pixel_freq;
@@ -1420,8 +1415,8 @@ static int qmp_v3_configure_dp_phy(struct qmp_combo *qmp)
14201415
}
14211416
writel(phy_vco_div, qmp->dp_pcs + QSERDES_V3_DP_PHY_VCO_DIV);
14221417

1423-
clk_set_rate(dp_clks->dp_link_hw.clk, dp_opts->link_rate * 100000);
1424-
clk_set_rate(dp_clks->dp_pixel_hw.clk, pixel_freq);
1418+
clk_set_rate(qmp->dp_link_hw.clk, dp_opts->link_rate * 100000);
1419+
clk_set_rate(qmp->dp_pixel_hw.clk, pixel_freq);
14251420

14261421
writel(0x04, qmp->dp_pcs + QSERDES_DP_PHY_AUX_CFG2);
14271422
writel(0x01, qmp->dp_pcs + QSERDES_DP_PHY_CFG);
@@ -1518,7 +1513,6 @@ static void qmp_v4_configure_dp_tx(struct qmp_combo *qmp)
15181513

15191514
static int qmp_v45_configure_dp_phy(struct qmp_combo *qmp)
15201515
{
1521-
const struct qmp_phy_dp_clks *dp_clks = qmp->dp_clks;
15221516
const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;
15231517
u32 phy_vco_div, status;
15241518
unsigned long pixel_freq;
@@ -1556,8 +1550,8 @@ static int qmp_v45_configure_dp_phy(struct qmp_combo *qmp)
15561550
}
15571551
writel(phy_vco_div, qmp->dp_pcs + QSERDES_V4_DP_PHY_VCO_DIV);
15581552

1559-
clk_set_rate(dp_clks->dp_link_hw.clk, dp_opts->link_rate * 100000);
1560-
clk_set_rate(dp_clks->dp_pixel_hw.clk, pixel_freq);
1553+
clk_set_rate(qmp->dp_link_hw.clk, dp_opts->link_rate * 100000);
1554+
clk_set_rate(qmp->dp_pixel_hw.clk, pixel_freq);
15611555

15621556
writel(0x01, qmp->dp_pcs + QSERDES_DP_PHY_CFG);
15631557
writel(0x05, qmp->dp_pcs + QSERDES_DP_PHY_CFG);
@@ -2342,12 +2336,10 @@ static int qcom_qmp_dp_pixel_clk_determine_rate(struct clk_hw *hw,
23422336
static unsigned long
23432337
qcom_qmp_dp_pixel_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
23442338
{
2345-
const struct qmp_phy_dp_clks *dp_clks;
23462339
const struct qmp_combo *qmp;
23472340
const struct phy_configure_opts_dp *dp_opts;
23482341

2349-
dp_clks = container_of(hw, struct qmp_phy_dp_clks, dp_pixel_hw);
2350-
qmp = dp_clks->qmp;
2342+
qmp = container_of(hw, struct qmp_combo, dp_pixel_hw);
23512343
dp_opts = &qmp->dp_opts;
23522344

23532345
switch (dp_opts->link_rate) {
@@ -2386,12 +2378,10 @@ static int qcom_qmp_dp_link_clk_determine_rate(struct clk_hw *hw,
23862378
static unsigned long
23872379
qcom_qmp_dp_link_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
23882380
{
2389-
const struct qmp_phy_dp_clks *dp_clks;
23902381
const struct qmp_combo *qmp;
23912382
const struct phy_configure_opts_dp *dp_opts;
23922383

2393-
dp_clks = container_of(hw, struct qmp_phy_dp_clks, dp_link_hw);
2394-
qmp = dp_clks->qmp;
2384+
qmp = container_of(hw, struct qmp_combo, dp_link_hw);
23952385
dp_opts = &qmp->dp_opts;
23962386

23972387
switch (dp_opts->link_rate) {
@@ -2413,7 +2403,7 @@ static const struct clk_ops qcom_qmp_dp_link_clk_ops = {
24132403
static struct clk_hw *
24142404
qcom_qmp_dp_clks_hw_get(struct of_phandle_args *clkspec, void *data)
24152405
{
2416-
struct qmp_phy_dp_clks *dp_clks = data;
2406+
struct qmp_combo *qmp = data;
24172407
unsigned int idx = clkspec->args[0];
24182408

24192409
if (idx >= 2) {
@@ -2422,42 +2412,34 @@ qcom_qmp_dp_clks_hw_get(struct of_phandle_args *clkspec, void *data)
24222412
}
24232413

24242414
if (idx == 0)
2425-
return &dp_clks->dp_link_hw;
2415+
return &qmp->dp_link_hw;
24262416

2427-
return &dp_clks->dp_pixel_hw;
2417+
return &qmp->dp_pixel_hw;
24282418
}
24292419

24302420
static int phy_dp_clks_register(struct qmp_combo *qmp, struct device_node *np)
24312421
{
24322422
struct clk_init_data init = { };
2433-
struct qmp_phy_dp_clks *dp_clks;
24342423
char name[64];
24352424
int ret;
24362425

2437-
dp_clks = devm_kzalloc(qmp->dev, sizeof(*dp_clks), GFP_KERNEL);
2438-
if (!dp_clks)
2439-
return -ENOMEM;
2440-
2441-
dp_clks->qmp = qmp;
2442-
qmp->dp_clks = dp_clks;
2443-
24442426
snprintf(name, sizeof(name), "%s::link_clk", dev_name(qmp->dev));
24452427
init.ops = &qcom_qmp_dp_link_clk_ops;
24462428
init.name = name;
2447-
dp_clks->dp_link_hw.init = &init;
2448-
ret = devm_clk_hw_register(qmp->dev, &dp_clks->dp_link_hw);
2429+
qmp->dp_link_hw.init = &init;
2430+
ret = devm_clk_hw_register(qmp->dev, &qmp->dp_link_hw);
24492431
if (ret)
24502432
return ret;
24512433

24522434
snprintf(name, sizeof(name), "%s::vco_div_clk", dev_name(qmp->dev));
24532435
init.ops = &qcom_qmp_dp_pixel_clk_ops;
24542436
init.name = name;
2455-
dp_clks->dp_pixel_hw.init = &init;
2456-
ret = devm_clk_hw_register(qmp->dev, &dp_clks->dp_pixel_hw);
2437+
qmp->dp_pixel_hw.init = &init;
2438+
ret = devm_clk_hw_register(qmp->dev, &qmp->dp_pixel_hw);
24572439
if (ret)
24582440
return ret;
24592441

2460-
ret = of_clk_add_hw_provider(np, qcom_qmp_dp_clks_hw_get, dp_clks);
2442+
ret = of_clk_add_hw_provider(np, qcom_qmp_dp_clks_hw_get, qmp);
24612443
if (ret)
24622444
return ret;
24632445

0 commit comments

Comments
 (0)