omapdrm: Allocate objects dynamically
Subsystems (3)
v2 cover omapdrm: Allocate objects dynamically
Hello,
Most of this series has previously been posted as part of "[PATCH 00/48]
omapdrm: Merge omapdrm and omapdss". With "[PATCH v2 00/15] omapdrm:
Miscellaneous fixes and cleanups" posted and merged a few days ago, it completes the rework of the omapdrm and omapdss drivers to replace most global variables with dynamically-allocated objects. The actual merge of the omapdrm and omapdss drivers has been left out for now as it still suffers from unresolved issues.
As with the previous series I have other pending patches based on top of this, as passing driver objects around explicitly helps not relying on more global variables that would hinder the effort to move to the DRM bridge and DRM panel APIs.
Patches 02/30, 14/30, 22/30 and 23/30 are new. Patch 21/30 has seen significant changes and I have thus dropped the Reviewed-by tag from Sebastian. All other patches have been rebased and reordered, thus sometimes modified to resolve conflicts, but have otherwise seen only minor changes.
The series is based on top of the omapdrm-next branch fromgit://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git.
Tomi, as the series has been stripped of its controversial patches, I think it's now ready to be merged (pending review of the patches mentioned above of course). I have tested it on both a Panda board and an AM57xx EVM without any issues (and this time I made sure to try with the drivers compiled as modules).
Laurent Pinchart (30):
drm: omapdrm: Split init and cleanup from probe and remove functions
drm: omapdrm: dss: Expose DSS data in a dss_device structure
drm: omapdrm: dss: Pass DSS private structure to runtime PM functions
drm: omapdrm: dss: Pass PLL pointer to dss_ctrl_pll_enable()
drm: omapdrm: dss: Pass DSS pointer to dss_sdi_*() functions
drm: omapdrm: dss: Pass DSS pointer to dss_ops operations
drm: omapdrm: dss: Pass DSS pointer to dss_get_*_clk_source()
drm: omapdrm: dss: Pass DSS pointer to dss clock functions
drm: omapdrm: dss: Pass DSS pointer to remaining dss functions
drm: omapdrm: dss: Allocate the DSS private data structure dynamically
drm: omapdrm: dss: Support passing private data to debugfs show
handlers
drm: omapdrm: dss: Store the registered plls array in struct
dss_device
drm: omapdrm: dss: Store the debugfs root directory in struct
dss_device
drm: omapdrm: dss: Don't unnecessarily cast to dev to pdev and back
drm: omapdrm: dsi: Pass the dsi_data pointer to internal functions
drm: omapdrm: dsi: Combine two commonly used inline functions
drm: omapdrm: dsi: Use dev pointer directly in dsi_bind() function
drm: omapdrm: dsi: Store the struct device pointer in struct dsi_data
drm: omapdrm: dsi: Don't pass channel to dispc init/uninit functions
drm: omapdrm: dss: Pass omap_dss_device pointer to dss_mgr_*()
functions
drm: omapdrm: dss: Pass omap_drm_private pointer to dss_mgr_ops
drm: omapdrm: dss: Store DSS device pointer in the omapdrm private
data
drm: omapdrm: dss: Store dispc ops in dss_device structure
drm: omapdrm: dispc: Pass DISPC pointer to dispc_ops operations
drm: omapdrm: dispc: Pass DISPC pointer to remaining dispc API
functions
drm: omapdrm: dispc: Allocate the dispc private data structure
dynamically
drm: omapdrm: hdmi4: Allocate the omap_hdmi data structure dynamically
drm: omapdrm: hdmi5: Allocate the omap_hdmi data structure dynamically
drm: omapdrm: sdi: Allocate the sdi private data structure dynamically
drm: omapdrm: venc: Allocate the venc private data structure
dynamically
drivers/gpu/drm/omapdrm/dss/base.c | 27 +- drivers/gpu/drm/omapdrm/dss/dispc.c | 2183 ++++++++++++++++-------------- drivers/gpu/drm/omapdrm/dss/dpi.c | 89 +- drivers/gpu/drm/omapdrm/dss/dsi.c | 1466 ++++++++++---------- drivers/gpu/drm/omapdrm/dss/dss.c | 668 ++++----- drivers/gpu/drm/omapdrm/dss/dss.h | 229 ++-- drivers/gpu/drm/omapdrm/dss/hdmi.h | 11 +- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 371 ++--- drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c | 4 +- drivers/gpu/drm/omapdrm/dss/hdmi4_core.h | 4 +- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 379 +++--- drivers/gpu/drm/omapdrm/dss/hdmi_pll.c | 15 +- drivers/gpu/drm/omapdrm/dss/omapdss.h | 171 ++- drivers/gpu/drm/omapdrm/dss/output.c | 52 +- drivers/gpu/drm/omapdrm/dss/pll.c | 40 +- drivers/gpu/drm/omapdrm/dss/sdi.c | 162 ++- drivers/gpu/drm/omapdrm/dss/venc.c | 453 ++++--- drivers/gpu/drm/omapdrm/dss/video-pll.c | 19 +- drivers/gpu/drm/omapdrm/omap_crtc.c | 62 +- drivers/gpu/drm/omapdrm/omap_crtc.h | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 102 +- drivers/gpu/drm/omapdrm/omap_drv.h | 4 + drivers/gpu/drm/omapdrm/omap_irq.c | 32 +- drivers/gpu/drm/omapdrm/omap_plane.c | 12 +- 24 files changed, 3484 insertions(+), 3073 deletions(-)
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/30 drm: omapdrm: Split init and cleanup from probe and remove functions
When merging the omapdrm and omapdss drivers there will be not omapdrm platform device anymore, and thus no associated probe and remove functions. To prepare for that, split all the initialization code from the probe function to make it usable without a platform device. Similarly, split the cleanup code from the remove function.
--- drivers/gpu/drm/omapdrm/omap_drv.c | 83 +++++++++++++++++++++++--------------- drivers/gpu/drm/omapdrm/omap_drv.h | 2 + 2 files changed, 53 insertions(+), 32 deletions(-)
drivers/gpu/drm/omapdrm/omap_drv.c +51 -32
@@ -510,24 +510,16 @@ static const struct soc_device_attribute omapdrm_soc_devices[] = { {/* sentinel */ } }; -static int pdev_probe (struct platform_device *pdev) +static int omapdrm_init (struct omap_drm_private *priv,struct device *dev) {const struct soc_device_attribute *soc; -struct omap_drm_private *priv;struct drm_device *ddev;unsigned int i;int ret; -DBG ("%s" , pdev->name); - -if (omapdss_is_initialized () == false) -return -EPROBE_DEFER ; +DBG ("%s" ,dev_name (dev)); - ret =dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 )); -if (ret) { -dev_err (&pdev->dev,"Failed to set the DMA mask\n" ); -return ret; - } + priv->dev = dev;omap_crtc_pre_init ();
@@ -535,13 +527,6 @@ static int pdev_probe(struct platform_device *pdev)if (ret) goto err_crtc_uninit; -/* Allocate and initialize the driver private structure. */ - priv =kzalloc (sizeof (*priv),GFP_KERNEL ); -if (!priv) { - ret = -ENOMEM ; - goto err_disconnect_dssdevs; - } - priv->dispc_ops =dispc_get_ops (); soc =soc_device_match (omapdrm_soc_devices);
@@ -552,14 +537,14 @@ static int pdev_probe(struct platform_device *pdev)INIT_LIST_HEAD (&priv->obj_list);/* Allocate and initialize the DRM device. */ - ddev =drm_dev_alloc (&omap_drm_driver, &pdev->dev); + ddev =drm_dev_alloc (&omap_drm_driver, priv->dev);if (IS_ERR (ddev)) { ret =PTR_ERR (ddev); - goto err_free_priv; + goto err_destroy_wq; } + priv->ddev = ddev; ddev->dev_private = priv; -platform_set_drvdata (pdev, ddev);/* Get memory bandwidth limits */ if (priv->dispc_ops->get_memory_bandwidth_limit)
@@ -570,14 +555,14 @@ static int pdev_probe(struct platform_device *pdev) ret =omap_modeset_init (ddev);if (ret) { -dev_err (&pdev->dev,"omap_modeset_init failed: ret=%d\n" , ret); +dev_err (priv->dev,"omap_modeset_init failed: ret=%d\n" , ret); goto err_free_drm_dev; }/* Initialize vblank handling, start with all CRTCs disabled. */ ret =drm_vblank_init (ddev, priv->num_crtcs);if (ret) { -dev_err (&pdev->dev,"could not init vblank\n" ); +dev_err (priv->dev,"could not init vblank\n" ); goto err_cleanup_modeset; }
@@ -610,20 +595,17 @@ static int pdev_probe(struct platform_device *pdev) err_free_drm_dev:omap_gem_deinit (ddev);drm_dev_unref (ddev); -err_free_priv: +err_destroy_wq:destroy_workqueue (priv->wq); -kfree (priv); -err_disconnect_dssdevs:omap_disconnect_dssdevs (); err_crtc_uninit:omap_crtc_pre_uninit ();return ret; } -static int pdev_remove (struct platform_device *pdev) +static void omapdrm_cleanup (struct omap_drm_private *priv) { -struct drm_device *ddev =platform_get_drvdata (pdev); -struct omap_drm_private *priv = ddev->dev_private; +struct drm_device *ddev = priv->ddev;DBG ("" );
@@ -645,10 +627,45 @@ static int pdev_remove(struct platform_device *pdev)drm_dev_unref (ddev);destroy_workqueue (priv->wq); -kfree (priv);omap_disconnect_dssdevs ();omap_crtc_pre_uninit (); +} + +static int pdev_probe (struct platform_device *pdev) +{ +struct omap_drm_private *priv; +int ret; + +if (omapdss_is_initialized () == false) +return -EPROBE_DEFER ; + + ret =dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 )); +if (ret) { +dev_err (&pdev->dev,"Failed to set the DMA mask\n" ); +return ret; + } + +/* Allocate and initialize the driver private structure. */ + priv =kzalloc (sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + +platform_set_drvdata (pdev, priv); + + ret =omapdrm_init (priv, &pdev->dev); +if (ret <0 ) +kfree (priv); + +return ret; +} + +static int pdev_remove (struct platform_device *pdev) +{ +struct omap_drm_private *priv =platform_get_drvdata (pdev); + +omapdrm_cleanup (priv); +kfree (priv);return 0 ; }
@@ -692,7 +709,8 @@ static int omap_drm_resume_all_displays(void)static int omap_drm_suspend (struct device *dev) { -struct drm_device *drm_dev =dev_get_drvdata (dev); +struct omap_drm_private *priv =dev_get_drvdata (dev); +struct drm_device *drm_dev = priv->ddev;drm_kms_helper_poll_disable (drm_dev);
@@ -705,7 +723,8 @@ static int omap_drm_suspend(struct device *dev)static int omap_drm_resume (struct device *dev) { -struct drm_device *drm_dev =dev_get_drvdata (dev); +struct omap_drm_private *priv =dev_get_drvdata (dev); +struct drm_device *drm_dev = priv->ddev;drm_modeset_lock_all (drm_dev);omap_drm_resume_all_displays ();
drivers/gpu/drm/omapdrm/omap_drv.h +2 -0
@@ -46,6 +46,8 @@struct omap_drm_usergart ;struct omap_drm_private { +struct drm_device *ddev; +struct device *dev;u32 omaprev;const struct dispc_ops *dispc_ops;
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 2/30 drm: omapdrm: dss: Expose DSS data in a dss_device structure
In reply to Laurent PinchartThe anoonymous dss structure in dss.c is the top-level component in the omapdss driver. As such it should store all internal instance-specific data that is currently stored in global variables. This however requires both naming the structure to pass it around functions, and accessing it from various locations in the omapdss driver. While we could implement get and set functions for every field that needs to be accessed outside of dss.c, that would introduce overhead and complexity that we could avoid by exposing the structure to internal components of the omapdss driver. Do so to prepare for removal of global variables.
--- drivers/gpu/drm/omapdrm/dss/dss.c | 29 +---------------------------- drivers/gpu/drm/omapdrm/dss/dss.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 28 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss.c +1 -28
@@ -48,8 +48,6 @@#include "omapdss.h" #include "dss.h" -#define DSS_SZ_REGS SZ_512 -struct dss_reg {u16 idx; };
@@ -90,32 +88,7 @@ struct dss_features {bool has_lcd_clk_src; }; -static struct { -struct platform_device *pdev; -void __iomem *base; -struct regmap *syscon_pll_ctrl; -u32 syscon_pll_ctrl_offset; - -struct clk *parent_clk; -struct clk *dss_clk; -unsigned long dss_clk_rate; - -unsigned long cache_req_pck; -unsigned long cache_prate; -struct dispc_clock_info cache_dispc_cinfo; - -enum dss_clk_source dsi_clk_source[MAX_NUM_DSI ]; -enum dss_clk_source dispc_clk_source; -enum dss_clk_source lcd_clk_source[MAX_DSS_LCD_MANAGERS ]; - -bool ctx_valid; -u32 ctx[DSS_SZ_REGS /sizeof (u32)]; - -const struct dss_features *feat; - -struct dss_pll *video1_pll; -struct dss_pll *video2_pll; -} dss; +static struct dss_device dss;static const char *const dss_generic_clk_source_names[] = { [DSS_CLK_SRC_FCK ] ="FCK" ,
drivers/gpu/drm/omapdrm/dss/dss.h +29 -0
@@ -235,6 +235,35 @@ struct dss_lcd_mgr_config {struct seq_file ;struct platform_device ; +#define DSS_SZ_REGS SZ_512 + +struct dss_device { +struct platform_device *pdev; +void __iomem *base; +struct regmap *syscon_pll_ctrl; +u32 syscon_pll_ctrl_offset; + +struct clk *parent_clk; +struct clk *dss_clk; +unsigned long dss_clk_rate; + +unsigned long cache_req_pck; +unsigned long cache_prate; +struct dispc_clock_info cache_dispc_cinfo; + +enum dss_clk_source dsi_clk_source[MAX_NUM_DSI ]; +enum dss_clk_source dispc_clk_source; +enum dss_clk_source lcd_clk_source[MAX_DSS_LCD_MANAGERS ]; + +bool ctx_valid; +u32 ctx[DSS_SZ_REGS /sizeof (u32)]; + +const struct dss_features *feat; + +struct dss_pll *video1_pll; +struct dss_pll *video2_pll; +}; +/* core */ static inline int dss_set_min_bus_tput (struct device *dev,unsigned long tput) {
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 02/30] drm: omapdrm: dss: Expose DSS data in a dss_device structure
Hi,
Quoted 10 lines · Laurent Pinchart
The anoonymous dss structure in
dss.cis the top-level component in the omapdss driver. As such it should store all internal instance-specific data that is currently stored in global variables. This however requires both naming the structure to pass it around functions, and accessing it from various locations in the omapdss driver. While we could implement get and set functions for every field that needs to be accessed outside ofdss.c, that would introduce overhead and complexity that we could avoid by exposing the structure to internal components of the omapdss driver. Do so to prepare for removal of global variables.
Quoted 2 lines
Signed-off-by Laurent Pinchart <[email protected]>---
-- Sebastian
Quoted 100 lines
drivers/gpu/drm/omapdrm/dss/dss.c | 29 +---------------------------- drivers/gpu/drm/omapdrm/dss/dss.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 28 deletions(-)drivers/gpu/drm/omapdrm/dss/dss.c +1
-28@@ -48,8 +48,6 @@#include "omapdss.h" #include "dss.h" -#define DSS_SZ_REGS SZ_512 -struct dss_reg {u16 idx; };@@ -90,32 +88,7 @@ struct dss_features {bool has_lcd_clk_src; }; -static struct { -struct platform_device *pdev; -void __iomem *base; -struct regmap *syscon_pll_ctrl; -u32 syscon_pll_ctrl_offset; - -struct clk *parent_clk; -struct clk *dss_clk; -unsigned long dss_clk_rate; - -unsigned long cache_req_pck; -unsigned long cache_prate; -struct dispc_clock_info cache_dispc_cinfo; - -enum dss_clk_source dsi_clk_source[MAX_NUM_DSI ]; -enum dss_clk_source dispc_clk_source; -enum dss_clk_source lcd_clk_source[MAX_DSS_LCD_MANAGERS ]; - -bool ctx_valid; -u32 ctx[DSS_SZ_REGS /sizeof (u32)]; - -const struct dss_features *feat; - -struct dss_pll *video1_pll; -struct dss_pll *video2_pll; -} dss; +static struct dss_device dss;static const char *const dss_generic_clk_source_names[] = { [DSS_CLK_SRC_FCK ] ="FCK" ,drivers/gpu/drm/omapdrm/dss/dss.h +29
-0@@ -235,6 +235,35 @@ struct dss_lcd_mgr_config {struct seq_file ;struct platform_device ; +#define DSS_SZ_REGS SZ_512 + +struct dss_device { +struct platform_device *pdev; +void __iomem *base; +struct regmap *syscon_pll_ctrl; +u32 syscon_pll_ctrl_offset; + +struct clk *parent_clk; +struct clk *dss_clk; +unsigned long dss_clk_rate; + +unsigned long cache_req_pck; +unsigned long cache_prate; +struct dispc_clock_info cache_dispc_cinfo; + +enum dss_clk_source dsi_clk_source[MAX_NUM_DSI ]; +enum dss_clk_source dispc_clk_source; +enum dss_clk_source lcd_clk_source[MAX_DSS_LCD_MANAGERS ]; + +bool ctx_valid; +u32 ctx[DSS_SZ_REGS /sizeof (u32)]; + +const struct dss_features *feat; + +struct dss_pll *video1_pll; +struct dss_pll *video2_pll; +}; +/* core */ static inline int dss_set_min_bus_tput (struct device *dev,unsigned long tput) {Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 3/30 drm: omapdrm: dss: Pass DSS private structure to runtime PM functions
In reply to Laurent PinchartTo prepare for the removal of the global variable storing DSS private data, pass its pointer to the dss_runtime_{get,put}() functions.
As this requires getting hold of the dss_device structure in the callers, we add a new dss_get_device() function to retrieve it. The function currently returns a pointer to the global data structure, and will later be updated to get the pointer from device driver data when the DSS private structure will be allocated dynamically.
--- drivers/gpu/drm/omapdrm/dss/dsi.c | 7 +++-- drivers/gpu/drm/omapdrm/dss/dss.c | 47 +++++++++++++++++++-------------- drivers/gpu/drm/omapdrm/dss/dss.h | 12 ++++++--- drivers/gpu/drm/omapdrm/dss/hdmi.h | 6 +++-- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 3 ++- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 3 ++- drivers/gpu/drm/omapdrm/dss/hdmi_pll.c | 10 ++++--- drivers/gpu/drm/omapdrm/dss/video-pll.c | 12 +++++---- 8 files changed, 61 insertions(+), 39 deletions(-)
drivers/gpu/drm/omapdrm/dss/dsi.c +5 -2
@@ -5322,7 +5322,8 @@ static const struct dss_pll_hw dss_omap5_dsi_pll_hw = { .has_refsel = true, }; -static int dsi_init_pll_data (struct platform_device *dsidev) +static int dsi_init_pll_data (struct dss_device *dss, +struct platform_device *dsidev) {struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);struct dss_pll *pll = &dsi->pll;
@@ -5341,6 +5342,7 @@ static int dsi_init_pll_data(struct platform_device *dsidev) pll->base = dsi->pll_base; pll->hw = dsi->data->pll_hw; pll->ops = &dsi_pll_ops; + pll->dss = dss; r =dss_pll_register (pll);if (r)
@@ -5417,6 +5419,7 @@ static const struct soc_device_attribute dsi_soc_devices[] = {static int dsi_bind (struct device *dev,struct device *master,void *data) {struct platform_device *dsidev =to_platform_device (dev); +struct dss_device *dss =dss_get_device (master);const struct soc_device_attribute *soc;const struct dsi_module_id_data *d;u32 rev;
@@ -5525,7 +5528,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)if (r)return r; -dsi_init_pll_data (dsidev); +dsi_init_pll_data (dss, dsidev);pm_runtime_enable (&dsidev->dev);
drivers/gpu/drm/omapdrm/dss/dss.c +27 -20
134 lines not on this page · raw message
drivers/gpu/drm/omapdrm/dss/dss.h +8 -4
@@ -191,6 +191,7 @@ struct dss_pll_hw {struct dss_pll {const char *name;enum dss_pll_id id; +struct dss_device *dss;struct clk *clkin;struct regulator *regulator;
@@ -291,8 +292,10 @@ static inline int dss_debugfs_create_file(const char *name, }#endif /* CONFIG_OMAP2_DSS_DEBUGFS */ -int dss_runtime_get (void ); -void dss_runtime_put (void ); +struct dss_device *dss_get_device (struct device *dev); + +int dss_runtime_get (struct dss_device *dss); +void dss_runtime_put (struct dss_device *dss);unsigned long dss_get_dispc_clk_rate (void );unsigned long dss_get_max_fck_rate (void );
@@ -302,8 +305,9 @@ void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select);const char *dss_get_clk_source_name (enum dss_clk_source clk_src);/* DSS VIDEO PLL */ -struct dss_pll *dss_video_pll_init (struct platform_device *pdev,int id, -struct regulator *regulator); +struct dss_pll *dss_video_pll_init (struct dss_device *dss, +struct platform_device *pdev,int id, +struct regulator *regulator);void dss_video_pll_uninit (struct dss_pll *pll);void dss_ctrl_pll_enable (enum dss_pll_id pll_id,bool enable);
drivers/gpu/drm/omapdrm/dss/hdmi.h +4 -2
@@ -29,6 +29,8 @@#include "omapdss.h" #include "dss.h" +struct dss_device ; +/* HDMI Wrapper */ #define HDMI_WP_REVISION 0x0
@@ -324,8 +326,8 @@ phys_addr_t hdmi_wp_get_audio_dma_addr(struct hdmi_wp_data *wp);/* HDMI PLL funcs */ void hdmi_pll_dump (struct hdmi_pll_data *pll,struct seq_file *s); -int hdmi_pll_init (struct platform_device *pdev,struct hdmi_pll_data *pll, -struct hdmi_wp_data *wp); +int hdmi_pll_init (struct dss_device *dss,struct platform_device *pdev, +struct hdmi_pll_data *pll,struct hdmi_wp_data *wp);void hdmi_pll_uninit (struct hdmi_pll_data *hpll);/* HDMI PHY funcs */
drivers/gpu/drm/omapdrm/dss/hdmi4.c +2 -1
@@ -717,6 +717,7 @@ static int hdmi_audio_register(struct device *dev)static int hdmi4_bind (struct device *dev,struct device *master,void *data) {struct platform_device *pdev =to_platform_device (dev); +struct dss_device *dss =dss_get_device (master);int r;int irq;
@@ -734,7 +735,7 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)if (r)return r; - r =hdmi_pll_init (pdev, &hdmi.pll, &hdmi.wp); + r =hdmi_pll_init (dss, pdev, &hdmi.pll, &hdmi.wp);if (r)return r;
drivers/gpu/drm/omapdrm/dss/hdmi5.c +2 -1
@@ -718,6 +718,7 @@ static int hdmi_audio_register(struct device *dev)static int hdmi5_bind (struct device *dev,struct device *master,void *data) {struct platform_device *pdev =to_platform_device (dev); +struct dss_device *dss =dss_get_device (master);int r;int irq;
@@ -735,7 +736,7 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data)if (r)return r; - r =hdmi_pll_init (pdev, &hdmi.pll, &hdmi.wp); + r =hdmi_pll_init (dss, pdev, &hdmi.pll, &hdmi.wp);if (r)return r;
drivers/gpu/drm/omapdrm/dss/hdmi_pll.c +6 -4
@@ -128,7 +128,8 @@ static const struct dss_pll_hw dss_omap5_hdmi_pll_hw = { .has_refsel = true, }; -static int hdmi_init_pll_data (struct platform_device *pdev, +static int hdmi_init_pll_data (struct dss_device *dss, +struct platform_device *pdev,struct hdmi_pll_data *hpll) {struct dss_pll *pll = &hpll->pll;
@@ -145,6 +146,7 @@ static int hdmi_init_pll_data(struct platform_device *pdev, pll->id =DSS_PLL_HDMI ; pll->base = hpll->base; pll->clkin = clk; + pll->dss = dss;if (hpll->wp->version ==4 ) pll->hw = &dss_omap4_hdmi_pll_hw;
@@ -160,8 +162,8 @@ static int hdmi_init_pll_data(struct platform_device *pdev,return 0 ; } -int hdmi_pll_init (struct platform_device *pdev,struct hdmi_pll_data *pll, -struct hdmi_wp_data *wp) +int hdmi_pll_init (struct dss_device *dss,struct platform_device *pdev, +struct hdmi_pll_data *pll,struct hdmi_wp_data *wp) {int r;struct resource *res;
@@ -174,7 +176,7 @@ int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,if (IS_ERR (pll->base))return PTR_ERR (pll->base); - r =hdmi_init_pll_data (pdev, pll); + r =hdmi_init_pll_data (dss, pdev, pll);if (r) {DSSERR ("failed to init HDMI PLL\n" );return r;
drivers/gpu/drm/omapdrm/dss/video-pll.c +7 -5
@@ -64,7 +64,7 @@ static int dss_video_pll_enable(struct dss_pll *pll) struct dss_video_pll *vpll = container_of(pll, struct dss_video_pll, pll);int r; - r =dss_runtime_get (); + r =dss_runtime_get (pll->dss);if (r)return r;
@@ -83,7 +83,7 @@ static int dss_video_pll_enable(struct dss_pll *pll) err_reset:dss_dpll_disable_scp_clk (vpll);dss_ctrl_pll_enable (pll->id, false); -dss_runtime_put (); +dss_runtime_put (pll->dss);return r; }
@@ -98,7 +98,7 @@ static void dss_video_pll_disable(struct dss_pll *pll)dss_ctrl_pll_enable (pll->id, false); -dss_runtime_put (); +dss_runtime_put (pll->dss); }static const struct dss_pll_ops dss_pll_ops = {
@@ -136,8 +136,9 @@ static const struct dss_pll_hw dss_dra7_video_pll_hw = { .errata_i886 = true, }; -struct dss_pll *dss_video_pll_init (struct platform_device *pdev,int id, -struct regulator *regulator) +struct dss_pll *dss_video_pll_init (struct dss_device *dss, +struct platform_device *pdev,int id, +struct regulator *regulator) {const char *const reg_name[] = {"pll1" ,"pll2" };const char *const clkctrl_name[] = {"pll1_clkctrl" ,"pll2_clkctrl" };
@@ -189,6 +190,7 @@ struct dss_pll *dss_video_pll_init(struct platform_device *pdev, int id, pll->base = pll_base; pll->hw = &dss_dra7_video_pll_hw; pll->ops = &dss_pll_ops; + pll->dss = dss; r =dss_pll_register (pll);if (r)
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 4/30 drm: omapdrm: dss: Pass PLL pointer to dss_ctrl_pll_enable()
In reply to Laurent PinchartThis will allow accessing the PLL data to get the DSS device pointer, removing the need to access the global DSS private data.
--- drivers/gpu/drm/omapdrm/dss/dss.c | 13 +++++++------ drivers/gpu/drm/omapdrm/dss/dss.h | 2 +- drivers/gpu/drm/omapdrm/dss/hdmi_pll.c | 4 ++-- drivers/gpu/drm/omapdrm/dss/video-pll.c | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss.c +7 -6
@@ -152,17 +152,17 @@ static void dss_restore_context(void)#undef SR#undef RR -void dss_ctrl_pll_enable (enum dss_pll_id pll_id,bool enable) +void dss_ctrl_pll_enable (struct dss_pll *pll,bool enable) {unsigned int shift;unsigned int val; -if (!dss.syscon_pll_ctrl) +if (!pll->dss->syscon_pll_ctrl)return ; val = !enable; -switch (pll_id) { +switch (pll->id) {case DSS_PLL_VIDEO1 : shift =0 ;break ;
@@ -173,12 +173,13 @@ void dss_ctrl_pll_enable(enum dss_pll_id pll_id, bool enable) shift =2 ;break ;default : -DSSERR ("illegal DSS PLL ID %d\n" , pll_id); +DSSERR ("illegal DSS PLL ID %d\n" , pll->id);return ; } -regmap_update_bits (dss.syscon_pll_ctrl, dss.syscon_pll_ctrl_offset, -1 << shift, val << shift); +regmap_update_bits (pll->dss->syscon_pll_ctrl, + pll->dss->syscon_pll_ctrl_offset, +1 << shift, val << shift); } static int dss_ctrl_pll_set_control_mux(enum dss_clk_source clk_src,
drivers/gpu/drm/omapdrm/dss/dss.h +1 -1
@@ -310,7 +310,7 @@ struct dss_pll *dss_video_pll_init(struct dss_device *dss, struct regulator *regulator);void dss_video_pll_uninit (struct dss_pll *pll); -void dss_ctrl_pll_enable (enum dss_pll_id pll_id,bool enable); +void dss_ctrl_pll_enable (struct dss_pll *pll,bool enable);void dss_sdi_init (int datapairs);int dss_sdi_enable (void );
drivers/gpu/drm/omapdrm/dss/hdmi_pll.c +2 -2
@@ -48,7 +48,7 @@ static int hdmi_pll_enable(struct dss_pll *dsspll) r =pm_runtime_get_sync (&pll->pdev->dev);WARN_ON (r <0 ); -dss_ctrl_pll_enable (DSS_PLL_HDMI , true); +dss_ctrl_pll_enable (dsspll, true); r =hdmi_wp_set_pll_pwr (wp,HDMI_PLLPWRCMD_BOTHON_ALLCLKS );if (r)
@@ -65,7 +65,7 @@ static void hdmi_pll_disable(struct dss_pll *dsspll)hdmi_wp_set_pll_pwr (wp,HDMI_PLLPWRCMD_ALLOFF ); -dss_ctrl_pll_enable (DSS_PLL_HDMI , false); +dss_ctrl_pll_enable (dsspll, false); r =pm_runtime_put_sync (&pll->pdev->dev);WARN_ON (r <0 && r != -ENOSYS );
drivers/gpu/drm/omapdrm/dss/video-pll.c +3 -3
@@ -68,7 +68,7 @@ static int dss_video_pll_enable(struct dss_pll *pll)if (r)return r; -dss_ctrl_pll_enable (pll->id, true); +dss_ctrl_pll_enable (pll, true);dss_dpll_enable_scp_clk (vpll);
@@ -82,7 +82,7 @@ static int dss_video_pll_enable(struct dss_pll *pll) err_reset:dss_dpll_disable_scp_clk (vpll); -dss_ctrl_pll_enable (pll->id, false); +dss_ctrl_pll_enable (pll, false);dss_runtime_put (pll->dss);return r;
@@ -96,7 +96,7 @@ static void dss_video_pll_disable(struct dss_pll *pll)dss_dpll_disable_scp_clk (vpll); -dss_ctrl_pll_enable (pll->id, false); +dss_ctrl_pll_enable (pll, false);dss_runtime_put (pll->dss); }
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 5/30 drm: omapdrm: dss: Pass DSS pointer to dss_sdi_*() functions
In reply to Laurent PinchartThis removes the need to access the global DSS private data in those functions (both for the current accesses and the future ones that will be introduced when allocating the DSS device dynamically).
--- drivers/gpu/drm/omapdrm/dss/dss.c | 8 ++++---- drivers/gpu/drm/omapdrm/dss/dss.h | 14 ++++++++------ drivers/gpu/drm/omapdrm/dss/sdi.c | 13 ++++++++----- 3 files changed, 20 insertions(+), 15 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss.c +4 -4
@@ -248,7 +248,7 @@ static int dss_ctrl_pll_set_control_mux(enum dss_clk_source clk_src,return 0 ; } -void dss_sdi_init (int datapairs) +void dss_sdi_init (struct dss_device *dss,int datapairs) {u32 l;
@@ -267,7 +267,7 @@ void dss_sdi_init(int datapairs)dss_write_reg (DSS_PLL_CONTROL , l); } -int dss_sdi_enable (void ) +int dss_sdi_enable (struct dss_device *dss) {unsigned long timeout;
@@ -325,7 +325,7 @@ int dss_sdi_enable(void)return -ETIMEDOUT ; } -void dss_sdi_disable (void ) +void dss_sdi_disable (struct dss_device *dss) {dispc_lcd_enable_signal (0 );
@@ -1150,7 +1150,7 @@ static int dss_init_ports(struct platform_device *pdev)dpi_init_port (pdev, port, dss.feat->model);break ;case OMAP_DISPLAY_TYPE_SDI : -sdi_init_port (pdev, port); +sdi_init_port (&dss, pdev, port);break ;default :break ;
drivers/gpu/drm/omapdrm/dss/dss.h +8 -6
@@ -312,9 +312,9 @@ void dss_video_pll_uninit(struct dss_pll *pll);void dss_ctrl_pll_enable (struct dss_pll *pll,bool enable); -void dss_sdi_init (int datapairs); -int dss_sdi_enable (void ); -void dss_sdi_disable (void ); +void dss_sdi_init (struct dss_device *dss,int datapairs); +int dss_sdi_enable (struct dss_device *dss); +void dss_sdi_disable (struct dss_device *dss);void dss_select_dsi_clk_source (int dsi_module,enum dss_clk_source clk_src);
@@ -335,11 +335,13 @@ bool dss_div_calc(unsigned long pck, unsigned long fck_min,/* SDI */ #ifdef CONFIG_OMAP2_DSS_SDI -int sdi_init_port (struct platform_device *pdev,struct device_node *port); +int sdi_init_port (struct dss_device *dss,struct platform_device *pdev, +struct device_node *port);void sdi_uninit_port (struct device_node *port);#else -static inline int sdi_init_port (struct platform_device *pdev, -struct device_node *port) +static inline int sdi_init_port (struct dss_device *dss, +struct platform_device *pdev, +struct device_node *port) {return 0 ; }
drivers/gpu/drm/omapdrm/dss/sdi.c +8 -5
@@ -31,6 +31,7 @@ static struct { struct platform_device *pdev; + struct dss_device *dss; bool update_enabled; struct regulator *vdds_sdi_reg;
@@ -187,8 +188,8 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)*/ dispc_mgr_set_clock_div (channel, &sdi.mgr_config.clock_info); -dss_sdi_init (sdi.datapairs); - r =dss_sdi_enable (); +dss_sdi_init (sdi.dss, sdi.datapairs); + r =dss_sdi_enable (sdi.dss);if (r) goto err_sdi_enable;mdelay (2 );
@@ -200,7 +201,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)return 0 ; err_mgr_enable: -dss_sdi_disable (); +dss_sdi_disable (sdi.dss); err_sdi_enable: err_set_dss_clock_div: err_calc_clock_div:
@@ -217,7 +218,7 @@ static void sdi_display_disable(struct omap_dss_device *dssdev)dss_mgr_disable (channel); -dss_sdi_disable (); +dss_sdi_disable (sdi.dss);dispc_runtime_put ();
@@ -345,7 +346,8 @@ static void sdi_uninit_output(struct platform_device *pdev)omapdss_unregister_output (out); } -int sdi_init_port (struct platform_device *pdev,struct device_node *port) +int sdi_init_port (struct dss_device *dss,struct platform_device *pdev, +struct device_node *port) {struct device_node *ep;u32 datapairs;
@@ -362,6 +364,7 @@ int sdi_init_port(struct platform_device *pdev, struct device_node *port) } sdi.datapairs = datapairs; + sdi.dss = dss;of_node_put (ep);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 6/30 drm: omapdrm: dss: Pass DSS pointer to dss_ops operations
In reply to Laurent PinchartThis removes the need to access the global DSS private data in those functions (both for the current accesses and the future ones that will be introduced when allocating the DSS device dynamically).
--- drivers/gpu/drm/omapdrm/dss/dpi.c | 12 ++++--- drivers/gpu/drm/omapdrm/dss/dsi.c | 18 +++++----- drivers/gpu/drm/omapdrm/dss/dss.c | 68 ++++++++++++++++++++++--------------- drivers/gpu/drm/omapdrm/dss/dss.h | 25 ++++++++------ drivers/gpu/drm/omapdrm/dss/hdmi.h | 1 + drivers/gpu/drm/omapdrm/dss/hdmi4.c | 3 +- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 3 +- 7 files changed, 77 insertions(+), 53 deletions(-)
drivers/gpu/drm/omapdrm/dss/dpi.c +7 -5
@@ -38,6 +38,7 @@struct dpi_data {struct platform_device *pdev;enum dss_model dss_model; +struct dss_device *dss;struct regulator *vdds_dsi_reg;enum dss_clk_source clk_src;
@@ -302,7 +303,7 @@ static int dpi_set_pll_clk(struct dpi_data *dpi, enum omap_channel channel,if (r)return r; -dss_select_lcd_clk_source (channel, dpi->clk_src); +dss_select_lcd_clk_source (dpi->dss, channel, dpi->clk_src); dpi->mgr_config.clock_info = ctx.dispc_cinfo;
@@ -412,7 +413,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)if (r) goto err_get_dispc; - r =dss_dpi_select_source (out->port_num, channel); + r =dss_dpi_select_source (dpi->dss, out->port_num, channel);if (r) goto err_src_sel;
@@ -464,7 +465,7 @@ static void dpi_display_disable(struct omap_dss_device *dssdev)dss_mgr_disable (channel);if (dpi->pll) { -dss_select_lcd_clk_source (channel,DSS_CLK_SRC_FCK ); +dss_select_lcd_clk_source (dpi->dss, channel,DSS_CLK_SRC_FCK );dss_pll_disable (dpi->pll); }
@@ -748,8 +749,8 @@ static void dpi_uninit_output_port(struct device_node *port)omapdss_unregister_output (out); } -int dpi_init_port (struct platform_device *pdev,struct device_node *port, -enum dss_model dss_model) +int dpi_init_port (struct dss_device *dss,struct platform_device *pdev, +struct device_node *port,enum dss_model dss_model) {struct dpi_data *dpi;struct device_node *ep;
@@ -776,6 +777,7 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port, dpi->pdev = pdev; dpi->dss_model = dss_model; + dpi->dss = dss; port->data = dpi;mutex_init (&dpi->lock);
drivers/gpu/drm/omapdrm/dss/dsi.c +10 -8
@@ -343,6 +343,7 @@ struct dsi_data {struct clk *dss_clk;struct regmap *syscon; +struct dss_device *dss;struct dispc_clock_info user_dispc_cinfo;struct dss_pll_clock_info user_dsi_cinfo;
@@ -4206,7 +4207,7 @@ static int dsi_display_init_dispc(struct platform_device *dsidev,struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int r; -dss_select_lcd_clk_source (channel, dsi->module_id ==0 ? +dss_select_lcd_clk_source (dsi->dss, channel, dsi->module_id ==0 ?DSS_CLK_SRC_PLL1_1 :DSS_CLK_SRC_PLL2_1 );
@@ -4260,7 +4261,7 @@ static int dsi_display_init_dispc(struct platform_device *dsidev,dss_mgr_unregister_framedone_handler (channel, dsi_framedone_irq_callback, dsidev); err: -dss_select_lcd_clk_source (channel,DSS_CLK_SRC_FCK ); +dss_select_lcd_clk_source (dsi->dss, channel,DSS_CLK_SRC_FCK );return r; }
@@ -4273,7 +4274,7 @@ static void dsi_display_uninit_dispc(struct platform_device *dsidev,dss_mgr_unregister_framedone_handler (channel, dsi_framedone_irq_callback, dsidev); -dss_select_lcd_clk_source (channel,DSS_CLK_SRC_FCK ); +dss_select_lcd_clk_source (dsi->dss, channel,DSS_CLK_SRC_FCK ); }static int dsi_configure_dsi_clocks (struct platform_device *dsidev)
@@ -4306,9 +4307,9 @@ static int dsi_display_init_dsi(struct platform_device *dsidev)if (r) goto err1; -dss_select_dsi_clk_source (dsi->module_id, dsi->module_id ==0 ? -DSS_CLK_SRC_PLL1_2 : -DSS_CLK_SRC_PLL2_2 ); +dss_select_dsi_clk_source (dsi->dss, dsi->module_id, + dsi->module_id ==0 ? +DSS_CLK_SRC_PLL1_2 :DSS_CLK_SRC_PLL2_2 );DSSDBG ("PLL OK\n" );
@@ -4340,7 +4341,7 @@ static int dsi_display_init_dsi(struct platform_device *dsidev) err3:dsi_cio_uninit (dsidev); err2: -dss_select_dsi_clk_source (dsi->module_id,DSS_CLK_SRC_FCK ); +dss_select_dsi_clk_source (dsi->dss, dsi->module_id,DSS_CLK_SRC_FCK ); err1:dss_pll_disable (&dsi->pll); err0:
@@ -4362,7 +4363,7 @@ static void dsi_display_uninit_dsi(struct platform_device *dsidev,dsi_vc_enable (dsidev,2 ,0 );dsi_vc_enable (dsidev,3 ,0 ); -dss_select_dsi_clk_source (dsi->module_id,DSS_CLK_SRC_FCK ); +dss_select_dsi_clk_source (dsi->dss, dsi->module_id,DSS_CLK_SRC_FCK );dsi_cio_uninit (dsidev);dsi_pll_uninit (dsidev, disconnect_lanes); }
@@ -5432,6 +5433,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)if (!dsi)return -ENOMEM ; + dsi->dss = dss; dsi->pdev = dsidev;dev_set_drvdata (&dsidev->dev, dsi);
drivers/gpu/drm/omapdrm/dss/dss.c +40 -28
166 lines not on this page · raw message
drivers/gpu/drm/omapdrm/dss/dss.h +15 -10
@@ -300,8 +300,10 @@ void dss_runtime_put(struct dss_device *dss);unsigned long dss_get_dispc_clk_rate (void );unsigned long dss_get_max_fck_rate (void );enum omap_dss_output_id dss_get_supported_outputs (enum omap_channel channel); -int dss_dpi_select_source (int port,enum omap_channel channel); -void dss_select_hdmi_venc_clk_source (enum dss_hdmi_venc_clk_source_select ); +int dss_dpi_select_source (struct dss_device *dss,int port, +enum omap_channel channel); +void dss_select_hdmi_venc_clk_source (struct dss_device *dss, +enum dss_hdmi_venc_clk_source_select src);const char *dss_get_clk_source_name (enum dss_clk_source clk_src);/* DSS VIDEO PLL */
@@ -316,10 +318,11 @@ void dss_sdi_init(struct dss_device *dss, int datapairs);int dss_sdi_enable (struct dss_device *dss);void dss_sdi_disable (struct dss_device *dss); -void dss_select_dsi_clk_source (int dsi_module, -enum dss_clk_source clk_src); -void dss_select_lcd_clk_source (enum omap_channel channel, -enum dss_clk_source clk_src); +void dss_select_dsi_clk_source (struct dss_device *dss,int dsi_module, +enum dss_clk_source clk_src); +void dss_select_lcd_clk_source (struct dss_device *dss, +enum omap_channel channel, +enum dss_clk_source clk_src);enum dss_clk_source dss_get_dispc_clk_source (void );enum dss_clk_source dss_get_dsi_clk_source (int dsi_module);enum dss_clk_source dss_get_lcd_clk_source (enum omap_channel channel);
@@ -365,12 +368,14 @@ void dsi_irq_handler(void);/* DPI */ #ifdef CONFIG_OMAP2_DSS_DPI -int dpi_init_port (struct platform_device *pdev,struct device_node *port, -enum dss_model dss_model); +int dpi_init_port (struct dss_device *dss,struct platform_device *pdev, +struct device_node *port,enum dss_model dss_model);void dpi_uninit_port (struct device_node *port);#else -static inline int dpi_init_port (struct platform_device *pdev, -struct device_node *port,enum dss_model dss_model) +static inline int dpi_init_port (struct dss_device *port, +struct platform_device *pdev, +struct device_node *port, +enum dss_model dss_model) {return 0 ; }
drivers/gpu/drm/omapdrm/dss/hdmi.h +1 -0
@@ -359,6 +359,7 @@ static inline bool hdmi_mode_has_audio(struct hdmi_config *cfg)struct omap_hdmi {struct mutex lock;struct platform_device *pdev; +struct dss_device *dss;struct hdmi_wp_data wp;struct hdmi_pll_data pll;
drivers/gpu/drm/omapdrm/dss/hdmi4.c +2 -1
@@ -148,7 +148,7 @@ static int hdmi_power_on_core(struct omap_dss_device *dssdev)hdmi4_core_powerdown_disable (&hdmi.core);/* Make selection of HDMI in DSS */ -dss_select_hdmi_venc_clk_source (DSS_HDMI_M_PCLK ); +dss_select_hdmi_venc_clk_source (hdmi.dss,DSS_HDMI_M_PCLK ); hdmi.core_enabled = true;
@@ -722,6 +722,7 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)int irq; hdmi.pdev = pdev; + hdmi.dss = dss;dev_set_drvdata (&pdev->dev, &hdmi);mutex_init (&hdmi.lock);
drivers/gpu/drm/omapdrm/dss/hdmi5.c +2 -1
@@ -149,7 +149,7 @@ static int hdmi_power_on_core(struct omap_dss_device *dssdev) goto err_runtime_get;/* Make selection of HDMI in DSS */ -dss_select_hdmi_venc_clk_source (DSS_HDMI_M_PCLK ); +dss_select_hdmi_venc_clk_source (hdmi.dss,DSS_HDMI_M_PCLK ); hdmi.core_enabled = true;
@@ -723,6 +723,7 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data)int irq; hdmi.pdev = pdev; + hdmi.dss = dss;dev_set_drvdata (&pdev->dev, &hdmi);mutex_init (&hdmi.lock);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 7/30 drm: omapdrm: dss: Pass DSS pointer to dss_get_*_clk_source()
In reply to Laurent PinchartThis removes the need to access the global DSS private data in those functions (both for the current accesses and the future ones that will be introduced when allocating the DSS device dynamically).
--- drivers/gpu/drm/omapdrm/dss/dispc.c | 11 +++++++---- drivers/gpu/drm/omapdrm/dss/dsi.c | 8 +++++--- drivers/gpu/drm/omapdrm/dss/dss.c | 18 ++++++++++-------- drivers/gpu/drm/omapdrm/dss/dss.h | 8 +++++--- 4 files changed, 27 insertions(+), 18 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +7 -4
@@ -165,6 +165,7 @@ struct dispc_features { static struct { struct platform_device *pdev; void __iomem *base; + struct dss_device *dss; int irq; irq_handler_t user_handler;
@@ -3112,7 +3113,7 @@ static unsigned long dispc_fclk_rate(void)unsigned long r;enum dss_clk_source src; - src =dss_get_dispc_clk_source (); + src =dss_get_dispc_clk_source (dispc.dss);if (src ==DSS_CLK_SRC_FCK ) { r =dss_get_dispc_clk_rate ();
@@ -3139,7 +3140,7 @@ static unsigned long dispc_mgr_lclk_rate(enum omap_channel channel)if (!dss_mgr_is_lcd (channel))return dispc_fclk_rate (); - src =dss_get_lcd_clk_source (channel); + src =dss_get_lcd_clk_source (dispc.dss, channel);if (src ==DSS_CLK_SRC_FCK ) { r =dss_get_dispc_clk_rate ();
@@ -3219,7 +3220,7 @@ static void dispc_dump_clocks_channel(struct seq_file *s, enum omap_channel chanseq_printf (s,"- %s -\n" , mgr_desc[channel].name); - lcd_clk_src =dss_get_lcd_clk_source (channel); + lcd_clk_src =dss_get_lcd_clk_source (dispc.dss, channel);seq_printf (s,"%s clk source = %s\n" , mgr_desc[channel].name,dss_get_clk_source_name (lcd_clk_src));
@@ -3236,7 +3237,7 @@ void dispc_dump_clocks(struct seq_file *s) {int lcd;u32 l; -enum dss_clk_source dispc_clk_src =dss_get_dispc_clk_source (); +enum dss_clk_source dispc_clk_src =dss_get_dispc_clk_source (dispc.dss);if (dispc_runtime_get ())return ;
@@ -4549,12 +4550,14 @@ static int dispc_bind(struct device *dev, struct device *master, void *data) {struct platform_device *pdev =to_platform_device (dev);const struct soc_device_attribute *soc; +struct dss_device *dss =dss_get_device (master);u32 rev;int r =0 ;struct resource *dispc_mem;struct device_node *np = pdev->dev.of_node; dispc.pdev = pdev; + dispc.dss = dss;spin_lock_init (&dispc.control_lock);
drivers/gpu/drm/omapdrm/dss/dsi.c +5 -3
@@ -1286,8 +1286,10 @@ static unsigned long dsi_fclk_rate(struct platform_device *dsidev) {unsigned long r;struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +enum dss_clk_source source; -if (dss_get_dsi_clk_source (dsi->module_id) ==DSS_CLK_SRC_FCK ) { + source =dss_get_dsi_clk_source (dsi->dss, dsi->module_id); +if (source ==DSS_CLK_SRC_FCK ) {/* DSI FCLK source is DSS_CLK_FCK */ r =clk_get_rate (dsi->dss_clk); }else {
@@ -1506,8 +1508,8 @@ static void dsi_dump_dsidev_clocks(struct platform_device *dsidev,int dsi_module = dsi->module_id;struct dss_pll *pll = &dsi->pll; - dispc_clk_src =dss_get_dispc_clk_source (); - dsi_clk_src =dss_get_dsi_clk_source (dsi_module); + dispc_clk_src =dss_get_dispc_clk_source (dsi->dss); + dsi_clk_src =dss_get_dsi_clk_source (dsi->dss, dsi_module);if (dsi_runtime_get (dsidev))return ;
drivers/gpu/drm/omapdrm/dss/dss.c +10 -8
@@ -570,25 +570,27 @@ void dss_select_lcd_clk_source(struct dss_device *dss, dss->lcd_clk_source[idx] = clk_src; } -enum dss_clk_source dss_get_dispc_clk_source (void ) +enum dss_clk_source dss_get_dispc_clk_source (struct dss_device *dss) { -return dss.dispc_clk_source; +return dss->dispc_clk_source; } -enum dss_clk_source dss_get_dsi_clk_source (int dsi_module) +enum dss_clk_source dss_get_dsi_clk_source (struct dss_device *dss, +int dsi_module) { -return dss.dsi_clk_source[dsi_module]; +return dss->dsi_clk_source[dsi_module]; } -enum dss_clk_source dss_get_lcd_clk_source (enum omap_channel channel) +enum dss_clk_source dss_get_lcd_clk_source (struct dss_device *dss, +enum omap_channel channel) { -if (dss.feat->has_lcd_clk_src) { +if (dss->feat->has_lcd_clk_src) {int idx =dss_get_channel_index (channel); -return dss.lcd_clk_source[idx]; +return dss->lcd_clk_source[idx]; }else {/* LCD_CLK source is the same as DISPC_FCLK source for * OMAP2 and OMAP3 */ -return dss.dispc_clk_source; +return dss->dispc_clk_source; } }
drivers/gpu/drm/omapdrm/dss/dss.h +5 -3
@@ -323,9 +323,11 @@ void dss_select_dsi_clk_source(struct dss_device *dss, int dsi_module,void dss_select_lcd_clk_source (struct dss_device *dss,enum omap_channel channel,enum dss_clk_source clk_src); -enum dss_clk_source dss_get_dispc_clk_source (void ); -enum dss_clk_source dss_get_dsi_clk_source (int dsi_module); -enum dss_clk_source dss_get_lcd_clk_source (enum omap_channel channel); +enum dss_clk_source dss_get_dispc_clk_source (struct dss_device *dss); +enum dss_clk_source dss_get_dsi_clk_source (struct dss_device *dss, +int dsi_module); +enum dss_clk_source dss_get_lcd_clk_source (struct dss_device *dss, +enum omap_channel channel);void dss_set_venc_output (enum omap_dss_venc_type type);void dss_set_dac_pwrdn_bgz (bool enable);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 8/30 drm: omapdrm: dss: Pass DSS pointer to dss clock functions
In reply to Laurent PinchartThis removes the need to access the global DSS private data in those functions (both for the current accesses and the future ones that will be introduced when allocating the DSS device dynamically).
--- drivers/gpu/drm/omapdrm/dss/dispc.c | 8 ++++---- drivers/gpu/drm/omapdrm/dss/dpi.c | 14 ++++++++------ drivers/gpu/drm/omapdrm/dss/dss.c | 37 ++++++++++++++++++------------------- drivers/gpu/drm/omapdrm/dss/dss.h | 10 +++++----- drivers/gpu/drm/omapdrm/dss/sdi.c | 5 +++-- 5 files changed, 38 insertions(+), 36 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +4 -4
@@ -3116,7 +3116,7 @@ static unsigned long dispc_fclk_rate(void) src =dss_get_dispc_clk_source (dispc.dss);if (src ==DSS_CLK_SRC_FCK ) { - r =dss_get_dispc_clk_rate (); + r =dss_get_dispc_clk_rate (dispc.dss); }else {struct dss_pll *pll;unsigned int clkout_idx;
@@ -3143,7 +3143,7 @@ static unsigned long dispc_mgr_lclk_rate(enum omap_channel channel) src =dss_get_lcd_clk_source (dispc.dss, channel);if (src ==DSS_CLK_SRC_FCK ) { - r =dss_get_dispc_clk_rate (); + r =dss_get_dispc_clk_rate (dispc.dss); }else {struct dss_pll *pll;unsigned int clkout_idx;
@@ -3499,7 +3499,7 @@ bool dispc_div_calc(unsigned long dispc_freq, pckd_hw_min = dispc.feat->min_pcd; pckd_hw_max =255 ; - lck_max =dss_get_max_fck_rate (); + lck_max =dss_get_max_fck_rate (dispc.dss); pck_min = pck_min ? pck_min :1 ; pck_max = pck_max ? pck_max :ULONG_MAX ;
@@ -4460,7 +4460,7 @@ static void dispc_errata_i734_wa(void)/* Set up and enable display manager for LCD1 */ dispc_mgr_setup (OMAP_DSS_CHANNEL_LCD , &i734.mgri); -dispc_calc_clock_rates (dss_get_dispc_clk_rate (), +dispc_calc_clock_rates (dss_get_dispc_clk_rate (dispc.dss), &lcd_conf.clock_info);dispc_mgr_set_lcd_config (OMAP_DSS_CHANNEL_LCD , &lcd_conf);dispc_mgr_set_timings (OMAP_DSS_CHANNEL_LCD , &i734.vm);
drivers/gpu/drm/omapdrm/dss/dpi.c +8 -6
@@ -207,7 +207,7 @@ static bool dpi_calc_pll_cb(int n, int m, unsigned long fint, ctx->pll_cinfo.clkdco = clkdco;return dss_pll_hsdiv_calc_a (ctx->pll, clkdco, - ctx->pck_min,dss_get_max_fck_rate (), + ctx->pck_min,dss_get_max_fck_rate (ctx->pll->dss), dpi_calc_hsdiv_cb, ctx); }
@@ -256,7 +256,8 @@ static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck, } } -static bool dpi_dss_clk_calc (unsigned long pck,struct dpi_clk_calc_ctx *ctx) +static bool dpi_dss_clk_calc (struct dpi_data *dpi,unsigned long pck, +struct dpi_clk_calc_ctx *ctx) {int i;
@@ -277,7 +278,8 @@ static bool dpi_dss_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx) ctx->pck_min =0 ; ctx->pck_max = pck +1000 * i * i * i; - ok =dss_div_calc (pck, ctx->pck_min, dpi_calc_dss_cb, ctx); + ok =dss_div_calc (dpi->dss, pck, ctx->pck_min, + dpi_calc_dss_cb, ctx);if (ok)return ok; }
@@ -321,11 +323,11 @@ static int dpi_set_dispc_clk(struct dpi_data *dpi, unsigned long pck_req,int r;bool ok; - ok =dpi_dss_clk_calc (pck_req, &ctx); + ok =dpi_dss_clk_calc (dpi, pck_req, &ctx);if (!ok)return -EINVAL ; - r =dss_set_fck_rate (ctx.fck); + r =dss_set_fck_rate (dpi->dss, ctx.fck);if (r)return r;
@@ -530,7 +532,7 @@ static int dpi_check_timings(struct omap_dss_device *dssdev, fck = ctx.pll_cinfo.clkout[ctx.clkout_idx]; }else { - ok =dpi_dss_clk_calc (vm->pixelclock, &ctx); + ok =dpi_dss_clk_calc (dpi, vm->pixelclock, &ctx);if (!ok)return -EINVAL ;
drivers/gpu/drm/omapdrm/dss/dss.c +18 -19
@@ -594,8 +594,8 @@ enum dss_clk_source dss_get_lcd_clk_source(struct dss_device *dss, } } -bool dss_div_calc (unsigned long pck,unsigned long fck_min, -dss_div_calc_func func,void *data) +bool dss_div_calc (struct dss_device *dss,unsigned long pck, +unsigned long fck_min,dss_div_calc_func func,void *data) {int fckd, fckd_start, fckd_stop;unsigned long fck;
@@ -604,24 +604,24 @@ bool dss_div_calc(unsigned long pck, unsigned long fck_min,unsigned long prate;unsigned int m; - fck_hw_max = dss.feat->fck_freq_max; + fck_hw_max = dss->feat->fck_freq_max; -if (dss.parent_clk ==NULL ) { +if (dss->parent_clk ==NULL ) {unsigned int pckd; pckd = fck_hw_max / pck; fck = pck * pckd; - fck =clk_round_rate (dss.dss_clk, fck); + fck =clk_round_rate (dss->dss_clk, fck);return func (fck, data); } - fckd_hw_max = dss.feat->fck_div_max; + fckd_hw_max = dss->feat->fck_div_max; - m = dss.feat->dss_fck_multiplier; - prate =clk_get_rate (dss.parent_clk); + m = dss->feat->dss_fck_multiplier; + prate =clk_get_rate (dss->parent_clk); fck_min = fck_min ? fck_min :1 ;
@@ -638,33 +638,32 @@ bool dss_div_calc(unsigned long pck, unsigned long fck_min,return false; } -int dss_set_fck_rate (unsigned long rate) +int dss_set_fck_rate (struct dss_device *dss,unsigned long rate) {int r;DSSDBG ("set fck to %lu\n" , rate); - r =clk_set_rate (dss.dss_clk, rate); + r =clk_set_rate (dss->dss_clk, rate);if (r)return r; - dss.dss_clk_rate =clk_get_rate (dss.dss_clk); + dss->dss_clk_rate =clk_get_rate (dss->dss_clk); -WARN_ONCE (dss.dss_clk_rate != rate, -"clk rate mismatch: %lu != %lu" , dss.dss_clk_rate, - rate); +WARN_ONCE (dss->dss_clk_rate != rate,"clk rate mismatch: %lu != %lu" , + dss->dss_clk_rate, rate);return 0 ; } -unsigned long dss_get_dispc_clk_rate (void ) +unsigned long dss_get_dispc_clk_rate (struct dss_device *dss) { -return dss.dss_clk_rate; +return dss->dss_clk_rate; } -unsigned long dss_get_max_fck_rate (void ) +unsigned long dss_get_max_fck_rate (struct dss_device *dss) { -return dss.feat->fck_freq_max; +return dss->feat->fck_freq_max; }enum omap_dss_output_id dss_get_supported_outputs (enum omap_channel channel)
@@ -691,7 +690,7 @@ static int dss_setup_default_clock(void) fck =DIV_ROUND_UP (prate, fck_div) * dss.feat->dss_fck_multiplier; } - r =dss_set_fck_rate (fck); + r =dss_set_fck_rate (&dss, fck);if (r)return r;
drivers/gpu/drm/omapdrm/dss/dss.h +5 -5
@@ -297,8 +297,8 @@ struct dss_device *dss_get_device(struct device *dev);int dss_runtime_get (struct dss_device *dss);void dss_runtime_put (struct dss_device *dss); -unsigned long dss_get_dispc_clk_rate (void ); -unsigned long dss_get_max_fck_rate (void ); +unsigned long dss_get_dispc_clk_rate (struct dss_device *dss); +unsigned long dss_get_max_fck_rate (struct dss_device *dss);enum omap_dss_output_id dss_get_supported_outputs (enum omap_channel channel);int dss_dpi_select_source (struct dss_device *dss,int port,enum omap_channel channel);
@@ -332,11 +332,11 @@ enum dss_clk_source dss_get_lcd_clk_source(struct dss_device *dss,void dss_set_venc_output (enum omap_dss_venc_type type);void dss_set_dac_pwrdn_bgz (bool enable); -int dss_set_fck_rate (unsigned long rate); +int dss_set_fck_rate (struct dss_device *dss,unsigned long rate);typedef bool (*dss_div_calc_func )(unsigned long fck,void *data); -bool dss_div_calc (unsigned long pck,unsigned long fck_min, -dss_div_calc_func func,void *data); +bool dss_div_calc (struct dss_device *dss,unsigned long pck, +unsigned long fck_min,dss_div_calc_func func,void *data);/* SDI */ #ifdef CONFIG_OMAP2_DSS_SDI
drivers/gpu/drm/omapdrm/dss/sdi.c +3 -2
@@ -99,7 +99,8 @@ static int sdi_calc_clock_div(unsigned long pclk, ctx.pck_min =0 ; ctx.pck_max = pclk +1000 * i * i * i; - ok =dss_div_calc (pclk, ctx.pck_min, dpi_calc_dss_cb, &ctx); + ok =dss_div_calc (sdi.dss, pclk, ctx.pck_min, + dpi_calc_dss_cb, &ctx);if (ok) { *fck = ctx.fck; *dispc_cinfo = ctx.dispc_cinfo;
@@ -169,7 +170,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)dss_mgr_set_timings (channel, vm); - r =dss_set_fck_rate (fck); + r =dss_set_fck_rate (sdi.dss, fck);if (r) goto err_set_dss_clock_div;
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 9/30 drm: omapdrm: dss: Pass DSS pointer to remaining dss functions
In reply to Laurent PinchartThis removes the need to access the global DSS private data in those functions (both for the current accesses and the future ones that will be introduced when allocating the DSS device dynamically).
--- drivers/gpu/drm/omapdrm/dss/dispc.c | 2 +- drivers/gpu/drm/omapdrm/dss/dss.c | 9 +++++---- drivers/gpu/drm/omapdrm/dss/dss.h | 7 ++++--- drivers/gpu/drm/omapdrm/dss/venc.c | 11 +++++++---- 4 files changed, 17 insertions(+), 12 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +1 -1
@@ -2733,7 +2733,7 @@ static int dispc_ovl_enable(enum omap_plane_id plane, bool enable)static enum omap_dss_output_id dispc_mgr_get_supported_outputs (enum omap_channel channel) { -return dss_get_supported_outputs (channel); +return dss_get_supported_outputs (dispc.dss, channel); }static void dispc_lcd_enable_signal_polarity (bool act_high)
drivers/gpu/drm/omapdrm/dss/dss.c +5 -4
@@ -666,9 +666,10 @@ unsigned long dss_get_max_fck_rate(struct dss_device *dss)return dss->feat->fck_freq_max; } -enum omap_dss_output_id dss_get_supported_outputs (enum omap_channel channel) +enum omap_dss_output_id dss_get_supported_outputs (struct dss_device *dss, +enum omap_channel channel) { -return dss.feat->outputs[channel]; +return dss->feat->outputs[channel]; }static int dss_setup_default_clock (void )
@@ -697,7 +698,7 @@ static int dss_setup_default_clock(void)return 0 ; } -void dss_set_venc_output (enum omap_dss_venc_type type) +void dss_set_venc_output (struct dss_device *dss,enum omap_dss_venc_type type) {int l =0 ;
@@ -712,7 +713,7 @@ void dss_set_venc_output(enum omap_dss_venc_type type)REG_FLD_MOD (DSS_CONTROL , l,6 ,6 ); } -void dss_set_dac_pwrdn_bgz (bool enable) +void dss_set_dac_pwrdn_bgz (struct dss_device *dss,bool enable) {REG_FLD_MOD (DSS_CONTROL , enable,5 ,5 );/* DAC Power-Down Control */ }
drivers/gpu/drm/omapdrm/dss/dss.h +4 -3
@@ -299,7 +299,8 @@ void dss_runtime_put(struct dss_device *dss);unsigned long dss_get_dispc_clk_rate (struct dss_device *dss);unsigned long dss_get_max_fck_rate (struct dss_device *dss); -enum omap_dss_output_id dss_get_supported_outputs (enum omap_channel channel); +enum omap_dss_output_id dss_get_supported_outputs (struct dss_device *dss, +enum omap_channel channel);int dss_dpi_select_source (struct dss_device *dss,int port,enum omap_channel channel); void dss_select_hdmi_venc_clk_source(struct dss_device *dss,
@@ -329,8 +330,8 @@ enum dss_clk_source dss_get_dsi_clk_source(struct dss_device *dss,enum dss_clk_source dss_get_lcd_clk_source (struct dss_device *dss,enum omap_channel channel); -void dss_set_venc_output (enum omap_dss_venc_type type); -void dss_set_dac_pwrdn_bgz (bool enable); +void dss_set_venc_output (struct dss_device *dss,enum omap_dss_venc_type type); +void dss_set_dac_pwrdn_bgz (struct dss_device *dss,bool enable);int dss_set_fck_rate (struct dss_device *dss,unsigned long rate);
drivers/gpu/drm/omapdrm/dss/venc.c +7 -4
@@ -325,6 +325,7 @@ static struct {struct mutex venc_lock;u32 wss_data;struct regulator *vdda_dac_reg; +struct dss_device *dss;struct clk *tv_dac_clk;
@@ -468,8 +469,8 @@ static int venc_power_on(struct omap_dss_device *dssdev)venc_reset ();venc_write_config (venc_timings_to_config (&venc.vm)); -dss_set_venc_output (venc.type); -dss_set_dac_pwrdn_bgz (1 ); +dss_set_venc_output (venc.dss, venc.type); +dss_set_dac_pwrdn_bgz (venc.dss,1 ); l =0 ;
@@ -499,7 +500,7 @@ static int venc_power_on(struct omap_dss_device *dssdev)regulator_disable (venc.vdda_dac_reg); err1:venc_write_reg (VENC_OUTPUT_CONTROL ,0 ); -dss_set_dac_pwrdn_bgz (0 ); +dss_set_dac_pwrdn_bgz (venc.dss,0 );venc_runtime_put (); err0:
@@ -511,7 +512,7 @@ static void venc_power_off(struct omap_dss_device *dssdev)enum omap_channel channel = dssdev->dispc_channel;venc_write_reg (VENC_OUTPUT_CONTROL ,0 ); -dss_set_dac_pwrdn_bgz (0 ); +dss_set_dac_pwrdn_bgz (venc.dss,0 );dss_mgr_disable (channel);
@@ -871,11 +872,13 @@ static const struct soc_device_attribute venc_soc_devices[] = {static int venc_bind (struct device *dev,struct device *master,void *data) {struct platform_device *pdev =to_platform_device (dev); +struct dss_device *dss =dss_get_device (master);u8 rev_id;struct resource *venc_mem;int r; venc.pdev = pdev; + venc.dss = dss;/* The OMAP34xx, OMAP35xx and AM35xx VENC require the TV DAC clock. */ if (soc_device_match (venc_soc_devices))
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 10/30 drm: omapdrm: dss: Allocate the DSS private data structure dynamically
In reply to Laurent PinchartThe DSS private data structure is currently stored as a global variable. While no platform with multiple DSS devices currently exists nor is planned, this doesn't comply with the kernel device model and should thus be fixed.
Allocate the DSS private data structure dynamically for each DSS instance and remove the global variable. All code that need access to the structure now retrieves it dynamically so we can remove the global variable.
---
Changes since v1:
- Wrap lines at 80 columns limit
--- drivers/gpu/drm/omapdrm/dss/dss.c | 341 +++++++++++++++++++++----------------- 1 file changed, 186 insertions(+), 155 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss.c +186 -155
@@ -62,11 +62,12 @@ struct dss_reg {#define DSS_PLL_CONTROL DSS_REG(0x0048)#define DSS_SDI_STATUS DSS_REG(0x005C) -#define REG_GET (idx, start, end) \ - FLD_GET(dss_read_reg(idx), start, end) +#define REG_GET (dss, idx, start, end) \ + FLD_GET(dss_read_reg(dss, idx), start, end) -#define REG_FLD_MOD (idx, val, start, end) \ - dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end)) +#define REG_FLD_MOD (dss, idx, val, start, end) \ + dss_write_reg(dss, idx, \ + FLD_MOD(dss_read_reg(dss, idx), val, start, end))struct dss_ops { int (*dpi_select_source)(struct dss_device *dss, int port,
@@ -90,8 +91,6 @@ struct dss_features {bool has_lcd_clk_src; }; -static struct dss_device dss; -static const char *const dss_generic_clk_source_names[] = { [DSS_CLK_SRC_FCK ] ="FCK" , [DSS_CLK_SRC_PLL1_1 ] ="PLL1:1" ,
@@ -103,49 +102,50 @@ static const char * const dss_generic_clk_source_names[] = { [DSS_CLK_SRC_HDMI_PLL] = "HDMI PLL", }; -static inline void dss_write_reg (const struct dss_reg idx,u32 val) +static inline void dss_write_reg (struct dss_device *dss, +const struct dss_reg idx,u32 val) { -__raw_writel (val, dss.base + idx.idx); +__raw_writel (val, dss->base + idx.idx); } -static inline u32 dss_read_reg (const struct dss_reg idx) +static inline u32 dss_read_reg (struct dss_device *dss,const struct dss_reg idx) { -return __raw_readl (dss.base + idx.idx); +return __raw_readl (dss->base + idx.idx); } -#define SR (reg) \ - dss.ctx[(DSS_##reg).idx / sizeof(u32)] = dss_read_reg(DSS_##reg) -#define RR (reg) \ - dss_write_reg(DSS_##reg, dss.ctx[(DSS_##reg).idx / sizeof(u32)]) +#define SR (dss, reg) \ + dss->ctx[(DSS_##reg).idx / sizeof(u32)] = dss_read_reg(dss, DSS_##reg) +#define RR (dss, reg) \ + dss_write_reg(dss, DSS_##reg, dss->ctx[(DSS_##reg).idx / sizeof(u32)]) -static void dss_save_context (void ) +static void dss_save_context (struct dss_device *dss) {DSSDBG ("dss_save_context\n" ); -SR (CONTROL ); +SR (dss,CONTROL ); -if (dss.feat->outputs[OMAP_DSS_CHANNEL_LCD ] &OMAP_DSS_OUTPUT_SDI ) { -SR (SDI_CONTROL ); -SR (PLL_CONTROL ); +if (dss->feat->outputs[OMAP_DSS_CHANNEL_LCD ] &OMAP_DSS_OUTPUT_SDI ) { +SR (dss,SDI_CONTROL ); +SR (dss,PLL_CONTROL ); } - dss.ctx_valid = true; + dss->ctx_valid = true;DSSDBG ("context saved\n" ); } -static void dss_restore_context (void ) +static void dss_restore_context (struct dss_device *dss) {DSSDBG ("dss_restore_context\n" ); -if (!dss.ctx_valid) +if (!dss->ctx_valid)return ; -RR (CONTROL ); +RR (dss,CONTROL ); -if (dss.feat->outputs[OMAP_DSS_CHANNEL_LCD ] &OMAP_DSS_OUTPUT_SDI ) { -RR (SDI_CONTROL ); -RR (PLL_CONTROL ); +if (dss->feat->outputs[OMAP_DSS_CHANNEL_LCD ] &OMAP_DSS_OUTPUT_SDI ) { +RR (dss,SDI_CONTROL ); +RR (dss,PLL_CONTROL ); }DSSDBG ("context restored\n" );
@@ -184,12 +184,13 @@ void dss_ctrl_pll_enable(struct dss_pll *pll, bool enable) 1 << shift, val << shift); } -static int dss_ctrl_pll_set_control_mux (enum dss_clk_source clk_src, -enum omap_channel channel) +static int dss_ctrl_pll_set_control_mux (struct dss_device *dss, +enum dss_clk_source clk_src, +enum omap_channel channel) {unsigned int shift, val; -if (!dss.syscon_pll_ctrl) +if (!dss->syscon_pll_ctrl)return -EINVAL ;switch (channel) {
@@ -244,7 +245,7 @@ static int dss_ctrl_pll_set_control_mux(enum dss_clk_source clk_src,return -EINVAL ; } -regmap_update_bits (dss.syscon_pll_ctrl, dss.syscon_pll_ctrl_offset, +regmap_update_bits (dss->syscon_pll_ctrl, dss->syscon_pll_ctrl_offset,0x3 << shift, val << shift);return 0 ;
@@ -256,17 +257,17 @@ void dss_sdi_init(struct dss_device *dss, int datapairs)BUG_ON (datapairs >3 || datapairs <1 ); - l =dss_read_reg (DSS_SDI_CONTROL ); + l =dss_read_reg (dss,DSS_SDI_CONTROL ); l =FLD_MOD (l,0xf ,19 ,15 );/* SDI_PDIV */ l =FLD_MOD (l, datapairs-1 ,3 ,2 );/* SDI_PRSEL */ l =FLD_MOD (l,2 ,1 ,0 );/* SDI_BWSEL */ -dss_write_reg (DSS_SDI_CONTROL , l); +dss_write_reg (dss,DSS_SDI_CONTROL , l); - l =dss_read_reg (DSS_PLL_CONTROL ); + l =dss_read_reg (dss,DSS_PLL_CONTROL ); l =FLD_MOD (l,0x7 ,25 ,22 );/* SDI_PLL_FREQSEL */ l =FLD_MOD (l,0xb ,16 ,11 );/* SDI_PLL_REGN */ l =FLD_MOD (l,0xb4 ,10 ,1 );/* SDI_PLL_REGM */ -dss_write_reg (DSS_PLL_CONTROL , l); +dss_write_reg (dss,DSS_PLL_CONTROL , l); }int dss_sdi_enable (struct dss_device *dss)
@@ -276,15 +277,15 @@ int dss_sdi_enable(struct dss_device *dss)dispc_pck_free_enable (1 );/* Reset SDI PLL */ -REG_FLD_MOD (DSS_PLL_CONTROL ,1 ,18 ,18 );/* SDI_PLL_SYSRESET */ +REG_FLD_MOD (dss,DSS_PLL_CONTROL ,1 ,18 ,18 );/* SDI_PLL_SYSRESET */ udelay (1 );/* wait 2x PCLK */ /* Lock SDI PLL */ -REG_FLD_MOD (DSS_PLL_CONTROL ,1 ,28 ,28 );/* SDI_PLL_GOBIT */ +REG_FLD_MOD (dss,DSS_PLL_CONTROL ,1 ,28 ,28 );/* SDI_PLL_GOBIT */ /* Waiting for PLL lock request to complete */ timeout = jiffies +msecs_to_jiffies (500 ); -while (dss_read_reg (DSS_SDI_STATUS ) & (1 <<6 )) { +while (dss_read_reg (dss,DSS_SDI_STATUS ) & (1 <<6 )) {if (time_after_eq (jiffies, timeout)) {DSSERR ("PLL lock request timed out\n" ); goto err1;
@@ -292,11 +293,11 @@ int dss_sdi_enable(struct dss_device *dss) }/* Clearing PLL_GO bit */ -REG_FLD_MOD (DSS_PLL_CONTROL ,0 ,28 ,28 ); +REG_FLD_MOD (dss,DSS_PLL_CONTROL ,0 ,28 ,28 );/* Waiting for PLL to lock */ timeout = jiffies +msecs_to_jiffies (500 ); -while (!(dss_read_reg (DSS_SDI_STATUS ) & (1 <<5 ))) { +while (!(dss_read_reg (dss,DSS_SDI_STATUS ) & (1 <<5 ))) {if (time_after_eq (jiffies, timeout)) {DSSERR ("PLL lock timed out\n" ); goto err1;
@@ -307,7 +308,7 @@ int dss_sdi_enable(struct dss_device *dss)/* Waiting for SDI reset to complete */ timeout = jiffies +msecs_to_jiffies (500 ); -while (!(dss_read_reg (DSS_SDI_STATUS ) & (1 <<2 ))) { +while (!(dss_read_reg (dss,DSS_SDI_STATUS ) & (1 <<2 ))) {if (time_after_eq (jiffies, timeout)) {DSSERR ("SDI reset timed out\n" ); goto err2;
@@ -320,7 +321,7 @@ int dss_sdi_enable(struct dss_device *dss)dispc_lcd_enable_signal (0 ); err1:/* Reset SDI PLL */ -REG_FLD_MOD (DSS_PLL_CONTROL ,0 ,18 ,18 );/* SDI_PLL_SYSRESET */ +REG_FLD_MOD (dss,DSS_PLL_CONTROL ,0 ,18 ,18 );/* SDI_PLL_SYSRESET */ dispc_pck_free_enable (0 );
@@ -334,7 +335,7 @@ void dss_sdi_disable(struct dss_device *dss)dispc_pck_free_enable (0 );/* Reset SDI PLL */ -REG_FLD_MOD (DSS_PLL_CONTROL ,0 ,18 ,18 );/* SDI_PLL_SYSRESET */ +REG_FLD_MOD (dss,DSS_PLL_CONTROL ,0 ,18 ,18 );/* SDI_PLL_SYSRESET */ }const char *dss_get_clk_source_name (enum dss_clk_source clk_src)
@@ -343,46 +344,48 @@ const char *dss_get_clk_source_name(enum dss_clk_source clk_src) }#if defined(CONFIG_OMAP2_DSS_DEBUGFS ) -static void dss_dump_clocks (struct seq_file *s) +static void dss_dump_clocks (struct dss_device *dss,struct seq_file *s) {const char *fclk_name;unsigned long fclk_rate; -if (dss_runtime_get (&dss)) +if (dss_runtime_get (dss))return ;seq_printf (s,"- DSS -\n" ); fclk_name =dss_get_clk_source_name (DSS_CLK_SRC_FCK ); - fclk_rate =clk_get_rate (dss.dss_clk); + fclk_rate =clk_get_rate (dss->dss_clk);seq_printf (s,"%s = %lu\n" , fclk_name, fclk_rate); -dss_runtime_put (&dss); +dss_runtime_put (dss); }#endif static void dss_dump_regs (struct seq_file *s) { -#define DUMPREG (r) seq_printf(s, "%-35s %08x\n", #r, dss_read_reg(r)) +struct dss_device *dss = s->private; + +#define DUMPREG (dss, r) seq_printf(s, "%-35s %08x\n", #r, dss_read_reg(dss, r)) -if (dss_runtime_get (&dss)) +if (dss_runtime_get (dss))return ; -DUMPREG (DSS_REVISION ); -DUMPREG (DSS_SYSCONFIG ); -DUMPREG (DSS_SYSSTATUS ); -DUMPREG (DSS_CONTROL ); +DUMPREG (dss,DSS_REVISION ); +DUMPREG (dss,DSS_SYSCONFIG ); +DUMPREG (dss,DSS_SYSSTATUS ); +DUMPREG (dss,DSS_CONTROL ); -if (dss.feat->outputs[OMAP_DSS_CHANNEL_LCD ] &OMAP_DSS_OUTPUT_SDI ) { -DUMPREG (DSS_SDI_CONTROL ); -DUMPREG (DSS_PLL_CONTROL ); -DUMPREG (DSS_SDI_STATUS ); +if (dss->feat->outputs[OMAP_DSS_CHANNEL_LCD ] &OMAP_DSS_OUTPUT_SDI ) { +DUMPREG (dss,DSS_SDI_CONTROL ); +DUMPREG (dss,DSS_PLL_CONTROL ); +DUMPREG (dss,DSS_SDI_STATUS ); } -dss_runtime_put (&dss); +dss_runtime_put (dss);#undef DUMPREG }
@@ -401,7 +404,8 @@ static int dss_get_channel_index(enum omap_channel channel) } } -static void dss_select_dispc_clk_source (enum dss_clk_source clk_src) +static void dss_select_dispc_clk_source (struct dss_device *dss, +enum dss_clk_source clk_src) {int b;
@@ -409,7 +413,7 @@ static void dss_select_dispc_clk_source(enum dss_clk_source clk_src)* We always use PRCM clock as the DISPC func clock, except on DSS3, * where we don't have separate DISPC and LCD clock sources. */ -if (WARN_ON (dss.feat->has_lcd_clk_src && clk_src !=DSS_CLK_SRC_FCK )) +if (WARN_ON (dss->feat->has_lcd_clk_src && clk_src !=DSS_CLK_SRC_FCK ))return ;switch (clk_src) {
@@ -427,11 +431,11 @@ static void dss_select_dispc_clk_source(enum dss_clk_source clk_src)return ; } -REG_FLD_MOD (DSS_CONTROL , b,/* DISPC_CLK_SWITCH */ - dss.feat->dispc_clk_switch.start, - dss.feat->dispc_clk_switch.end); +REG_FLD_MOD (dss,DSS_CONTROL , b,/* DISPC_CLK_SWITCH */ + dss->feat->dispc_clk_switch.start, + dss->feat->dispc_clk_switch.end); - dss.dispc_clk_source = clk_src; + dss->dispc_clk_source = clk_src; } void dss_select_dsi_clk_source(struct dss_device *dss, int dsi_module,
@@ -457,7 +461,7 @@ void dss_select_dsi_clk_source(struct dss_device *dss, int dsi_module, } pos = dsi_module ==0 ?1 :10 ; -REG_FLD_MOD (DSS_CONTROL , b, pos, pos);/* DSIx_CLK_SWITCH */ +REG_FLD_MOD (dss,DSS_CONTROL , b, pos, pos);/* DSIx_CLK_SWITCH */ dss->dsi_clk_source[dsi_module] = clk_src; }
@@ -477,15 +481,15 @@ static int dss_lcd_clk_mux_dra7(struct dss_device *dss,if (clk_src ==DSS_CLK_SRC_FCK ) {/* LCDx_CLK_SWITCH */ -REG_FLD_MOD (DSS_CONTROL ,0 , ctrl_bit, ctrl_bit); +REG_FLD_MOD (dss,DSS_CONTROL ,0 , ctrl_bit, ctrl_bit);return -EINVAL ; } - r =dss_ctrl_pll_set_control_mux (clk_src, channel); + r =dss_ctrl_pll_set_control_mux (dss, clk_src, channel);if (r)return r; -REG_FLD_MOD (DSS_CONTROL ,1 , ctrl_bit, ctrl_bit); +REG_FLD_MOD (dss,DSS_CONTROL ,1 , ctrl_bit, ctrl_bit);return 0 ; }
@@ -509,14 +513,14 @@ static int dss_lcd_clk_mux_omap5(struct dss_device *dss,if (clk_src ==DSS_CLK_SRC_FCK ) {/* LCDx_CLK_SWITCH */ -REG_FLD_MOD (DSS_CONTROL ,0 , ctrl_bit, ctrl_bit); +REG_FLD_MOD (dss,DSS_CONTROL ,0 , ctrl_bit, ctrl_bit);return -EINVAL ; }if (WARN_ON (allowed_plls[channel] != clk_src))return -EINVAL ; -REG_FLD_MOD (DSS_CONTROL ,1 , ctrl_bit, ctrl_bit); +REG_FLD_MOD (dss,DSS_CONTROL ,1 , ctrl_bit, ctrl_bit);return 0 ; }
@@ -538,14 +542,14 @@ static int dss_lcd_clk_mux_omap4(struct dss_device *dss,if (clk_src ==DSS_CLK_SRC_FCK ) {/* LCDx_CLK_SWITCH */ -REG_FLD_MOD (DSS_CONTROL ,0 , ctrl_bit, ctrl_bit); +REG_FLD_MOD (dss,DSS_CONTROL ,0 , ctrl_bit, ctrl_bit);return 0 ; }if (WARN_ON (allowed_plls[channel] != clk_src))return -EINVAL ; -REG_FLD_MOD (DSS_CONTROL ,1 , ctrl_bit, ctrl_bit); +REG_FLD_MOD (dss,DSS_CONTROL ,1 , ctrl_bit, ctrl_bit);return 0 ; }
@@ -558,7 +562,7 @@ void dss_select_lcd_clk_source(struct dss_device *dss,int r;if (!dss->feat->has_lcd_clk_src) { -dss_select_dispc_clk_source (clk_src); +dss_select_dispc_clk_source (dss, clk_src); dss->lcd_clk_source[idx] = clk_src;return ; }
@@ -672,26 +676,27 @@ enum omap_dss_output_id dss_get_supported_outputs(struct dss_device *dss,return dss->feat->outputs[channel]; } -static int dss_setup_default_clock (void ) +static int dss_setup_default_clock (struct dss_device *dss) {unsigned long max_dss_fck, prate;unsigned long fck;unsigned int fck_div;int r; - max_dss_fck = dss.feat->fck_freq_max; + max_dss_fck = dss->feat->fck_freq_max; -if (dss.parent_clk ==NULL ) { - fck =clk_round_rate (dss.dss_clk, max_dss_fck); +if (dss->parent_clk ==NULL ) { + fck =clk_round_rate (dss->dss_clk, max_dss_fck); }else { - prate =clk_get_rate (dss.parent_clk); + prate =clk_get_rate (dss->parent_clk); - fck_div =DIV_ROUND_UP (prate * dss.feat->dss_fck_multiplier, + fck_div =DIV_ROUND_UP (prate * dss->feat->dss_fck_multiplier, max_dss_fck); - fck =DIV_ROUND_UP (prate, fck_div) * dss.feat->dss_fck_multiplier; + fck =DIV_ROUND_UP (prate, fck_div) + * dss->feat->dss_fck_multiplier; } - r =dss_set_fck_rate (&dss, fck); + r =dss_set_fck_rate (dss, fck);if (r)return r;
@@ -710,12 +715,13 @@ void dss_set_venc_output(struct dss_device *dss, enum omap_dss_venc_type type)BUG ();/* venc out selection. 0 = comp, 1 = svideo */ -REG_FLD_MOD (DSS_CONTROL , l,6 ,6 ); +REG_FLD_MOD (dss,DSS_CONTROL , l,6 ,6 ); }void dss_set_dac_pwrdn_bgz (struct dss_device *dss,bool enable) { -REG_FLD_MOD (DSS_CONTROL , enable,5 ,5 );/* DAC Power-Down Control */ +/* DAC Power-Down Control */ +REG_FLD_MOD (dss,DSS_CONTROL , enable,5 ,5 ); } void dss_select_hdmi_venc_clk_source(struct dss_device *dss,
@@ -732,7 +738,8 @@ void dss_select_hdmi_venc_clk_source(struct dss_device *dss,/* Select only if we have options */ if ((outputs &OMAP_DSS_OUTPUT_VENC ) && (outputs &OMAP_DSS_OUTPUT_HDMI )) -REG_FLD_MOD (DSS_CONTROL , src,15 ,15 );/* VENC_HDMI_SWITCH */ +/* VENC_HDMI_SWITCH */ +REG_FLD_MOD (dss,DSS_CONTROL , src,15 ,15 ); } static int dss_dpi_select_source_omap2_omap3(struct dss_device *dss, int port,
@@ -760,7 +767,7 @@ static int dss_dpi_select_source_omap4(struct dss_device *dss, int port,return -EINVAL ; } -REG_FLD_MOD (DSS_CONTROL , val,17 ,17 ); +REG_FLD_MOD (dss,DSS_CONTROL , val,17 ,17 );return 0 ; }
@@ -787,7 +794,7 @@ static int dss_dpi_select_source_omap5(struct dss_device *dss, int port,return -EINVAL ; } -REG_FLD_MOD (DSS_CONTROL , val,17 ,16 ); +REG_FLD_MOD (dss,DSS_CONTROL , val,17 ,16 );return 0 ; }
@@ -819,37 +826,38 @@ int dss_dpi_select_source(struct dss_device *dss, int port,return dss->feat->ops->dpi_select_source (dss, port, channel); } -static int dss_get_clocks (void ) +static int dss_get_clocks (struct dss_device *dss) {struct clk *clk; - clk =devm_clk_get (&dss.pdev->dev,"fck" ); + clk =devm_clk_get (&dss->pdev->dev,"fck" );if (IS_ERR (clk)) {DSSERR ("can't get clock fck\n" );return PTR_ERR (clk); } - dss.dss_clk = clk; + dss->dss_clk = clk; -if (dss.feat->parent_clk_name) { - clk =clk_get (NULL , dss.feat->parent_clk_name); +if (dss->feat->parent_clk_name) { + clk =clk_get (NULL , dss->feat->parent_clk_name);if (IS_ERR (clk)) { -DSSERR ("Failed to get %s\n" , dss.feat->parent_clk_name); +DSSERR ("Failed to get %s\n" , + dss->feat->parent_clk_name);return PTR_ERR (clk); } }else { clk =NULL ; } - dss.parent_clk = clk; + dss->parent_clk = clk;return 0 ; } -static void dss_put_clocks (void ) +static void dss_put_clocks (struct dss_device *dss) { -if (dss.parent_clk) -clk_put (dss.parent_clk); +if (dss->parent_clk) +clk_put (dss->parent_clk); }int dss_runtime_get (struct dss_device *dss)
@@ -875,14 +883,16 @@ void dss_runtime_put(struct dss_device *dss)struct dss_device *dss_get_device (struct device *dev) { -return &dss; +return dev_get_drvdata (dev); }/* DEBUGFS */ #if defined(CONFIG_OMAP2_DSS_DEBUGFS )static void dss_debug_dump_clocks (struct seq_file *s) { -dss_dump_clocks (s); +struct dss_device *dss = s->private; + +dss_dump_clocks (dss, s);dispc_dump_clocks (s);#ifdef CONFIG_OMAP2_DSS_DSI dsi_dump_clocks (s);
@@ -911,7 +921,7 @@ static const struct file_operations dss_debug_fops = {static struct dentry *dss_debugfs_dir; -static int dss_initialize_debugfs (void ) +static int dss_initialize_debugfs (struct dss_device *dss) { dss_debugfs_dir =debugfs_create_dir ("omapdss" ,NULL );if (IS_ERR (dss_debugfs_dir)) {
@@ -943,7 +953,7 @@ int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) return PTR_ERR_OR_ZERO(d); }#else /* CONFIG_OMAP2_DSS_DEBUGFS */ -static inline int dss_initialize_debugfs (void ) +static inline int dss_initialize_debugfs (struct dss_device *dss) {return 0 ; }
@@ -1148,23 +1158,24 @@ static const struct dss_features dra7xx_dss_feats = { .has_lcd_clk_src = true, }; -static int dss_init_ports (struct platform_device *pdev) +static int dss_init_ports (struct dss_device *dss) { +struct platform_device *pdev = dss->pdev;struct device_node *parent = pdev->dev.of_node;struct device_node *port;int i; -for (i =0 ; i < dss.feat->num_ports; i++) { +for (i =0 ; i < dss->feat->num_ports; i++) { port =of_graph_get_port_by_id (parent, i);if (!port)continue ; -switch (dss.feat->ports[i]) { +switch (dss->feat->ports[i]) {case OMAP_DISPLAY_TYPE_DPI : -dpi_init_port (&dss, pdev, port, dss.feat->model); +dpi_init_port (dss, pdev, port, dss->feat->model);break ;case OMAP_DISPLAY_TYPE_SDI : -sdi_init_port (&dss, pdev, port); +sdi_init_port (dss, pdev, port);break ;default :break ;
@@ -1174,18 +1185,19 @@ static int dss_init_ports(struct platform_device *pdev)return 0 ; } -static void dss_uninit_ports (struct platform_device *pdev) +static void dss_uninit_ports (struct dss_device *dss) { +struct platform_device *pdev = dss->pdev;struct device_node *parent = pdev->dev.of_node;struct device_node *port;int i; -for (i =0 ; i < dss.feat->num_ports; i++) { +for (i =0 ; i < dss->feat->num_ports; i++) { port =of_graph_get_port_by_id (parent, i);if (!port)continue ; -switch (dss.feat->ports[i]) { +switch (dss->feat->ports[i]) {case OMAP_DISPLAY_TYPE_DPI :dpi_uninit_port (port);break ;
@@ -1198,8 +1210,9 @@ static void dss_uninit_ports(struct platform_device *pdev) } } -static int dss_video_pll_probe (struct platform_device *pdev) +static int dss_video_pll_probe (struct dss_device *dss) { +struct platform_device *pdev = dss->pdev;struct device_node *np = pdev->dev.of_node;struct regulator *pll_regulator;int r;
@@ -1208,16 +1221,16 @@ static int dss_video_pll_probe(struct platform_device *pdev)return 0 ;if (of_property_read_bool (np,"syscon-pll-ctrl" )) { - dss.syscon_pll_ctrl =syscon_regmap_lookup_by_phandle (np, + dss->syscon_pll_ctrl =syscon_regmap_lookup_by_phandle (np,"syscon-pll-ctrl" ); -if (IS_ERR (dss.syscon_pll_ctrl)) { +if (IS_ERR (dss->syscon_pll_ctrl)) {dev_err (&pdev->dev,"failed to get syscon-pll-ctrl regmap\n" ); -return PTR_ERR (dss.syscon_pll_ctrl); +return PTR_ERR (dss->syscon_pll_ctrl); }if (of_property_read_u32_index (np,"syscon-pll-ctrl" ,1 , - &dss.syscon_pll_ctrl_offset)) { + &dss->syscon_pll_ctrl_offset)) {dev_err (&pdev->dev,"failed to get syscon-pll-ctrl offset\n" );return -EINVAL ;
@@ -1243,18 +1256,18 @@ static int dss_video_pll_probe(struct platform_device *pdev) }if (of_property_match_string (np,"reg-names" ,"pll1" ) >=0 ) { - dss.video1_pll =dss_video_pll_init (&dss, pdev,0 , - pll_regulator); -if (IS_ERR (dss.video1_pll)) -return PTR_ERR (dss.video1_pll); + dss->video1_pll =dss_video_pll_init (dss, pdev,0 , + pll_regulator); +if (IS_ERR (dss->video1_pll)) +return PTR_ERR (dss->video1_pll); }if (of_property_match_string (np,"reg-names" ,"pll2" ) >=0 ) { - dss.video2_pll =dss_video_pll_init (&dss, pdev,1 , - pll_regulator); -if (IS_ERR (dss.video2_pll)) { -dss_video_pll_uninit (dss.video1_pll); -return PTR_ERR (dss.video2_pll); + dss->video2_pll =dss_video_pll_init (dss, pdev,1 , + pll_regulator); +if (IS_ERR (dss->video2_pll)) { +dss_video_pll_uninit (dss->video1_pll); +return PTR_ERR (dss->video2_pll); } }
@@ -1345,14 +1358,14 @@ static int dss_probe_hardware(struct dss_device *dss) dss->dss_clk_rate =clk_get_rate (dss->dss_clk);/* Select DPLL */ -REG_FLD_MOD (DSS_CONTROL ,0 ,0 ,0 ); +REG_FLD_MOD (dss,DSS_CONTROL ,0 ,0 ,0 ); -dss_select_dispc_clk_source (DSS_CLK_SRC_FCK ); +dss_select_dispc_clk_source (dss,DSS_CLK_SRC_FCK );#ifdef CONFIG_OMAP2_DSS_VENC -REG_FLD_MOD (DSS_CONTROL ,1 ,4 ,4 );/* venc dac demen */ -REG_FLD_MOD (DSS_CONTROL ,1 ,3 ,3 );/* venc clock 4x enable */ -REG_FLD_MOD (DSS_CONTROL ,0 ,2 ,2 );/* venc clock mode = normal */ +REG_FLD_MOD (dss,DSS_CONTROL ,1 ,4 ,4 );/* venc dac demen */ +REG_FLD_MOD (dss,DSS_CONTROL ,1 ,3 ,3 );/* venc clock 4x enable */ +REG_FLD_MOD (dss,DSS_CONTROL ,0 ,2 ,2 );/* venc clock mode = normal */ #endif dss->dsi_clk_source[0 ] =DSS_CLK_SRC_FCK ; dss->dsi_clk_source[1 ] =DSS_CLK_SRC_FCK ;
@@ -1360,7 +1373,7 @@ static int dss_probe_hardware(struct dss_device *dss) dss->lcd_clk_source[0 ] =DSS_CLK_SRC_FCK ; dss->lcd_clk_source[1 ] =DSS_CLK_SRC_FCK ; - rev =dss_read_reg (DSS_REVISION ); + rev =dss_read_reg (dss,DSS_REVISION );pr_info ("OMAP DSS rev %d.%d\n" ,FLD_GET (rev,7 ,4 ),FLD_GET (rev,3 ,0 ));dss_runtime_put (dss);
@@ -1373,14 +1386,20 @@ static int dss_probe(struct platform_device *pdev)const struct soc_device_attribute *soc;struct component_match *match =NULL ;struct resource *dss_mem; +struct dss_device *dss;int r; - dss.pdev = pdev; + dss =kzalloc (sizeof (*dss),GFP_KERNEL ); +if (!dss) +return -ENOMEM ; + + dss->pdev = pdev; +platform_set_drvdata (pdev, dss); r =dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 ));if (r) {dev_err (&pdev->dev,"Failed to set the DMA mask\n" ); -return r; + goto err_free_dss; }/*
@@ -1389,42 +1408,44 @@ static int dss_probe(struct platform_device *pdev)*/ soc =soc_device_match (dss_soc_devices);if (soc) - dss.feat = soc->data; + dss->feat = soc->data;else - dss.feat =of_match_device (dss_of_match, &pdev->dev)->data; + dss->feat =of_match_device (dss_of_match, &pdev->dev)->data;/* Map I/O registers, get and setup clocks. */ dss_mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - dss.base =devm_ioremap_resource (&pdev->dev, dss_mem); -if (IS_ERR (dss.base)) -return PTR_ERR (dss.base); + dss->base =devm_ioremap_resource (&pdev->dev, dss_mem); +if (IS_ERR (dss->base)) { + r =PTR_ERR (dss->base); + goto err_free_dss; + } - r =dss_get_clocks (); + r =dss_get_clocks (dss);if (r) -return r; + goto err_free_dss; - r =dss_setup_default_clock (); + r =dss_setup_default_clock (dss);if (r) goto err_put_clocks;/* Setup the video PLLs and the DPI and SDI ports. */ - r =dss_video_pll_probe (pdev); + r =dss_video_pll_probe (dss);if (r) goto err_put_clocks; - r =dss_init_ports (pdev); + r =dss_init_ports (dss);if (r) goto err_uninit_plls;/* Enable runtime PM and probe the hardware. */ pm_runtime_enable (&pdev->dev); - r =dss_probe_hardware (&dss); + r =dss_probe_hardware (dss);if (r) goto err_pm_runtime_disable;/* Initialize debugfs. */ - r =dss_initialize_debugfs (); + r =dss_initialize_debugfs (dss);if (r) goto err_pm_runtime_disable;
@@ -1444,37 +1465,44 @@ static int dss_probe(struct platform_device *pdev) err_pm_runtime_disable:pm_runtime_disable (&pdev->dev); -dss_uninit_ports (pdev); +dss_uninit_ports (dss); err_uninit_plls: -if (dss.video1_pll) -dss_video_pll_uninit (dss.video1_pll); -if (dss.video2_pll) -dss_video_pll_uninit (dss.video2_pll); +if (dss->video1_pll) +dss_video_pll_uninit (dss->video1_pll); +if (dss->video2_pll) +dss_video_pll_uninit (dss->video2_pll); err_put_clocks: -dss_put_clocks (); +dss_put_clocks (dss); + +err_free_dss: +kfree (dss);return r; }static int dss_remove (struct platform_device *pdev) { +struct dss_device *dss =platform_get_drvdata (pdev); +component_master_del (&pdev->dev, &dss_component_ops);dss_uninitialize_debugfs ();pm_runtime_disable (&pdev->dev); -dss_uninit_ports (pdev); +dss_uninit_ports (dss); + +if (dss->video1_pll) +dss_video_pll_uninit (dss->video1_pll); -if (dss.video1_pll) -dss_video_pll_uninit (dss.video1_pll); +if (dss->video2_pll) +dss_video_pll_uninit (dss->video2_pll); -if (dss.video2_pll) -dss_video_pll_uninit (dss.video2_pll); +dss_put_clocks (dss); -dss_put_clocks (); +kfree (dss);return 0 ; }
@@ -1496,7 +1524,9 @@ static void dss_shutdown(struct platform_device *pdev)static int dss_runtime_suspend (struct device *dev) { -dss_save_context (); +struct dss_device *dss =dev_get_drvdata (dev); + +dss_save_context (dss);dss_set_min_bus_tput (dev,0 );pinctrl_pm_select_sleep_state (dev);
@@ -1506,6 +1536,7 @@ static int dss_runtime_suspend(struct device *dev)static int dss_runtime_resume (struct device *dev) { +struct dss_device *dss =dev_get_drvdata (dev);int r;pinctrl_pm_select_default_state (dev);
@@ -1521,7 +1552,7 @@ static int dss_runtime_resume(struct device *dev)if (r)return r; -dss_restore_context (); +dss_restore_context (dss);return 0 ; }
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 11/30 drm: omapdrm: dss: Support passing private data to debugfs show handlers
In reply to Laurent PinchartTo simplify implementation of debugfs seq_file show handlers, the driver passes the pointer to the show function through the debugfs_create_file data pointer. This prevents using the pointer to pass driver private data to the show handler, and requires all handlers to use global variables to access private data.
To prepare for the removal of global private data in the driver, rework the debugfs infrastructure to allow passing a private data pointer to show handlers.
The price to pay is explicit removal of debugfs files to free the internally allocated memory. This is desirable anyway as debugfs entries should be removed when a component driver is unbound, otherwise crashes will occur due to access to freed memory when the components will be dynamically allocated instead of stored in global variables.
---
Changes since v1:
- Removed unneeded declaration of struct dentry in dss.h
- Removed DSS debugfs files in driver remove handler
--- drivers/gpu/drm/omapdrm/dss/dispc.c | 13 ++++-- drivers/gpu/drm/omapdrm/dss/dsi.c | 40 ++++++++++++----- drivers/gpu/drm/omapdrm/dss/dss.c | 89 ++++++++++++++++++++++++------------- drivers/gpu/drm/omapdrm/dss/dss.h | 31 ++++++++----- drivers/gpu/drm/omapdrm/dss/hdmi.h | 2 + drivers/gpu/drm/omapdrm/dss/hdmi4.c | 9 ++-- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 9 ++-- drivers/gpu/drm/omapdrm/dss/venc.c | 11 +++-- 8 files changed, 141 insertions(+), 63 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +10 -3
@@ -167,6 +167,8 @@ static struct {void __iomem *base;struct dss_device *dss; +struct dss_debugfs_entry *debugfs; +int irq;irq_handler_t user_handler;void *user_data;
@@ -3268,7 +3270,7 @@ void dispc_dump_clocks(struct seq_file *s)dispc_runtime_put (); } -static void dispc_dump_regs (struct seq_file *s) +static int dispc_dump_regs (struct seq_file *s,void *p) {int i, j;const char *mgr_names[] = {
@@ -3289,7 +3291,7 @@ static void dispc_dump_regs(struct seq_file *s)#define DUMPREG (r) seq_printf(s, "%-50s %08x\n", #r, dispc_read_reg(r))if (dispc_runtime_get ()) -return ; +return 0 ;/* DISPC common registers */ DUMPREG (DISPC_REVISION );
@@ -3461,6 +3463,8 @@ static void dispc_dump_regs(struct seq_file *s)#undef DISPC_REG#undef DUMPREG + +return 0 ; }/* calculate clock rates using dividers in cinfo */
@@ -4620,7 +4624,8 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)dispc_set_ops (&dispc_ops); -dss_debugfs_create_file ("dispc" , dispc_dump_regs); + dispc.debugfs =dss_debugfs_create_file ("dispc" , dispc_dump_regs, + &dispc);return 0 ;
@@ -4632,6 +4637,8 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)static void dispc_unbind (struct device *dev,struct device *master,void *data) { +dss_debugfs_remove_file (dispc.debugfs); +dispc_set_ops (NULL );pm_runtime_disable (dev);
drivers/gpu/drm/omapdrm/dss/dsi.c +29 -11
@@ -401,6 +401,10 @@ struct dsi_data {#endif int debug_read;int debug_write; +struct { +struct dss_debugfs_entry *irqs; +struct dss_debugfs_entry *regs; + } debugfs;#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS spinlock_t irq_stats_lock;
@@ -1660,18 +1664,20 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,#undef PIS } -static void dsi1_dump_irqs (struct seq_file *s) +static int dsi1_dump_irqs (struct seq_file *s,void *p) {struct platform_device *dsidev =dsi_get_dsidev_from_id (0 );dsi_dump_dsidev_irqs (dsidev, s); +return 0 ; } -static void dsi2_dump_irqs (struct seq_file *s) +static int dsi2_dump_irqs (struct seq_file *s,void *p) {struct platform_device *dsidev =dsi_get_dsidev_from_id (1 );dsi_dump_dsidev_irqs (dsidev, s); +return 0 ; }#endif
@@ -1759,18 +1765,20 @@ static void dsi_dump_dsidev_regs(struct platform_device *dsidev,#undef DUMPREG } -static void dsi1_dump_regs (struct seq_file *s) +static int dsi1_dump_regs (struct seq_file *s,void *p) {struct platform_device *dsidev =dsi_get_dsidev_from_id (0 );dsi_dump_dsidev_regs (dsidev, s); +return 0 ; } -static void dsi2_dump_regs (struct seq_file *s) +static int dsi2_dump_regs (struct seq_file *s,void *p) {struct platform_device *dsidev =dsi_get_dsidev_from_id (1 );dsi_dump_dsidev_regs (dsidev, s); +return 0 ; }enum dsi_cio_power_state {
@@ -5569,15 +5577,22 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)dsi_runtime_put (dsidev);if (dsi->module_id ==0 ) -dss_debugfs_create_file ("dsi1_regs" , dsi1_dump_regs); -else if (dsi->module_id ==1 ) -dss_debugfs_create_file ("dsi2_regs" , dsi2_dump_regs); - + dsi->debugfs.regs =dss_debugfs_create_file ("dsi1_regs" , + dsi1_dump_regs, + &dsi); +else + dsi->debugfs.regs =dss_debugfs_create_file ("dsi2_regs" , + dsi2_dump_regs, + &dsi);#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS if (dsi->module_id ==0 ) -dss_debugfs_create_file ("dsi1_irqs" , dsi1_dump_irqs); -else if (dsi->module_id ==1 ) -dss_debugfs_create_file ("dsi2_irqs" , dsi2_dump_irqs); + dsi->debugfs.irqs =dss_debugfs_create_file ("dsi1_irqs" , + dsi1_dump_irqs, + &dsi); +else + dsi->debugfs.irqs =dss_debugfs_create_file ("dsi2_irqs" , + dsi2_dump_irqs, + &dsi);#endif return 0 ;
@@ -5596,6 +5611,9 @@ static void dsi_unbind(struct device *dev, struct device *master, void *data)struct platform_device *dsidev =to_platform_device (dev);struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +dss_debugfs_remove_file (dsi->debugfs.irqs); +dss_debugfs_remove_file (dsi->debugfs.regs); +of_platform_depopulate (&dsidev->dev);WARN_ON (dsi->scp_clk_refcount >0 );
drivers/gpu/drm/omapdrm/dss/dss.c +59 -30
157 lines not on this page · raw message
drivers/gpu/drm/omapdrm/dss/dss.h +21 -10
@@ -25,6 +25,10 @@#include "omapdss.h" +struct dss_debugfs_entry ; +struct platform_device ; +struct seq_file ; +#define MAX_DSS_LCD_MANAGERS 3#define MAX_NUM_DSI 2
@@ -233,9 +237,6 @@ struct dss_lcd_mgr_config {int lcden_sig_polarity; }; -struct seq_file ; -struct platform_device ; -#define DSS_SZ_REGS SZ_512struct dss_device {
@@ -261,6 +262,11 @@ struct dss_device {const struct dss_features *feat; +struct { +struct dss_debugfs_entry *clk; +struct dss_debugfs_entry *dss; + } debugfs; +struct dss_pll *video1_pll;struct dss_pll *video2_pll; };
@@ -283,12 +289,20 @@ static inline bool dss_mgr_is_lcd(enum omap_channel id)/* DSS */ #if defined(CONFIG_OMAP2_DSS_DEBUGFS ) -int dss_debugfs_create_file (const char *name,void (*write)(struct seq_file *)); +struct dss_debugfs_entry *dss_debugfs_create_file (const char *name, +int (*show_fn)(struct seq_file *s,void *data),void *data); +void dss_debugfs_remove_file (struct dss_debugfs_entry *entry);#else -static inline int dss_debugfs_create_file (const char *name, -void (*write)(struct seq_file *)) +static inline struct dss_debugfs_entry * +dss_debugfs_create_file (const char *name, +int (*show_fn)(struct seq_file *s,void *data), +void *data) +{ +return NULL ; +} + +static inline void dss_debugfs_remove_file (struct dss_debugfs_entry *entry) { -return 0 ; }#endif /* CONFIG_OMAP2_DSS_DEBUGFS */
@@ -360,9 +374,6 @@ static inline void sdi_uninit_port(struct device_node *port)#ifdef CONFIG_OMAP2_DSS_DSI -struct dentry ; -struct file_operations ; -void dsi_dump_clocks (struct seq_file *s);void dsi_irq_handler (void );
drivers/gpu/drm/omapdrm/dss/hdmi.h +2 -0
@@ -361,6 +361,8 @@ struct omap_hdmi {struct platform_device *pdev;struct dss_device *dss; +struct dss_debugfs_entry *debugfs; +struct hdmi_wp_data wp;struct hdmi_pll_data pll;struct hdmi_phy_data phy;
drivers/gpu/drm/omapdrm/dss/hdmi4.c +6 -3
@@ -303,13 +303,13 @@ static void hdmi_display_get_timings(struct omap_dss_device *dssdev, *vm = hdmi.cfg.vm; } -static void hdmi_dump_regs (struct seq_file *s) +static int hdmi_dump_regs (struct seq_file *s,void *p) {mutex_lock (&hdmi.lock);if (hdmi_runtime_get ()) {mutex_unlock (&hdmi.lock); -return ; +return 0 ; }hdmi_wp_dump (&hdmi.wp, s);
@@ -319,6 +319,7 @@ static void hdmi_dump_regs(struct seq_file *s)hdmi_runtime_put ();mutex_unlock (&hdmi.lock); +return 0 ; }static int read_edid (u8 *buf,int len)
@@ -779,7 +780,7 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)return r; } -dss_debugfs_create_file ("hdmi" , hdmi_dump_regs); + hdmi.debugfs =dss_debugfs_create_file ("hdmi" , hdmi_dump_regs, &hdmi);return 0 ; err:
@@ -791,6 +792,8 @@ static void hdmi4_unbind(struct device *dev, struct device *master, void *data) {struct platform_device *pdev =to_platform_device (dev); +dss_debugfs_remove_file (hdmi.debugfs); +if (hdmi.audio_pdev)platform_device_unregister (hdmi.audio_pdev);
drivers/gpu/drm/omapdrm/dss/hdmi5.c +6 -3
@@ -299,13 +299,13 @@ static void hdmi_display_get_timings(struct omap_dss_device *dssdev, *vm = hdmi.cfg.vm; } -static void hdmi_dump_regs (struct seq_file *s) +static int hdmi_dump_regs (struct seq_file *s,void *p) {mutex_lock (&hdmi.lock);if (hdmi_runtime_get ()) {mutex_unlock (&hdmi.lock); -return ; +return 0 ; }hdmi_wp_dump (&hdmi.wp, s);
@@ -315,6 +315,7 @@ static void hdmi_dump_regs(struct seq_file *s)hdmi_runtime_put ();mutex_unlock (&hdmi.lock); +return 0 ; }static int read_edid (u8 *buf,int len)
@@ -776,7 +777,7 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data)return r; } -dss_debugfs_create_file ("hdmi" , hdmi_dump_regs); + hdmi.debugfs =dss_debugfs_create_file ("hdmi" , hdmi_dump_regs, &hdmi);return 0 ; err:
@@ -788,6 +789,8 @@ static void hdmi5_unbind(struct device *dev, struct device *master, void *data) {struct platform_device *pdev =to_platform_device (dev); +dss_debugfs_remove_file (hdmi.debugfs); +if (hdmi.audio_pdev)platform_device_unregister (hdmi.audio_pdev);
drivers/gpu/drm/omapdrm/dss/venc.c +8 -3
@@ -327,6 +327,8 @@ static struct {struct regulator *vdda_dac_reg;struct dss_device *dss; +struct dss_debugfs_entry *debugfs; +struct clk *tv_dac_clk;struct videomode vm;
@@ -670,12 +672,12 @@ static int venc_init_regulator(void)return 0 ; } -static void venc_dump_regs (struct seq_file *s) +static int venc_dump_regs (struct seq_file *s,void *p) {#define DUMPREG (r) seq_printf(s, "%-35s %08x\n", #r, venc_read_reg(r))if (venc_runtime_get ()) -return ; +return 0 ;DUMPREG (VENC_F_CONTROL );DUMPREG (VENC_VIDOUT_CTRL );
@@ -722,6 +724,7 @@ static void venc_dump_regs(struct seq_file *s)venc_runtime_put ();#undef DUMPREG +return 0 ; }static int venc_get_clocks (struct platform_device *pdev)
@@ -914,7 +917,7 @@ static int venc_bind(struct device *dev, struct device *master, void *data) goto err_probe_of; } -dss_debugfs_create_file ("venc" , venc_dump_regs); + venc.debugfs =dss_debugfs_create_file ("venc" , venc_dump_regs, &venc);venc_init_output (pdev);
@@ -930,6 +933,8 @@ static void venc_unbind(struct device *dev, struct device *master, void *data) {struct platform_device *pdev =to_platform_device (dev); +dss_debugfs_remove_file (venc.debugfs); +venc_uninit_output (pdev);pm_runtime_disable (&pdev->dev);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 12/30 drm: omapdrm: dss: Store the registered plls array in struct dss_device
In reply to Laurent PinchartAs part of an effort to remove the usage of global variables in the driver, store the registered plls array in the dss_device structure instead of a global variable.
--- drivers/gpu/drm/omapdrm/dss/dispc.c | 4 ++-- drivers/gpu/drm/omapdrm/dss/dpi.c | 17 +++++++------- drivers/gpu/drm/omapdrm/dss/dsi.c | 3 +-- drivers/gpu/drm/omapdrm/dss/dss.h | 8 ++++--- drivers/gpu/drm/omapdrm/dss/hdmi_pll.c | 3 +-- drivers/gpu/drm/omapdrm/dss/pll.c | 40 +++++++++++++++++---------------- drivers/gpu/drm/omapdrm/dss/video-pll.c | 3 +-- 7 files changed, 40 insertions(+), 38 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +2 -2
@@ -3123,7 +3123,7 @@ static unsigned long dispc_fclk_rate(void)struct dss_pll *pll;unsigned int clkout_idx; - pll =dss_pll_find_by_src (src); + pll =dss_pll_find_by_src (dispc.dss, src); clkout_idx =dss_pll_get_clkout_idx_for_src (src); r = pll->cinfo.clkout[clkout_idx];
@@ -3150,7 +3150,7 @@ static unsigned long dispc_mgr_lclk_rate(enum omap_channel channel)struct dss_pll *pll;unsigned int clkout_idx; - pll =dss_pll_find_by_src (src); + pll =dss_pll_find_by_src (dispc.dss, src); clkout_idx =dss_pll_get_clkout_idx_for_src (src); r = pll->cinfo.clkout[clkout_idx];
drivers/gpu/drm/omapdrm/dss/dpi.c +9 -8
@@ -58,7 +58,8 @@ static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device *dssdev) return container_of(dssdev, struct dpi_data, output); } -static enum dss_clk_source dpi_get_clk_src_dra7xx (enum omap_channel channel) +static enum dss_clk_source dpi_get_clk_src_dra7xx (struct dpi_data *dpi, +enum omap_channel channel) {/* * Possible clock sources:
@@ -70,23 +71,23 @@ static enum dss_clk_source dpi_get_clk_src_dra7xx(enum omap_channel channel)switch (channel) {case OMAP_DSS_CHANNEL_LCD : { -if (dss_pll_find_by_src (DSS_CLK_SRC_PLL1_1 )) +if (dss_pll_find_by_src (dpi->dss,DSS_CLK_SRC_PLL1_1 ))return DSS_CLK_SRC_PLL1_1 ;break ; }case OMAP_DSS_CHANNEL_LCD2 : { -if (dss_pll_find_by_src (DSS_CLK_SRC_PLL1_3 )) +if (dss_pll_find_by_src (dpi->dss,DSS_CLK_SRC_PLL1_3 ))return DSS_CLK_SRC_PLL1_3 ; -if (dss_pll_find_by_src (DSS_CLK_SRC_PLL2_3 )) +if (dss_pll_find_by_src (dpi->dss,DSS_CLK_SRC_PLL2_3 ))return DSS_CLK_SRC_PLL2_3 ;break ; }case OMAP_DSS_CHANNEL_LCD3 : { -if (dss_pll_find_by_src (DSS_CLK_SRC_PLL2_1 )) +if (dss_pll_find_by_src (dpi->dss,DSS_CLK_SRC_PLL2_1 ))return DSS_CLK_SRC_PLL2_1 ; -if (dss_pll_find_by_src (DSS_CLK_SRC_PLL1_3 )) +if (dss_pll_find_by_src (dpi->dss,DSS_CLK_SRC_PLL1_3 ))return DSS_CLK_SRC_PLL1_3 ;break ; }
@@ -133,7 +134,7 @@ static enum dss_clk_source dpi_get_clk_src(struct dpi_data *dpi) }case DSS_MODEL_DRA7 : -return dpi_get_clk_src_dra7xx (channel); +return dpi_get_clk_src_dra7xx (dpi, channel);default :return DSS_CLK_SRC_FCK ;
@@ -605,7 +606,7 @@ static void dpi_init_pll(struct dpi_data *dpi) dpi->clk_src =dpi_get_clk_src (dpi); - pll =dss_pll_find_by_src (dpi->clk_src); + pll =dss_pll_find_by_src (dpi->dss, dpi->clk_src);if (!pll)return ;
drivers/gpu/drm/omapdrm/dss/dsi.c +1 -2
@@ -5353,9 +5353,8 @@ static int dsi_init_pll_data(struct dss_device *dss, pll->base = dsi->pll_base; pll->hw = dsi->data->pll_hw; pll->ops = &dsi_pll_ops; - pll->dss = dss; - r =dss_pll_register (pll); + r =dss_pll_register (dss, pll);if (r)return r;
drivers/gpu/drm/omapdrm/dss/dss.h +5 -3
@@ -267,6 +267,7 @@ struct dss_device {struct dss_debugfs_entry *dss; } debugfs; +struct dss_pll *plls[4 ];struct dss_pll *video1_pll;struct dss_pll *video2_pll; };
@@ -458,10 +459,11 @@ typedef bool (*dss_pll_calc_func)(int n, int m, unsigned long fint,typedef bool (*dss_hsdiv_calc_func )(int m_dispc,unsigned long dispc,void *data); -int dss_pll_register (struct dss_pll *pll); +int dss_pll_register (struct dss_device *dss,struct dss_pll *pll);void dss_pll_unregister (struct dss_pll *pll); -struct dss_pll *dss_pll_find (const char *name); -struct dss_pll *dss_pll_find_by_src (enum dss_clk_source src); +struct dss_pll *dss_pll_find (struct dss_device *dss,const char *name); +struct dss_pll *dss_pll_find_by_src (struct dss_device *dss, +enum dss_clk_source src);unsigned int dss_pll_get_clkout_idx_for_src (enum dss_clk_source src);int dss_pll_enable (struct dss_pll *pll);void dss_pll_disable (struct dss_pll *pll);
drivers/gpu/drm/omapdrm/dss/hdmi_pll.c +1 -2
@@ -146,7 +146,6 @@ static int hdmi_init_pll_data(struct dss_device *dss, pll->id =DSS_PLL_HDMI ; pll->base = hpll->base; pll->clkin = clk; - pll->dss = dss;if (hpll->wp->version ==4 ) pll->hw = &dss_omap4_hdmi_pll_hw;
@@ -155,7 +154,7 @@ static int hdmi_init_pll_data(struct dss_device *dss, pll->ops = &hdmi_pll_ops; - r =dss_pll_register (pll); + r =dss_pll_register (dss, pll);if (r)return r;
drivers/gpu/drm/omapdrm/dss/pll.c +21 -19
@@ -35,15 +35,14 @@#define PLL_SSC_CONFIGURATION2 0x001C#define PLL_CONFIGURATION4 0x0020 -static struct dss_pll *dss_plls[4 ]; - -int dss_pll_register (struct dss_pll *pll) +int dss_pll_register (struct dss_device *dss,struct dss_pll *pll) {int i; -for (i =0 ; i <ARRAY_SIZE (dss_plls); ++i) { -if (!dss_plls[i]) { - dss_plls[i] = pll; +for (i =0 ; i <ARRAY_SIZE (dss->plls); ++i) { +if (!dss->plls[i]) { + dss->plls[i] = pll; + pll->dss = dss;return 0 ; } }
@@ -53,29 +52,32 @@ int dss_pll_register(struct dss_pll *pll)void dss_pll_unregister (struct dss_pll *pll) { +struct dss_device *dss = pll->dss;int i; -for (i =0 ; i <ARRAY_SIZE (dss_plls); ++i) { -if (dss_plls[i] == pll) { - dss_plls[i] =NULL ; +for (i =0 ; i <ARRAY_SIZE (dss->plls); ++i) { +if (dss->plls[i] == pll) { + dss->plls[i] =NULL ; + pll->dss =NULL ;return ; } } } -struct dss_pll *dss_pll_find (const char *name) +struct dss_pll *dss_pll_find (struct dss_device *dss,const char *name) {int i; -for (i =0 ; i <ARRAY_SIZE (dss_plls); ++i) { -if (dss_plls[i] &&strcmp (dss_plls[i]->name, name) ==0 ) -return dss_plls[i]; +for (i =0 ; i <ARRAY_SIZE (dss->plls); ++i) { +if (dss->plls[i] &&strcmp (dss->plls[i]->name, name) ==0 ) +return dss->plls[i]; }return NULL ; } -struct dss_pll *dss_pll_find_by_src (enum dss_clk_source src) +struct dss_pll *dss_pll_find_by_src (struct dss_device *dss, +enum dss_clk_source src) {struct dss_pll *pll;
@@ -85,22 +87,22 @@ struct dss_pll *dss_pll_find_by_src(enum dss_clk_source src)return NULL ;case DSS_CLK_SRC_HDMI_PLL : -return dss_pll_find ("hdmi" ); +return dss_pll_find (dss,"hdmi" );case DSS_CLK_SRC_PLL1_1 :case DSS_CLK_SRC_PLL1_2 :case DSS_CLK_SRC_PLL1_3 : - pll =dss_pll_find ("dsi0" ); + pll =dss_pll_find (dss,"dsi0" );if (!pll) - pll =dss_pll_find ("video0" ); + pll =dss_pll_find (dss,"video0" );return pll;case DSS_CLK_SRC_PLL2_1 :case DSS_CLK_SRC_PLL2_2 :case DSS_CLK_SRC_PLL2_3 : - pll =dss_pll_find ("dsi1" ); + pll =dss_pll_find (dss,"dsi1" );if (!pll) - pll =dss_pll_find ("video1" ); + pll =dss_pll_find (dss,"video1" );return pll; } }
drivers/gpu/drm/omapdrm/dss/video-pll.c +1 -2
@@ -190,9 +190,8 @@ struct dss_pll *dss_video_pll_init(struct dss_device *dss, pll->base = pll_base; pll->hw = &dss_dra7_video_pll_hw; pll->ops = &dss_pll_ops; - pll->dss = dss; - r =dss_pll_register (pll); + r =dss_pll_register (dss, pll);if (r)return ERR_PTR (r);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 13/30 drm: omapdrm: dss: Store the debugfs root directory in struct dss_device
In reply to Laurent PinchartAs part of an effort to remove the usage of global variables in the driver, store the debugfs root directory in the dss_device structure instead of a global variable.
---
Changes since v1:
- Remove static keyword from dss_initialize_debugfs() local variable
- Remove NULL check before debugfs_remove_recursive()
--- drivers/gpu/drm/omapdrm/dss/dispc.c | 2 +- drivers/gpu/drm/omapdrm/dss/dsi.c | 8 ++++---- drivers/gpu/drm/omapdrm/dss/dss.c | 38 ++++++++++++++++++------------------- drivers/gpu/drm/omapdrm/dss/dss.h | 9 ++++++--- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 3 ++- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 3 ++- drivers/gpu/drm/omapdrm/dss/venc.c | 3 ++- 7 files changed, 36 insertions(+), 30 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +1 -1
@@ -4624,7 +4624,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)dispc_set_ops (&dispc_ops); - dispc.debugfs =dss_debugfs_create_file ("dispc" , dispc_dump_regs, + dispc.debugfs =dss_debugfs_create_file (dss,"dispc" , dispc_dump_regs, &dispc);return 0 ;
drivers/gpu/drm/omapdrm/dss/dsi.c +4 -4
@@ -5576,20 +5576,20 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)dsi_runtime_put (dsidev);if (dsi->module_id ==0 ) - dsi->debugfs.regs =dss_debugfs_create_file ("dsi1_regs" , + dsi->debugfs.regs =dss_debugfs_create_file (dss,"dsi1_regs" , dsi1_dump_regs, &dsi);else - dsi->debugfs.regs =dss_debugfs_create_file ("dsi2_regs" , + dsi->debugfs.regs =dss_debugfs_create_file (dss,"dsi2_regs" , dsi2_dump_regs, &dsi);#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS if (dsi->module_id ==0 ) - dsi->debugfs.irqs =dss_debugfs_create_file ("dsi1_irqs" , + dsi->debugfs.irqs =dss_debugfs_create_file (dss,"dsi1_irqs" , dsi1_dump_irqs, &dsi);else - dsi->debugfs.irqs =dss_debugfs_create_file ("dsi2_irqs" , + dsi->debugfs.irqs =dss_debugfs_create_file (dss,"dsi2_irqs" , dsi2_dump_irqs, &dsi);#endif
drivers/gpu/drm/omapdrm/dss/dss.c +19 -19
@@ -901,25 +901,22 @@ static int dss_debug_dump_clocks(struct seq_file *s, void *p)return 0 ; } -static struct dentry *dss_debugfs_dir; -static int dss_initialize_debugfs (struct dss_device *dss) { - dss_debugfs_dir =debugfs_create_dir ("omapdss" ,NULL ); -if (IS_ERR (dss_debugfs_dir)) { -int err =PTR_ERR (dss_debugfs_dir); +struct dentry *dir; - dss_debugfs_dir =NULL ; -return err; - } + dir =debugfs_create_dir ("omapdss" ,NULL ); +if (IS_ERR (dir)) +return PTR_ERR (dir); + + dss->debugfs.root = dir;return 0 ; } -static void dss_uninitialize_debugfs (void ) +static void dss_uninitialize_debugfs (struct dss_device *dss) { -if (dss_debugfs_dir) -debugfs_remove_recursive (dss_debugfs_dir); +debugfs_remove_recursive (dss->debugfs.root); }struct dss_debugfs_entry {
@@ -942,8 +939,10 @@ static const struct file_operations dss_debug_fops = { .release = single_release, }; -struct dss_debugfs_entry *dss_debugfs_create_file (const char *name, -int (*show_fn)(struct seq_file *s,void *data),void *data) +struct dss_debugfs_entry * +dss_debugfs_create_file (struct dss_device *dss,const char *name, +int (*show_fn)(struct seq_file *s,void *data), +void *data) {struct dss_debugfs_entry *entry;struct dentry *d;
@@ -955,7 +954,7 @@ struct dss_debugfs_entry *dss_debugfs_create_file(const char *name, entry->show_fn = show_fn; entry->data = data; - d =debugfs_create_file (name,0444 , dss_debugfs_dir, entry, + d =debugfs_create_file (name,0444 , dss->debugfs.root, entry, &dss_debug_fops);if (IS_ERR (d)) {kfree (entry);
@@ -980,7 +979,7 @@ static inline int dss_initialize_debugfs(struct dss_device *dss) {return 0 ; } -static inline void dss_uninitialize_debugfs (void ) +static inline void dss_uninitialize_debugfs (struct dss_device *dss) { }#endif /* CONFIG_OMAP2_DSS_DEBUGFS */
@@ -1472,9 +1471,10 @@ static int dss_probe(struct platform_device *pdev)if (r) goto err_pm_runtime_disable; - dss->debugfs.clk =dss_debugfs_create_file ("clk" , dss_debug_dump_clocks, + dss->debugfs.clk =dss_debugfs_create_file (dss,"clk" , + dss_debug_dump_clocks, dss); + dss->debugfs.dss =dss_debugfs_create_file (dss,"dss" , dss_dump_regs, dss); - dss->debugfs.dss =dss_debugfs_create_file ("dss" , dss_dump_regs, dss);/* Add all the child devices as components. */ device_for_each_child (&pdev->dev, &match, dss_add_child_component);
@@ -1488,7 +1488,7 @@ static int dss_probe(struct platform_device *pdev) err_uninit_debugfs:dss_debugfs_remove_file (dss->debugfs.clk);dss_debugfs_remove_file (dss->debugfs.dss); -dss_uninitialize_debugfs (); +dss_uninitialize_debugfs (dss); err_pm_runtime_disable:pm_runtime_disable (&pdev->dev);
@@ -1517,7 +1517,7 @@ static int dss_remove(struct platform_device *pdev)dss_debugfs_remove_file (dss->debugfs.clk);dss_debugfs_remove_file (dss->debugfs.dss); -dss_uninitialize_debugfs (); +dss_uninitialize_debugfs (dss);pm_runtime_disable (&pdev->dev);
drivers/gpu/drm/omapdrm/dss/dss.h +6 -3
@@ -263,6 +263,7 @@ struct dss_device {const struct dss_features *feat;struct { +struct dentry *root;struct dss_debugfs_entry *clk;struct dss_debugfs_entry *dss; } debugfs;
@@ -290,12 +291,14 @@ static inline bool dss_mgr_is_lcd(enum omap_channel id)/* DSS */ #if defined(CONFIG_OMAP2_DSS_DEBUGFS ) -struct dss_debugfs_entry *dss_debugfs_create_file (const char *name, -int (*show_fn)(struct seq_file *s,void *data),void *data); +struct dss_debugfs_entry * +dss_debugfs_create_file (struct dss_device *dss,const char *name, +int (*show_fn)(struct seq_file *s,void *data), +void *data);void dss_debugfs_remove_file (struct dss_debugfs_entry *entry);#else static inline struct dss_debugfs_entry * -dss_debugfs_create_file (const char *name, +dss_debugfs_create_file (struct dss_device *dss,const char *name,int (*show_fn)(struct seq_file *s,void *data),void *data) {
drivers/gpu/drm/omapdrm/dss/hdmi4.c +2 -1
@@ -780,7 +780,8 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)return r; } - hdmi.debugfs =dss_debugfs_create_file ("hdmi" , hdmi_dump_regs, &hdmi); + hdmi.debugfs =dss_debugfs_create_file (dss,"hdmi" , hdmi_dump_regs, + &hdmi);return 0 ; err:
drivers/gpu/drm/omapdrm/dss/hdmi5.c +2 -1
@@ -777,7 +777,8 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data)return r; } - hdmi.debugfs =dss_debugfs_create_file ("hdmi" , hdmi_dump_regs, &hdmi); + hdmi.debugfs =dss_debugfs_create_file (dss,"hdmi" , hdmi_dump_regs, + &hdmi);return 0 ; err:
drivers/gpu/drm/omapdrm/dss/venc.c +2 -1
@@ -917,7 +917,8 @@ static int venc_bind(struct device *dev, struct device *master, void *data) goto err_probe_of; } - venc.debugfs =dss_debugfs_create_file ("venc" , venc_dump_regs, &venc); + venc.debugfs =dss_debugfs_create_file (dss,"venc" , venc_dump_regs, + &venc);venc_init_output (pdev);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 14/30 drm: omapdrm: dss: Don't unnecessarily cast to dev to pdev and back
In reply to Laurent PinchartThe dss_unbind() function casts the struct device pointer to a struct platform_device, only to later use the struct device pointer from platform_device. Don't cast at all.
--- drivers/gpu/drm/omapdrm/dss/dss.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss.c +1 -3
@@ -1332,11 +1332,9 @@ static int dss_bind(struct device *dev)static void dss_unbind (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -omapdss_set_is_initialized (false); -component_unbind_all (&pdev->dev,NULL ); +component_unbind_all (dev,NULL ); }static const struct component_master_ops dss_component_ops = {
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 14/30] drm: omapdrm: dss: Don't unnecessarily cast to dev to pdev and back
Hi,
Quoted 6 lines · Laurent Pinchart
The
dss_unbind()function casts the struct device pointer to a structplatform_device, only to later use the struct device pointer fromplatform_device. Don't cast at all.Signed-off-by Laurent Pinchart <[email protected]>---
-- Sebastian
Quoted 29 lines
drivers/gpu/drm/omapdrm/dss/dss.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/omapdrm/dss/dss.c +1
-3@@ -1332,11 +1332,9 @@ static int dss_bind(struct device *dev)static void dss_unbind (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -omapdss_set_is_initialized (false); -component_unbind_all (&pdev->dev,NULL ); +component_unbind_all (dev,NULL ); }static const struct component_master_ops dss_component_ops = {Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 15/30 drm: omapdrm: dsi: Pass the dsi_data pointer to internal functions
In reply to Laurent PinchartInternal dsi functions take a pointer to the DSI platform_device and then cast it to a dsi_data pointer. That's pointless as the caller already has the dsi_data pointer. Pass it directly instead of the platform_device pointer.
--- drivers/gpu/drm/omapdrm/dss/dsi.c | 1228 +++++++++++++++++-------------------- 1 file changed, 564 insertions(+), 664 deletions(-)
drivers/gpu/drm/omapdrm/dss/dsi.c +564 -664
@@ -119,11 +119,11 @@ struct dsi_reg { u16 module; u16 idx; };#define DSI_PLL_CONFIGURATION1 DSI_REG(DSI_PLL, 0x000C)#define DSI_PLL_CONFIGURATION2 DSI_REG(DSI_PLL, 0x0010) -#define REG_GET (dsidev, idx, start, end) \ - FLD_GET(dsi_read_reg(dsidev, idx), start, end) +#define REG_GET (dsi, idx, start, end) \ + FLD_GET(dsi_read_reg(dsi, idx), start, end) -#define REG_FLD_MOD (dsidev, idx, val, start, end) \ - dsi_write_reg(dsidev, idx, FLD_MOD(dsi_read_reg(dsidev, idx), val, start, end)) +#define REG_FLD_MOD (dsi, idx, val, start, end) \ + dsi_write_reg(dsi, idx, FLD_MOD(dsi_read_reg(dsi, idx), val, start, end))/* Global interrupts */ #define DSI_IRQ_VC0 (1 << 0)
@@ -213,13 +213,14 @@ struct dsi_reg { u16 module; u16 idx; }; DSI_CIO_IRQ_ERRCONTENTIONLP0_5 | DSI_CIO_IRQ_ERRCONTENTIONLP1_5)typedef void (*omap_dsi_isr_t ) (void *arg,u32 mask); +struct dsi_data ; -static int dsi_display_init_dispc (struct platform_device *dsidev, +static int dsi_display_init_dispc (struct dsi_data *dsi,enum omap_channel channel); -static void dsi_display_uninit_dispc (struct platform_device *dsidev, +static void dsi_display_uninit_dispc (struct dsi_data *dsi,enum omap_channel channel); -static int dsi_vc_send_null (struct omap_dss_device *dssdev,int channel); +static int dsi_vc_send_null (struct dsi_data *dsi,int channel);/* DSI PLL HSDIV indices */ #define HSDIV_DISPC 0
@@ -282,7 +283,7 @@ struct dsi_isr_tables { };struct dsi_clk_calc_ctx { -struct platform_device *dsidev; +struct dsi_data *dsi;struct dss_pll *pll;/* inputs */
@@ -429,7 +430,7 @@ struct dsi_data { };struct dsi_packet_sent_handler_data { -struct platform_device *dsidev; +struct dsi_data *dsi;struct completion *completion; };
@@ -448,7 +449,7 @@ static inline struct platform_device *dsi_get_dsidev_from_dssdev(struct omap_dssreturn to_platform_device (dssdev->dev); } -static struct platform_device *dsi_get_dsidev_from_id (int module) +static struct dsi_data *dsi_get_dsi_from_id (int module) {struct omap_dss_device *out;enum omap_dss_output_id id;
@@ -466,13 +467,12 @@ static struct platform_device *dsi_get_dsidev_from_id(int module) out =omap_dss_get_output (id); -return out ?to_platform_device (out->dev) :NULL ; +return out ?dsi_get_dsidrv_data (to_platform_device (out->dev)) :NULL ; } -static inline void dsi_write_reg (struct platform_device *dsidev, -const struct dsi_reg idx,u32 val) +static inline void dsi_write_reg (struct dsi_data *dsi, +const struct dsi_reg idx,u32 val) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);void __iomem *base;switch (idx.module) {
@@ -485,10 +485,8 @@ static inline void dsi_write_reg(struct platform_device *dsidev,__raw_writel (val, base + idx.idx); } -static inline u32 dsi_read_reg (struct platform_device *dsidev, -const struct dsi_reg idx) +static inline u32 dsi_read_reg (struct dsi_data *dsi,const struct dsi_reg idx) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);void __iomem *base;switch (idx.module) {
@@ -517,10 +515,8 @@ static void dsi_bus_unlock(struct omap_dss_device *dssdev)up (&dsi->bus_lock); } -static bool dsi_bus_is_locked (struct platform_device *dsidev) +static bool dsi_bus_is_locked (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -return dsi->bus_lock.count ==0 ; }
@@ -529,8 +525,9 @@ static void dsi_completion_handler(void *data, u32 mask)complete ((struct completion *)data); } -static inline bool wait_for_bit_change (struct platform_device *dsidev, -const struct dsi_reg idx,int bitnum,int value) +static inline bool wait_for_bit_change (struct dsi_data *dsi, +const struct dsi_reg idx, +int bitnum,int value) {unsigned long timeout;ktime_t wait;
@@ -539,14 +536,14 @@ static inline bool wait_for_bit_change(struct platform_device *dsidev,/* first busyloop to see if the bit changes right away */ t =100 ;while (t-- >0 ) { -if (REG_GET (dsidev, idx, bitnum, bitnum) == value) +if (REG_GET (dsi, idx, bitnum, bitnum) == value)return true; }/* then loop for 500ms, sleeping for 1ms in between */ timeout = jiffies +msecs_to_jiffies (500 );while (time_before (jiffies, timeout)) { -if (REG_GET (dsidev, idx, bitnum, bitnum) == value) +if (REG_GET (dsi, idx, bitnum, bitnum) == value)return true; wait =ns_to_ktime (1000 *1000 );
@@ -574,21 +571,18 @@ static u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt) }#ifdef DSI_PERF_MEASURE -static void dsi_perf_mark_setup (struct platform_device *dsidev) +static void dsi_perf_mark_setup (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); dsi->perf_setup_time =ktime_get (); } -static void dsi_perf_mark_start (struct platform_device *dsidev) +static void dsi_perf_mark_start (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); dsi->perf_start_time =ktime_get (); } -static void dsi_perf_show (struct platform_device *dsidev,const char *name) +static void dsi_perf_show (struct dsi_data *dsi,const char *name) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);ktime_t t, setup_time, trans_time;u32 total_bytes;u32 setup_us, trans_us, total_us;
@@ -622,16 +616,15 @@ static void dsi_perf_show(struct platform_device *dsidev, const char *name) total_bytes * 1000 / total_us); }#else -static inline void dsi_perf_mark_setup (struct platform_device *dsidev) +static inline void dsi_perf_mark_setup (struct dsi_data *dsi) { } -static inline void dsi_perf_mark_start (struct platform_device *dsidev) +static inline void dsi_perf_mark_start (struct dsi_data *dsi) { } -static inline void dsi_perf_show (struct platform_device *dsidev, -const char *name) +static inline void dsi_perf_show (struct dsi_data *dsi,const char *name) { }#endif
@@ -728,10 +721,9 @@ static void print_irq_status_cio(u32 status) }#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS -static void dsi_collect_irq_stats (struct platform_device *dsidev,u32 irqstatus, -u32 *vcstatus,u32 ciostatus) +static void dsi_collect_irq_stats (struct dsi_data *dsi,u32 irqstatus, +u32 *vcstatus,u32 ciostatus) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int i;spin_lock (&dsi->irq_stats_lock);
@@ -747,15 +739,14 @@ static void dsi_collect_irq_stats(struct platform_device *dsidev, u32 irqstatus, spin_unlock(&dsi->irq_stats_lock); }#else -#define dsi_collect_irq_stats (dsidev, irqstatus, vcstatus, ciostatus) +#define dsi_collect_irq_stats (dsi, irqstatus, vcstatus, ciostatus)#endif static int debug_irq; -static void dsi_handle_irq_errors (struct platform_device *dsidev,u32 irqstatus, -u32 *vcstatus,u32 ciostatus) +static void dsi_handle_irq_errors (struct dsi_data *dsi,u32 irqstatus, +u32 *vcstatus,u32 ciostatus) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int i;if (irqstatus &DSI_IRQ_ERROR_MASK ) {
@@ -824,20 +815,16 @@ static void dsi_handle_isrs(struct dsi_isr_tables *isr_tables,static irqreturn_t omap_dsi_irq_handler (int irq,void *arg) { -struct platform_device *dsidev; -struct dsi_data *dsi; +struct dsi_data *dsi = arg;u32 irqstatus, vcstatus[4 ], ciostatus;int i; - dsidev = (struct platform_device *) arg; - dsi =dsi_get_dsidrv_data (dsidev); -if (!dsi->is_enabled)return IRQ_NONE ;spin_lock (&dsi->irq_lock); - irqstatus =dsi_read_reg (dsidev,DSI_IRQSTATUS ); + irqstatus =dsi_read_reg (dsi,DSI_IRQSTATUS );/* IRQ is not for us */ if (!irqstatus) {
@@ -845,9 +832,9 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)return IRQ_NONE ; } -dsi_write_reg (dsidev,DSI_IRQSTATUS , irqstatus & ~DSI_IRQ_CHANNEL_MASK ); +dsi_write_reg (dsi,DSI_IRQSTATUS , irqstatus & ~DSI_IRQ_CHANNEL_MASK );/* flush posted write */ -dsi_read_reg (dsidev,DSI_IRQSTATUS ); +dsi_read_reg (dsi,DSI_IRQSTATUS );for (i =0 ; i <4 ; ++i) {if ((irqstatus & (1 << i)) ==0 ) {
@@ -855,19 +842,19 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)continue ; } - vcstatus[i] =dsi_read_reg (dsidev,DSI_VC_IRQSTATUS (i)); + vcstatus[i] =dsi_read_reg (dsi,DSI_VC_IRQSTATUS (i)); -dsi_write_reg (dsidev,DSI_VC_IRQSTATUS (i), vcstatus[i]); +dsi_write_reg (dsi,DSI_VC_IRQSTATUS (i), vcstatus[i]);/* flush posted write */ -dsi_read_reg (dsidev,DSI_VC_IRQSTATUS (i)); +dsi_read_reg (dsi,DSI_VC_IRQSTATUS (i)); }if (irqstatus &DSI_IRQ_COMPLEXIO_ERR ) { - ciostatus =dsi_read_reg (dsidev,DSI_COMPLEXIO_IRQ_STATUS ); + ciostatus =dsi_read_reg (dsi,DSI_COMPLEXIO_IRQ_STATUS ); -dsi_write_reg (dsidev,DSI_COMPLEXIO_IRQ_STATUS , ciostatus); +dsi_write_reg (dsi,DSI_COMPLEXIO_IRQ_STATUS , ciostatus);/* flush posted write */ -dsi_read_reg (dsidev,DSI_COMPLEXIO_IRQ_STATUS ); +dsi_read_reg (dsi,DSI_COMPLEXIO_IRQ_STATUS ); }else { ciostatus =0 ; }
@@ -886,19 +873,20 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)dsi_handle_isrs (&dsi->isr_tables_copy, irqstatus, vcstatus, ciostatus); -dsi_handle_irq_errors (dsidev, irqstatus, vcstatus, ciostatus); +dsi_handle_irq_errors (dsi, irqstatus, vcstatus, ciostatus); -dsi_collect_irq_stats (dsidev, irqstatus, vcstatus, ciostatus); +dsi_collect_irq_stats (dsi, irqstatus, vcstatus, ciostatus);return IRQ_HANDLED ; }/* dsi->irq_lock has to be locked by the caller */ -static void _omap_dsi_configure_irqs (struct platform_device *dsidev, -struct dsi_isr_data *isr_array, -unsigned int isr_array_size,u32 default_mask, -const struct dsi_reg enable_reg, -const struct dsi_reg status_reg) +static void _omap_dsi_configure_irqs (struct dsi_data *dsi, +struct dsi_isr_data *isr_array, +unsigned int isr_array_size, +u32 default_mask, +const struct dsi_reg enable_reg, +const struct dsi_reg status_reg) {struct dsi_isr_data *isr_data;u32 mask;
@@ -916,54 +904,48 @@ static void _omap_dsi_configure_irqs(struct platform_device *dsidev, mask |= isr_data->mask; } - old_mask =dsi_read_reg (dsidev, enable_reg); + old_mask =dsi_read_reg (dsi, enable_reg);/* clear the irqstatus for newly enabled irqs */ -dsi_write_reg (dsidev, status_reg, (mask ^ old_mask) & mask); -dsi_write_reg (dsidev, enable_reg, mask); +dsi_write_reg (dsi, status_reg, (mask ^ old_mask) & mask); +dsi_write_reg (dsi, enable_reg, mask);/* flush posted writes */ -dsi_read_reg (dsidev, enable_reg); -dsi_read_reg (dsidev, status_reg); +dsi_read_reg (dsi, enable_reg); +dsi_read_reg (dsi, status_reg); }/* dsi->irq_lock has to be locked by the caller */ -static void _omap_dsi_set_irqs (struct platform_device *dsidev) +static void _omap_dsi_set_irqs (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);u32 mask =DSI_IRQ_ERROR_MASK ;#ifdef DSI_CATCH_MISSING_TE mask |=DSI_IRQ_TE_TRIGGER ;#endif -_omap_dsi_configure_irqs (dsidev, dsi->isr_tables.isr_table, +_omap_dsi_configure_irqs (dsi, dsi->isr_tables.isr_table,ARRAY_SIZE (dsi->isr_tables.isr_table), mask,DSI_IRQENABLE ,DSI_IRQSTATUS ); }/* dsi->irq_lock has to be locked by the caller */ -static void _omap_dsi_set_irqs_vc (struct platform_device *dsidev,int vc) +static void _omap_dsi_set_irqs_vc (struct dsi_data *dsi,int vc) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); - -_omap_dsi_configure_irqs (dsidev, dsi->isr_tables.isr_table_vc[vc], +_omap_dsi_configure_irqs (dsi, dsi->isr_tables.isr_table_vc[vc],ARRAY_SIZE (dsi->isr_tables.isr_table_vc[vc]),DSI_VC_IRQ_ERROR_MASK ,DSI_VC_IRQENABLE (vc),DSI_VC_IRQSTATUS (vc)); }/* dsi->irq_lock has to be locked by the caller */ -static void _omap_dsi_set_irqs_cio (struct platform_device *dsidev) +static void _omap_dsi_set_irqs_cio (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); - -_omap_dsi_configure_irqs (dsidev, dsi->isr_tables.isr_table_cio, +_omap_dsi_configure_irqs (dsi, dsi->isr_tables.isr_table_cio,ARRAY_SIZE (dsi->isr_tables.isr_table_cio),DSI_CIO_IRQ_ERROR_MASK ,DSI_COMPLEXIO_IRQ_ENABLE ,DSI_COMPLEXIO_IRQ_STATUS ); } -static void _dsi_initialize_irq (struct platform_device *dsidev) +static void _dsi_initialize_irq (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);unsigned long flags;int vc;
@@ -971,10 +953,10 @@ static void _dsi_initialize_irq(struct platform_device *dsidev)memset (&dsi->isr_tables,0 ,sizeof (dsi->isr_tables)); -_omap_dsi_set_irqs (dsidev); +_omap_dsi_set_irqs (dsi);for (vc =0 ; vc <4 ; ++vc) -_omap_dsi_set_irqs_vc (dsidev, vc); -_omap_dsi_set_irqs_cio (dsidev); +_omap_dsi_set_irqs_vc (dsi, vc); +_omap_dsi_set_irqs_cio (dsi);spin_unlock_irqrestore (&dsi->irq_lock, flags); }
@@ -1035,10 +1017,9 @@ static int _dsi_unregister_isr(omap_dsi_isr_t isr, void *arg, u32 mask,return -EINVAL ; } -static int dsi_register_isr (struct platform_device *dsidev,omap_dsi_isr_t isr, -void *arg,u32 mask) +static int dsi_register_isr (struct dsi_data *dsi,omap_dsi_isr_t isr, +void *arg,u32 mask) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);unsigned long flags;int r;
@@ -1048,17 +1029,16 @@ static int dsi_register_isr(struct platform_device *dsidev, omap_dsi_isr_t isr, ARRAY_SIZE(dsi->isr_tables.isr_table));if (r ==0 ) -_omap_dsi_set_irqs (dsidev); +_omap_dsi_set_irqs (dsi);spin_unlock_irqrestore (&dsi->irq_lock, flags);return r; } -static int dsi_unregister_isr (struct platform_device *dsidev, -omap_dsi_isr_t isr,void *arg,u32 mask) +static int dsi_unregister_isr (struct dsi_data *dsi,omap_dsi_isr_t isr, +void *arg,u32 mask) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);unsigned long flags;int r;
@@ -1068,17 +1048,16 @@ static int dsi_unregister_isr(struct platform_device *dsidev, ARRAY_SIZE(dsi->isr_tables.isr_table));if (r ==0 ) -_omap_dsi_set_irqs (dsidev); +_omap_dsi_set_irqs (dsi);spin_unlock_irqrestore (&dsi->irq_lock, flags);return r; } -static int dsi_register_isr_vc (struct platform_device *dsidev,int channel, -omap_dsi_isr_t isr,void *arg,u32 mask) +static int dsi_register_isr_vc (struct dsi_data *dsi,int channel, +omap_dsi_isr_t isr,void *arg,u32 mask) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);unsigned long flags;int r;
@@ -1089,17 +1068,16 @@ static int dsi_register_isr_vc(struct platform_device *dsidev, int channel, ARRAY_SIZE(dsi->isr_tables.isr_table_vc[channel]));if (r ==0 ) -_omap_dsi_set_irqs_vc (dsidev, channel); +_omap_dsi_set_irqs_vc (dsi, channel);spin_unlock_irqrestore (&dsi->irq_lock, flags);return r; } -static int dsi_unregister_isr_vc (struct platform_device *dsidev,int channel, -omap_dsi_isr_t isr,void *arg,u32 mask) +static int dsi_unregister_isr_vc (struct dsi_data *dsi,int channel, +omap_dsi_isr_t isr,void *arg,u32 mask) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);unsigned long flags;int r;
@@ -1110,17 +1088,16 @@ static int dsi_unregister_isr_vc(struct platform_device *dsidev, int channel, ARRAY_SIZE(dsi->isr_tables.isr_table_vc[channel]));if (r ==0 ) -_omap_dsi_set_irqs_vc (dsidev, channel); +_omap_dsi_set_irqs_vc (dsi, channel);spin_unlock_irqrestore (&dsi->irq_lock, flags);return r; } -static int dsi_register_isr_cio (struct platform_device *dsidev, -omap_dsi_isr_t isr,void *arg,u32 mask) +static int dsi_register_isr_cio (struct dsi_data *dsi,omap_dsi_isr_t isr, +void *arg,u32 mask) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);unsigned long flags;int r;
@@ -1130,17 +1107,16 @@ static int dsi_register_isr_cio(struct platform_device *dsidev, ARRAY_SIZE(dsi->isr_tables.isr_table_cio));if (r ==0 ) -_omap_dsi_set_irqs_cio (dsidev); +_omap_dsi_set_irqs_cio (dsi);spin_unlock_irqrestore (&dsi->irq_lock, flags);return r; } -static int dsi_unregister_isr_cio (struct platform_device *dsidev, -omap_dsi_isr_t isr,void *arg,u32 mask) +static int dsi_unregister_isr_cio (struct dsi_data *dsi,omap_dsi_isr_t isr, +void *arg,u32 mask) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);unsigned long flags;int r;
@@ -1150,18 +1126,18 @@ static int dsi_unregister_isr_cio(struct platform_device *dsidev, ARRAY_SIZE(dsi->isr_tables.isr_table_cio));if (r ==0 ) -_omap_dsi_set_irqs_cio (dsidev); +_omap_dsi_set_irqs_cio (dsi);spin_unlock_irqrestore (&dsi->irq_lock, flags);return r; } -static u32 dsi_get_errors (struct platform_device *dsidev) +static u32 dsi_get_errors (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);unsigned long flags;u32 e; +spin_lock_irqsave (&dsi->errors_lock, flags); e = dsi->errors; dsi->errors =0 ;
@@ -1169,10 +1145,9 @@ static u32 dsi_get_errors(struct platform_device *dsidev)return e; } -static int dsi_runtime_get (struct platform_device *dsidev) +static int dsi_runtime_get (struct dsi_data *dsi) {int r; -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);DSSDBG ("dsi_runtime_get\n" );
@@ -1181,9 +1156,8 @@ static int dsi_runtime_get(struct platform_device *dsidev)return r <0 ? r :0 ; } -static void dsi_runtime_put (struct platform_device *dsidev) +static void dsi_runtime_put (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int r;DSSDBG ("dsi_runtime_put\n" );
@@ -1192,9 +1166,8 @@ static void dsi_runtime_put(struct platform_device *dsidev)WARN_ON (r <0 && r != -ENOSYS ); } -static int dsi_regulator_init (struct platform_device *dsidev) +static int dsi_regulator_init (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);struct regulator *vdds_dsi;if (dsi->vdds_dsi_reg !=NULL )
@@ -1213,16 +1186,15 @@ static int dsi_regulator_init(struct platform_device *dsidev)return 0 ; } -static void _dsi_print_reset_status (struct platform_device *dsidev) +static void _dsi_print_reset_status (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);u32 l;int b0, b1, b2;/* A dummy read using the SCP interface to any DSIPHY register is * required after DSIPHY reset to complete the reset of the DSI complex * I/O. */ - l =dsi_read_reg (dsidev,DSI_DSIPHY_CFG5 ); + l =dsi_read_reg (dsi,DSI_DSIPHY_CFG5 );if (dsi->data->quirks &DSI_QUIRK_REVERSE_TXCLKESC ) { b0 =28 ;
@@ -1235,7 +1207,7 @@ static void _dsi_print_reset_status(struct platform_device *dsidev) }#define DSI_FLD_GET (fld, start, end)\ - FLD_GET(dsi_read_reg(dsidev, DSI_##fld), start, end) + FLD_GET(dsi_read_reg(dsi, DSI_##fld), start, end) pr_debug("DSI resets: PLL (%d) CIO (%d) PHY (%x%x%x, %d, %d, %d)\n", DSI_FLD_GET(PLL_STATUS, 0, 0),
@@ -1250,14 +1222,14 @@ static void _dsi_print_reset_status(struct platform_device *dsidev)#undef DSI_FLD_GET } -static inline int dsi_if_enable (struct platform_device *dsidev,bool enable) +static inline int dsi_if_enable (struct dsi_data *dsi,bool enable) {DSSDBG ("dsi_if_enable(%d)\n" , enable); enable = enable ?1 :0 ; -REG_FLD_MOD (dsidev,DSI_CTRL , enable,0 ,0 );/* IF_EN */ +REG_FLD_MOD (dsi,DSI_CTRL , enable,0 ,0 );/* IF_EN */ -if (!wait_for_bit_change (dsidev,DSI_CTRL ,0 , enable)) { +if (!wait_for_bit_change (dsi,DSI_CTRL ,0 , enable)) {DSSERR ("Failed to set dsi_if_enable to %d\n" , enable);return -EIO ; }
@@ -1265,31 +1237,24 @@ static inline int dsi_if_enable(struct platform_device *dsidev, bool enable)return 0 ; } -static unsigned long dsi_get_pll_hsdiv_dispc_rate (struct platform_device *dsidev) +static unsigned long dsi_get_pll_hsdiv_dispc_rate (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -return dsi->pll.cinfo.clkout[HSDIV_DISPC ]; } -static unsigned long dsi_get_pll_hsdiv_dsi_rate (struct platform_device *dsidev) +static unsigned long dsi_get_pll_hsdiv_dsi_rate (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -return dsi->pll.cinfo.clkout[HSDIV_DSI ]; } -static unsigned long dsi_get_txbyteclkhs (struct platform_device *dsidev) +static unsigned long dsi_get_txbyteclkhs (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -return dsi->pll.cinfo.clkdco /16 ; } -static unsigned long dsi_fclk_rate (struct platform_device *dsidev) +static unsigned long dsi_fclk_rate (struct dsi_data *dsi) {unsigned long r; -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);enum dss_clk_source source; source =dss_get_dsi_clk_source (dsi->dss, dsi->module_id);
@@ -1298,7 +1263,7 @@ static unsigned long dsi_fclk_rate(struct platform_device *dsidev) r =clk_get_rate (dsi->dss_clk); }else {/* DSI FCLK source is dsi_pll_hsdiv_dsi_clk */ - r =dsi_get_pll_hsdiv_dsi_rate (dsidev); + r =dsi_get_pll_hsdiv_dsi_rate (dsi); }return r;
@@ -1323,9 +1288,8 @@ static int dsi_lp_clock_calc(unsigned long dsi_fclk,return 0 ; } -static int dsi_set_lp_clk_divisor (struct platform_device *dsidev) +static int dsi_set_lp_clk_divisor (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);unsigned long dsi_fclk;unsigned int lp_clk_div;unsigned long lp_clk;
@@ -1337,7 +1301,7 @@ static int dsi_set_lp_clk_divisor(struct platform_device *dsidev)if (lp_clk_div ==0 || lp_clk_div > lpdiv_max)return -EINVAL ; - dsi_fclk =dsi_fclk_rate (dsidev); + dsi_fclk =dsi_fclk_rate (dsi); lp_clk = dsi_fclk /2 / lp_clk_div;
@@ -1346,29 +1310,25 @@ static int dsi_set_lp_clk_divisor(struct platform_device *dsidev) dsi->current_lp_cinfo.lp_clk_div = lp_clk_div;/* LP_CLK_DIVISOR */ -REG_FLD_MOD (dsidev,DSI_CLK_CTRL , lp_clk_div,12 ,0 ); +REG_FLD_MOD (dsi,DSI_CLK_CTRL , lp_clk_div,12 ,0 );/* LP_RX_SYNCHRO_ENABLE */ -REG_FLD_MOD (dsidev,DSI_CLK_CTRL , dsi_fclk >30000000 ?1 :0 ,21 ,21 ); +REG_FLD_MOD (dsi,DSI_CLK_CTRL , dsi_fclk >30000000 ?1 :0 ,21 ,21 );return 0 ; } -static void dsi_enable_scp_clk (struct platform_device *dsidev) +static void dsi_enable_scp_clk (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -if (dsi->scp_clk_refcount++ ==0 ) -REG_FLD_MOD (dsidev,DSI_CLK_CTRL ,1 ,14 ,14 );/* CIO_CLK_ICG */ +REG_FLD_MOD (dsi,DSI_CLK_CTRL ,1 ,14 ,14 );/* CIO_CLK_ICG */ } -static void dsi_disable_scp_clk (struct platform_device *dsidev) +static void dsi_disable_scp_clk (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -WARN_ON (dsi->scp_clk_refcount ==0 );if (--dsi->scp_clk_refcount ==0 ) -REG_FLD_MOD (dsidev,DSI_CLK_CTRL ,0 ,14 ,14 );/* CIO_CLK_ICG */ +REG_FLD_MOD (dsi,DSI_CLK_CTRL ,0 ,14 ,14 );/* CIO_CLK_ICG */ }enum dsi_pll_power_state {
@@ -1378,10 +1338,8 @@ enum dsi_pll_power_state { DSI_PLL_POWER_ON_DIV = 0x3, }; -static int dsi_pll_power (struct platform_device *dsidev, -enum dsi_pll_power_state state) +static int dsi_pll_power (struct dsi_data *dsi,enum dsi_pll_power_state state) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int t =0 ;/* DSI-PLL power command 0x3 is not working */
@@ -1390,10 +1348,10 @@ static int dsi_pll_power(struct platform_device *dsidev, state =DSI_PLL_POWER_ON_ALL ;/* PLL_PWR_CMD */ -REG_FLD_MOD (dsidev,DSI_CLK_CTRL , state,31 ,30 ); +REG_FLD_MOD (dsi,DSI_CLK_CTRL , state,31 ,30 );/* PLL_PWR_STATUS */ -while (FLD_GET (dsi_read_reg (dsidev,DSI_CLK_CTRL ),29 ,28 ) != state) { +while (FLD_GET (dsi_read_reg (dsi,DSI_CLK_CTRL ),29 ,28 ) != state) {if (++t >1000 ) {DSSERR ("Failed to set DSI PLL power mode to %d\n" , state);
@@ -1420,23 +1378,22 @@ static void dsi_pll_calc_dsi_fck(struct dsi_data *dsi,static int dsi_pll_enable (struct dss_pll *pll) { struct dsi_data *dsi = container_of(pll, struct dsi_data, pll); -struct platform_device *dsidev = dsi->pdev;int r =0 ;DSSDBG ("PLL init\n" ); - r =dsi_regulator_init (dsidev); + r =dsi_regulator_init (dsi);if (r)return r; - r =dsi_runtime_get (dsidev); + r =dsi_runtime_get (dsi);if (r)return r;/* * Note: SCP CLK is not required on OMAP3, but it is required on OMAP4. */ -dsi_enable_scp_clk (dsidev); +dsi_enable_scp_clk (dsi);if (!dsi->vdds_dsi_enabled) { r =regulator_enable (dsi->vdds_dsi_reg);
@@ -1448,7 +1405,7 @@ static int dsi_pll_enable(struct dss_pll *pll)/* XXX PLL does not come out of reset without this... */ dispc_pck_free_enable (1 ); -if (!wait_for_bit_change (dsidev,DSI_PLL_STATUS ,0 ,1 )) { +if (!wait_for_bit_change (dsi,DSI_PLL_STATUS ,0 ,1 )) {DSSERR ("PLL not coming out of reset.\n" ); r = -ENODEV ;dispc_pck_free_enable (0 );
@@ -1459,7 +1416,7 @@ static int dsi_pll_enable(struct dss_pll *pll)* fill the whole display. No idea about this */ dispc_pck_free_enable (0 ); - r =dsi_pll_power (dsidev,DSI_PLL_POWER_ON_ALL ); + r =dsi_pll_power (dsi,DSI_PLL_POWER_ON_ALL );if (r) goto err1;
@@ -1473,24 +1430,22 @@ static int dsi_pll_enable(struct dss_pll *pll) dsi->vdds_dsi_enabled = false; } err0: -dsi_disable_scp_clk (dsidev); -dsi_runtime_put (dsidev); +dsi_disable_scp_clk (dsi); +dsi_runtime_put (dsi);return r; } -static void dsi_pll_uninit (struct platform_device *dsidev,bool disconnect_lanes) +static void dsi_pll_uninit (struct dsi_data *dsi,bool disconnect_lanes) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); - -dsi_pll_power (dsidev,DSI_PLL_POWER_OFF ); +dsi_pll_power (dsi,DSI_PLL_POWER_OFF );if (disconnect_lanes) {WARN_ON (!dsi->vdds_dsi_enabled);regulator_disable (dsi->vdds_dsi_reg); dsi->vdds_dsi_enabled = false; } -dsi_disable_scp_clk (dsidev); -dsi_runtime_put (dsidev); +dsi_disable_scp_clk (dsi); +dsi_runtime_put (dsi);DSSDBG ("PLL uninit done\n" ); }
@@ -1498,15 +1453,12 @@ static void dsi_pll_uninit(struct platform_device *dsidev, bool disconnect_lanesstatic void dsi_pll_disable (struct dss_pll *pll) { struct dsi_data *dsi = container_of(pll, struct dsi_data, pll); -struct platform_device *dsidev = dsi->pdev; -dsi_pll_uninit (dsidev, true); +dsi_pll_uninit (dsi, true); } -static void dsi_dump_dsidev_clocks (struct platform_device *dsidev, -struct seq_file *s) +static void dsi_dump_dsi_clocks (struct dsi_data *dsi,struct seq_file *s) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);struct dss_pll_clock_info *cinfo = &dsi->pll.cinfo;enum dss_clk_source dispc_clk_src, dsi_clk_src;int dsi_module = dsi->module_id;
@@ -1515,7 +1467,7 @@ static void dsi_dump_dsidev_clocks(struct platform_device *dsidev, dispc_clk_src =dss_get_dispc_clk_source (dsi->dss); dsi_clk_src =dss_get_dsi_clk_source (dsi->dss, dsi_module); -if (dsi_runtime_get (dsidev)) +if (dsi_runtime_get (dsi))return ;seq_printf (s,"- DSI%d PLL -\n" , dsi_module +1 );
@@ -1550,35 +1502,33 @@ static void dsi_dump_dsidev_clocks(struct platform_device *dsidev,seq_printf (s,"dsi fclk source = %s\n" ,dss_get_clk_source_name (dsi_clk_src)); -seq_printf (s,"DSI_FCLK\t%lu\n" ,dsi_fclk_rate (dsidev)); +seq_printf (s,"DSI_FCLK\t%lu\n" ,dsi_fclk_rate (dsi));seq_printf (s,"DDR_CLK\t\t%lu\n" , cinfo->clkdco /4 ); -seq_printf (s,"TxByteClkHS\t%lu\n" ,dsi_get_txbyteclkhs (dsidev)); +seq_printf (s,"TxByteClkHS\t%lu\n" ,dsi_get_txbyteclkhs (dsi));seq_printf (s,"LP_CLK\t\t%lu\n" , dsi->current_lp_cinfo.lp_clk); -dsi_runtime_put (dsidev); +dsi_runtime_put (dsi); }void dsi_dump_clocks (struct seq_file *s) { -struct platform_device *dsidev; +struct dsi_data *dsi;int i;for (i =0 ; i <MAX_NUM_DSI ; i++) { - dsidev =dsi_get_dsidev_from_id (i); -if (dsidev) -dsi_dump_dsidev_clocks (dsidev, s); + dsi =dsi_get_dsi_from_id (i); +if (dsi) +dsi_dump_dsi_clocks (dsi, s); } }#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS -static void dsi_dump_dsidev_irqs (struct platform_device *dsidev, -struct seq_file *s) +static void dsi_dump_dsi_irqs (struct dsi_data *dsi,struct seq_file *s) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);unsigned long flags;struct dsi_irq_stats stats;
@@ -1666,29 +1616,28 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,static int dsi1_dump_irqs (struct seq_file *s,void *p) { -struct platform_device *dsidev =dsi_get_dsidev_from_id (0 ); +struct dsi_data *dsi =dsi_get_dsi_from_id (0 ); -dsi_dump_dsidev_irqs (dsidev, s); +dsi_dump_dsi_irqs (dsi, s);return 0 ; }static int dsi2_dump_irqs (struct seq_file *s,void *p) { -struct platform_device *dsidev =dsi_get_dsidev_from_id (1 ); +struct dsi_data *dsi =dsi_get_dsi_from_id (1 ); -dsi_dump_dsidev_irqs (dsidev, s); +dsi_dump_dsi_irqs (dsi, s);return 0 ; }#endif -static void dsi_dump_dsidev_regs (struct platform_device *dsidev, -struct seq_file *s) +static void dsi_dump_dsi_regs (struct dsi_data *dsi,struct seq_file *s) { -#define DUMPREG (r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(dsidev, r)) +#define DUMPREG (r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(dsi, r)) -if (dsi_runtime_get (dsidev)) +if (dsi_runtime_get (dsi))return ; -dsi_enable_scp_clk (dsidev); +dsi_enable_scp_clk (dsi);DUMPREG (DSI_REVISION );DUMPREG (DSI_SYSCONFIG );
@@ -1760,24 +1709,24 @@ static void dsi_dump_dsidev_regs(struct platform_device *dsidev,DUMPREG (DSI_PLL_CONFIGURATION1 );DUMPREG (DSI_PLL_CONFIGURATION2 ); -dsi_disable_scp_clk (dsidev); -dsi_runtime_put (dsidev); +dsi_disable_scp_clk (dsi); +dsi_runtime_put (dsi);#undef DUMPREG }static int dsi1_dump_regs (struct seq_file *s,void *p) { -struct platform_device *dsidev =dsi_get_dsidev_from_id (0 ); +struct dsi_data *dsi =dsi_get_dsi_from_id (0 ); -dsi_dump_dsidev_regs (dsidev, s); +dsi_dump_dsi_regs (dsi, s);return 0 ; }static int dsi2_dump_regs (struct seq_file *s,void *p) { -struct platform_device *dsidev =dsi_get_dsidev_from_id (1 ); +struct dsi_data *dsi =dsi_get_dsi_from_id (1 ); -dsi_dump_dsidev_regs (dsidev, s); +dsi_dump_dsi_regs (dsi, s);return 0 ; }
@@ -1787,16 +1736,15 @@ enum dsi_cio_power_state { DSI_COMPLEXIO_POWER_ULPS = 0x2, }; -static int dsi_cio_power (struct platform_device *dsidev, -enum dsi_cio_power_state state) +static int dsi_cio_power (struct dsi_data *dsi,enum dsi_cio_power_state state) {int t =0 ;/* PWR_CMD */ -REG_FLD_MOD (dsidev,DSI_COMPLEXIO_CFG1 , state,28 ,27 ); +REG_FLD_MOD (dsi,DSI_COMPLEXIO_CFG1 , state,28 ,27 );/* PWR_STATUS */ -while (FLD_GET (dsi_read_reg (dsidev,DSI_COMPLEXIO_CFG1 ), +while (FLD_GET (dsi_read_reg (dsi,DSI_COMPLEXIO_CFG1 ),26 ,25 ) != state) {if (++t >1000 ) { DSSERR("failed to set complexio power state to "
@@ -1809,9 +1757,8 @@ static int dsi_cio_power(struct platform_device *dsidev,return 0 ; } -static unsigned int dsi_get_line_buf_size (struct platform_device *dsidev) +static unsigned int dsi_get_line_buf_size (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int val;/* line buffer on OMAP3 is 1024 x 24bits */
@@ -1821,7 +1768,7 @@ static unsigned int dsi_get_line_buf_size(struct platform_device *dsidev)if (!(dsi->data->quirks &DSI_QUIRK_GNQ ))return 1023 *3 ; - val =REG_GET (dsidev,DSI_GNQ ,14 ,12 );/* VP1_LINE_BUFFER_SIZE */ + val =REG_GET (dsi,DSI_GNQ ,14 ,12 );/* VP1_LINE_BUFFER_SIZE */ switch (val) {case 1 :
@@ -1844,9 +1791,8 @@ static unsigned int dsi_get_line_buf_size(struct platform_device *dsidev) } } -static int dsi_set_lane_config (struct platform_device *dsidev) +static int dsi_set_lane_config (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);static const u8 offsets[] = {0 ,4 ,8 ,12 ,16 };static const enum dsi_lane_function functions[] = {DSI_LANE_CLK ,
@@ -1858,7 +1804,7 @@ static int dsi_set_lane_config(struct platform_device *dsidev)u32 r;int i; - r =dsi_read_reg (dsidev,DSI_COMPLEXIO_CFG1 ); + r =dsi_read_reg (dsi,DSI_COMPLEXIO_CFG1 );for (i =0 ; i < dsi->num_lanes_used; ++i) {unsigned int offset = offsets[i];
@@ -1887,33 +1833,28 @@ static int dsi_set_lane_config(struct platform_device *dsidev) r =FLD_MOD (r,0 , offset +3 , offset +3 ); } -dsi_write_reg (dsidev,DSI_COMPLEXIO_CFG1 , r); +dsi_write_reg (dsi,DSI_COMPLEXIO_CFG1 , r);return 0 ; } -static inline unsigned int ns2ddr (struct platform_device *dsidev, -unsigned int ns) +static inline unsigned int ns2ddr (struct dsi_data *dsi,unsigned int ns) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -/* convert time in ns to ddr ticks, rounding up */ unsigned long ddr_clk = dsi->pll.cinfo.clkdco /4 ; +return (ns * (ddr_clk /1000 /1000 ) +999 ) /1000 ; } -static inline unsigned int ddr2ns (struct platform_device *dsidev, -unsigned int ddr) +static inline unsigned int ddr2ns (struct dsi_data *dsi,unsigned int ddr) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -unsigned long ddr_clk = dsi->pll.cinfo.clkdco /4 ; +return ddr *1000 *1000 / (ddr_clk /1000 ); } -static void dsi_cio_timings (struct platform_device *dsidev) +static void dsi_cio_timings (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);u32 r;u32 ths_prepare, ths_prepare_ths_zero, ths_trail, ths_exit;u32 tlpx_half, tclk_trail, tclk_zero;
@@ -1924,54 +1865,54 @@ static void dsi_cio_timings(struct platform_device *dsidev)/* 1 * DDR_CLK = 2 * UI */ /* min 40ns + 4*UI max 85ns + 6*UI */ - ths_prepare =ns2ddr (dsidev,70 ) +2 ; + ths_prepare =ns2ddr (dsi,70 ) +2 ;/* min 145ns + 10*UI */ - ths_prepare_ths_zero =ns2ddr (dsidev,175 ) +2 ; + ths_prepare_ths_zero =ns2ddr (dsi,175 ) +2 ;/* min max(8*UI, 60ns+4*UI) */ - ths_trail =ns2ddr (dsidev,60 ) +5 ; + ths_trail =ns2ddr (dsi,60 ) +5 ;/* min 100ns */ - ths_exit =ns2ddr (dsidev,145 ); + ths_exit =ns2ddr (dsi,145 );/* tlpx min 50n */ - tlpx_half =ns2ddr (dsidev,25 ); + tlpx_half =ns2ddr (dsi,25 );/* min 60ns */ - tclk_trail =ns2ddr (dsidev,60 ) +2 ; + tclk_trail =ns2ddr (dsi,60 ) +2 ;/* min 38ns, max 95ns */ - tclk_prepare =ns2ddr (dsidev,65 ); + tclk_prepare =ns2ddr (dsi,65 );/* min tclk-prepare + tclk-zero = 300ns */ - tclk_zero =ns2ddr (dsidev,260 ); + tclk_zero =ns2ddr (dsi,260 );DSSDBG ("ths_prepare %u (%uns), ths_prepare_ths_zero %u (%uns)\n" , - ths_prepare,ddr2ns (dsidev, ths_prepare), - ths_prepare_ths_zero,ddr2ns (dsidev, ths_prepare_ths_zero)); + ths_prepare,ddr2ns (dsi, ths_prepare), + ths_prepare_ths_zero,ddr2ns (dsi, ths_prepare_ths_zero));DSSDBG ("ths_trail %u (%uns), ths_exit %u (%uns)\n" , - ths_trail,ddr2ns (dsidev, ths_trail), - ths_exit,ddr2ns (dsidev, ths_exit)); + ths_trail,ddr2ns (dsi, ths_trail), + ths_exit,ddr2ns (dsi, ths_exit));DSSDBG ("tlpx_half %u (%uns), tclk_trail %u (%uns), " "tclk_zero %u (%uns)\n" , - tlpx_half,ddr2ns (dsidev, tlpx_half), - tclk_trail,ddr2ns (dsidev, tclk_trail), - tclk_zero,ddr2ns (dsidev, tclk_zero)); + tlpx_half,ddr2ns (dsi, tlpx_half), + tclk_trail,ddr2ns (dsi, tclk_trail), + tclk_zero,ddr2ns (dsi, tclk_zero));DSSDBG ("tclk_prepare %u (%uns)\n" , - tclk_prepare,ddr2ns (dsidev, tclk_prepare)); + tclk_prepare,ddr2ns (dsi, tclk_prepare));/* program timings */ - r =dsi_read_reg (dsidev,DSI_DSIPHY_CFG0 ); + r =dsi_read_reg (dsi,DSI_DSIPHY_CFG0 ); r =FLD_MOD (r, ths_prepare,31 ,24 ); r =FLD_MOD (r, ths_prepare_ths_zero,23 ,16 ); r =FLD_MOD (r, ths_trail,15 ,8 ); r =FLD_MOD (r, ths_exit,7 ,0 ); -dsi_write_reg (dsidev,DSI_DSIPHY_CFG0 , r); +dsi_write_reg (dsi,DSI_DSIPHY_CFG0 , r); - r =dsi_read_reg (dsidev,DSI_DSIPHY_CFG1 ); + r =dsi_read_reg (dsi,DSI_DSIPHY_CFG1 ); r =FLD_MOD (r, tlpx_half,20 ,16 ); r =FLD_MOD (r, tclk_trail,15 ,8 ); r =FLD_MOD (r, tclk_zero,7 ,0 );
@@ -1982,18 +1923,18 @@ static void dsi_cio_timings(struct platform_device *dsidev) r =FLD_MOD (r,1 ,23 ,23 );/* CLKINP_SEL = enable */ } -dsi_write_reg (dsidev,DSI_DSIPHY_CFG1 , r); +dsi_write_reg (dsi,DSI_DSIPHY_CFG1 , r); - r =dsi_read_reg (dsidev,DSI_DSIPHY_CFG2 ); + r =dsi_read_reg (dsi,DSI_DSIPHY_CFG2 ); r =FLD_MOD (r, tclk_prepare,7 ,0 ); -dsi_write_reg (dsidev,DSI_DSIPHY_CFG2 , r); +dsi_write_reg (dsi,DSI_DSIPHY_CFG2 , r); }/* lane masks have lane 0 at lsb. mask_p for positive lines, n for negative */ -static void dsi_cio_enable_lane_override (struct platform_device *dsidev, -unsigned int mask_p,unsigned int mask_n) +static void dsi_cio_enable_lane_override (struct dsi_data *dsi, +unsigned int mask_p, +unsigned int mask_n) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int i;u32 l;u8 lptxscp_start = dsi->num_lanes_supported ==3 ?22 :26 ;
@@ -2022,26 +1963,25 @@ static void dsi_cio_enable_lane_override(struct platform_device *dsidev,/* Set the lane override configuration */ /* REGLPTXSCPDAT4TO0DXDY */ -REG_FLD_MOD (dsidev,DSI_DSIPHY_CFG10 , l, lptxscp_start,17 ); +REG_FLD_MOD (dsi,DSI_DSIPHY_CFG10 , l, lptxscp_start,17 );/* Enable lane override */ /* ENLPTXSCPDAT */ -REG_FLD_MOD (dsidev,DSI_DSIPHY_CFG10 ,1 ,27 ,27 ); +REG_FLD_MOD (dsi,DSI_DSIPHY_CFG10 ,1 ,27 ,27 ); } -static void dsi_cio_disable_lane_override (struct platform_device *dsidev) +static void dsi_cio_disable_lane_override (struct dsi_data *dsi) {/* Disable lane override */ -REG_FLD_MOD (dsidev,DSI_DSIPHY_CFG10 ,0 ,27 ,27 );/* ENLPTXSCPDAT */ +REG_FLD_MOD (dsi,DSI_DSIPHY_CFG10 ,0 ,27 ,27 );/* ENLPTXSCPDAT */ /* Reset the lane override configuration */ /* REGLPTXSCPDAT4TO0DXDY */ -REG_FLD_MOD (dsidev,DSI_DSIPHY_CFG10 ,0 ,22 ,17 ); +REG_FLD_MOD (dsi,DSI_DSIPHY_CFG10 ,0 ,22 ,17 ); } -static int dsi_cio_wait_tx_clk_esc_reset (struct platform_device *dsidev) +static int dsi_cio_wait_tx_clk_esc_reset (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int t, i;bool in_use[DSI_MAX_NR_LANES ];static const u8 offsets_old[] = {28 ,27 ,26 };
@@ -2061,7 +2001,7 @@ static int dsi_cio_wait_tx_clk_esc_reset(struct platform_device *dsidev)u32 l;int ok; - l =dsi_read_reg (dsidev,DSI_DSIPHY_CFG5 ); + l =dsi_read_reg (dsi,DSI_DSIPHY_CFG5 ); ok =0 ;for (i =0 ; i < dsi->num_lanes_supported; ++i) {
@@ -2088,9 +2028,8 @@ static int dsi_cio_wait_tx_clk_esc_reset(struct platform_device *dsidev) }/* return bitmask of enabled lanes, lane0 being the lsb */ -static unsigned int dsi_get_lane_mask (struct platform_device *dsidev) +static unsigned int dsi_get_lane_mask (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);unsigned int mask =0 ;int i;
@@ -2179,42 +2118,41 @@ static void dsi_disable_pads(struct dsi_data *dsi)dsi_omap5_mux_pads (dsi,0 ); } -static int dsi_cio_init (struct platform_device *dsidev) +static int dsi_cio_init (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int r;u32 l;DSSDBG ("DSI CIO init starts" ); - r =dsi_enable_pads (dsi,dsi_get_lane_mask (dsidev)); + r =dsi_enable_pads (dsi,dsi_get_lane_mask (dsi));if (r)return r; -dsi_enable_scp_clk (dsidev); +dsi_enable_scp_clk (dsi);/* A dummy read using the SCP interface to any DSIPHY register is * required after DSIPHY reset to complete the reset of the DSI complex * I/O. */ -dsi_read_reg (dsidev,DSI_DSIPHY_CFG5 ); +dsi_read_reg (dsi,DSI_DSIPHY_CFG5 ); -if (!wait_for_bit_change (dsidev,DSI_DSIPHY_CFG5 ,30 ,1 )) { +if (!wait_for_bit_change (dsi,DSI_DSIPHY_CFG5 ,30 ,1 )) {DSSERR ("CIO SCP Clock domain not coming out of reset.\n" ); r = -EIO ; goto err_scp_clk_dom; } - r =dsi_set_lane_config (dsidev); + r =dsi_set_lane_config (dsi);if (r) goto err_scp_clk_dom;/* set TX STOP MODE timer to maximum for this operation */ - l =dsi_read_reg (dsidev,DSI_TIMING1 ); + l =dsi_read_reg (dsi,DSI_TIMING1 ); l =FLD_MOD (l,1 ,15 ,15 );/* FORCE_TX_STOP_MODE_IO */ l =FLD_MOD (l,1 ,14 ,14 );/* STOP_STATE_X16_IO */ l =FLD_MOD (l,1 ,13 ,13 );/* STOP_STATE_X4_IO */ l =FLD_MOD (l,0x1fff ,12 ,0 );/* STOP_STATE_COUNTER_IO */ -dsi_write_reg (dsidev,DSI_TIMING1 , l); +dsi_write_reg (dsi,DSI_TIMING1 , l);if (dsi->ulps_enabled) {unsigned int mask_p;
@@ -2239,24 +2177,24 @@ static int dsi_cio_init(struct platform_device *dsidev) mask_p |=1 << i; } -dsi_cio_enable_lane_override (dsidev, mask_p,0 ); +dsi_cio_enable_lane_override (dsi, mask_p,0 ); } - r =dsi_cio_power (dsidev,DSI_COMPLEXIO_POWER_ON ); + r =dsi_cio_power (dsi,DSI_COMPLEXIO_POWER_ON );if (r) goto err_cio_pwr; -if (!wait_for_bit_change (dsidev,DSI_COMPLEXIO_CFG1 ,29 ,1 )) { +if (!wait_for_bit_change (dsi,DSI_COMPLEXIO_CFG1 ,29 ,1 )) {DSSERR ("CIO PWR clock domain not coming out of reset.\n" ); r = -ENODEV ; goto err_cio_pwr_dom; } -dsi_if_enable (dsidev, true); -dsi_if_enable (dsidev, false); -REG_FLD_MOD (dsidev,DSI_CLK_CTRL ,1 ,20 ,20 );/* LP_CLK_ENABLE */ +dsi_if_enable (dsi, true); +dsi_if_enable (dsi, false); +REG_FLD_MOD (dsi,DSI_CLK_CTRL ,1 ,20 ,20 );/* LP_CLK_ENABLE */ - r =dsi_cio_wait_tx_clk_esc_reset (dsidev); + r =dsi_cio_wait_tx_clk_esc_reset (dsi);if (r) goto err_tx_clk_esc_rst;
@@ -2268,17 +2206,17 @@ static int dsi_cio_init(struct platform_device *dsidev)/* Disable the override. The lanes should be set to Mark-11 * state by the HW */ -dsi_cio_disable_lane_override (dsidev); +dsi_cio_disable_lane_override (dsi); }/* FORCE_TX_STOP_MODE_IO */ -REG_FLD_MOD (dsidev,DSI_TIMING1 ,0 ,15 ,15 ); +REG_FLD_MOD (dsi,DSI_TIMING1 ,0 ,15 ,15 ); -dsi_cio_timings (dsidev); +dsi_cio_timings (dsi);if (dsi->mode ==OMAP_DSS_DSI_VIDEO_MODE ) {/* DDR_CLK_ALWAYS_ON */ -REG_FLD_MOD (dsidev,DSI_CLK_CTRL , +REG_FLD_MOD (dsi,DSI_CLK_CTRL , dsi->vm_timings.ddr_clk_always_on,13 ,13 ); }
@@ -2289,35 +2227,32 @@ static int dsi_cio_init(struct platform_device *dsidev)return 0 ; err_tx_clk_esc_rst: -REG_FLD_MOD (dsidev,DSI_CLK_CTRL ,0 ,20 ,20 );/* LP_CLK_ENABLE */ +REG_FLD_MOD (dsi,DSI_CLK_CTRL ,0 ,20 ,20 );/* LP_CLK_ENABLE */ err_cio_pwr_dom: -dsi_cio_power (dsidev,DSI_COMPLEXIO_POWER_OFF ); +dsi_cio_power (dsi,DSI_COMPLEXIO_POWER_OFF ); err_cio_pwr:if (dsi->ulps_enabled) -dsi_cio_disable_lane_override (dsidev); +dsi_cio_disable_lane_override (dsi); err_scp_clk_dom: -dsi_disable_scp_clk (dsidev); +dsi_disable_scp_clk (dsi);dsi_disable_pads (dsi);return r; } -static void dsi_cio_uninit (struct platform_device *dsidev) +static void dsi_cio_uninit (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -/* DDR_CLK_ALWAYS_ON */ -REG_FLD_MOD (dsidev,DSI_CLK_CTRL ,0 ,13 ,13 ); +REG_FLD_MOD (dsi,DSI_CLK_CTRL ,0 ,13 ,13 ); -dsi_cio_power (dsidev,DSI_COMPLEXIO_POWER_OFF ); -dsi_disable_scp_clk (dsidev); +dsi_cio_power (dsi,DSI_COMPLEXIO_POWER_OFF ); +dsi_disable_scp_clk (dsi);dsi_disable_pads (dsi); } -static void dsi_config_tx_fifo (struct platform_device *dsidev, -enum fifo_size size1,enum fifo_size size2, -enum fifo_size size3,enum fifo_size size4) +static void dsi_config_tx_fifo (struct dsi_data *dsi, +enum fifo_size size1,enum fifo_size size2, +enum fifo_size size3,enum fifo_size size4) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);u32 r =0 ;int add =0 ;int i;
@@ -2343,14 +2278,13 @@ static void dsi_config_tx_fifo(struct platform_device *dsidev, add += size; } -dsi_write_reg (dsidev,DSI_TX_FIFO_VC_SIZE , r); +dsi_write_reg (dsi,DSI_TX_FIFO_VC_SIZE , r); } -static void dsi_config_rx_fifo (struct platform_device *dsidev, +static void dsi_config_rx_fifo (struct dsi_data *dsi,enum fifo_size size1,enum fifo_size size2,enum fifo_size size3,enum fifo_size size4) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);u32 r =0 ;int add =0 ;int i;
@@ -2376,18 +2310,18 @@ static void dsi_config_rx_fifo(struct platform_device *dsidev, add += size; } -dsi_write_reg (dsidev,DSI_RX_FIFO_VC_SIZE , r); +dsi_write_reg (dsi,DSI_RX_FIFO_VC_SIZE , r); } -static int dsi_force_tx_stop_mode_io (struct platform_device *dsidev) +static int dsi_force_tx_stop_mode_io (struct dsi_data *dsi) {u32 r; - r =dsi_read_reg (dsidev,DSI_TIMING1 ); + r =dsi_read_reg (dsi,DSI_TIMING1 ); r =FLD_MOD (r,1 ,15 ,15 );/* FORCE_TX_STOP_MODE_IO */ -dsi_write_reg (dsidev,DSI_TIMING1 , r); +dsi_write_reg (dsi,DSI_TIMING1 , r); -if (!wait_for_bit_change (dsidev,DSI_TIMING1 ,15 ,0 )) { +if (!wait_for_bit_change (dsi,DSI_TIMING1 ,15 ,0 )) {DSSERR ("TX_STOP bit not going down\n" );return -EIO ; }
@@ -2395,29 +2329,28 @@ static int dsi_force_tx_stop_mode_io(struct platform_device *dsidev)return 0 ; } -static bool dsi_vc_is_enabled (struct platform_device *dsidev,int channel) +static bool dsi_vc_is_enabled (struct dsi_data *dsi,int channel) { -return REG_GET (dsidev,DSI_VC_CTRL (channel),0 ,0 ); +return REG_GET (dsi,DSI_VC_CTRL (channel),0 ,0 ); }static void dsi_packet_sent_handler_vp (void *data,u32 mask) {struct dsi_packet_sent_handler_data *vp_data = (struct dsi_packet_sent_handler_data *) data; -struct dsi_data *dsi =dsi_get_dsidrv_data (vp_data->dsidev); +struct dsi_data *dsi = vp_data->dsi;const int channel = dsi->update_channel;u8 bit = dsi->te_enabled ?30 :31 ; -if (REG_GET (vp_data->dsidev,DSI_VC_TE (channel), bit, bit) ==0 ) +if (REG_GET (dsi,DSI_VC_TE (channel), bit, bit) ==0 )complete (vp_data->completion); } -static int dsi_sync_vc_vp (struct platform_device *dsidev,int channel) +static int dsi_sync_vc_vp (struct dsi_data *dsi,int channel) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);DECLARE_COMPLETION_ONSTACK (completion);struct dsi_packet_sent_handler_data vp_data = { - .dsidev = dsidev, + .dsi = dsi, .completion = &completion };int r =0 ;
@@ -2425,13 +2358,13 @@ static int dsi_sync_vc_vp(struct platform_device *dsidev, int channel) bit = dsi->te_enabled ?30 :31 ; - r =dsi_register_isr_vc (dsidev, channel, dsi_packet_sent_handler_vp, + r =dsi_register_isr_vc (dsi, channel, dsi_packet_sent_handler_vp, &vp_data,DSI_VC_IRQ_PACKET_SENT );if (r) goto err0;/* Wait for completion only if TE_EN/TE_START is still set */ -if (REG_GET (dsidev,DSI_VC_TE (channel), bit, bit)) { +if (REG_GET (dsi,DSI_VC_TE (channel), bit, bit)) {if (wait_for_completion_timeout (&completion,msecs_to_jiffies (10 )) ==0 ) {DSSERR ("Failed to complete previous frame transfer\n" );
@@ -2440,12 +2373,12 @@ static int dsi_sync_vc_vp(struct platform_device *dsidev, int channel) } } -dsi_unregister_isr_vc (dsidev, channel, dsi_packet_sent_handler_vp, +dsi_unregister_isr_vc (dsi, channel, dsi_packet_sent_handler_vp, &vp_data,DSI_VC_IRQ_PACKET_SENT );return 0 ; err1: -dsi_unregister_isr_vc (dsidev, channel, dsi_packet_sent_handler_vp, +dsi_unregister_isr_vc (dsi, channel, dsi_packet_sent_handler_vp, &vp_data,DSI_VC_IRQ_PACKET_SENT ); err0:return r;
@@ -2455,29 +2388,29 @@ static void dsi_packet_sent_handler_l4(void *data, u32 mask) {struct dsi_packet_sent_handler_data *l4_data = (struct dsi_packet_sent_handler_data *) data; -struct dsi_data *dsi =dsi_get_dsidrv_data (l4_data->dsidev); +struct dsi_data *dsi = l4_data->dsi;const int channel = dsi->update_channel; -if (REG_GET (l4_data->dsidev,DSI_VC_CTRL (channel),5 ,5 ) ==0 ) +if (REG_GET (dsi,DSI_VC_CTRL (channel),5 ,5 ) ==0 )complete (l4_data->completion); } -static int dsi_sync_vc_l4 (struct platform_device *dsidev,int channel) +static int dsi_sync_vc_l4 (struct dsi_data *dsi,int channel) {DECLARE_COMPLETION_ONSTACK (completion);struct dsi_packet_sent_handler_data l4_data = { - .dsidev = dsidev, + .dsi = dsi, .completion = &completion };int r =0 ; - r =dsi_register_isr_vc (dsidev, channel, dsi_packet_sent_handler_l4, + r =dsi_register_isr_vc (dsi, channel, dsi_packet_sent_handler_l4, &l4_data,DSI_VC_IRQ_PACKET_SENT );if (r) goto err0;/* Wait for completion only if TX_FIFO_NOT_EMPTY is still set */ -if (REG_GET (dsidev,DSI_VC_CTRL (channel),5 ,5 )) { +if (REG_GET (dsi,DSI_VC_CTRL (channel),5 ,5 )) {if (wait_for_completion_timeout (&completion,msecs_to_jiffies (10 )) ==0 ) {DSSERR ("Failed to complete previous l4 transfer\n" );
@@ -2486,50 +2419,47 @@ static int dsi_sync_vc_l4(struct platform_device *dsidev, int channel) } } -dsi_unregister_isr_vc (dsidev, channel, dsi_packet_sent_handler_l4, +dsi_unregister_isr_vc (dsi, channel, dsi_packet_sent_handler_l4, &l4_data,DSI_VC_IRQ_PACKET_SENT );return 0 ; err1: -dsi_unregister_isr_vc (dsidev, channel, dsi_packet_sent_handler_l4, +dsi_unregister_isr_vc (dsi, channel, dsi_packet_sent_handler_l4, &l4_data,DSI_VC_IRQ_PACKET_SENT ); err0:return r; } -static int dsi_sync_vc (struct platform_device *dsidev,int channel) +static int dsi_sync_vc (struct dsi_data *dsi,int channel) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); - -WARN_ON (!dsi_bus_is_locked (dsidev)); +WARN_ON (!dsi_bus_is_locked (dsi));WARN_ON (in_interrupt ()); -if (!dsi_vc_is_enabled (dsidev, channel)) +if (!dsi_vc_is_enabled (dsi, channel))return 0 ;switch (dsi->vc[channel].source) {case DSI_VC_SOURCE_VP : -return dsi_sync_vc_vp (dsidev, channel); +return dsi_sync_vc_vp (dsi, channel);case DSI_VC_SOURCE_L4 : -return dsi_sync_vc_l4 (dsidev, channel); +return dsi_sync_vc_l4 (dsi, channel);default :BUG ();return -EINVAL ; } } -static int dsi_vc_enable (struct platform_device *dsidev,int channel, -bool enable) +static int dsi_vc_enable (struct dsi_data *dsi,int channel,bool enable) {DSSDBG ("dsi_vc_enable channel %d, enable %d\n" , channel, enable); enable = enable ?1 :0 ; -REG_FLD_MOD (dsidev,DSI_VC_CTRL (channel), enable,0 ,0 ); +REG_FLD_MOD (dsi,DSI_VC_CTRL (channel), enable,0 ,0 ); -if (!wait_for_bit_change (dsidev,DSI_VC_CTRL (channel),0 , enable)) { +if (!wait_for_bit_change (dsi,DSI_VC_CTRL (channel),0 , enable)) {DSSERR ("Failed to set dsi_vc_enable to %d\n" , enable);return -EIO ; }
@@ -2537,14 +2467,13 @@ static int dsi_vc_enable(struct platform_device *dsidev, int channel,return 0 ; } -static void dsi_vc_initial_config (struct platform_device *dsidev,int channel) +static void dsi_vc_initial_config (struct dsi_data *dsi,int channel) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);u32 r;DSSDBG ("Initial config of virtual channel %d" , channel); - r =dsi_read_reg (dsidev,DSI_VC_CTRL (channel)); + r =dsi_read_reg (dsi,DSI_VC_CTRL (channel));if (FLD_GET (r,15 ,15 ))/* VC_BUSY */ DSSERR("VC(%d) busy when trying to configure it!\n",
@@ -2563,41 +2492,39 @@ static void dsi_vc_initial_config(struct platform_device *dsidev, int channel) r =FLD_MOD (r,4 ,29 ,27 );/* DMA_RX_REQ_NB = no dma */ r =FLD_MOD (r,4 ,23 ,21 );/* DMA_TX_REQ_NB = no dma */ -dsi_write_reg (dsidev,DSI_VC_CTRL (channel), r); +dsi_write_reg (dsi,DSI_VC_CTRL (channel), r); dsi->vc[channel].source =DSI_VC_SOURCE_L4 ; } -static int dsi_vc_config_source (struct platform_device *dsidev,int channel, -enum dsi_vc_source source) +static int dsi_vc_config_source (struct dsi_data *dsi,int channel, +enum dsi_vc_source source) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -if (dsi->vc[channel].source == source)return 0 ;DSSDBG ("Source config of virtual channel %d" , channel); -dsi_sync_vc (dsidev, channel); +dsi_sync_vc (dsi, channel); -dsi_vc_enable (dsidev, channel,0 ); +dsi_vc_enable (dsi, channel,0 );/* VC_BUSY */ -if (!wait_for_bit_change (dsidev,DSI_VC_CTRL (channel),15 ,0 )) { +if (!wait_for_bit_change (dsi,DSI_VC_CTRL (channel),15 ,0 )) {DSSERR ("vc(%d) busy when trying to config for VP\n" , channel);return -EIO ; }/* SOURCE, 0 = L4, 1 = video port */ -REG_FLD_MOD (dsidev,DSI_VC_CTRL (channel), source,1 ,1 ); +REG_FLD_MOD (dsi,DSI_VC_CTRL (channel), source,1 ,1 );/* DCS_CMD_ENABLE */ if (dsi->data->quirks &DSI_QUIRK_DCS_CMD_CONFIG_VC ) {bool enable = source ==DSI_VC_SOURCE_VP ; -REG_FLD_MOD (dsidev,DSI_VC_CTRL (channel), enable,30 ,30 ); +REG_FLD_MOD (dsi,DSI_VC_CTRL (channel), enable,30 ,30 ); } -dsi_vc_enable (dsidev, channel,1 ); +dsi_vc_enable (dsi, channel,1 ); dsi->vc[channel].source = source;
@@ -2612,28 +2539,28 @@ static void dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,DSSDBG ("dsi_vc_enable_hs(%d, %d)\n" , channel, enable); -WARN_ON (!dsi_bus_is_locked (dsidev)); +WARN_ON (!dsi_bus_is_locked (dsi)); -dsi_vc_enable (dsidev, channel,0 ); -dsi_if_enable (dsidev,0 ); +dsi_vc_enable (dsi, channel,0 ); +dsi_if_enable (dsi,0 ); -REG_FLD_MOD (dsidev,DSI_VC_CTRL (channel), enable,9 ,9 ); +REG_FLD_MOD (dsi,DSI_VC_CTRL (channel), enable,9 ,9 ); -dsi_vc_enable (dsidev, channel,1 ); -dsi_if_enable (dsidev,1 ); +dsi_vc_enable (dsi, channel,1 ); +dsi_if_enable (dsi,1 ); -dsi_force_tx_stop_mode_io (dsidev); +dsi_force_tx_stop_mode_io (dsi);/* start the DDR clock by sending a NULL packet */ if (dsi->vm_timings.ddr_clk_always_on && enable) -dsi_vc_send_null (dssdev, channel); +dsi_vc_send_null (dsi, channel); } -static void dsi_vc_flush_long_data (struct platform_device *dsidev,int channel) +static void dsi_vc_flush_long_data (struct dsi_data *dsi,int channel) { -while (REG_GET (dsidev,DSI_VC_CTRL (channel),20 ,20 )) { +while (REG_GET (dsi,DSI_VC_CTRL (channel),20 ,20 )) {u32 val; - val =dsi_read_reg (dsidev,DSI_VC_SHORT_PACKET_HEADER (channel)); + val =dsi_read_reg (dsi,DSI_VC_SHORT_PACKET_HEADER (channel)); DSSDBG("\t\tb1 %#02x b2 %#02x b3 %#02x b4 %#02x\n", (val >> 0) & 0xff, (val >> 8) & 0xff,
@@ -2679,14 +2606,13 @@ static void dsi_show_rx_ack_with_err(u16 err)DSSERR ("\t\tDSI Protocol Violation\n" ); } -static u16 dsi_vc_flush_receive_data (struct platform_device *dsidev, -int channel) +static u16 dsi_vc_flush_receive_data (struct dsi_data *dsi,int channel) {/* RX_FIFO_NOT_EMPTY */ -while (REG_GET (dsidev,DSI_VC_CTRL (channel),20 ,20 )) { +while (REG_GET (dsi,DSI_VC_CTRL (channel),20 ,20 )) {u32 val;u8 dt; - val =dsi_read_reg (dsidev,DSI_VC_SHORT_PACKET_HEADER (channel)); + val =dsi_read_reg (dsi,DSI_VC_SHORT_PACKET_HEADER (channel));DSSERR ("\trawval %#08x\n" , val); dt =FLD_GET (val,5 ,0 );if (dt ==MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT ) {
@@ -2701,7 +2627,7 @@ static u16 dsi_vc_flush_receive_data(struct platform_device *dsidev, }else if (dt ==MIPI_DSI_RX_DCS_LONG_READ_RESPONSE ) {DSSERR ("\tDCS long response, len %d\n" ,FLD_GET (val,23 ,8 )); -dsi_vc_flush_long_data (dsidev, channel); +dsi_vc_flush_long_data (dsi, channel); }else {DSSERR ("\tunknown datatype 0x%02x\n" , dt); }
@@ -2709,25 +2635,23 @@ static u16 dsi_vc_flush_receive_data(struct platform_device *dsidev,return 0 ; } -static int dsi_vc_send_bta (struct platform_device *dsidev,int channel) +static int dsi_vc_send_bta (struct dsi_data *dsi,int channel) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -if (dsi->debug_write || dsi->debug_read)DSSDBG ("dsi_vc_send_bta %d\n" , channel); -WARN_ON (!dsi_bus_is_locked (dsidev)); +WARN_ON (!dsi_bus_is_locked (dsi));/* RX_FIFO_NOT_EMPTY */ -if (REG_GET (dsidev,DSI_VC_CTRL (channel),20 ,20 )) { +if (REG_GET (dsi,DSI_VC_CTRL (channel),20 ,20 )) {DSSERR ("rx fifo not empty when sending BTA, dumping data:\n" ); -dsi_vc_flush_receive_data (dsidev, channel); +dsi_vc_flush_receive_data (dsi, channel); } -REG_FLD_MOD (dsidev,DSI_VC_CTRL (channel),1 ,6 ,6 );/* BTA_EN */ +REG_FLD_MOD (dsi,DSI_VC_CTRL (channel),1 ,6 ,6 );/* BTA_EN */ /* flush posted write */ -dsi_read_reg (dsidev,DSI_VC_CTRL (channel)); +dsi_read_reg (dsi,DSI_VC_CTRL (channel));return 0 ; }
@@ -2735,21 +2659,22 @@ static int dsi_vc_send_bta(struct platform_device *dsidev, int channel)static int dsi_vc_send_bta_sync (struct omap_dss_device *dssdev,int channel) {struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); +struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);DECLARE_COMPLETION_ONSTACK (completion);int r =0 ;u32 err; - r =dsi_register_isr_vc (dsidev, channel, dsi_completion_handler, + r =dsi_register_isr_vc (dsi, channel, dsi_completion_handler, &completion,DSI_VC_IRQ_BTA );if (r) goto err0; - r =dsi_register_isr (dsidev, dsi_completion_handler, &completion, + r =dsi_register_isr (dsi, dsi_completion_handler, &completion,DSI_IRQ_ERROR_MASK );if (r) goto err1; - r =dsi_vc_send_bta (dsidev, channel); + r =dsi_vc_send_bta (dsi, channel);if (r) goto err2;
@@ -2760,41 +2685,40 @@ static int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel) goto err2; } - err =dsi_get_errors (dsidev); + err =dsi_get_errors (dsi);if (err) {DSSERR ("Error while sending BTA: %x\n" , err); r = -EIO ; goto err2; } err2: -dsi_unregister_isr (dsidev, dsi_completion_handler, &completion, +dsi_unregister_isr (dsi, dsi_completion_handler, &completion,DSI_IRQ_ERROR_MASK ); err1: -dsi_unregister_isr_vc (dsidev, channel, dsi_completion_handler, +dsi_unregister_isr_vc (dsi, channel, dsi_completion_handler, &completion,DSI_VC_IRQ_BTA ); err0:return r; } -static inline void dsi_vc_write_long_header (struct platform_device *dsidev, -int channel,u8 data_type,u16 len,u8 ecc) +static inline void dsi_vc_write_long_header (struct dsi_data *dsi,int channel, +u8 data_type,u16 len,u8 ecc) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);u32 val;u8 data_id; -WARN_ON (!dsi_bus_is_locked (dsidev)); +WARN_ON (!dsi_bus_is_locked (dsi)); data_id = data_type | dsi->vc[channel].vc_id <<6 ; val =FLD_VAL (data_id,7 ,0 ) |FLD_VAL (len,23 ,8 ) |FLD_VAL (ecc,31 ,24 ); -dsi_write_reg (dsidev,DSI_VC_LONG_PACKET_HEADER (channel), val); +dsi_write_reg (dsi,DSI_VC_LONG_PACKET_HEADER (channel), val); } -static inline void dsi_vc_write_long_payload (struct platform_device *dsidev, -int channel,u8 b1,u8 b2,u8 b3,u8 b4) +static inline void dsi_vc_write_long_payload (struct dsi_data *dsi,int channel, +u8 b1,u8 b2,u8 b3,u8 b4) {u32 val;
@@ -2803,14 +2727,13 @@ static inline void dsi_vc_write_long_payload(struct platform_device *dsidev,/* DSSDBG("\twriting %02x, %02x, %02x, %02x (%#010x)\n", b1, b2, b3, b4, val); */ -dsi_write_reg (dsidev,DSI_VC_LONG_PACKET_PAYLOAD (channel), val); +dsi_write_reg (dsi,DSI_VC_LONG_PACKET_PAYLOAD (channel), val); } -static int dsi_vc_send_long (struct platform_device *dsidev,int channel, -u8 data_type,u8 *data,u16 len,u8 ecc) +static int dsi_vc_send_long (struct dsi_data *dsi,int channel,u8 data_type, +u8 *data,u16 len,u8 ecc) {/*u32 val; */ -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int i;u8 *p;int r =0 ;
@@ -2825,9 +2748,9 @@ static int dsi_vc_send_long(struct platform_device *dsidev, int channel,return -EINVAL ; } -dsi_vc_config_source (dsidev, channel,DSI_VC_SOURCE_L4 ); +dsi_vc_config_source (dsi, channel,DSI_VC_SOURCE_L4 ); -dsi_vc_write_long_header (dsidev, channel, data_type, len, ecc); +dsi_vc_write_long_header (dsi, channel, data_type, len, ecc); p = data;for (i =0 ; i < len >>2 ; i++) {
@@ -2839,7 +2762,7 @@ static int dsi_vc_send_long(struct platform_device *dsidev, int channel, b3 = *p++; b4 = *p++; -dsi_vc_write_long_payload (dsidev, channel, b1, b2, b3, b4); +dsi_vc_write_long_payload (dsi, channel, b1, b2, b3, b4); } i = len %4 ;
@@ -2864,29 +2787,28 @@ static int dsi_vc_send_long(struct platform_device *dsidev, int channel,break ; } -dsi_vc_write_long_payload (dsidev, channel, b1, b2, b3,0 ); +dsi_vc_write_long_payload (dsi, channel, b1, b2, b3,0 ); }return r; } -static int dsi_vc_send_short (struct platform_device *dsidev,int channel, -u8 data_type,u16 data,u8 ecc) +static int dsi_vc_send_short (struct dsi_data *dsi,int channel,u8 data_type, +u16 data,u8 ecc) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);u32 r;u8 data_id; -WARN_ON (!dsi_bus_is_locked (dsidev)); +WARN_ON (!dsi_bus_is_locked (dsi));if (dsi->debug_write)DSSDBG ("dsi_vc_send_short(ch%d, dt %#x, b1 %#x, b2 %#x)\n" , channel, data_type, data &0xff , (data >>8 ) &0xff ); -dsi_vc_config_source (dsidev, channel,DSI_VC_SOURCE_L4 ); +dsi_vc_config_source (dsi, channel,DSI_VC_SOURCE_L4 ); -if (FLD_GET (dsi_read_reg (dsidev,DSI_VC_CTRL (channel)),16 ,16 )) { +if (FLD_GET (dsi_read_reg (dsi,DSI_VC_CTRL (channel)),16 ,16 )) {DSSERR ("ERROR FIFO FULL, aborting transfer\n" );return -EINVAL ; }
@@ -2895,41 +2817,39 @@ static int dsi_vc_send_short(struct platform_device *dsidev, int channel, r = (data_id <<0 ) | (data <<8 ) | (ecc <<24 ); -dsi_write_reg (dsidev,DSI_VC_SHORT_PACKET_HEADER (channel), r); +dsi_write_reg (dsi,DSI_VC_SHORT_PACKET_HEADER (channel), r);return 0 ; } -static int dsi_vc_send_null (struct omap_dss_device *dssdev,int channel) +static int dsi_vc_send_null (struct dsi_data *dsi,int channel) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); - -return dsi_vc_send_long (dsidev, channel,MIPI_DSI_NULL_PACKET ,NULL , -0 ,0 ); +return dsi_vc_send_long (dsi, channel,MIPI_DSI_NULL_PACKET ,NULL ,0 ,0 ); } -static int dsi_vc_write_nosync_common (struct platform_device *dsidev, -int channel,u8 *data,int len,enum dss_dsi_content_type type) +static int dsi_vc_write_nosync_common (struct dsi_data *dsi,int channel, +u8 *data,int len, +enum dss_dsi_content_type type) {int r;if (len ==0 ) {BUG_ON (type ==DSS_DSI_CONTENT_DCS ); - r =dsi_vc_send_short (dsidev, channel, + r =dsi_vc_send_short (dsi, channel,MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM ,0 ,0 ); }else if (len ==1 ) { - r =dsi_vc_send_short (dsidev, channel, + r =dsi_vc_send_short (dsi, channel, type ==DSS_DSI_CONTENT_GENERIC ?MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM :MIPI_DSI_DCS_SHORT_WRITE , data[0 ],0 ); }else if (len ==2 ) { - r =dsi_vc_send_short (dsidev, channel, + r =dsi_vc_send_short (dsi, channel, type ==DSS_DSI_CONTENT_GENERIC ?MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM :MIPI_DSI_DCS_SHORT_WRITE_PARAM , data[0 ] | (data[1 ] <<8 ),0 ); }else { - r =dsi_vc_send_long (dsidev, channel, + r =dsi_vc_send_long (dsi, channel, type ==DSS_DSI_CONTENT_GENERIC ?MIPI_DSI_GENERIC_LONG_WRITE :MIPI_DSI_DCS_LONG_WRITE , data, len,0 );
@@ -2942,8 +2862,9 @@ static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel, u8 *data, int len) {struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); +struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -return dsi_vc_write_nosync_common (dsidev, channel, data, len, +return dsi_vc_write_nosync_common (dsi, channel, data, len,DSS_DSI_CONTENT_DCS ); }
@@ -2951,18 +2872,21 @@ static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int chann u8 *data, int len) {struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); +struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -return dsi_vc_write_nosync_common (dsidev, channel, data, len, +return dsi_vc_write_nosync_common (dsi, channel, data, len,DSS_DSI_CONTENT_GENERIC ); } -static int dsi_vc_write_common (struct omap_dss_device *dssdev,int channel, -u8 *data,int len,enum dss_dsi_content_type type) +static int dsi_vc_write_common (struct omap_dss_device *dssdev, +int channel,u8 *data,int len, +enum dss_dsi_content_type type) {struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); +struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int r; - r =dsi_vc_write_nosync_common (dsidev, channel, data, len, type); + r =dsi_vc_write_nosync_common (dsi, channel, data, len, type);if (r) goto err;
@@ -2971,9 +2895,9 @@ static int dsi_vc_write_common(struct omap_dss_device *dssdev, int channel, goto err;/* RX_FIFO_NOT_EMPTY */ -if (REG_GET (dsidev,DSI_VC_CTRL (channel),20 ,20 )) { +if (REG_GET (dsi,DSI_VC_CTRL (channel),20 ,20 )) {DSSERR ("rx fifo not empty after write, dumping data:\n" ); -dsi_vc_flush_receive_data (dsidev, channel); +dsi_vc_flush_receive_data (dsi, channel); r = -EIO ; goto err; }
@@ -2999,17 +2923,16 @@ static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 DSS_DSI_CONTENT_GENERIC); } -static int dsi_vc_dcs_send_read_request (struct platform_device *dsidev, -int channel,u8 dcs_cmd) +static int dsi_vc_dcs_send_read_request (struct dsi_data *dsi,int channel, +u8 dcs_cmd) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int r;if (dsi->debug_read)DSSDBG ("dsi_vc_dcs_send_read_request(ch%d, dcs_cmd %x)\n" , channel, dcs_cmd); - r =dsi_vc_send_short (dsidev, channel,MIPI_DSI_DCS_READ , dcs_cmd,0 ); + r =dsi_vc_send_short (dsi, channel,MIPI_DSI_DCS_READ , dcs_cmd,0 );if (r) {DSSERR ("dsi_vc_dcs_send_read_request(ch %d, cmd 0x%02x)" " failed\n" , channel, dcs_cmd);
@@ -3019,10 +2942,9 @@ static int dsi_vc_dcs_send_read_request(struct platform_device *dsidev,return 0 ; } -static int dsi_vc_generic_send_read_request (struct platform_device *dsidev, -int channel,u8 *reqdata,int reqlen) +static int dsi_vc_generic_send_read_request (struct dsi_data *dsi,int channel, +u8 *reqdata,int reqlen) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);u16 data;u8 data_type;int r;
@@ -3045,7 +2967,7 @@ static int dsi_vc_generic_send_read_request(struct platform_device *dsidev,return -EINVAL ; } - r =dsi_vc_send_short (dsidev, channel, data_type, data,0 ); + r =dsi_vc_send_short (dsi, channel, data_type, data,0 );if (r) {DSSERR ("dsi_vc_generic_send_read_request(ch %d, reqlen %d)" " failed\n" , channel, reqlen);
@@ -3055,22 +2977,21 @@ static int dsi_vc_generic_send_read_request(struct platform_device *dsidev,return 0 ; } -static int dsi_vc_read_rx_fifo (struct platform_device *dsidev,int channel, -u8 *buf,int buflen,enum dss_dsi_content_type type) +static int dsi_vc_read_rx_fifo (struct dsi_data *dsi,int channel,u8 *buf, +int buflen,enum dss_dsi_content_type type) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);u32 val;u8 dt;int r;/* RX_FIFO_NOT_EMPTY */ -if (REG_GET (dsidev,DSI_VC_CTRL (channel),20 ,20 ) ==0 ) { +if (REG_GET (dsi,DSI_VC_CTRL (channel),20 ,20 ) ==0 ) {DSSERR ("RX fifo empty when trying to read.\n" ); r = -EIO ; goto err; } - val =dsi_read_reg (dsidev,DSI_VC_SHORT_PACKET_HEADER (channel)); + val =dsi_read_reg (dsi,DSI_VC_SHORT_PACKET_HEADER (channel));if (dsi->debug_read)DSSDBG ("\theader: %08x\n" , val); dt =FLD_GET (val,5 ,0 );
@@ -3133,7 +3054,7 @@ static int dsi_vc_read_rx_fifo(struct platform_device *dsidev, int channel,/* two byte checksum ends the packet, not included in len */ for (w =0 ; w < len +2 ;) {int b; - val =dsi_read_reg (dsidev, + val =dsi_read_reg (dsi,DSI_VC_SHORT_PACKET_HEADER (channel));if (dsi->debug_read) DSSDBG("\t\t%02x %02x %02x %02x\n",
@@ -3168,9 +3089,10 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_c u8 *buf, int buflen) {struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); +struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int r; - r =dsi_vc_dcs_send_read_request (dsidev, channel, dcs_cmd); + r =dsi_vc_dcs_send_read_request (dsi, channel, dcs_cmd);if (r) goto err;
@@ -3178,7 +3100,7 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cif (r) goto err; - r =dsi_vc_read_rx_fifo (dsidev, channel, buf, buflen, + r =dsi_vc_read_rx_fifo (dsi, channel, buf, buflen,DSS_DSI_CONTENT_DCS );if (r <0 ) goto err;
@@ -3198,9 +3120,10 @@ static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel, u8 *reqdata, int reqlen, u8 *buf, int buflen) { struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); +struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int r; - r =dsi_vc_generic_send_read_request (dsidev, channel, reqdata, reqlen); + r =dsi_vc_generic_send_read_request (dsi, channel, reqdata, reqlen);if (r)return r;
@@ -3208,7 +3131,7 @@ static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,if (r)return r; - r =dsi_vc_read_rx_fifo (dsidev, channel, buf, buflen, + r =dsi_vc_read_rx_fifo (dsi, channel, buf, buflen,DSS_DSI_CONTENT_GENERIC );if (r <0 )return r;
@@ -3225,21 +3148,21 @@ static int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int cha u16 len) {struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); +struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -return dsi_vc_send_short (dsidev, channel, +return dsi_vc_send_short (dsi, channel,MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE , len,0 ); } -static int dsi_enter_ulps (struct platform_device *dsidev) +static int dsi_enter_ulps (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);DECLARE_COMPLETION_ONSTACK (completion);int r, i;unsigned int mask;DSSDBG ("Entering ULPS" ); -WARN_ON (!dsi_bus_is_locked (dsidev)); +WARN_ON (!dsi_bus_is_locked (dsi));WARN_ON (dsi->ulps_enabled);
@@ -3247,35 +3170,35 @@ static int dsi_enter_ulps(struct platform_device *dsidev)return 0 ;/* DDR_CLK_ALWAYS_ON */ -if (REG_GET (dsidev,DSI_CLK_CTRL ,13 ,13 )) { -dsi_if_enable (dsidev,0 ); -REG_FLD_MOD (dsidev,DSI_CLK_CTRL ,0 ,13 ,13 ); -dsi_if_enable (dsidev,1 ); +if (REG_GET (dsi,DSI_CLK_CTRL ,13 ,13 )) { +dsi_if_enable (dsi,0 ); +REG_FLD_MOD (dsi,DSI_CLK_CTRL ,0 ,13 ,13 ); +dsi_if_enable (dsi,1 ); } -dsi_sync_vc (dsidev,0 ); -dsi_sync_vc (dsidev,1 ); -dsi_sync_vc (dsidev,2 ); -dsi_sync_vc (dsidev,3 ); +dsi_sync_vc (dsi,0 ); +dsi_sync_vc (dsi,1 ); +dsi_sync_vc (dsi,2 ); +dsi_sync_vc (dsi,3 ); -dsi_force_tx_stop_mode_io (dsidev); +dsi_force_tx_stop_mode_io (dsi); -dsi_vc_enable (dsidev,0 , false); -dsi_vc_enable (dsidev,1 , false); -dsi_vc_enable (dsidev,2 , false); -dsi_vc_enable (dsidev,3 , false); +dsi_vc_enable (dsi,0 , false); +dsi_vc_enable (dsi,1 , false); +dsi_vc_enable (dsi,2 , false); +dsi_vc_enable (dsi,3 , false); -if (REG_GET (dsidev,DSI_COMPLEXIO_CFG2 ,16 ,16 )) {/* HS_BUSY */ +if (REG_GET (dsi,DSI_COMPLEXIO_CFG2 ,16 ,16 )) {/* HS_BUSY */ DSSERR ("HS busy when enabling ULPS\n" );return -EIO ; } -if (REG_GET (dsidev,DSI_COMPLEXIO_CFG2 ,17 ,17 )) {/* LP_BUSY */ +if (REG_GET (dsi,DSI_COMPLEXIO_CFG2 ,17 ,17 )) {/* LP_BUSY */ DSSERR ("LP busy when enabling ULPS\n" );return -EIO ; } - r =dsi_register_isr_cio (dsidev, dsi_completion_handler, &completion, + r =dsi_register_isr_cio (dsi, dsi_completion_handler, &completion,DSI_CIO_IRQ_ULPSACTIVENOT_ALL0 );if (r)return r;
@@ -3289,10 +3212,10 @@ static int dsi_enter_ulps(struct platform_device *dsidev) }/* Assert TxRequestEsc for data lanes and TxUlpsClk for clk lane */ /* LANEx_ULPS_SIG2 */ -REG_FLD_MOD (dsidev,DSI_COMPLEXIO_CFG2 , mask,9 ,5 ); +REG_FLD_MOD (dsi,DSI_COMPLEXIO_CFG2 , mask,9 ,5 );/* flush posted write and wait for SCP interface to finish the write */ -dsi_read_reg (dsidev,DSI_COMPLEXIO_CFG2 ); +dsi_read_reg (dsi,DSI_COMPLEXIO_CFG2 );if (wait_for_completion_timeout (&completion,msecs_to_jiffies (1000 )) ==0 ) {
@@ -3301,31 +3224,31 @@ static int dsi_enter_ulps(struct platform_device *dsidev) goto err; } -dsi_unregister_isr_cio (dsidev, dsi_completion_handler, &completion, +dsi_unregister_isr_cio (dsi, dsi_completion_handler, &completion,DSI_CIO_IRQ_ULPSACTIVENOT_ALL0 );/* Reset LANEx_ULPS_SIG2 */ -REG_FLD_MOD (dsidev,DSI_COMPLEXIO_CFG2 ,0 ,9 ,5 ); +REG_FLD_MOD (dsi,DSI_COMPLEXIO_CFG2 ,0 ,9 ,5 );/* flush posted write and wait for SCP interface to finish the write */ -dsi_read_reg (dsidev,DSI_COMPLEXIO_CFG2 ); +dsi_read_reg (dsi,DSI_COMPLEXIO_CFG2 ); -dsi_cio_power (dsidev,DSI_COMPLEXIO_POWER_ULPS ); +dsi_cio_power (dsi,DSI_COMPLEXIO_POWER_ULPS ); -dsi_if_enable (dsidev, false); +dsi_if_enable (dsi, false); dsi->ulps_enabled = true;return 0 ; err: -dsi_unregister_isr_cio (dsidev, dsi_completion_handler, &completion, +dsi_unregister_isr_cio (dsi, dsi_completion_handler, &completion,DSI_CIO_IRQ_ULPSACTIVENOT_ALL0 );return r; } -static void dsi_set_lp_rx_timeout (struct platform_device *dsidev, -unsigned int ticks,bool x4,bool x16) +static void dsi_set_lp_rx_timeout (struct dsi_data *dsi,unsigned int ticks, +bool x4,bool x16) {unsigned long fck;unsigned long total_ticks;
@@ -3334,14 +3257,14 @@ static void dsi_set_lp_rx_timeout(struct platform_device *dsidev,BUG_ON (ticks >0x1fff );/* ticks in DSI_FCK */ - fck =dsi_fclk_rate (dsidev); + fck =dsi_fclk_rate (dsi); - r =dsi_read_reg (dsidev,DSI_TIMING2 ); + r =dsi_read_reg (dsi,DSI_TIMING2 ); r =FLD_MOD (r,1 ,15 ,15 );/* LP_RX_TO */ r =FLD_MOD (r, x16 ?1 :0 ,14 ,14 );/* LP_RX_TO_X16 */ r =FLD_MOD (r, x4 ?1 :0 ,13 ,13 );/* LP_RX_TO_X4 */ r =FLD_MOD (r, ticks,12 ,0 );/* LP_RX_COUNTER */ -dsi_write_reg (dsidev,DSI_TIMING2 , r); +dsi_write_reg (dsi,DSI_TIMING2 , r); total_ticks = ticks * (x16 ?16 :1 ) * (x4 ?4 :1 );
@@ -3351,8 +3274,8 @@ static void dsi_set_lp_rx_timeout(struct platform_device *dsidev, (total_ticks * 1000) / (fck / 1000 / 1000)); } -static void dsi_set_ta_timeout (struct platform_device *dsidev, -unsigned int ticks,bool x8,bool x16) +static void dsi_set_ta_timeout (struct dsi_data *dsi,unsigned int ticks, +bool x8,bool x16) {unsigned long fck;unsigned long total_ticks;
@@ -3361,14 +3284,14 @@ static void dsi_set_ta_timeout(struct platform_device *dsidev,BUG_ON (ticks >0x1fff );/* ticks in DSI_FCK */ - fck =dsi_fclk_rate (dsidev); + fck =dsi_fclk_rate (dsi); - r =dsi_read_reg (dsidev,DSI_TIMING1 ); + r =dsi_read_reg (dsi,DSI_TIMING1 ); r =FLD_MOD (r,1 ,31 ,31 );/* TA_TO */ r =FLD_MOD (r, x16 ?1 :0 ,30 ,30 );/* TA_TO_X16 */ r =FLD_MOD (r, x8 ?1 :0 ,29 ,29 );/* TA_TO_X8 */ r =FLD_MOD (r, ticks,28 ,16 );/* TA_TO_COUNTER */ -dsi_write_reg (dsidev,DSI_TIMING1 , r); +dsi_write_reg (dsi,DSI_TIMING1 , r); total_ticks = ticks * (x16 ?16 :1 ) * (x8 ?8 :1 );
@@ -3378,8 +3301,8 @@ static void dsi_set_ta_timeout(struct platform_device *dsidev, (total_ticks * 1000) / (fck / 1000 / 1000)); } -static void dsi_set_stop_state_counter (struct platform_device *dsidev, -unsigned int ticks,bool x4,bool x16) +static void dsi_set_stop_state_counter (struct dsi_data *dsi,unsigned int ticks, +bool x4,bool x16) {unsigned long fck;unsigned long total_ticks;
@@ -3388,14 +3311,14 @@ static void dsi_set_stop_state_counter(struct platform_device *dsidev,BUG_ON (ticks >0x1fff );/* ticks in DSI_FCK */ - fck =dsi_fclk_rate (dsidev); + fck =dsi_fclk_rate (dsi); - r =dsi_read_reg (dsidev,DSI_TIMING1 ); + r =dsi_read_reg (dsi,DSI_TIMING1 ); r =FLD_MOD (r,1 ,15 ,15 );/* FORCE_TX_STOP_MODE_IO */ r =FLD_MOD (r, x16 ?1 :0 ,14 ,14 );/* STOP_STATE_X16_IO */ r =FLD_MOD (r, x4 ?1 :0 ,13 ,13 );/* STOP_STATE_X4_IO */ r =FLD_MOD (r, ticks,12 ,0 );/* STOP_STATE_COUNTER_IO */ -dsi_write_reg (dsidev,DSI_TIMING1 , r); +dsi_write_reg (dsi,DSI_TIMING1 , r); total_ticks = ticks * (x16 ?16 :1 ) * (x4 ?4 :1 );
@@ -3405,8 +3328,8 @@ static void dsi_set_stop_state_counter(struct platform_device *dsidev, (total_ticks * 1000) / (fck / 1000 / 1000)); } -static void dsi_set_hs_tx_timeout (struct platform_device *dsidev, -unsigned int ticks,bool x4,bool x16) +static void dsi_set_hs_tx_timeout (struct dsi_data *dsi,unsigned int ticks, +bool x4,bool x16) {unsigned long fck;unsigned long total_ticks;
@@ -3415,14 +3338,14 @@ static void dsi_set_hs_tx_timeout(struct platform_device *dsidev,BUG_ON (ticks >0x1fff );/* ticks in TxByteClkHS */ - fck =dsi_get_txbyteclkhs (dsidev); + fck =dsi_get_txbyteclkhs (dsi); - r =dsi_read_reg (dsidev,DSI_TIMING2 ); + r =dsi_read_reg (dsi,DSI_TIMING2 ); r =FLD_MOD (r,1 ,31 ,31 );/* HS_TX_TO */ r =FLD_MOD (r, x16 ?1 :0 ,30 ,30 );/* HS_TX_TO_X16 */ r =FLD_MOD (r, x4 ?1 :0 ,29 ,29 );/* HS_TX_TO_X8 (4 really) */ r =FLD_MOD (r, ticks,28 ,16 );/* HS_TX_TO_COUNTER */ -dsi_write_reg (dsidev,DSI_TIMING2 , r); +dsi_write_reg (dsi,DSI_TIMING2 , r); total_ticks = ticks * (x16 ?16 :1 ) * (x4 ?4 :1 );
@@ -3432,9 +3355,8 @@ static void dsi_set_hs_tx_timeout(struct platform_device *dsidev, (total_ticks * 1000) / (fck / 1000 / 1000)); } -static void dsi_config_vp_num_line_buffers (struct platform_device *dsidev) +static void dsi_config_vp_num_line_buffers (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int num_line_buffers;if (dsi->mode ==OMAP_DSS_DSI_VIDEO_MODE ) {
@@ -3454,12 +3376,11 @@ static void dsi_config_vp_num_line_buffers(struct platform_device *dsidev) }/* LINE_BUFFER */ -REG_FLD_MOD (dsidev,DSI_CTRL , num_line_buffers,13 ,12 ); +REG_FLD_MOD (dsi,DSI_CTRL , num_line_buffers,13 ,12 ); } -static void dsi_config_vp_sync_events (struct platform_device *dsidev) +static void dsi_config_vp_sync_events (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);bool sync_end;u32 r;
@@ -3468,7 +3389,7 @@ static void dsi_config_vp_sync_events(struct platform_device *dsidev)else sync_end = false; - r =dsi_read_reg (dsidev,DSI_CTRL ); + r =dsi_read_reg (dsi,DSI_CTRL ); r =FLD_MOD (r,1 ,9 ,9 );/* VP_DE_POL */ r =FLD_MOD (r,1 ,10 ,10 );/* VP_HSYNC_POL */ r =FLD_MOD (r,1 ,11 ,11 );/* VP_VSYNC_POL */
@@ -3476,12 +3397,11 @@ static void dsi_config_vp_sync_events(struct platform_device *dsidev) r =FLD_MOD (r, sync_end,16 ,16 );/* VP_VSYNC_END */ r =FLD_MOD (r,1 ,17 ,17 );/* VP_HSYNC_START */ r =FLD_MOD (r, sync_end,18 ,18 );/* VP_HSYNC_END */ -dsi_write_reg (dsidev,DSI_CTRL , r); +dsi_write_reg (dsi,DSI_CTRL , r); } -static void dsi_config_blanking_modes (struct platform_device *dsidev) +static void dsi_config_blanking_modes (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int blanking_mode = dsi->vm_timings.blanking_mode;int hfp_blanking_mode = dsi->vm_timings.hfp_blanking_mode;int hbp_blanking_mode = dsi->vm_timings.hbp_blanking_mode;
@@ -3492,12 +3412,12 @@ static void dsi_config_blanking_modes(struct platform_device *dsidev)* 0 = TX FIFO packets sent or LPS in corresponding blanking periods * 1 = Long blanking packets are sent in corresponding blanking periods */ - r =dsi_read_reg (dsidev,DSI_CTRL ); + r =dsi_read_reg (dsi,DSI_CTRL ); r =FLD_MOD (r, blanking_mode,20 ,20 );/* BLANKING_MODE */ r =FLD_MOD (r, hfp_blanking_mode,21 ,21 );/* HFP_BLANKING */ r =FLD_MOD (r, hbp_blanking_mode,22 ,22 );/* HBP_BLANKING */ r =FLD_MOD (r, hsa_blanking_mode,23 ,23 );/* HSA_BLANKING */ -dsi_write_reg (dsidev,DSI_CTRL , r); +dsi_write_reg (dsi,DSI_CTRL , r); }/*
@@ -3562,9 +3482,8 @@ static int dsi_compute_interleave_lp(int blank, int enter_hs, int exit_hs,return max (lp_inter,0 ); } -static void dsi_config_cmd_mode_interleaving (struct platform_device *dsidev) +static void dsi_config_cmd_mode_interleaving (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int blanking_mode;int hfp_blanking_mode, hbp_blanking_mode, hsa_blanking_mode;int hsa, hfp, hbp, width_bytes, bllp, lp_clk_div;
@@ -3581,33 +3500,33 @@ static void dsi_config_cmd_mode_interleaving(struct platform_device *dsidev)int bl_interleave_hs =0 , bl_interleave_lp =0 ;u32 r; - r =dsi_read_reg (dsidev,DSI_CTRL ); + r =dsi_read_reg (dsi,DSI_CTRL ); blanking_mode =FLD_GET (r,20 ,20 ); hfp_blanking_mode =FLD_GET (r,21 ,21 ); hbp_blanking_mode =FLD_GET (r,22 ,22 ); hsa_blanking_mode =FLD_GET (r,23 ,23 ); - r =dsi_read_reg (dsidev,DSI_VM_TIMING1 ); + r =dsi_read_reg (dsi,DSI_VM_TIMING1 ); hbp =FLD_GET (r,11 ,0 ); hfp =FLD_GET (r,23 ,12 ); hsa =FLD_GET (r,31 ,24 ); - r =dsi_read_reg (dsidev,DSI_CLK_TIMING ); + r =dsi_read_reg (dsi,DSI_CLK_TIMING ); ddr_clk_post =FLD_GET (r,7 ,0 ); ddr_clk_pre =FLD_GET (r,15 ,8 ); - r =dsi_read_reg (dsidev,DSI_VM_TIMING7 ); + r =dsi_read_reg (dsi,DSI_VM_TIMING7 ); exit_hs_mode_lat =FLD_GET (r,15 ,0 ); enter_hs_mode_lat =FLD_GET (r,31 ,16 ); - r =dsi_read_reg (dsidev,DSI_CLK_CTRL ); + r =dsi_read_reg (dsi,DSI_CLK_CTRL ); lp_clk_div =FLD_GET (r,12 ,0 ); ddr_alwon =FLD_GET (r,13 ,13 ); - r =dsi_read_reg (dsidev,DSI_DSIPHY_CFG0 ); + r =dsi_read_reg (dsi,DSI_DSIPHY_CFG0 ); ths_exit =FLD_GET (r,7 ,0 ); - r =dsi_read_reg (dsidev,DSI_DSIPHY_CFG1 ); + r =dsi_read_reg (dsi,DSI_DSIPHY_CFG1 ); tclk_trail =FLD_GET (r,15 ,8 ); exiths_clk = ths_exit + tclk_trail;
@@ -3661,45 +3580,44 @@ static void dsi_config_cmd_mode_interleaving(struct platform_device *dsidev) hsa_interleave_lp, hfp_interleave_lp, hbp_interleave_lp, bl_interleave_lp); - r =dsi_read_reg (dsidev,DSI_VM_TIMING4 ); + r =dsi_read_reg (dsi,DSI_VM_TIMING4 ); r =FLD_MOD (r, hsa_interleave_hs,23 ,16 ); r =FLD_MOD (r, hfp_interleave_hs,15 ,8 ); r =FLD_MOD (r, hbp_interleave_hs,7 ,0 ); -dsi_write_reg (dsidev,DSI_VM_TIMING4 , r); +dsi_write_reg (dsi,DSI_VM_TIMING4 , r); - r =dsi_read_reg (dsidev,DSI_VM_TIMING5 ); + r =dsi_read_reg (dsi,DSI_VM_TIMING5 ); r =FLD_MOD (r, hsa_interleave_lp,23 ,16 ); r =FLD_MOD (r, hfp_interleave_lp,15 ,8 ); r =FLD_MOD (r, hbp_interleave_lp,7 ,0 ); -dsi_write_reg (dsidev,DSI_VM_TIMING5 , r); +dsi_write_reg (dsi,DSI_VM_TIMING5 , r); - r =dsi_read_reg (dsidev,DSI_VM_TIMING6 ); + r =dsi_read_reg (dsi,DSI_VM_TIMING6 ); r =FLD_MOD (r, bl_interleave_hs,31 ,15 ); r =FLD_MOD (r, bl_interleave_lp,16 ,0 ); -dsi_write_reg (dsidev,DSI_VM_TIMING6 , r); +dsi_write_reg (dsi,DSI_VM_TIMING6 , r); } -static int dsi_proto_config (struct platform_device *dsidev) +static int dsi_proto_config (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);u32 r;int buswidth =0 ; -dsi_config_tx_fifo (dsidev,DSI_FIFO_SIZE_32 , +dsi_config_tx_fifo (dsi,DSI_FIFO_SIZE_32 ,DSI_FIFO_SIZE_32 ,DSI_FIFO_SIZE_32 ,DSI_FIFO_SIZE_32 ); -dsi_config_rx_fifo (dsidev,DSI_FIFO_SIZE_32 , +dsi_config_rx_fifo (dsi,DSI_FIFO_SIZE_32 ,DSI_FIFO_SIZE_32 ,DSI_FIFO_SIZE_32 ,DSI_FIFO_SIZE_32 );/* XXX what values for the timeouts? */ -dsi_set_stop_state_counter (dsidev,0x1000 , false, false); -dsi_set_ta_timeout (dsidev,0x1fff , true, true); -dsi_set_lp_rx_timeout (dsidev,0x1fff , true, true); -dsi_set_hs_tx_timeout (dsidev,0x1fff , true, true); +dsi_set_stop_state_counter (dsi,0x1000 , false, false); +dsi_set_ta_timeout (dsi,0x1fff , true, true); +dsi_set_lp_rx_timeout (dsi,0x1fff , true, true); +dsi_set_hs_tx_timeout (dsi,0x1fff , true, true);switch (dsi_get_pixel_size (dsi->pix_fmt)) {case 16 :
@@ -3716,7 +3634,7 @@ static int dsi_proto_config(struct platform_device *dsidev)return -EINVAL ; } - r =dsi_read_reg (dsidev,DSI_CTRL ); + r =dsi_read_reg (dsi,DSI_CTRL ); r =FLD_MOD (r,1 ,1 ,1 );/* CS_RX_EN */ r =FLD_MOD (r,1 ,2 ,2 );/* ECC_RX_EN */ r =FLD_MOD (r,1 ,3 ,3 );/* TX_FIFO_ARBITRATION */
@@ -3731,27 +3649,26 @@ static int dsi_proto_config(struct platform_device *dsidev) r =FLD_MOD (r,0 ,25 ,25 ); } -dsi_write_reg (dsidev,DSI_CTRL , r); +dsi_write_reg (dsi,DSI_CTRL , r); -dsi_config_vp_num_line_buffers (dsidev); +dsi_config_vp_num_line_buffers (dsi);if (dsi->mode ==OMAP_DSS_DSI_VIDEO_MODE ) { -dsi_config_vp_sync_events (dsidev); -dsi_config_blanking_modes (dsidev); -dsi_config_cmd_mode_interleaving (dsidev); +dsi_config_vp_sync_events (dsi); +dsi_config_blanking_modes (dsi); +dsi_config_cmd_mode_interleaving (dsi); } -dsi_vc_initial_config (dsidev,0 ); -dsi_vc_initial_config (dsidev,1 ); -dsi_vc_initial_config (dsidev,2 ); -dsi_vc_initial_config (dsidev,3 ); +dsi_vc_initial_config (dsi,0 ); +dsi_vc_initial_config (dsi,1 ); +dsi_vc_initial_config (dsi,2 ); +dsi_vc_initial_config (dsi,3 );return 0 ; } -static void dsi_proto_timings (struct platform_device *dsidev) +static void dsi_proto_timings (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);unsigned int tlpx, tclk_zero, tclk_prepare, tclk_trail;unsigned int tclk_pre, tclk_post;unsigned int ths_prepare, ths_prepare_ths_zero, ths_zero;
@@ -3762,25 +3679,25 @@ static void dsi_proto_timings(struct platform_device *dsidev)int ndl = dsi->num_lanes_used -1 ;u32 r; - r =dsi_read_reg (dsidev,DSI_DSIPHY_CFG0 ); + r =dsi_read_reg (dsi,DSI_DSIPHY_CFG0 ); ths_prepare =FLD_GET (r,31 ,24 ); ths_prepare_ths_zero =FLD_GET (r,23 ,16 ); ths_zero = ths_prepare_ths_zero - ths_prepare; ths_trail =FLD_GET (r,15 ,8 ); ths_exit =FLD_GET (r,7 ,0 ); - r =dsi_read_reg (dsidev,DSI_DSIPHY_CFG1 ); + r =dsi_read_reg (dsi,DSI_DSIPHY_CFG1 ); tlpx =FLD_GET (r,20 ,16 ) *2 ; tclk_trail =FLD_GET (r,15 ,8 ); tclk_zero =FLD_GET (r,7 ,0 ); - r =dsi_read_reg (dsidev,DSI_DSIPHY_CFG2 ); + r =dsi_read_reg (dsi,DSI_DSIPHY_CFG2 ); tclk_prepare =FLD_GET (r,7 ,0 );/* min 8*UI */ tclk_pre =20 ;/* min 60ns + 52*UI */ - tclk_post =ns2ddr (dsidev,60 ) +26 ; + tclk_post =ns2ddr (dsi,60 ) +26 ; ths_eot =DIV_ROUND_UP (4 , ndl);
@@ -3791,10 +3708,10 @@ static void dsi_proto_timings(struct platform_device *dsidev)BUG_ON (ddr_clk_pre ==0 || ddr_clk_pre >255 );BUG_ON (ddr_clk_post ==0 || ddr_clk_post >255 ); - r =dsi_read_reg (dsidev,DSI_CLK_TIMING ); + r =dsi_read_reg (dsi,DSI_CLK_TIMING ); r =FLD_MOD (r, ddr_clk_pre,15 ,8 ); r =FLD_MOD (r, ddr_clk_post,7 ,0 ); -dsi_write_reg (dsidev,DSI_CLK_TIMING , r); +dsi_write_reg (dsi,DSI_CLK_TIMING , r); DSSDBG("ddr_clk_pre %u, ddr_clk_post %u\n", ddr_clk_pre,
@@ -3808,7 +3725,7 @@ static void dsi_proto_timings(struct platform_device *dsidev) r =FLD_VAL (enter_hs_mode_lat,31 ,16 ) |FLD_VAL (exit_hs_mode_lat,15 ,0 ); -dsi_write_reg (dsidev,DSI_VM_TIMING7 , r); +dsi_write_reg (dsi,DSI_VM_TIMING7 , r);DSSDBG ("enter_hs_mode_lat %u, exit_hs_mode_lat %u\n" , enter_hs_mode_lat, exit_hs_mode_lat);
@@ -3842,23 +3759,23 @@ static void dsi_proto_timings(struct platform_device *dsidev)DSSDBG ("VBP: %d, VFP: %d, VSA: %d, VACT: %d lines\n" , vbp, vfp, vsa, vm->vactive); - r =dsi_read_reg (dsidev,DSI_VM_TIMING1 ); + r =dsi_read_reg (dsi,DSI_VM_TIMING1 ); r =FLD_MOD (r, hbp,11 ,0 );/* HBP */ r =FLD_MOD (r, hfp,23 ,12 );/* HFP */ r =FLD_MOD (r, hsync_end ? hsa :0 ,31 ,24 );/* HSA */ -dsi_write_reg (dsidev,DSI_VM_TIMING1 , r); +dsi_write_reg (dsi,DSI_VM_TIMING1 , r); - r =dsi_read_reg (dsidev,DSI_VM_TIMING2 ); + r =dsi_read_reg (dsi,DSI_VM_TIMING2 ); r =FLD_MOD (r, vbp,7 ,0 );/* VBP */ r =FLD_MOD (r, vfp,15 ,8 );/* VFP */ r =FLD_MOD (r, vsa,23 ,16 );/* VSA */ r =FLD_MOD (r, window_sync,27 ,24 );/* WINDOW_SYNC */ -dsi_write_reg (dsidev,DSI_VM_TIMING2 , r); +dsi_write_reg (dsi,DSI_VM_TIMING2 , r); - r =dsi_read_reg (dsidev,DSI_VM_TIMING3 ); + r =dsi_read_reg (dsi,DSI_VM_TIMING3 ); r =FLD_MOD (r, vm->vactive,14 ,0 );/* VACT */ r =FLD_MOD (r, tl,31 ,16 );/* TL */ -dsi_write_reg (dsidev,DSI_VM_TIMING3 , r); +dsi_write_reg (dsi,DSI_VM_TIMING3 , r); } }
@@ -3945,7 +3862,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)return -ENODEV ; } - r =dsi_display_init_dispc (dsidev, dispc_channel); + r =dsi_display_init_dispc (dsi, dispc_channel);if (r) goto err_init_dispc;
@@ -3968,19 +3885,19 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) goto err_pix_fmt; } -dsi_if_enable (dsidev, false); -dsi_vc_enable (dsidev, channel, false); +dsi_if_enable (dsi, false); +dsi_vc_enable (dsi, channel, false);/* MODE, 1 = video mode */ -REG_FLD_MOD (dsidev,DSI_VC_CTRL (channel),1 ,4 ,4 ); +REG_FLD_MOD (dsi,DSI_VC_CTRL (channel),1 ,4 ,4 ); word_count =DIV_ROUND_UP (dsi->vm.hactive * bpp,8 ); -dsi_vc_write_long_header (dsidev, channel, data_type, +dsi_vc_write_long_header (dsi, channel, data_type, word_count,0 ); -dsi_vc_enable (dsidev, channel, true); -dsi_if_enable (dsidev, true); +dsi_vc_enable (dsi, channel, true); +dsi_if_enable (dsi, true); } r =dss_mgr_enable (dispc_channel);
@@ -3991,11 +3908,11 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) err_mgr_enable:if (dsi->mode ==OMAP_DSS_DSI_VIDEO_MODE ) { -dsi_if_enable (dsidev, false); -dsi_vc_enable (dsidev, channel, false); +dsi_if_enable (dsi, false); +dsi_vc_enable (dsi, channel, false); } err_pix_fmt: -dsi_display_uninit_dispc (dsidev, dispc_channel); +dsi_display_uninit_dispc (dsi, dispc_channel); err_init_dispc:return r; }
@@ -4007,24 +3924,23 @@ static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channelenum omap_channel dispc_channel = dssdev->dispc_channel;if (dsi->mode ==OMAP_DSS_DSI_VIDEO_MODE ) { -dsi_if_enable (dsidev, false); -dsi_vc_enable (dsidev, channel, false); +dsi_if_enable (dsi, false); +dsi_vc_enable (dsi, channel, false);/* MODE, 0 = command mode */ -REG_FLD_MOD (dsidev,DSI_VC_CTRL (channel),0 ,4 ,4 ); +REG_FLD_MOD (dsi,DSI_VC_CTRL (channel),0 ,4 ,4 ); -dsi_vc_enable (dsidev, channel, true); -dsi_if_enable (dsidev, true); +dsi_vc_enable (dsi, channel, true); +dsi_if_enable (dsi, true); }dss_mgr_disable (dispc_channel); -dsi_display_uninit_dispc (dsidev, dispc_channel); +dsi_display_uninit_dispc (dsi, dispc_channel); } -static void dsi_update_screen_dispc (struct platform_device *dsidev) +static void dsi_update_screen_dispc (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);enum omap_channel dispc_channel = dsi->output.dispc_channel;unsigned int bytespp;unsigned int bytespl;
@@ -4041,7 +3957,7 @@ static void dsi_update_screen_dispc(struct platform_device *dsidev)DSSDBG ("dsi_update_screen_dispc(%dx%d)\n" , w, h); -dsi_vc_config_source (dsidev, channel,DSI_VC_SOURCE_VP ); +dsi_vc_config_source (dsi, channel,DSI_VC_SOURCE_VP ); bytespp =dsi_get_pixel_size (dsi->pix_fmt) /8 ; bytespl = w * bytespp;
@@ -4062,16 +3978,16 @@ static void dsi_update_screen_dispc(struct platform_device *dsidev) total_len += (bytespf % packet_payload) +1 ; l =FLD_VAL (total_len,23 ,0 );/* TE_SIZE */ -dsi_write_reg (dsidev,DSI_VC_TE (channel), l); +dsi_write_reg (dsi,DSI_VC_TE (channel), l); -dsi_vc_write_long_header (dsidev, channel,MIPI_DSI_DCS_LONG_WRITE , +dsi_vc_write_long_header (dsi, channel,MIPI_DSI_DCS_LONG_WRITE , packet_len,0 );if (dsi->te_enabled) l =FLD_MOD (l,1 ,30 ,30 );/* TE_EN */ else l =FLD_MOD (l,1 ,31 ,31 );/* TE_START */ -dsi_write_reg (dsidev,DSI_VC_TE (channel), l); +dsi_write_reg (dsi,DSI_VC_TE (channel), l);/* We put SIDLEMODE to no-idle for the duration of the transfer, * because DSS interrupts are not capable of waking up the CPU and the
@@ -4081,7 +3997,7 @@ static void dsi_update_screen_dispc(struct platform_device *dsidev)*/ dispc_disable_sidle (); -dsi_perf_mark_start (dsidev); +dsi_perf_mark_start (dsi); r =schedule_delayed_work (&dsi->framedone_timeout_work,msecs_to_jiffies (250 ));
@@ -4094,9 +4010,9 @@ static void dsi_update_screen_dispc(struct platform_device *dsidev)if (dsi->te_enabled) {/* disable LP_RX_TO, so that we can receive TE. Time to wait * for TE is longer than the timer allows */ -REG_FLD_MOD (dsidev,DSI_TIMING2 ,0 ,15 ,15 );/* LP_RX_TO */ +REG_FLD_MOD (dsi,DSI_TIMING2 ,0 ,15 ,15 );/* LP_RX_TO */ -dsi_vc_send_bta (dsidev, channel); +dsi_vc_send_bta (dsi, channel);#ifdef DSI_CATCH_MISSING_TE mod_timer (&dsi->te_timer, jiffies +msecs_to_jiffies (250 ));
@@ -4111,22 +4027,20 @@ static void dsi_te_timeout(struct timer_list *unused) }#endif -static void dsi_handle_framedone (struct platform_device *dsidev,int error) +static void dsi_handle_framedone (struct dsi_data *dsi,int error) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -/* SIDLEMODE back to smart-idle */ dispc_enable_sidle ();if (dsi->te_enabled) {/* enable LP_RX_TO again after the TE */ -REG_FLD_MOD (dsidev,DSI_TIMING2 ,1 ,15 ,15 );/* LP_RX_TO */ +REG_FLD_MOD (dsi,DSI_TIMING2 ,1 ,15 ,15 );/* LP_RX_TO */ } dsi->framedone_callback (error, dsi->framedone_data);if (!error) -dsi_perf_show (dsidev,"DISPC" ); +dsi_perf_show (dsi,"DISPC" ); }static void dsi_framedone_timeout_work_callback (struct work_struct *work)
@@ -4142,13 +4056,12 @@ static void dsi_framedone_timeout_work_callback(struct work_struct *work)DSSERR ("Framedone not received for 250ms!\n" ); -dsi_handle_framedone (dsi->pdev, -ETIMEDOUT ); +dsi_handle_framedone (dsi, -ETIMEDOUT ); }static void dsi_framedone_irq_callback (void *data) { -struct platform_device *dsidev = (struct platform_device *) data; -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi = data;/* Note: We get FRAMEDONE when DISPC has finished sending pixels and * turns itself off. However, DSI still has the pixels in its buffers,
@@ -4157,7 +4070,7 @@ static void dsi_framedone_irq_callback(void *data)cancel_delayed_work (&dsi->framedone_timeout_work); -dsi_handle_framedone (dsidev,0 ); +dsi_handle_framedone (dsi,0 ); } static int dsi_update(struct omap_dss_device *dssdev, int channel,
@@ -4167,7 +4080,7 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);u16 dw, dh; -dsi_perf_mark_setup (dsidev); +dsi_perf_mark_setup (dsi); dsi->update_channel = channel;
@@ -4181,21 +4094,20 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel, dsi->update_bytes = dw * dh *dsi_get_pixel_size (dsi->pix_fmt) /8 ;#endif -dsi_update_screen_dispc (dsidev); +dsi_update_screen_dispc (dsi);return 0 ; }/* Display funcs */ -static int dsi_configure_dispc_clocks (struct platform_device *dsidev) +static int dsi_configure_dispc_clocks (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);struct dispc_clock_info dispc_cinfo;int r;unsigned long fck; - fck =dsi_get_pll_hsdiv_dispc_rate (dsidev); + fck =dsi_get_pll_hsdiv_dispc_rate (dsi); dispc_cinfo.lck_div = dsi->user_dispc_cinfo.lck_div; dispc_cinfo.pck_div = dsi->user_dispc_cinfo.pck_div;
@@ -4211,10 +4123,9 @@ static int dsi_configure_dispc_clocks(struct platform_device *dsidev)return 0 ; } -static int dsi_display_init_dispc (struct platform_device *dsidev, -enum omap_channel channel) +static int dsi_display_init_dispc (struct dsi_data *dsi, +enum omap_channel channel) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int r; dss_select_lcd_clk_source(dsi->dss, channel, dsi->module_id == 0 ?
@@ -4223,7 +4134,7 @@ static int dsi_display_init_dispc(struct platform_device *dsidev,if (dsi->mode ==OMAP_DSS_DSI_CMD_MODE ) { r =dss_mgr_register_framedone_handler (channel, - dsi_framedone_irq_callback, dsidev); + dsi_framedone_irq_callback, dsi);if (r) {DSSERR ("can't register FRAMEDONE handler\n" ); goto err;
@@ -4254,7 +4165,7 @@ static int dsi_display_init_dispc(struct platform_device *dsidev,dss_mgr_set_timings (channel, &dsi->vm); - r =dsi_configure_dispc_clocks (dsidev); + r =dsi_configure_dispc_clocks (dsi);if (r) goto err1;
@@ -4269,27 +4180,24 @@ static int dsi_display_init_dispc(struct platform_device *dsidev, err1:if (dsi->mode ==OMAP_DSS_DSI_CMD_MODE )dss_mgr_unregister_framedone_handler (channel, - dsi_framedone_irq_callback, dsidev); + dsi_framedone_irq_callback, dsi); err:dss_select_lcd_clk_source (dsi->dss, channel,DSS_CLK_SRC_FCK );return r; } -static void dsi_display_uninit_dispc (struct platform_device *dsidev, -enum omap_channel channel) +static void dsi_display_uninit_dispc (struct dsi_data *dsi, +enum omap_channel channel) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -if (dsi->mode ==OMAP_DSS_DSI_CMD_MODE )dss_mgr_unregister_framedone_handler (channel, - dsi_framedone_irq_callback, dsidev); + dsi_framedone_irq_callback, dsi);dss_select_lcd_clk_source (dsi->dss, channel,DSS_CLK_SRC_FCK ); } -static int dsi_configure_dsi_clocks (struct platform_device *dsidev) +static int dsi_configure_dsi_clocks (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);struct dss_pll_clock_info cinfo;int r;
@@ -4304,16 +4212,15 @@ static int dsi_configure_dsi_clocks(struct platform_device *dsidev)return 0 ; } -static int dsi_display_init_dsi (struct platform_device *dsidev) +static int dsi_display_init_dsi (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);int r; r =dss_pll_enable (&dsi->pll);if (r) goto err0; - r =dsi_configure_dsi_clocks (dsidev); + r =dsi_configure_dsi_clocks (dsi);if (r) goto err1;
@@ -4323,33 +4230,33 @@ static int dsi_display_init_dsi(struct platform_device *dsidev)DSSDBG ("PLL OK\n" ); - r =dsi_cio_init (dsidev); + r =dsi_cio_init (dsi);if (r) goto err2; -_dsi_print_reset_status (dsidev); +_dsi_print_reset_status (dsi); -dsi_proto_timings (dsidev); -dsi_set_lp_clk_divisor (dsidev); +dsi_proto_timings (dsi); +dsi_set_lp_clk_divisor (dsi);if (1 ) -_dsi_print_reset_status (dsidev); +_dsi_print_reset_status (dsi); - r =dsi_proto_config (dsidev); + r =dsi_proto_config (dsi);if (r) goto err3;/* enable interface */ -dsi_vc_enable (dsidev,0 ,1 ); -dsi_vc_enable (dsidev,1 ,1 ); -dsi_vc_enable (dsidev,2 ,1 ); -dsi_vc_enable (dsidev,3 ,1 ); -dsi_if_enable (dsidev,1 ); -dsi_force_tx_stop_mode_io (dsidev); +dsi_vc_enable (dsi,0 ,1 ); +dsi_vc_enable (dsi,1 ,1 ); +dsi_vc_enable (dsi,2 ,1 ); +dsi_vc_enable (dsi,3 ,1 ); +dsi_if_enable (dsi,1 ); +dsi_force_tx_stop_mode_io (dsi);return 0 ; err3: -dsi_cio_uninit (dsidev); +dsi_cio_uninit (dsi); err2:dss_select_dsi_clk_source (dsi->dss, dsi->module_id,DSS_CLK_SRC_FCK ); err1:
@@ -4358,24 +4265,22 @@ static int dsi_display_init_dsi(struct platform_device *dsidev)return r; } -static void dsi_display_uninit_dsi (struct platform_device *dsidev, -bool disconnect_lanes,bool enter_ulps) +static void dsi_display_uninit_dsi (struct dsi_data *dsi,bool disconnect_lanes, +bool enter_ulps) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); -if (enter_ulps && !dsi->ulps_enabled) -dsi_enter_ulps (dsidev); +dsi_enter_ulps (dsi);/* disable interface */ -dsi_if_enable (dsidev,0 ); -dsi_vc_enable (dsidev,0 ,0 ); -dsi_vc_enable (dsidev,1 ,0 ); -dsi_vc_enable (dsidev,2 ,0 ); -dsi_vc_enable (dsidev,3 ,0 ); +dsi_if_enable (dsi,0 ); +dsi_vc_enable (dsi,0 ,0 ); +dsi_vc_enable (dsi,1 ,0 ); +dsi_vc_enable (dsi,2 ,0 ); +dsi_vc_enable (dsi,3 ,0 );dss_select_dsi_clk_source (dsi->dss, dsi->module_id,DSS_CLK_SRC_FCK ); -dsi_cio_uninit (dsidev); -dsi_pll_uninit (dsidev, disconnect_lanes); +dsi_cio_uninit (dsi); +dsi_pll_uninit (dsi, disconnect_lanes); }static int dsi_display_enable (struct omap_dss_device *dssdev)
@@ -4386,17 +4291,17 @@ static int dsi_display_enable(struct omap_dss_device *dssdev)DSSDBG ("dsi_display_enable\n" ); -WARN_ON (!dsi_bus_is_locked (dsidev)); +WARN_ON (!dsi_bus_is_locked (dsi));mutex_lock (&dsi->lock); - r =dsi_runtime_get (dsidev); + r =dsi_runtime_get (dsi);if (r) goto err_get_dsi; -_dsi_initialize_irq (dsidev); +_dsi_initialize_irq (dsi); - r =dsi_display_init_dsi (dsidev); + r =dsi_display_init_dsi (dsi);if (r) goto err_init_dsi;
@@ -4405,7 +4310,7 @@ static int dsi_display_enable(struct omap_dss_device *dssdev)return 0 ; err_init_dsi: -dsi_runtime_put (dsidev); +dsi_runtime_put (dsi); err_get_dsi:mutex_unlock (&dsi->lock);DSSDBG ("dsi_display_enable FAILED\n" );
@@ -4420,18 +4325,18 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,DSSDBG ("dsi_display_disable\n" ); -WARN_ON (!dsi_bus_is_locked (dsidev)); +WARN_ON (!dsi_bus_is_locked (dsi));mutex_lock (&dsi->lock); -dsi_sync_vc (dsidev,0 ); -dsi_sync_vc (dsidev,1 ); -dsi_sync_vc (dsidev,2 ); -dsi_sync_vc (dsidev,3 ); +dsi_sync_vc (dsi,0 ); +dsi_sync_vc (dsi,1 ); +dsi_sync_vc (dsi,2 ); +dsi_sync_vc (dsi,3 ); -dsi_display_uninit_dsi (dsidev, disconnect_lanes, enter_ulps); +dsi_display_uninit_dsi (dsi, disconnect_lanes, enter_ulps); -dsi_runtime_put (dsidev); +dsi_runtime_put (dsi);mutex_unlock (&dsi->lock); }
@@ -4568,7 +4473,7 @@ static bool dsi_cm_calc_pll_cb(int n, int m, unsigned long fint, unsigned long clkdco, void *data) { struct dsi_clk_calc_ctx *ctx = data; -struct dsi_data *dsi =dsi_get_dsidrv_data (ctx->dsidev); +struct dsi_data *dsi = ctx->dsi; ctx->dsi_cinfo.n = n; ctx->dsi_cinfo.m = m;
@@ -4604,7 +4509,7 @@ static bool dsi_cm_calc(struct dsi_data *dsi, txbyteclk = pck * bitspp /8 / ndl;memset (ctx,0 ,sizeof (*ctx)); - ctx->dsidev = dsi->pdev; + ctx->dsi = dsi; ctx->pll = &dsi->pll; ctx->config = cfg; ctx->req_pck_min = pck;
@@ -4621,7 +4526,7 @@ static bool dsi_cm_calc(struct dsi_data *dsi,static bool dsi_vm_calc_blanking (struct dsi_clk_calc_ctx *ctx) { -struct dsi_data *dsi =dsi_get_dsidrv_data (ctx->dsidev); +struct dsi_data *dsi = ctx->dsi;const struct omap_dss_dsi_config *cfg = ctx->config;int bitspp =dsi_get_pixel_size (cfg->pixel_format);int ndl = dsi->num_lanes_used -1 ;
@@ -4868,7 +4773,7 @@ static bool dsi_vm_calc_pll_cb(int n, int m, unsigned long fint, unsigned long clkdco, void *data) { struct dsi_clk_calc_ctx *ctx = data; -struct dsi_data *dsi =dsi_get_dsidrv_data (ctx->dsidev); +struct dsi_data *dsi = ctx->dsi; ctx->dsi_cinfo.n = n; ctx->dsi_cinfo.m = m;
@@ -4895,7 +4800,7 @@ static bool dsi_vm_calc(struct dsi_data *dsi, clkin =clk_get_rate (dsi->pll.clkin);memset (ctx,0 ,sizeof (*ctx)); - ctx->dsidev = dsi->pdev; + ctx->dsi = dsi; ctx->pll = &dsi->pll; ctx->config = cfg;
@@ -5068,12 +4973,11 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel) } -static int dsi_get_clocks (struct platform_device *dsidev) +static int dsi_get_clocks (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);struct clk *clk; - clk =devm_clk_get (&dsidev->dev,"fck" ); + clk =devm_clk_get (&dsi->pdev->dev,"fck" );if (IS_ERR (clk)) {DSSERR ("can't get fck\n" );return PTR_ERR (clk);
@@ -5088,10 +4992,11 @@ static int dsi_connect(struct omap_dss_device *dssdev, struct omap_dss_device *dst) {struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); +struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);enum omap_channel dispc_channel = dssdev->dispc_channel;int r; - r =dsi_regulator_init (dsidev); + r =dsi_regulator_init (dsi);if (r)return r;
@@ -5164,12 +5069,11 @@ static const struct omapdss_dsi_ops dsi_ops = { .set_max_rx_packet_size = dsi_vc_set_max_rx_packet_size, }; -static void dsi_init_output (struct platform_device *dsidev) +static void dsi_init_output (struct dsi_data *dsi) { -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev);struct omap_dss_device *out = &dsi->output;
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Part of the diff is not shown here. View the raw message.
PATCH v2 16/30 drm: omapdrm: dsi: Combine two commonly used inline functions
In reply to Laurent PinchartThe dsi_get_dsidrv_data() and dsi_get_dsidev_from_dssdev() inline functions convert a struct omap_dss_device pointer to the corresponding struct platform_device, and a struct platform_device pointer to the corresponding struct dsi_data. They are nearly always called together without any use of the intermediate platform_device, so combine them into a single function.
In the three locations where only dsi_get_dsidrv_data() is used, call dev_get_drvdata() directly.
--- drivers/gpu/drm/omapdrm/dss/dsi.c | 90 +++++++++++++-------------------------- 1 file changed, 30 insertions(+), 60 deletions(-)
drivers/gpu/drm/omapdrm/dss/dsi.c +30 -60
@@ -439,14 +439,9 @@ static bool dsi_perf;module_param (dsi_perf, bool,0644 );#endif -static inline struct dsi_data *dsi_get_dsidrv_data (struct platform_device *dsidev) +static inline struct dsi_data *to_dsi_data (struct omap_dss_device *dssdev) { -return dev_get_drvdata (&dsidev->dev); -} - -static inline struct platform_device *dsi_get_dsidev_from_dssdev (struct omap_dss_device *dssdev) -{ -return to_platform_device (dssdev->dev); +return dev_get_drvdata (dssdev->dev); }static struct dsi_data *dsi_get_dsi_from_id (int module)
@@ -467,7 +462,7 @@ static struct dsi_data *dsi_get_dsi_from_id(int module) out =omap_dss_get_output (id); -return out ?dsi_get_dsidrv_data (to_platform_device (out->dev)) :NULL ; +return out ?to_dsi_data (out) :NULL ; } static inline void dsi_write_reg(struct dsi_data *dsi,
@@ -501,16 +496,14 @@ static inline u32 dsi_read_reg(struct dsi_data *dsi, const struct dsi_reg idx)static void dsi_bus_lock (struct omap_dss_device *dssdev) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);down (&dsi->bus_lock); }static void dsi_bus_unlock (struct omap_dss_device *dssdev) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);up (&dsi->bus_lock); }
@@ -2534,8 +2527,7 @@ static int dsi_vc_config_source(struct dsi_data *dsi, int channel,static void dsi_vc_enable_hs (struct omap_dss_device *dssdev,int channel,bool enable) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);DSSDBG ("dsi_vc_enable_hs(%d, %d)\n" , channel, enable);
@@ -2658,8 +2650,7 @@ static int dsi_vc_send_bta(struct dsi_data *dsi, int channel)static int dsi_vc_send_bta_sync (struct omap_dss_device *dssdev,int channel) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);DECLARE_COMPLETION_ONSTACK (completion);int r =0 ;u32 err;
@@ -2861,8 +2852,7 @@ static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,static int dsi_vc_dcs_write_nosync (struct omap_dss_device *dssdev,int channel,u8 *data,int len) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);return dsi_vc_write_nosync_common (dsi, channel, data, len,DSS_DSI_CONTENT_DCS );
@@ -2871,8 +2861,7 @@ static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,static int dsi_vc_generic_write_nosync (struct omap_dss_device *dssdev,int channel,u8 *data,int len) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);return dsi_vc_write_nosync_common (dsi, channel, data, len,DSS_DSI_CONTENT_GENERIC );
@@ -2882,8 +2871,7 @@ static int dsi_vc_write_common(struct omap_dss_device *dssdev, int channel, u8 *data, int len, enum dss_dsi_content_type type) { - struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); + struct dsi_data *dsi = to_dsi_data(dssdev);int r; r =dsi_vc_write_nosync_common (dsi, channel, data, len, type);
@@ -3088,8 +3076,7 @@ static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, int channel, u8 *buf,static int dsi_vc_dcs_read (struct omap_dss_device *dssdev,int channel,u8 dcs_cmd,u8 *buf,int buflen) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);int r; r =dsi_vc_dcs_send_read_request (dsi, channel, dcs_cmd);
@@ -3119,8 +3106,7 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cstatic int dsi_vc_generic_read (struct omap_dss_device *dssdev,int channel,u8 *reqdata,int reqlen,u8 *buf,int buflen) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);int r; r =dsi_vc_generic_send_read_request (dsi, channel, reqdata, reqlen);
@@ -3147,8 +3133,7 @@ static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,static int dsi_vc_set_max_rx_packet_size (struct omap_dss_device *dssdev,int channel,u16 len) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);return dsi_vc_send_short (dsi, channel,MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE , len,0 );
@@ -3782,8 +3767,7 @@ static void dsi_proto_timings(struct dsi_data *dsi)static int dsi_configure_pins (struct omap_dss_device *dssdev,const struct omap_dsi_pin_config *pin_cfg) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);int num_pins;const int *pins;struct dsi_lane_config lanes[DSI_MAX_NR_LANES ];
@@ -3848,8 +3832,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,static int dsi_enable_video_output (struct omap_dss_device *dssdev,int channel) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);enum omap_channel dispc_channel = dssdev->dispc_channel;int bpp =dsi_get_pixel_size (dsi->pix_fmt);struct omap_dss_device *out = &dsi->output;
@@ -3919,8 +3902,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)static void dsi_disable_video_output (struct omap_dss_device *dssdev,int channel) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);enum omap_channel dispc_channel = dssdev->dispc_channel;if (dsi->mode ==OMAP_DSS_DSI_VIDEO_MODE ) {
@@ -4076,8 +4058,7 @@ static void dsi_framedone_irq_callback(void *data)static int dsi_update (struct omap_dss_device *dssdev,int channel,void (*callback)(int ,void *),void *data) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);u16 dw, dh;dsi_perf_mark_setup (dsi);
@@ -4285,8 +4266,7 @@ static void dsi_display_uninit_dsi(struct dsi_data *dsi, bool disconnect_lanes,static int dsi_display_enable (struct omap_dss_device *dssdev) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);int r =0 ;DSSDBG ("dsi_display_enable\n" );
@@ -4320,8 +4300,7 @@ static int dsi_display_enable(struct omap_dss_device *dssdev)static void dsi_display_disable (struct omap_dss_device *dssdev,bool disconnect_lanes,bool enter_ulps) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);DSSDBG ("dsi_display_disable\n" );
@@ -4343,8 +4322,7 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,static int dsi_enable_te (struct omap_dss_device *dssdev,bool enable) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev); dsi->te_enabled = enable;return 0 ;
@@ -4830,8 +4808,7 @@ static bool dsi_vm_calc(struct dsi_data *dsi,static int dsi_set_config (struct omap_dss_device *dssdev,const struct omap_dss_dsi_config *config) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);struct dsi_clk_calc_ctx ctx;bool ok;int r;
@@ -4918,8 +4895,7 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)static int dsi_request_vc (struct omap_dss_device *dssdev,int *channel) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);int i;for (i =0 ; i <ARRAY_SIZE (dsi->vc); i++) {
@@ -4936,8 +4912,7 @@ static int dsi_request_vc(struct omap_dss_device *dssdev, int *channel)static int dsi_set_vc_id (struct omap_dss_device *dssdev,int channel,int vc_id) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);if (vc_id <0 || vc_id >3 ) {DSSERR ("VC ID out of range\n" );
@@ -4962,8 +4937,7 @@ static int dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id)static void dsi_release_vc (struct omap_dss_device *dssdev,int channel) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);if ((channel >=0 && channel <=3 ) && dsi->vc[channel].dssdev == dssdev) {
@@ -4991,8 +4965,7 @@ static int dsi_get_clocks(struct dsi_data *dsi)static int dsi_connect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { -struct platform_device *dsidev =dsi_get_dsidev_from_dssdev (dssdev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =to_dsi_data (dssdev);enum omap_channel dispc_channel = dssdev->dispc_channel;int r;
@@ -5507,13 +5480,12 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)static void dsi_unbind (struct device *dev,struct device *master,void *data) { -struct platform_device *dsidev =to_platform_device (dev); -struct dsi_data *dsi =dsi_get_dsidrv_data (dsidev); +struct dsi_data *dsi =dev_get_drvdata (dev);dss_debugfs_remove_file (dsi->debugfs.irqs);dss_debugfs_remove_file (dsi->debugfs.regs); -of_platform_depopulate (&dsidev->dev); +of_platform_depopulate (dev);WARN_ON (dsi->scp_clk_refcount >0 );
@@ -5521,7 +5493,7 @@ static void dsi_unbind(struct device *dev, struct device *master, void *data)dsi_uninit_output (dsi); -pm_runtime_disable (&dsidev->dev); +pm_runtime_disable (dev);if (dsi->vdds_dsi_reg !=NULL && dsi->vdds_dsi_enabled) {regulator_disable (dsi->vdds_dsi_reg);
@@ -5547,8 +5519,7 @@ static int dsi_remove(struct platform_device *pdev)static int dsi_runtime_suspend (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct dsi_data *dsi =dsi_get_dsidrv_data (pdev); +struct dsi_data *dsi =dev_get_drvdata (dev); dsi->is_enabled = false;/* ensure the irq handler sees the is_enabled value */
@@ -5563,8 +5534,7 @@ static int dsi_runtime_suspend(struct device *dev)static int dsi_runtime_resume (struct device *dev) { -struct platform_device *pdev =to_platform_device (dev); -struct dsi_data *dsi =dsi_get_dsidrv_data (pdev); +struct dsi_data *dsi =dev_get_drvdata (dev);int r; r =dispc_runtime_get ();
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 17/30 drm: omapdrm: dsi: Use dev pointer directly in dsi_bind() function
In reply to Laurent PinchartThe dsi_bind() function receives a pointer to a struct device that it casts to a struct platform_device, only to use the platform device's dev field through the code. Use the dev pointer directly.
While at it rename the struct platform_device pointer dsidev to pdev to make it more explicit.
--- drivers/gpu/drm/omapdrm/dss/dsi.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)
drivers/gpu/drm/omapdrm/dss/dsi.c +18 -17
@@ -5299,9 +5299,10 @@ static const struct soc_device_attribute dsi_soc_devices[] = { { .machine = "AM35*", .data = &dsi_of_data_omap34xx }, {/* sentinel */ } }; +static int dsi_bind (struct device *dev,struct device *master,void *data) { -struct platform_device *dsidev =to_platform_device (dev); +struct platform_device *pdev =to_platform_device (dev);struct dss_device *dss =dss_get_device (master);const struct soc_device_attribute *soc;const struct dsi_module_id_data *d;
@@ -5311,13 +5312,13 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)struct resource *dsi_mem;struct resource *res; - dsi =devm_kzalloc (&dsidev->dev,sizeof (*dsi),GFP_KERNEL ); + dsi =devm_kzalloc (dev,sizeof (*dsi),GFP_KERNEL );if (!dsi)return -ENOMEM ; dsi->dss = dss; - dsi->pdev = dsidev; -dev_set_drvdata (&dsidev->dev, dsi); + dsi->pdev = pdev; +dev_set_drvdata (dev, dsi);spin_lock_init (&dsi->irq_lock);spin_lock_init (&dsi->errors_lock);
@@ -5338,29 +5339,29 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)timer_setup (&dsi->te_timer, dsi_te_timeout,0 );#endif - dsi_mem =platform_get_resource_byname (dsidev,IORESOURCE_MEM ,"proto" ); - dsi->proto_base =devm_ioremap_resource (&dsidev->dev, dsi_mem); + dsi_mem =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"proto" ); + dsi->proto_base =devm_ioremap_resource (dev, dsi_mem);if (IS_ERR (dsi->proto_base))return PTR_ERR (dsi->proto_base); - res =platform_get_resource_byname (dsidev,IORESOURCE_MEM ,"phy" ); - dsi->phy_base =devm_ioremap_resource (&dsidev->dev, res); + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"phy" ); + dsi->phy_base =devm_ioremap_resource (dev, res);if (IS_ERR (dsi->phy_base))return PTR_ERR (dsi->phy_base); - res =platform_get_resource_byname (dsidev,IORESOURCE_MEM ,"pll" ); - dsi->pll_base =devm_ioremap_resource (&dsidev->dev, res); + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"pll" ); + dsi->pll_base =devm_ioremap_resource (dev, res);if (IS_ERR (dsi->pll_base))return PTR_ERR (dsi->pll_base); - dsi->irq =platform_get_irq (dsi->pdev,0 ); + dsi->irq =platform_get_irq (pdev,0 );if (dsi->irq <0 ) {DSSERR ("platform_get_irq failed\n" );return -ENODEV ; } - r =devm_request_irq (&dsidev->dev, dsi->irq, omap_dsi_irq_handler, -IRQF_SHARED ,dev_name (&dsidev->dev), dsi); + r =devm_request_irq (dev, dsi->irq, omap_dsi_irq_handler, +IRQF_SHARED ,dev_name (dev), dsi);if (r <0 ) {DSSERR ("request_irq failed\n" );return r;
@@ -5414,14 +5415,14 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)dsi_init_pll_data (dss, dsi); -pm_runtime_enable (&dsidev->dev); +pm_runtime_enable (dev); r =dsi_runtime_get (dsi);if (r) goto err_runtime_get; rev =dsi_read_reg (dsi,DSI_REVISION ); -dev_dbg (&dsidev->dev,"OMAP DSI rev %d.%d\n" , +dev_dbg (dev,"OMAP DSI rev %d.%d\n" ,FLD_GET (rev,7 ,4 ),FLD_GET (rev,3 ,0 ));/* DSI on OMAP3 doesn't have register DSI_GNQ, set number
@@ -5442,7 +5443,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) goto err_probe_of; } - r =of_platform_populate (dsidev->dev.of_node,NULL ,NULL , &dsidev->dev); + r =of_platform_populate (dev->of_node,NULL ,NULL , dev);if (r)DSSERR ("Failed to populate DSI child devices: %d\n" , r);
@@ -5474,7 +5475,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)dsi_runtime_put (dsi); err_runtime_get: -pm_runtime_disable (&dsidev->dev); +pm_runtime_disable (dev);return r; }
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 18/30 drm: omapdrm: dsi: Store the struct device pointer in struct dsi_data
In reply to Laurent PinchartThe dsi_data structure stores a pointer to a struct platform_device. The driver only uses the dev member of the platform device structure. Store the struct device pointer instead and use it directly.
--- drivers/gpu/drm/omapdrm/dss/dsi.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/omapdrm/dss/dsi.c +13 -13
@@ -330,7 +330,7 @@ struct dsi_of_data { };struct dsi_data { -struct platform_device *pdev; +struct device *dev;void __iomem *proto_base;void __iomem *phy_base;void __iomem *pll_base;
@@ -1144,7 +1144,7 @@ static int dsi_runtime_get(struct dsi_data *dsi)DSSDBG ("dsi_runtime_get\n" ); - r =pm_runtime_get_sync (&dsi->pdev->dev); + r =pm_runtime_get_sync (dsi->dev);WARN_ON (r <0 );return r <0 ? r :0 ; }
@@ -1155,7 +1155,7 @@ static void dsi_runtime_put(struct dsi_data *dsi)DSSDBG ("dsi_runtime_put\n" ); - r =pm_runtime_put_sync (&dsi->pdev->dev); + r =pm_runtime_put_sync (dsi->dev);WARN_ON (r <0 && r != -ENOSYS ); }
@@ -1166,7 +1166,7 @@ static int dsi_regulator_init(struct dsi_data *dsi)if (dsi->vdds_dsi_reg !=NULL )return 0 ; - vdds_dsi =devm_regulator_get (&dsi->pdev->dev,"vdd" ); + vdds_dsi =devm_regulator_get (dsi->dev,"vdd" );if (IS_ERR (vdds_dsi)) {if (PTR_ERR (vdds_dsi) != -EPROBE_DEFER )
@@ -4951,7 +4951,7 @@ static int dsi_get_clocks(struct dsi_data *dsi) {struct clk *clk; - clk =devm_clk_get (&dsi->pdev->dev,"fck" ); + clk =devm_clk_get (dsi->dev,"fck" );if (IS_ERR (clk)) {DSSERR ("can't get fck\n" );return PTR_ERR (clk);
@@ -5046,7 +5046,7 @@ static void dsi_init_output(struct dsi_data *dsi) {struct omap_dss_device *out = &dsi->output; - out->dev = &dsi->pdev->dev; + out->dev = dsi->dev; out->id = dsi->module_id ==0 ?OMAP_DSS_OUTPUT_DSI1 :OMAP_DSS_OUTPUT_DSI2 ;
@@ -5068,7 +5068,7 @@ static void dsi_uninit_output(struct dsi_data *dsi)static int dsi_probe_of (struct dsi_data *dsi) { -struct device_node *node = dsi->pdev->dev.of_node; +struct device_node *node = dsi->dev->of_node;struct property *prop;u32 lane_arr[10 ];int len, num_pins;
@@ -5082,7 +5082,7 @@ static int dsi_probe_of(struct dsi_data *dsi) prop =of_find_property (ep,"lanes" , &len);if (prop ==NULL ) { -dev_err (&dsi->pdev->dev,"failed to find lane data\n" ); +dev_err (dsi->dev,"failed to find lane data\n" ); r = -EINVAL ; goto err; }
@@ -5091,14 +5091,14 @@ static int dsi_probe_of(struct dsi_data *dsi)if (num_pins <4 || num_pins %2 !=0 || num_pins > dsi->num_lanes_supported *2 ) { -dev_err (&dsi->pdev->dev,"bad number of lanes\n" ); +dev_err (dsi->dev,"bad number of lanes\n" ); r = -EINVAL ; goto err; } r =of_property_read_u32_array (ep,"lanes" , lane_arr, num_pins);if (r) { -dev_err (&dsi->pdev->dev,"failed to read lane data\n" ); +dev_err (dsi->dev,"failed to read lane data\n" ); goto err; }
@@ -5108,7 +5108,7 @@ static int dsi_probe_of(struct dsi_data *dsi) r =dsi_configure_pins (&dsi->output, &pin_cfg);if (r) { -dev_err (&dsi->pdev->dev,"failed to configure pins" ); +dev_err (dsi->dev,"failed to configure pins" ); goto err; }
@@ -5214,7 +5214,7 @@ static int dsi_init_pll_data(struct dss_device *dss, struct dsi_data *dsi)struct clk *clk;int r; - clk =devm_clk_get (&dsi->pdev->dev,"sys_clk" ); + clk =devm_clk_get (dsi->dev,"sys_clk" );if (IS_ERR (clk)) {DSSERR ("can't get sys_clk\n" );return PTR_ERR (clk);
@@ -5317,7 +5317,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)return -ENOMEM ; dsi->dss = dss; - dsi->pdev = pdev; + dsi->dev = dev;dev_set_drvdata (dev, dsi);spin_lock_init (&dsi->irq_lock);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 19/30 drm: omapdrm: dsi: Don't pass channel to dispc init/uninit functions
In reply to Laurent PinchartThe dsi_display_init_dispc() and dsi_display_uninit_dispc() functions take a channel argument that is reduntant as it is always identical to the dsi->output.dispc_channel. Remove the argument and use the field directly in the functions to avoid misuse.
--- drivers/gpu/drm/omapdrm/dss/dsi.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/gpu/drm/omapdrm/dss/dsi.c +10 -11
@@ -215,10 +215,8 @@ struct dsi_reg { u16 module; u16 idx; };typedef void (*omap_dsi_isr_t ) (void *arg,u32 mask);struct dsi_data ; -static int dsi_display_init_dispc (struct dsi_data *dsi, -enum omap_channel channel); -static void dsi_display_uninit_dispc (struct dsi_data *dsi, -enum omap_channel channel); +static int dsi_display_init_dispc (struct dsi_data *dsi); +static void dsi_display_uninit_dispc (struct dsi_data *dsi);static int dsi_vc_send_null (struct dsi_data *dsi,int channel);
@@ -3845,7 +3843,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)return -ENODEV ; } - r =dsi_display_init_dispc (dsi, dispc_channel); + r =dsi_display_init_dispc (dsi);if (r) goto err_init_dispc;
@@ -3895,7 +3893,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)dsi_vc_enable (dsi, channel, false); } err_pix_fmt: -dsi_display_uninit_dispc (dsi, dispc_channel); +dsi_display_uninit_dispc (dsi); err_init_dispc:return r; }
@@ -3918,7 +3916,7 @@ static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channeldss_mgr_disable (dispc_channel); -dsi_display_uninit_dispc (dsi, dispc_channel); +dsi_display_uninit_dispc (dsi); }static void dsi_update_screen_dispc (struct dsi_data *dsi)
@@ -4104,9 +4102,9 @@ static int dsi_configure_dispc_clocks(struct dsi_data *dsi)return 0 ; } -static int dsi_display_init_dispc (struct dsi_data *dsi, -enum omap_channel channel) +static int dsi_display_init_dispc (struct dsi_data *dsi) { +enum omap_channel channel = dsi->output.dispc_channel;int r; dss_select_lcd_clk_source(dsi->dss, channel, dsi->module_id == 0 ?
@@ -4167,9 +4165,10 @@ static int dsi_display_init_dispc(struct dsi_data *dsi,return r; } -static void dsi_display_uninit_dispc (struct dsi_data *dsi, -enum omap_channel channel) +static void dsi_display_uninit_dispc (struct dsi_data *dsi) { +enum omap_channel channel = dsi->output.dispc_channel; +if (dsi->mode ==OMAP_DSS_DSI_CMD_MODE )dss_mgr_unregister_framedone_handler (channel, dsi_framedone_irq_callback, dsi);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 20/30 drm: omapdrm: dss: Pass omap_dss_device pointer to dss_mgr_*() functions
In reply to Laurent PinchartThe dss_mgr_*() functions take a channel argument to identify the channel they operate on. This prevents the functions from accessing driver data structures without resorting to global variables. In an effort to remove global variables, pass the omap_dss_device pointer associated with the channel instead. This will be used to look up the omap_drm_private data structure to pass to the dss_mgr_ops.
--- drivers/gpu/drm/omapdrm/dss/dpi.c | 32 ++++++++++---------------- drivers/gpu/drm/omapdrm/dss/dsi.c | 30 +++++++++++-------------- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 20 ++++++----------- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 20 ++++++----------- drivers/gpu/drm/omapdrm/dss/omapdss.h | 22 +++++++++--------- drivers/gpu/drm/omapdrm/dss/output.c | 42 ++++++++++++++++++----------------- drivers/gpu/drm/omapdrm/dss/sdi.c | 28 +++++++++-------------- drivers/gpu/drm/omapdrm/dss/venc.c | 18 +++++---------- 8 files changed, 88 insertions(+), 124 deletions(-)
drivers/gpu/drm/omapdrm/dss/dpi.c +12 -20
@@ -343,8 +343,6 @@ static int dpi_set_dispc_clk(struct dpi_data *dpi, unsigned long pck_req,static int dpi_set_mode (struct dpi_data *dpi) { -struct omap_dss_device *out = &dpi->output; -enum omap_channel channel = out->dispc_channel;struct videomode *vm = &dpi->vm;int lck_div =0 , pck_div =0 ;unsigned long fck =0 ;
@@ -352,8 +350,8 @@ static int dpi_set_mode(struct dpi_data *dpi)int r =0 ;if (dpi->pll) - r =dpi_set_pll_clk (dpi, channel, vm->pixelclock, &fck, - &lck_div, &pck_div); + r =dpi_set_pll_clk (dpi, dpi->output.dispc_channel, + vm->pixelclock, &fck, &lck_div, &pck_div);else r =dpi_set_dispc_clk (dpi, vm->pixelclock, &fck, &lck_div, &pck_div);
@@ -369,16 +367,13 @@ static int dpi_set_mode(struct dpi_data *dpi) vm->pixelclock = pck; } -dss_mgr_set_timings (channel, vm); +dss_mgr_set_timings (&dpi->output, vm);return 0 ; }static void dpi_config_lcd_manager (struct dpi_data *dpi) { -struct omap_dss_device *out = &dpi->output; -enum omap_channel channel = out->dispc_channel; - dpi->mgr_config.io_pad_mode =DSS_IO_PAD_MODE_BYPASS ; dpi->mgr_config.stallmode = false;
@@ -388,14 +383,13 @@ static void dpi_config_lcd_manager(struct dpi_data *dpi) dpi->mgr_config.lcden_sig_polarity =0 ; -dss_mgr_set_lcd_config (channel, &dpi->mgr_config); +dss_mgr_set_lcd_config (&dpi->output, &dpi->mgr_config); }static int dpi_display_enable (struct omap_dss_device *dssdev) {struct dpi_data *dpi =dpi_get_data_from_dssdev (dssdev);struct omap_dss_device *out = &dpi->output; -enum omap_channel channel = out->dispc_channel;int r;mutex_lock (&dpi->lock);
@@ -416,7 +410,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)if (r) goto err_get_dispc; - r =dss_dpi_select_source (dpi->dss, out->port_num, channel); + r =dss_dpi_select_source (dpi->dss, out->port_num, out->dispc_channel);if (r) goto err_src_sel;
@@ -434,7 +428,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)mdelay (2 ); - r =dss_mgr_enable (channel); + r =dss_mgr_enable (&dpi->output);if (r) goto err_mgr_enable;
@@ -461,14 +455,14 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)static void dpi_display_disable (struct omap_dss_device *dssdev) {struct dpi_data *dpi =dpi_get_data_from_dssdev (dssdev); -enum omap_channel channel = dpi->output.dispc_channel;mutex_lock (&dpi->lock); -dss_mgr_disable (channel); +dss_mgr_disable (&dpi->output);if (dpi->pll) { -dss_select_lcd_clk_source (dpi->dss, channel,DSS_CLK_SRC_FCK ); +dss_select_lcd_clk_source (dpi->dss, dpi->output.dispc_channel, +DSS_CLK_SRC_FCK );dss_pll_disable (dpi->pll); }
@@ -658,7 +652,6 @@ static int dpi_connect(struct omap_dss_device *dssdev, struct omap_dss_device *dst) {struct dpi_data *dpi =dpi_get_data_from_dssdev (dssdev); -enum omap_channel channel = dpi->output.dispc_channel;int r; r =dpi_init_regulator (dpi);
@@ -667,7 +660,7 @@ static int dpi_connect(struct omap_dss_device *dssdev,dpi_init_pll (dpi); - r =dss_mgr_connect (channel, dssdev); + r =dss_mgr_connect (&dpi->output, dssdev);if (r)return r;
@@ -675,7 +668,7 @@ static int dpi_connect(struct omap_dss_device *dssdev,if (r) {DSSERR ("failed to connect output to new device: %s\n" , dst->name); -dss_mgr_disconnect (channel, dssdev); +dss_mgr_disconnect (&dpi->output, dssdev);return r; }
@@ -686,7 +679,6 @@ static void dpi_disconnect(struct omap_dss_device *dssdev, struct omap_dss_device *dst) {struct dpi_data *dpi =dpi_get_data_from_dssdev (dssdev); -enum omap_channel channel = dpi->output.dispc_channel;WARN_ON (dst != dssdev->dst);
@@ -695,7 +687,7 @@ static void dpi_disconnect(struct omap_dss_device *dssdev,omapdss_output_unset_device (dssdev); -dss_mgr_disconnect (channel, dssdev); +dss_mgr_disconnect (&dpi->output, dssdev); }static const struct omapdss_dpi_ops dpi_ops = {
drivers/gpu/drm/omapdrm/dss/dsi.c +13 -17
@@ -3831,7 +3831,6 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,static int dsi_enable_video_output (struct omap_dss_device *dssdev,int channel) {struct dsi_data *dsi =to_dsi_data (dssdev); -enum omap_channel dispc_channel = dssdev->dispc_channel;int bpp =dsi_get_pixel_size (dsi->pix_fmt);struct omap_dss_device *out = &dsi->output;u8 data_type;
@@ -3881,7 +3880,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)dsi_if_enable (dsi, true); } - r =dss_mgr_enable (dispc_channel); + r =dss_mgr_enable (&dsi->output);if (r) goto err_mgr_enable;
@@ -3901,7 +3900,6 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)static void dsi_disable_video_output (struct omap_dss_device *dssdev,int channel) {struct dsi_data *dsi =to_dsi_data (dssdev); -enum omap_channel dispc_channel = dssdev->dispc_channel;if (dsi->mode ==OMAP_DSS_DSI_VIDEO_MODE ) {dsi_if_enable (dsi, false);
@@ -3914,14 +3912,13 @@ static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channeldsi_if_enable (dsi, true); } -dss_mgr_disable (dispc_channel); +dss_mgr_disable (&dsi->output);dsi_display_uninit_dispc (dsi); }static void dsi_update_screen_dispc (struct dsi_data *dsi) { -enum omap_channel dispc_channel = dsi->output.dispc_channel;unsigned int bytespp;unsigned int bytespl;unsigned int bytespf;
@@ -3983,9 +3980,9 @@ static void dsi_update_screen_dispc(struct dsi_data *dsi) msecs_to_jiffies(250));BUG_ON (r ==0 ); -dss_mgr_set_timings (dispc_channel, &dsi->vm); +dss_mgr_set_timings (&dsi->output, &dsi->vm); -dss_mgr_start_update (dispc_channel); +dss_mgr_start_update (&dsi->output);if (dsi->te_enabled) {/* disable LP_RX_TO, so that we can receive TE. Time to wait
@@ -4112,7 +4109,7 @@ static int dsi_display_init_dispc(struct dsi_data *dsi) DSS_CLK_SRC_PLL2_1);if (dsi->mode ==OMAP_DSS_DSI_CMD_MODE ) { - r =dss_mgr_register_framedone_handler (channel, + r =dss_mgr_register_framedone_handler (&dsi->output, dsi_framedone_irq_callback, dsi);if (r) {DSSERR ("can't register FRAMEDONE handler\n" );
@@ -4142,7 +4139,7 @@ static int dsi_display_init_dispc(struct dsi_data *dsi) dsi->vm.flags &= ~DISPLAY_FLAGS_SYNC_POSEDGE ; dsi->vm.flags |=DISPLAY_FLAGS_SYNC_NEGEDGE ; -dss_mgr_set_timings (channel, &dsi->vm); +dss_mgr_set_timings (&dsi->output, &dsi->vm); r =dsi_configure_dispc_clocks (dsi);if (r)
@@ -4153,12 +4150,12 @@ static int dsi_display_init_dispc(struct dsi_data *dsi)dsi_get_pixel_size (dsi->pix_fmt); dsi->mgr_config.lcden_sig_polarity =0 ; -dss_mgr_set_lcd_config (channel, &dsi->mgr_config); +dss_mgr_set_lcd_config (&dsi->output, &dsi->mgr_config);return 0 ; err1:if (dsi->mode ==OMAP_DSS_DSI_CMD_MODE ) -dss_mgr_unregister_framedone_handler (channel, +dss_mgr_unregister_framedone_handler (&dsi->output, dsi_framedone_irq_callback, dsi); err:dss_select_lcd_clk_source (dsi->dss, channel,DSS_CLK_SRC_FCK );
@@ -4170,7 +4167,7 @@ static void dsi_display_uninit_dispc(struct dsi_data *dsi)enum omap_channel channel = dsi->output.dispc_channel;if (dsi->mode ==OMAP_DSS_DSI_CMD_MODE ) -dss_mgr_unregister_framedone_handler (channel, +dss_mgr_unregister_framedone_handler (&dsi->output, dsi_framedone_irq_callback, dsi);dss_select_lcd_clk_source (dsi->dss, channel,DSS_CLK_SRC_FCK );
@@ -4965,14 +4962,13 @@ static int dsi_connect(struct omap_dss_device *dssdev, struct omap_dss_device *dst) {struct dsi_data *dsi =to_dsi_data (dssdev); -enum omap_channel dispc_channel = dssdev->dispc_channel;int r; r =dsi_regulator_init (dsi);if (r)return r; - r =dss_mgr_connect (dispc_channel, dssdev); + r =dss_mgr_connect (&dsi->output, dssdev);if (r)return r;
@@ -4980,7 +4976,7 @@ static int dsi_connect(struct omap_dss_device *dssdev,if (r) {DSSERR ("failed to connect output to new device: %s\n" , dssdev->name); -dss_mgr_disconnect (dispc_channel, dssdev); +dss_mgr_disconnect (&dsi->output, dssdev);return r; }
@@ -4990,7 +4986,7 @@ static int dsi_connect(struct omap_dss_device *dssdev,static void dsi_disconnect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { -enum omap_channel dispc_channel = dssdev->dispc_channel; +struct dsi_data *dsi =to_dsi_data (dssdev);WARN_ON (dst != dssdev->dst);
@@ -4999,7 +4995,7 @@ static void dsi_disconnect(struct omap_dss_device *dssdev,omapdss_output_unset_device (dssdev); -dss_mgr_disconnect (dispc_channel, dssdev); +dss_mgr_disconnect (&dsi->output, dssdev); }static const struct omapdss_dsi_ops dsi_ops = {
drivers/gpu/drm/omapdrm/dss/hdmi4.c +7 -13
@@ -177,7 +177,6 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev) {int r;struct videomode *vm; -enum omap_channel channel = dssdev->dispc_channel;struct hdmi_wp_data *wp = &hdmi.wp;struct dss_pll_clock_info hdmi_cinfo = {0 };unsigned int pc;
@@ -231,9 +230,9 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)hdmi4_configure (&hdmi.core, &hdmi.wp, &hdmi.cfg);/* tv size */ -dss_mgr_set_timings (channel, vm); +dss_mgr_set_timings (&hdmi.output, vm); - r =dss_mgr_enable (channel); + r =dss_mgr_enable (&hdmi.output);if (r) goto err_mgr_enable;
@@ -247,7 +246,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)return 0 ; err_vid_enable: -dss_mgr_disable (channel); +dss_mgr_disable (&hdmi.output); err_mgr_enable:hdmi_wp_set_phy_pwr (&hdmi.wp,HDMI_PHYPWRCMD_OFF ); err_phy_pwr:
@@ -261,13 +260,11 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)static void hdmi_power_off_full (struct omap_dss_device *dssdev) { -enum omap_channel channel = dssdev->dispc_channel; -hdmi_wp_clear_irqenable (&hdmi.wp, ~HDMI_IRQ_CORE );hdmi_wp_video_stop (&hdmi.wp); -dss_mgr_disable (channel); +dss_mgr_disable (&hdmi.output);hdmi_wp_set_phy_pwr (&hdmi.wp,HDMI_PHYPWRCMD_OFF );
@@ -451,14 +448,13 @@ void hdmi4_core_disable(struct omap_dss_device *dssdev)static int hdmi_connect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { -enum omap_channel channel = dssdev->dispc_channel;int r; r =hdmi_init_regulator ();if (r)return r; - r =dss_mgr_connect (channel, dssdev); + r =dss_mgr_connect (&hdmi.output, dssdev);if (r)return r;
@@ -466,7 +462,7 @@ static int hdmi_connect(struct omap_dss_device *dssdev,if (r) {DSSERR ("failed to connect output to new device: %s\n" , dst->name); -dss_mgr_disconnect (channel, dssdev); +dss_mgr_disconnect (&hdmi.output, dssdev);return r; }
@@ -476,8 +472,6 @@ static int hdmi_connect(struct omap_dss_device *dssdev,static void hdmi_disconnect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { -enum omap_channel channel = dssdev->dispc_channel; -WARN_ON (dst != dssdev->dst);if (dst != dssdev->dst)
@@ -485,7 +479,7 @@ static void hdmi_disconnect(struct omap_dss_device *dssdev,omapdss_output_unset_device (dssdev); -dss_mgr_disconnect (channel, dssdev); +dss_mgr_disconnect (&hdmi.output, dssdev); } static int hdmi_read_edid(struct omap_dss_device *dssdev,
drivers/gpu/drm/omapdrm/dss/hdmi5.c +7 -13
@@ -173,7 +173,6 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev) {int r;struct videomode *vm; -enum omap_channel channel = dssdev->dispc_channel;struct dss_pll_clock_info hdmi_cinfo = {0 };unsigned int pc;
@@ -227,9 +226,9 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)hdmi5_configure (&hdmi.core, &hdmi.wp, &hdmi.cfg);/* tv size */ -dss_mgr_set_timings (channel, vm); +dss_mgr_set_timings (&hdmi.output, vm); - r =dss_mgr_enable (channel); + r =dss_mgr_enable (&hdmi.output);if (r) goto err_mgr_enable;
@@ -243,7 +242,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)return 0 ; err_vid_enable: -dss_mgr_disable (channel); +dss_mgr_disable (&hdmi.output); err_mgr_enable:hdmi_wp_set_phy_pwr (&hdmi.wp,HDMI_PHYPWRCMD_OFF ); err_phy_pwr:
@@ -257,13 +256,11 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)static void hdmi_power_off_full (struct omap_dss_device *dssdev) { -enum omap_channel channel = dssdev->dispc_channel; -hdmi_wp_clear_irqenable (&hdmi.wp,0xffffffff );hdmi_wp_video_stop (&hdmi.wp); -dss_mgr_disable (channel); +dss_mgr_disable (&hdmi.output);hdmi_wp_set_phy_pwr (&hdmi.wp,HDMI_PHYPWRCMD_OFF );
@@ -456,14 +453,13 @@ static void hdmi_core_disable(struct omap_dss_device *dssdev)static int hdmi_connect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { -enum omap_channel channel = dssdev->dispc_channel;int r; r =hdmi_init_regulator ();if (r)return r; - r =dss_mgr_connect (channel, dssdev); + r =dss_mgr_connect (&hdmi.output, dssdev);if (r)return r;
@@ -471,7 +467,7 @@ static int hdmi_connect(struct omap_dss_device *dssdev,if (r) {DSSERR ("failed to connect output to new device: %s\n" , dst->name); -dss_mgr_disconnect (channel, dssdev); +dss_mgr_disconnect (&hdmi.output, dssdev);return r; }
@@ -481,8 +477,6 @@ static int hdmi_connect(struct omap_dss_device *dssdev,static void hdmi_disconnect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { -enum omap_channel channel = dssdev->dispc_channel; -WARN_ON (dst != dssdev->dst);if (dst != dssdev->dst)
@@ -490,7 +484,7 @@ static void hdmi_disconnect(struct omap_dss_device *dssdev,omapdss_output_unset_device (dssdev); -dss_mgr_disconnect (channel, dssdev); +dss_mgr_disconnect (&hdmi.output, dssdev); } static int hdmi_read_edid(struct omap_dss_device *dssdev,
drivers/gpu/drm/omapdrm/dss/omapdss.h +11 -11
@@ -656,20 +656,20 @@ struct dss_mgr_ops {int dss_install_mgr_ops (const struct dss_mgr_ops *mgr_ops);void dss_uninstall_mgr_ops (void ); -int dss_mgr_connect (enum omap_channel channel, -struct omap_dss_device *dst); -void dss_mgr_disconnect (enum omap_channel channel, -struct omap_dss_device *dst); -void dss_mgr_set_timings (enum omap_channel channel, +int dss_mgr_connect (struct omap_dss_device *dssdev, +struct omap_dss_device *dst); +void dss_mgr_disconnect (struct omap_dss_device *dssdev, +struct omap_dss_device *dst); +void dss_mgr_set_timings (struct omap_dss_device *dssdev,const struct videomode *vm); -void dss_mgr_set_lcd_config (enum omap_channel channel, +void dss_mgr_set_lcd_config (struct omap_dss_device *dssdev,const struct dss_lcd_mgr_config *config); -int dss_mgr_enable (enum omap_channel channel); -void dss_mgr_disable (enum omap_channel channel); -void dss_mgr_start_update (enum omap_channel channel); -int dss_mgr_register_framedone_handler (enum omap_channel channel, +int dss_mgr_enable (struct omap_dss_device *dssdev); +void dss_mgr_disable (struct omap_dss_device *dssdev); +void dss_mgr_start_update (struct omap_dss_device *dssdev); +int dss_mgr_register_framedone_handler (struct omap_dss_device *dssdev,void (*handler)(void *),void *data); -void dss_mgr_unregister_framedone_handler (enum omap_channel channel, +void dss_mgr_unregister_framedone_handler (struct omap_dss_device *dssdev,void (*handler)(void *),void *data);/* dispc ops */
drivers/gpu/drm/omapdrm/dss/output.c +22 -20
83 lines not on this page · raw message
drivers/gpu/drm/omapdrm/dss/sdi.c +10 -18
@@ -113,8 +113,6 @@ static int sdi_calc_clock_div(unsigned long pclk,static void sdi_config_lcd_manager (struct omap_dss_device *dssdev) { -enum omap_channel channel = dssdev->dispc_channel; - sdi.mgr_config.io_pad_mode =DSS_IO_PAD_MODE_BYPASS ; sdi.mgr_config.stallmode = false;
@@ -123,20 +121,18 @@ static void sdi_config_lcd_manager(struct omap_dss_device *dssdev) sdi.mgr_config.video_port_width =24 ; sdi.mgr_config.lcden_sig_polarity =1 ; -dss_mgr_set_lcd_config (channel, &sdi.mgr_config); +dss_mgr_set_lcd_config (&sdi.output, &sdi.mgr_config); }static int sdi_display_enable (struct omap_dss_device *dssdev) { -struct omap_dss_device *out = &sdi.output; -enum omap_channel channel = dssdev->dispc_channel;struct videomode *vm = &sdi.vm;unsigned long fck;struct dispc_clock_info dispc_cinfo;unsigned long pck;int r; -if (!out->dispc_channel_connected) { +if (!sdi.output.dispc_channel_connected) {DSSERR ("failed to enable display: no output/manager\n" );return -ENODEV ; }
@@ -168,7 +164,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) } -dss_mgr_set_timings (channel, vm); +dss_mgr_set_timings (&sdi.output, vm); r =dss_set_fck_rate (sdi.dss, fck);if (r)
@@ -187,7 +183,8 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)* need to care about the shadow register mechanism for pck-free. The * exact reason for this is unknown. */ -dispc_mgr_set_clock_div (channel, &sdi.mgr_config.clock_info); +dispc_mgr_set_clock_div (sdi.output.dispc_channel, + &sdi.mgr_config.clock_info);dss_sdi_init (sdi.dss, sdi.datapairs); r =dss_sdi_enable (sdi.dss);
@@ -195,7 +192,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) goto err_sdi_enable;mdelay (2 ); - r =dss_mgr_enable (channel); + r =dss_mgr_enable (&sdi.output);if (r) goto err_mgr_enable;
@@ -215,9 +212,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)static void sdi_display_disable (struct omap_dss_device *dssdev) { -enum omap_channel channel = dssdev->dispc_channel; - -dss_mgr_disable (channel); +dss_mgr_disable (&sdi.output);dss_sdi_disable (sdi.dss);
@@ -274,14 +269,13 @@ static int sdi_init_regulator(void)static int sdi_connect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { -enum omap_channel channel = dssdev->dispc_channel;int r; r =sdi_init_regulator ();if (r)return r; - r =dss_mgr_connect (channel, dssdev); + r =dss_mgr_connect (&sdi.output, dssdev);if (r)return r;
@@ -289,7 +283,7 @@ static int sdi_connect(struct omap_dss_device *dssdev,if (r) {DSSERR ("failed to connect output to new device: %s\n" , dst->name); -dss_mgr_disconnect (channel, dssdev); +dss_mgr_disconnect (&sdi.output, dssdev);return r; }
@@ -299,8 +293,6 @@ static int sdi_connect(struct omap_dss_device *dssdev,static void sdi_disconnect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { -enum omap_channel channel = dssdev->dispc_channel; -WARN_ON (dst != dssdev->dst);if (dst != dssdev->dst)
@@ -308,7 +300,7 @@ static void sdi_disconnect(struct omap_dss_device *dssdev,omapdss_output_unset_device (dssdev); -dss_mgr_disconnect (channel, dssdev); +dss_mgr_disconnect (&sdi.output, dssdev); }static const struct omapdss_sdi_ops sdi_ops = {
drivers/gpu/drm/omapdrm/dss/venc.c +6 -12
@@ -460,7 +460,6 @@ static const struct venc_config *venc_timings_to_config(struct videomode *vm)static int venc_power_on (struct omap_dss_device *dssdev) { -enum omap_channel channel = dssdev->dispc_channel;u32 l;int r;
@@ -486,13 +485,13 @@ static int venc_power_on(struct omap_dss_device *dssdev)venc_write_reg (VENC_OUTPUT_CONTROL , l); -dss_mgr_set_timings (channel, &venc.vm); +dss_mgr_set_timings (&venc.output, &venc.vm); r =regulator_enable (venc.vdda_dac_reg);if (r) goto err1; - r =dss_mgr_enable (channel); + r =dss_mgr_enable (&venc.output);if (r) goto err2;
@@ -511,12 +510,10 @@ static int venc_power_on(struct omap_dss_device *dssdev)static void venc_power_off (struct omap_dss_device *dssdev) { -enum omap_channel channel = dssdev->dispc_channel; -venc_write_reg (VENC_OUTPUT_CONTROL ,0 );dss_set_dac_pwrdn_bgz (venc.dss,0 ); -dss_mgr_disable (channel); +dss_mgr_disable (&venc.output);regulator_disable (venc.vdda_dac_reg);
@@ -749,14 +746,13 @@ static int venc_get_clocks(struct platform_device *pdev)static int venc_connect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { -enum omap_channel channel = dssdev->dispc_channel;int r; r =venc_init_regulator ();if (r)return r; - r =dss_mgr_connect (channel, dssdev); + r =dss_mgr_connect (&venc.output, dssdev);if (r)return r;
@@ -764,7 +760,7 @@ static int venc_connect(struct omap_dss_device *dssdev,if (r) {DSSERR ("failed to connect output to new device: %s\n" , dst->name); -dss_mgr_disconnect (channel, dssdev); +dss_mgr_disconnect (&venc.output, dssdev);return r; }
@@ -774,8 +770,6 @@ static int venc_connect(struct omap_dss_device *dssdev,static void venc_disconnect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { -enum omap_channel channel = dssdev->dispc_channel; -WARN_ON (dst != dssdev->dst);if (dst != dssdev->dst)
@@ -783,7 +777,7 @@ static void venc_disconnect(struct omap_dss_device *dssdev,omapdss_output_unset_device (dssdev); -dss_mgr_disconnect (channel, dssdev); +dss_mgr_disconnect (&venc.output, dssdev); }static const struct omapdss_atv_ops venc_ops = {
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 21/30 drm: omapdrm: dss: Pass omap_drm_private pointer to dss_mgr_ops
In reply to Laurent PinchartThe dss_mgr_ops operations implemented by the omapdrm side have to look up the omap_crtc objects from global variables as they are only passed a channel number. In order to remove global variables in the omapdrm driver pass the omap_drm_private pointer to the dss_mgr_ops. This requires storing a pointer to the omap_drm_private in a global variable on the DSS side as a temporary measure until the omapdrm and omapdss drivers get merged.
--- drivers/gpu/drm/omapdrm/dss/omapdss.h | 41 ++++++++++++++++++++++------------- drivers/gpu/drm/omapdrm/dss/output.c | 28 +++++++++++++++--------- drivers/gpu/drm/omapdrm/omap_crtc.c | 31 +++++++++++++++----------- drivers/gpu/drm/omapdrm/omap_crtc.h | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- 5 files changed, 64 insertions(+), 40 deletions(-)
drivers/gpu/drm/omapdrm/dss/omapdss.h +26 -15
@@ -59,6 +59,7 @@#define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)#define DISPC_IRQ_FRAMEDONE3 (1 << 30) +struct omap_drm_private ;struct omap_dss_device ;struct dss_lcd_mgr_config ;struct snd_aes_iec958 ;
@@ -635,25 +636,35 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port);u32 dss_of_port_get_port_number (struct device_node *port);struct dss_mgr_ops { -int (*connect)(enum omap_channel channel, -struct omap_dss_device *dst); -void (*disconnect)(enum omap_channel channel, -struct omap_dss_device *dst); - -void (*start_update)(enum omap_channel channel); -int (*enable)(enum omap_channel channel); -void (*disable)(enum omap_channel channel); -void (*set_timings)(enum omap_channel channel, -const struct videomode *vm); -void (*set_lcd_config)(enum omap_channel channel, -const struct dss_lcd_mgr_config *config); -int (*register_framedone_handler)(enum omap_channel channel, +int (*connect)(struct omap_drm_private *priv, +enum omap_channel channel, +struct omap_dss_device *dst); +void (*disconnect)(struct omap_drm_private *priv, +enum omap_channel channel, +struct omap_dss_device *dst); + +void (*start_update)(struct omap_drm_private *priv, +enum omap_channel channel); +int (*enable)(struct omap_drm_private *priv, +enum omap_channel channel); +void (*disable)(struct omap_drm_private *priv, +enum omap_channel channel); +void (*set_timings)(struct omap_drm_private *priv, +enum omap_channel channel, +const struct videomode *vm); +void (*set_lcd_config)(struct omap_drm_private *priv, +enum omap_channel channel, +const struct dss_lcd_mgr_config *config); +int (*register_framedone_handler)(struct omap_drm_private *priv, +enum omap_channel channel,void (*handler)(void *),void *data); -void (*unregister_framedone_handler)(enum omap_channel channel, +void (*unregister_framedone_handler)(struct omap_drm_private *priv, +enum omap_channel channel,void (*handler)(void *),void *data); }; -int dss_install_mgr_ops (const struct dss_mgr_ops *mgr_ops); +int dss_install_mgr_ops (const struct dss_mgr_ops *mgr_ops, +struct omap_drm_private *priv);void dss_uninstall_mgr_ops (void ); int dss_mgr_connect(struct omap_dss_device *dssdev,
drivers/gpu/drm/omapdrm/dss/output.c +18 -10
@@ -170,13 +170,16 @@ struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_deviceEXPORT_SYMBOL (omapdss_find_output_from_display);static const struct dss_mgr_ops *dss_mgr_ops; +static struct omap_drm_private *dss_mgr_ops_priv; -int dss_install_mgr_ops (const struct dss_mgr_ops *mgr_ops) +int dss_install_mgr_ops (const struct dss_mgr_ops *mgr_ops, +struct omap_drm_private *priv) {if (dss_mgr_ops)return -EBUSY ; dss_mgr_ops = mgr_ops; + dss_mgr_ops_priv = priv;return 0 ; }
@@ -185,58 +188,62 @@ EXPORT_SYMBOL(dss_install_mgr_ops);void dss_uninstall_mgr_ops (void ) { dss_mgr_ops =NULL ; + dss_mgr_ops_priv =NULL ; }EXPORT_SYMBOL (dss_uninstall_mgr_ops);int dss_mgr_connect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { -return dss_mgr_ops->connect (dssdev->dispc_channel, dst); +return dss_mgr_ops->connect (dss_mgr_ops_priv, + dssdev->dispc_channel, dst); }EXPORT_SYMBOL (dss_mgr_connect);void dss_mgr_disconnect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { - dss_mgr_ops->disconnect (dssdev->dispc_channel, dst); + dss_mgr_ops->disconnect (dss_mgr_ops_priv, dssdev->dispc_channel, dst); }EXPORT_SYMBOL (dss_mgr_disconnect);void dss_mgr_set_timings (struct omap_dss_device *dssdev,const struct videomode *vm) { - dss_mgr_ops->set_timings (dssdev->dispc_channel, vm); + dss_mgr_ops->set_timings (dss_mgr_ops_priv, dssdev->dispc_channel, vm); }EXPORT_SYMBOL (dss_mgr_set_timings);void dss_mgr_set_lcd_config (struct omap_dss_device *dssdev,const struct dss_lcd_mgr_config *config) { - dss_mgr_ops->set_lcd_config (dssdev->dispc_channel, config); + dss_mgr_ops->set_lcd_config (dss_mgr_ops_priv, + dssdev->dispc_channel, config); }EXPORT_SYMBOL (dss_mgr_set_lcd_config);int dss_mgr_enable (struct omap_dss_device *dssdev) { -return dss_mgr_ops->enable (dssdev->dispc_channel); +return dss_mgr_ops->enable (dss_mgr_ops_priv, dssdev->dispc_channel); }EXPORT_SYMBOL (dss_mgr_enable);void dss_mgr_disable (struct omap_dss_device *dssdev) { - dss_mgr_ops->disable (dssdev->dispc_channel); + dss_mgr_ops->disable (dss_mgr_ops_priv, dssdev->dispc_channel); }EXPORT_SYMBOL (dss_mgr_disable);void dss_mgr_start_update (struct omap_dss_device *dssdev) { - dss_mgr_ops->start_update (dssdev->dispc_channel); + dss_mgr_ops->start_update (dss_mgr_ops_priv, dssdev->dispc_channel); }EXPORT_SYMBOL (dss_mgr_start_update);int dss_mgr_register_framedone_handler (struct omap_dss_device *dssdev,void (*handler)(void *),void *data) { -return dss_mgr_ops->register_framedone_handler (dssdev->dispc_channel, +return dss_mgr_ops->register_framedone_handler (dss_mgr_ops_priv, + dssdev->dispc_channel, handler, data); }EXPORT_SYMBOL (dss_mgr_register_framedone_handler);
@@ -244,7 +251,8 @@ EXPORT_SYMBOL(dss_mgr_register_framedone_handler);void dss_mgr_unregister_framedone_handler (struct omap_dss_device *dssdev,void (*handler)(void *),void *data) { - dss_mgr_ops->unregister_framedone_handler (dssdev->dispc_channel, + dss_mgr_ops->unregister_framedone_handler (dss_mgr_ops_priv, + dssdev->dispc_channel, handler, data); }EXPORT_SYMBOL (dss_mgr_unregister_framedone_handler);
drivers/gpu/drm/omapdrm/omap_crtc.c +18 -13
@@ -113,7 +113,8 @@ static struct omap_crtc *omap_crtcs[8];static struct omap_dss_device *omap_crtc_output[8 ];/* we can probably ignore these until we support command-mode panels: */ -static int omap_crtc_dss_connect (enum omap_channel channel, +static int omap_crtc_dss_connect (struct omap_drm_private *priv, +enum omap_channel channel,struct omap_dss_device *dst) {const struct dispc_ops *dispc_ops =dispc_get_ops ();
@@ -130,14 +131,16 @@ static int omap_crtc_dss_connect(enum omap_channel channel,return 0 ; } -static void omap_crtc_dss_disconnect (enum omap_channel channel, +static void omap_crtc_dss_disconnect (struct omap_drm_private *priv, +enum omap_channel channel,struct omap_dss_device *dst) { omap_crtc_output[channel] =NULL ; dst->dispc_channel_connected = false; } -static void omap_crtc_dss_start_update (enum omap_channel channel) +static void omap_crtc_dss_start_update (struct omap_drm_private *priv, +enum omap_channel channel) { }
@@ -207,10 +210,10 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) } -static int omap_crtc_dss_enable (enum omap_channel channel) +static int omap_crtc_dss_enable (struct omap_drm_private *priv, +enum omap_channel channel) {struct omap_crtc *omap_crtc = omap_crtcs[channel]; -struct omap_drm_private *priv = omap_crtc->base.dev->dev_private; priv->dispc_ops->mgr_set_timings (omap_crtc->channel, &omap_crtc->vm);omap_crtc_set_enabled (&omap_crtc->base, true);
@@ -218,14 +221,16 @@ static int omap_crtc_dss_enable(enum omap_channel channel)return 0 ; } -static void omap_crtc_dss_disable (enum omap_channel channel) +static void omap_crtc_dss_disable (struct omap_drm_private *priv, +enum omap_channel channel) {struct omap_crtc *omap_crtc = omap_crtcs[channel];omap_crtc_set_enabled (&omap_crtc->base, false); } -static void omap_crtc_dss_set_timings (enum omap_channel channel, +static void omap_crtc_dss_set_timings (struct omap_drm_private *priv, +enum omap_channel channel,const struct videomode *vm) {struct omap_crtc *omap_crtc = omap_crtcs[channel];
@@ -233,25 +238,25 @@ static void omap_crtc_dss_set_timings(enum omap_channel channel, omap_crtc->vm = *vm; } -static void omap_crtc_dss_set_lcd_config (enum omap_channel channel, +static void omap_crtc_dss_set_lcd_config (struct omap_drm_private *priv, +enum omap_channel channel,const struct dss_lcd_mgr_config *config) {struct omap_crtc *omap_crtc = omap_crtcs[channel]; -struct omap_drm_private *priv = omap_crtc->base.dev->dev_private;DBG ("%s" , omap_crtc->name); priv->dispc_ops->mgr_set_lcd_config (omap_crtc->channel, config); }static int omap_crtc_dss_register_framedone ( -enum omap_channel channel, +struct omap_drm_private *priv,enum omap_channel channel,void (*handler)(void *),void *data) {return 0 ; }static void omap_crtc_dss_unregister_framedone ( -enum omap_channel channel, +struct omap_drm_private *priv,enum omap_channel channel,void (*handler)(void *),void *data) { }
@@ -669,11 +674,11 @@ static const char *channel_names[] = { [OMAP_DSS_CHANNEL_LCD3] = "lcd3", }; -void omap_crtc_pre_init (void ) +void omap_crtc_pre_init (struct omap_drm_private *priv) {memset (omap_crtcs,0 ,sizeof (omap_crtcs)); -dss_install_mgr_ops (&mgr_ops); +dss_install_mgr_ops (&mgr_ops, priv); }void omap_crtc_pre_uninit (void )
drivers/gpu/drm/omapdrm/omap_crtc.h +1 -1
@@ -32,7 +32,7 @@ struct videomode;struct videomode *omap_crtc_timings (struct drm_crtc *crtc);enum omap_channel omap_crtc_channel (struct drm_crtc *crtc); -void omap_crtc_pre_init (void ); +void omap_crtc_pre_init (struct omap_drm_private *priv);void omap_crtc_pre_uninit (void );struct drm_crtc *omap_crtc_init (struct drm_device *dev,struct drm_plane *plane,struct omap_dss_device *dssdev);
drivers/gpu/drm/omapdrm/omap_drv.c +1 -1
@@ -521,7 +521,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) priv->dev = dev; -omap_crtc_pre_init (); +omap_crtc_pre_init (priv); ret =omap_connect_dssdevs ();if (ret)
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 21/30] drm: omapdrm: dss: Pass omap_drm_private pointer to dss_mgr_ops
Hi,
Quoted 10 lines · Laurent Pinchart
The
dss_mgr_opsoperations implemented by the omapdrm side have to look up theomap_crtcobjects from global variables as they are only passed a channel number. In order to remove global variables in the omapdrm driver pass theomap_drm_privatepointer to thedss_mgr_ops. This requires storing a pointer to theomap_drm_privatein a global variable on the DSS side as a temporary measure until the omapdrm and omapdss drivers get merged.Signed-off-by Laurent Pinchart <[email protected]>---
-- Sebastian
Quoted 317 lines
drivers/gpu/drm/omapdrm/dss/omapdss.h | 41 ++++++++++++++++++++++------------- drivers/gpu/drm/omapdrm/dss/output.c | 28 +++++++++++++++--------- drivers/gpu/drm/omapdrm/omap_crtc.c | 31 +++++++++++++++----------- drivers/gpu/drm/omapdrm/omap_crtc.h | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- 5 files changed, 64 insertions(+), 40 deletions(-)drivers/gpu/drm/omapdrm/dss/omapdss.h +26
-15@@ -59,6 +59,7 @@#define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)#define DISPC_IRQ_FRAMEDONE3 (1 << 30) +struct omap_drm_private ;struct omap_dss_device ;struct dss_lcd_mgr_config ;struct snd_aes_iec958 ;@@ -635,25 +636,35 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port);u32 dss_of_port_get_port_number (struct device_node *port);struct dss_mgr_ops { -int (*connect)(enum omap_channel channel, -struct omap_dss_device *dst); -void (*disconnect)(enum omap_channel channel, -struct omap_dss_device *dst); - -void (*start_update)(enum omap_channel channel); -int (*enable)(enum omap_channel channel); -void (*disable)(enum omap_channel channel); -void (*set_timings)(enum omap_channel channel, -const struct videomode *vm); -void (*set_lcd_config)(enum omap_channel channel, -const struct dss_lcd_mgr_config *config); -int (*register_framedone_handler)(enum omap_channel channel, +int (*connect)(struct omap_drm_private *priv, +enum omap_channel channel, +struct omap_dss_device *dst); +void (*disconnect)(struct omap_drm_private *priv, +enum omap_channel channel, +struct omap_dss_device *dst); + +void (*start_update)(struct omap_drm_private *priv, +enum omap_channel channel); +int (*enable)(struct omap_drm_private *priv, +enum omap_channel channel); +void (*disable)(struct omap_drm_private *priv, +enum omap_channel channel); +void (*set_timings)(struct omap_drm_private *priv, +enum omap_channel channel, +const struct videomode *vm); +void (*set_lcd_config)(struct omap_drm_private *priv, +enum omap_channel channel, +const struct dss_lcd_mgr_config *config); +int (*register_framedone_handler)(struct omap_drm_private *priv, +enum omap_channel channel,void (*handler)(void *),void *data); -void (*unregister_framedone_handler)(enum omap_channel channel, +void (*unregister_framedone_handler)(struct omap_drm_private *priv, +enum omap_channel channel,void (*handler)(void *),void *data); }; -int dss_install_mgr_ops (const struct dss_mgr_ops *mgr_ops); +int dss_install_mgr_ops (const struct dss_mgr_ops *mgr_ops, +struct omap_drm_private *priv);void dss_uninstall_mgr_ops (void ); int dss_mgr_connect(struct omap_dss_device *dssdev,drivers/gpu/drm/omapdrm/dss/output.c +18
-10@@ -170,13 +170,16 @@ struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_deviceEXPORT_SYMBOL (omapdss_find_output_from_display);static const struct dss_mgr_ops *dss_mgr_ops; +static struct omap_drm_private *dss_mgr_ops_priv; -int dss_install_mgr_ops (const struct dss_mgr_ops *mgr_ops) +int dss_install_mgr_ops (const struct dss_mgr_ops *mgr_ops, +struct omap_drm_private *priv) {if (dss_mgr_ops)return -EBUSY ; dss_mgr_ops = mgr_ops; + dss_mgr_ops_priv = priv;return 0 ; }@@ -185,58 +188,62 @@ EXPORT_SYMBOL(dss_install_mgr_ops);void dss_uninstall_mgr_ops (void ) { dss_mgr_ops =NULL ; + dss_mgr_ops_priv =NULL ; }EXPORT_SYMBOL (dss_uninstall_mgr_ops);int dss_mgr_connect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { -return dss_mgr_ops->connect (dssdev->dispc_channel, dst); +return dss_mgr_ops->connect (dss_mgr_ops_priv, + dssdev->dispc_channel, dst); }EXPORT_SYMBOL (dss_mgr_connect);void dss_mgr_disconnect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { - dss_mgr_ops->disconnect (dssdev->dispc_channel, dst); + dss_mgr_ops->disconnect (dss_mgr_ops_priv, dssdev->dispc_channel, dst); }EXPORT_SYMBOL (dss_mgr_disconnect);void dss_mgr_set_timings (struct omap_dss_device *dssdev,const struct videomode *vm) { - dss_mgr_ops->set_timings (dssdev->dispc_channel, vm); + dss_mgr_ops->set_timings (dss_mgr_ops_priv, dssdev->dispc_channel, vm); }EXPORT_SYMBOL (dss_mgr_set_timings);void dss_mgr_set_lcd_config (struct omap_dss_device *dssdev,const struct dss_lcd_mgr_config *config) { - dss_mgr_ops->set_lcd_config (dssdev->dispc_channel, config); + dss_mgr_ops->set_lcd_config (dss_mgr_ops_priv, + dssdev->dispc_channel, config); }EXPORT_SYMBOL (dss_mgr_set_lcd_config);int dss_mgr_enable (struct omap_dss_device *dssdev) { -return dss_mgr_ops->enable (dssdev->dispc_channel); +return dss_mgr_ops->enable (dss_mgr_ops_priv, dssdev->dispc_channel); }EXPORT_SYMBOL (dss_mgr_enable);void dss_mgr_disable (struct omap_dss_device *dssdev) { - dss_mgr_ops->disable (dssdev->dispc_channel); + dss_mgr_ops->disable (dss_mgr_ops_priv, dssdev->dispc_channel); }EXPORT_SYMBOL (dss_mgr_disable);void dss_mgr_start_update (struct omap_dss_device *dssdev) { - dss_mgr_ops->start_update (dssdev->dispc_channel); + dss_mgr_ops->start_update (dss_mgr_ops_priv, dssdev->dispc_channel); }EXPORT_SYMBOL (dss_mgr_start_update);int dss_mgr_register_framedone_handler (struct omap_dss_device *dssdev,void (*handler)(void *),void *data) { -return dss_mgr_ops->register_framedone_handler (dssdev->dispc_channel, +return dss_mgr_ops->register_framedone_handler (dss_mgr_ops_priv, + dssdev->dispc_channel, handler, data); }EXPORT_SYMBOL (dss_mgr_register_framedone_handler);@@ -244,7 +251,8 @@ EXPORT_SYMBOL(dss_mgr_register_framedone_handler);void dss_mgr_unregister_framedone_handler (struct omap_dss_device *dssdev,void (*handler)(void *),void *data) { - dss_mgr_ops->unregister_framedone_handler (dssdev->dispc_channel, + dss_mgr_ops->unregister_framedone_handler (dss_mgr_ops_priv, + dssdev->dispc_channel, handler, data); }EXPORT_SYMBOL (dss_mgr_unregister_framedone_handler);drivers/gpu/drm/omapdrm/omap_crtc.c +18
-13@@ -113,7 +113,8 @@ static struct omap_crtc *omap_crtcs[8];static struct omap_dss_device *omap_crtc_output[8 ];/* we can probably ignore these until we support command-mode panels: */ -static int omap_crtc_dss_connect (enum omap_channel channel, +static int omap_crtc_dss_connect (struct omap_drm_private *priv, +enum omap_channel channel,struct omap_dss_device *dst) {const struct dispc_ops *dispc_ops =dispc_get_ops ();@@ -130,14 +131,16 @@ static int omap_crtc_dss_connect(enum omap_channel channel,return 0 ; } -static void omap_crtc_dss_disconnect (enum omap_channel channel, +static void omap_crtc_dss_disconnect (struct omap_drm_private *priv, +enum omap_channel channel,struct omap_dss_device *dst) { omap_crtc_output[channel] =NULL ; dst->dispc_channel_connected = false; } -static void omap_crtc_dss_start_update (enum omap_channel channel) +static void omap_crtc_dss_start_update (struct omap_drm_private *priv, +enum omap_channel channel) { }@@ -207,10 +210,10 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) } -static int omap_crtc_dss_enable (enum omap_channel channel) +static int omap_crtc_dss_enable (struct omap_drm_private *priv, +enum omap_channel channel) {struct omap_crtc *omap_crtc = omap_crtcs[channel]; -struct omap_drm_private *priv = omap_crtc->base.dev->dev_private; priv->dispc_ops->mgr_set_timings (omap_crtc->channel, &omap_crtc->vm);omap_crtc_set_enabled (&omap_crtc->base, true);@@ -218,14 +221,16 @@ static int omap_crtc_dss_enable(enum omap_channel channel)return 0 ; } -static void omap_crtc_dss_disable (enum omap_channel channel) +static void omap_crtc_dss_disable (struct omap_drm_private *priv, +enum omap_channel channel) {struct omap_crtc *omap_crtc = omap_crtcs[channel];omap_crtc_set_enabled (&omap_crtc->base, false); } -static void omap_crtc_dss_set_timings (enum omap_channel channel, +static void omap_crtc_dss_set_timings (struct omap_drm_private *priv, +enum omap_channel channel,const struct videomode *vm) {struct omap_crtc *omap_crtc = omap_crtcs[channel];@@ -233,25 +238,25 @@ static void omap_crtc_dss_set_timings(enum omap_channel channel, omap_crtc->vm = *vm; } -static void omap_crtc_dss_set_lcd_config (enum omap_channel channel, +static void omap_crtc_dss_set_lcd_config (struct omap_drm_private *priv, +enum omap_channel channel,const struct dss_lcd_mgr_config *config) {struct omap_crtc *omap_crtc = omap_crtcs[channel]; -struct omap_drm_private *priv = omap_crtc->base.dev->dev_private;DBG ("%s" , omap_crtc->name); priv->dispc_ops->mgr_set_lcd_config (omap_crtc->channel, config); }static int omap_crtc_dss_register_framedone ( -enum omap_channel channel, +struct omap_drm_private *priv,enum omap_channel channel,void (*handler)(void *),void *data) {return 0 ; }static void omap_crtc_dss_unregister_framedone ( -enum omap_channel channel, +struct omap_drm_private *priv,enum omap_channel channel,void (*handler)(void *),void *data) { }@@ -669,11 +674,11 @@ static const char *channel_names[] = { [OMAP_DSS_CHANNEL_LCD3] = "lcd3", }; -void omap_crtc_pre_init (void ) +void omap_crtc_pre_init (struct omap_drm_private *priv) {memset (omap_crtcs,0 ,sizeof (omap_crtcs)); -dss_install_mgr_ops (&mgr_ops); +dss_install_mgr_ops (&mgr_ops, priv); }void omap_crtc_pre_uninit (void )drivers/gpu/drm/omapdrm/omap_crtc.h +1
-1@@ -32,7 +32,7 @@ struct videomode;struct videomode *omap_crtc_timings (struct drm_crtc *crtc);enum omap_channel omap_crtc_channel (struct drm_crtc *crtc); -void omap_crtc_pre_init (void ); +void omap_crtc_pre_init (struct omap_drm_private *priv);void omap_crtc_pre_uninit (void );struct drm_crtc *omap_crtc_init (struct drm_device *dev,struct drm_plane *plane,struct omap_dss_device *dssdev);drivers/gpu/drm/omapdrm/omap_drv.c +1
-1@@ -521,7 +521,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) priv->dev = dev; -omap_crtc_pre_init (); +omap_crtc_pre_init (priv); ret =omap_connect_dssdevs ();if (ret)Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 22/30 drm: omapdrm: dss: Store DSS device pointer in the omapdrm private data
In reply to Laurent PinchartThe dss_device is the top-level component in the omapdss driver. Give the omapdrm driver access to the dss_device pointer in order to obtain pointers to all other components from it. This requires a new global variable in the omapdss driver that will be removed when merging the omapdrm and omapdss drivers, but will already allow removal of several other global variables.
As this partly duplicates the omapdss_is_initialized() API, reimplement it as an inline function wrapping omapdss_get_dss().
--- drivers/gpu/drm/omapdrm/dss/base.c | 14 +++++++------- drivers/gpu/drm/omapdrm/dss/dss.c | 5 +++-- drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 +++++++--- drivers/gpu/drm/omapdrm/omap_drv.c | 1 + drivers/gpu/drm/omapdrm/omap_drv.h | 1 + 5 files changed, 19 insertions(+), 12 deletions(-)
drivers/gpu/drm/omapdrm/dss/base.c +7 -7
@@ -20,7 +20,7 @@#include <linux/list.h> #include "omapdss.h" -static bool dss_initialized; +static struct dss_device *dss_device;static const struct dispc_ops *ops;static struct list_head omapdss_comp_list;
@@ -31,17 +31,17 @@ struct omapdss_comp_node {bool dss_core_component; }; -void omapdss_set_is_initialized (bool set) +struct dss_device *omapdss_get_dss (void ) { - dss_initialized = set; +return dss_device; } -EXPORT_SYMBOL (omapdss_set_is_initialized); +EXPORT_SYMBOL (omapdss_get_dss); -bool omapdss_is_initialized (void ) +void omapdss_set_dss (struct dss_device *dss) { -return dss_initialized; + dss_device = dss; } -EXPORT_SYMBOL (omapdss_is_initialized); +EXPORT_SYMBOL (omapdss_set_dss);void dispc_set_ops (const struct dispc_ops *o) {
drivers/gpu/drm/omapdrm/dss/dss.c +3 -2
@@ -1316,6 +1316,7 @@ static const struct soc_device_attribute dss_soc_devices[] = {static int dss_bind (struct device *dev) { +struct dss_device *dss =dev_get_drvdata (dev);int r; r =component_bind_all (dev,NULL );
@@ -1325,14 +1326,14 @@ static int dss_bind(struct device *dev)pm_set_vt_switch (0 );omapdss_gather_components (dev); -omapdss_set_is_initialized (true); +omapdss_set_dss (dss);return 0 ; }static void dss_unbind (struct device *dev) { -omapdss_set_is_initialized (false); +omapdss_set_dss (NULL );component_unbind_all (dev,NULL ); }
drivers/gpu/drm/omapdrm/dss/omapdss.h +7 -3
@@ -59,6 +59,7 @@#define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)#define DISPC_IRQ_FRAMEDONE3 (1 << 30) +struct dss_device ;struct omap_drm_private ;struct omap_dss_device ;struct dss_lcd_mgr_config ;
@@ -586,7 +587,12 @@ struct omap_dss_driver { const struct hdmi_avi_infoframe *avi); }; -bool omapdss_is_initialized (void ); +struct dss_device *omapdss_get_dss (void ); +void omapdss_set_dss (struct dss_device *dss); +static inline bool omapdss_is_initialized (void ) +{ +return !!omapdss_get_dss (); +}int omapdss_register_display (struct omap_dss_device *dssdev);void omapdss_unregister_display (struct omap_dss_device *dssdev);
@@ -630,8 +636,6 @@ static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)struct omap_dss_device *omapdss_of_find_source_for_first_ep (struct device_node *node); -void omapdss_set_is_initialized (bool set); -struct device_node *dss_of_port_get_parent_device (struct device_node *port);u32 dss_of_port_get_port_number (struct device_node *port);
drivers/gpu/drm/omapdrm/omap_drv.c +1 -0
@@ -527,6 +527,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)if (ret) goto err_crtc_uninit; + priv->dss =omapdss_get_dss (); priv->dispc_ops =dispc_get_ops (); soc =soc_device_match (omapdrm_soc_devices);
drivers/gpu/drm/omapdrm/omap_drv.h +1 -0
@@ -50,6 +50,7 @@ struct omap_drm_private {struct device *dev;u32 omaprev; +struct dss_device *dss;const struct dispc_ops *dispc_ops;unsigned int num_crtcs;
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 22/30] drm: omapdrm: dss: Store DSS device pointer in the omapdrm private data
Hi,
Quoted 7 lines · Laurent Pinchart
The
dss_deviceis the top-level component in the omapdss driver. Give the omapdrm driver access to thedss_devicepointer in order to obtain pointers to all other components from it. This requires a new global variable in the omapdss driver that will be removed when merging the omapdrm and omapdss drivers, but will already allow removal of several other global variables.
Quoted 5 lines
As this partly duplicates the
omapdss_is_initialized()API, reimplement it as an inline function wrappingomapdss_get_dss().Signed-off-by Laurent Pinchart <[email protected]>---
-- Sebastian
Quoted 141 lines
drivers/gpu/drm/omapdrm/dss/base.c | 14 +++++++------- drivers/gpu/drm/omapdrm/dss/dss.c | 5 +++-- drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 +++++++--- drivers/gpu/drm/omapdrm/omap_drv.c | 1 + drivers/gpu/drm/omapdrm/omap_drv.h | 1 + 5 files changed, 19 insertions(+), 12 deletions(-)drivers/gpu/drm/omapdrm/dss/base.c +7
-7@@ -20,7 +20,7 @@#include <linux/list.h> #include "omapdss.h" -static bool dss_initialized; +static struct dss_device *dss_device;static const struct dispc_ops *ops;static struct list_head omapdss_comp_list;@@ -31,17 +31,17 @@ struct omapdss_comp_node {bool dss_core_component; }; -void omapdss_set_is_initialized (bool set) +struct dss_device *omapdss_get_dss (void ) { - dss_initialized = set; +return dss_device; } -EXPORT_SYMBOL (omapdss_set_is_initialized); +EXPORT_SYMBOL (omapdss_get_dss); -bool omapdss_is_initialized (void ) +void omapdss_set_dss (struct dss_device *dss) { -return dss_initialized; + dss_device = dss; } -EXPORT_SYMBOL (omapdss_is_initialized); +EXPORT_SYMBOL (omapdss_set_dss);void dispc_set_ops (const struct dispc_ops *o) {drivers/gpu/drm/omapdrm/dss/dss.c +3
-2@@ -1316,6 +1316,7 @@ static const struct soc_device_attribute dss_soc_devices[] = {static int dss_bind (struct device *dev) { +struct dss_device *dss =dev_get_drvdata (dev);int r; r =component_bind_all (dev,NULL );@@ -1325,14 +1326,14 @@ static int dss_bind(struct device *dev)pm_set_vt_switch (0 );omapdss_gather_components (dev); -omapdss_set_is_initialized (true); +omapdss_set_dss (dss);return 0 ; }static void dss_unbind (struct device *dev) { -omapdss_set_is_initialized (false); +omapdss_set_dss (NULL );component_unbind_all (dev,NULL ); }drivers/gpu/drm/omapdrm/dss/omapdss.h +7
-3@@ -59,6 +59,7 @@#define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)#define DISPC_IRQ_FRAMEDONE3 (1 << 30) +struct dss_device ;struct omap_drm_private ;struct omap_dss_device ;struct dss_lcd_mgr_config ;@@ -586,7 +587,12 @@ struct omap_dss_driver { const struct hdmi_avi_infoframe *avi); }; -bool omapdss_is_initialized (void ); +struct dss_device *omapdss_get_dss (void ); +void omapdss_set_dss (struct dss_device *dss); +static inline bool omapdss_is_initialized (void ) +{ +return !!omapdss_get_dss (); +}int omapdss_register_display (struct omap_dss_device *dssdev);void omapdss_unregister_display (struct omap_dss_device *dssdev);@@ -630,8 +636,6 @@ static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)struct omap_dss_device *omapdss_of_find_source_for_first_ep (struct device_node *node); -void omapdss_set_is_initialized (bool set); -struct device_node *dss_of_port_get_parent_device (struct device_node *port);u32 dss_of_port_get_port_number (struct device_node *port);drivers/gpu/drm/omapdrm/omap_drv.c +1
-0@@ -527,6 +527,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)if (ret) goto err_crtc_uninit; + priv->dss =omapdss_get_dss (); priv->dispc_ops =dispc_get_ops (); soc =soc_device_match (omapdrm_soc_devices);drivers/gpu/drm/omapdrm/omap_drv.h +1
-0@@ -50,6 +50,7 @@ struct omap_drm_private {struct device *dev;u32 omaprev; +struct dss_device *dss;const struct dispc_ops *dispc_ops;unsigned int num_crtcs;Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 22/30] drm: omapdrm: dss: Store DSS device pointer in the omapdrm private data
In reply to Laurent PinchartHi,
Quoted 6 lines · Laurent Pinchart
The
dss_deviceis the top-level component in the omapdss driver. Give the omapdrm driver access to thedss_devicepointer in order to obtain pointers to all other components from it. This requires a new global variable in the omapdss driver that will be removed when merging the omapdrm and omapdss drivers, but will already allow removal of several other global variables.
How can we support different DSS versions with this change? So far the DSS functions used from omapdrm have been designed to be free of DSS specific parameters, and in the TI kernel we have a separate DSS driver for the DSS6, and omapdrm "just works" with either DSS2-5 and DSS6.
We could have the "struct dss_device *dss" and "struct dispc_device *dispc" in omap_drv.h as "struct device" pointers instead.
Alternatively, we could just create a totally new DRM driver for DSS6, having nothing in common with the current omapdrm. From naming perspective that would not be so bad, as OMAP is dead =). But if we ever get DSS7, perhaps that's again different enough that we don't want a single DSS driver for DSS6 and DSS7.
Tomi
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 22/30] drm: omapdrm: dss: Store DSS device pointer in the omapdrm private data
Hi Tomi,
Quoted 10 lines · On Wednesday, 14 February 2018 10:31:17 EET Tomi Valkeinen wrote:
Hi,
Quoted 6 lines · Laurent Pinchart
The
dss_deviceis the top-level component in the omapdss driver. Give the omapdrm driver access to thedss_devicepointer in order to obtain pointers to all other components from it. This requires a new global variable in the omapdss driver that will be removed when merging the omapdrm and omapdss drivers, but will already allow removal of several other global variables.
Quoted 7 lines
How can we support different DSS versions with this change? So far the DSS functions used from omapdrm have been designed to be free of DSS specific parameters, and in the TI kernel we have a separate DSS driver for the DSS6, and omapdrm "just works" with either DSS2-5 and DSS6.
We could have the "struct
dss_device*dss" and "structdispc_device*dispc" inomap_drv.has "struct device" pointers instead.
From an omapdrm point of view the dss_device and dispc_device structures are opaque. We're free to do anything we want with them, from switching to struct device pointers to allow completely separate implementations of the DSS and DISPC on DSS2-5 and DSS6, or storing common data in struct dss_device and struct dispc_device, that we can then subclass with version-specific structures internally. I don't have a strong opinion at the moment as I haven't seen the DSS6 code and thus can't judge whether there's a need to share data and code. At this point what matters to me is making sure we always pass objects around explicitly to avoid global variables. We could go for struct device now and switch to something else later, or the other way around, or anything else that works for you.
Quoted 5 lines
Alternatively, we could just create a totally new DRM driver for DSS6, having nothing in common with the current omapdrm. From naming perspective that would not be so bad, as OMAP is dead =). But if we ever get DSS7, perhaps that's again different enough that we don't want a single DSS driver for DSS6 and DSS7.
Again I haven't stupid the differences between DSS2-5 and DSS6 so I can't really comment, but being able to start from scratch without carrying device mistakes over is tempting. Of course that means we would just make different design mistakes :-)
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 23/30 drm: omapdrm: dss: Store dispc ops in dss_device structure
In reply to Laurent PinchartRemove the global dispc ops variable by storing it in the dss_device structure.
--- drivers/gpu/drm/omapdrm/dss/base.c | 13 ++++--------- drivers/gpu/drm/omapdrm/dss/dispc.c | 6 ++++-- drivers/gpu/drm/omapdrm/dss/dss.h | 2 ++ drivers/gpu/drm/omapdrm/dss/omapdss.h | 3 +-- drivers/gpu/drm/omapdrm/omap_crtc.c | 4 +--- drivers/gpu/drm/omapdrm/omap_drv.c | 5 ++--- 6 files changed, 14 insertions(+), 19 deletions(-)
drivers/gpu/drm/omapdrm/dss/base.c +4 -9
@@ -18,10 +18,11 @@#include <linux/of.h> #include <linux/of_graph.h> #include <linux/list.h> + +#include "dss.h" #include "omapdss.h" static struct dss_device *dss_device; -static const struct dispc_ops *ops;static struct list_head omapdss_comp_list;
@@ -43,15 +44,9 @@ void omapdss_set_dss(struct dss_device *dss) }EXPORT_SYMBOL (omapdss_set_dss); -void dispc_set_ops (const struct dispc_ops *o) -{ - ops = o; -} -EXPORT_SYMBOL (dispc_set_ops); - -const struct dispc_ops *dispc_get_ops (void ) +const struct dispc_ops *dispc_get_ops (struct dss_device *dss) { -return ops; +return dss->dispc_ops; }EXPORT_SYMBOL (dispc_get_ops);
drivers/gpu/drm/omapdrm/dss/dispc.c +4 -2
@@ -4622,7 +4622,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)dispc_runtime_put (); -dispc_set_ops (&dispc_ops); + dss->dispc_ops = &dispc_ops; dispc.debugfs =dss_debugfs_create_file (dss,"dispc" , dispc_dump_regs, &dispc);
@@ -4637,9 +4637,11 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)static void dispc_unbind (struct device *dev,struct device *master,void *data) { +struct dss_device *dss = dispc.dss; +dss_debugfs_remove_file (dispc.debugfs); -dispc_set_ops (NULL ); + dss->dispc_ops =NULL ;pm_runtime_disable (dev);
drivers/gpu/drm/omapdrm/dss/dss.h +2 -0
@@ -271,6 +271,8 @@ struct dss_device {struct dss_pll *plls[4 ];struct dss_pll *video1_pll;struct dss_pll *video2_pll; + +const struct dispc_ops *dispc_ops; };/* core */
drivers/gpu/drm/omapdrm/dss/omapdss.h +1 -2
@@ -733,8 +733,7 @@ struct dispc_ops {const u32 *(*ovl_get_color_modes)(enum omap_plane_id plane); }; -void dispc_set_ops (const struct dispc_ops *o); -const struct dispc_ops *dispc_get_ops (void ); +const struct dispc_ops *dispc_get_ops (struct dss_device *dss);bool omapdss_component_is_display (struct device_node *node);bool omapdss_component_is_output (struct device_node *node);
drivers/gpu/drm/omapdrm/omap_crtc.c +1 -3
@@ -117,12 +117,10 @@ static int omap_crtc_dss_connect(struct omap_drm_private *priv, enum omap_channel channel, struct omap_dss_device *dst) { - const struct dispc_ops *dispc_ops = dispc_get_ops(); - if (omap_crtc_output[channel]) return -EINVAL; -if ((dispc_ops->mgr_get_supported_outputs (channel) & dst->id) ==0 ) +if (!(priv->dispc_ops->mgr_get_supported_outputs (channel) & dst->id))return -EINVAL ; omap_crtc_output[channel] = dst;
drivers/gpu/drm/omapdrm/omap_drv.c +2 -3
@@ -520,6 +520,8 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)DBG ("%s" ,dev_name (dev)); priv->dev = dev; + priv->dss =omapdss_get_dss (); + priv->dispc_ops =dispc_get_ops (priv->dss);omap_crtc_pre_init (priv);
@@ -527,9 +529,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)if (ret) goto err_crtc_uninit; - priv->dss =omapdss_get_dss (); - priv->dispc_ops =dispc_get_ops (); - soc =soc_device_match (omapdrm_soc_devices); priv->omaprev = soc ? (unsigned int )soc->data :0 ; priv->wq =alloc_ordered_workqueue ("omapdrm" ,0 );
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 23/30] drm: omapdrm: dss: Store dispc ops in dss_device structure
Hi,
Quoted 4 lines · Laurent Pinchart
Remove the global dispc ops variable by storing it in the
dss_devicestructure.Signed-off-by Laurent Pinchart <[email protected]>
-- Sebastian
Quoted 147 lines
--- drivers/gpu/drm/omapdrm/dss/base.c | 13 ++++--------- drivers/gpu/drm/omapdrm/dss/dispc.c | 6 ++++-- drivers/gpu/drm/omapdrm/dss/dss.h | 2 ++ drivers/gpu/drm/omapdrm/dss/omapdss.h | 3 +-- drivers/gpu/drm/omapdrm/omap_crtc.c | 4 +--- drivers/gpu/drm/omapdrm/omap_drv.c | 5 ++--- 6 files changed, 14 insertions(+), 19 deletions(-)drivers/gpu/drm/omapdrm/dss/base.c +4
-9@@ -18,10 +18,11 @@#include <linux/of.h> #include <linux/of_graph.h> #include <linux/list.h> + +#include "dss.h" #include "omapdss.h" static struct dss_device *dss_device; -static const struct dispc_ops *ops;static struct list_head omapdss_comp_list;@@ -43,15 +44,9 @@ void omapdss_set_dss(struct dss_device *dss) }EXPORT_SYMBOL (omapdss_set_dss); -void dispc_set_ops (const struct dispc_ops *o) -{ - ops = o; -} -EXPORT_SYMBOL (dispc_set_ops); - -const struct dispc_ops *dispc_get_ops (void ) +const struct dispc_ops *dispc_get_ops (struct dss_device *dss) { -return ops; +return dss->dispc_ops; }EXPORT_SYMBOL (dispc_get_ops);drivers/gpu/drm/omapdrm/dss/dispc.c +4
-2@@ -4622,7 +4622,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)dispc_runtime_put (); -dispc_set_ops (&dispc_ops); + dss->dispc_ops = &dispc_ops; dispc.debugfs =dss_debugfs_create_file (dss,"dispc" , dispc_dump_regs, &dispc);@@ -4637,9 +4637,11 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)static void dispc_unbind (struct device *dev,struct device *master,void *data) { +struct dss_device *dss = dispc.dss; +dss_debugfs_remove_file (dispc.debugfs); -dispc_set_ops (NULL ); + dss->dispc_ops =NULL ;pm_runtime_disable (dev);drivers/gpu/drm/omapdrm/dss/dss.h +2
-0@@ -271,6 +271,8 @@ struct dss_device {struct dss_pll *plls[4 ];struct dss_pll *video1_pll;struct dss_pll *video2_pll; + +const struct dispc_ops *dispc_ops; };/* core */ drivers/gpu/drm/omapdrm/dss/omapdss.h +1
-2@@ -733,8 +733,7 @@ struct dispc_ops {const u32 *(*ovl_get_color_modes)(enum omap_plane_id plane); }; -void dispc_set_ops (const struct dispc_ops *o); -const struct dispc_ops *dispc_get_ops (void ); +const struct dispc_ops *dispc_get_ops (struct dss_device *dss);bool omapdss_component_is_display (struct device_node *node);bool omapdss_component_is_output (struct device_node *node);drivers/gpu/drm/omapdrm/omap_crtc.c +1
-3@@ -117,12 +117,10 @@ static int omap_crtc_dss_connect(struct omap_drm_private *priv, enum omap_channel channel, struct omap_dss_device *dst) { - const struct dispc_ops *dispc_ops = dispc_get_ops(); - if (omap_crtc_output[channel]) return -EINVAL; -if ((dispc_ops->mgr_get_supported_outputs (channel) & dst->id) ==0 ) +if (!(priv->dispc_ops->mgr_get_supported_outputs (channel) & dst->id))return -EINVAL ; omap_crtc_output[channel] = dst;drivers/gpu/drm/omapdrm/omap_drv.c +2
-3@@ -520,6 +520,8 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)DBG ("%s" ,dev_name (dev)); priv->dev = dev; + priv->dss =omapdss_get_dss (); + priv->dispc_ops =dispc_get_ops (priv->dss);omap_crtc_pre_init (priv);@@ -527,9 +529,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)if (ret) goto err_crtc_uninit; - priv->dss =omapdss_get_dss (); - priv->dispc_ops =dispc_get_ops (); - soc =soc_device_match (omapdrm_soc_devices); priv->omaprev = soc ? (unsigned int )soc->data :0 ; priv->wq =alloc_ordered_workqueue ("omapdrm" ,0 );Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 24/30 drm: omapdrm: dispc: Pass DISPC pointer to dispc_ops operations
In reply to Laurent PinchartThis 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.
--- drivers/gpu/drm/omapdrm/dss/base.c | 6 + drivers/gpu/drm/omapdrm/dss/dispc.c | 223 ++++++++++++++++++---------------- drivers/gpu/drm/omapdrm/dss/dpi.c | 6 +- drivers/gpu/drm/omapdrm/dss/dsi.c | 4 +- drivers/gpu/drm/omapdrm/dss/dss.h | 6 +- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 7 +- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 7 +- drivers/gpu/drm/omapdrm/dss/omapdss.h | 95 +++++++++------ drivers/gpu/drm/omapdrm/dss/sdi.c | 6 +- drivers/gpu/drm/omapdrm/dss/venc.c | 4 +- drivers/gpu/drm/omapdrm/omap_crtc.c | 31 +++-- drivers/gpu/drm/omapdrm/omap_drv.c | 13 +- drivers/gpu/drm/omapdrm/omap_drv.h | 1 + drivers/gpu/drm/omapdrm/omap_irq.c | 32 ++--- drivers/gpu/drm/omapdrm/omap_plane.c | 12 +- 15 files changed, 257 insertions(+), 196 deletions(-)
drivers/gpu/drm/omapdrm/dss/base.c +6 -0
@@ -44,6 +44,12 @@ void omapdss_set_dss(struct dss_device *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) {return dss->dispc_ops;
drivers/gpu/drm/omapdrm/dss/dispc.c +121 -102
603 lines not on this page · raw message
drivers/gpu/drm/omapdrm/dss/dpi.c +3 -3
@@ -406,7 +406,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) goto err_reg_enable; } - r =dispc_runtime_get (); + r =dispc_runtime_get (dpi->dss->dispc);if (r) goto err_get_dispc;
@@ -442,7 +442,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)dss_pll_disable (dpi->pll); err_pll_init: err_src_sel: -dispc_runtime_put (); +dispc_runtime_put (dpi->dss->dispc); err_get_dispc:if (dpi->vdds_dsi_reg)regulator_disable (dpi->vdds_dsi_reg);
@@ -466,7 +466,7 @@ static void dpi_display_disable(struct omap_dss_device *dssdev)dss_pll_disable (dpi->pll); } -dispc_runtime_put (); +dispc_runtime_put (dpi->dss->dispc);if (dpi->vdds_dsi_reg)regulator_disable (dpi->vdds_dsi_reg);
drivers/gpu/drm/omapdrm/dss/dsi.c +2 -2
@@ -5523,7 +5523,7 @@ 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 (); +dispc_runtime_put (dsi->dss->dispc);return 0 ; }
@@ -5533,7 +5533,7 @@ static int dsi_runtime_resume(struct device *dev)struct dsi_data *dsi =dev_get_drvdata (dev);int r; - r =dispc_runtime_get (); + r =dispc_runtime_get (dsi->dss->dispc);if (r)return r;
drivers/gpu/drm/omapdrm/dss/dss.h +4 -2
@@ -25,6 +25,7 @@#include "omapdss.h" +struct dispc_device ;struct dss_debugfs_entry ;struct platform_device ;struct seq_file ;
@@ -272,6 +273,7 @@ struct dss_device {struct dss_pll *video1_pll;struct dss_pll *video2_pll; +struct dispc_device *dispc;const struct dispc_ops *dispc_ops; };
@@ -407,8 +409,8 @@ static inline void dpi_uninit_port(struct device_node *port)/* DISPC */ void dispc_dump_clocks (struct seq_file *s); -int dispc_runtime_get (void ); -void dispc_runtime_put (void ); +int dispc_runtime_get (struct dispc_device *dispc); +void dispc_runtime_put (struct dispc_device *dispc);void dispc_enable_sidle (void );void dispc_disable_sidle (void );
drivers/gpu/drm/omapdrm/dss/hdmi4.c +5 -2
@@ -819,16 +819,19 @@ static int hdmi4_remove(struct platform_device *pdev)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 ; }static int hdmi_runtime_resume (struct device *dev) { +struct omap_hdmi *hdmi =dev_get_drvdata (dev);int r; - r =dispc_runtime_get (); + r =dispc_runtime_get (hdmi->dss->dispc);if (r <0 )return r;
drivers/gpu/drm/omapdrm/dss/hdmi5.c +5 -2
@@ -814,16 +814,19 @@ static int hdmi5_remove(struct platform_device *pdev)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 ; }static int hdmi_runtime_resume (struct device *dev) { +struct omap_hdmi *hdmi =dev_get_drvdata (dev);int r; - r =dispc_runtime_get (); + r =dispc_runtime_get (hdmi->dss->dispc);if (r <0 )return r;
drivers/gpu/drm/omapdrm/dss/omapdss.h +56 -39
111 lines not on this page · raw message
drivers/gpu/drm/omapdrm/dss/sdi.c +3 -3
@@ -141,7 +141,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)if (r) goto err_reg_enable; - r =dispc_runtime_get (); + r =dispc_runtime_get (sdi.dss->dispc);if (r) goto err_get_dispc;
@@ -203,7 +203,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) err_sdi_enable: err_set_dss_clock_div: err_calc_clock_div: -dispc_runtime_put (); +dispc_runtime_put (sdi.dss->dispc); err_get_dispc:regulator_disable (sdi.vdds_sdi_reg); err_reg_enable:
@@ -216,7 +216,7 @@ static void sdi_display_disable(struct omap_dss_device *dssdev)dss_sdi_disable (sdi.dss); -dispc_runtime_put (); +dispc_runtime_put (sdi.dss->dispc);regulator_disable (sdi.vdds_sdi_reg); }
drivers/gpu/drm/omapdrm/dss/venc.c +2 -2
@@ -956,7 +956,7 @@ static int venc_runtime_suspend(struct device *dev)if (venc.tv_dac_clk)clk_disable_unprepare (venc.tv_dac_clk); -dispc_runtime_put (); +dispc_runtime_put (venc.dss->dispc);return 0 ; }
@@ -965,7 +965,7 @@ static int venc_runtime_resume(struct device *dev) {int r; - r =dispc_runtime_get (); + r =dispc_runtime_get (venc.dss->dispc);if (r <0 )return r;
drivers/gpu/drm/omapdrm/omap_crtc.c +19 -12
@@ -117,10 +117,13 @@ static int omap_crtc_dss_connect(struct omap_drm_private *priv,enum omap_channel channel, 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])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 ; omap_crtc_output[channel] = dst;
@@ -157,7 +160,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)return ;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;return ; }
@@ -170,8 +173,9 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) omap_crtc->ignore_digit_sync_lost = true; } - framedone_irq = priv->dispc_ops->mgr_get_framedone_irq (channel); - vsync_irq = priv->dispc_ops->mgr_get_vsync_irq (channel); + framedone_irq = priv->dispc_ops->mgr_get_framedone_irq (priv->dispc, + channel); + vsync_irq = priv->dispc_ops->mgr_get_vsync_irq (priv->dispc, channel);if (enable) { 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) 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; 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, {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);return 0 ;
@@ -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];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(
@@ -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 * 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);return ; }
@@ -337,7 +343,7 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc) info.partial_alpha_enabled = 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, length = crtc->state->gamma_lut->length /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);
@@ -552,7 +559,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,WARN_ON (ret !=0 );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);spin_unlock_irq (&crtc->dev->event_lock); }
@@ -734,7 +741,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,* extracted with dispc_mgr_gamma_size(). If it returns 0 * 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 ;drm_crtc_enable_color_mgmt (crtc,0 , false, gamma_lut_size);
drivers/gpu/drm/omapdrm/omap_drv.c +7 -6
@@ -69,7 +69,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)struct drm_device *dev = old_state->dev;struct omap_drm_private *priv = dev->dev_private; - priv->dispc_ops->runtime_get (); + priv->dispc_ops->runtime_get (priv->dispc);/* Apply the atomic update. */ 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)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 = {
@@ -191,7 +191,7 @@ static int omap_connect_dssdevs(void)static int omap_modeset_init_properties (struct drm_device *dev) {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 , num_planes -1 );
@@ -205,8 +205,8 @@ static int omap_modeset_init(struct drm_device *dev) {struct omap_drm_private *priv = dev->dev_private;struct omap_dss_device *dssdev =NULL ; -int num_ovls = priv->dispc_ops->get_num_ovls (); -int num_mgrs = priv->dispc_ops->get_num_mgrs (); +int num_ovls = priv->dispc_ops->get_num_ovls (priv->dispc); +int num_mgrs = priv->dispc_ops->get_num_mgrs (priv->dispc);int num_crtcs, crtc_idx, plane_idx;int ret;u32 plane_crtc_mask;
@@ -521,6 +521,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) priv->dev = dev; priv->dss =omapdss_get_dss (); + priv->dispc =dispc_get_dispc (priv->dss); priv->dispc_ops =dispc_get_ops (priv->dss);omap_crtc_pre_init (priv);
@@ -549,7 +550,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)/* Get memory bandwidth limits */ if (priv->dispc_ops->get_memory_bandwidth_limit) priv->max_bandwidth = - priv->dispc_ops->get_memory_bandwidth_limit (); + priv->dispc_ops->get_memory_bandwidth_limit (priv->dispc);omap_gem_init (ddev);
drivers/gpu/drm/omapdrm/omap_drv.h +1 -0
@@ -51,6 +51,7 @@ struct omap_drm_private {u32 omaprev;struct dss_device *dss; +struct dispc_device *dispc;const struct dispc_ops *dispc_ops;unsigned int num_crtcs;
drivers/gpu/drm/omapdrm/omap_irq.c +17 -15
@@ -38,7 +38,7 @@ static void omap_irq_update(struct drm_device *dev)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)
@@ -108,7 +108,8 @@ int omap_irq_enable_vblank(struct drm_crtc *crtc)DBG ("dev=%p, crtc=%u" , dev, channel);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);spin_unlock_irqrestore (&priv->wait_lock, flags);
@@ -134,7 +135,8 @@ void omap_irq_disable_vblank(struct drm_crtc *crtc)DBG ("dev=%p, crtc=%u" , dev, channel);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);spin_unlock_irqrestore (&priv->wait_lock, flags); }
@@ -198,9 +200,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)unsigned int id;u32 irqstatus; - irqstatus = priv->dispc_ops->read_irqstatus (); - priv->dispc_ops->clear_irqstatus (irqstatus); - priv->dispc_ops->read_irqstatus ();/* flush posted write */ + irqstatus = priv->dispc_ops->read_irqstatus (priv->dispc); + priv->dispc_ops->clear_irqstatus (priv->dispc, irqstatus); + priv->dispc_ops->read_irqstatus (priv->dispc);/* flush posted write */ VERB ("irqs: %08x" , irqstatus);
@@ -208,12 +210,12 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)struct drm_crtc *crtc = priv->crtcs[id];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);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); }
@@ -247,7 +249,7 @@ static const u32 omap_underflow_irqs[] = {int omap_drm_irq_install (struct drm_device *dev) {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 i;int ret;
@@ -265,13 +267,13 @@ int omap_drm_irq_install(struct drm_device *dev) }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->clear_irqstatus (0xffffffff ); - priv->dispc_ops->runtime_put (); + priv->dispc_ops->runtime_get (priv->dispc); + priv->dispc_ops->clear_irqstatus (priv->dispc,0xffffffff ); + 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 )return ret;
@@ -289,5 +291,5 @@ void omap_drm_irq_uninstall(struct drm_device *dev) dev->irq_enabled = false; - priv->dispc_ops->free_irq (dev); + priv->dispc_ops->free_irq (priv->dispc, dev); }
drivers/gpu/drm/omapdrm/omap_plane.c +6 -6
@@ -77,17 +77,17 @@ static void omap_plane_atomic_update(struct drm_plane *plane, &info.paddr, &info.p_uv_addr);/* 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_channel (state->crtc));if (ret) {dev_err (plane->dev->dev,"Failed to setup plane %s\n" , omap_plane->name); - priv->dispc_ops->ovl_enable (omap_plane->id, false); + priv->dispc_ops->ovl_enable (priv->dispc, omap_plane->id, false);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,
@@ -100,7 +100,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane, plane->state->zpos = plane->type ==DRM_PLANE_TYPE_PRIMARY ?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,
@@ -259,7 +259,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, u32 possible_crtcs) {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 omap_plane *omap_plane;enum omap_plane_id id;
@@ -278,7 +278,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,if (!omap_plane)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) ; omap_plane->id = id;
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 25/30 drm: omapdrm: dispc: Pass DISPC pointer to remaining dispc API functions
In reply to Laurent PinchartThis 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).
--- drivers/gpu/drm/omapdrm/dss/dispc.c | 102 ++++++++++++++++++++---------------- drivers/gpu/drm/omapdrm/dss/dpi.c | 12 +++-- drivers/gpu/drm/omapdrm/dss/dsi.c | 22 ++++---- drivers/gpu/drm/omapdrm/dss/dss.c | 14 ++--- drivers/gpu/drm/omapdrm/dss/dss.h | 74 ++++++++++++++------------ drivers/gpu/drm/omapdrm/dss/hdmi4.c | 4 +- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 4 +- drivers/gpu/drm/omapdrm/dss/sdi.c | 9 ++-- drivers/gpu/drm/omapdrm/dss/venc.c | 2 +- 9 files changed, 133 insertions(+), 110 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +56 -46
@@ -704,7 +704,7 @@ static u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,return mgr_desc[channel].sync_lost_irq; } -u32 dispc_wb_get_framedone_irq (void ) +u32 dispc_wb_get_framedone_irq (struct dispc_device *dispc) {return DISPC_IRQ_FRAMEDONEWB ; }
@@ -739,12 +739,12 @@ static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)mgr_fld_write (channel,DISPC_MGR_FLD_GO ,1 ); } -bool dispc_wb_go_busy (void ) +bool dispc_wb_go_busy (struct dispc_device *dispc) {return REG_GET (DISPC_CONTROL2 ,6 ,6 ) ==1 ; } -void dispc_wb_go (void ) +void dispc_wb_go (struct dispc_device *dispc) {enum omap_plane_id plane =OMAP_DSS_WB ;bool enable, go;
@@ -1196,7 +1196,8 @@ static enum omap_channel dispc_ovl_get_channel_out(enum omap_plane_id plane) } } -void dispc_wb_set_channel_in (enum dss_writeback_channel channel) +void dispc_wb_set_channel_in (struct dispc_device *dispc, +enum dss_writeback_channel channel) {enum omap_plane_id plane =OMAP_DSS_WB ;
@@ -1371,10 +1372,10 @@ static void dispc_init_fifos(void)const bool use_fifomerge = false;const bool manual_update = false; -dispc_ovl_compute_fifo_thresholds (i, &low, &high, +dispc_ovl_compute_fifo_thresholds (&dispc, i, &low, &high, use_fifomerge, manual_update); -dispc_ovl_set_fifo_threshold (i, low, high); +dispc_ovl_set_fifo_threshold (&dispc, i, low, high); }if (dispc.feat->has_writeback) {
@@ -1382,10 +1383,11 @@ static void dispc_init_fifos(void)const bool use_fifomerge = false;const bool manual_update = false; -dispc_ovl_compute_fifo_thresholds (OMAP_DSS_WB , &low, &high, - use_fifomerge, manual_update); +dispc_ovl_compute_fifo_thresholds (&dispc,OMAP_DSS_WB , + &low, &high, + use_fifomerge, manual_update); -dispc_ovl_set_fifo_threshold (OMAP_DSS_WB , low, high); +dispc_ovl_set_fifo_threshold (&dispc,OMAP_DSS_WB , low, high); } }
@@ -1402,13 +1404,14 @@ static u32 dispc_ovl_get_fifo_size(enum omap_plane_id plane)return size; } -void dispc_ovl_set_fifo_threshold (enum omap_plane_id plane,u32 low, -u32 high) +void dispc_ovl_set_fifo_threshold (struct dispc_device *dispc, +enum omap_plane_id plane, +u32 low,u32 high) {u8 hi_start, hi_end, lo_start, lo_end;u32 unit; - unit = dispc.feat->buffer_size_unit; + unit = dispc->feat->buffer_size_unit;WARN_ON (low % unit !=0 );WARN_ON (high % unit !=0 );
@@ -1436,12 +1439,12 @@ void dispc_ovl_set_fifo_threshold(enum omap_plane_id plane, u32 low,* large for the preload field, set the threshold to the maximum value * that can be held by the preload register */ -if (dispc_has_feature (FEAT_PRELOAD ) && dispc.feat->set_max_preload && +if (dispc_has_feature (FEAT_PRELOAD ) && dispc->feat->set_max_preload && plane !=OMAP_DSS_WB )dispc_write_reg (DISPC_OVL_PRELOAD (plane),min (high,0xfffu )); } -void dispc_enable_fifomerge (bool enable) +void dispc_enable_fifomerge (struct dispc_device *dispc,bool enable) {if (!dispc_has_feature (FEAT_FIFO_MERGE )) {WARN_ON (enable);
@@ -1452,15 +1455,16 @@ void dispc_enable_fifomerge(bool enable)REG_FLD_MOD (DISPC_CONFIG , enable ?1 :0 ,14 ,14 ); } -void dispc_ovl_compute_fifo_thresholds (enum omap_plane_id plane, -u32 *fifo_low,u32 *fifo_high,bool use_fifomerge, -bool manual_update) +void dispc_ovl_compute_fifo_thresholds (struct dispc_device *dispc, +enum omap_plane_id plane, +u32 *fifo_low,u32 *fifo_high, +bool use_fifomerge,bool manual_update) {/* * All sizes are in bytes. Both the buffer and burst are made of * buffer_units, and the fifo thresholds must be buffer_unit aligned. */ -unsigned int buf_unit = dispc.feat->buffer_size_unit; +unsigned int buf_unit = dispc->feat->buffer_size_unit;unsigned int ovl_fifo_size, total_fifo_size, burst_size;int i;
@@ -1469,7 +1473,7 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane_id plane,if (use_fifomerge) { total_fifo_size =0 ; -for (i =0 ; i <dispc_get_num_ovls (&dispc); ++i) +for (i =0 ; i <dispc_get_num_ovls (dispc); ++i) total_fifo_size +=dispc_ovl_get_fifo_size (i); }else { total_fifo_size = ovl_fifo_size;
@@ -2665,8 +2669,9 @@ static int dispc_ovl_setup(struct dispc_device *dispc,return r; } -int dispc_wb_setup (const struct omap_dss_writeback_info *wi, -bool mem_to_mem,const struct videomode *vm) +int dispc_wb_setup (struct dispc_device *dispc, +const struct omap_dss_writeback_info *wi, +bool mem_to_mem,const struct videomode *vm) {int r;u32 l;
@@ -2757,7 +2762,7 @@ static void dispc_lcd_enable_signal_polarity(bool act_high)REG_FLD_MOD (DISPC_CONTROL , act_high ?1 :0 ,29 ,29 ); } -void dispc_lcd_enable_signal (bool enable) +void dispc_lcd_enable_signal (struct dispc_device *dispc,bool enable) {if (!dispc_has_feature (FEAT_LCDENABLESIGNAL ))return ;
@@ -2765,7 +2770,7 @@ void dispc_lcd_enable_signal(bool enable)REG_FLD_MOD (DISPC_CONTROL , enable ?1 :0 ,28 ,28 ); } -void dispc_pck_free_enable (bool enable) +void dispc_pck_free_enable (struct dispc_device *dispc,bool enable) {if (!dispc_has_feature (FEAT_PCKFREEENABLE ))return ;
@@ -2904,7 +2909,7 @@ static void dispc_mgr_set_lcd_config(struct dispc_device *dispc,dispc_mgr_enable_stallmode (channel, config->stallmode);dispc_mgr_enable_fifohandcheck (channel, config->fifohandcheck); -dispc_mgr_set_clock_div (channel, &config->clock_info); +dispc_mgr_set_clock_div (dispc, channel, &config->clock_info);dispc_mgr_set_tft_data_lines (channel, config->video_port_width);
@@ -2941,7 +2946,8 @@ static bool _dispc_mgr_pclk_ok(enum omap_channel channel,return pclk <= dispc.feat->max_tv_pclk; } -bool dispc_mgr_timings_ok (enum omap_channel channel,const struct videomode *vm) +bool dispc_mgr_timings_ok (struct dispc_device *dispc,enum omap_channel channel, +const struct videomode *vm) {if (!_dispc_mgr_size_ok (vm->hactive, vm->vactive))return false;
@@ -3062,7 +3068,7 @@ static void dispc_mgr_set_timings(struct dispc_device *dispc,DSSDBG ("channel %d xres %u yres %u\n" , channel, t.hactive, t.vactive); -if (!dispc_mgr_timings_ok (channel, &t)) { +if (!dispc_mgr_timings_ok (dispc, channel, &t)) {BUG ();return ; }
@@ -3195,9 +3201,9 @@ static unsigned long dispc_mgr_pclk_rate(enum omap_channel channel) } } -void dispc_set_tv_pclk (unsigned long pclk) +void dispc_set_tv_pclk (struct dispc_device *dispc,unsigned long pclk) { - dispc.tv_pclk_rate = pclk; + dispc->tv_pclk_rate = pclk; }static unsigned long dispc_core_clk_rate (void )
@@ -3249,17 +3255,18 @@ static void dispc_dump_clocks_channel(struct seq_file *s, enum omap_channel chan dispc_mgr_pclk_rate(channel), pcd); } -void dispc_dump_clocks (struct seq_file *s) +void dispc_dump_clocks (struct dispc_device *dispc,struct seq_file *s) { +enum dss_clk_source dispc_clk_src;int lcd;u32 l; -enum dss_clk_source dispc_clk_src =dss_get_dispc_clk_source (dispc.dss); -if (dispc_runtime_get (&dispc)) +if (dispc_runtime_get (dispc))return ;seq_printf (s,"- DISPC -\n" ); + dispc_clk_src =dss_get_dispc_clk_source (dispc->dss);seq_printf (s,"dispc fclk source = %s\n" ,dss_get_clk_source_name (dispc_clk_src));
@@ -3281,7 +3288,7 @@ void dispc_dump_clocks(struct seq_file *s)if (dispc_has_feature (FEAT_MGR_LCD3 ))dispc_dump_clocks_channel (s,OMAP_DSS_CHANNEL_LCD3 ); -dispc_runtime_put (&dispc); +dispc_runtime_put (dispc); }static int dispc_dump_regs (struct seq_file *s,void *p)
@@ -3482,8 +3489,9 @@ static int dispc_dump_regs(struct seq_file *s, void *p) }/* calculate clock rates using dividers in cinfo */ -int dispc_calc_clock_rates (unsigned long dispc_fclk_rate, -struct dispc_clock_info *cinfo) +int dispc_calc_clock_rates (struct dispc_device *dispc, +unsigned long dispc_fclk_rate, +struct dispc_clock_info *cinfo) {if (cinfo->lck_div >255 || cinfo->lck_div ==0 )return -EINVAL ;
@@ -3496,9 +3504,9 @@ int dispc_calc_clock_rates(unsigned long dispc_fclk_rate,return 0 ; } -bool dispc_div_calc (unsigned long dispc_freq, -unsigned long pck_min,unsigned long pck_max, -dispc_div_calc_func func,void *data) +bool dispc_div_calc (struct dispc_device *dispc,unsigned long dispc_freq, +unsigned long pck_min,unsigned long pck_max, +dispc_div_calc_func func,void *data) {int lckd, lckd_start, lckd_stop;int pckd, pckd_start, pckd_stop;
@@ -3514,10 +3522,10 @@ bool dispc_div_calc(unsigned long dispc_freq, min_fck_per_pck =0 ;#endif - pckd_hw_min = dispc.feat->min_pcd; + pckd_hw_min = dispc->feat->min_pcd; pckd_hw_max =255 ; - lck_max =dss_get_max_fck_rate (dispc.dss); + lck_max =dss_get_max_fck_rate (dispc->dss); pck_min = pck_min ? pck_min :1 ; pck_max = pck_max ? pck_max :ULONG_MAX ;
@@ -3556,8 +3564,9 @@ bool dispc_div_calc(unsigned long dispc_freq,return false; } -void dispc_mgr_set_clock_div (enum omap_channel channel, -const struct dispc_clock_info *cinfo) +void dispc_mgr_set_clock_div (struct dispc_device *dispc, +enum omap_channel channel, +const struct dispc_clock_info *cinfo) {DSSDBG ("lck = %lu (%u)\n" , cinfo->lck, cinfo->lck_div);DSSDBG ("pck = %lu (%u)\n" , cinfo->pck, cinfo->pck_div);
@@ -3565,8 +3574,9 @@ void dispc_mgr_set_clock_div(enum omap_channel channel,dispc_mgr_set_lcd_divisor (channel, cinfo->lck_div, cinfo->pck_div); } -int dispc_mgr_get_clock_div (enum omap_channel channel, -struct dispc_clock_info *cinfo) +int dispc_mgr_get_clock_div (struct dispc_device *dispc, +enum omap_channel channel, +struct dispc_clock_info *cinfo) {unsigned long fck;
@@ -3604,12 +3614,12 @@ static void dispc_write_irqenable(struct dispc_device *dispc, u32 mask)dispc_read_reg (DISPC_IRQENABLE ); } -void dispc_enable_sidle (void ) +void dispc_enable_sidle (struct dispc_device *dispc) {REG_FLD_MOD (DISPC_SYSCONFIG ,2 ,4 ,3 );/* SIDLEMODE: smart idle */ } -void dispc_disable_sidle (void ) +void dispc_disable_sidle (struct dispc_device *dispc) {REG_FLD_MOD (DISPC_SYSCONFIG ,1 ,4 ,3 );/* SIDLEMODE: no idle */ }
@@ -4482,7 +4492,7 @@ static void dispc_errata_i734_wa(void)/* Set up and enable display manager for LCD1 */ dispc_mgr_setup (&dispc,OMAP_DSS_CHANNEL_LCD , &i734.mgri); -dispc_calc_clock_rates (dss_get_dispc_clk_rate (dispc.dss), +dispc_calc_clock_rates (&dispc,dss_get_dispc_clk_rate (dispc.dss), &lcd_conf.clock_info);dispc_mgr_set_lcd_config (&dispc,OMAP_DSS_CHANNEL_LCD , &lcd_conf);dispc_mgr_set_timings (&dispc,OMAP_DSS_CHANNEL_LCD , &i734.vm);
drivers/gpu/drm/omapdrm/dss/dpi.c +7 -5
@@ -191,8 +191,9 @@ static bool dpi_calc_hsdiv_cb(int m_dispc, unsigned long dispc, ctx->pll_cinfo.mX[ctx->clkout_idx] = m_dispc; ctx->pll_cinfo.clkout[ctx->clkout_idx] = dispc; -return dispc_div_calc (dispc, ctx->pck_min, ctx->pck_max, - dpi_calc_dispc_cb, ctx); +return dispc_div_calc (ctx->pll->dss->dispc, dispc, + ctx->pck_min, ctx->pck_max, + dpi_calc_dispc_cb, ctx); }
@@ -218,8 +219,9 @@ static bool dpi_calc_dss_cb(unsigned long fck, void *data) ctx->fck = fck; -return dispc_div_calc (fck, ctx->pck_min, ctx->pck_max, - dpi_calc_dispc_cb, ctx); +return dispc_div_calc (ctx->pll->dss->dispc, fck, + ctx->pck_min, ctx->pck_max, + dpi_calc_dispc_cb, ctx); } static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck,
@@ -514,7 +516,7 @@ static int dpi_check_timings(struct omap_dss_device *dssdev,if (vm->hactive %8 !=0 )return -EINVAL ; -if (!dispc_mgr_timings_ok (channel, vm)) +if (!dispc_mgr_timings_ok (dpi->dss->dispc, channel, vm))return -EINVAL ;if (vm->pixelclock ==0 )
drivers/gpu/drm/omapdrm/dss/dsi.c +12 -10
@@ -1394,18 +1394,18 @@ static int dsi_pll_enable(struct dss_pll *pll) }/* XXX PLL does not come out of reset without this... */ -dispc_pck_free_enable (1 ); +dispc_pck_free_enable (dsi->dss->dispc,1 );if (!wait_for_bit_change (dsi,DSI_PLL_STATUS ,0 ,1 )) {DSSERR ("PLL not coming out of reset.\n" ); r = -ENODEV ; -dispc_pck_free_enable (0 ); +dispc_pck_free_enable (dsi->dss->dispc,0 ); goto err1; }/* XXX ... but if left on, we get problems when planes do not * fill the whole display. No idea about this */ -dispc_pck_free_enable (0 ); +dispc_pck_free_enable (dsi->dss->dispc,0 ); r =dsi_pll_power (dsi,DSI_PLL_POWER_ON_ALL );
@@ -3972,7 +3972,7 @@ static void dsi_update_screen_dispc(struct dsi_data *dsi)* the same goes for any DSS interrupts, but for some reason I have not * seen the problem anywhere else than here. */ -dispc_disable_sidle (); +dispc_disable_sidle (dsi->dss->dispc);dsi_perf_mark_start (dsi);
@@ -4007,7 +4007,7 @@ static void dsi_te_timeout(struct timer_list *unused)static void dsi_handle_framedone (struct dsi_data *dsi,int error) {/* SIDLEMODE back to smart-idle */ -dispc_enable_sidle (); +dispc_enable_sidle (dsi->dss->dispc);if (dsi->te_enabled) {/* enable LP_RX_TO again after the TE */
@@ -4088,7 +4088,7 @@ static int dsi_configure_dispc_clocks(struct dsi_data *dsi) dispc_cinfo.lck_div = dsi->user_dispc_cinfo.lck_div; dispc_cinfo.pck_div = dsi->user_dispc_cinfo.pck_div; - r =dispc_calc_clock_rates (fck, &dispc_cinfo); + r =dispc_calc_clock_rates (dsi->dss->dispc, fck, &dispc_cinfo);if (r) {DSSERR ("Failed to calc dispc clocks\n" );return r;
@@ -4439,8 +4439,9 @@ static bool dsi_cm_calc_hsdiv_cb(int m_dispc, unsigned long dispc, ctx->dsi_cinfo.mX[HSDIV_DISPC ] = m_dispc; ctx->dsi_cinfo.clkout[HSDIV_DISPC ] = dispc; -return dispc_div_calc (dispc, ctx->req_pck_min, ctx->req_pck_max, - dsi_cm_calc_dispc_cb, ctx); +return dispc_div_calc (ctx->dsi->dss->dispc, dispc, + ctx->req_pck_min, ctx->req_pck_max, + dsi_cm_calc_dispc_cb, ctx); } static bool dsi_cm_calc_pll_cb(int n, int m, unsigned long fint,
@@ -4739,8 +4740,9 @@ static bool dsi_vm_calc_hsdiv_cb(int m_dispc, unsigned long dispc,else pck_max = ctx->req_pck_max; -return dispc_div_calc (dispc, ctx->req_pck_min, pck_max, - dsi_vm_calc_dispc_cb, ctx); +return dispc_div_calc (ctx->dsi->dss->dispc, dispc, + ctx->req_pck_min, pck_max, + dsi_vm_calc_dispc_cb, ctx); } static bool dsi_vm_calc_pll_cb(int n, int m, unsigned long fint,
drivers/gpu/drm/omapdrm/dss/dss.c +7 -7
@@ -274,7 +274,7 @@ int dss_sdi_enable(struct dss_device *dss) {unsigned long timeout; -dispc_pck_free_enable (1 ); +dispc_pck_free_enable (dss->dispc,1 );/* Reset SDI PLL */ REG_FLD_MOD (dss,DSS_PLL_CONTROL ,1 ,18 ,18 );/* SDI_PLL_SYSRESET */
@@ -304,7 +304,7 @@ int dss_sdi_enable(struct dss_device *dss) } } -dispc_lcd_enable_signal (1 ); +dispc_lcd_enable_signal (dss->dispc,1 );/* Waiting for SDI reset to complete */ timeout = jiffies +msecs_to_jiffies (500 );
@@ -318,21 +318,21 @@ int dss_sdi_enable(struct dss_device *dss)return 0 ; err2: -dispc_lcd_enable_signal (0 ); +dispc_lcd_enable_signal (dss->dispc,0 ); err1:/* Reset SDI PLL */ REG_FLD_MOD (dss,DSS_PLL_CONTROL ,0 ,18 ,18 );/* SDI_PLL_SYSRESET */ -dispc_pck_free_enable (0 ); +dispc_pck_free_enable (dss->dispc,0 );return -ETIMEDOUT ; }void dss_sdi_disable (struct dss_device *dss) { -dispc_lcd_enable_signal (0 ); +dispc_lcd_enable_signal (dss->dispc,0 ); -dispc_pck_free_enable (0 ); +dispc_pck_free_enable (dss->dispc,0 );/* Reset SDI PLL */ REG_FLD_MOD (dss,DSS_PLL_CONTROL ,0 ,18 ,18 );/* SDI_PLL_SYSRESET */
@@ -894,7 +894,7 @@ static int dss_debug_dump_clocks(struct seq_file *s, void *p)struct dss_device *dss = s->private;dss_dump_clocks (dss, s); -dispc_dump_clocks (s); +dispc_dump_clocks (dss->dispc, s);#ifdef CONFIG_OMAP2_DSS_DSI dsi_dump_clocks (s);#endif
drivers/gpu/drm/omapdrm/dss/dss.h +41 -33
88 lines not on this page · raw message
drivers/gpu/drm/omapdrm/dss/hdmi4.c +2 -2
@@ -276,7 +276,7 @@ static void hdmi_power_off_full(struct omap_dss_device *dssdev)static int hdmi_display_check_timing (struct omap_dss_device *dssdev,struct videomode *vm) { -if (!dispc_mgr_timings_ok (dssdev->dispc_channel, vm)) +if (!dispc_mgr_timings_ok (hdmi.dss->dispc, dssdev->dispc_channel, vm))return -EINVAL ;return 0 ;
@@ -289,7 +289,7 @@ static void hdmi_display_set_timing(struct omap_dss_device *dssdev, hdmi.cfg.vm = *vm; -dispc_set_tv_pclk (vm->pixelclock); +dispc_set_tv_pclk (hdmi.dss->dispc, vm->pixelclock);mutex_unlock (&hdmi.lock); }
drivers/gpu/drm/omapdrm/dss/hdmi5.c +2 -2
@@ -272,7 +272,7 @@ static void hdmi_power_off_full(struct omap_dss_device *dssdev)static int hdmi_display_check_timing (struct omap_dss_device *dssdev,struct videomode *vm) { -if (!dispc_mgr_timings_ok (dssdev->dispc_channel, vm)) +if (!dispc_mgr_timings_ok (hdmi.dss->dispc, dssdev->dispc_channel, vm))return -EINVAL ;return 0 ;
@@ -285,7 +285,7 @@ static void hdmi_display_set_timing(struct omap_dss_device *dssdev, hdmi.cfg.vm = *vm; -dispc_set_tv_pclk (vm->pixelclock); +dispc_set_tv_pclk (hdmi.dss->dispc, vm->pixelclock);mutex_unlock (&hdmi.lock); }
drivers/gpu/drm/omapdrm/dss/sdi.c +5 -4
@@ -71,8 +71,9 @@ static bool dpi_calc_dss_cb(unsigned long fck, void *data) ctx->fck = fck; -return dispc_div_calc (fck, ctx->pck_min, ctx->pck_max, - dpi_calc_dispc_cb, ctx); +return dispc_div_calc (sdi.dss->dispc, fck, + ctx->pck_min, ctx->pck_max, + dpi_calc_dispc_cb, ctx); } static int sdi_calc_clock_div(unsigned long pclk,
@@ -183,7 +184,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)* need to care about the shadow register mechanism for pck-free. The * exact reason for this is unknown. */ -dispc_mgr_set_clock_div (sdi.output.dispc_channel, +dispc_mgr_set_clock_div (sdi.dss->dispc, sdi.output.dispc_channel, &sdi.mgr_config.clock_info);dss_sdi_init (sdi.dss, sdi.datapairs);
@@ -238,7 +239,7 @@ static int sdi_check_timings(struct omap_dss_device *dssdev, {enum omap_channel channel = dssdev->dispc_channel; -if (!dispc_mgr_timings_ok (channel, vm)) +if (!dispc_mgr_timings_ok (sdi.dss->dispc, channel, vm))return -EINVAL ;if (vm->pixelclock ==0 )
drivers/gpu/drm/omapdrm/dss/venc.c +1 -1
@@ -586,7 +586,7 @@ static void venc_set_timings(struct omap_dss_device *dssdev, venc.vm = actual_vm; -dispc_set_tv_pclk (13500000 ); +dispc_set_tv_pclk (venc.dss->dispc,13500000 );mutex_unlock (&venc.venc_lock); }
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 26/30 drm: omapdrm: dispc: Allocate the dispc private data structure dynamically
In reply to Laurent PinchartThe dispc private data structure is currently stored as a global variable. While no platform with multiple DISPC currently exists nor is planned, this doesn't comply with the kernel device model and should thus be fixed.
--- drivers/gpu/drm/omapdrm/dss/dispc.c | 1934 +++++++++++++++++++---------------- 1 file changed, 1039 insertions(+), 895 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +1039 -895
@@ -47,6 +47,8 @@#include "dss.h" #include "dispc.h" +struct dispc_device ; +/* DISPC */ #define DISPC_SZ_REGS SZ_4K
@@ -56,11 +58,12 @@ enum omap_burst_size { BURST_SIZE_X8 = 2, }; -#define REG_GET (idx, start, end) \ - FLD_GET(dispc_read_reg(idx), start, end) +#define REG_GET (dispc, idx, start, end) \ + FLD_GET(dispc_read_reg(dispc, idx), start, end) -#define REG_FLD_MOD (idx, val, start, end) \ - dispc_write_reg(idx, FLD_MOD(dispc_read_reg(idx), val, start, end)) +#define REG_FLD_MOD (dispc, idx, val, start, end) \ + dispc_write_reg(dispc, idx, \ + FLD_MOD(dispc_read_reg(dispc, idx), val, start, end))/* DISPC has feature id */ enum dispc_feature_id {
@@ -105,7 +108,8 @@ struct dispc_features {unsigned int max_downscale;unsigned int max_line_width;unsigned int min_pcd; - int (*calc_scaling) (unsigned long pclk, unsigned long lclk, + int (*calc_scaling)(struct dispc_device *dispc, + unsigned long pclk, unsigned long lclk, const struct videomode *vm, u16 width, u16 height, u16 out_width, u16 out_height, u32 fourcc, bool *five_taps,
@@ -196,8 +200,6 @@ struct dispc_device {spinlock_t control_lock; }; -static struct dispc_device dispc; -enum omap_color_component {/* used for all color formats for OMAP3 and earlier * and for RGB and Y color component on OMAP4
@@ -355,45 +357,52 @@ struct color_conv_coef {int full_range; }; -static unsigned long dispc_fclk_rate (void ); -static unsigned long dispc_core_clk_rate (void ); -static unsigned long dispc_mgr_lclk_rate (enum omap_channel channel); -static unsigned long dispc_mgr_pclk_rate (enum omap_channel channel); +static unsigned long dispc_fclk_rate (struct dispc_device *dispc); +static unsigned long dispc_core_clk_rate (struct dispc_device *dispc); +static unsigned long dispc_mgr_lclk_rate (struct dispc_device *dispc, +enum omap_channel channel); +static unsigned long dispc_mgr_pclk_rate (struct dispc_device *dispc, +enum omap_channel channel); -static unsigned long dispc_plane_pclk_rate (enum omap_plane_id plane); -static unsigned long dispc_plane_lclk_rate (enum omap_plane_id plane); +static unsigned long dispc_plane_pclk_rate (struct dispc_device *dispc, +enum omap_plane_id plane); +static unsigned long dispc_plane_lclk_rate (struct dispc_device *dispc, +enum omap_plane_id plane);static void dispc_clear_irqstatus (struct dispc_device *dispc,u32 mask); -static inline void dispc_write_reg (const u16 idx,u32 val) +static inline void dispc_write_reg (struct dispc_device *dispc,u16 idx,u32 val) { -__raw_writel (val, dispc.base + idx); +__raw_writel (val, dispc->base + idx); } -static inline u32 dispc_read_reg (const u16 idx) +static inline u32 dispc_read_reg (struct dispc_device *dispc,u16 idx) { -return __raw_readl (dispc.base + idx); +return __raw_readl (dispc->base + idx); } -static u32 mgr_fld_read (enum omap_channel channel,enum mgr_reg_fields regfld) +static u32 mgr_fld_read (struct dispc_device *dispc,enum omap_channel channel, +enum mgr_reg_fields regfld) {const struct dispc_reg_field rfld = mgr_desc[channel].reg_desc[regfld]; -return REG_GET (rfld.reg, rfld.high, rfld.low); + +return REG_GET (dispc, rfld.reg, rfld.high, rfld.low); } -static void mgr_fld_write (enum omap_channel channel, -enum mgr_reg_fields regfld,int val) { +static void mgr_fld_write (struct dispc_device *dispc,enum omap_channel channel, +enum mgr_reg_fields regfld,int val) +{const struct dispc_reg_field rfld = mgr_desc[channel].reg_desc[regfld];const bool need_lock = rfld.reg ==DISPC_CONTROL || rfld.reg ==DISPC_CONFIG ;unsigned long flags;if (need_lock) -spin_lock_irqsave (&dispc.control_lock, flags); +spin_lock_irqsave (&dispc->control_lock, flags); -REG_FLD_MOD (rfld.reg, val, rfld.high, rfld.low); +REG_FLD_MOD (dispc, rfld.reg, val, rfld.high, rfld.low);if (need_lock) -spin_unlock_irqrestore (&dispc.control_lock, flags); +spin_unlock_irqrestore (&dispc->control_lock, flags); }static int dispc_get_num_ovls (struct dispc_device *dispc)
@@ -406,255 +415,257 @@ static int dispc_get_num_mgrs(struct dispc_device *dispc)return dispc->feat->num_mgrs; } -static void dispc_get_reg_field (enum dispc_feat_reg_field id, +static void dispc_get_reg_field (struct dispc_device *dispc, +enum dispc_feat_reg_field id,u8 *start,u8 *end) { -if (id >= dispc.feat->num_reg_fields) +if (id >= dispc->feat->num_reg_fields)BUG (); - *start = dispc.feat->reg_fields[id].start; - *end = dispc.feat->reg_fields[id].end; + *start = dispc->feat->reg_fields[id].start; + *end = dispc->feat->reg_fields[id].end; } -static bool dispc_has_feature (enum dispc_feature_id id) +static bool dispc_has_feature (struct dispc_device *dispc, +enum dispc_feature_id id) {unsigned int i; -for (i =0 ; i < dispc.feat->num_features; i++) { -if (dispc.feat->features[i] == id) +for (i =0 ; i < dispc->feat->num_features; i++) { +if (dispc->feat->features[i] == id)return true; }return false; } -#define SR (reg) \ - dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg) -#define RR (reg) \ - dispc_write_reg(DISPC_##reg, dispc.ctx[DISPC_##reg / sizeof(u32)]) +#define SR (dispc, reg) \ + dispc->ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(dispc, DISPC_##reg) +#define RR (dispc, reg) \ + dispc_write_reg(dispc, DISPC_##reg, dispc->ctx[DISPC_##reg / sizeof(u32)]) -static void dispc_save_context (void ) +static void dispc_save_context (struct dispc_device *dispc) {int i, j;DSSDBG ("dispc_save_context\n" ); -SR (IRQENABLE ); -SR (CONTROL ); -SR (CONFIG ); -SR (LINE_NUMBER ); -if (dispc_has_feature (FEAT_ALPHA_FIXED_ZORDER ) || -dispc_has_feature (FEAT_ALPHA_FREE_ZORDER )) -SR (GLOBAL_ALPHA ); -if (dispc_has_feature (FEAT_MGR_LCD2 )) { -SR (CONTROL2 ); -SR (CONFIG2 ); +SR (dispc,IRQENABLE ); +SR (dispc,CONTROL ); +SR (dispc,CONFIG ); +SR (dispc,LINE_NUMBER ); +if (dispc_has_feature (dispc,FEAT_ALPHA_FIXED_ZORDER ) || +dispc_has_feature (dispc,FEAT_ALPHA_FREE_ZORDER )) +SR (dispc,GLOBAL_ALPHA ); +if (dispc_has_feature (dispc,FEAT_MGR_LCD2 )) { +SR (dispc,CONTROL2 ); +SR (dispc,CONFIG2 ); } -if (dispc_has_feature (FEAT_MGR_LCD3 )) { -SR (CONTROL3 ); -SR (CONFIG3 ); +if (dispc_has_feature (dispc,FEAT_MGR_LCD3 )) { +SR (dispc,CONTROL3 ); +SR (dispc,CONFIG3 ); } -for (i =0 ; i <dispc_get_num_mgrs (&dispc); i++) { -SR (DEFAULT_COLOR (i)); -SR (TRANS_COLOR (i)); -SR (SIZE_MGR (i)); +for (i =0 ; i <dispc_get_num_mgrs (dispc); i++) { +SR (dispc,DEFAULT_COLOR (i)); +SR (dispc,TRANS_COLOR (i)); +SR (dispc,SIZE_MGR (i));if (i ==OMAP_DSS_CHANNEL_DIGIT )continue ; -SR (TIMING_H (i)); -SR (TIMING_V (i)); -SR (POL_FREQ (i)); -SR (DIVISORo (i)); - -SR (DATA_CYCLE1 (i)); -SR (DATA_CYCLE2 (i)); -SR (DATA_CYCLE3 (i)); - -if (dispc_has_feature (FEAT_CPR )) { -SR (CPR_COEF_R (i)); -SR (CPR_COEF_G (i)); -SR (CPR_COEF_B (i)); +SR (dispc,TIMING_H (i)); +SR (dispc,TIMING_V (i)); +SR (dispc,POL_FREQ (i)); +SR (dispc,DIVISORo (i)); + +SR (dispc,DATA_CYCLE1 (i)); +SR (dispc,DATA_CYCLE2 (i)); +SR (dispc,DATA_CYCLE3 (i)); + +if (dispc_has_feature (dispc,FEAT_CPR )) { +SR (dispc,CPR_COEF_R (i)); +SR (dispc,CPR_COEF_G (i)); +SR (dispc,CPR_COEF_B (i)); } } -for (i =0 ; i <dispc_get_num_ovls (&dispc); i++) { -SR (OVL_BA0 (i)); -SR (OVL_BA1 (i)); -SR (OVL_POSITION (i)); -SR (OVL_SIZE (i)); -SR (OVL_ATTRIBUTES (i)); -SR (OVL_FIFO_THRESHOLD (i)); -SR (OVL_ROW_INC (i)); -SR (OVL_PIXEL_INC (i)); -if (dispc_has_feature (FEAT_PRELOAD )) -SR (OVL_PRELOAD (i)); +for (i =0 ; i <dispc_get_num_ovls (dispc); i++) { +SR (dispc,OVL_BA0 (i)); +SR (dispc,OVL_BA1 (i)); +SR (dispc,OVL_POSITION (i)); +SR (dispc,OVL_SIZE (i)); +SR (dispc,OVL_ATTRIBUTES (i)); +SR (dispc,OVL_FIFO_THRESHOLD (i)); +SR (dispc,OVL_ROW_INC (i)); +SR (dispc,OVL_PIXEL_INC (i)); +if (dispc_has_feature (dispc,FEAT_PRELOAD )) +SR (dispc,OVL_PRELOAD (i));if (i ==OMAP_DSS_GFX ) { -SR (OVL_WINDOW_SKIP (i)); -SR (OVL_TABLE_BA (i)); +SR (dispc,OVL_WINDOW_SKIP (i)); +SR (dispc,OVL_TABLE_BA (i));continue ; } -SR (OVL_FIR (i)); -SR (OVL_PICTURE_SIZE (i)); -SR (OVL_ACCU0 (i)); -SR (OVL_ACCU1 (i)); +SR (dispc,OVL_FIR (i)); +SR (dispc,OVL_PICTURE_SIZE (i)); +SR (dispc,OVL_ACCU0 (i)); +SR (dispc,OVL_ACCU1 (i));for (j =0 ; j <8 ; j++) -SR (OVL_FIR_COEF_H (i, j)); +SR (dispc,OVL_FIR_COEF_H (i, j));for (j =0 ; j <8 ; j++) -SR (OVL_FIR_COEF_HV (i, j)); +SR (dispc,OVL_FIR_COEF_HV (i, j));for (j =0 ; j <5 ; j++) -SR (OVL_CONV_COEF (i, j)); +SR (dispc,OVL_CONV_COEF (i, j)); -if (dispc_has_feature (FEAT_FIR_COEF_V )) { +if (dispc_has_feature (dispc,FEAT_FIR_COEF_V )) {for (j =0 ; j <8 ; j++) -SR (OVL_FIR_COEF_V (i, j)); +SR (dispc,OVL_FIR_COEF_V (i, j)); } -if (dispc_has_feature (FEAT_HANDLE_UV_SEPARATE )) { -SR (OVL_BA0_UV (i)); -SR (OVL_BA1_UV (i)); -SR (OVL_FIR2 (i)); -SR (OVL_ACCU2_0 (i)); -SR (OVL_ACCU2_1 (i)); +if (dispc_has_feature (dispc,FEAT_HANDLE_UV_SEPARATE )) { +SR (dispc,OVL_BA0_UV (i)); +SR (dispc,OVL_BA1_UV (i)); +SR (dispc,OVL_FIR2 (i)); +SR (dispc,OVL_ACCU2_0 (i)); +SR (dispc,OVL_ACCU2_1 (i));for (j =0 ; j <8 ; j++) -SR (OVL_FIR_COEF_H2 (i, j)); +SR (dispc,OVL_FIR_COEF_H2 (i, j));for (j =0 ; j <8 ; j++) -SR (OVL_FIR_COEF_HV2 (i, j)); +SR (dispc,OVL_FIR_COEF_HV2 (i, j));for (j =0 ; j <8 ; j++) -SR (OVL_FIR_COEF_V2 (i, j)); +SR (dispc,OVL_FIR_COEF_V2 (i, j)); } -if (dispc_has_feature (FEAT_ATTR2 )) -SR (OVL_ATTRIBUTES2 (i)); +if (dispc_has_feature (dispc,FEAT_ATTR2 )) +SR (dispc,OVL_ATTRIBUTES2 (i)); } -if (dispc_has_feature (FEAT_CORE_CLK_DIV )) -SR (DIVISOR ); +if (dispc_has_feature (dispc,FEAT_CORE_CLK_DIV )) +SR (dispc,DIVISOR ); - dispc.ctx_valid = true; + dispc->ctx_valid = true;DSSDBG ("context saved\n" ); } -static void dispc_restore_context (void ) +static void dispc_restore_context (struct dispc_device *dispc) {int i, j;DSSDBG ("dispc_restore_context\n" ); -if (!dispc.ctx_valid) +if (!dispc->ctx_valid)return ; -/*RR(IRQENABLE);*/ -/*RR(CONTROL);*/ -RR (CONFIG ); -RR (LINE_NUMBER ); -if (dispc_has_feature (FEAT_ALPHA_FIXED_ZORDER ) || -dispc_has_feature (FEAT_ALPHA_FREE_ZORDER )) -RR (GLOBAL_ALPHA ); -if (dispc_has_feature (FEAT_MGR_LCD2 )) -RR (CONFIG2 ); -if (dispc_has_feature (FEAT_MGR_LCD3 )) -RR (CONFIG3 ); - -for (i =0 ; i <dispc_get_num_mgrs (&dispc); i++) { -RR (DEFAULT_COLOR (i)); -RR (TRANS_COLOR (i)); -RR (SIZE_MGR (i)); +/*RR(dispc, IRQENABLE);*/ +/*RR(dispc, CONTROL);*/ +RR (dispc,CONFIG ); +RR (dispc,LINE_NUMBER ); +if (dispc_has_feature (dispc,FEAT_ALPHA_FIXED_ZORDER ) || +dispc_has_feature (dispc,FEAT_ALPHA_FREE_ZORDER )) +RR (dispc,GLOBAL_ALPHA ); +if (dispc_has_feature (dispc,FEAT_MGR_LCD2 )) +RR (dispc,CONFIG2 ); +if (dispc_has_feature (dispc,FEAT_MGR_LCD3 )) +RR (dispc,CONFIG3 ); + +for (i =0 ; i <dispc_get_num_mgrs (dispc); i++) { +RR (dispc,DEFAULT_COLOR (i)); +RR (dispc,TRANS_COLOR (i)); +RR (dispc,SIZE_MGR (i));if (i ==OMAP_DSS_CHANNEL_DIGIT )continue ; -RR (TIMING_H (i)); -RR (TIMING_V (i)); -RR (POL_FREQ (i)); -RR (DIVISORo (i)); - -RR (DATA_CYCLE1 (i)); -RR (DATA_CYCLE2 (i)); -RR (DATA_CYCLE3 (i)); - -if (dispc_has_feature (FEAT_CPR )) { -RR (CPR_COEF_R (i)); -RR (CPR_COEF_G (i)); -RR (CPR_COEF_B (i)); +RR (dispc,TIMING_H (i)); +RR (dispc,TIMING_V (i)); +RR (dispc,POL_FREQ (i)); +RR (dispc,DIVISORo (i)); + +RR (dispc,DATA_CYCLE1 (i)); +RR (dispc,DATA_CYCLE2 (i)); +RR (dispc,DATA_CYCLE3 (i)); + +if (dispc_has_feature (dispc,FEAT_CPR )) { +RR (dispc,CPR_COEF_R (i)); +RR (dispc,CPR_COEF_G (i)); +RR (dispc,CPR_COEF_B (i)); } } -for (i =0 ; i <dispc_get_num_ovls (&dispc); i++) { -RR (OVL_BA0 (i)); -RR (OVL_BA1 (i)); -RR (OVL_POSITION (i)); -RR (OVL_SIZE (i)); -RR (OVL_ATTRIBUTES (i)); -RR (OVL_FIFO_THRESHOLD (i)); -RR (OVL_ROW_INC (i)); -RR (OVL_PIXEL_INC (i)); -if (dispc_has_feature (FEAT_PRELOAD )) -RR (OVL_PRELOAD (i)); +for (i =0 ; i <dispc_get_num_ovls (dispc); i++) { +RR (dispc,OVL_BA0 (i)); +RR (dispc,OVL_BA1 (i)); +RR (dispc,OVL_POSITION (i)); +RR (dispc,OVL_SIZE (i)); +RR (dispc,OVL_ATTRIBUTES (i)); +RR (dispc,OVL_FIFO_THRESHOLD (i)); +RR (dispc,OVL_ROW_INC (i)); +RR (dispc,OVL_PIXEL_INC (i)); +if (dispc_has_feature (dispc,FEAT_PRELOAD )) +RR (dispc,OVL_PRELOAD (i));if (i ==OMAP_DSS_GFX ) { -RR (OVL_WINDOW_SKIP (i)); -RR (OVL_TABLE_BA (i)); +RR (dispc,OVL_WINDOW_SKIP (i)); +RR (dispc,OVL_TABLE_BA (i));continue ; } -RR (OVL_FIR (i)); -RR (OVL_PICTURE_SIZE (i)); -RR (OVL_ACCU0 (i)); -RR (OVL_ACCU1 (i)); +RR (dispc,OVL_FIR (i)); +RR (dispc,OVL_PICTURE_SIZE (i)); +RR (dispc,OVL_ACCU0 (i)); +RR (dispc,OVL_ACCU1 (i));for (j =0 ; j <8 ; j++) -RR (OVL_FIR_COEF_H (i, j)); +RR (dispc,OVL_FIR_COEF_H (i, j));for (j =0 ; j <8 ; j++) -RR (OVL_FIR_COEF_HV (i, j)); +RR (dispc,OVL_FIR_COEF_HV (i, j));for (j =0 ; j <5 ; j++) -RR (OVL_CONV_COEF (i, j)); +RR (dispc,OVL_CONV_COEF (i, j)); -if (dispc_has_feature (FEAT_FIR_COEF_V )) { +if (dispc_has_feature (dispc,FEAT_FIR_COEF_V )) {for (j =0 ; j <8 ; j++) -RR (OVL_FIR_COEF_V (i, j)); +RR (dispc,OVL_FIR_COEF_V (i, j)); } -if (dispc_has_feature (FEAT_HANDLE_UV_SEPARATE )) { -RR (OVL_BA0_UV (i)); -RR (OVL_BA1_UV (i)); -RR (OVL_FIR2 (i)); -RR (OVL_ACCU2_0 (i)); -RR (OVL_ACCU2_1 (i)); +if (dispc_has_feature (dispc,FEAT_HANDLE_UV_SEPARATE )) { +RR (dispc,OVL_BA0_UV (i)); +RR (dispc,OVL_BA1_UV (i)); +RR (dispc,OVL_FIR2 (i)); +RR (dispc,OVL_ACCU2_0 (i)); +RR (dispc,OVL_ACCU2_1 (i));for (j =0 ; j <8 ; j++) -RR (OVL_FIR_COEF_H2 (i, j)); +RR (dispc,OVL_FIR_COEF_H2 (i, j));for (j =0 ; j <8 ; j++) -RR (OVL_FIR_COEF_HV2 (i, j)); +RR (dispc,OVL_FIR_COEF_HV2 (i, j));for (j =0 ; j <8 ; j++) -RR (OVL_FIR_COEF_V2 (i, j)); +RR (dispc,OVL_FIR_COEF_V2 (i, j)); } -if (dispc_has_feature (FEAT_ATTR2 )) -RR (OVL_ATTRIBUTES2 (i)); +if (dispc_has_feature (dispc,FEAT_ATTR2 )) +RR (dispc,OVL_ATTRIBUTES2 (i)); } -if (dispc_has_feature (FEAT_CORE_CLK_DIV )) -RR (DIVISOR ); +if (dispc_has_feature (dispc,FEAT_CORE_CLK_DIV )) +RR (dispc,DIVISOR );/* enable last, because LCD & DIGIT enable are here */ -RR (CONTROL ); -if (dispc_has_feature (FEAT_MGR_LCD2 )) -RR (CONTROL2 ); -if (dispc_has_feature (FEAT_MGR_LCD3 )) -RR (CONTROL3 ); +RR (dispc,CONTROL ); +if (dispc_has_feature (dispc,FEAT_MGR_LCD2 )) +RR (dispc,CONTROL2 ); +if (dispc_has_feature (dispc,FEAT_MGR_LCD3 )) +RR (dispc,CONTROL3 );/* clear spurious SYNC_LOST_DIGIT interrupts */ -dispc_clear_irqstatus (&dispc,DISPC_IRQ_SYNC_LOST_DIGIT ); +dispc_clear_irqstatus (dispc,DISPC_IRQ_SYNC_LOST_DIGIT );/* * enable last so IRQs won't trigger before * the context is fully restored */ -RR (IRQENABLE ); +RR (dispc,IRQENABLE );DSSDBG ("context restored\n" ); }
@@ -712,21 +723,21 @@ u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)static void dispc_mgr_enable (struct dispc_device *dispc,enum omap_channel channel,bool enable) { -mgr_fld_write (channel,DISPC_MGR_FLD_ENABLE , enable); +mgr_fld_write (dispc, channel,DISPC_MGR_FLD_ENABLE , enable);/* flush posted write */ -mgr_fld_read (channel,DISPC_MGR_FLD_ENABLE ); +mgr_fld_read (dispc, channel,DISPC_MGR_FLD_ENABLE ); }static bool dispc_mgr_is_enabled (struct dispc_device *dispc,enum omap_channel channel) { -return !!mgr_fld_read (channel,DISPC_MGR_FLD_ENABLE ); +return !!mgr_fld_read (dispc, channel,DISPC_MGR_FLD_ENABLE ); }static bool dispc_mgr_go_busy (struct dispc_device *dispc,enum omap_channel channel) { -return mgr_fld_read (channel,DISPC_MGR_FLD_GO ) ==1 ; +return mgr_fld_read (dispc, channel,DISPC_MGR_FLD_GO ) ==1 ; }static void dispc_mgr_go (struct dispc_device *dispc,enum omap_channel channel)
@@ -736,12 +747,12 @@ static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)DSSDBG ("GO %s\n" , mgr_desc[channel].name); -mgr_fld_write (channel,DISPC_MGR_FLD_GO ,1 ); +mgr_fld_write (dispc, channel,DISPC_MGR_FLD_GO ,1 ); }bool dispc_wb_go_busy (struct dispc_device *dispc) { -return REG_GET (DISPC_CONTROL2 ,6 ,6 ) ==1 ; +return REG_GET (dispc,DISPC_CONTROL2 ,6 ,6 ) ==1 ; }void dispc_wb_go (struct dispc_device *dispc)
@@ -749,65 +760,72 @@ void dispc_wb_go(struct dispc_device *dispc)enum omap_plane_id plane =OMAP_DSS_WB ;bool enable, go; - enable =REG_GET (DISPC_OVL_ATTRIBUTES (plane),0 ,0 ) ==1 ; + enable =REG_GET (dispc,DISPC_OVL_ATTRIBUTES (plane),0 ,0 ) ==1 ;if (!enable)return ; - go =REG_GET (DISPC_CONTROL2 ,6 ,6 ) ==1 ; + go =REG_GET (dispc,DISPC_CONTROL2 ,6 ,6 ) ==1 ;if (go) {DSSERR ("GO bit not down for WB\n" );return ; } -REG_FLD_MOD (DISPC_CONTROL2 ,1 ,6 ,6 ); +REG_FLD_MOD (dispc,DISPC_CONTROL2 ,1 ,6 ,6 ); } -static void dispc_ovl_write_firh_reg (enum omap_plane_id plane,int reg, +static void dispc_ovl_write_firh_reg (struct dispc_device *dispc, +enum omap_plane_id plane,int reg,u32 value) { -dispc_write_reg (DISPC_OVL_FIR_COEF_H (plane, reg), value); +dispc_write_reg (dispc,DISPC_OVL_FIR_COEF_H (plane, reg), value); } -static void dispc_ovl_write_firhv_reg (enum omap_plane_id plane,int reg, +static void dispc_ovl_write_firhv_reg (struct dispc_device *dispc, +enum omap_plane_id plane,int reg,u32 value) { -dispc_write_reg (DISPC_OVL_FIR_COEF_HV (plane, reg), value); +dispc_write_reg (dispc,DISPC_OVL_FIR_COEF_HV (plane, reg), value); } -static void dispc_ovl_write_firv_reg (enum omap_plane_id plane,int reg, +static void dispc_ovl_write_firv_reg (struct dispc_device *dispc, +enum omap_plane_id plane,int reg,u32 value) { -dispc_write_reg (DISPC_OVL_FIR_COEF_V (plane, reg), value); +dispc_write_reg (dispc,DISPC_OVL_FIR_COEF_V (plane, reg), value); } -static void dispc_ovl_write_firh2_reg (enum omap_plane_id plane,int reg, +static void dispc_ovl_write_firh2_reg (struct dispc_device *dispc, +enum omap_plane_id plane,int reg,u32 value) {BUG_ON (plane ==OMAP_DSS_GFX ); -dispc_write_reg (DISPC_OVL_FIR_COEF_H2 (plane, reg), value); +dispc_write_reg (dispc,DISPC_OVL_FIR_COEF_H2 (plane, reg), value); } -static void dispc_ovl_write_firhv2_reg (enum omap_plane_id plane,int reg, -u32 value) +static void dispc_ovl_write_firhv2_reg (struct dispc_device *dispc, +enum omap_plane_id plane,int reg, +u32 value) {BUG_ON (plane ==OMAP_DSS_GFX ); -dispc_write_reg (DISPC_OVL_FIR_COEF_HV2 (plane, reg), value); +dispc_write_reg (dispc,DISPC_OVL_FIR_COEF_HV2 (plane, reg), value); } -static void dispc_ovl_write_firv2_reg (enum omap_plane_id plane,int reg, +static void dispc_ovl_write_firv2_reg (struct dispc_device *dispc, +enum omap_plane_id plane,int reg,u32 value) {BUG_ON (plane ==OMAP_DSS_GFX ); -dispc_write_reg (DISPC_OVL_FIR_COEF_V2 (plane, reg), value); +dispc_write_reg (dispc,DISPC_OVL_FIR_COEF_V2 (plane, reg), value); } -static void dispc_ovl_set_scale_coef (enum omap_plane_id plane,int fir_hinc, -int fir_vinc,int five_taps, -enum omap_color_component color_comp) +static void dispc_ovl_set_scale_coef (struct dispc_device *dispc, +enum omap_plane_id plane,int fir_hinc, +int fir_vinc,int five_taps, +enum omap_color_component color_comp) {const struct dispc_coef *h_coef, *v_coef;int i;
@@ -828,11 +846,11 @@ static void dispc_ovl_set_scale_coef(enum omap_plane_id plane, int fir_hinc, | FLD_VAL(v_coef[i].hc3_vc2, 31, 24);if (color_comp ==DISPC_COLOR_COMPONENT_RGB_Y ) { -dispc_ovl_write_firh_reg (plane, i, h); -dispc_ovl_write_firhv_reg (plane, i, hv); +dispc_ovl_write_firh_reg (dispc, plane, i, h); +dispc_ovl_write_firhv_reg (dispc, plane, i, hv); }else { -dispc_ovl_write_firh2_reg (plane, i, h); -dispc_ovl_write_firhv2_reg (plane, i, hv); +dispc_ovl_write_firh2_reg (dispc, plane, i, h); +dispc_ovl_write_firhv2_reg (dispc, plane, i, hv); } }
@@ -843,34 +861,35 @@ static void dispc_ovl_set_scale_coef(enum omap_plane_id plane, int fir_hinc, v =FLD_VAL (v_coef[i].hc0_vc00,7 ,0 ) |FLD_VAL (v_coef[i].hc4_vc22,15 ,8 );if (color_comp ==DISPC_COLOR_COMPONENT_RGB_Y ) -dispc_ovl_write_firv_reg (plane, i, v); +dispc_ovl_write_firv_reg (dispc, plane, i, v);else -dispc_ovl_write_firv2_reg (plane, i, v); +dispc_ovl_write_firv2_reg (dispc, plane, i, v); } } } -static void dispc_ovl_write_color_conv_coef (enum omap_plane_id plane, -const struct color_conv_coef *ct) +static void dispc_ovl_write_color_conv_coef (struct dispc_device *dispc, +enum omap_plane_id plane, +const struct color_conv_coef *ct) {#define CVAL (x, y) (FLD_VAL(x, 26, 16) | FLD_VAL(y, 10, 0)) -dispc_write_reg (DISPC_OVL_CONV_COEF (plane,0 ),CVAL (ct->rcr, ct->ry)); -dispc_write_reg (DISPC_OVL_CONV_COEF (plane,1 ),CVAL (ct->gy, ct->rcb)); -dispc_write_reg (DISPC_OVL_CONV_COEF (plane,2 ),CVAL (ct->gcb, ct->gcr)); -dispc_write_reg (DISPC_OVL_CONV_COEF (plane,3 ),CVAL (ct->bcr, ct->by)); -dispc_write_reg (DISPC_OVL_CONV_COEF (plane,4 ),CVAL (0 , ct->bcb)); +dispc_write_reg (dispc,DISPC_OVL_CONV_COEF (plane,0 ),CVAL (ct->rcr, ct->ry)); +dispc_write_reg (dispc,DISPC_OVL_CONV_COEF (plane,1 ),CVAL (ct->gy, ct->rcb)); +dispc_write_reg (dispc,DISPC_OVL_CONV_COEF (plane,2 ),CVAL (ct->gcb, ct->gcr)); +dispc_write_reg (dispc,DISPC_OVL_CONV_COEF (plane,3 ),CVAL (ct->bcr, ct->by)); +dispc_write_reg (dispc,DISPC_OVL_CONV_COEF (plane,4 ),CVAL (0 , ct->bcb)); -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), ct->full_range,11 ,11 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), ct->full_range,11 ,11 );#undef CVAL } -static void dispc_setup_color_conv_coef (void ) +static void dispc_setup_color_conv_coef (struct dispc_device *dispc) {int i; -int num_ovl =dispc_get_num_ovls (&dispc); +int num_ovl =dispc_get_num_ovls (dispc);const struct color_conv_coef ctbl_bt601_5_ovl = {/* YUV -> RGB */ 298 ,409 ,0 ,298 ,-208 ,-100 ,298 ,0 ,517 ,0 ,
@@ -881,34 +900,40 @@ static void dispc_setup_color_conv_coef(void) };for (i =1 ; i < num_ovl; i++) -dispc_ovl_write_color_conv_coef (i, &ctbl_bt601_5_ovl); +dispc_ovl_write_color_conv_coef (dispc, i, &ctbl_bt601_5_ovl); -if (dispc.feat->has_writeback) -dispc_ovl_write_color_conv_coef (OMAP_DSS_WB , &ctbl_bt601_5_wb); +if (dispc->feat->has_writeback) +dispc_ovl_write_color_conv_coef (dispc,OMAP_DSS_WB , + &ctbl_bt601_5_wb); } -static void dispc_ovl_set_ba0 (enum omap_plane_id plane,u32 paddr) +static void dispc_ovl_set_ba0 (struct dispc_device *dispc, +enum omap_plane_id plane,u32 paddr) { -dispc_write_reg (DISPC_OVL_BA0 (plane), paddr); +dispc_write_reg (dispc,DISPC_OVL_BA0 (plane), paddr); } -static void dispc_ovl_set_ba1 (enum omap_plane_id plane,u32 paddr) +static void dispc_ovl_set_ba1 (struct dispc_device *dispc, +enum omap_plane_id plane,u32 paddr) { -dispc_write_reg (DISPC_OVL_BA1 (plane), paddr); +dispc_write_reg (dispc,DISPC_OVL_BA1 (plane), paddr); } -static void dispc_ovl_set_ba0_uv (enum omap_plane_id plane,u32 paddr) +static void dispc_ovl_set_ba0_uv (struct dispc_device *dispc, +enum omap_plane_id plane,u32 paddr) { -dispc_write_reg (DISPC_OVL_BA0_UV (plane), paddr); +dispc_write_reg (dispc,DISPC_OVL_BA0_UV (plane), paddr); } -static void dispc_ovl_set_ba1_uv (enum omap_plane_id plane,u32 paddr) +static void dispc_ovl_set_ba1_uv (struct dispc_device *dispc, +enum omap_plane_id plane,u32 paddr) { -dispc_write_reg (DISPC_OVL_BA1_UV (plane), paddr); +dispc_write_reg (dispc,DISPC_OVL_BA1_UV (plane), paddr); } -static void dispc_ovl_set_pos (enum omap_plane_id plane, -enum omap_overlay_caps caps,int x,int y) +static void dispc_ovl_set_pos (struct dispc_device *dispc, +enum omap_plane_id plane, +enum omap_overlay_caps caps,int x,int y) {u32 val;
@@ -917,22 +942,24 @@ static void dispc_ovl_set_pos(enum omap_plane_id plane, val =FLD_VAL (y,26 ,16 ) |FLD_VAL (x,10 ,0 ); -dispc_write_reg (DISPC_OVL_POSITION (plane), val); +dispc_write_reg (dispc,DISPC_OVL_POSITION (plane), val); } -static void dispc_ovl_set_input_size (enum omap_plane_id plane,int width, -int height) +static void dispc_ovl_set_input_size (struct dispc_device *dispc, +enum omap_plane_id plane,int width, +int height) {u32 val =FLD_VAL (height -1 ,26 ,16 ) |FLD_VAL (width -1 ,10 ,0 );if (plane ==OMAP_DSS_GFX || plane ==OMAP_DSS_WB ) -dispc_write_reg (DISPC_OVL_SIZE (plane), val); +dispc_write_reg (dispc,DISPC_OVL_SIZE (plane), val);else -dispc_write_reg (DISPC_OVL_PICTURE_SIZE (plane), val); +dispc_write_reg (dispc,DISPC_OVL_PICTURE_SIZE (plane), val); } -static void dispc_ovl_set_output_size (enum omap_plane_id plane,int width, -int height) +static void dispc_ovl_set_output_size (struct dispc_device *dispc, +enum omap_plane_id plane,int width, +int height) {u32 val;
@@ -941,42 +968,47 @@ static void dispc_ovl_set_output_size(enum omap_plane_id plane, int width, val =FLD_VAL (height -1 ,26 ,16 ) |FLD_VAL (width -1 ,10 ,0 );if (plane ==OMAP_DSS_WB ) -dispc_write_reg (DISPC_OVL_PICTURE_SIZE (plane), val); +dispc_write_reg (dispc,DISPC_OVL_PICTURE_SIZE (plane), val);else -dispc_write_reg (DISPC_OVL_SIZE (plane), val); +dispc_write_reg (dispc,DISPC_OVL_SIZE (plane), val); } -static void dispc_ovl_set_zorder (enum omap_plane_id plane, -enum omap_overlay_caps caps,u8 zorder) +static void dispc_ovl_set_zorder (struct dispc_device *dispc, +enum omap_plane_id plane, +enum omap_overlay_caps caps,u8 zorder) {if ((caps &OMAP_DSS_OVL_CAP_ZORDER ) ==0 )return ; -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), zorder,27 ,26 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), zorder,27 ,26 ); } -static void dispc_ovl_enable_zorder_planes (void ) +static void dispc_ovl_enable_zorder_planes (struct dispc_device *dispc) {int i; -if (!dispc_has_feature (FEAT_ALPHA_FREE_ZORDER )) +if (!dispc_has_feature (dispc,FEAT_ALPHA_FREE_ZORDER ))return ; -for (i =0 ; i <dispc_get_num_ovls (&dispc); i++) -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (i),1 ,25 ,25 ); +for (i =0 ; i <dispc_get_num_ovls (dispc); i++) +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (i),1 ,25 ,25 ); } -static void dispc_ovl_set_pre_mult_alpha (enum omap_plane_id plane, -enum omap_overlay_caps caps,bool enable) +static void dispc_ovl_set_pre_mult_alpha (struct dispc_device *dispc, +enum omap_plane_id plane, +enum omap_overlay_caps caps, +bool enable) {if ((caps &OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA ) ==0 )return ; -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), enable ?1 :0 ,28 ,28 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), enable ?1 :0 ,28 ,28 ); } -static void dispc_ovl_setup_global_alpha (enum omap_plane_id plane, -enum omap_overlay_caps caps,u8 global_alpha) +static void dispc_ovl_setup_global_alpha (struct dispc_device *dispc, +enum omap_plane_id plane, +enum omap_overlay_caps caps, +u8 global_alpha) {static const unsigned int shifts[] = {0 ,8 ,16 ,24 , };int shift;
@@ -985,20 +1017,23 @@ static void dispc_ovl_setup_global_alpha(enum omap_plane_id plane,return ; shift = shifts[plane]; -REG_FLD_MOD (DISPC_GLOBAL_ALPHA , global_alpha, shift +7 , shift); +REG_FLD_MOD (dispc,DISPC_GLOBAL_ALPHA , global_alpha, shift +7 , shift); } -static void dispc_ovl_set_pix_inc (enum omap_plane_id plane,s32 inc) +static void dispc_ovl_set_pix_inc (struct dispc_device *dispc, +enum omap_plane_id plane,s32 inc) { -dispc_write_reg (DISPC_OVL_PIXEL_INC (plane), inc); +dispc_write_reg (dispc,DISPC_OVL_PIXEL_INC (plane), inc); } -static void dispc_ovl_set_row_inc (enum omap_plane_id plane,s32 inc) +static void dispc_ovl_set_row_inc (struct dispc_device *dispc, +enum omap_plane_id plane,s32 inc) { -dispc_write_reg (DISPC_OVL_ROW_INC (plane), inc); +dispc_write_reg (dispc,DISPC_OVL_ROW_INC (plane), inc); } -static void dispc_ovl_set_color_mode (enum omap_plane_id plane,u32 fourcc) +static void dispc_ovl_set_color_mode (struct dispc_device *dispc, +enum omap_plane_id plane,u32 fourcc) {u32 m =0 ;if (plane !=OMAP_DSS_GFX ) {
@@ -1067,7 +1102,7 @@ static void dispc_ovl_set_color_mode(enum omap_plane_id plane, u32 fourcc) } } -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), m,4 ,1 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), m,4 ,1 ); }static bool format_is_yuv (u32 fourcc)
@@ -1082,19 +1117,21 @@ static bool format_is_yuv(u32 fourcc) } } -static void dispc_ovl_configure_burst_type (enum omap_plane_id plane, -enum omap_dss_rotation_type rotation_type) +static void dispc_ovl_configure_burst_type (struct dispc_device *dispc, +enum omap_plane_id plane, +enum omap_dss_rotation_type rotation) { -if (dispc_has_feature (FEAT_BURST_2D ) ==0 ) +if (dispc_has_feature (dispc,FEAT_BURST_2D ) ==0 )return ; -if (rotation_type ==OMAP_DSS_ROT_TILER ) -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane),1 ,29 ,29 ); +if (rotation ==OMAP_DSS_ROT_TILER ) +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane),1 ,29 ,29 );else -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane),0 ,29 ,29 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane),0 ,29 ,29 ); } -static void dispc_ovl_set_channel_out (enum omap_plane_id plane, +static void dispc_ovl_set_channel_out (struct dispc_device *dispc, +enum omap_plane_id plane,enum omap_channel channel) {int shift;
@@ -1115,8 +1152,8 @@ static void dispc_ovl_set_channel_out(enum omap_plane_id plane,return ; } - val =dispc_read_reg (DISPC_OVL_ATTRIBUTES (plane)); -if (dispc_has_feature (FEAT_MGR_LCD2 )) { + val =dispc_read_reg (dispc,DISPC_OVL_ATTRIBUTES (plane)); +if (dispc_has_feature (dispc,FEAT_MGR_LCD2 )) {switch (channel) {case OMAP_DSS_CHANNEL_LCD : chan =0 ;
@@ -1131,7 +1168,7 @@ static void dispc_ovl_set_channel_out(enum omap_plane_id plane, chan2 =1 ;break ;case OMAP_DSS_CHANNEL_LCD3 : -if (dispc_has_feature (FEAT_MGR_LCD3 )) { +if (dispc_has_feature (dispc,FEAT_MGR_LCD3 )) { chan =0 ; chan2 =2 ; }else {
@@ -1153,10 +1190,11 @@ static void dispc_ovl_set_channel_out(enum omap_plane_id plane, }else { val =FLD_MOD (val, channel, shift, shift); } -dispc_write_reg (DISPC_OVL_ATTRIBUTES (plane), val); +dispc_write_reg (dispc,DISPC_OVL_ATTRIBUTES (plane), val); } -static enum omap_channel dispc_ovl_get_channel_out (enum omap_plane_id plane) +static enum omap_channel dispc_ovl_get_channel_out (struct dispc_device *dispc, +enum omap_plane_id plane) {int shift;u32 val;
@@ -1175,12 +1213,12 @@ static enum omap_channel dispc_ovl_get_channel_out(enum omap_plane_id plane)return 0 ; } - val =dispc_read_reg (DISPC_OVL_ATTRIBUTES (plane)); + val =dispc_read_reg (dispc,DISPC_OVL_ATTRIBUTES (plane));if (FLD_GET (val, shift, shift) ==1 )return OMAP_DSS_CHANNEL_DIGIT ; -if (!dispc_has_feature (FEAT_MGR_LCD2 )) +if (!dispc_has_feature (dispc,FEAT_MGR_LCD2 ))return OMAP_DSS_CHANNEL_LCD ;switch (FLD_GET (val,31 ,30 )) {
@@ -1201,43 +1239,47 @@ void dispc_wb_set_channel_in(struct dispc_device *dispc, {enum omap_plane_id plane =OMAP_DSS_WB ; -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), channel,18 ,16 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), channel,18 ,16 ); } -static void dispc_ovl_set_burst_size (enum omap_plane_id plane, -enum omap_burst_size burst_size) +static void dispc_ovl_set_burst_size (struct dispc_device *dispc, +enum omap_plane_id plane, +enum omap_burst_size burst_size) {static const unsigned int shifts[] = {6 ,14 ,14 ,14 ,14 , };int shift; shift = shifts[plane]; -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), burst_size, shift +1 , shift); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), burst_size, + shift +1 , shift); } -static void dispc_configure_burst_sizes (void ) +static void dispc_configure_burst_sizes (struct dispc_device *dispc) {int i;const int burst_size =BURST_SIZE_X8 ;/* Configure burst size always to maximum size */ -for (i =0 ; i <dispc_get_num_ovls (&dispc); ++i) -dispc_ovl_set_burst_size (i, burst_size); -if (dispc.feat->has_writeback) -dispc_ovl_set_burst_size (OMAP_DSS_WB , burst_size); +for (i =0 ; i <dispc_get_num_ovls (dispc); ++i) +dispc_ovl_set_burst_size (dispc, i, burst_size); +if (dispc->feat->has_writeback) +dispc_ovl_set_burst_size (dispc,OMAP_DSS_WB , burst_size); } -static u32 dispc_ovl_get_burst_size (enum omap_plane_id plane) +static u32 dispc_ovl_get_burst_size (struct dispc_device *dispc, +enum omap_plane_id plane) {/* burst multiplier is always x8 (see dispc_configure_burst_sizes()) */ -return dispc.feat->burst_size_unit *8 ; +return dispc->feat->burst_size_unit *8 ; } -static bool dispc_ovl_color_mode_supported (enum omap_plane_id plane,u32 fourcc) +static bool dispc_ovl_color_mode_supported (struct dispc_device *dispc, +enum omap_plane_id plane,u32 fourcc) {const u32 *modes;unsigned int i; - modes = dispc.feat->supported_color_modes[plane]; + modes = dispc->feat->supported_color_modes[plane];for (i =0 ; modes[i]; ++i) {if (modes[i] == fourcc)
@@ -1253,16 +1295,18 @@ static const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,return dispc->feat->supported_color_modes[plane]; } -static void dispc_mgr_enable_cpr (enum omap_channel channel,bool enable) +static void dispc_mgr_enable_cpr (struct dispc_device *dispc, +enum omap_channel channel,bool enable) {if (channel ==OMAP_DSS_CHANNEL_DIGIT )return ; -mgr_fld_write (channel,DISPC_MGR_FLD_CPR , enable); +mgr_fld_write (dispc, channel,DISPC_MGR_FLD_CPR , enable); } -static void dispc_mgr_set_cpr_coef (enum omap_channel channel, -const struct omap_dss_cpr_coefs *coefs) +static void dispc_mgr_set_cpr_coef (struct dispc_device *dispc, +enum omap_channel channel, +const struct omap_dss_cpr_coefs *coefs) {u32 coef_r, coef_g, coef_b;
@@ -1276,25 +1320,27 @@ static void dispc_mgr_set_cpr_coef(enum omap_channel channel, coef_b =FLD_VAL (coefs->br,31 ,22 ) |FLD_VAL (coefs->bg,20 ,11 ) |FLD_VAL (coefs->bb,9 ,0 ); -dispc_write_reg (DISPC_CPR_COEF_R (channel), coef_r); -dispc_write_reg (DISPC_CPR_COEF_G (channel), coef_g); -dispc_write_reg (DISPC_CPR_COEF_B (channel), coef_b); +dispc_write_reg (dispc,DISPC_CPR_COEF_R (channel), coef_r); +dispc_write_reg (dispc,DISPC_CPR_COEF_G (channel), coef_g); +dispc_write_reg (dispc,DISPC_CPR_COEF_B (channel), coef_b); } -static void dispc_ovl_set_vid_color_conv (enum omap_plane_id plane, -bool enable) +static void dispc_ovl_set_vid_color_conv (struct dispc_device *dispc, +enum omap_plane_id plane,bool enable) {u32 val;BUG_ON (plane ==OMAP_DSS_GFX ); - val =dispc_read_reg (DISPC_OVL_ATTRIBUTES (plane)); + val =dispc_read_reg (dispc,DISPC_OVL_ATTRIBUTES (plane)); val =FLD_MOD (val, enable,9 ,9 ); -dispc_write_reg (DISPC_OVL_ATTRIBUTES (plane), val); +dispc_write_reg (dispc,DISPC_OVL_ATTRIBUTES (plane), val); } -static void dispc_ovl_enable_replication (enum omap_plane_id plane, -enum omap_overlay_caps caps,bool enable) +static void dispc_ovl_enable_replication (struct dispc_device *dispc, +enum omap_plane_id plane, +enum omap_overlay_caps caps, +bool enable) {static const unsigned int shifts[] = {5 ,10 ,10 ,10 };int shift;
@@ -1303,21 +1349,21 @@ static void dispc_ovl_enable_replication(enum omap_plane_id plane,return ; shift = shifts[plane]; -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), enable, shift, shift); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), enable, shift, shift); } -static void dispc_mgr_set_size (enum omap_channel channel,u16 width, -u16 height) +static void dispc_mgr_set_size (struct dispc_device *dispc, +enum omap_channel channel,u16 width,u16 height) {u32 val; - val =FLD_VAL (height -1 , dispc.feat->mgr_height_start,16 ) | -FLD_VAL (width -1 , dispc.feat->mgr_width_start,0 ); + val =FLD_VAL (height -1 , dispc->feat->mgr_height_start,16 ) | +FLD_VAL (width -1 , dispc->feat->mgr_width_start,0 ); -dispc_write_reg (DISPC_SIZE_MGR (channel), val); +dispc_write_reg (dispc,DISPC_SIZE_MGR (channel), val); } -static void dispc_init_fifos (void ) +static void dispc_init_fifos (struct dispc_device *dispc) {u32 size;int fifo;
@@ -1325,20 +1371,21 @@ static void dispc_init_fifos(void)u32 unit;int i; - unit = dispc.feat->buffer_size_unit; + unit = dispc->feat->buffer_size_unit; -dispc_get_reg_field (FEAT_REG_FIFOSIZE , &start, &end); +dispc_get_reg_field (dispc,FEAT_REG_FIFOSIZE , &start, &end); -for (fifo =0 ; fifo < dispc.feat->num_fifos; ++fifo) { - size =REG_GET (DISPC_OVL_FIFO_SIZE_STATUS (fifo), start, end); +for (fifo =0 ; fifo < dispc->feat->num_fifos; ++fifo) { + size =REG_GET (dispc,DISPC_OVL_FIFO_SIZE_STATUS (fifo), + start, end); size *= unit; - dispc.fifo_size[fifo] = size; + dispc->fifo_size[fifo] = size;/* * By default fifos are mapped directly to overlays, fifo 0 to * ovl 0, fifo 1 to ovl 1, etc. */ - dispc.fifo_assignment[fifo] = fifo; + dispc->fifo_assignment[fifo] = fifo; }/*
@@ -1348,57 +1395,58 @@ static void dispc_init_fifos(void)* giving GFX plane a larger fifo. WB but should work fine with a * smaller fifo. */ -if (dispc.feat->gfx_fifo_workaround) { +if (dispc->feat->gfx_fifo_workaround) {u32 v; - v =dispc_read_reg (DISPC_GLOBAL_BUFFER ); + v =dispc_read_reg (dispc,DISPC_GLOBAL_BUFFER ); v =FLD_MOD (v,4 ,2 ,0 );/* GFX BUF top to WB */ v =FLD_MOD (v,4 ,5 ,3 );/* GFX BUF bottom to WB */ v =FLD_MOD (v,0 ,26 ,24 );/* WB BUF top to GFX */ v =FLD_MOD (v,0 ,29 ,27 );/* WB BUF bottom to GFX */ -dispc_write_reg (DISPC_GLOBAL_BUFFER , v); +dispc_write_reg (dispc,DISPC_GLOBAL_BUFFER , v); - dispc.fifo_assignment[OMAP_DSS_GFX ] =OMAP_DSS_WB ; - dispc.fifo_assignment[OMAP_DSS_WB ] =OMAP_DSS_GFX ; + dispc->fifo_assignment[OMAP_DSS_GFX ] =OMAP_DSS_WB ; + dispc->fifo_assignment[OMAP_DSS_WB ] =OMAP_DSS_GFX ; }/* * Setup default fifo thresholds. */ -for (i =0 ; i <dispc_get_num_ovls (&dispc); ++i) { +for (i =0 ; i <dispc_get_num_ovls (dispc); ++i) {u32 low, high;const bool use_fifomerge = false;const bool manual_update = false; -dispc_ovl_compute_fifo_thresholds (&dispc, i, &low, &high, - use_fifomerge, manual_update); +dispc_ovl_compute_fifo_thresholds (dispc, i, &low, &high, + use_fifomerge, manual_update); -dispc_ovl_set_fifo_threshold (&dispc, i, low, high); +dispc_ovl_set_fifo_threshold (dispc, i, low, high); } -if (dispc.feat->has_writeback) { +if (dispc->feat->has_writeback) {u32 low, high;const bool use_fifomerge = false;const bool manual_update = false; -dispc_ovl_compute_fifo_thresholds (&dispc,OMAP_DSS_WB , - &low, &high, - use_fifomerge, manual_update); +dispc_ovl_compute_fifo_thresholds (dispc,OMAP_DSS_WB , + &low, &high, use_fifomerge, + manual_update); -dispc_ovl_set_fifo_threshold (&dispc,OMAP_DSS_WB , low, high); +dispc_ovl_set_fifo_threshold (dispc,OMAP_DSS_WB , low, high); } } -static u32 dispc_ovl_get_fifo_size (enum omap_plane_id plane) +static u32 dispc_ovl_get_fifo_size (struct dispc_device *dispc, +enum omap_plane_id plane) {int fifo;u32 size =0 ; -for (fifo =0 ; fifo < dispc.feat->num_fifos; ++fifo) { -if (dispc.fifo_assignment[fifo] == plane) - size += dispc.fifo_size[fifo]; +for (fifo =0 ; fifo < dispc->feat->num_fifos; ++fifo) { +if (dispc->fifo_assignment[fifo] == plane) + size += dispc->fifo_size[fifo]; }return size;
@@ -1419,18 +1467,20 @@ void dispc_ovl_set_fifo_threshold(struct dispc_device *dispc, low /= unit; high /= unit; -dispc_get_reg_field (FEAT_REG_FIFOHIGHTHRESHOLD , &hi_start, &hi_end); -dispc_get_reg_field (FEAT_REG_FIFOLOWTHRESHOLD , &lo_start, &lo_end); +dispc_get_reg_field (dispc,FEAT_REG_FIFOHIGHTHRESHOLD , + &hi_start, &hi_end); +dispc_get_reg_field (dispc,FEAT_REG_FIFOLOWTHRESHOLD , + &lo_start, &lo_end);DSSDBG ("fifo(%d) threshold (bytes), old %u/%u, new %u/%u\n" , plane, -REG_GET (DISPC_OVL_FIFO_THRESHOLD (plane), +REG_GET (dispc,DISPC_OVL_FIFO_THRESHOLD (plane), lo_start, lo_end) * unit, -REG_GET (DISPC_OVL_FIFO_THRESHOLD (plane), +REG_GET (dispc,DISPC_OVL_FIFO_THRESHOLD (plane), hi_start, hi_end) * unit, low * unit, high * unit); -dispc_write_reg (DISPC_OVL_FIFO_THRESHOLD (plane), +dispc_write_reg (dispc,DISPC_OVL_FIFO_THRESHOLD (plane),FLD_VAL (high, hi_start, hi_end) |FLD_VAL (low, lo_start, lo_end));
@@ -1439,20 +1489,21 @@ void dispc_ovl_set_fifo_threshold(struct dispc_device *dispc,* large for the preload field, set the threshold to the maximum value * that can be held by the preload register */ -if (dispc_has_feature (FEAT_PRELOAD ) && dispc->feat->set_max_preload && - plane !=OMAP_DSS_WB ) -dispc_write_reg (DISPC_OVL_PRELOAD (plane),min (high,0xfffu )); +if (dispc_has_feature (dispc,FEAT_PRELOAD ) && + dispc->feat->set_max_preload && plane !=OMAP_DSS_WB ) +dispc_write_reg (dispc,DISPC_OVL_PRELOAD (plane), +min (high,0xfffu )); }void dispc_enable_fifomerge (struct dispc_device *dispc,bool enable) { -if (!dispc_has_feature (FEAT_FIFO_MERGE )) { +if (!dispc_has_feature (dispc,FEAT_FIFO_MERGE )) {WARN_ON (enable);return ; }DSSDBG ("FIFO merge %s\n" , enable ?"enabled" :"disabled" ); -REG_FLD_MOD (DISPC_CONFIG , enable ?1 :0 ,14 ,14 ); +REG_FLD_MOD (dispc,DISPC_CONFIG , enable ?1 :0 ,14 ,14 ); } void dispc_ovl_compute_fifo_thresholds(struct dispc_device *dispc,
@@ -1468,13 +1519,13 @@ void dispc_ovl_compute_fifo_thresholds(struct dispc_device *dispc,unsigned int ovl_fifo_size, total_fifo_size, burst_size;int i; - burst_size =dispc_ovl_get_burst_size (plane); - ovl_fifo_size =dispc_ovl_get_fifo_size (plane); + burst_size =dispc_ovl_get_burst_size (dispc, plane); + ovl_fifo_size =dispc_ovl_get_fifo_size (dispc, plane);if (use_fifomerge) { total_fifo_size =0 ;for (i =0 ; i <dispc_get_num_ovls (dispc); ++i) - total_fifo_size +=dispc_ovl_get_fifo_size (i); + total_fifo_size +=dispc_ovl_get_fifo_size (dispc, i); }else { total_fifo_size = ovl_fifo_size; }
@@ -1485,7 +1536,7 @@ void dispc_ovl_compute_fifo_thresholds(struct dispc_device *dispc,* combined fifo size */ -if (manual_update &&dispc_has_feature (FEAT_OMAP3_DSI_FIFO_BUG )) { +if (manual_update &&dispc_has_feature (dispc,FEAT_OMAP3_DSI_FIFO_BUG )) { *fifo_low = ovl_fifo_size - burst_size *2 ; *fifo_high = total_fifo_size - burst_size; }else if (plane ==OMAP_DSS_WB ) {
@@ -1502,7 +1553,8 @@ void dispc_ovl_compute_fifo_thresholds(struct dispc_device *dispc, } } -static void dispc_ovl_set_mflag (enum omap_plane_id plane,bool enable) +static void dispc_ovl_set_mflag (struct dispc_device *dispc, +enum omap_plane_id plane,bool enable) {int bit;
@@ -1511,17 +1563,18 @@ static void dispc_ovl_set_mflag(enum omap_plane_id plane, bool enable)else bit =23 ; -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), enable, bit, bit); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), enable, bit, bit); } -static void dispc_ovl_set_mflag_threshold (enum omap_plane_id plane, -int low,int high) +static void dispc_ovl_set_mflag_threshold (struct dispc_device *dispc, +enum omap_plane_id plane, +int low,int high) { -dispc_write_reg (DISPC_OVL_MFLAG_THRESHOLD (plane), +dispc_write_reg (dispc,DISPC_OVL_MFLAG_THRESHOLD (plane),FLD_VAL (high,31 ,16 ) |FLD_VAL (low,15 ,0 )); } -static void dispc_init_mflag (void ) +static void dispc_init_mflag (struct dispc_device *dispc) {int i;
@@ -1535,16 +1588,16 @@ static void dispc_init_mflag(void)* * As a work-around, set force MFLAG to always on. */ -dispc_write_reg (DISPC_GLOBAL_MFLAG_ATTRIBUTE , +dispc_write_reg (dispc,DISPC_GLOBAL_MFLAG_ATTRIBUTE , (1 <<0 ) |/* MFLAG_CTRL = force always on */ (0 <<2 ));/* MFLAG_START = disable */ -for (i =0 ; i <dispc_get_num_ovls (&dispc); ++i) { -u32 size =dispc_ovl_get_fifo_size (i); -u32 unit = dispc.feat->buffer_size_unit; +for (i =0 ; i <dispc_get_num_ovls (dispc); ++i) { +u32 size =dispc_ovl_get_fifo_size (dispc, i); +u32 unit = dispc->feat->buffer_size_unit;u32 low, high; -dispc_ovl_set_mflag (i, true); +dispc_ovl_set_mflag (dispc, i, true);/* * Simulation team suggests below thesholds:
@@ -1555,15 +1608,15 @@ static void dispc_init_mflag(void) low = size *4 /8 / unit; high = size *5 /8 / unit; -dispc_ovl_set_mflag_threshold (i, low, high); +dispc_ovl_set_mflag_threshold (dispc, i, low, high); } -if (dispc.feat->has_writeback) { -u32 size =dispc_ovl_get_fifo_size (OMAP_DSS_WB ); -u32 unit = dispc.feat->buffer_size_unit; +if (dispc->feat->has_writeback) { +u32 size =dispc_ovl_get_fifo_size (dispc,OMAP_DSS_WB ); +u32 unit = dispc->feat->buffer_size_unit;u32 low, high; -dispc_ovl_set_mflag (OMAP_DSS_WB , true); +dispc_ovl_set_mflag (dispc,OMAP_DSS_WB , true);/* * Simulation team suggests below thesholds:
@@ -1574,98 +1627,112 @@ static void dispc_init_mflag(void) low = size *4 /8 / unit; high = size *5 /8 / unit; -dispc_ovl_set_mflag_threshold (OMAP_DSS_WB , low, high); +dispc_ovl_set_mflag_threshold (dispc,OMAP_DSS_WB , low, high); } } -static void dispc_ovl_set_fir (enum omap_plane_id plane, -int hinc,int vinc, -enum omap_color_component color_comp) +static void dispc_ovl_set_fir (struct dispc_device *dispc, +enum omap_plane_id plane, +int hinc,int vinc, +enum omap_color_component color_comp) {u32 val;if (color_comp ==DISPC_COLOR_COMPONENT_RGB_Y ) {u8 hinc_start, hinc_end, vinc_start, vinc_end; -dispc_get_reg_field (FEAT_REG_FIRHINC , &hinc_start, &hinc_end); -dispc_get_reg_field (FEAT_REG_FIRVINC , &vinc_start, &vinc_end); +dispc_get_reg_field (dispc,FEAT_REG_FIRHINC , + &hinc_start, &hinc_end); +dispc_get_reg_field (dispc,FEAT_REG_FIRVINC , + &vinc_start, &vinc_end); val =FLD_VAL (vinc, vinc_start, vinc_end) |FLD_VAL (hinc, hinc_start, hinc_end); -dispc_write_reg (DISPC_OVL_FIR (plane), val); +dispc_write_reg (dispc,DISPC_OVL_FIR (plane), val); }else { val =FLD_VAL (vinc,28 ,16 ) |FLD_VAL (hinc,12 ,0 ); -dispc_write_reg (DISPC_OVL_FIR2 (plane), val); +dispc_write_reg (dispc,DISPC_OVL_FIR2 (plane), val); } } -static void dispc_ovl_set_vid_accu0 (enum omap_plane_id plane,int haccu, +static void dispc_ovl_set_vid_accu0 (struct dispc_device *dispc, +enum omap_plane_id plane,int haccu,int vaccu) {u32 val;u8 hor_start, hor_end, vert_start, vert_end; -dispc_get_reg_field (FEAT_REG_HORIZONTALACCU , &hor_start, &hor_end); -dispc_get_reg_field (FEAT_REG_VERTICALACCU , &vert_start, &vert_end); +dispc_get_reg_field (dispc,FEAT_REG_HORIZONTALACCU , + &hor_start, &hor_end); +dispc_get_reg_field (dispc,FEAT_REG_VERTICALACCU , + &vert_start, &vert_end); val =FLD_VAL (vaccu, vert_start, vert_end) |FLD_VAL (haccu, hor_start, hor_end); -dispc_write_reg (DISPC_OVL_ACCU0 (plane), val); +dispc_write_reg (dispc,DISPC_OVL_ACCU0 (plane), val); } -static void dispc_ovl_set_vid_accu1 (enum omap_plane_id plane,int haccu, +static void dispc_ovl_set_vid_accu1 (struct dispc_device *dispc, +enum omap_plane_id plane,int haccu,int vaccu) {u32 val;u8 hor_start, hor_end, vert_start, vert_end; -dispc_get_reg_field (FEAT_REG_HORIZONTALACCU , &hor_start, &hor_end); -dispc_get_reg_field (FEAT_REG_VERTICALACCU , &vert_start, &vert_end); +dispc_get_reg_field (dispc,FEAT_REG_HORIZONTALACCU , + &hor_start, &hor_end); +dispc_get_reg_field (dispc,FEAT_REG_VERTICALACCU , + &vert_start, &vert_end); val =FLD_VAL (vaccu, vert_start, vert_end) |FLD_VAL (haccu, hor_start, hor_end); -dispc_write_reg (DISPC_OVL_ACCU1 (plane), val); +dispc_write_reg (dispc,DISPC_OVL_ACCU1 (plane), val); } -static void dispc_ovl_set_vid_accu2_0 (enum omap_plane_id plane,int haccu, -int vaccu) +static void dispc_ovl_set_vid_accu2_0 (struct dispc_device *dispc, +enum omap_plane_id plane,int haccu, +int vaccu) {u32 val; val =FLD_VAL (vaccu,26 ,16 ) |FLD_VAL (haccu,10 ,0 ); -dispc_write_reg (DISPC_OVL_ACCU2_0 (plane), val); +dispc_write_reg (dispc,DISPC_OVL_ACCU2_0 (plane), val); } -static void dispc_ovl_set_vid_accu2_1 (enum omap_plane_id plane,int haccu, -int vaccu) +static void dispc_ovl_set_vid_accu2_1 (struct dispc_device *dispc, +enum omap_plane_id plane,int haccu, +int vaccu) {u32 val; val =FLD_VAL (vaccu,26 ,16 ) |FLD_VAL (haccu,10 ,0 ); -dispc_write_reg (DISPC_OVL_ACCU2_1 (plane), val); +dispc_write_reg (dispc,DISPC_OVL_ACCU2_1 (plane), val); } -static void dispc_ovl_set_scale_param (enum omap_plane_id plane, -u16 orig_width,u16 orig_height, -u16 out_width,u16 out_height, -bool five_taps,u8 rotation, -enum omap_color_component color_comp) +static void dispc_ovl_set_scale_param (struct dispc_device *dispc, +enum omap_plane_id plane, +u16 orig_width,u16 orig_height, +u16 out_width,u16 out_height, +bool five_taps,u8 rotation, +enum omap_color_component color_comp) {int fir_hinc, fir_vinc; fir_hinc =1024 * orig_width / out_width; fir_vinc =1024 * orig_height / out_height; -dispc_ovl_set_scale_coef (plane, fir_hinc, fir_vinc, five_taps, - color_comp); -dispc_ovl_set_fir (plane, fir_hinc, fir_vinc, color_comp); +dispc_ovl_set_scale_coef (dispc, plane, fir_hinc, fir_vinc, five_taps, + color_comp); +dispc_ovl_set_fir (dispc, plane, fir_hinc, fir_vinc, color_comp); } -static void dispc_ovl_set_accu_uv (enum omap_plane_id plane, -u16 orig_width,u16 orig_height,u16 out_width,u16 out_height, -bool ilace,u32 fourcc,u8 rotation) +static void dispc_ovl_set_accu_uv (struct dispc_device *dispc, +enum omap_plane_id plane, +u16 orig_width,u16 orig_height, +u16 out_width,u16 out_height, +bool ilace,u32 fourcc,u8 rotation) {int h_accu2_0, h_accu2_1;int v_accu2_0, v_accu2_1;
@@ -1746,25 +1813,26 @@ static void dispc_ovl_set_accu_uv(enum omap_plane_id plane, v_accu2_0 = (accu_val->v0_m * chroma_vinc / accu_val->v0_n) %1024 ; v_accu2_1 = (accu_val->v1_m * chroma_vinc / accu_val->v1_n) %1024 ; -dispc_ovl_set_vid_accu2_0 (plane, h_accu2_0, v_accu2_0); -dispc_ovl_set_vid_accu2_1 (plane, h_accu2_1, v_accu2_1); +dispc_ovl_set_vid_accu2_0 (dispc, plane, h_accu2_0, v_accu2_0); +dispc_ovl_set_vid_accu2_1 (dispc, plane, h_accu2_1, v_accu2_1); } -static void dispc_ovl_set_scaling_common (enum omap_plane_id plane, -u16 orig_width,u16 orig_height, -u16 out_width,u16 out_height, -bool ilace,bool five_taps, -bool fieldmode,u32 fourcc, -u8 rotation) +static void dispc_ovl_set_scaling_common (struct dispc_device *dispc, +enum omap_plane_id plane, +u16 orig_width,u16 orig_height, +u16 out_width,u16 out_height, +bool ilace,bool five_taps, +bool fieldmode,u32 fourcc, +u8 rotation) {int accu0 =0 ;int accu1 =0 ;u32 l; -dispc_ovl_set_scale_param (plane, orig_width, orig_height, - out_width, out_height, five_taps, - rotation,DISPC_COLOR_COMPONENT_RGB_Y ); - l =dispc_read_reg (DISPC_OVL_ATTRIBUTES (plane)); +dispc_ovl_set_scale_param (dispc, plane, orig_width, orig_height, + out_width, out_height, five_taps, + rotation,DISPC_COLOR_COMPONENT_RGB_Y ); + l =dispc_read_reg (dispc,DISPC_OVL_ATTRIBUTES (plane));/* RESIZEENABLE and VERTICALTAPS */ l &= ~((0x3 <<5 ) | (0x1 <<21 ));
@@ -1773,19 +1841,19 @@ static void dispc_ovl_set_scaling_common(enum omap_plane_id plane, l |= five_taps ? (1 <<21 ) :0 ;/* VRESIZECONF and HRESIZECONF */ -if (dispc_has_feature (FEAT_RESIZECONF )) { +if (dispc_has_feature (dispc,FEAT_RESIZECONF )) { l &= ~(0x3 <<7 ); l |= (orig_width <= out_width) ?0 : (1 <<7 ); l |= (orig_height <= out_height) ?0 : (1 <<8 ); }/* LINEBUFFERSPLIT */ -if (dispc_has_feature (FEAT_LINEBUFFERSPLIT )) { +if (dispc_has_feature (dispc,FEAT_LINEBUFFERSPLIT )) { l &= ~(0x1 <<22 ); l |= five_taps ? (1 <<22 ) :0 ; } -dispc_write_reg (DISPC_OVL_ATTRIBUTES (plane), l); +dispc_write_reg (dispc,DISPC_OVL_ATTRIBUTES (plane), l);/* * field 0 = even field = bottom field
@@ -1800,33 +1868,35 @@ static void dispc_ovl_set_scaling_common(enum omap_plane_id plane, } } -dispc_ovl_set_vid_accu0 (plane,0 , accu0); -dispc_ovl_set_vid_accu1 (plane,0 , accu1); +dispc_ovl_set_vid_accu0 (dispc, plane,0 , accu0); +dispc_ovl_set_vid_accu1 (dispc, plane,0 , accu1); } -static void dispc_ovl_set_scaling_uv (enum omap_plane_id plane, -u16 orig_width,u16 orig_height, -u16 out_width,u16 out_height, -bool ilace,bool five_taps, -bool fieldmode,u32 fourcc, -u8 rotation) +static void dispc_ovl_set_scaling_uv (struct dispc_device *dispc, +enum omap_plane_id plane, +u16 orig_width,u16 orig_height, +u16 out_width,u16 out_height, +bool ilace,bool five_taps, +bool fieldmode,u32 fourcc, +u8 rotation) {int scale_x = out_width != orig_width;int scale_y = out_height != orig_height;bool chroma_upscale = plane !=OMAP_DSS_WB ; -if (!dispc_has_feature (FEAT_HANDLE_UV_SEPARATE )) +if (!dispc_has_feature (dispc,FEAT_HANDLE_UV_SEPARATE ))return ;if (!format_is_yuv (fourcc)) {/* reset chroma resampling for RGB formats */ if (plane !=OMAP_DSS_WB ) -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES2 (plane),0 ,8 ,8 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES2 (plane), +0 ,8 ,8 );return ; } -dispc_ovl_set_accu_uv (plane, orig_width, orig_height, out_width, - out_height, ilace, fourcc, rotation); +dispc_ovl_set_accu_uv (dispc, plane, orig_width, orig_height, out_width, + out_height, ilace, fourcc, rotation);switch (fourcc) {case DRM_FORMAT_NV12 :
@@ -1868,46 +1938,43 @@ static void dispc_ovl_set_scaling_uv(enum omap_plane_id plane,if (out_height != orig_height) scale_y = true; -dispc_ovl_set_scale_param (plane, orig_width, orig_height, - out_width, out_height, five_taps, - rotation,DISPC_COLOR_COMPONENT_UV ); +dispc_ovl_set_scale_param (dispc, plane, orig_width, orig_height, + out_width, out_height, five_taps, + rotation,DISPC_COLOR_COMPONENT_UV );if (plane !=OMAP_DSS_WB ) -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES2 (plane), +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES2 (plane), (scale_x || scale_y) ?1 :0 ,8 ,8 );/* set H scaling */ -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), scale_x ?1 :0 ,5 ,5 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), scale_x ?1 :0 ,5 ,5 );/* set V scaling */ -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), scale_y ?1 :0 ,6 ,6 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), scale_y ?1 :0 ,6 ,6 ); } -static void dispc_ovl_set_scaling (enum omap_plane_id plane, -u16 orig_width,u16 orig_height, -u16 out_width,u16 out_height, -bool ilace,bool five_taps, -bool fieldmode,u32 fourcc, -u8 rotation) +static void dispc_ovl_set_scaling (struct dispc_device *dispc, +enum omap_plane_id plane, +u16 orig_width,u16 orig_height, +u16 out_width,u16 out_height, +bool ilace,bool five_taps, +bool fieldmode,u32 fourcc, +u8 rotation) {BUG_ON (plane ==OMAP_DSS_GFX ); -dispc_ovl_set_scaling_common (plane, - orig_width, orig_height, - out_width, out_height, - ilace, five_taps, - fieldmode, fourcc, - rotation); +dispc_ovl_set_scaling_common (dispc, plane, orig_width, orig_height, + out_width, out_height, ilace, five_taps, + fieldmode, fourcc, rotation); -dispc_ovl_set_scaling_uv (plane, - orig_width, orig_height, - out_width, out_height, - ilace, five_taps, - fieldmode, fourcc, - rotation); +dispc_ovl_set_scaling_uv (dispc, plane, orig_width, orig_height, + out_width, out_height, ilace, five_taps, + fieldmode, fourcc, rotation); } -static void dispc_ovl_set_rotation_attrs (enum omap_plane_id plane,u8 rotation, -enum omap_dss_rotation_type rotation_type,u32 fourcc) +static void dispc_ovl_set_rotation_attrs (struct dispc_device *dispc, +enum omap_plane_id plane,u8 rotation, +enum omap_dss_rotation_type rotation_type, +u32 fourcc) {bool row_repeat = false;int vidrot =0 ;
@@ -1961,19 +2028,20 @@ static void dispc_ovl_set_rotation_attrs(enum omap_plane_id plane, u8 rotation,if (fourcc ==DRM_FORMAT_NV12 && rotation_type !=OMAP_DSS_ROT_TILER ) vidrot =1 ; -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), vidrot,13 ,12 ); -if (dispc_has_feature (FEAT_ROWREPEATENABLE )) -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), vidrot,13 ,12 ); +if (dispc_has_feature (dispc,FEAT_ROWREPEATENABLE )) +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), row_repeat ?1 :0 ,18 ,18 ); -if (dispc_ovl_color_mode_supported (plane,DRM_FORMAT_NV12 )) { +if (dispc_ovl_color_mode_supported (dispc, plane,DRM_FORMAT_NV12 )) {bool doublestride = fourcc ==DRM_FORMAT_NV12 && rotation_type ==OMAP_DSS_ROT_TILER && !drm_rotation_90_or_270 (rotation);/* DOUBLESTRIDE */ -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), doublestride,22 ,22 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), + doublestride,22 ,22 ); } }
@@ -2210,27 +2278,31 @@ static unsigned long calc_core_clk_44xx(unsigned long pclk, u16 width,return pclk; } -static int dispc_ovl_calc_scaling_24xx (unsigned long pclk,unsigned long lclk, -const struct videomode *vm, -u16 width,u16 height,u16 out_width,u16 out_height, -u32 fourcc,bool *five_taps, -int *x_predecim,int *y_predecim,int *decim_x,int *decim_y, -u16 pos_x,unsigned long *core_clk,bool mem_to_mem) +static int dispc_ovl_calc_scaling_24xx (struct dispc_device *dispc, +unsigned long pclk,unsigned long lclk, +const struct videomode *vm, +u16 width,u16 height, +u16 out_width,u16 out_height, +u32 fourcc,bool *five_taps, +int *x_predecim,int *y_predecim, +int *decim_x,int *decim_y, +u16 pos_x,unsigned long *core_clk, +bool mem_to_mem) {int error;u16 in_width, in_height;int min_factor =min (*decim_x, *decim_y); -const int maxsinglelinewidth = dispc.feat->max_line_width; +const int maxsinglelinewidth = dispc->feat->max_line_width; *five_taps = false; do { in_height = height / *decim_y; in_width = width / *decim_x; - *core_clk = dispc.feat->calc_core_clk(pclk, in_width, + *core_clk = dispc->feat->calc_core_clk(pclk, in_width, in_height, out_width, out_height, mem_to_mem); error = (in_width > maxsinglelinewidth || !*core_clk || - *core_clk > dispc_core_clk_rate()); + *core_clk > dispc_core_clk_rate(dispc)); if (error) { if (*decim_x == *decim_y) { *decim_x = min_factor;
@@ -2255,16 +2327,20 @@ static int dispc_ovl_calc_scaling_24xx(unsigned long pclk, unsigned long lclk,return 0 ; } -static int dispc_ovl_calc_scaling_34xx (unsigned long pclk,unsigned long lclk, -const struct videomode *vm, -u16 width,u16 height,u16 out_width,u16 out_height, -u32 fourcc,bool *five_taps, -int *x_predecim,int *y_predecim,int *decim_x,int *decim_y, -u16 pos_x,unsigned long *core_clk,bool mem_to_mem) +static int dispc_ovl_calc_scaling_34xx (struct dispc_device *dispc, +unsigned long pclk,unsigned long lclk, +const struct videomode *vm, +u16 width,u16 height, +u16 out_width,u16 out_height, +u32 fourcc,bool *five_taps, +int *x_predecim,int *y_predecim, +int *decim_x,int *decim_y, +u16 pos_x,unsigned long *core_clk, +bool mem_to_mem) {int error;u16 in_width, in_height; -const int maxsinglelinewidth = dispc.feat->max_line_width; +const int maxsinglelinewidth = dispc->feat->max_line_width; do { in_height = height / *decim_y;
@@ -2281,7 +2357,7 @@ static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk, in_width, in_height, out_width, out_height, fourcc); else - *core_clk = dispc.feat->calc_core_clk (pclk, in_width, + *core_clk = dispc->feat->calc_core_clk (pclk, in_width, in_height, out_width, out_height, mem_to_mem);
@@ -2295,7 +2371,7 @@ static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk, error = (error || in_width > maxsinglelinewidth *2 || (in_width > maxsinglelinewidth && *five_taps) || - !*core_clk || *core_clk >dispc_core_clk_rate ()); + !*core_clk || *core_clk >dispc_core_clk_rate (dispc));if (!error) {/* verify that we're inside the limits of scaler */
@@ -2339,24 +2415,28 @@ static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk,return 0 ; } -static int dispc_ovl_calc_scaling_44xx (unsigned long pclk,unsigned long lclk, -const struct videomode *vm, -u16 width,u16 height,u16 out_width,u16 out_height, -u32 fourcc,bool *five_taps, -int *x_predecim,int *y_predecim,int *decim_x,int *decim_y, -u16 pos_x,unsigned long *core_clk,bool mem_to_mem) +static int dispc_ovl_calc_scaling_44xx (struct dispc_device *dispc, +unsigned long pclk,unsigned long lclk, +const struct videomode *vm, +u16 width,u16 height, +u16 out_width,u16 out_height, +u32 fourcc,bool *five_taps, +int *x_predecim,int *y_predecim, +int *decim_x,int *decim_y, +u16 pos_x,unsigned long *core_clk, +bool mem_to_mem) {u16 in_width, in_width_max;int decim_x_min = *decim_x;u16 in_height = height / *decim_y; -const int maxsinglelinewidth = dispc.feat->max_line_width; -const int maxdownscale = dispc.feat->max_downscale; +const int maxsinglelinewidth = dispc->feat->max_line_width; +const int maxdownscale = dispc->feat->max_downscale;if (mem_to_mem) { in_width_max = out_width * maxdownscale; }else { - in_width_max =dispc_core_clk_rate () / -DIV_ROUND_UP (pclk, out_width); + in_width_max =dispc_core_clk_rate (dispc) + /DIV_ROUND_UP (pclk, out_width); } *decim_x =DIV_ROUND_UP (width, in_width_max);
@@ -2394,7 +2474,7 @@ static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk,return -EINVAL ; } - *core_clk = dispc.feat->calc_core_clk (pclk, in_width, in_height, + *core_clk = dispc->feat->calc_core_clk (pclk, in_width, in_height, out_width, out_height, mem_to_mem);return 0 ; }
@@ -2402,15 +2482,18 @@ static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk,#define DIV_FRAC (dividend, divisor) \ ((dividend) * 100 / (divisor) - ((dividend) / (divisor) * 100)) -static int dispc_ovl_calc_scaling (unsigned long pclk,unsigned long lclk, -enum omap_overlay_caps caps, -const struct videomode *vm, -u16 width,u16 height,u16 out_width,u16 out_height, -u32 fourcc,bool *five_taps, -int *x_predecim,int *y_predecim,u16 pos_x, -enum omap_dss_rotation_type rotation_type,bool mem_to_mem) -{ -const int maxdownscale = dispc.feat->max_downscale; +static int dispc_ovl_calc_scaling (struct dispc_device *dispc, +unsigned long pclk,unsigned long lclk, +enum omap_overlay_caps caps, +const struct videomode *vm, +u16 width,u16 height, +u16 out_width,u16 out_height, +u32 fourcc,bool *five_taps, +int *x_predecim,int *y_predecim,u16 pos_x, +enum omap_dss_rotation_type rotation_type, +bool mem_to_mem) +{ +const int maxdownscale = dispc->feat->max_downscale;const int max_decim_limit =16 ;unsigned long core_clk =0 ;int decim_x, decim_y, ret;
@@ -2431,7 +2514,7 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk, }else { *x_predecim = max_decim_limit; *y_predecim = (rotation_type ==OMAP_DSS_ROT_TILER && -dispc_has_feature (FEAT_BURST_2D )) ? +dispc_has_feature (dispc,FEAT_BURST_2D )) ?2 : max_decim_limit; }
@@ -2444,10 +2527,11 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk,if (decim_y > *y_predecim || out_height > height *8 )return -EINVAL ; - ret = dispc.feat->calc_scaling (pclk, lclk, vm, width, height, - out_width, out_height, fourcc, five_taps, - x_predecim, y_predecim, &decim_x, &decim_y, pos_x, &core_clk, - mem_to_mem); + ret = dispc->feat->calc_scaling (dispc, pclk, lclk, vm, width, height, + out_width, out_height, fourcc, + five_taps, x_predecim, y_predecim, + &decim_x, &decim_y, pos_x, &core_clk, + mem_to_mem);if (ret)return ret;
@@ -2463,13 +2547,13 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk, out_height / (height / decim_y),DIV_FRAC (out_height, height / decim_y), *five_taps ?5 :3 , - core_clk, dispc_core_clk_rate()); + core_clk, dispc_core_clk_rate(dispc)); -if (!core_clk || core_clk >dispc_core_clk_rate ()) { +if (!core_clk || core_clk >dispc_core_clk_rate (dispc)) {DSSERR ("failed to set up scaling, " "required core clk rate = %lu Hz, " "current core clk rate = %lu Hz\n" , - core_clk,dispc_core_clk_rate ()); + core_clk,dispc_core_clk_rate (dispc));return -EINVAL ; }
@@ -2478,14 +2562,18 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk,return 0 ; } -static int dispc_ovl_setup_common (enum omap_plane_id plane, -enum omap_overlay_caps caps,u32 paddr,u32 p_uv_addr, -u16 screen_width,int pos_x,int pos_y,u16 width,u16 height, -u16 out_width,u16 out_height,u32 fourcc, -u8 rotation,u8 zorder,u8 pre_mult_alpha, -u8 global_alpha,enum omap_dss_rotation_type rotation_type, -bool replication,const struct videomode *vm, -bool mem_to_mem) +static int dispc_ovl_setup_common (struct dispc_device *dispc, +enum omap_plane_id plane, +enum omap_overlay_caps caps, +u32 paddr,u32 p_uv_addr, +u16 screen_width,int pos_x,int pos_y, +u16 width,u16 height, +u16 out_width,u16 out_height, +u32 fourcc,u8 rotation,u8 zorder, +u8 pre_mult_alpha,u8 global_alpha, +enum omap_dss_rotation_type rotation_type, +bool replication,const struct videomode *vm, +bool mem_to_mem) {bool five_taps = true;bool fieldmode = false;
@@ -2499,8 +2587,8 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane,u16 in_width = width;int x_predecim =1 , y_predecim =1 ;bool ilace = !!(vm->flags &DISPLAY_FLAGS_INTERLACED ); -unsigned long pclk =dispc_plane_pclk_rate (plane); -unsigned long lclk =dispc_plane_lclk_rate (plane); +unsigned long pclk =dispc_plane_pclk_rate (dispc, plane); +unsigned long lclk =dispc_plane_lclk_rate (dispc, plane);if (paddr ==0 && rotation_type !=OMAP_DSS_ROT_TILER )return -EINVAL ;
@@ -2527,13 +2615,13 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane, out_height); } -if (!dispc_ovl_color_mode_supported (plane, fourcc)) +if (!dispc_ovl_color_mode_supported (dispc, plane, fourcc))return -EINVAL ; - r =dispc_ovl_calc_scaling (pclk, lclk, caps, vm, in_width, - in_height, out_width, out_height, fourcc, - &five_taps, &x_predecim, &y_predecim, pos_x, - rotation_type, mem_to_mem); + r =dispc_ovl_calc_scaling (dispc, pclk, lclk, caps, vm, in_width, + in_height, out_width, out_height, fourcc, + &five_taps, &x_predecim, &y_predecim, pos_x, + rotation_type, mem_to_mem);if (r)return r;
@@ -2595,49 +2683,50 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane,DSSDBG ("offset0 %u, offset1 %u, row_inc %d, pix_inc %d\n" , offset0, offset1, row_inc, pix_inc); -dispc_ovl_set_color_mode (plane, fourcc); +dispc_ovl_set_color_mode (dispc, plane, fourcc); -dispc_ovl_configure_burst_type (plane, rotation_type); +dispc_ovl_configure_burst_type (dispc, plane, rotation_type); -if (dispc.feat->reverse_ilace_field_order) +if (dispc->feat->reverse_ilace_field_order)swap (offset0, offset1); -dispc_ovl_set_ba0 (plane, paddr + offset0); -dispc_ovl_set_ba1 (plane, paddr + offset1); +dispc_ovl_set_ba0 (dispc, plane, paddr + offset0); +dispc_ovl_set_ba1 (dispc, plane, paddr + offset1);if (fourcc ==DRM_FORMAT_NV12 ) { -dispc_ovl_set_ba0_uv (plane, p_uv_addr + offset0); -dispc_ovl_set_ba1_uv (plane, p_uv_addr + offset1); +dispc_ovl_set_ba0_uv (dispc, plane, p_uv_addr + offset0); +dispc_ovl_set_ba1_uv (dispc, plane, p_uv_addr + offset1); } -if (dispc.feat->last_pixel_inc_missing) +if (dispc->feat->last_pixel_inc_missing) row_inc += pix_inc -1 ; -dispc_ovl_set_row_inc (plane, row_inc); -dispc_ovl_set_pix_inc (plane, pix_inc); +dispc_ovl_set_row_inc (dispc, plane, row_inc); +dispc_ovl_set_pix_inc (dispc, plane, pix_inc);DSSDBG ("%d,%d %dx%d -> %dx%d\n" , pos_x, pos_y, in_width, in_height, out_width, out_height); -dispc_ovl_set_pos (plane, caps, pos_x, pos_y); +dispc_ovl_set_pos (dispc, plane, caps, pos_x, pos_y); -dispc_ovl_set_input_size (plane, in_width, in_height); +dispc_ovl_set_input_size (dispc, plane, in_width, in_height);if (caps &OMAP_DSS_OVL_CAP_SCALE ) { -dispc_ovl_set_scaling (plane, in_width, in_height, out_width, - out_height, ilace, five_taps, fieldmode, - fourcc, rotation); -dispc_ovl_set_output_size (plane, out_width, out_height); -dispc_ovl_set_vid_color_conv (plane, cconv); +dispc_ovl_set_scaling (dispc, plane, in_width, in_height, + out_width, out_height, ilace, five_taps, + fieldmode, fourcc, rotation); +dispc_ovl_set_output_size (dispc, plane, out_width, out_height); +dispc_ovl_set_vid_color_conv (dispc, plane, cconv); } -dispc_ovl_set_rotation_attrs (plane, rotation, rotation_type, fourcc); +dispc_ovl_set_rotation_attrs (dispc, plane, rotation, rotation_type, + fourcc); -dispc_ovl_set_zorder (plane, caps, zorder); -dispc_ovl_set_pre_mult_alpha (plane, caps, pre_mult_alpha); -dispc_ovl_setup_global_alpha (plane, caps, global_alpha); +dispc_ovl_set_zorder (dispc, plane, caps, zorder); +dispc_ovl_set_pre_mult_alpha (dispc, plane, caps, pre_mult_alpha); +dispc_ovl_setup_global_alpha (dispc, plane, caps, global_alpha); -dispc_ovl_enable_replication (plane, caps, replication); +dispc_ovl_enable_replication (dispc, plane, caps, replication);return 0 ; }
@@ -2658,9 +2747,9 @@ static int dispc_ovl_setup(struct dispc_device *dispc, oi->pos_y, oi->width, oi->height, oi->out_width, oi->out_height, oi->fourcc, oi->rotation, channel, replication); -dispc_ovl_set_channel_out (plane, channel); +dispc_ovl_set_channel_out (dispc, plane, channel); - r = dispc_ovl_setup_common(plane, caps, oi->paddr, oi->p_uv_addr, + r = dispc_ovl_setup_common(dispc, plane, caps, oi->paddr, oi->p_uv_addr, oi->screen_width, oi->pos_x, oi->pos_y, oi->width, oi->height, oi->out_width, oi->out_height, oi->fourcc, oi->rotation, oi->zorder, oi->pre_mult_alpha, oi->global_alpha,
@@ -2689,7 +2778,7 @@ int dispc_wb_setup(struct dispc_device *dispc,"rot %d\n" , wi->paddr, wi->p_uv_addr, in_width, in_height, wi->width, wi->height, wi->fourcc, wi->rotation); - r = dispc_ovl_setup_common(plane, caps, wi->paddr, wi->p_uv_addr, + r = dispc_ovl_setup_common(dispc, plane, caps, wi->paddr, wi->p_uv_addr, wi->buf_width, pos_x, pos_y, in_width, in_height, wi->width, wi->height, wi->fourcc, wi->rotation, zorder, wi->pre_mult_alpha, global_alpha, wi->rotation_type,
@@ -2712,18 +2801,18 @@ int dispc_wb_setup(struct dispc_device *dispc, }/* setup extra DISPC_WB_ATTRIBUTES */ - l =dispc_read_reg (DISPC_OVL_ATTRIBUTES (plane)); + l =dispc_read_reg (dispc,DISPC_OVL_ATTRIBUTES (plane)); l =FLD_MOD (l, truncation,10 ,10 );/* TRUNCATIONENABLE */ l =FLD_MOD (l, mem_to_mem,19 ,19 );/* WRITEBACKMODE */ if (mem_to_mem) l =FLD_MOD (l,1 ,26 ,24 );/* CAPTUREMODE */ else l =FLD_MOD (l,0 ,26 ,24 );/* CAPTUREMODE */ -dispc_write_reg (DISPC_OVL_ATTRIBUTES (plane), l); +dispc_write_reg (dispc,DISPC_OVL_ATTRIBUTES (plane), l);if (mem_to_mem) {/* WBDELAYCOUNT */ -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES2 (plane),0 ,7 ,0 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES2 (plane),0 ,7 ,0 ); }else {int wbdelay;
@@ -2731,7 +2820,7 @@ int dispc_wb_setup(struct dispc_device *dispc, vm->vsync_len + vm->vback_porch, (u32)255);/* WBDELAYCOUNT */ -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES2 (plane), wbdelay,7 ,0 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES2 (plane), wbdelay,7 ,0 ); }return r;
@@ -2742,7 +2831,7 @@ static int dispc_ovl_enable(struct dispc_device *dispc, {DSSDBG ("dispc_enable_plane %d, %d\n" , plane, enable); -REG_FLD_MOD (DISPC_OVL_ATTRIBUTES (plane), enable ?1 :0 ,0 ,0 ); +REG_FLD_MOD (dispc,DISPC_OVL_ATTRIBUTES (plane), enable ?1 :0 ,0 ,0 );return 0 ; }
@@ -2754,94 +2843,106 @@ dispc_mgr_get_supported_outputs(struct dispc_device *dispc,return dss_get_supported_outputs (dispc->dss, channel); } -static void dispc_lcd_enable_signal_polarity (bool act_high) +static void dispc_lcd_enable_signal_polarity (struct dispc_device *dispc, +bool act_high) { -if (!dispc_has_feature (FEAT_LCDENABLEPOL )) +if (!dispc_has_feature (dispc,FEAT_LCDENABLEPOL ))return ; -REG_FLD_MOD (DISPC_CONTROL , act_high ?1 :0 ,29 ,29 ); +REG_FLD_MOD (dispc,DISPC_CONTROL , act_high ?1 :0 ,29 ,29 ); }void dispc_lcd_enable_signal (struct dispc_device *dispc,bool enable) { -if (!dispc_has_feature (FEAT_LCDENABLESIGNAL )) +if (!dispc_has_feature (dispc,FEAT_LCDENABLESIGNAL ))return ; -REG_FLD_MOD (DISPC_CONTROL , enable ?1 :0 ,28 ,28 ); +REG_FLD_MOD (dispc,DISPC_CONTROL , enable ?1 :0 ,28 ,28 ); }void dispc_pck_free_enable (struct dispc_device *dispc,bool enable) { -if (!dispc_has_feature (FEAT_PCKFREEENABLE )) +if (!dispc_has_feature (dispc,FEAT_PCKFREEENABLE ))return ; -REG_FLD_MOD (DISPC_CONTROL , enable ?1 :0 ,27 ,27 ); +REG_FLD_MOD (dispc,DISPC_CONTROL , enable ?1 :0 ,27 ,27 ); } -static void dispc_mgr_enable_fifohandcheck (enum omap_channel channel,bool enable) +static void dispc_mgr_enable_fifohandcheck (struct dispc_device *dispc, +enum omap_channel channel, +bool enable) { -mgr_fld_write (channel,DISPC_MGR_FLD_FIFOHANDCHECK , enable); +mgr_fld_write (dispc, channel,DISPC_MGR_FLD_FIFOHANDCHECK , enable); } -static void dispc_mgr_set_lcd_type_tft (enum omap_channel channel) +static void dispc_mgr_set_lcd_type_tft (struct dispc_device *dispc, +enum omap_channel channel) { -mgr_fld_write (channel,DISPC_MGR_FLD_STNTFT ,1 ); +mgr_fld_write (dispc, channel,DISPC_MGR_FLD_STNTFT ,1 ); } -static void dispc_set_loadmode (enum omap_dss_load_mode mode) +static void dispc_set_loadmode (struct dispc_device *dispc, +enum omap_dss_load_mode mode) { -REG_FLD_MOD (DISPC_CONFIG , mode,2 ,1 ); +REG_FLD_MOD (dispc,DISPC_CONFIG , mode,2 ,1 ); } -static void dispc_mgr_set_default_color (enum omap_channel channel,u32 color) +static void dispc_mgr_set_default_color (struct dispc_device *dispc, +enum omap_channel channel,u32 color) { -dispc_write_reg (DISPC_DEFAULT_COLOR (channel), color); +dispc_write_reg (dispc,DISPC_DEFAULT_COLOR (channel), color); } -static void dispc_mgr_set_trans_key (enum omap_channel ch, -enum omap_dss_trans_key_type type, -u32 trans_key) +static void dispc_mgr_set_trans_key (struct dispc_device *dispc, +enum omap_channel ch, +enum omap_dss_trans_key_type type, +u32 trans_key) { -mgr_fld_write (ch,DISPC_MGR_FLD_TCKSELECTION , type); +mgr_fld_write (dispc, ch,DISPC_MGR_FLD_TCKSELECTION , type); -dispc_write_reg (DISPC_TRANS_COLOR (ch), trans_key); +dispc_write_reg (dispc,DISPC_TRANS_COLOR (ch), trans_key); } -static void dispc_mgr_enable_trans_key (enum omap_channel ch,bool enable) +static void dispc_mgr_enable_trans_key (struct dispc_device *dispc, +enum omap_channel ch,bool enable) { -mgr_fld_write (ch,DISPC_MGR_FLD_TCKENABLE , enable); +mgr_fld_write (dispc, ch,DISPC_MGR_FLD_TCKENABLE , enable); } -static void dispc_mgr_enable_alpha_fixed_zorder (enum omap_channel ch, -bool enable) +static void dispc_mgr_enable_alpha_fixed_zorder (struct dispc_device *dispc, +enum omap_channel ch, +bool enable) { -if (!dispc_has_feature (FEAT_ALPHA_FIXED_ZORDER )) +if (!dispc_has_feature (dispc,FEAT_ALPHA_FIXED_ZORDER ))return ;if (ch ==OMAP_DSS_CHANNEL_LCD ) -REG_FLD_MOD (DISPC_CONFIG , enable,18 ,18 ); +REG_FLD_MOD (dispc,DISPC_CONFIG , enable,18 ,18 );else if (ch ==OMAP_DSS_CHANNEL_DIGIT ) -REG_FLD_MOD (DISPC_CONFIG , enable,19 ,19 ); +REG_FLD_MOD (dispc,DISPC_CONFIG , enable,19 ,19 ); }static void dispc_mgr_setup (struct dispc_device *dispc,enum omap_channel channel,const struct omap_overlay_manager_info *info) { -dispc_mgr_set_default_color (channel, info->default_color); -dispc_mgr_set_trans_key (channel, info->trans_key_type, info->trans_key); -dispc_mgr_enable_trans_key (channel, info->trans_enabled); -dispc_mgr_enable_alpha_fixed_zorder (channel, +dispc_mgr_set_default_color (dispc, channel, info->default_color); +dispc_mgr_set_trans_key (dispc, channel, info->trans_key_type, + info->trans_key); +dispc_mgr_enable_trans_key (dispc, channel, info->trans_enabled); +dispc_mgr_enable_alpha_fixed_zorder (dispc, channel, info->partial_alpha_enabled); -if (dispc_has_feature (FEAT_CPR )) { -dispc_mgr_enable_cpr (channel, info->cpr_enable); -dispc_mgr_set_cpr_coef (channel, &info->cpr_coefs); +if (dispc_has_feature (dispc,FEAT_CPR )) { +dispc_mgr_enable_cpr (dispc, channel, info->cpr_enable); +dispc_mgr_set_cpr_coef (dispc, channel, &info->cpr_coefs); } } -static void dispc_mgr_set_tft_data_lines (enum omap_channel channel,u8 data_lines) +static void dispc_mgr_set_tft_data_lines (struct dispc_device *dispc, +enum omap_channel channel, +u8 data_lines) {int code;
@@ -2863,10 +2964,11 @@ static void dispc_mgr_set_tft_data_lines(enum omap_channel channel, u8 data_linereturn ; } -mgr_fld_write (channel,DISPC_MGR_FLD_TFTDATALINES , code); +mgr_fld_write (dispc, channel,DISPC_MGR_FLD_TFTDATALINES , code); } -static void dispc_mgr_set_io_pad_mode (enum dss_io_pad_mode mode) +static void dispc_mgr_set_io_pad_mode (struct dispc_device *dispc, +enum dss_io_pad_mode mode) {u32 l;int gpout0, gpout1;
@@ -2889,70 +2991,74 @@ static void dispc_mgr_set_io_pad_mode(enum dss_io_pad_mode mode)return ; } - l =dispc_read_reg (DISPC_CONTROL ); + l =dispc_read_reg (dispc,DISPC_CONTROL ); l =FLD_MOD (l, gpout0,15 ,15 ); l =FLD_MOD (l, gpout1,16 ,16 ); -dispc_write_reg (DISPC_CONTROL , l); +dispc_write_reg (dispc,DISPC_CONTROL , l); } -static void dispc_mgr_enable_stallmode (enum omap_channel channel,bool enable) +static void dispc_mgr_enable_stallmode (struct dispc_device *dispc, +enum omap_channel channel,bool enable) { -mgr_fld_write (channel,DISPC_MGR_FLD_STALLMODE , enable); +mgr_fld_write (dispc, channel,DISPC_MGR_FLD_STALLMODE , enable); }static void dispc_mgr_set_lcd_config (struct dispc_device *dispc,enum omap_channel channel,const struct dss_lcd_mgr_config *config) { -dispc_mgr_set_io_pad_mode (config->io_pad_mode); +dispc_mgr_set_io_pad_mode (dispc, config->io_pad_mode); -dispc_mgr_enable_stallmode (channel, config->stallmode); -dispc_mgr_enable_fifohandcheck (channel, config->fifohandcheck); +dispc_mgr_enable_stallmode (dispc, channel, config->stallmode); +dispc_mgr_enable_fifohandcheck (dispc, channel, config->fifohandcheck);dispc_mgr_set_clock_div (dispc, channel, &config->clock_info); -dispc_mgr_set_tft_data_lines (channel, config->video_port_width); +dispc_mgr_set_tft_data_lines (dispc, channel, config->video_port_width); -dispc_lcd_enable_signal_polarity (config->lcden_sig_polarity); +dispc_lcd_enable_signal_polarity (dispc, config->lcden_sig_polarity); -dispc_mgr_set_lcd_type_tft (channel); +dispc_mgr_set_lcd_type_tft (dispc, channel); } -static bool _dispc_mgr_size_ok (u16 width,u16 height) +static bool _dispc_mgr_size_ok (struct dispc_device *dispc, +u16 width,u16 height) { -return width <= dispc.feat->mgr_width_max && - height <= dispc.feat->mgr_height_max; +return width <= dispc->feat->mgr_width_max && + height <= dispc->feat->mgr_height_max; } -static bool _dispc_lcd_timings_ok (int hsync_len,int hfp,int hbp, -int vsw,int vfp,int vbp) +static bool _dispc_lcd_timings_ok (struct dispc_device *dispc, +int hsync_len,int hfp,int hbp, +int vsw,int vfp,int vbp) { -if (hsync_len <1 || hsync_len > dispc.feat->sw_max || - hfp <1 || hfp > dispc.feat->hp_max || - hbp <1 || hbp > dispc.feat->hp_max || - vsw <1 || vsw > dispc.feat->sw_max || - vfp <0 || vfp > dispc.feat->vp_max || - vbp <0 || vbp > dispc.feat->vp_max) +if (hsync_len <1 || hsync_len > dispc->feat->sw_max || + hfp <1 || hfp > dispc->feat->hp_max || + hbp <1 || hbp > dispc->feat->hp_max || + vsw <1 || vsw > dispc->feat->sw_max || + vfp <0 || vfp > dispc->feat->vp_max || + vbp <0 || vbp > dispc->feat->vp_max)return false;return true; } -static bool _dispc_mgr_pclk_ok (enum omap_channel channel, -unsigned long pclk) +static bool _dispc_mgr_pclk_ok (struct dispc_device *dispc, +enum omap_channel channel, +unsigned long pclk) {if (dss_mgr_is_lcd (channel)) -return pclk <= dispc.feat->max_lcd_pclk; +return pclk <= dispc->feat->max_lcd_pclk;else -return pclk <= dispc.feat->max_tv_pclk; +return pclk <= dispc->feat->max_tv_pclk; }bool dispc_mgr_timings_ok (struct dispc_device *dispc,enum omap_channel channel,const struct videomode *vm) { -if (!_dispc_mgr_size_ok (vm->hactive, vm->vactive)) +if (!_dispc_mgr_size_ok (dispc, vm->hactive, vm->vactive))return false; -if (!_dispc_mgr_pclk_ok (channel, vm->pixelclock)) +if (!_dispc_mgr_pclk_ok (dispc, channel, vm->pixelclock))return false;if (dss_mgr_is_lcd (channel)) {
@@ -2960,7 +3066,7 @@ bool dispc_mgr_timings_ok(struct dispc_device *dispc, enum omap_channel channel,if (vm->flags &DISPLAY_FLAGS_INTERLACED )return false; -if (!_dispc_lcd_timings_ok (vm->hsync_len, +if (!_dispc_lcd_timings_ok (dispc, vm->hsync_len, vm->hfront_porch, vm->hback_porch, vm->vsync_len, vm->vfront_porch, vm->vback_porch))
@@ -2970,21 +3076,22 @@ bool dispc_mgr_timings_ok(struct dispc_device *dispc, enum omap_channel channel,return true; } -static void _dispc_mgr_set_lcd_timings (enum omap_channel channel, +static void _dispc_mgr_set_lcd_timings (struct dispc_device *dispc, +enum omap_channel channel,const struct videomode *vm) {u32 timing_h, timing_v, l;bool onoff, rf, ipc, vs, hs, de; - timing_h =FLD_VAL (vm->hsync_len -1 , dispc.feat->sw_start,0 ) | -FLD_VAL (vm->hfront_porch -1 , dispc.feat->fp_start,8 ) | -FLD_VAL (vm->hback_porch -1 , dispc.feat->bp_start,20 ); - timing_v =FLD_VAL (vm->vsync_len -1 , dispc.feat->sw_start,0 ) | -FLD_VAL (vm->vfront_porch, dispc.feat->fp_start,8 ) | -FLD_VAL (vm->vback_porch, dispc.feat->bp_start,20 ); + timing_h =FLD_VAL (vm->hsync_len -1 , dispc->feat->sw_start,0 ) | +FLD_VAL (vm->hfront_porch -1 , dispc->feat->fp_start,8 ) | +FLD_VAL (vm->hback_porch -1 , dispc->feat->bp_start,20 ); + timing_v =FLD_VAL (vm->vsync_len -1 , dispc->feat->sw_start,0 ) | +FLD_VAL (vm->vfront_porch, dispc->feat->fp_start,8 ) | +FLD_VAL (vm->vback_porch, dispc->feat->bp_start,20 ); -dispc_write_reg (DISPC_TIMING_H (channel), timing_h); -dispc_write_reg (DISPC_TIMING_V (channel), timing_v); +dispc_write_reg (dispc,DISPC_TIMING_H (channel), timing_h); +dispc_write_reg (dispc,DISPC_TIMING_V (channel), timing_v);if (vm->flags &DISPLAY_FLAGS_VSYNC_HIGH ) vs = false;
@@ -3022,12 +3129,12 @@ static void _dispc_mgr_set_lcd_timings(enum omap_channel channel,FLD_VAL (vs,12 ,12 );/* always set ALIGN bit when available */ -if (dispc.feat->supports_sync_align) +if (dispc->feat->supports_sync_align) l |= (1 <<18 ); -dispc_write_reg (DISPC_POL_FREQ (channel), l); +dispc_write_reg (dispc,DISPC_POL_FREQ (channel), l); -if (dispc.syscon_pol) { +if (dispc->syscon_pol) {const int shifts[] = { [OMAP_DSS_CHANNEL_LCD ] =0 , [OMAP_DSS_CHANNEL_LCD2 ] =1 ,
@@ -3042,8 +3149,8 @@ static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, mask <<=16 + shifts[channel]; val <<=16 + shifts[channel]; -regmap_update_bits (dispc.syscon_pol, dispc.syscon_pol_offset, - mask, val); +regmap_update_bits (dispc->syscon_pol, dispc->syscon_pol_offset, + mask, val); } }
@@ -3074,7 +3181,7 @@ static void dispc_mgr_set_timings(struct dispc_device *dispc, }if (dss_mgr_is_lcd (channel)) { -_dispc_mgr_set_lcd_timings (channel, &t); +_dispc_mgr_set_lcd_timings (dispc, channel, &t); xtot = t.hactive + t.hfront_porch + t.hsync_len + t.hback_porch; ytot = t.vactive + t.vfront_porch + t.vsync_len + t.vback_porch;
@@ -3099,51 +3206,53 @@ static void dispc_mgr_set_timings(struct dispc_device *dispc, t.vactive /=2 ;if (dispc->feat->supports_double_pixel) -REG_FLD_MOD (DISPC_CONTROL , +REG_FLD_MOD (dispc,DISPC_CONTROL , !!(t.flags &DISPLAY_FLAGS_DOUBLECLK ),19 ,17 ); } -dispc_mgr_set_size (channel, t.hactive, t.vactive); +dispc_mgr_set_size (dispc, channel, t.hactive, t.vactive); } -static void dispc_mgr_set_lcd_divisor (enum omap_channel channel,u16 lck_div, -u16 pck_div) +static void dispc_mgr_set_lcd_divisor (struct dispc_device *dispc, +enum omap_channel channel,u16 lck_div, +u16 pck_div) {BUG_ON (lck_div <1 );BUG_ON (pck_div <1 ); -dispc_write_reg (DISPC_DIVISORo (channel), +dispc_write_reg (dispc,DISPC_DIVISORo (channel),FLD_VAL (lck_div,23 ,16 ) |FLD_VAL (pck_div,7 ,0 )); -if (!dispc_has_feature (FEAT_CORE_CLK_DIV ) && +if (!dispc_has_feature (dispc,FEAT_CORE_CLK_DIV ) && channel ==OMAP_DSS_CHANNEL_LCD ) - dispc.core_clk_rate =dispc_fclk_rate () / lck_div; + dispc->core_clk_rate =dispc_fclk_rate (dispc) / lck_div; } -static void dispc_mgr_get_lcd_divisor (enum omap_channel channel,int *lck_div, -int *pck_div) +static void dispc_mgr_get_lcd_divisor (struct dispc_device *dispc, +enum omap_channel channel,int *lck_div, +int *pck_div) {u32 l; - l =dispc_read_reg (DISPC_DIVISORo (channel)); + l =dispc_read_reg (dispc,DISPC_DIVISORo (channel)); *lck_div =FLD_GET (l,23 ,16 ); *pck_div =FLD_GET (l,7 ,0 ); } -static unsigned long dispc_fclk_rate (void ) +static unsigned long dispc_fclk_rate (struct dispc_device *dispc) {unsigned long r;enum dss_clk_source src; - src =dss_get_dispc_clk_source (dispc.dss); + src =dss_get_dispc_clk_source (dispc->dss);if (src ==DSS_CLK_SRC_FCK ) { - r =dss_get_dispc_clk_rate (dispc.dss); + r =dss_get_dispc_clk_rate (dispc->dss); }else {struct dss_pll *pll;unsigned int clkout_idx; - pll =dss_pll_find_by_src (dispc.dss, src); + pll =dss_pll_find_by_src (dispc->dss, src); clkout_idx =dss_pll_get_clkout_idx_for_src (src); r = pll->cinfo.clkout[clkout_idx];
@@ -3152,7 +3261,8 @@ static unsigned long dispc_fclk_rate(void)return r; } -static unsigned long dispc_mgr_lclk_rate (enum omap_channel channel) +static unsigned long dispc_mgr_lclk_rate (struct dispc_device *dispc, +enum omap_channel channel) {int lcd;unsigned long r;
@@ -3160,28 +3270,29 @@ static unsigned long dispc_mgr_lclk_rate(enum omap_channel channel)/* for TV, LCLK rate is the FCLK rate */ if (!dss_mgr_is_lcd (channel)) -return dispc_fclk_rate (); +return dispc_fclk_rate (dispc); - src =dss_get_lcd_clk_source (dispc.dss, channel); + src =dss_get_lcd_clk_source (dispc->dss, channel);if (src ==DSS_CLK_SRC_FCK ) { - r =dss_get_dispc_clk_rate (dispc.dss); + r =dss_get_dispc_clk_rate (dispc->dss); }else {struct dss_pll *pll;unsigned int clkout_idx; - pll =dss_pll_find_by_src (dispc.dss, src); + pll =dss_pll_find_by_src (dispc->dss, src); clkout_idx =dss_pll_get_clkout_idx_for_src (src); r = pll->cinfo.clkout[clkout_idx]; } - lcd =REG_GET (DISPC_DIVISORo (channel),23 ,16 ); + lcd =REG_GET (dispc,DISPC_DIVISORo (channel),23 ,16 );return r / lcd; } -static unsigned long dispc_mgr_pclk_rate (enum omap_channel channel) +static unsigned long dispc_mgr_pclk_rate (struct dispc_device *dispc, +enum omap_channel channel) {unsigned long r;
@@ -3189,15 +3300,15 @@ static unsigned long dispc_mgr_pclk_rate(enum omap_channel channel)int pcd;u32 l; - l =dispc_read_reg (DISPC_DIVISORo (channel)); + l =dispc_read_reg (dispc,DISPC_DIVISORo (channel)); pcd =FLD_GET (l,7 ,0 ); - r =dispc_mgr_lclk_rate (channel); + r =dispc_mgr_lclk_rate (dispc, channel);return r / pcd; }else { -return dispc.tv_pclk_rate; +return dispc->tv_pclk_rate; } }
@@ -3206,53 +3317,57 @@ void dispc_set_tv_pclk(struct dispc_device *dispc, unsigned long pclk) dispc->tv_pclk_rate = pclk; } -static unsigned long dispc_core_clk_rate (void ) +static unsigned long dispc_core_clk_rate (struct dispc_device *dispc) { -return dispc.core_clk_rate; +return dispc->core_clk_rate; } -static unsigned long dispc_plane_pclk_rate (enum omap_plane_id plane) +static unsigned long dispc_plane_pclk_rate (struct dispc_device *dispc, +enum omap_plane_id plane) {enum omap_channel channel;if (plane ==OMAP_DSS_WB )return 0 ; - channel =dispc_ovl_get_channel_out (plane); + channel =dispc_ovl_get_channel_out (dispc, plane); -return dispc_mgr_pclk_rate (channel); +return dispc_mgr_pclk_rate (dispc, channel); } -static unsigned long dispc_plane_lclk_rate (enum omap_plane_id plane) +static unsigned long dispc_plane_lclk_rate (struct dispc_device *dispc, +enum omap_plane_id plane) {enum omap_channel channel;if (plane ==OMAP_DSS_WB )return 0 ; - channel =dispc_ovl_get_channel_out (plane); + channel =dispc_ovl_get_channel_out (dispc, plane); -return dispc_mgr_lclk_rate (channel); +return dispc_mgr_lclk_rate (dispc, channel); } -static void dispc_dump_clocks_channel (struct seq_file *s,enum omap_channel channel) +static void dispc_dump_clocks_channel (struct dispc_device *dispc, +struct seq_file *s, +enum omap_channel channel) {int lcd, pcd;enum dss_clk_source lcd_clk_src;seq_printf (s,"- %s -\n" , mgr_desc[channel].name); - lcd_clk_src =dss_get_lcd_clk_source (dispc.dss, channel); + lcd_clk_src =dss_get_lcd_clk_source (dispc->dss, channel);seq_printf (s,"%s clk source = %s\n" , mgr_desc[channel].name,dss_get_clk_source_name (lcd_clk_src)); -dispc_mgr_get_lcd_divisor (channel, &lcd, &pcd); +dispc_mgr_get_lcd_divisor (dispc, channel, &lcd, &pcd);seq_printf (s,"lck\t\t%-16lulck div\t%u\n" , -dispc_mgr_lclk_rate (channel), lcd); +dispc_mgr_lclk_rate (dispc, channel), lcd);seq_printf (s,"pck\t\t%-16lupck div\t%u\n" , -dispc_mgr_pclk_rate (channel), pcd); +dispc_mgr_pclk_rate (dispc, channel), pcd); }void dispc_dump_clocks (struct dispc_device *dispc,struct seq_file *s)
@@ -3270,29 +3385,30 @@ void dispc_dump_clocks(struct dispc_device *dispc, struct seq_file *s)seq_printf (s,"dispc fclk source = %s\n" ,dss_get_clk_source_name (dispc_clk_src)); -seq_printf (s,"fck\t\t%-16lu\n" ,dispc_fclk_rate ()); +seq_printf (s,"fck\t\t%-16lu\n" ,dispc_fclk_rate (dispc)); -if (dispc_has_feature (FEAT_CORE_CLK_DIV )) { +if (dispc_has_feature (dispc,FEAT_CORE_CLK_DIV )) {seq_printf (s,"- DISPC-CORE-CLK -\n" ); - l =dispc_read_reg (DISPC_DIVISOR ); + l =dispc_read_reg (dispc,DISPC_DIVISOR ); lcd =FLD_GET (l,23 ,16 );seq_printf (s,"lck\t\t%-16lulck div\t%u\n" , - (dispc_fclk_rate ()/lcd), lcd); + (dispc_fclk_rate (dispc)/lcd), lcd); } -dispc_dump_clocks_channel (s,OMAP_DSS_CHANNEL_LCD ); +dispc_dump_clocks_channel (dispc, s,OMAP_DSS_CHANNEL_LCD ); -if (dispc_has_feature (FEAT_MGR_LCD2 )) -dispc_dump_clocks_channel (s,OMAP_DSS_CHANNEL_LCD2 ); -if (dispc_has_feature (FEAT_MGR_LCD3 )) -dispc_dump_clocks_channel (s,OMAP_DSS_CHANNEL_LCD3 ); +if (dispc_has_feature (dispc,FEAT_MGR_LCD2 )) +dispc_dump_clocks_channel (dispc, s,OMAP_DSS_CHANNEL_LCD2 ); +if (dispc_has_feature (dispc,FEAT_MGR_LCD3 )) +dispc_dump_clocks_channel (dispc, s,OMAP_DSS_CHANNEL_LCD3 );dispc_runtime_put (dispc); }static int dispc_dump_regs (struct seq_file *s,void *p) { +struct dispc_device *dispc = s->private;int i, j;const char *mgr_names[] = { [OMAP_DSS_CHANNEL_LCD ] ="LCD" ,
@@ -3309,178 +3425,179 @@ static int dispc_dump_regs(struct seq_file *s, void *p) };const char **p_names; -#define DUMPREG (r) seq_printf(s, "%-50s %08x\n", #r, dispc_read_reg(r)) +#define DUMPREG (dispc, r) \ + seq_printf(s, "%-50s %08x\n", #r, dispc_read_reg(dispc, r)) -if (dispc_runtime_get (&dispc)) +if (dispc_runtime_get (dispc))return 0 ;/* DISPC common registers */ -DUMPREG (DISPC_REVISION ); -DUMPREG (DISPC_SYSCONFIG ); -DUMPREG (DISPC_SYSSTATUS ); -DUMPREG (DISPC_IRQSTATUS ); -DUMPREG (DISPC_IRQENABLE ); -DUMPREG (DISPC_CONTROL ); -DUMPREG (DISPC_CONFIG ); -DUMPREG (DISPC_CAPABLE ); -DUMPREG (DISPC_LINE_STATUS ); -DUMPREG (DISPC_LINE_NUMBER ); -if (dispc_has_feature (FEAT_ALPHA_FIXED_ZORDER ) || -dispc_has_feature (FEAT_ALPHA_FREE_ZORDER )) -DUMPREG (DISPC_GLOBAL_ALPHA ); -if (dispc_has_feature (FEAT_MGR_LCD2 )) { -DUMPREG (DISPC_CONTROL2 ); -DUMPREG (DISPC_CONFIG2 ); +DUMPREG (dispc,DISPC_REVISION ); +DUMPREG (dispc,DISPC_SYSCONFIG ); +DUMPREG (dispc,DISPC_SYSSTATUS ); +DUMPREG (dispc,DISPC_IRQSTATUS ); +DUMPREG (dispc,DISPC_IRQENABLE ); +DUMPREG (dispc,DISPC_CONTROL ); +DUMPREG (dispc,DISPC_CONFIG ); +DUMPREG (dispc,DISPC_CAPABLE ); +DUMPREG (dispc,DISPC_LINE_STATUS ); +DUMPREG (dispc,DISPC_LINE_NUMBER ); +if (dispc_has_feature (dispc,FEAT_ALPHA_FIXED_ZORDER ) || +dispc_has_feature (dispc,FEAT_ALPHA_FREE_ZORDER )) +DUMPREG (dispc,DISPC_GLOBAL_ALPHA ); +if (dispc_has_feature (dispc,FEAT_MGR_LCD2 )) { +DUMPREG (dispc,DISPC_CONTROL2 ); +DUMPREG (dispc,DISPC_CONFIG2 ); } -if (dispc_has_feature (FEAT_MGR_LCD3 )) { -DUMPREG (DISPC_CONTROL3 ); -DUMPREG (DISPC_CONFIG3 ); +if (dispc_has_feature (dispc,FEAT_MGR_LCD3 )) { +DUMPREG (dispc,DISPC_CONTROL3 ); +DUMPREG (dispc,DISPC_CONFIG3 ); } -if (dispc_has_feature (FEAT_MFLAG )) -DUMPREG (DISPC_GLOBAL_MFLAG_ATTRIBUTE ); +if (dispc_has_feature (dispc,FEAT_MFLAG )) +DUMPREG (dispc,DISPC_GLOBAL_MFLAG_ATTRIBUTE );#undef DUMPREG#define DISPC_REG (i, name) name(i) -#define DUMPREG (i, r) seq_printf(s, "%s(%s)%*s %08x\n", #r, p_names[i], \ +#define DUMPREG (dispc, i, r) seq_printf(s, "%s(%s)%*s %08x\n", #r, p_names[i], \ (int)(48 - strlen(#r) - strlen(p_names[i])), " ", \ - dispc_read_reg(DISPC_REG(i, r))) + dispc_read_reg(dispc, DISPC_REG(i, r))) p_names = mgr_names;/* DISPC channel specific registers */ -for (i =0 ; i <dispc_get_num_mgrs (&dispc); i++) { -DUMPREG (i,DISPC_DEFAULT_COLOR ); -DUMPREG (i,DISPC_TRANS_COLOR ); -DUMPREG (i,DISPC_SIZE_MGR ); +for (i =0 ; i <dispc_get_num_mgrs (dispc); i++) { +DUMPREG (dispc, i,DISPC_DEFAULT_COLOR ); +DUMPREG (dispc, i,DISPC_TRANS_COLOR ); +DUMPREG (dispc, i,DISPC_SIZE_MGR );if (i ==OMAP_DSS_CHANNEL_DIGIT )continue ; -DUMPREG (i,DISPC_TIMING_H ); -DUMPREG (i,DISPC_TIMING_V ); -DUMPREG (i,DISPC_POL_FREQ ); -DUMPREG (i, DISPC_DIVISORo); +DUMPREG (dispc, i,DISPC_TIMING_H ); +DUMPREG (dispc, i,DISPC_TIMING_V ); +DUMPREG (dispc, i,DISPC_POL_FREQ ); +DUMPREG (dispc, i, DISPC_DIVISORo); -DUMPREG (i,DISPC_DATA_CYCLE1 ); -DUMPREG (i,DISPC_DATA_CYCLE2 ); -DUMPREG (i,DISPC_DATA_CYCLE3 ); +DUMPREG (dispc, i,DISPC_DATA_CYCLE1 ); +DUMPREG (dispc, i,DISPC_DATA_CYCLE2 ); +DUMPREG (dispc, i,DISPC_DATA_CYCLE3 ); -if (dispc_has_feature (FEAT_CPR )) { -DUMPREG (i,DISPC_CPR_COEF_R ); -DUMPREG (i,DISPC_CPR_COEF_G ); -DUMPREG (i,DISPC_CPR_COEF_B ); +if (dispc_has_feature (dispc,FEAT_CPR )) { +DUMPREG (dispc, i,DISPC_CPR_COEF_R ); +DUMPREG (dispc, i,DISPC_CPR_COEF_G ); +DUMPREG (dispc, i,DISPC_CPR_COEF_B ); } } p_names = ovl_names; -for (i =0 ; i <dispc_get_num_ovls (&dispc); i++) { -DUMPREG (i,DISPC_OVL_BA0 ); -DUMPREG (i,DISPC_OVL_BA1 ); -DUMPREG (i,DISPC_OVL_POSITION ); -DUMPREG (i,DISPC_OVL_SIZE ); -DUMPREG (i,DISPC_OVL_ATTRIBUTES ); -DUMPREG (i,DISPC_OVL_FIFO_THRESHOLD ); -DUMPREG (i,DISPC_OVL_FIFO_SIZE_STATUS ); -DUMPREG (i,DISPC_OVL_ROW_INC ); -DUMPREG (i,DISPC_OVL_PIXEL_INC ); - -if (dispc_has_feature (FEAT_PRELOAD )) -DUMPREG (i,DISPC_OVL_PRELOAD ); -if (dispc_has_feature (FEAT_MFLAG )) -DUMPREG (i,DISPC_OVL_MFLAG_THRESHOLD ); +for (i =0 ; i <dispc_get_num_ovls (dispc); i++) { +DUMPREG (dispc, i,DISPC_OVL_BA0 ); +DUMPREG (dispc, i,DISPC_OVL_BA1 ); +DUMPREG (dispc, i,DISPC_OVL_POSITION ); +DUMPREG (dispc, i,DISPC_OVL_SIZE ); +DUMPREG (dispc, i,DISPC_OVL_ATTRIBUTES ); +DUMPREG (dispc, i,DISPC_OVL_FIFO_THRESHOLD ); +DUMPREG (dispc, i,DISPC_OVL_FIFO_SIZE_STATUS ); +DUMPREG (dispc, i,DISPC_OVL_ROW_INC ); +DUMPREG (dispc, i,DISPC_OVL_PIXEL_INC ); + +if (dispc_has_feature (dispc,FEAT_PRELOAD )) +DUMPREG (dispc, i,DISPC_OVL_PRELOAD ); +if (dispc_has_feature (dispc,FEAT_MFLAG )) +DUMPREG (dispc, i,DISPC_OVL_MFLAG_THRESHOLD );if (i ==OMAP_DSS_GFX ) { -DUMPREG (i,DISPC_OVL_WINDOW_SKIP ); -DUMPREG (i,DISPC_OVL_TABLE_BA ); +DUMPREG (dispc, i,DISPC_OVL_WINDOW_SKIP ); +DUMPREG (dispc, i,DISPC_OVL_TABLE_BA );continue ; } -DUMPREG (i,DISPC_OVL_FIR ); -DUMPREG (i,DISPC_OVL_PICTURE_SIZE ); -DUMPREG (i,DISPC_OVL_ACCU0 ); -DUMPREG (i,DISPC_OVL_ACCU1 ); -if (dispc_has_feature (FEAT_HANDLE_UV_SEPARATE )) { -DUMPREG (i,DISPC_OVL_BA0_UV ); -DUMPREG (i,DISPC_OVL_BA1_UV ); -DUMPREG (i,DISPC_OVL_FIR2 ); -DUMPREG (i,DISPC_OVL_ACCU2_0 ); -DUMPREG (i,DISPC_OVL_ACCU2_1 ); +DUMPREG (dispc, i,DISPC_OVL_FIR ); +DUMPREG (dispc, i,DISPC_OVL_PICTURE_SIZE ); +DUMPREG (dispc, i,DISPC_OVL_ACCU0 ); +DUMPREG (dispc, i,DISPC_OVL_ACCU1 ); +if (dispc_has_feature (dispc,FEAT_HANDLE_UV_SEPARATE )) { +DUMPREG (dispc, i,DISPC_OVL_BA0_UV ); +DUMPREG (dispc, i,DISPC_OVL_BA1_UV ); +DUMPREG (dispc, i,DISPC_OVL_FIR2 ); +DUMPREG (dispc, i,DISPC_OVL_ACCU2_0 ); +DUMPREG (dispc, i,DISPC_OVL_ACCU2_1 ); } -if (dispc_has_feature (FEAT_ATTR2 )) -DUMPREG (i,DISPC_OVL_ATTRIBUTES2 ); +if (dispc_has_feature (dispc,FEAT_ATTR2 )) +DUMPREG (dispc, i,DISPC_OVL_ATTRIBUTES2 ); } -if (dispc.feat->has_writeback) { +if (dispc->feat->has_writeback) { i =OMAP_DSS_WB ; -DUMPREG (i,DISPC_OVL_BA0 ); -DUMPREG (i,DISPC_OVL_BA1 ); -DUMPREG (i,DISPC_OVL_SIZE ); -DUMPREG (i,DISPC_OVL_ATTRIBUTES ); -DUMPREG (i,DISPC_OVL_FIFO_THRESHOLD ); -DUMPREG (i,DISPC_OVL_FIFO_SIZE_STATUS ); -DUMPREG (i,DISPC_OVL_ROW_INC ); -DUMPREG (i,DISPC_OVL_PIXEL_INC ); - -if (dispc_has_feature (FEAT_MFLAG )) -DUMPREG (i,DISPC_OVL_MFLAG_THRESHOLD ); - -DUMPREG (i,DISPC_OVL_FIR ); -DUMPREG (i,DISPC_OVL_PICTURE_SIZE ); -DUMPREG (i,DISPC_OVL_ACCU0 ); -DUMPREG (i,DISPC_OVL_ACCU1 ); -if (dispc_has_feature (FEAT_HANDLE_UV_SEPARATE )) { -DUMPREG (i,DISPC_OVL_BA0_UV ); -DUMPREG (i,DISPC_OVL_BA1_UV ); -DUMPREG (i,DISPC_OVL_FIR2 ); -DUMPREG (i,DISPC_OVL_ACCU2_0 ); -DUMPREG (i,DISPC_OVL_ACCU2_1 ); +DUMPREG (dispc, i,DISPC_OVL_BA0 ); +DUMPREG (dispc, i,DISPC_OVL_BA1 ); +DUMPREG (dispc, i,DISPC_OVL_SIZE ); +DUMPREG (dispc, i,DISPC_OVL_ATTRIBUTES ); +DUMPREG (dispc, i,DISPC_OVL_FIFO_THRESHOLD ); +DUMPREG (dispc, i,DISPC_OVL_FIFO_SIZE_STATUS ); +DUMPREG (dispc, i,DISPC_OVL_ROW_INC ); +DUMPREG (dispc, i,DISPC_OVL_PIXEL_INC ); + +if (dispc_has_feature (dispc,FEAT_MFLAG )) +DUMPREG (dispc, i,DISPC_OVL_MFLAG_THRESHOLD ); + +DUMPREG (dispc, i,DISPC_OVL_FIR ); +DUMPREG (dispc, i,DISPC_OVL_PICTURE_SIZE ); +DUMPREG (dispc, i,DISPC_OVL_ACCU0 ); +DUMPREG (dispc, i,DISPC_OVL_ACCU1 ); +if (dispc_has_feature (dispc,FEAT_HANDLE_UV_SEPARATE )) { +DUMPREG (dispc, i,DISPC_OVL_BA0_UV ); +DUMPREG (dispc, i,DISPC_OVL_BA1_UV ); +DUMPREG (dispc, i,DISPC_OVL_FIR2 ); +DUMPREG (dispc, i,DISPC_OVL_ACCU2_0 ); +DUMPREG (dispc, i,DISPC_OVL_ACCU2_1 ); } -if (dispc_has_feature (FEAT_ATTR2 )) -DUMPREG (i,DISPC_OVL_ATTRIBUTES2 ); +if (dispc_has_feature (dispc,FEAT_ATTR2 )) +DUMPREG (dispc, i,DISPC_OVL_ATTRIBUTES2 ); }#undef DISPC_REG#undef DUMPREG#define DISPC_REG (plane, name, i) name(plane, i) -#define DUMPREG (plane, name, i) \ +#define DUMPREG (dispc, plane, name, i) \ seq_printf(s, "%s_%d(%s)%*s %08x\n", #name, i, p_names[plane], \ (int)(46 - strlen(#name) - strlen(p_names[plane])), " ", \ - dispc_read_reg(DISPC_REG(plane, name, i))) + dispc_read_reg(dispc, DISPC_REG(plane, name, i)))/* Video pipeline coefficient registers */ /* start from OMAP_DSS_VIDEO1 */ -for (i =1 ; i <dispc_get_num_ovls (&dispc); i++) { +for (i =1 ; i <dispc_get_num_ovls (dispc); i++) {for (j =0 ; j <8 ; j++) -DUMPREG (i,DISPC_OVL_FIR_COEF_H , j); +DUMPREG (dispc, i,DISPC_OVL_FIR_COEF_H , j);for (j =0 ; j <8 ; j++) -DUMPREG (i,DISPC_OVL_FIR_COEF_HV , j); +DUMPREG (dispc, i,DISPC_OVL_FIR_COEF_HV , j);for (j =0 ; j <5 ; j++) -DUMPREG (i,DISPC_OVL_CONV_COEF , j); +DUMPREG (dispc, i,DISPC_OVL_CONV_COEF , j); -if (dispc_has_feature (FEAT_FIR_COEF_V )) { +if (dispc_has_feature (dispc,FEAT_FIR_COEF_V )) {for (j =0 ; j <8 ; j++) -DUMPREG (i,DISPC_OVL_FIR_COEF_V , j); +DUMPREG (dispc, i,DISPC_OVL_FIR_COEF_V , j); } -if (dispc_has_feature (FEAT_HANDLE_UV_SEPARATE )) { +if (dispc_has_feature (dispc,FEAT_HANDLE_UV_SEPARATE )) {for (j =0 ; j <8 ; j++) -DUMPREG (i,DISPC_OVL_FIR_COEF_H2 , j); +DUMPREG (dispc, i,DISPC_OVL_FIR_COEF_H2 , j);for (j =0 ; j <8 ; j++) -DUMPREG (i,DISPC_OVL_FIR_COEF_HV2 , j); +DUMPREG (dispc, i,DISPC_OVL_FIR_COEF_HV2 , j);for (j =0 ; j <8 ; j++) -DUMPREG (i,DISPC_OVL_FIR_COEF_V2 , j); +DUMPREG (dispc, i,DISPC_OVL_FIR_COEF_V2 , j); } } -dispc_runtime_put (&dispc); +dispc_runtime_put (dispc);#undef DISPC_REG#undef DUMPREG
@@ -3548,8 +3665,8 @@ bool dispc_div_calc(struct dispc_device *dispc, unsigned long dispc_freq,* also. Thus we need to use the calculated lck. For * OMAP4+ the DISPC fclk is a separate clock. */ -if (dispc_has_feature (FEAT_CORE_CLK_DIV )) - fck =dispc_core_clk_rate (); +if (dispc_has_feature (dispc,FEAT_CORE_CLK_DIV )) + fck =dispc_core_clk_rate (dispc);else fck = lck;
@@ -3571,7 +3688,8 @@ void dispc_mgr_set_clock_div(struct dispc_device *dispc,DSSDBG ("lck = %lu (%u)\n" , cinfo->lck, cinfo->lck_div);DSSDBG ("pck = %lu (%u)\n" , cinfo->pck, cinfo->pck_div); -dispc_mgr_set_lcd_divisor (channel, cinfo->lck_div, cinfo->pck_div); +dispc_mgr_set_lcd_divisor (dispc, channel, cinfo->lck_div, + cinfo->pck_div); } int dispc_mgr_get_clock_div(struct dispc_device *dispc,
@@ -3580,10 +3698,10 @@ int dispc_mgr_get_clock_div(struct dispc_device *dispc, {unsigned long fck; - fck =dispc_fclk_rate (); + fck =dispc_fclk_rate (dispc); - cinfo->lck_div =REG_GET (DISPC_DIVISORo (channel),23 ,16 ); - cinfo->pck_div =REG_GET (DISPC_DIVISORo (channel),7 ,0 ); + cinfo->lck_div =REG_GET (dispc,DISPC_DIVISORo (channel),23 ,16 ); + cinfo->pck_div =REG_GET (dispc,DISPC_DIVISORo (channel),7 ,0 ); cinfo->lck = fck / cinfo->lck_div; cinfo->pck = cinfo->lck / cinfo->pck_div;
@@ -3593,35 +3711,36 @@ int dispc_mgr_get_clock_div(struct dispc_device *dispc,static u32 dispc_read_irqstatus (struct dispc_device *dispc) { -return dispc_read_reg (DISPC_IRQSTATUS ); +return dispc_read_reg (dispc,DISPC_IRQSTATUS ); }static void dispc_clear_irqstatus (struct dispc_device *dispc,u32 mask) { -dispc_write_reg (DISPC_IRQSTATUS , mask); +dispc_write_reg (dispc,DISPC_IRQSTATUS , mask); }static void dispc_write_irqenable (struct dispc_device *dispc,u32 mask) { -u32 old_mask =dispc_read_reg (DISPC_IRQENABLE ); +u32 old_mask =dispc_read_reg (dispc,DISPC_IRQENABLE );/* clear the irqstatus for newly enabled irqs */ dispc_clear_irqstatus (dispc, (mask ^ old_mask) & mask); -dispc_write_reg (DISPC_IRQENABLE , mask); +dispc_write_reg (dispc,DISPC_IRQENABLE , mask);/* flush posted write */ -dispc_read_reg (DISPC_IRQENABLE ); +dispc_read_reg (dispc,DISPC_IRQENABLE ); }void dispc_enable_sidle (struct dispc_device *dispc) { -REG_FLD_MOD (DISPC_SYSCONFIG ,2 ,4 ,3 );/* SIDLEMODE: smart idle */
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Part of the diff is not shown here. View the raw message.
PATCH v2 27/30 drm: omapdrm: hdmi4: Allocate the omap_hdmi data structure dynamically
In reply to Laurent PinchartThe omap_hdmi private data structure is currently stored as a global variable. While no platform with multiple HDMI4 encoders currently exists nor is planned, this doesn't comply with the kernel device model and should thus be fixed.
---
Changes since v1:
- Fixed device name string that had been incorrectly modified
--- drivers/gpu/drm/omapdrm/dss/hdmi.h | 2 + drivers/gpu/drm/omapdrm/dss/hdmi4.c | 356 +++++++++++++++++-------------- drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c | 4 +- drivers/gpu/drm/omapdrm/dss/hdmi4_core.h | 4 +- 4 files changed, 200 insertions(+), 166 deletions(-)
drivers/gpu/drm/omapdrm/dss/hdmi.h +2 -0
@@ -389,4 +389,6 @@ struct omap_hdmi { bool display_enabled; }; +#define dssdev_to_hdmi (dssdev) container_of(dssdev, struct omap_hdmi, output) +#endif
drivers/gpu/drm/omapdrm/dss/hdmi4.c +194 -162
755 lines not on this page · raw message
drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c +2 -2
@@ -175,10 +175,10 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)REG_FLD_MOD (core->base,HDMI_CORE_SYS_INTR_UNMASK4 ,0 ,3 ,3 );hdmi_wp_clear_irqenable (core->wp,HDMI_IRQ_CORE );hdmi_wp_set_irqstatus (core->wp,HDMI_IRQ_CORE ); -hdmi4_core_disable (NULL ); +hdmi4_core_disable (core);return 0 ; } - err =hdmi4_core_enable (NULL ); + err =hdmi4_core_enable (core);if (err)return err;
drivers/gpu/drm/omapdrm/dss/hdmi4_core.h +2 -2
@@ -266,8 +266,8 @@ void hdmi4_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,void hdmi4_core_dump (struct hdmi_core_data *core,struct seq_file *s);int hdmi4_core_init (struct platform_device *pdev,struct hdmi_core_data *core); -int hdmi4_core_enable (struct omap_dss_device *dssdev); -void hdmi4_core_disable (struct omap_dss_device *dssdev); +int hdmi4_core_enable (struct hdmi_core_data *core); +void hdmi4_core_disable (struct hdmi_core_data *core);void hdmi4_core_powerdown_disable (struct hdmi_core_data *core);int hdmi4_audio_start (struct hdmi_core_data *core,struct hdmi_wp_data *wp);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 28/30 drm: omapdrm: hdmi5: Allocate the omap_hdmi data structure dynamically
In reply to Laurent PinchartThe omap_hdmi private data structure is currently stored as a global variable. While no platform with multiple HDMI5 encoders currently exists nor is planned, this doesn't comply with the kernel device model and should thus be fixed.
---
Changes since v1:
- Fixed device name string that had been incorrectly modified
--- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 364 +++++++++++++++++++----------------- 1 file changed, 196 insertions(+), 168 deletions(-)
drivers/gpu/drm/omapdrm/dss/hdmi5.c +196 -168
@@ -46,15 +46,13 @@#include "hdmi5_core.h" #include "dss.h" -static struct omap_hdmi hdmi; - -static int hdmi_runtime_get (void ) +static int hdmi_runtime_get (struct omap_hdmi *hdmi) {int r;DSSDBG ("hdmi_runtime_get\n" ); - r =pm_runtime_get_sync (&hdmi.pdev->dev); + r =pm_runtime_get_sync (&hdmi->pdev->dev);WARN_ON (r <0 );if (r <0 )return r;
@@ -62,19 +60,20 @@ static int hdmi_runtime_get(void)return 0 ; } -static void hdmi_runtime_put (void ) +static void hdmi_runtime_put (struct omap_hdmi *hdmi) {int r;DSSDBG ("hdmi_runtime_put\n" ); - r =pm_runtime_put_sync (&hdmi.pdev->dev); + r =pm_runtime_put_sync (&hdmi->pdev->dev);WARN_ON (r <0 && r != -ENOSYS ); }static irqreturn_t hdmi_irq_handler (int irq,void *data) { -struct hdmi_wp_data *wp = data; +struct omap_hdmi *hdmi = data; +struct hdmi_wp_data *wp = &hdmi->wp;u32 irqstatus; irqstatus =hdmi_wp_get_irqstatus (wp);
@@ -97,17 +96,17 @@ static irqreturn_t hdmi_irq_handler(int irq, void *data)* setting the PHY to LDOON. To ignore those, we force the RXDET * line to 0 until the PHY power state has been changed. */ - v =hdmi_read_reg (hdmi.phy.base,HDMI_TXPHY_PAD_CFG_CTRL ); + v =hdmi_read_reg (hdmi->phy.base,HDMI_TXPHY_PAD_CFG_CTRL ); v =FLD_MOD (v,1 ,15 ,15 );/* FORCE_RXDET_HIGH */ v =FLD_MOD (v,0 ,14 ,7 );/* RXDET_LINE */ -hdmi_write_reg (hdmi.phy.base,HDMI_TXPHY_PAD_CFG_CTRL , v); +hdmi_write_reg (hdmi->phy.base,HDMI_TXPHY_PAD_CFG_CTRL , v);hdmi_wp_set_irqstatus (wp,HDMI_IRQ_LINK_CONNECT |HDMI_IRQ_LINK_DISCONNECT );hdmi_wp_set_phy_pwr (wp,HDMI_PHYPWRCMD_LDOON ); -REG_FLD_MOD (hdmi.phy.base,HDMI_TXPHY_PAD_CFG_CTRL ,0 ,15 ,15 ); +REG_FLD_MOD (hdmi->phy.base,HDMI_TXPHY_PAD_CFG_CTRL ,0 ,15 ,15 ); }else if (irqstatus &HDMI_IRQ_LINK_CONNECT ) {hdmi_wp_set_phy_pwr (wp,HDMI_PHYPWRCMD_TXON );
@@ -118,69 +117,69 @@ static irqreturn_t hdmi_irq_handler(int irq, void *data)return IRQ_HANDLED ; } -static int hdmi_init_regulator (void ) +static int hdmi_init_regulator (struct omap_hdmi *hdmi) {struct regulator *reg; -if (hdmi.vdda_reg !=NULL ) +if (hdmi->vdda_reg !=NULL )return 0 ; - reg =devm_regulator_get (&hdmi.pdev->dev,"vdda" ); + reg =devm_regulator_get (&hdmi->pdev->dev,"vdda" );if (IS_ERR (reg)) {DSSERR ("can't get VDDA regulator\n" );return PTR_ERR (reg); } - hdmi.vdda_reg = reg; + hdmi->vdda_reg = reg;return 0 ; } -static int hdmi_power_on_core (struct omap_dss_device *dssdev) +static int hdmi_power_on_core (struct omap_hdmi *hdmi) {int r; - r =regulator_enable (hdmi.vdda_reg); + r =regulator_enable (hdmi->vdda_reg);if (r)return r; - r =hdmi_runtime_get (); + r =hdmi_runtime_get (hdmi);if (r) goto err_runtime_get;/* Make selection of HDMI in DSS */ -dss_select_hdmi_venc_clk_source (hdmi.dss,DSS_HDMI_M_PCLK ); +dss_select_hdmi_venc_clk_source (hdmi->dss,DSS_HDMI_M_PCLK ); - hdmi.core_enabled = true; + hdmi->core_enabled = true;return 0 ; err_runtime_get: -regulator_disable (hdmi.vdda_reg); +regulator_disable (hdmi->vdda_reg);return r; } -static void hdmi_power_off_core (struct omap_dss_device *dssdev) +static void hdmi_power_off_core (struct omap_hdmi *hdmi) { - hdmi.core_enabled = false; + hdmi->core_enabled = false; -hdmi_runtime_put (); -regulator_disable (hdmi.vdda_reg); +hdmi_runtime_put (hdmi); +regulator_disable (hdmi->vdda_reg); } -static int hdmi_power_on_full (struct omap_dss_device *dssdev) +static int hdmi_power_on_full (struct omap_hdmi *hdmi) {int r;struct videomode *vm;struct dss_pll_clock_info hdmi_cinfo = {0 };unsigned int pc; - r =hdmi_power_on_core (dssdev); + r =hdmi_power_on_core (hdmi);if (r)return r; - vm = &hdmi.cfg.vm; + vm = &hdmi->cfg.vm;DSSDBG ("hdmi_power_on hactive= %d vactive = %d\n" , vm->hactive, vm->vactive);
@@ -192,87 +191,89 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)/* DSS_HDMI_TCLK is bitclk / 10 */ pc *=10 ; -dss_pll_calc_b (&hdmi.pll.pll,clk_get_rate (hdmi.pll.pll.clkin), +dss_pll_calc_b (&hdmi->pll.pll,clk_get_rate (hdmi->pll.pll.clkin), pc, &hdmi_cinfo);/* disable and clear irqs */ -hdmi_wp_clear_irqenable (&hdmi.wp,0xffffffff ); -hdmi_wp_set_irqstatus (&hdmi.wp, -hdmi_wp_get_irqstatus (&hdmi.wp)); +hdmi_wp_clear_irqenable (&hdmi->wp,0xffffffff ); +hdmi_wp_set_irqstatus (&hdmi->wp, +hdmi_wp_get_irqstatus (&hdmi->wp)); - r =dss_pll_enable (&hdmi.pll.pll); + r =dss_pll_enable (&hdmi->pll.pll);if (r) {DSSERR ("Failed to enable PLL\n" ); goto err_pll_enable; } - r =dss_pll_set_config (&hdmi.pll.pll, &hdmi_cinfo); + r =dss_pll_set_config (&hdmi->pll.pll, &hdmi_cinfo);if (r) {DSSERR ("Failed to configure PLL\n" ); goto err_pll_cfg; } - r =hdmi_phy_configure (&hdmi.phy, hdmi_cinfo.clkdco, + r =hdmi_phy_configure (&hdmi->phy, hdmi_cinfo.clkdco, hdmi_cinfo.clkout[0 ]);if (r) {DSSDBG ("Failed to start PHY\n" ); goto err_phy_cfg; } - r =hdmi_wp_set_phy_pwr (&hdmi.wp,HDMI_PHYPWRCMD_LDOON ); + r =hdmi_wp_set_phy_pwr (&hdmi->wp,HDMI_PHYPWRCMD_LDOON );if (r) goto err_phy_pwr; -hdmi5_configure (&hdmi.core, &hdmi.wp, &hdmi.cfg); +hdmi5_configure (&hdmi->core, &hdmi->wp, &hdmi->cfg);/* tv size */ -dss_mgr_set_timings (&hdmi.output, vm); +dss_mgr_set_timings (&hdmi->output, vm); - r =dss_mgr_enable (&hdmi.output); + r =dss_mgr_enable (&hdmi->output);if (r) goto err_mgr_enable; - r =hdmi_wp_video_start (&hdmi.wp); + r =hdmi_wp_video_start (&hdmi->wp);if (r) goto err_vid_enable; -hdmi_wp_set_irqenable (&hdmi.wp, +hdmi_wp_set_irqenable (&hdmi->wp,HDMI_IRQ_LINK_CONNECT |HDMI_IRQ_LINK_DISCONNECT );return 0 ; err_vid_enable: -dss_mgr_disable (&hdmi.output); +dss_mgr_disable (&hdmi->output); err_mgr_enable: -hdmi_wp_set_phy_pwr (&hdmi.wp,HDMI_PHYPWRCMD_OFF ); +hdmi_wp_set_phy_pwr (&hdmi->wp,HDMI_PHYPWRCMD_OFF ); err_phy_pwr: err_phy_cfg: err_pll_cfg: -dss_pll_disable (&hdmi.pll.pll); +dss_pll_disable (&hdmi->pll.pll); err_pll_enable: -hdmi_power_off_core (dssdev); +hdmi_power_off_core (hdmi);return -EIO ; } -static void hdmi_power_off_full (struct omap_dss_device *dssdev) +static void hdmi_power_off_full (struct omap_hdmi *hdmi) { -hdmi_wp_clear_irqenable (&hdmi.wp,0xffffffff ); +hdmi_wp_clear_irqenable (&hdmi->wp,0xffffffff ); -hdmi_wp_video_stop (&hdmi.wp); +hdmi_wp_video_stop (&hdmi->wp); -dss_mgr_disable (&hdmi.output); +dss_mgr_disable (&hdmi->output); -hdmi_wp_set_phy_pwr (&hdmi.wp,HDMI_PHYPWRCMD_OFF ); +hdmi_wp_set_phy_pwr (&hdmi->wp,HDMI_PHYPWRCMD_OFF ); -dss_pll_disable (&hdmi.pll.pll); +dss_pll_disable (&hdmi->pll.pll); -hdmi_power_off_core (dssdev); +hdmi_power_off_core (hdmi); }static int hdmi_display_check_timing (struct omap_dss_device *dssdev,struct videomode *vm) { -if (!dispc_mgr_timings_ok (hdmi.dss->dispc, dssdev->dispc_channel, vm)) +struct omap_hdmi *hdmi =dssdev_to_hdmi (dssdev); + +if (!dispc_mgr_timings_ok (hdmi->dss->dispc, dssdev->dispc_channel, vm))return -EINVAL ;return 0 ;
@@ -281,67 +282,73 @@ static int hdmi_display_check_timing(struct omap_dss_device *dssdev,static void hdmi_display_set_timing (struct omap_dss_device *dssdev,struct videomode *vm) { -mutex_lock (&hdmi.lock); +struct omap_hdmi *hdmi =dssdev_to_hdmi (dssdev); + +mutex_lock (&hdmi->lock); - hdmi.cfg.vm = *vm; + hdmi->cfg.vm = *vm; -dispc_set_tv_pclk (hdmi.dss->dispc, vm->pixelclock); +dispc_set_tv_pclk (hdmi->dss->dispc, vm->pixelclock); -mutex_unlock (&hdmi.lock); +mutex_unlock (&hdmi->lock); }static void hdmi_display_get_timings (struct omap_dss_device *dssdev,struct videomode *vm) { - *vm = hdmi.cfg.vm; +struct omap_hdmi *hdmi =dssdev_to_hdmi (dssdev); + + *vm = hdmi->cfg.vm; }static int hdmi_dump_regs (struct seq_file *s,void *p) { -mutex_lock (&hdmi.lock); +struct omap_hdmi *hdmi = s->private; + +mutex_lock (&hdmi->lock); -if (hdmi_runtime_get ()) { -mutex_unlock (&hdmi.lock); +if (hdmi_runtime_get (hdmi)) { +mutex_unlock (&hdmi->lock);return 0 ; } -hdmi_wp_dump (&hdmi.wp, s); -hdmi_pll_dump (&hdmi.pll, s); -hdmi_phy_dump (&hdmi.phy, s); -hdmi5_core_dump (&hdmi.core, s); +hdmi_wp_dump (&hdmi->wp, s); +hdmi_pll_dump (&hdmi->pll, s); +hdmi_phy_dump (&hdmi->phy, s); +hdmi5_core_dump (&hdmi->core, s); -hdmi_runtime_put (); -mutex_unlock (&hdmi.lock); +hdmi_runtime_put (hdmi); +mutex_unlock (&hdmi->lock);return 0 ; } -static int read_edid (u8 *buf,int len) +static int read_edid (struct omap_hdmi *hdmi,u8 *buf,int len) {int r;int idlemode; -mutex_lock (&hdmi.lock); +mutex_lock (&hdmi->lock); - r =hdmi_runtime_get (); + r =hdmi_runtime_get (hdmi);BUG_ON (r); - idlemode =REG_GET (hdmi.wp.base,HDMI_WP_SYSCONFIG ,3 ,2 ); + idlemode =REG_GET (hdmi->wp.base,HDMI_WP_SYSCONFIG ,3 ,2 );/* No-idle mode */ -REG_FLD_MOD (hdmi.wp.base,HDMI_WP_SYSCONFIG ,1 ,3 ,2 ); +REG_FLD_MOD (hdmi->wp.base,HDMI_WP_SYSCONFIG ,1 ,3 ,2 ); - r =hdmi5_read_edid (&hdmi.core, buf, len); + r =hdmi5_read_edid (&hdmi->core, buf, len); -REG_FLD_MOD (hdmi.wp.base,HDMI_WP_SYSCONFIG , idlemode,3 ,2 ); +REG_FLD_MOD (hdmi->wp.base,HDMI_WP_SYSCONFIG , idlemode,3 ,2 ); -hdmi_runtime_put (); -mutex_unlock (&hdmi.lock); +hdmi_runtime_put (hdmi); +mutex_unlock (&hdmi->lock);return r; }static void hdmi_start_audio_stream (struct omap_hdmi *hd) { -REG_FLD_MOD (hdmi.wp.base,HDMI_WP_SYSCONFIG ,1 ,3 ,2 ); +REG_FLD_MOD (hd->wp.base,HDMI_WP_SYSCONFIG ,1 ,3 ,2 );hdmi_wp_audio_enable (&hd->wp, true);hdmi_wp_audio_core_req_enable (&hd->wp, true); }
@@ -355,111 +362,114 @@ static void hdmi_stop_audio_stream(struct omap_hdmi *hd)static int hdmi_display_enable (struct omap_dss_device *dssdev) { -struct omap_dss_device *out = &hdmi.output; +struct omap_hdmi *hdmi =dssdev_to_hdmi (dssdev);unsigned long flags;int r =0 ;DSSDBG ("ENTER hdmi_display_enable\n" ); -mutex_lock (&hdmi.lock); +mutex_lock (&hdmi->lock); -if (!out->dispc_channel_connected) { +if (!dssdev->dispc_channel_connected) {DSSERR ("failed to enable display: no output/manager\n" ); r = -ENODEV ; goto err0; } - r =hdmi_power_on_full (dssdev); + r =hdmi_power_on_full (hdmi);if (r) {DSSERR ("failed to power on device\n" ); goto err0; } -if (hdmi.audio_configured) { - r =hdmi5_audio_config (&hdmi.core, &hdmi.wp, &hdmi.audio_config, - hdmi.cfg.vm.pixelclock); +if (hdmi->audio_configured) { + r =hdmi5_audio_config (&hdmi->core, &hdmi->wp, + &hdmi->audio_config, + hdmi->cfg.vm.pixelclock);if (r) {DSSERR ("Error restoring audio configuration: %d" , r); - hdmi.audio_abort_cb (&hdmi.pdev->dev); - hdmi.audio_configured = false; + hdmi->audio_abort_cb (&hdmi->pdev->dev); + hdmi->audio_configured = false; } } -spin_lock_irqsave (&hdmi.audio_playing_lock, flags); -if (hdmi.audio_configured && hdmi.audio_playing) -hdmi_start_audio_stream (&hdmi); - hdmi.display_enabled = true; -spin_unlock_irqrestore (&hdmi.audio_playing_lock, flags); +spin_lock_irqsave (&hdmi->audio_playing_lock, flags); +if (hdmi->audio_configured && hdmi->audio_playing) +hdmi_start_audio_stream (hdmi); + hdmi->display_enabled = true; +spin_unlock_irqrestore (&hdmi->audio_playing_lock, flags); -mutex_unlock (&hdmi.lock); +mutex_unlock (&hdmi->lock);return 0 ; err0: -mutex_unlock (&hdmi.lock); +mutex_unlock (&hdmi->lock);return r; }static void hdmi_display_disable (struct omap_dss_device *dssdev) { +struct omap_hdmi *hdmi =dssdev_to_hdmi (dssdev);unsigned long flags;DSSDBG ("Enter hdmi_display_disable\n" ); -mutex_lock (&hdmi.lock); +mutex_lock (&hdmi->lock); -spin_lock_irqsave (&hdmi.audio_playing_lock, flags); -hdmi_stop_audio_stream (&hdmi); - hdmi.display_enabled = false; -spin_unlock_irqrestore (&hdmi.audio_playing_lock, flags); +spin_lock_irqsave (&hdmi->audio_playing_lock, flags); +hdmi_stop_audio_stream (hdmi); + hdmi->display_enabled = false; +spin_unlock_irqrestore (&hdmi->audio_playing_lock, flags); -hdmi_power_off_full (dssdev); +hdmi_power_off_full (hdmi); -mutex_unlock (&hdmi.lock); +mutex_unlock (&hdmi->lock); } -static int hdmi_core_enable (struct omap_dss_device *dssdev) +static int hdmi_core_enable (struct omap_hdmi *hdmi) {int r =0 ;DSSDBG ("ENTER omapdss_hdmi_core_enable\n" ); -mutex_lock (&hdmi.lock); +mutex_lock (&hdmi->lock); - r =hdmi_power_on_core (dssdev); + r =hdmi_power_on_core (hdmi);if (r) {DSSERR ("failed to power on device\n" ); goto err0; } -mutex_unlock (&hdmi.lock); +mutex_unlock (&hdmi->lock);return 0 ; err0: -mutex_unlock (&hdmi.lock); +mutex_unlock (&hdmi->lock);return r; } -static void hdmi_core_disable (struct omap_dss_device *dssdev) +static void hdmi_core_disable (struct omap_hdmi *hdmi) {DSSDBG ("Enter omapdss_hdmi_core_disable\n" ); -mutex_lock (&hdmi.lock); +mutex_lock (&hdmi->lock); -hdmi_power_off_core (dssdev); +hdmi_power_off_core (hdmi); -mutex_unlock (&hdmi.lock); +mutex_unlock (&hdmi->lock); }static int hdmi_connect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { +struct omap_hdmi *hdmi =dssdev_to_hdmi (dssdev);int r; - r =hdmi_init_regulator (); + r =hdmi_init_regulator (hdmi);if (r)return r; - r =dss_mgr_connect (&hdmi.output, dssdev); + r =dss_mgr_connect (&hdmi->output, dssdev);if (r)return r;
@@ -467,7 +477,7 @@ static int hdmi_connect(struct omap_dss_device *dssdev,if (r) {DSSERR ("failed to connect output to new device: %s\n" , dst->name); -dss_mgr_disconnect (&hdmi.output, dssdev); +dss_mgr_disconnect (&hdmi->output, dssdev);return r; }
@@ -477,6 +487,8 @@ static int hdmi_connect(struct omap_dss_device *dssdev,static void hdmi_disconnect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { +struct omap_hdmi *hdmi =dssdev_to_hdmi (dssdev); +WARN_ON (dst != dssdev->dst);if (dst != dssdev->dst)
@@ -484,27 +496,28 @@ static void hdmi_disconnect(struct omap_dss_device *dssdev,omapdss_output_unset_device (dssdev); -dss_mgr_disconnect (&hdmi.output, dssdev); +dss_mgr_disconnect (&hdmi->output, dssdev); }static int hdmi_read_edid (struct omap_dss_device *dssdev,u8 *edid,int len) { +struct omap_hdmi *hdmi =dssdev_to_hdmi (dssdev);bool need_enable;int r; - need_enable = hdmi.core_enabled == false; + need_enable = hdmi->core_enabled == false;if (need_enable) { - r =hdmi_core_enable (dssdev); + r =hdmi_core_enable (hdmi);if (r)return r; } - r =read_edid (edid, len); + r =read_edid (hdmi, edid, len);if (need_enable) -hdmi_core_disable (dssdev); +hdmi_core_disable (hdmi);return r; }
@@ -512,14 +525,18 @@ static int hdmi_read_edid(struct omap_dss_device *dssdev,static int hdmi_set_infoframe (struct omap_dss_device *dssdev,const struct hdmi_avi_infoframe *avi) { - hdmi.cfg.infoframe = *avi; +struct omap_hdmi *hdmi =dssdev_to_hdmi (dssdev); + + hdmi->cfg.infoframe = *avi;return 0 ; }static int hdmi_set_hdmi_mode (struct omap_dss_device *dssdev,bool hdmi_mode) { - hdmi.cfg.hdmi_dvi_mode = hdmi_mode ?HDMI_HDMI :HDMI_DVI ; +struct omap_hdmi *hdmi =dssdev_to_hdmi (dssdev); + + hdmi->cfg.hdmi_dvi_mode = hdmi_mode ?HDMI_HDMI :HDMI_DVI ;return 0 ; }
@@ -539,11 +556,11 @@ static const struct omapdss_hdmi_ops hdmi_ops = { .set_hdmi_mode = hdmi_set_hdmi_mode, }; -static void hdmi_init_output (struct platform_device *pdev) +static void hdmi_init_output (struct omap_hdmi *hdmi) { -struct omap_dss_device *out = &hdmi.output; +struct omap_dss_device *out = &hdmi->output; - out->dev = &pdev->dev; + out->dev = &hdmi->pdev->dev; out->id =OMAP_DSS_OUTPUT_HDMI ; out->output_type =OMAP_DISPLAY_TYPE_HDMI ; out->name ="hdmi.0" ;
@@ -554,15 +571,16 @@ static void hdmi_init_output(struct platform_device *pdev)omapdss_register_output (out); } -static void hdmi_uninit_output (struct platform_device *pdev) +static void hdmi_uninit_output (struct omap_hdmi *hdmi) { -struct omap_dss_device *out = &hdmi.output; +struct omap_dss_device *out = &hdmi->output;omapdss_unregister_output (out); } -static int hdmi_probe_of (struct platform_device *pdev) +static int hdmi_probe_of (struct omap_hdmi *hdmi) { +struct platform_device *pdev = hdmi->pdev;struct device_node *node = pdev->dev.of_node;struct device_node *ep;int r;
@@ -571,7 +589,7 @@ static int hdmi_probe_of(struct platform_device *pdev)if (!ep)return 0 ; - r =hdmi_parse_lanes_of (pdev, ep, &hdmi.phy); + r =hdmi_parse_lanes_of (pdev, ep, &hdmi->phy);if (r) goto err;
@@ -685,26 +703,26 @@ static const struct omap_hdmi_audio_ops hdmi_audio_ops = { .audio_config = hdmi_audio_config, }; -static int hdmi_audio_register (struct device *dev) +static int hdmi_audio_register (struct omap_hdmi *hdmi) {struct omap_hdmi_audio_pdata pdata = { - .dev = dev, + .dev = &hdmi->pdev->dev, .version =5 , - .audio_dma_addr =hdmi_wp_get_audio_dma_addr (&hdmi.wp), + .audio_dma_addr =hdmi_wp_get_audio_dma_addr (&hdmi->wp), .ops = &hdmi_audio_ops, }; - hdmi.audio_pdev =platform_device_register_data ( - dev,"omap-hdmi-audio" ,PLATFORM_DEVID_AUTO , + hdmi->audio_pdev =platform_device_register_data ( + &hdmi->pdev->dev,"omap-hdmi-audio" ,PLATFORM_DEVID_AUTO , &pdata,sizeof (pdata)); -if (IS_ERR (hdmi.audio_pdev)) -return PTR_ERR (hdmi.audio_pdev); +if (IS_ERR (hdmi->audio_pdev)) +return PTR_ERR (hdmi->audio_pdev); -hdmi_runtime_get (); - hdmi.wp_idlemode = -REG_GET (hdmi.wp.base,HDMI_WP_SYSCONFIG ,3 ,2 ); -hdmi_runtime_put (); +hdmi_runtime_get (hdmi); + hdmi->wp_idlemode = +REG_GET (hdmi->wp.base,HDMI_WP_SYSCONFIG ,3 ,2 ); +hdmi_runtime_put (hdmi);return 0 ; }
@@ -714,86 +732,96 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data) {struct platform_device *pdev =to_platform_device (dev);struct dss_device *dss =dss_get_device (master); +struct omap_hdmi *hdmi;int r;int irq; - hdmi.pdev = pdev; - hdmi.dss = dss; -dev_set_drvdata (&pdev->dev, &hdmi); + hdmi =kzalloc (sizeof (*hdmi),GFP_KERNEL ); +if (!hdmi) +return -ENOMEM ; + + hdmi->pdev = pdev; + hdmi->dss = dss; +dev_set_drvdata (&pdev->dev, hdmi); -mutex_init (&hdmi.lock); -spin_lock_init (&hdmi.audio_playing_lock); +mutex_init (&hdmi->lock); +spin_lock_init (&hdmi->audio_playing_lock); - r =hdmi_probe_of (pdev); + r =hdmi_probe_of (hdmi);if (r) -return r; + goto err_free; - r =hdmi_wp_init (pdev, &hdmi.wp,5 ); + r =hdmi_wp_init (pdev, &hdmi->wp,5 );if (r) -return r; + goto err_free; - r =hdmi_pll_init (dss, pdev, &hdmi.pll, &hdmi.wp); + r =hdmi_pll_init (dss, pdev, &hdmi->pll, &hdmi->wp);if (r) -return r; + goto err_free; - r =hdmi_phy_init (pdev, &hdmi.phy,5 ); + r =hdmi_phy_init (pdev, &hdmi->phy,5 );if (r) - goto err; + goto err_pll; - r =hdmi5_core_init (pdev, &hdmi.core); + r =hdmi5_core_init (pdev, &hdmi->core);if (r) - goto err; + goto err_pll; irq =platform_get_irq (pdev,0 );if (irq <0 ) {DSSERR ("platform_get_irq failed\n" ); r = -ENODEV ; - goto err; + goto err_pll; } r =devm_request_threaded_irq (&pdev->dev, irq,NULL , hdmi_irq_handler, -IRQF_ONESHOT ,"OMAP HDMI" , &hdmi.wp); +IRQF_ONESHOT ,"OMAP HDMI" , hdmi);if (r) {DSSERR ("HDMI IRQ request failed\n" ); - goto err; + goto err_pll; }pm_runtime_enable (&pdev->dev); -hdmi_init_output (pdev); +hdmi_init_output (hdmi); - r =hdmi_audio_register (&pdev->dev); + r =hdmi_audio_register (hdmi);if (r) {DSSERR ("Registering HDMI audio failed %d\n" , r); -hdmi_uninit_output (pdev); +hdmi_uninit_output (hdmi);pm_runtime_disable (&pdev->dev);return r; } - hdmi.debugfs =dss_debugfs_create_file (dss,"hdmi" , hdmi_dump_regs, - &hdmi); + hdmi->debugfs =dss_debugfs_create_file (dss,"hdmi" , hdmi_dump_regs, + hdmi);return 0 ; -err: -hdmi_pll_uninit (&hdmi.pll); + +err_pll: +hdmi_pll_uninit (&hdmi->pll); +err_free: +kfree (hdmi);return r; }static void hdmi5_unbind (struct device *dev,struct device *master,void *data) { -struct platform_device *pdev =to_platform_device (dev); +struct omap_hdmi *hdmi =dev_get_drvdata (dev); + +dss_debugfs_remove_file (hdmi->debugfs); -dss_debugfs_remove_file (hdmi.debugfs); +if (hdmi->audio_pdev) +platform_device_unregister (hdmi->audio_pdev); -if (hdmi.audio_pdev) -platform_device_unregister (hdmi.audio_pdev); +hdmi_uninit_output (hdmi); -hdmi_uninit_output (pdev); +hdmi_pll_uninit (&hdmi->pll); -hdmi_pll_uninit (&hdmi.pll); +pm_runtime_disable (dev); -pm_runtime_disable (&pdev->dev); +kfree (hdmi); }static const struct component_ops hdmi5_component_ops = {
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 29/30 drm: omapdrm: sdi: Allocate the sdi private data structure dynamically
In reply to Laurent PinchartThe sdi private data structure is currently stored as a global variable. While no platform with multiple SDI encoders currently exists nor is planned, this doesn't comply with the kernel device model and should thus be fixed.
--- drivers/gpu/drm/omapdrm/dss/sdi.c | 151 ++++++++++++++++++++++---------------- 1 file changed, 86 insertions(+), 65 deletions(-)
drivers/gpu/drm/omapdrm/dss/sdi.c +86 -65
@@ -29,7 +29,7 @@#include "omapdss.h" #include "dss.h" -static struct { +struct sdi_device {struct platform_device *pdev;struct dss_device *dss;
@@ -41,11 +41,12 @@ static struct {int datapairs;struct omap_dss_device output; +}; -bool port_initialized; -} sdi; +#define dssdev_to_sdi (dssdev) container_of(dssdev, struct sdi_device, output)struct sdi_clk_calc_ctx { +struct sdi_device *sdi;unsigned long pck_min, pck_max;unsigned long fck;
@@ -71,17 +72,17 @@ static bool dpi_calc_dss_cb(unsigned long fck, void *data) ctx->fck = fck; -return dispc_div_calc (sdi.dss->dispc, fck, +return dispc_div_calc (ctx->sdi->dss->dispc, fck, ctx->pck_min, ctx->pck_max, dpi_calc_dispc_cb, ctx); } -static int sdi_calc_clock_div (unsigned long pclk, -unsigned long *fck, -struct dispc_clock_info *dispc_cinfo) +static int sdi_calc_clock_div (struct sdi_device *sdi,unsigned long pclk, +unsigned long *fck, +struct dispc_clock_info *dispc_cinfo) {int i; -struct sdi_clk_calc_ctx ctx; +struct sdi_clk_calc_ctx ctx = { .sdi = sdi };/* * DSS fclk gives us very few possibilities, so finding a good pixel
@@ -100,7 +101,7 @@ static int sdi_calc_clock_div(unsigned long pclk, ctx.pck_min =0 ; ctx.pck_max = pclk +1000 * i * i * i; - ok =dss_div_calc (sdi.dss, pclk, ctx.pck_min, + ok =dss_div_calc (sdi->dss, pclk, ctx.pck_min, dpi_calc_dss_cb, &ctx);if (ok) { *fck = ctx.fck;
@@ -112,48 +113,49 @@ static int sdi_calc_clock_div(unsigned long pclk,return -EINVAL ; } -static void sdi_config_lcd_manager (struct omap_dss_device *dssdev) +static void sdi_config_lcd_manager (struct sdi_device *sdi) { - sdi.mgr_config.io_pad_mode =DSS_IO_PAD_MODE_BYPASS ; + sdi->mgr_config.io_pad_mode =DSS_IO_PAD_MODE_BYPASS ; - sdi.mgr_config.stallmode = false; - sdi.mgr_config.fifohandcheck = false; + sdi->mgr_config.stallmode = false; + sdi->mgr_config.fifohandcheck = false; - sdi.mgr_config.video_port_width =24 ; - sdi.mgr_config.lcden_sig_polarity =1 ; + sdi->mgr_config.video_port_width =24 ; + sdi->mgr_config.lcden_sig_polarity =1 ; -dss_mgr_set_lcd_config (&sdi.output, &sdi.mgr_config); +dss_mgr_set_lcd_config (&sdi->output, &sdi->mgr_config); }static int sdi_display_enable (struct omap_dss_device *dssdev) { -struct videomode *vm = &sdi.vm; +struct sdi_device *sdi =dssdev_to_sdi (dssdev); +struct videomode *vm = &sdi->vm;unsigned long fck;struct dispc_clock_info dispc_cinfo;unsigned long pck;int r; -if (!sdi.output.dispc_channel_connected) { +if (!sdi->output.dispc_channel_connected) {DSSERR ("failed to enable display: no output/manager\n" );return -ENODEV ; } - r =regulator_enable (sdi.vdds_sdi_reg); + r =regulator_enable (sdi->vdds_sdi_reg);if (r) goto err_reg_enable; - r =dispc_runtime_get (sdi.dss->dispc); + r =dispc_runtime_get (sdi->dss->dispc);if (r) goto err_get_dispc;/* 15.5.9.1.2 */ vm->flags |=DISPLAY_FLAGS_PIXDATA_POSEDGE |DISPLAY_FLAGS_SYNC_POSEDGE ; - r =sdi_calc_clock_div (vm->pixelclock, &fck, &dispc_cinfo); + r =sdi_calc_clock_div (sdi, vm->pixelclock, &fck, &dispc_cinfo);if (r) goto err_calc_clock_div; - sdi.mgr_config.clock_info = dispc_cinfo; + sdi->mgr_config.clock_info = dispc_cinfo; pck = fck / dispc_cinfo.lck_div / dispc_cinfo.pck_div;
@@ -165,13 +167,13 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) } -dss_mgr_set_timings (&sdi.output, vm); +dss_mgr_set_timings (&sdi->output, vm); - r =dss_set_fck_rate (sdi.dss, fck); + r =dss_set_fck_rate (sdi->dss, fck);if (r) goto err_set_dss_clock_div; -sdi_config_lcd_manager (dssdev); +sdi_config_lcd_manager (sdi);/* * LCLK and PCLK divisors are located in shadow registers, and we
@@ -184,62 +186,69 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)* need to care about the shadow register mechanism for pck-free. The * exact reason for this is unknown. */ -dispc_mgr_set_clock_div (sdi.dss->dispc, sdi.output.dispc_channel, - &sdi.mgr_config.clock_info); +dispc_mgr_set_clock_div (sdi->dss->dispc, sdi->output.dispc_channel, + &sdi->mgr_config.clock_info); -dss_sdi_init (sdi.dss, sdi.datapairs); - r =dss_sdi_enable (sdi.dss); +dss_sdi_init (sdi->dss, sdi->datapairs); + r =dss_sdi_enable (sdi->dss);if (r) goto err_sdi_enable;mdelay (2 ); - r =dss_mgr_enable (&sdi.output); + r =dss_mgr_enable (&sdi->output);if (r) goto err_mgr_enable;return 0 ; err_mgr_enable: -dss_sdi_disable (sdi.dss); +dss_sdi_disable (sdi->dss); err_sdi_enable: err_set_dss_clock_div: err_calc_clock_div: -dispc_runtime_put (sdi.dss->dispc); +dispc_runtime_put (sdi->dss->dispc); err_get_dispc: -regulator_disable (sdi.vdds_sdi_reg); +regulator_disable (sdi->vdds_sdi_reg); err_reg_enable:return r; }static void sdi_display_disable (struct omap_dss_device *dssdev) { -dss_mgr_disable (&sdi.output); +struct sdi_device *sdi =dssdev_to_sdi (dssdev); + +dss_mgr_disable (&sdi->output); -dss_sdi_disable (sdi.dss); +dss_sdi_disable (sdi->dss); -dispc_runtime_put (sdi.dss->dispc); +dispc_runtime_put (sdi->dss->dispc); -regulator_disable (sdi.vdds_sdi_reg); +regulator_disable (sdi->vdds_sdi_reg); }static void sdi_set_timings (struct omap_dss_device *dssdev,struct videomode *vm) { - sdi.vm = *vm; +struct sdi_device *sdi =dssdev_to_sdi (dssdev); + + sdi->vm = *vm; }static void sdi_get_timings (struct omap_dss_device *dssdev,struct videomode *vm) { - *vm = sdi.vm; +struct sdi_device *sdi =dssdev_to_sdi (dssdev); + + *vm = sdi->vm; }static int sdi_check_timings (struct omap_dss_device *dssdev,struct videomode *vm) { +struct sdi_device *sdi =dssdev_to_sdi (dssdev);enum omap_channel channel = dssdev->dispc_channel; -if (!dispc_mgr_timings_ok (sdi.dss->dispc, channel, vm)) +if (!dispc_mgr_timings_ok (sdi->dss->dispc, channel, vm))return -EINVAL ;if (vm->pixelclock ==0 )
@@ -248,21 +257,21 @@ static int sdi_check_timings(struct omap_dss_device *dssdev,return 0 ; } -static int sdi_init_regulator (void ) +static int sdi_init_regulator (struct sdi_device *sdi) {struct regulator *vdds_sdi; -if (sdi.vdds_sdi_reg) +if (sdi->vdds_sdi_reg)return 0 ; - vdds_sdi =devm_regulator_get (&sdi.pdev->dev,"vdds_sdi" ); + vdds_sdi =devm_regulator_get (&sdi->pdev->dev,"vdds_sdi" );if (IS_ERR (vdds_sdi)) {if (PTR_ERR (vdds_sdi) != -EPROBE_DEFER )DSSERR ("can't get VDDS_SDI regulator\n" );return PTR_ERR (vdds_sdi); } - sdi.vdds_sdi_reg = vdds_sdi; + sdi->vdds_sdi_reg = vdds_sdi;return 0 ; }
@@ -270,13 +279,14 @@ static int sdi_init_regulator(void)static int sdi_connect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { +struct sdi_device *sdi =dssdev_to_sdi (dssdev);int r; - r =sdi_init_regulator (); + r =sdi_init_regulator (sdi);if (r)return r; - r =dss_mgr_connect (&sdi.output, dssdev); + r =dss_mgr_connect (&sdi->output, dssdev);if (r)return r;
@@ -284,7 +294,7 @@ static int sdi_connect(struct omap_dss_device *dssdev,if (r) {DSSERR ("failed to connect output to new device: %s\n" , dst->name); -dss_mgr_disconnect (&sdi.output, dssdev); +dss_mgr_disconnect (&sdi->output, dssdev);return r; }
@@ -294,6 +304,8 @@ static int sdi_connect(struct omap_dss_device *dssdev,static void sdi_disconnect (struct omap_dss_device *dssdev,struct omap_dss_device *dst) { +struct sdi_device *sdi =dssdev_to_sdi (dssdev); +WARN_ON (dst != dssdev->dst);if (dst != dssdev->dst)
@@ -301,7 +313,7 @@ static void sdi_disconnect(struct omap_dss_device *dssdev,omapdss_output_unset_device (dssdev); -dss_mgr_disconnect (&sdi.output, dssdev); +dss_mgr_disconnect (&sdi->output, dssdev); }static const struct omapdss_sdi_ops sdi_ops = {
@@ -316,11 +328,11 @@ static const struct omapdss_sdi_ops sdi_ops = { .get_timings = sdi_get_timings, }; -static void sdi_init_output (struct platform_device *pdev) +static void sdi_init_output (struct sdi_device *sdi) { -struct omap_dss_device *out = &sdi.output; +struct omap_dss_device *out = &sdi->output; - out->dev = &pdev->dev; + out->dev = &sdi->pdev->dev; out->id =OMAP_DSS_OUTPUT_SDI ; out->output_type =OMAP_DISPLAY_TYPE_SDI ; out->name ="sdi.0" ;
@@ -333,23 +345,28 @@ static void sdi_init_output(struct platform_device *pdev)omapdss_register_output (out); } -static void sdi_uninit_output (struct platform_device *pdev) +static void sdi_uninit_output (struct sdi_device *sdi) { -struct omap_dss_device *out = &sdi.output; - -omapdss_unregister_output (out); +omapdss_unregister_output (&sdi->output); }int sdi_init_port (struct dss_device *dss,struct platform_device *pdev,struct device_node *port) { +struct sdi_device *sdi;struct device_node *ep;u32 datapairs;int r; + sdi =kzalloc (sizeof (*sdi),GFP_KERNEL ); +if (!sdi) +return -ENOMEM ; + ep =of_get_next_child (port,NULL ); -if (!ep) -return 0 ; +if (!ep) { + r =0 ; + goto err_free; + } r =of_property_read_u32 (ep,"datapairs" , &datapairs);if (r) {
@@ -357,29 +374,33 @@ int sdi_init_port(struct dss_device *dss, struct platform_device *pdev, goto err_datapairs; } - sdi.datapairs = datapairs; - sdi.dss = dss; + sdi->datapairs = datapairs; + sdi->dss = dss;of_node_put (ep); - sdi.pdev = pdev; + sdi->pdev = pdev; + port->data = sdi; -sdi_init_output (pdev); - - sdi.port_initialized = true; +sdi_init_output (sdi);return 0 ; err_datapairs:of_node_put (ep); +err_free: +kfree (sdi);return r; }void sdi_uninit_port (struct device_node *port) { -if (!sdi.port_initialized) +struct sdi_device *sdi = port->data; + +if (!sdi)return ; -sdi_uninit_output (sdi.pdev); +sdi_uninit_output (sdi); +kfree (sdi); }
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel