summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hajda <a.hajda@samsung.com>2016-10-24 11:33:49 +0200
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:54:07 +0900
commitf74fff5a566848b758fe1dd843cf06d50c7dcaa8 (patch)
treead4db7af8dad21d3b019fd648a5fcae07e0104c5
parent4e7ff2ba1abff8596df5c684836010e828b333dd (diff)
drm/exynos/hdmi: use constant size array for regulators
Driver always uses the same number of regulators, so there is no point in dynamic allocation. Change-Id: I8227ea4e341c55f1932f1e88e1138bb50271a749 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r--drivers/gpu/drm/exynos/exynos_hdmi.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index a2d5d618bd5b..96cd9e5e3c0d 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -102,6 +102,12 @@ static const u32 hdmi_reg_map[][HDMI_TYPE_COUNT] = {
{ HDMI_V13_ACR_N0, HDMI_V14_ACR_N0 },
};
+static const char * const supply[] = {
+ "vdd",
+ "vdd_osc",
+ "vdd_pll",
+};
+
struct string_array_spec {
int count;
const char * const *data;
@@ -149,8 +155,7 @@ struct hdmi_context {
struct regmap *sysreg;
struct clk **clk_gates;
struct clk **clk_muxes;
- int regul_count;
- struct regulator_bulk_data *regul_bulk;
+ struct regulator_bulk_data regul_bulk[ARRAY_SIZE(supply)];
struct regulator *reg_hdmi_en;
};
@@ -1860,7 +1865,7 @@ static void hdmiphy_enable(struct hdmi_context *hdata)
hdmi_clk_set_parents(hdata, false);
- if (regulator_bulk_enable(hdata->regul_count, hdata->regul_bulk))
+ if (regulator_bulk_enable(ARRAY_SIZE(supply), hdata->regul_bulk))
DRM_DEBUG_KMS("failed to enable regulator bulk\n");
regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
@@ -1964,7 +1969,7 @@ static void hdmi_poweroff(struct hdmi_context *hdata)
regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
PMU_HDMI_PHY_ENABLE_BIT, 0);
- regulator_bulk_disable(hdata->regul_count, hdata->regul_bulk);
+ regulator_bulk_disable(ARRAY_SIZE(supply), hdata->regul_bulk);
pm_runtime_put_sync(hdata->dev);
@@ -2127,11 +2132,6 @@ static int hdmi_bridge_init(struct hdmi_context *hdata)
static int hdmi_resources_init(struct hdmi_context *hdata)
{
struct device *dev = hdata->dev;
- static char *supply[] = {
- "vdd",
- "vdd_osc",
- "vdd_pll",
- };
int i, ret;
DRM_DEBUG_KMS("HDMI resource init\n");
@@ -2140,11 +2140,6 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
if (ret)
return ret;
- hdata->regul_bulk = devm_kzalloc(dev, ARRAY_SIZE(supply) *
- sizeof(hdata->regul_bulk[0]), GFP_KERNEL);
- if (!hdata->regul_bulk)
- return -ENOMEM;
-
for (i = 0; i < ARRAY_SIZE(supply); ++i) {
hdata->regul_bulk[i].supply = supply[i];
hdata->regul_bulk[i].consumer = NULL;
@@ -2154,7 +2149,6 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
DRM_ERROR("failed to get regulators\n");
return ret;
}
- hdata->regul_count = ARRAY_SIZE(supply);
hdata->reg_hdmi_en = devm_regulator_get(dev, "hdmi-en");
if (IS_ERR(hdata->reg_hdmi_en) && PTR_ERR(hdata->reg_hdmi_en) != -ENOENT) {