Skip to content

Commit

Permalink
Merge tag 'drm-misc-fixes-2018-11-14' of git://anongit.freedesktop.or…
Browse files Browse the repository at this point in the history
…g/drm/drm-misc into drm-fixes

Cross-subsystem:
- omap: Instantiate dss children in omapdss instead of mach (Laurent)

Other:
- htmldocs build warning (Sean)
- MST NULL deref fix (Stanislav)
- omap: Various runtime ref gets on probe/bind (Laurent)
- omap: Fix to the above dss children patch (Tony)

Cc: Sean Paul <sean@poorly.run>
Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Sean Paul <sean@poorly.run>
Link: https://patchwork.freedesktop.org/patch/msgid/20181114204542.GA52569@art_vandelay
  • Loading branch information
Dave Airlie committed Nov 15, 2018
2 parents ccda4af + adf59dd commit 7b74026
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 140 deletions.
111 changes: 53 additions & 58 deletions arch/arm/mach-omap2/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,61 @@ static int __init omapdss_init_fbdev(void)

return 0;
}
#else
static inline int omapdss_init_fbdev(void)

static const char * const omapdss_compat_names[] __initconst = {
"ti,omap2-dss",
"ti,omap3-dss",
"ti,omap4-dss",
"ti,omap5-dss",
"ti,dra7-dss",
};

static struct device_node * __init omapdss_find_dss_of_node(void)
{
return 0;
struct device_node *node;
int i;

for (i = 0; i < ARRAY_SIZE(omapdss_compat_names); ++i) {
node = of_find_compatible_node(NULL, NULL,
omapdss_compat_names[i]);
if (node)
return node;
}

return NULL;
}

static int __init omapdss_init_of(void)
{
int r;
struct device_node *node;
struct platform_device *pdev;

/* only create dss helper devices if dss is enabled in the .dts */

node = omapdss_find_dss_of_node();
if (!node)
return 0;

if (!of_device_is_available(node))
return 0;

pdev = of_find_device_by_node(node);

if (!pdev) {
pr_err("Unable to find DSS platform device\n");
return -ENODEV;
}

r = of_platform_populate(node, NULL, NULL, &pdev->dev);
if (r) {
pr_err("Unable to populate DSS submodule devices\n");
return r;
}

return omapdss_init_fbdev();
}
omap_device_initcall(omapdss_init_of);
#endif /* CONFIG_FB_OMAP2 */

static void dispc_disable_outputs(void)
Expand Down Expand Up @@ -361,58 +411,3 @@ int omap_dss_reset(struct omap_hwmod *oh)

return r;
}

static const char * const omapdss_compat_names[] __initconst = {
"ti,omap2-dss",
"ti,omap3-dss",
"ti,omap4-dss",
"ti,omap5-dss",
"ti,dra7-dss",
};

static struct device_node * __init omapdss_find_dss_of_node(void)
{
struct device_node *node;
int i;

for (i = 0; i < ARRAY_SIZE(omapdss_compat_names); ++i) {
node = of_find_compatible_node(NULL, NULL,
omapdss_compat_names[i]);
if (node)
return node;
}

return NULL;
}

static int __init omapdss_init_of(void)
{
int r;
struct device_node *node;
struct platform_device *pdev;

/* only create dss helper devices if dss is enabled in the .dts */

node = omapdss_find_dss_of_node();
if (!node)
return 0;

if (!of_device_is_available(node))
return 0;

pdev = of_find_device_by_node(node);

if (!pdev) {
pr_err("Unable to find DSS platform device\n");
return -ENODEV;
}

r = of_platform_populate(node, NULL, NULL, &pdev->dev);
if (r) {
pr_err("Unable to populate DSS submodule devices\n");
return r;
}

return omapdss_init_fbdev();
}
omap_device_initcall(omapdss_init_of);
3 changes: 3 additions & 0 deletions drivers/gpu/drm/drm_dp_mst_topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,9 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_
mutex_lock(&mgr->lock);
mstb = mgr->mst_primary;

if (!mstb)
goto out;

