Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm/dsi: Take advantage of devm_regulator_bulk_get_const()

As of the commit 1de452a0edda ("regulator: core: Allow drivers to
define their init data as const") we no longer need to do copying of
regulator bulk data from initdata to something dynamic. Let's take
advantage of that.

In addition to saving some code, this also moves us to using
ARRAY_SIZE() to specify how many regulators we have which is less
error prone.

This gets rid of some layers of wrappers which makes it obvious that
we can get rid of an extra error print.
devm_regulator_bulk_get_const() prints errors for you so you don't
need an extra layer of printing.

In all cases here I have preserved the old settings without any
investigation about whether the loads being set are sensible. In the
cases of some of the PHYs if several PHYs in the same file used
exactly the same settings I had them point to the same data structure.

NOTE: Though I haven't done the math, this is likely an overall
savings in terms of "static const" data. We previously always
allocated space for 8 supplies. Each of these supplies took up 36
bytes of data (32 for name, 4 for an int).

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/496325/
Link: https://lore.kernel.org/r/20220804073608.v4.5.I55a9e65cb1c22221316629e98768ff473f47a067@changeid
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>

authored by

Douglas Anderson and committed by
Rob Clark
d8810a66 15cde7ea

+167 -242
-12
drivers/gpu/drm/msm/dsi/dsi.h
··· 30 30 MSM_DSI_PHY_SLAVE, 31 31 }; 32 32 33 - #define DSI_DEV_REGULATOR_MAX 8 34 33 #define DSI_BUS_CLK_MAX 4 35 - 36 - /* Regulators for DSI devices */ 37 - struct dsi_reg_entry { 38 - char name[32]; 39 - int enable_load; 40 - }; 41 - 42 - struct dsi_reg_config { 43 - int num; 44 - struct dsi_reg_entry regs[DSI_DEV_REGULATOR_MAX]; 45 - }; 46 34 47 35 struct msm_dsi { 48 36 struct drm_device *dev;
+86 -86
drivers/gpu/drm/msm/dsi/dsi_cfg.c
··· 9 9 "core_mmss", "iface", "bus", 10 10 }; 11 11 12 + static const struct regulator_bulk_data apq8064_dsi_regulators[] = { 13 + { .supply = "vdda", .init_load_uA = 100000 }, /* 1.2 V */ 14 + { .supply = "avdd", .init_load_uA = 10000 }, /* 3.0 V */ 15 + { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */ 16 + }; 17 + 12 18 static const struct msm_dsi_config apq8064_dsi_cfg = { 13 19 .io_offset = 0, 14 - .reg_cfg = { 15 - .num = 3, 16 - .regs = { 17 - {"vdda", 100000}, /* 1.2 V */ 18 - {"avdd", 10000}, /* 3.0 V */ 19 - {"vddio", 100000}, /* 1.8 V */ 20 - }, 21 - }, 20 + .regulator_data = apq8064_dsi_regulators, 21 + .num_regulators = ARRAY_SIZE(apq8064_dsi_regulators), 22 22 .bus_clk_names = dsi_v2_bus_clk_names, 23 23 .num_bus_clks = ARRAY_SIZE(dsi_v2_bus_clk_names), 24 24 .io_start = { 0x4700000, 0x5800000 }, ··· 29 29 "mdp_core", "iface", "bus", "core_mmss", 30 30 }; 31 31 32 + static const struct regulator_bulk_data msm8974_apq8084_regulators[] = { 33 + { .supply = "vdd", .init_load_uA = 150000 }, /* 3.0 V */ 34 + { .supply = "vdda", .init_load_uA = 100000 }, /* 1.2 V */ 35 + { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */ 36 + }; 37 + 32 38 static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = { 33 39 .io_offset = DSI_6G_REG_SHIFT, 34 - .reg_cfg = { 35 - .num = 3, 36 - .regs = { 37 - {"vdd", 150000}, /* 3.0 V */ 38 - {"vdda", 100000}, /* 1.2 V */ 39 - {"vddio", 100000}, /* 1.8 V */ 40 - }, 41 - }, 40 + .regulator_data = msm8974_apq8084_regulators, 41 + .num_regulators = ARRAY_SIZE(msm8974_apq8084_regulators), 42 42 .bus_clk_names = dsi_6g_bus_clk_names, 43 43 .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names), 44 44 .io_start = { 0xfd922800, 0xfd922b00 }, ··· 49 49 "mdp_core", "iface", "bus", 50 50 }; 51 51 52 + static const struct regulator_bulk_data msm8916_dsi_regulators[] = { 53 + { .supply = "vdda", .init_load_uA = 100000 }, /* 1.2 V */ 54 + { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */ 55 + }; 56 + 52 57 static const struct msm_dsi_config msm8916_dsi_cfg = { 53 58 .io_offset = DSI_6G_REG_SHIFT, 54 - .reg_cfg = { 55 - .num = 2, 56 - .regs = { 57 - {"vdda", 100000}, /* 1.2 V */ 58 - {"vddio", 100000}, /* 1.8 V */ 59 - }, 60 - }, 59 + .regulator_data = msm8916_dsi_regulators, 60 + .num_regulators = ARRAY_SIZE(msm8916_dsi_regulators), 61 61 .bus_clk_names = dsi_8916_bus_clk_names, 62 62 .num_bus_clks = ARRAY_SIZE(dsi_8916_bus_clk_names), 63 63 .io_start = { 0x1a98000 }, ··· 68 68 "mdp_core", "iface", "bus", 69 69 }; 70 70 71 + static const struct regulator_bulk_data msm8976_dsi_regulators[] = { 72 + { .supply = "vdda", .init_load_uA = 100000 }, /* 1.2 V */ 73 + { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */ 74 + }; 75 + 71 76 static const struct msm_dsi_config msm8976_dsi_cfg = { 72 77 .io_offset = DSI_6G_REG_SHIFT, 73 - .reg_cfg = { 74 - .num = 2, 75 - .regs = { 76 - {"vdda", 100000}, /* 1.2 V */ 77 - {"vddio", 100000}, /* 1.8 V */ 78 - }, 79 - }, 78 + .regulator_data = msm8976_dsi_regulators, 79 + .num_regulators = ARRAY_SIZE(msm8976_dsi_regulators), 80 80 .bus_clk_names = dsi_8976_bus_clk_names, 81 81 .num_bus_clks = ARRAY_SIZE(dsi_8976_bus_clk_names), 82 82 .io_start = { 0x1a94000, 0x1a96000 }, 83 83 .num_dsi = 2, 84 84 }; 85 85 86 + static const struct regulator_bulk_data msm8994_dsi_regulators[] = { 87 + { .supply = "vdda", .init_load_uA = 100000 }, /* 1.25 V */ 88 + { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */ 89 + { .supply = "vcca", .init_load_uA = 10000 }, /* 1.0 V */ 90 + { .supply = "vdd", .init_load_uA = 100000 }, /* 1.8 V */ 91 + { .supply = "lab_reg", .init_load_uA = -1 }, 92 + { .supply = "ibb_reg", .init_load_uA = -1 }, 93 + }; 94 + 86 95 static const struct msm_dsi_config msm8994_dsi_cfg = { 87 96 .io_offset = DSI_6G_REG_SHIFT, 88 - .reg_cfg = { 89 - .num = 6, 90 - .regs = { 91 - {"vdda", 100000}, /* 1.25 V */ 92 - {"vddio", 100000}, /* 1.8 V */ 93 - {"vcca", 10000}, /* 1.0 V */ 94 - {"vdd", 100000}, /* 1.8 V */ 95 - {"lab_reg", -1}, 96 - {"ibb_reg", -1}, 97 - }, 98 - }, 97 + .regulator_data = msm8994_dsi_regulators, 98 + .num_regulators = ARRAY_SIZE(msm8994_dsi_regulators), 99 99 .bus_clk_names = dsi_6g_bus_clk_names, 100 100 .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names), 101 101 .io_start = { 0xfd998000, 0xfd9a0000 }, ··· 106 106 "mdp_core", "iface", "bus", "core_mmss", 107 107 }; 108 108 109 + static const struct regulator_bulk_data msm8996_dsi_regulators[] = { 110 + { .supply = "vdda", .init_load_uA = 18160 }, /* 1.25 V */ 111 + { .supply = "vcca", .init_load_uA = 17000 }, /* 0.925 V */ 112 + { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */ 113 + }; 114 + 109 115 static const struct msm_dsi_config msm8996_dsi_cfg = { 110 116 .io_offset = DSI_6G_REG_SHIFT, 111 - .reg_cfg = { 112 - .num = 3, 113 - .regs = { 114 - {"vdda", 18160}, /* 1.25 V */ 115 - {"vcca", 17000}, /* 0.925 V */ 116 - {"vddio", 100000},/* 1.8 V */ 117 - }, 118 - }, 117 + .regulator_data = msm8996_dsi_regulators, 118 + .num_regulators = ARRAY_SIZE(msm8996_dsi_regulators), 119 119 .bus_clk_names = dsi_8996_bus_clk_names, 120 120 .num_bus_clks = ARRAY_SIZE(dsi_8996_bus_clk_names), 121 121 .io_start = { 0x994000, 0x996000 }, ··· 126 126 "iface", "bus", "core", 127 127 }; 128 128 129 + static const struct regulator_bulk_data msm8998_dsi_regulators[] = { 130 + { .supply = "vdd", .init_load_uA = 367000 }, /* 0.9 V */ 131 + { .supply = "vdda", .init_load_uA = 62800 }, /* 1.2 V */ 132 + }; 133 + 129 134 static const struct msm_dsi_config msm8998_dsi_cfg = { 130 135 .io_offset = DSI_6G_REG_SHIFT, 131 - .reg_cfg = { 132 - .num = 2, 133 - .regs = { 134 - {"vdd", 367000}, /* 0.9 V */ 135 - {"vdda", 62800}, /* 1.2 V */ 136 - }, 137 - }, 136 + .regulator_data = msm8998_dsi_regulators, 137 + .num_regulators = ARRAY_SIZE(msm8998_dsi_regulators), 138 138 .bus_clk_names = dsi_msm8998_bus_clk_names, 139 139 .num_bus_clks = ARRAY_SIZE(dsi_msm8998_bus_clk_names), 140 140 .io_start = { 0xc994000, 0xc996000 }, ··· 145 145 "iface", "bus", "core", "core_mmss", 146 146 }; 147 147 148 + static const struct regulator_bulk_data sdm660_dsi_regulators[] = { 149 + { .supply = "vdda", .init_load_uA = 12560 }, /* 1.2 V */ 150 + }; 151 + 148 152 static const struct msm_dsi_config sdm660_dsi_cfg = { 149 153 .io_offset = DSI_6G_REG_SHIFT, 150 - .reg_cfg = { 151 - .num = 1, 152 - .regs = { 153 - {"vdda", 12560}, /* 1.2 V */ 154 - }, 155 - }, 154 + .regulator_data = sdm660_dsi_regulators, 155 + .num_regulators = ARRAY_SIZE(sdm660_dsi_regulators), 156 156 .bus_clk_names = dsi_sdm660_bus_clk_names, 157 157 .num_bus_clks = ARRAY_SIZE(dsi_sdm660_bus_clk_names), 158 158 .io_start = { 0xc994000, 0xc996000 }, ··· 167 167 "iface", "bus", 168 168 }; 169 169 170 + static const struct regulator_bulk_data sdm845_dsi_regulators[] = { 171 + { .supply = "vdda", .init_load_uA = 21800 }, /* 1.2 V */ 172 + }; 173 + 170 174 static const struct msm_dsi_config sdm845_dsi_cfg = { 171 175 .io_offset = DSI_6G_REG_SHIFT, 172 - .reg_cfg = { 173 - .num = 1, 174 - .regs = { 175 - {"vdda", 21800}, /* 1.2 V */ 176 - }, 177 - }, 176 + .regulator_data = sdm845_dsi_regulators, 177 + .num_regulators = ARRAY_SIZE(sdm845_dsi_regulators), 178 178 .bus_clk_names = dsi_sdm845_bus_clk_names, 179 179 .num_bus_clks = ARRAY_SIZE(dsi_sdm845_bus_clk_names), 180 180 .io_start = { 0xae94000, 0xae96000 }, 181 181 .num_dsi = 2, 182 182 }; 183 183 184 + static const struct regulator_bulk_data sc7180_dsi_regulators[] = { 185 + { .supply = "vdda", .init_load_uA = 21800 }, /* 1.2 V */ 186 + }; 187 + 184 188 static const struct msm_dsi_config sc7180_dsi_cfg = { 185 189 .io_offset = DSI_6G_REG_SHIFT, 186 - .reg_cfg = { 187 - .num = 1, 188 - .regs = { 189 - {"vdda", 21800}, /* 1.2 V */ 190 - }, 191 - }, 190 + .regulator_data = sc7180_dsi_regulators, 191 + .num_regulators = ARRAY_SIZE(sc7180_dsi_regulators), 192 192 .bus_clk_names = dsi_sc7180_bus_clk_names, 193 193 .num_bus_clks = ARRAY_SIZE(dsi_sc7180_bus_clk_names), 194 194 .io_start = { 0xae94000 }, ··· 199 199 "iface", "bus", 200 200 }; 201 201 202 + static const struct regulator_bulk_data sc7280_dsi_regulators[] = { 203 + { .supply = "vdda", .init_load_uA = 8350 }, /* 1.2 V */ 204 + }; 205 + 202 206 static const struct msm_dsi_config sc7280_dsi_cfg = { 203 207 .io_offset = DSI_6G_REG_SHIFT, 204 - .reg_cfg = { 205 - .num = 1, 206 - .regs = { 207 - {"vdda", 8350}, /* 1.2 V */ 208 - }, 209 - }, 208 + .regulator_data = sc7280_dsi_regulators, 209 + .num_regulators = ARRAY_SIZE(sc7280_dsi_regulators), 210 210 .bus_clk_names = dsi_sc7280_bus_clk_names, 211 211 .num_bus_clks = ARRAY_SIZE(dsi_sc7280_bus_clk_names), 212 212 .io_start = { 0xae94000 }, ··· 217 217 "iface", "bus", 218 218 }; 219 219 220 + static const struct regulator_bulk_data qcm2290_dsi_cfg_regulators[] = { 221 + { .supply = "vdda", .init_load_uA = 21800 }, /* 1.2 V */ 222 + }; 223 + 220 224 static const struct msm_dsi_config qcm2290_dsi_cfg = { 221 225 .io_offset = DSI_6G_REG_SHIFT, 222 - .reg_cfg = { 223 - .num = 1, 224 - .regs = { 225 - {"vdda", 21800}, /* 1.2 V */ 226 - }, 227 - }, 226 + .regulator_data = qcm2290_dsi_cfg_regulators, 227 + .num_regulators = ARRAY_SIZE(qcm2290_dsi_cfg_regulators), 228 228 .bus_clk_names = dsi_qcm2290_bus_clk_names, 229 229 .num_bus_clks = ARRAY_SIZE(dsi_qcm2290_bus_clk_names), 230 230 .io_start = { 0x5e94000 },
+2 -1
drivers/gpu/drm/msm/dsi/dsi_cfg.h
··· 32 32 33 33 struct msm_dsi_config { 34 34 u32 io_offset; 35 - struct dsi_reg_config reg_cfg; 35 + const struct regulator_bulk_data *regulator_data; 36 + int num_regulators; 36 37 const char * const *bus_clk_names; 37 38 const int num_bus_clks; 38 39 const resource_size_t io_start[DSI_MAX];
+11 -31
drivers/gpu/drm/msm/dsi/dsi_host.c
··· 108 108 109 109 void __iomem *ctrl_base; 110 110 phys_addr_t ctrl_size; 111 - struct regulator_bulk_data supplies[DSI_DEV_REGULATOR_MAX]; 111 + struct regulator_bulk_data *supplies; 112 112 113 113 int num_bus_clks; 114 114 struct clk_bulk_data bus_clks[DSI_BUS_CLK_MAX]; ··· 253 253 static inline struct msm_dsi_host *to_msm_dsi_host(struct mipi_dsi_host *host) 254 254 { 255 255 return container_of(host, struct msm_dsi_host, base); 256 - } 257 - 258 - static int dsi_regulator_init(struct msm_dsi_host *msm_host) 259 - { 260 - struct regulator_bulk_data *s = msm_host->supplies; 261 - const struct dsi_reg_entry *regs = msm_host->cfg_hnd->cfg->reg_cfg.regs; 262 - int num = msm_host->cfg_hnd->cfg->reg_cfg.num; 263 - int i, ret; 264 - 265 - for (i = 0; i < num; i++) { 266 - s[i].supply = regs[i].name; 267 - s[i].init_load_uA = regs[i].enable_load; 268 - } 269 - 270 - ret = devm_regulator_bulk_get(&msm_host->pdev->dev, num, s); 271 - if (ret < 0) { 272 - pr_err("%s: failed to init regulator, ret=%d\n", 273 - __func__, ret); 274 - return ret; 275 - } 276 - 277 - return 0; 278 256 } 279 257 280 258 int dsi_clk_init_v2(struct msm_dsi_host *msm_host) ··· 1955 1977 { 1956 1978 struct msm_dsi_host *msm_host = NULL; 1957 1979 struct platform_device *pdev = msm_dsi->pdev; 1980 + const struct msm_dsi_config *cfg; 1958 1981 int ret; 1959 1982 1960 1983 msm_host = devm_kzalloc(&pdev->dev, sizeof(*msm_host), GFP_KERNEL); ··· 1988 2009 pr_err("%s: get config failed\n", __func__); 1989 2010 goto fail; 1990 2011 } 2012 + cfg = msm_host->cfg_hnd->cfg; 1991 2013 1992 2014 msm_host->id = dsi_host_get_id(msm_host); 1993 2015 if (msm_host->id < 0) { ··· 1998 2018 } 1999 2019 2000 2020 /* fixup base address by io offset */ 2001 - msm_host->ctrl_base += msm_host->cfg_hnd->cfg->io_offset; 2021 + msm_host->ctrl_base += cfg->io_offset; 2002 2022 2003 - ret = dsi_regulator_init(msm_host); 2004 - if (ret) { 2005 - pr_err("%s: regulator init failed\n", __func__); 2023 + ret = devm_regulator_bulk_get_const(&pdev->dev, cfg->num_regulators, 2024 + cfg->regulator_data, 2025 + &msm_host->supplies); 2026 + if (ret) 2006 2027 goto fail; 2007 - } 2008 2028 2009 2029 ret = dsi_clk_init(msm_host); 2010 2030 if (ret) { ··· 2476 2496 2477 2497 msm_dsi_sfpb_config(msm_host, true); 2478 2498 2479 - ret = regulator_bulk_enable(msm_host->cfg_hnd->cfg->reg_cfg.num, 2499 + ret = regulator_bulk_enable(msm_host->cfg_hnd->cfg->num_regulators, 2480 2500 msm_host->supplies); 2481 2501 if (ret) { 2482 2502 pr_err("%s:Failed to enable vregs.ret=%d\n", ··· 2517 2537 cfg_hnd->ops->link_clk_disable(msm_host); 2518 2538 pm_runtime_put(&msm_host->pdev->dev); 2519 2539 fail_disable_reg: 2520 - regulator_bulk_disable(msm_host->cfg_hnd->cfg->reg_cfg.num, 2540 + regulator_bulk_disable(msm_host->cfg_hnd->cfg->num_regulators, 2521 2541 msm_host->supplies); 2522 2542 unlock_ret: 2523 2543 mutex_unlock(&msm_host->dev_mutex); ··· 2545 2565 cfg_hnd->ops->link_clk_disable(msm_host); 2546 2566 pm_runtime_put(&msm_host->pdev->dev); 2547 2567 2548 - regulator_bulk_disable(msm_host->cfg_hnd->cfg->reg_cfg.num, 2568 + regulator_bulk_disable(msm_host->cfg_hnd->cfg->num_regulators, 2549 2569 msm_host->supplies); 2550 2570 2551 2571 msm_dsi_sfpb_config(msm_host, false);
+6 -31
drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
··· 507 507 return 0; 508 508 } 509 509 510 - static int dsi_phy_regulator_init(struct msm_dsi_phy *phy) 511 - { 512 - struct regulator_bulk_data *s = phy->supplies; 513 - const struct dsi_reg_entry *regs = phy->cfg->reg_cfg.regs; 514 - struct device *dev = &phy->pdev->dev; 515 - int num = phy->cfg->reg_cfg.num; 516 - int i, ret; 517 - 518 - for (i = 0; i < num; i++) { 519 - s[i].supply = regs[i].name; 520 - s[i].init_load_uA = regs[i].enable_load; 521 - } 522 - 523 - ret = devm_regulator_bulk_get(dev, num, s); 524 - if (ret < 0) { 525 - if (ret != -EPROBE_DEFER) { 526 - DRM_DEV_ERROR(dev, 527 - "%s: failed to init regulator, ret=%d\n", 528 - __func__, ret); 529 - } 530 - 531 - return ret; 532 - } 533 - 534 - return 0; 535 - } 536 - 537 510 static int dsi_phy_enable_resource(struct msm_dsi_phy *phy) 538 511 { 539 512 struct device *dev = &phy->pdev->dev; ··· 671 698 goto fail; 672 699 } 673 700 674 - ret = dsi_phy_regulator_init(phy); 701 + ret = devm_regulator_bulk_get_const(dev, phy->cfg->num_regulators, 702 + phy->cfg->regulator_data, 703 + &phy->supplies); 675 704 if (ret) 676 705 goto fail; 677 706 ··· 755 780 goto res_en_fail; 756 781 } 757 782 758 - ret = regulator_bulk_enable(phy->cfg->reg_cfg.num, phy->supplies); 783 + ret = regulator_bulk_enable(phy->cfg->num_regulators, phy->supplies); 759 784 if (ret) { 760 785 DRM_DEV_ERROR(dev, "%s: regulator enable failed, %d\n", 761 786 __func__, ret); ··· 792 817 if (phy->cfg->ops.disable) 793 818 phy->cfg->ops.disable(phy); 794 819 phy_en_fail: 795 - regulator_bulk_disable(phy->cfg->reg_cfg.num, phy->supplies); 820 + regulator_bulk_disable(phy->cfg->num_regulators, phy->supplies); 796 821 reg_en_fail: 797 822 dsi_phy_disable_resource(phy); 798 823 res_en_fail: ··· 806 831 807 832 phy->cfg->ops.disable(phy); 808 833 809 - regulator_bulk_disable(phy->cfg->reg_cfg.num, phy->supplies); 834 + regulator_bulk_disable(phy->cfg->num_regulators, phy->supplies); 810 835 dsi_phy_disable_resource(phy); 811 836 } 812 837
+3 -2
drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
··· 29 29 }; 30 30 31 31 struct msm_dsi_phy_cfg { 32 - struct dsi_reg_config reg_cfg; 32 + const struct regulator_bulk_data *regulator_data; 33 + int num_regulators; 33 34 struct msm_dsi_phy_ops ops; 34 35 35 36 unsigned long min_pll_rate; ··· 99 98 int id; 100 99 101 100 struct clk *ahb_clk; 102 - struct regulator_bulk_data supplies[DSI_DEV_REGULATOR_MAX]; 101 + struct regulator_bulk_data *supplies; 103 102 104 103 struct msm_dsi_dphy_timing timing; 105 104 const struct msm_dsi_phy_cfg *cfg;
+8 -12
drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c
··· 1019 1019 return 0; 1020 1020 } 1021 1021 1022 + static const struct regulator_bulk_data dsi_phy_10nm_regulators[] = { 1023 + { .supply = "vdds", .init_load_uA = 36000 }, 1024 + }; 1025 + 1022 1026 const struct msm_dsi_phy_cfg dsi_phy_10nm_cfgs = { 1023 1027 .has_phy_lane = true, 1024 - .reg_cfg = { 1025 - .num = 1, 1026 - .regs = { 1027 - {"vdds", 36000}, 1028 - }, 1029 - }, 1028 + .regulator_data = dsi_phy_10nm_regulators, 1029 + .num_regulators = ARRAY_SIZE(dsi_phy_10nm_regulators), 1030 1030 .ops = { 1031 1031 .enable = dsi_10nm_phy_enable, 1032 1032 .disable = dsi_10nm_phy_disable, ··· 1043 1043 1044 1044 const struct msm_dsi_phy_cfg dsi_phy_10nm_8998_cfgs = { 1045 1045 .has_phy_lane = true, 1046 - .reg_cfg = { 1047 - .num = 1, 1048 - .regs = { 1049 - {"vdds", 36000}, 1050 - }, 1051 - }, 1046 + .regulator_data = dsi_phy_10nm_regulators, 1047 + .num_regulators = ARRAY_SIZE(dsi_phy_10nm_regulators), 1052 1048 .ops = { 1053 1049 .enable = dsi_10nm_phy_enable, 1054 1050 .disable = dsi_10nm_phy_disable,
+14 -18
drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c
··· 1023 1023 wmb(); 1024 1024 } 1025 1025 1026 + static const struct regulator_bulk_data dsi_phy_14nm_17mA_regulators[] = { 1027 + { .supply = "vcca", .init_load_uA = 17000 }, 1028 + }; 1029 + 1030 + static const struct regulator_bulk_data dsi_phy_14nm_73p4mA_regulators[] = { 1031 + { .supply = "vcca", .init_load_uA = 73400 }, 1032 + }; 1033 + 1026 1034 const struct msm_dsi_phy_cfg dsi_phy_14nm_cfgs = { 1027 1035 .has_phy_lane = true, 1028 - .reg_cfg = { 1029 - .num = 1, 1030 - .regs = { 1031 - {"vcca", 17000}, 1032 - }, 1033 - }, 1036 + .regulator_data = dsi_phy_14nm_17mA_regulators, 1037 + .num_regulators = ARRAY_SIZE(dsi_phy_14nm_17mA_regulators), 1034 1038 .ops = { 1035 1039 .enable = dsi_14nm_phy_enable, 1036 1040 .disable = dsi_14nm_phy_disable, ··· 1050 1046 1051 1047 const struct msm_dsi_phy_cfg dsi_phy_14nm_660_cfgs = { 1052 1048 .has_phy_lane = true, 1053 - .reg_cfg = { 1054 - .num = 1, 1055 - .regs = { 1056 - {"vcca", 73400}, 1057 - }, 1058 - }, 1049 + .regulator_data = dsi_phy_14nm_73p4mA_regulators, 1050 + .num_regulators = ARRAY_SIZE(dsi_phy_14nm_73p4mA_regulators), 1059 1051 .ops = { 1060 1052 .enable = dsi_14nm_phy_enable, 1061 1053 .disable = dsi_14nm_phy_disable, ··· 1067 1067 1068 1068 const struct msm_dsi_phy_cfg dsi_phy_14nm_8953_cfgs = { 1069 1069 .has_phy_lane = true, 1070 - .reg_cfg = { 1071 - .num = 1, 1072 - .regs = { 1073 - {"vcca", 17000}, 1074 - }, 1075 - }, 1070 + .regulator_data = dsi_phy_14nm_17mA_regulators, 1071 + .num_regulators = ARRAY_SIZE(dsi_phy_14nm_17mA_regulators), 1076 1072 .ops = { 1077 1073 .enable = dsi_14nm_phy_enable, 1078 1074 .disable = dsi_14nm_phy_disable,
+7 -7
drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c
··· 129 129 dsi_20nm_phy_regulator_ctrl(phy, false); 130 130 } 131 131 132 + static const struct regulator_bulk_data dsi_phy_20nm_regulators[] = { 133 + { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */ 134 + { .supply = "vcca", .init_load_uA = 10000 }, /* 1.0 V */ 135 + }; 136 + 132 137 const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs = { 133 138 .has_phy_regulator = true, 134 - .reg_cfg = { 135 - .num = 2, 136 - .regs = { 137 - {"vddio", 100000}, /* 1.8 V */ 138 - {"vcca", 10000}, /* 1.0 V */ 139 - }, 140 - }, 139 + .regulator_data = dsi_phy_20nm_regulators, 140 + .num_regulators = ARRAY_SIZE(dsi_phy_20nm_regulators), 141 141 .ops = { 142 142 .enable = dsi_20nm_phy_enable, 143 143 .disable = dsi_20nm_phy_disable,
+10 -18
drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
··· 764 764 wmb(); 765 765 } 766 766 767 + static const struct regulator_bulk_data dsi_phy_28nm_regulators[] = { 768 + { .supply = "vddio", .init_load_uA = 100000 }, 769 + }; 770 + 767 771 const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs = { 768 772 .has_phy_regulator = true, 769 - .reg_cfg = { 770 - .num = 1, 771 - .regs = { 772 - {"vddio", 100000}, 773 - }, 774 - }, 773 + .regulator_data = dsi_phy_28nm_regulators, 774 + .num_regulators = ARRAY_SIZE(dsi_phy_28nm_regulators), 775 775 .ops = { 776 776 .enable = dsi_28nm_phy_enable, 777 777 .disable = dsi_28nm_phy_disable, ··· 787 787 788 788 const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_famb_cfgs = { 789 789 .has_phy_regulator = true, 790 - .reg_cfg = { 791 - .num = 1, 792 - .regs = { 793 - {"vddio", 100000}, 794 - }, 795 - }, 790 + .regulator_data = dsi_phy_28nm_regulators, 791 + .num_regulators = ARRAY_SIZE(dsi_phy_28nm_regulators), 796 792 .ops = { 797 793 .enable = dsi_28nm_phy_enable, 798 794 .disable = dsi_28nm_phy_disable, ··· 804 808 805 809 const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs = { 806 810 .has_phy_regulator = true, 807 - .reg_cfg = { 808 - .num = 1, 809 - .regs = { 810 - {"vddio", 100000}, /* 1.8 V */ 811 - }, 812 - }, 811 + .regulator_data = dsi_phy_28nm_regulators, 812 + .num_regulators = ARRAY_SIZE(dsi_phy_28nm_regulators), 813 813 .ops = { 814 814 .enable = dsi_28nm_phy_enable, 815 815 .disable = dsi_28nm_phy_disable,
+6 -6
drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c
··· 638 638 wmb(); 639 639 } 640 640 641 + static const struct regulator_bulk_data dsi_phy_28nm_8960_regulators[] = { 642 + { .supply = "vddio", .init_load_uA = 100000 }, /* 1.8 V */ 643 + }; 644 + 641 645 const struct msm_dsi_phy_cfg dsi_phy_28nm_8960_cfgs = { 642 646 .has_phy_regulator = true, 643 - .reg_cfg = { 644 - .num = 1, 645 - .regs = { 646 - {"vddio", 100000}, /* 1.8 V */ 647 - }, 648 - }, 647 + .regulator_data = dsi_phy_28nm_8960_regulators, 648 + .num_regulators = ARRAY_SIZE(dsi_phy_28nm_8960_regulators), 649 649 .ops = { 650 650 .enable = dsi_28nm_phy_enable, 651 651 .disable = dsi_28nm_phy_disable,
+14 -18
drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
··· 1032 1032 DBG("DSI%d PHY disabled", phy->id); 1033 1033 } 1034 1034 1035 + static const struct regulator_bulk_data dsi_phy_7nm_36mA_regulators[] = { 1036 + { .supply = "vdds", .init_load_uA = 36000 }, 1037 + }; 1038 + 1039 + static const struct regulator_bulk_data dsi_phy_7nm_37750uA_regulators[] = { 1040 + { .supply = "vdds", .init_load_uA = 37550 }, 1041 + }; 1042 + 1035 1043 const struct msm_dsi_phy_cfg dsi_phy_7nm_cfgs = { 1036 1044 .has_phy_lane = true, 1037 - .reg_cfg = { 1038 - .num = 1, 1039 - .regs = { 1040 - {"vdds", 36000}, 1041 - }, 1042 - }, 1045 + .regulator_data = dsi_phy_7nm_36mA_regulators, 1046 + .num_regulators = ARRAY_SIZE(dsi_phy_7nm_36mA_regulators), 1043 1047 .ops = { 1044 1048 .enable = dsi_7nm_phy_enable, 1045 1049 .disable = dsi_7nm_phy_disable, ··· 1065 1061 1066 1062 const struct msm_dsi_phy_cfg dsi_phy_7nm_8150_cfgs = { 1067 1063 .has_phy_lane = true, 1068 - .reg_cfg = { 1069 - .num = 1, 1070 - .regs = { 1071 - {"vdds", 36000}, 1072 - }, 1073 - }, 1064 + .regulator_data = dsi_phy_7nm_36mA_regulators, 1065 + .num_regulators = ARRAY_SIZE(dsi_phy_7nm_36mA_regulators), 1074 1066 .ops = { 1075 1067 .enable = dsi_7nm_phy_enable, 1076 1068 .disable = dsi_7nm_phy_disable, ··· 1083 1083 1084 1084 const struct msm_dsi_phy_cfg dsi_phy_7nm_7280_cfgs = { 1085 1085 .has_phy_lane = true, 1086 - .reg_cfg = { 1087 - .num = 1, 1088 - .regs = { 1089 - {"vdds", 37550}, 1090 - }, 1091 - }, 1086 + .regulator_data = dsi_phy_7nm_37750uA_regulators, 1087 + .num_regulators = ARRAY_SIZE(dsi_phy_7nm_37750uA_regulators), 1092 1088 .ops = { 1093 1089 .enable = dsi_7nm_phy_enable, 1094 1090 .disable = dsi_7nm_phy_disable,