aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Viau <sviau@codeaurora.org>2015-01-13 14:33:40 -0500
committerRob Clark <robdclark@gmail.com>2015-02-01 15:32:45 -0500
commit447fa5292fcf09197cf2ce124e8e0ff6c629733a (patch)
tree9b617a032cfb35165ed8db1baaaaeec4cadcf9ff
parent5cdde29bc93a1f4d4a4f5a6faa830e368d920280 (diff)
drm/msm/hdmi: use dynamic allocation for hdmi resources
Instead of reporting BUG_ON when resources arrays are not dimensioned correctly, this patch does a dynamic allocation of these arrays. This is needed for the following patches that add a regulator for a new target. Signed-off-by: Stephane Viau <sviau@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r--drivers/gpu/drm/msm/hdmi/hdmi.c28
-rw-r--r--drivers/gpu/drm/msm/hdmi/hdmi.h8
2 files changed, 28 insertions, 8 deletions
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 95f7b8d0f3ef..99b83a6a6adc 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -106,7 +106,12 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
106 goto fail; 106 goto fail;
107 } 107 }
108 108
109 BUG_ON(config->hpd_reg_cnt > ARRAY_SIZE(hdmi->hpd_regs)); 109 hdmi->hpd_regs = devm_kzalloc(&pdev->dev, sizeof(hdmi->hpd_regs[0]) *
110 config->hpd_reg_cnt, GFP_KERNEL);
111 if (!hdmi->hpd_regs) {
112 ret = -ENOMEM;
113 goto fail;
114 }
110 for (i = 0; i < config->hpd_reg_cnt; i++) { 115 for (i = 0; i < config->hpd_reg_cnt; i++) {
111 struct regulator *reg; 116 struct regulator *reg;
112 117
@@ -122,7 +127,12 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
122 hdmi->hpd_regs[i] = reg; 127 hdmi->hpd_regs[i] = reg;
123 } 128 }
124 129
125 BUG_ON(config->pwr_reg_cnt > ARRAY_SIZE(hdmi->pwr_regs)); 130 hdmi->pwr_regs = devm_kzalloc(&pdev->dev, sizeof(hdmi->pwr_regs[0]) *
131 config->pwr_reg_cnt, GFP_KERNEL);
132 if (!hdmi->pwr_regs) {
133 ret = -ENOMEM;
134 goto fail;
135 }
126 for (i = 0; i < config->pwr_reg_cnt; i++) { 136 for (i = 0; i < config->pwr_reg_cnt; i++) {
127 struct regulator *reg; 137 struct regulator *reg;
128 138
@@ -138,7 +148,12 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
138 hdmi->pwr_regs[i] = reg; 148 hdmi->pwr_regs[i] = reg;
139 } 149 }
140 150
141 BUG_ON(config->hpd_clk_cnt > ARRAY_SIZE(hdmi->hpd_clks)); 151 hdmi->hpd_clks = devm_kzalloc(&pdev->dev, sizeof(hdmi->hpd_clks[0]) *
152 config->hpd_clk_cnt, GFP_KERNEL);
153 if (!hdmi->hpd_clks) {
154 ret = -ENOMEM;
155 goto fail;
156 }
142 for (i = 0; i < config->hpd_clk_cnt; i++) { 157 for (i = 0; i < config->hpd_clk_cnt; i++) {
143 struct clk *clk; 158 struct clk *clk;
144 159
@@ -153,7 +168,12 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
153 hdmi->hpd_clks[i] = clk; 168 hdmi->hpd_clks[i] = clk;
154 } 169 }
155 170
156 BUG_ON(config->pwr_clk_cnt > ARRAY_SIZE(hdmi->pwr_clks)); 171 hdmi->pwr_clks = devm_kzalloc(&pdev->dev, sizeof(hdmi->pwr_clks[0]) *
172 config->pwr_clk_cnt, GFP_KERNEL);
173 if (!hdmi->pwr_clks) {
174 ret = -ENOMEM;
175 goto fail;
176 }
157 for (i = 0; i < config->pwr_clk_cnt; i++) { 177 for (i = 0; i < config->pwr_clk_cnt; i++) {
158 struct clk *clk; 178 struct clk *clk;
159 179
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h
index 4d4cad42a776..68fdfb3622a5 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.h
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.h
@@ -52,10 +52,10 @@ struct hdmi {
52 52
53 void __iomem *mmio; 53 void __iomem *mmio;
54 54
55 struct regulator *hpd_regs[2]; 55 struct regulator **hpd_regs;
56 struct regulator *pwr_regs[2]; 56 struct regulator **pwr_regs;
57 struct clk *hpd_clks[3]; 57 struct clk **hpd_clks;
58 struct clk *pwr_clks[2]; 58 struct clk **pwr_clks;
59 59
60 struct hdmi_phy *phy; 60 struct hdmi_phy *phy;
61 struct i2c_adapter *i2c; 61 struct i2c_adapter *i2c;