Commit 50638ae5 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

drm: omapdrm: dispc: Pass DISPC pointer to dispc_ops operations

This removes the need to access the global DISPC private data in those
functions (both for the current accesses and the future ones that will
be introduced when allocating the DISPC private data dynamically).

In order to allow the omapdrm side to call the dispc_ops with a DISPC
pointer, we also introduce a new function dss_get_dispc() to retrieve
the DISPC corresponding to the DSS.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
parent d3541ca8
...@@ -44,6 +44,12 @@ void omapdss_set_dss(struct dss_device *dss) ...@@ -44,6 +44,12 @@ void omapdss_set_dss(struct dss_device *dss)
} }
EXPORT_SYMBOL(omapdss_set_dss); EXPORT_SYMBOL(omapdss_set_dss);
struct dispc_device *dispc_get_dispc(struct dss_device *dss)
{
return dss->dispc;
}
EXPORT_SYMBOL(dispc_get_dispc);
const struct dispc_ops *dispc_get_ops(struct dss_device *dss) const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
{ {
return dss->dispc_ops; return dss->dispc_ops;
......
This diff is collapsed.
...@@ -406,7 +406,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) ...@@ -406,7 +406,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
goto err_reg_enable; goto err_reg_enable;
} }
r = dispc_runtime_get(); r = dispc_runtime_get(dpi->dss->dispc);
if (r) if (r)
goto err_get_dispc; goto err_get_dispc;
...@@ -442,7 +442,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) ...@@ -442,7 +442,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
dss_pll_disable(dpi->pll); dss_pll_disable(dpi->pll);
err_pll_init: err_pll_init:
err_src_sel: err_src_sel:
dispc_runtime_put(); dispc_runtime_put(dpi->dss->dispc);
err_get_dispc: err_get_dispc:
if (dpi->vdds_dsi_reg) if (dpi->vdds_dsi_reg)
regulator_disable(dpi->vdds_dsi_reg); regulator_disable(dpi->vdds_dsi_reg);
...@@ -466,7 +466,7 @@ static void dpi_display_disable(struct omap_dss_device *dssdev) ...@@ -466,7 +466,7 @@ static void dpi_display_disable(struct omap_dss_device *dssdev)
dss_pll_disable(dpi->pll); dss_pll_disable(dpi->pll);
} }
dispc_runtime_put(); dispc_runtime_put(dpi->dss->dispc);
if (dpi->vdds_dsi_reg) if (dpi->vdds_dsi_reg)
regulator_disable(dpi->vdds_dsi_reg); regulator_disable(dpi->vdds_dsi_reg);
......
...@@ -5523,7 +5523,7 @@ static int dsi_runtime_suspend(struct device *dev) ...@@ -5523,7 +5523,7 @@ static int dsi_runtime_suspend(struct device *dev)
/* wait for current handler to finish before turning the DSI off */ /* wait for current handler to finish before turning the DSI off */
synchronize_irq(dsi->irq); synchronize_irq(dsi->irq);
dispc_runtime_put(); dispc_runtime_put(dsi->dss->dispc);
return 0; return 0;
} }
...@@ -5533,7 +5533,7 @@ static int dsi_runtime_resume(struct device *dev) ...@@ -5533,7 +5533,7 @@ static int dsi_runtime_resume(struct device *dev)
struct dsi_data *dsi = dev_get_drvdata(dev); struct dsi_data *dsi = dev_get_drvdata(dev);
int r; int r;
r = dispc_runtime_get(); r = dispc_runtime_get(dsi->dss->dispc);
if (r) if (r)
return r; return r;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "omapdss.h" #include "omapdss.h"
struct dispc_device;
struct dss_debugfs_entry; struct dss_debugfs_entry;
struct platform_device; struct platform_device;
struct seq_file; struct seq_file;
...@@ -272,6 +273,7 @@ struct dss_device { ...@@ -272,6 +273,7 @@ struct dss_device {
struct dss_pll *video1_pll; struct dss_pll *video1_pll;
struct dss_pll *video2_pll; struct dss_pll *video2_pll;
struct dispc_device *dispc;
const struct dispc_ops *dispc_ops; const struct dispc_ops *dispc_ops;
}; };
...@@ -407,8 +409,8 @@ static inline void dpi_uninit_port(struct device_node *port) ...@@ -407,8 +409,8 @@ static inline void dpi_uninit_port(struct device_node *port)
/* DISPC */ /* DISPC */
void dispc_dump_clocks(struct seq_file *s); void dispc_dump_clocks(struct seq_file *s);
int dispc_runtime_get(void); int dispc_runtime_get(struct dispc_device *dispc);
void dispc_runtime_put(void); void dispc_runtime_put(struct dispc_device *dispc);
void dispc_enable_sidle(void); void dispc_enable_sidle(void);
void dispc_disable_sidle(void); void dispc_disable_sidle(void);
......
...@@ -819,16 +819,19 @@ static int hdmi4_remove(struct platform_device *pdev) ...@@ -819,16 +819,19 @@ static int hdmi4_remove(struct platform_device *pdev)
static int hdmi_runtime_suspend(struct device *dev) static int hdmi_runtime_suspend(struct device *dev)
{ {
dispc_runtime_put(); struct omap_hdmi *hdmi = dev_get_drvdata(dev);
dispc_runtime_put(hdmi->dss->dispc);
return 0; return 0;
} }
static int hdmi_runtime_resume(struct device *dev) static int hdmi_runtime_resume(struct device *dev)
{ {
struct omap_hdmi *hdmi = dev_get_drvdata(dev);
int r; int r;
r = dispc_runtime_get(); r = dispc_runtime_get(hdmi->dss->dispc);
if (r < 0) if (r < 0)
return r; return r;
......
...@@ -814,16 +814,19 @@ static int hdmi5_remove(struct platform_device *pdev) ...@@ -814,16 +814,19 @@ static int hdmi5_remove(struct platform_device *pdev)
static int hdmi_runtime_suspend(struct device *dev) static int hdmi_runtime_suspend(struct device *dev)
{ {
dispc_runtime_put(); struct omap_hdmi *hdmi = dev_get_drvdata(dev);
dispc_runtime_put(hdmi->dss->dispc);
return 0; return 0;
} }
static int hdmi_runtime_resume(struct device *dev) static int hdmi_runtime_resume(struct device *dev)
{ {
struct omap_hdmi *hdmi = dev_get_drvdata(dev);
int r; int r;
r = dispc_runtime_get(); r = dispc_runtime_get(hdmi->dss->dispc);
if (r < 0) if (r < 0)
return r; return r;
......
...@@ -62,6 +62,8 @@ ...@@ -62,6 +62,8 @@
struct dss_device; struct dss_device;
struct omap_drm_private; struct omap_drm_private;
struct omap_dss_device; struct omap_dss_device;
struct dispc_device;
struct dss_device;
struct dss_lcd_mgr_config; struct dss_lcd_mgr_config;
struct snd_aes_iec958; struct snd_aes_iec958;
struct snd_cea_861_aud_if; struct snd_cea_861_aud_if;
...@@ -690,49 +692,64 @@ void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev, ...@@ -690,49 +692,64 @@ void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
/* dispc ops */ /* dispc ops */
struct dispc_ops { struct dispc_ops {
u32 (*read_irqstatus)(void); u32 (*read_irqstatus)(struct dispc_device *dispc);
void (*clear_irqstatus)(u32 mask); void (*clear_irqstatus)(struct dispc_device *dispc, u32 mask);
void (*write_irqenable)(u32 mask); void (*write_irqenable)(struct dispc_device *dispc, u32 mask);
int (*request_irq)(irq_handler_t handler, void *dev_id); int (*request_irq)(struct dispc_device *dispc, irq_handler_t handler,
void (*free_irq)(void *dev_id); void *dev_id);
void (*free_irq)(struct dispc_device *dispc, void *dev_id);
int (*runtime_get)(void); int (*runtime_get)(struct dispc_device *dispc);
void (*runtime_put)(void); void (*runtime_put)(struct dispc_device *dispc);
int (*get_num_ovls)(void); int (*get_num_ovls)(struct dispc_device *dispc);
int (*get_num_mgrs)(void); int (*get_num_mgrs)(struct dispc_device *dispc);
u32 (*get_memory_bandwidth_limit)(void); u32 (*get_memory_bandwidth_limit)(struct dispc_device *dispc);
void (*mgr_enable)(enum omap_channel channel, bool enable); void (*mgr_enable)(struct dispc_device *dispc,
bool (*mgr_is_enabled)(enum omap_channel channel); enum omap_channel channel, bool enable);
u32 (*mgr_get_vsync_irq)(enum omap_channel channel); bool (*mgr_is_enabled)(struct dispc_device *dispc,
u32 (*mgr_get_framedone_irq)(enum omap_channel channel); enum omap_channel channel);
u32 (*mgr_get_sync_lost_irq)(enum omap_channel channel); u32 (*mgr_get_vsync_irq)(struct dispc_device *dispc,
bool (*mgr_go_busy)(enum omap_channel channel); enum omap_channel channel);
void (*mgr_go)(enum omap_channel channel); u32 (*mgr_get_framedone_irq)(struct dispc_device *dispc,
void (*mgr_set_lcd_config)(enum omap_channel channel, enum omap_channel channel);
u32 (*mgr_get_sync_lost_irq)(struct dispc_device *dispc,
enum omap_channel channel);
bool (*mgr_go_busy)(struct dispc_device *dispc,
enum omap_channel channel);
void (*mgr_go)(struct dispc_device *dispc, enum omap_channel channel);
void (*mgr_set_lcd_config)(struct dispc_device *dispc,
enum omap_channel channel,
const struct dss_lcd_mgr_config *config); const struct dss_lcd_mgr_config *config);
void (*mgr_set_timings)(enum omap_channel channel, void (*mgr_set_timings)(struct dispc_device *dispc,
enum omap_channel channel,
const struct videomode *vm); const struct videomode *vm);
void (*mgr_setup)(enum omap_channel channel, void (*mgr_setup)(struct dispc_device *dispc, enum omap_channel channel,
const struct omap_overlay_manager_info *info); const struct omap_overlay_manager_info *info);
enum omap_dss_output_id (*mgr_get_supported_outputs)(enum omap_channel channel); enum omap_dss_output_id (*mgr_get_supported_outputs)(
u32 (*mgr_gamma_size)(enum omap_channel channel); struct dispc_device *dispc, enum omap_channel channel);
void (*mgr_set_gamma)(enum omap_channel channel, u32 (*mgr_gamma_size)(struct dispc_device *dispc,
enum omap_channel channel);
void (*mgr_set_gamma)(struct dispc_device *dispc,
enum omap_channel channel,
const struct drm_color_lut *lut, const struct drm_color_lut *lut,
unsigned int length); unsigned int length);
int (*ovl_enable)(enum omap_plane_id plane, bool enable); int (*ovl_enable)(struct dispc_device *dispc, enum omap_plane_id plane,
int (*ovl_setup)(enum omap_plane_id plane, bool enable);
int (*ovl_setup)(struct dispc_device *dispc, enum omap_plane_id plane,
const struct omap_overlay_info *oi, const struct omap_overlay_info *oi,
const struct videomode *vm, bool mem_to_mem, const struct videomode *vm, bool mem_to_mem,
enum omap_channel channel); enum omap_channel channel);
const u32 *(*ovl_get_color_modes)(enum omap_plane_id plane); const u32 *(*ovl_get_color_modes)(struct dispc_device *dispc,
enum omap_plane_id plane);
}; };
struct dispc_device *dispc_get_dispc(struct dss_device *dss);
const struct dispc_ops *dispc_get_ops(struct dss_device *dss); const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
bool omapdss_component_is_display(struct device_node *node); bool omapdss_component_is_display(struct device_node *node);
......
...@@ -141,7 +141,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) ...@@ -141,7 +141,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)
if (r) if (r)
goto err_reg_enable; goto err_reg_enable;
r = dispc_runtime_get(); r = dispc_runtime_get(sdi.dss->dispc);
if (r) if (r)
goto err_get_dispc; goto err_get_dispc;
...@@ -203,7 +203,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) ...@@ -203,7 +203,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)
err_sdi_enable: err_sdi_enable:
err_set_dss_clock_div: err_set_dss_clock_div:
err_calc_clock_div: err_calc_clock_div:
dispc_runtime_put(); dispc_runtime_put(sdi.dss->dispc);
err_get_dispc: err_get_dispc:
regulator_disable(sdi.vdds_sdi_reg); regulator_disable(sdi.vdds_sdi_reg);
err_reg_enable: err_reg_enable:
...@@ -216,7 +216,7 @@ static void sdi_display_disable(struct omap_dss_device *dssdev) ...@@ -216,7 +216,7 @@ static void sdi_display_disable(struct omap_dss_device *dssdev)
dss_sdi_disable(sdi.dss); dss_sdi_disable(sdi.dss);
dispc_runtime_put(); dispc_runtime_put(sdi.dss->dispc);
regulator_disable(sdi.vdds_sdi_reg); regulator_disable(sdi.vdds_sdi_reg);
} }
......
...@@ -956,7 +956,7 @@ static int venc_runtime_suspend(struct device *dev) ...@@ -956,7 +956,7 @@ static int venc_runtime_suspend(struct device *dev)
if (venc.tv_dac_clk) if (venc.tv_dac_clk)
clk_disable_unprepare(venc.tv_dac_clk); clk_disable_unprepare(venc.tv_dac_clk);
dispc_runtime_put(); dispc_runtime_put(venc.dss->dispc);
return 0; return 0;
} }
...@@ -965,7 +965,7 @@ static int venc_runtime_resume(struct device *dev) ...@@ -965,7 +965,7 @@ static int venc_runtime_resume(struct device *dev)
{ {
int r; int r;
r = dispc_runtime_get(); r = dispc_runtime_get(venc.dss->dispc);
if (r < 0) if (r < 0)
return r; return r;
......
...@@ -117,10 +117,13 @@ static int omap_crtc_dss_connect(struct omap_drm_private *priv, ...@@ -117,10 +117,13 @@ static int omap_crtc_dss_connect(struct omap_drm_private *priv,
enum omap_channel channel, enum omap_channel channel,
struct omap_dss_device *dst) struct omap_dss_device *dst)
{ {
const struct dispc_ops *dispc_ops = priv->dispc_ops;
struct dispc_device *dispc = priv->dispc;
if (omap_crtc_output[channel]) if (omap_crtc_output[channel])
return -EINVAL; return -EINVAL;
if (!(priv->dispc_ops->mgr_get_supported_outputs(channel) & dst->id)) if (!(dispc_ops->mgr_get_supported_outputs(dispc, channel) & dst->id))
return -EINVAL; return -EINVAL;
omap_crtc_output[channel] = dst; omap_crtc_output[channel] = dst;
...@@ -157,7 +160,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) ...@@ -157,7 +160,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
return; return;
if (omap_crtc_output[channel]->output_type == OMAP_DISPLAY_TYPE_HDMI) { if (omap_crtc_output[channel]->output_type == OMAP_DISPLAY_TYPE_HDMI) {
priv->dispc_ops->mgr_enable(channel, enable); priv->dispc_ops->mgr_enable(priv->dispc, channel, enable);
omap_crtc->enabled = enable; omap_crtc->enabled = enable;
return; return;
} }
...@@ -170,8 +173,9 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) ...@@ -170,8 +173,9 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
omap_crtc->ignore_digit_sync_lost = true; omap_crtc->ignore_digit_sync_lost = true;
} }
framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(channel); framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(priv->dispc,
vsync_irq = priv->dispc_ops->mgr_get_vsync_irq(channel); channel);
vsync_irq = priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel);
if (enable) { if (enable) {
wait = omap_irq_wait_init(dev, vsync_irq, 1); wait = omap_irq_wait_init(dev, vsync_irq, 1);
...@@ -191,7 +195,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) ...@@ -191,7 +195,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
wait = omap_irq_wait_init(dev, vsync_irq, 2); wait = omap_irq_wait_init(dev, vsync_irq, 2);
} }
priv->dispc_ops->mgr_enable(channel, enable); priv->dispc_ops->mgr_enable(priv->dispc, channel, enable);
omap_crtc->enabled = enable; omap_crtc->enabled = enable;
ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100)); ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100));
...@@ -213,7 +217,8 @@ static int omap_crtc_dss_enable(struct omap_drm_private *priv, ...@@ -213,7 +217,8 @@ static int omap_crtc_dss_enable(struct omap_drm_private *priv,
{ {
struct omap_crtc *omap_crtc = omap_crtcs[channel]; struct omap_crtc *omap_crtc = omap_crtcs[channel];
priv->dispc_ops->mgr_set_timings(omap_crtc->channel, &omap_crtc->vm); priv->dispc_ops->mgr_set_timings(priv->dispc, omap_crtc->channel,
&omap_crtc->vm);
omap_crtc_set_enabled(&omap_crtc->base, true); omap_crtc_set_enabled(&omap_crtc->base, true);
return 0; return 0;
...@@ -243,7 +248,8 @@ static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv, ...@@ -243,7 +248,8 @@ static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
struct omap_crtc *omap_crtc = omap_crtcs[channel]; struct omap_crtc *omap_crtc = omap_crtcs[channel];
DBG("%s", omap_crtc->name); DBG("%s", omap_crtc->name);
priv->dispc_ops->mgr_set_lcd_config(omap_crtc->channel, config); priv->dispc_ops->mgr_set_lcd_config(priv->dispc, omap_crtc->channel,
config);
} }
static int omap_crtc_dss_register_framedone( static int omap_crtc_dss_register_framedone(
...@@ -300,7 +306,7 @@ void omap_crtc_vblank_irq(struct drm_crtc *crtc) ...@@ -300,7 +306,7 @@ void omap_crtc_vblank_irq(struct drm_crtc *crtc)
* If the dispc is busy we're racing the flush operation. Try again on * If the dispc is busy we're racing the flush operation. Try again on
* the next vblank interrupt. * the next vblank interrupt.
*/ */
if (priv->dispc_ops->mgr_go_busy(omap_crtc->channel)) { if (priv->dispc_ops->mgr_go_busy(priv->dispc, omap_crtc->channel)) {
spin_unlock(&crtc->dev->event_lock); spin_unlock(&crtc->dev->event_lock);
return; return;
} }
...@@ -337,7 +343,7 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc) ...@@ -337,7 +343,7 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc)
info.partial_alpha_enabled = false; info.partial_alpha_enabled = false;
info.cpr_enable = false; info.cpr_enable = false;
priv->dispc_ops->mgr_setup(omap_crtc->channel, &info); priv->dispc_ops->mgr_setup(priv->dispc, omap_crtc->channel, &info);
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
...@@ -537,7 +543,8 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc, ...@@ -537,7 +543,8 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
length = crtc->state->gamma_lut->length / length = crtc->state->gamma_lut->length /
sizeof(*lut); sizeof(*lut);
} }
priv->dispc_ops->mgr_set_gamma(omap_crtc->channel, lut, length); priv->dispc_ops->mgr_set_gamma(priv->dispc, omap_crtc->channel,
lut, length);
} }
omap_crtc_write_crtc_properties(crtc); omap_crtc_write_crtc_properties(crtc);
...@@ -552,7 +559,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc, ...@@ -552,7 +559,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
WARN_ON(ret != 0); WARN_ON(ret != 0);
spin_lock_irq(&crtc->dev->event_lock); spin_lock_irq(&crtc->dev->event_lock);
priv->dispc_ops->mgr_go(omap_crtc->channel); priv->dispc_ops->mgr_go(priv->dispc, omap_crtc->channel);
omap_crtc_arm_event(crtc); omap_crtc_arm_event(crtc);
spin_unlock_irq(&crtc->dev->event_lock); spin_unlock_irq(&crtc->dev->event_lock);
} }
...@@ -734,7 +741,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, ...@@ -734,7 +741,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
* extracted with dispc_mgr_gamma_size(). If it returns 0 * extracted with dispc_mgr_gamma_size(). If it returns 0
* gamma table is not supprted. * gamma table is not supprted.
*/ */
if (priv->dispc_ops->mgr_gamma_size(channel)) { if (priv->dispc_ops->mgr_gamma_size(priv->dispc, channel)) {
unsigned int gamma_lut_size = 256; unsigned int gamma_lut_size = 256;
drm_crtc_enable_color_mgmt(crtc, 0, false, gamma_lut_size); drm_crtc_enable_color_mgmt(crtc, 0, false, gamma_lut_size);
......
...@@ -69,7 +69,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state) ...@@ -69,7 +69,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
struct drm_device *dev = old_state->dev; struct drm_device *dev = old_state->dev;
struct omap_drm_private *priv = dev->dev_private; struct omap_drm_private *priv = dev->dev_private;
priv->dispc_ops->runtime_get(); priv->dispc_ops->runtime_get(priv->dispc);
/* Apply the atomic update. */ /* Apply the atomic update. */
drm_atomic_helper_commit_modeset_disables(dev, old_state); drm_atomic_helper_commit_modeset_disables(dev, old_state);
...@@ -113,7 +113,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state) ...@@ -113,7 +113,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
drm_atomic_helper_cleanup_planes(dev, old_state); drm_atomic_helper_cleanup_planes(dev, old_state);
priv->dispc_ops->runtime_put(); priv->dispc_ops->runtime_put(priv->dispc);
} }
static const struct drm_mode_config_helper_funcs omap_mode_config_helper_funcs = { static const struct drm_mode_config_helper_funcs omap_mode_config_helper_funcs = {
...@@ -191,7 +191,7 @@ static int omap_connect_dssdevs(void) ...@@ -191,7 +191,7 @@ static int omap_connect_dssdevs(void)
static int omap_modeset_init_properties(struct drm_device *dev) static int omap_modeset_init_properties(struct drm_device *dev)
{ {
struct omap_drm_private *priv = dev->dev_private; struct omap_drm_private *priv = dev->dev_private;
unsigned int num_planes = priv->dispc_ops->get_num_ovls(); unsigned int num_planes = priv->dispc_ops->get_num_ovls(priv->dispc);
priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0, priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0,
num_planes - 1); num_planes - 1);
...@@ -205,8 +205,8 @@ static int omap_modeset_init(struct drm_device *dev) ...@@ -205,8 +205,8 @@ static int omap_modeset_init(struct drm_device *dev)
{ {
struct omap_drm_private *priv = dev->dev_private; struct omap_drm_private *priv = dev->dev_private;
struct omap_dss_device *dssdev = NULL; struct omap_dss_device *dssdev = NULL;
int num_ovls = priv->dispc_ops->get_num_ovls(); int num_ovls = priv->dispc_ops->get_num_ovls(priv->dispc);
int num_mgrs = priv->dispc_ops->get_num_mgrs(); int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
int num_crtcs, crtc_idx, plane_idx; int num_crtcs, crtc_idx, plane_idx;
int ret; int ret;
u32 plane_crtc_mask; u32 plane_crtc_mask;
...@@ -521,6 +521,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) ...@@ -521,6 +521,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
priv->dev = dev; priv->dev = dev;
priv->dss = omapdss_get_dss(); priv->dss = omapdss_get_dss();
priv->dispc = dispc_get_dispc(priv->dss);
priv->dispc_ops = dispc_get_ops(priv->dss); priv->dispc_ops = dispc_get_ops(priv->dss);
omap_crtc_pre_init(priv); omap_crtc_pre_init(priv);
...@@ -549,7 +550,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) ...@@ -549,7 +550,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
/* Get memory bandwidth limits */ /* Get memory bandwidth limits */
if (priv->dispc_ops->get_memory_bandwidth_limit) if (priv->dispc_ops->get_memory_bandwidth_limit)
priv->max_bandwidth = priv->max_bandwidth =
priv->dispc_ops->get_memory_bandwidth_limit(); priv->dispc_ops->get_memory_bandwidth_limit(priv->dispc);
omap_gem_init(ddev); omap_gem_init(ddev);
......
...@@ -51,6 +51,7 @@ struct omap_drm_private { ...@@ -51,6 +51,7 @@ struct omap_drm_private {
u32 omaprev; u32 omaprev;
struct dss_device *dss; struct dss_device *dss;
struct dispc_device *dispc;
const struct dispc_ops *dispc_ops; const struct dispc_ops *dispc_ops;
unsigned int num_crtcs; unsigned int num_crtcs;
......
...@@ -38,7 +38,7 @@ static void omap_irq_update(struct drm_device *dev) ...@@ -38,7 +38,7 @@ static void omap_irq_update(struct drm_device *dev)
DBG("irqmask=%08x", irqmask); DBG("irqmask=%08x", irqmask);
priv->dispc_ops->write_irqenable(irqmask); priv->dispc_ops->write_irqenable(priv->dispc, irqmask);
} }
static void omap_irq_wait_handler(struct omap_irq_wait *wait) static void omap_irq_wait_handler(struct omap_irq_wait *wait)
...@@ -108,7 +108,8 @@ int omap_irq_enable_vblank(struct drm_crtc *crtc) ...@@ -108,7 +108,8 @@ int omap_irq_enable_vblank(struct drm_crtc *crtc)
DBG("dev=%p, crtc=%u", dev, channel); DBG("dev=%p, crtc=%u", dev, channel);
spin_lock_irqsave(&priv->wait_lock, flags); spin_lock_irqsave(&priv->wait_lock, flags);
priv->irq_mask |= priv->dispc_ops->mgr_get_vsync_irq(channel); priv->irq_mask |= priv->dispc_ops->mgr_get_vsync_irq(priv->dispc,
channel);
omap_irq_update(dev); omap_irq_update(dev);
spin_unlock_irqrestore(&priv->wait_lock, flags); spin_unlock_irqrestore(&priv->wait_lock, flags);
...@@ -134,7 +135,8 @@ void omap_irq_disable_vblank(struct drm_crtc *crtc) ...@@ -134,7 +135,8 @@ void omap_irq_disable_vblank(struct drm_crtc *crtc)
DBG("dev=%p, crtc=%u", dev, channel); DBG("dev=%p, crtc=%u", dev, channel);
spin_lock_irqsave(&priv->wait_lock, flags); spin_lock_irqsave(&priv->wait_lock, flags);
priv->irq_mask &= ~priv->dispc_ops->mgr_get_vsync_irq(channel); priv->irq_mask &= ~priv->dispc_ops->mgr_get_vsync_irq(priv->dispc,
channel);
omap_irq_update(dev); omap_irq_update(dev);
spin_unlock_irqrestore(&priv->wait_lock, flags); spin_unlock_irqrestore(&priv->wait_lock, flags);
} }
...@@ -198,9 +200,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg) ...@@ -198,9 +200,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
unsigned int id; unsigned int id;
u32 irqstatus; u32 irqstatus;
irqstatus = priv->dispc_ops->read_irqstatus(); irqstatus = priv->dispc_ops->read_irqstatus(priv->dispc);
priv->dispc_ops->clear_irqstatus(irqstatus); priv->dispc_ops->clear_irqstatus(priv->dispc, irqstatus);
priv->dispc_ops->read_irqstatus(); /* flush posted write */ priv->dispc_ops->read_irqstatus(priv->dispc); /* flush posted write */
VERB("irqs: %08x", irqstatus); VERB("irqs: %08x", irqstatus);
...@@ -208,12 +210,12 @@ static irqreturn_t omap_irq_handler(int irq, void *arg) ...@@ -208,12 +210,12 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
struct drm_crtc *crtc = priv->crtcs[id]; struct drm_crtc *crtc = priv->crtcs[id];
enum omap_channel channel = omap_crtc_channel(crtc); enum omap_channel channel = omap_crtc_channel(crtc);
if (irqstatus & priv->dispc_ops->mgr_get_vsync_irq(channel)) { if (irqstatus & priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel)) {
drm_handle_vblank(dev, id); drm_handle_vblank(dev, id);
omap_crtc_vblank_irq(crtc); omap_crtc_vblank_irq(crtc);
} }
if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(channel)) if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, channel))
omap_crtc_error_irq(crtc, irqstatus); omap_crtc_error_irq(crtc, irqstatus);
} }
...@@ -247,7 +249,7 @@ static const u32 omap_underflow_irqs[] = { ...@@ -247,7 +249,7 @@ static const u32 omap_underflow_irqs[] = {
int omap_drm_irq_install(struct drm_device *dev) int omap_drm_irq_install(struct drm_device *dev)
{ {
struct omap_drm_private *priv = dev->dev_private; struct omap_drm_private *priv = dev->dev_private;
unsigned int num_mgrs = priv->dispc_ops->get_num_mgrs(); unsigned int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
unsigned int max_planes; unsigned int max_planes;
unsigned int i; unsigned int i;
int ret; int ret;
...@@ -265,13 +267,13 @@ int omap_drm_irq_install(struct drm_device *dev) ...@@ -265,13 +267,13 @@ int omap_drm_irq_install(struct drm_device *dev)
} }
for (i = 0; i < num_mgrs; ++i) for (i = 0; i < num_mgrs; ++i)
priv->irq_mask |= priv->dispc_ops->mgr_get_sync_lost_irq(i); priv->irq_mask |= priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, i);
priv->dispc_ops->runtime_get(); priv->dispc_ops->runtime_get(priv->dispc);
priv->dispc_ops->clear_irqstatus(0xffffffff); priv->dispc_ops->clear_irqstatus(priv->dispc, 0xffffffff);
priv->dispc_ops->runtime_put(); priv->dispc_ops->runtime_put(priv->dispc);
ret = priv->dispc_ops->request_irq(omap_irq_handler, dev); ret = priv->dispc_ops->request_irq(priv->dispc, omap_irq_handler, dev);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -289,5 +291,5 @@ void omap_drm_irq_uninstall(struct drm_device *dev) ...@@ -289,5 +291,5 @@ void omap_drm_irq_uninstall(struct drm_device *dev)
dev->irq_enabled = false; dev->irq_enabled = false;
priv->dispc_ops->free_irq(dev); priv->dispc_ops->free_irq(priv->dispc, dev);
} }
...@@ -77,17 +77,17 @@ static void omap_plane_atomic_update(struct drm_plane *plane, ...@@ -77,17 +77,17 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
&info.paddr, &info.p_uv_addr); &info.paddr, &info.p_uv_addr);
/* and finally, update omapdss: */ /* and finally, update omapdss: */
ret = priv->dispc_ops->ovl_setup(omap_plane->id, &info, ret = priv->dispc_ops->ovl_setup(priv->dispc, omap_plane->id, &info,
omap_crtc_timings(state->crtc), false, omap_crtc_timings(state->crtc), false,
omap_crtc_channel(state->crtc)); omap_crtc_channel(state->crtc));
if (ret) { if (ret) {
dev_err(plane->dev->dev, "Failed to setup plane %s\n", dev_err(plane->dev->dev, "Failed to setup plane %s\n",
omap_plane->name); omap_plane->name);
priv->dispc_ops->ovl_enable(omap_plane->id, false); priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, false);
return; return;
} }
priv->dispc_ops->ovl_enable(omap_plane->id, true); priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, true);
} }
static void omap_plane_atomic_disable(struct drm_plane *plane, static void omap_plane_atomic_disable(struct drm_plane *plane,
...@@ -100,7 +100,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane, ...@@ -100,7 +100,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY
? 0 : omap_plane->id; ? 0 : omap_plane->id;
priv->dispc_ops->ovl_enable(omap_plane->id, false); priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, false);
} }
static int omap_plane_atomic_check(struct drm_plane *plane, static int omap_plane_atomic_check(struct drm_plane *plane,
...@@ -259,7 +259,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, ...@@ -259,7 +259,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
u32 possible_crtcs) u32 possible_crtcs)
{ {
struct omap_drm_private *priv = dev->dev_private; struct omap_drm_private *priv = dev->dev_private;
unsigned int num_planes = priv->dispc_ops->get_num_ovls(); unsigned int num_planes = priv->dispc_ops->get_num_ovls(priv->dispc);
struct drm_plane *plane; struct drm_plane *plane;
struct omap_plane *omap_plane; struct omap_plane *omap_plane;
enum omap_plane_id id; enum omap_plane_id id;
...@@ -278,7 +278,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, ...@@ -278,7 +278,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
if (!omap_plane) if (!omap_plane)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
formats = priv->dispc_ops->ovl_get_color_modes(id); formats = priv->dispc_ops->ovl_get_color_modes(priv->dispc, id);
for (nformats = 0; formats[nformats]; ++nformats) for (nformats = 0; formats[nformats]; ++nformats)
; ;
omap_plane->id = id; omap_plane->id = id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment