This patch returns error in case of using APB PHY.
Exynos5420 SoC and maybe later would use APB PHY instead of I2C PHY so such case should be considered.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_hdmi.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index e6ce363..b695398 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -63,6 +63,11 @@ enum hdmi_type { HDMI_TYPE14, };
+struct hdmi_driver_data { + unsigned int type; + unsigned int is_apb_phy:1; +}; + struct hdmi_resources { struct clk *hdmi; struct clk *sclk_hdmi; @@ -197,6 +202,14 @@ struct hdmiphy_config { u8 conf[32]; };
+struct hdmi_driver_data exynos4212_hdmi_driver_data = { + .type = HDMI_TYPE14, +}; + +struct hdmi_driver_data exynos5_hdmi_driver_data = { + .type = HDMI_TYPE14, +}; + /* list of phy config settings */ static const struct hdmiphy_config hdmiphy_v13_configs[] = { { @@ -1959,10 +1972,10 @@ err_data: static struct of_device_id hdmi_match_types[] = { { .compatible = "samsung,exynos5-hdmi", - .data = (void *)HDMI_TYPE14, + .data = &exynos5_hdmi_driver_data, }, { .compatible = "samsung,exynos4212-hdmi", - .data = (void *)HDMI_TYPE14, + .data = &exynos4212_hdmi_driver_data, }, { /* end node */ } @@ -1976,6 +1989,7 @@ static int hdmi_probe(struct platform_device *pdev) struct resource *res; const struct of_device_id *match; struct device_node *ddc_node, *phy_node; + struct hdmi_driver_data *drv_data; int ret;
if (!dev->of_node) @@ -1996,7 +2010,9 @@ static int hdmi_probe(struct platform_device *pdev) match = of_match_node(hdmi_match_types, dev->of_node); if (!match) return -ENODEV; - hdata->type = (enum hdmi_type)match->data; + + drv_data = (struct hdmi_driver_data *)match->data; + hdata->type = drv_data->type;
hdata->hpd_gpio = pdata->hpd_gpio; hdata->dev = dev; @@ -2030,6 +2046,10 @@ static int hdmi_probe(struct platform_device *pdev) return -ENODEV; }
+ /* Not support APB PHY yet. */ + if (drv_data->is_apb_phy) + return -EPERM; + /* hdmiphy i2c driver */ phy_node = of_parse_phandle(dev->of_node, "phy", 0); if (!phy_node) {
This patch changes i2c_client for ddc to i2c_adapter because ddc needs only i2c_adapter.
Signed-off-by: Inki Dae inki.dae@samsung.com Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- drivers/gpu/drm/exynos/exynos_hdmi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index b695398..a060363 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -184,7 +184,7 @@ struct hdmi_context { void __iomem *regs; int irq;
- struct i2c_client *ddc_port; + struct i2c_adapter *ddc_adpt; struct i2c_client *hdmiphy_port;
/* current hdmiphy conf regs */ @@ -765,10 +765,10 @@ static int hdmi_get_modes(struct drm_connector *connector) struct hdmi_context *hdata = ctx_from_connector(connector); struct edid *edid;
- if (!hdata->ddc_port) + if (!hdata->ddc_adpt) return -ENODEV;
- edid = drm_get_edid(connector, hdata->ddc_port->adapter); + edid = drm_get_edid(connector, hdata->ddc_adpt); if (!edid) return -ENODEV;
@@ -2040,9 +2040,9 @@ static int hdmi_probe(struct platform_device *pdev) DRM_ERROR("Failed to find ddc node in device tree\n"); return -ENODEV; } - hdata->ddc_port = of_find_i2c_device_by_node(ddc_node); - if (!hdata->ddc_port) { - DRM_ERROR("Failed to get ddc i2c client by node\n"); + hdata->ddc_adpt = of_find_i2c_adapter_by_node(ddc_node); + if (!hdata->ddc_adpt) { + DRM_ERROR("Failed to get ddc i2c adapter by node\n"); return -ENODEV; }
@@ -2092,7 +2092,7 @@ static int hdmi_probe(struct platform_device *pdev) err_hdmiphy: put_device(&hdata->hdmiphy_port->dev); err_ddc: - put_device(&hdata->ddc_port->dev); + put_device(&hdata->ddc_adpt->dev); return ret; }
@@ -2103,7 +2103,7 @@ static int hdmi_remove(struct platform_device *pdev) struct hdmi_context *hdata = display->ctx;
put_device(&hdata->hdmiphy_port->dev); - put_device(&hdata->ddc_port->dev); + put_device(&hdata->ddc_adpt->dev); pm_runtime_disable(&pdev->dev);
return 0;
dri-devel@lists.freedesktop.org