for (i = 0; i < lct - 1; i++) {
int shift = (i % 2) ? 0 : 4;
int port_num = (rad[i / 2] >> shift) & 0xf;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_fourcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ EXPORT_SYMBOL(drm_mode_legacy_fb_format);

/**
* drm_driver_legacy_fb_format - compute drm fourcc code from legacy description
* @dev: DRM device
* @bpp: bits per pixels
* @depth: bit depth per pixel
* @native: use host native byte order
*
* Computes a drm fourcc pixel format code for the given @bpp/@depth values.
* Unlike drm_mode_legacy_fb_format() this looks at the drivers mode_config,
Expand Down
15 changes: 8 additions & 7 deletions drivers/gpu/drm/meson/meson_venc.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,13 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic,
unsigned int sof_lines;
unsigned int vsync_lines;

/* Use VENCI for 480i and 576i and double HDMI pixels */
if (mode->flags & DRM_MODE_FLAG_DBLCLK) {
hdmi_repeat = true;
use_enci = true;
venc_hdmi_latency = 1;
}

if (meson_venc_hdmi_supported_vic(vic)) {
vmode = meson_venc_hdmi_get_vic_vmode(vic);
if (!vmode) {
Expand All @@ -865,13 +872,7 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic,
} else {
meson_venc_hdmi_get_dmt_vmode(mode, &vmode_dmt);
vmode = &vmode_dmt;
}

/* Use VENCI for 480i and 576i and double HDMI pixels */
if (mode->flags & DRM_MODE_FLAG_DBLCLK) {
hdmi_repeat = true;
use_enci = true;
venc_hdmi_latency = 1;
use_enci = false;
}

/* Repeat VENC pixels for 480/576i/p, 720p50/60 and 1080p50/60 */
Expand Down
22 changes: 11 additions & 11 deletions drivers/gpu/drm/omapdrm/dss/dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -5409,11 +5409,14 @@ static int dsi_probe(struct platform_device *pdev)

/* DSI on OMAP3 doesn't have register DSI_GNQ, set number
* of data to 3 by default */
if (dsi->data->quirks & DSI_QUIRK_GNQ)
if (dsi->data->quirks & DSI_QUIRK_GNQ) {
dsi_runtime_get(dsi);
/* NB_DATA_LANES */
dsi->num_lanes_supported = 1 + REG_GET(dsi, DSI_GNQ, 11, 9);
else
dsi_runtime_put(dsi);
} else {
dsi->num_lanes_supported = 3;
}

r = dsi_init_output(dsi);
if (r)
Expand All @@ -5426,15 +5429,19 @@ static int dsi_probe(struct platform_device *pdev)
}

r = of_platform_populate(dev->of_node, NULL, NULL, dev);
if (r)
if (r) {
DSSERR("Failed to populate DSI child devices: %d\n", r);
goto err_uninit_output;
}

r = component_add(&pdev->dev, &dsi_component_ops);
if (r)
goto err_uninit_output;
goto err_of_depopulate;

return 0;

err_of_depopulate:
of_platform_depopulate(dev);
err_uninit_output:
dsi_uninit_output(dsi);
err_pm_disable:
Expand Down Expand Up @@ -5470,19 +5477,12 @@ static int dsi_runtime_suspend(struct device *dev)
/* wait for current handler to finish before turning the DSI off */
synchronize_irq(dsi->irq);

dispc_runtime_put(dsi->dss->dispc);

return 0;
}

static int dsi_runtime_resume(struct device *dev)
{
struct dsi_data *dsi = dev_get_drvdata(dev);
int r;

r = dispc_runtime_get(dsi->dss->dispc);
if (r)
return r;

dsi->is_enabled = true;
/* ensure the irq handler sees the is_enabled value */
Expand Down
11 changes: 10 additions & 1 deletion drivers/gpu/drm/omapdrm/dss/dss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1484,16 +1484,23 @@ static int dss_probe(struct platform_device *pdev)
dss);

/* Add all the child devices as components. */
r = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
if (r)
goto err_uninit_debugfs;

omapdss_gather_components(&pdev->dev);

device_for_each_child(&pdev->dev, &match, dss_add_child_component);

r = component_master_add_with_match(&pdev->dev, &dss_component_ops, match);
if (r)
goto err_uninit_debugfs;
goto err_of_depopulate;

return 0;

err_of_depopulate:
of_platform_depopulate(&pdev->dev);

