diff options
author | Andrzej Hajda <a.hajda@samsung.com> | 2016-10-21 15:34:37 +0200 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2016-12-14 13:54:05 +0900 |
commit | f9ef42a26716569f46902ef2e91af637e9cadf77 (patch) | |
tree | c9feab6529e46f7452fcb8f187ff76f67cd18f42 | |
parent | 82b95f468916fb7d24bcd9e2e57eba9cea0ece99 (diff) |
drm/exynos/hdmi: stop duplicating drv_data fields
The patch removes duplicated drv_data fields and simplifies drv_data
matching.
Change-Id: I78abbd6dfee0d05c7095ae176fc8e080e233fd64
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_hdmi.c | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index badc45e02296..a0566151f2a0 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -31,8 +31,8 @@ #include <linux/clk.h> #include <linux/regulator/consumer.h> #include <linux/io.h> -#include <linux/of.h> #include <linux/of_address.h> +#include <linux/of_device.h> #include <linux/of_gpio.h> #include <linux/of_graph.h> #include <linux/hdmi.h> @@ -134,16 +134,13 @@ struct hdmi_context { u8 cea_video_id; struct hdmi_resources res; + const struct hdmi_driver_data *drv_data; int hpd_gpio; void __iomem *regs_hdmiphy; - const struct hdmiphy_config *phy_confs; - unsigned int phy_conf_count; struct regmap *pmureg; struct regmap *sysreg; - enum hdmi_type type; - struct hdmi_driver_data *drv_data; struct drm_bridge *bridge; }; @@ -1031,7 +1028,7 @@ static void hdmi_v14_regs_dump(struct hdmi_context *hdata, char *prefix) static void hdmi_regs_dump(struct hdmi_context *hdata, char *prefix) { - if (hdata->type == HDMI_TYPE13) + if (hdata->drv_data->type == HDMI_TYPE13) hdmi_v13_regs_dump(hdata, prefix); else hdmi_v14_regs_dump(hdata, prefix); @@ -1181,8 +1178,8 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock) { int i; - for (i = 0; i < hdata->phy_conf_count; i++) - if (hdata->phy_confs[i].pixel_clock == pixel_clock) + for (i = 0; i < hdata->drv_data->phy_conf_count; i++) + if (hdata->drv_data->phy_confs[i].pixel_clock == pixel_clock) return i; DRM_DEBUG_KMS("Could not find phy config for %d\n", pixel_clock); @@ -1360,7 +1357,7 @@ static void hdmi_reg_acr(struct hdmi_context *hdata, u8 *acr) hdmi_reg_writeb(hdata, HDMI_ACR_CTS1, acr[2]); hdmi_reg_writeb(hdata, HDMI_ACR_CTS2, acr[1]); - if (hdata->type == HDMI_TYPE13) + if (hdata->drv_data->type == HDMI_TYPE13) hdmi_reg_writeb(hdata, HDMI_V13_ACR_CON, 4); else hdmi_reg_writeb(hdata, HDMI_ACR_CON, 4); @@ -1494,7 +1491,7 @@ static void hdmi_conf_init(struct hdmi_context *hdata) HDMI_VID_PREAMBLE_DIS | HDMI_GUARD_BAND_DIS); } - if (hdata->type == HDMI_TYPE13) { + if (hdata->drv_data->type == HDMI_TYPE13) { /* choose bluescreen (fecal) color */ hdmi_reg_writeb(hdata, HDMI_V13_BLUE_SCREEN_0, 0x12); hdmi_reg_writeb(hdata, HDMI_V13_BLUE_SCREEN_1, 0x34); @@ -1762,7 +1759,7 @@ static void hdmi_v14_mode_apply(struct hdmi_context *hdata) static void hdmi_mode_apply(struct hdmi_context *hdata) { - if (hdata->type == HDMI_TYPE13) + if (hdata->drv_data->type == HDMI_TYPE13) hdmi_v13_mode_apply(hdata); else hdmi_v14_mode_apply(hdata); @@ -1780,7 +1777,7 @@ static void hdmiphy_conf_reset(struct hdmi_context *hdata) hdmiphy_reg_writeb(hdata, HDMIPHY_MODE_SET_DONE, HDMI_PHY_ENABLE_MODE_SET); - if (hdata->type == HDMI_TYPE13) + if (hdata->drv_data->type == HDMI_TYPE13) reg = HDMI_V13_PHY_RSTOUT; else reg = HDMI_PHY_RSTOUT; @@ -1799,7 +1796,7 @@ static void hdmiphy_poweroff(struct hdmi_context *hdata) hdata->phy_enabled = false; - if (hdata->type == HDMI_TYPE13) + if (hdata->drv_data->type == HDMI_TYPE13) return; DRM_DEBUG_KMS("\n"); @@ -1851,7 +1848,8 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata) hdmiphy_reg_writeb(hdata, mode_set_done, HDMI_PHY_ENABLE_MODE_SET); - ret = hdmiphy_reg_write_buf(hdata, 0, hdata->phy_confs[i].conf, 32); + ret = hdmiphy_reg_write_buf(hdata, 0, + hdata->drv_data->phy_confs[i].conf, 32); if (ret) { DRM_ERROR("failed to configure hdmiphy\n"); return; @@ -2123,7 +2121,7 @@ static int hdmi_clks_get(struct hdmi_context *hdata, static int hdmi_clk_init(struct hdmi_context *hdata) { - struct hdmi_driver_data *drv_data = hdata->drv_data; + const struct hdmi_driver_data *drv_data = hdata->drv_data; struct hdmi_resources *res = &hdata->res; int count = drv_data->clk_gates.count + drv_data->clk_muxes.count; struct device *dev = hdata->dev; @@ -2314,7 +2312,6 @@ static int hdmi_probe(struct platform_device *pdev) { struct device_node *ddc_node, *phy_node; struct s5p_hdmi_platform_data *pdata; - struct hdmi_driver_data *drv_data; const struct of_device_id *match; struct device *dev = &pdev->dev; struct hdmi_context *hdata; @@ -2337,15 +2334,10 @@ static int hdmi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, hdata); - match = of_match_node(hdmi_match_types, dev->of_node); + match = of_match_device(hdmi_match_types, dev); if (!match) return -ENODEV; - - drv_data = (struct hdmi_driver_data *)match->data; - hdata->type = drv_data->type; - hdata->phy_confs = drv_data->phy_confs; - hdata->phy_conf_count = drv_data->phy_conf_count; - hdata->drv_data = drv_data; + hdata->drv_data = match->data; hdata->hpd_gpio = pdata->hpd_gpio; hdata->dev = dev; @@ -2400,7 +2392,7 @@ out_get_ddc_adpt: } out_get_phy_port: - if (drv_data->is_apb_phy) { + if (hdata->drv_data->is_apb_phy) { hdata->regs_hdmiphy = of_iomap(phy_node, 0); if (!hdata->regs_hdmiphy) { DRM_ERROR("failed to ioremap hdmi phy\n"); |