err_uninit_debugfs:
dss_debugfs_remove_file(dss->debugfs.clk);
dss_debugfs_remove_file(dss->debugfs.dss);
Expand Down Expand Up @@ -1522,6 +1529,8 @@ static int dss_remove(struct platform_device *pdev)
{
struct dss_device *dss = platform_get_drvdata(pdev);

of_platform_depopulate(&pdev->dev);

component_master_del(&pdev->dev, &dss_component_ops);

dss_debugfs_remove_file(dss->debugfs.clk);
Expand Down
37 changes: 9 additions & 28 deletions drivers/gpu/drm/omapdrm/dss/hdmi4.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,14 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)

hdmi->dss = dss;

r = hdmi_pll_init(dss, hdmi->pdev, &hdmi->pll, &hdmi->wp);
r = hdmi_runtime_get(hdmi);
if (r)
return r;

r = hdmi_pll_init(dss, hdmi->pdev, &hdmi->pll, &hdmi->wp);
if (r)
goto err_runtime_put;

r = hdmi4_cec_init(hdmi->pdev, &hdmi->core, &hdmi->wp);
if (r)
goto err_pll_uninit;
Expand All @@ -652,12 +656,16 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)
hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
hdmi);

hdmi_runtime_put(hdmi);

return 0;

err_cec_uninit:
hdmi4_cec_uninit(&hdmi->core);
err_pll_uninit:
hdmi_pll_uninit(&hdmi->pll);
err_runtime_put:
hdmi_runtime_put(hdmi);
return r;
}

Expand Down Expand Up @@ -833,32 +841,6 @@ static int hdmi4_remove(struct platform_device *pdev)
return 0;
}

static int hdmi_runtime_suspend(struct device *dev)
{
struct omap_hdmi *hdmi = dev_get_drvdata(dev);

dispc_runtime_put(hdmi->dss->dispc);

return 0;
}

static int hdmi_runtime_resume(struct device *dev)
{
struct omap_hdmi *hdmi = dev_get_drvdata(dev);
int r;

r = dispc_runtime_get(hdmi->dss->dispc);
if (r < 0)
return r;

return 0;
}

static const struct dev_pm_ops hdmi_pm_ops = {
.runtime_suspend = hdmi_runtime_suspend,
.runtime_resume = hdmi_runtime_resume,
};

static const struct of_device_id hdmi_of_match[] = {
{ .compatible = "ti,omap4-hdmi", },
{},
Expand All @@ -869,7 +851,6 @@ struct platform_driver omapdss_hdmi4hw_driver = {
.remove = hdmi4_remove,
.driver = {
.name = "omapdss_hdmi",
.pm = &hdmi_pm_ops,
.of_match_table = hdmi_of_match,
.suppress_bind_attrs = true,
},
Expand Down
27 changes: 0 additions & 27 deletions drivers/gpu/drm/omapdrm/dss/hdmi5.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,32 +825,6 @@ static int hdmi5_remove(struct platform_device *pdev)
return 0;
}

static int hdmi_runtime_suspend(struct device *dev)
{
struct omap_hdmi *hdmi = dev_get_drvdata(dev);

dispc_runtime_put(hdmi->dss->dispc);

return 0;
}

static int hdmi_runtime_resume(struct device *dev)
{
struct omap_hdmi *hdmi = dev_get_drvdata(dev);
int r;

r = dispc_runtime_get(hdmi->dss->dispc);
if (r < 0)
return r;

return 0;
}

static const struct dev_pm_ops hdmi_pm_ops = {
.runtime_suspend = hdmi_runtime_suspend,
.runtime_resume = hdmi_runtime_resume,
};

static const struct of_device_id hdmi_of_match[] = {
{ .compatible = "ti,omap5-hdmi", },
{ .compatible = "ti,dra7-hdmi", },
Expand All @@ -862,7 +836,6 @@ struct platform_driver omapdss_hdmi5hw_driver = {
.remove = hdmi5_remove,
.driver = {
.name = "omapdss_hdmi5",
.pm = &hdmi_pm_ops,
.of_match_table = hdmi_of_match,
.suppress_bind_attrs = true,
},
Expand Down
Loading

0 comments on commit 7b74026

Please sign in to comment.