OMAPDSS: move the creation of debugfs files
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 2 Mar 2012 16:01:07 +0000 (18:01 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 11 May 2012 11:44:52 +0000 (14:44 +0300)
Instead of having an ugly #ifdef mess in the core.c for creating debugfs
files, add a dss_debugfs_create_file() function that the dss drivers
can use to create the debugfs files.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/omap2/dss/core.c
drivers/video/omap2/dss/dispc.c
drivers/video/omap2/dss/dsi.c
drivers/video/omap2/dss/dss.c
drivers/video/omap2/dss/dss.h
drivers/video/omap2/dss/hdmi.c
drivers/video/omap2/dss/rfbi.c
drivers/video/omap2/dss/venc.c

index 2a0cbaeed211da4dd7c139cf7e2f37a34f8d6579..c54bba04cb00d75c998be7f7d3e0707725dad607 100644 (file)
@@ -166,34 +166,6 @@ static int dss_initialize_debugfs(void)
        debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir,
                        &dss_debug_dump_clocks, &dss_debug_fops);
 
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
-       debugfs_create_file("dispc_irq", S_IRUGO, dss_debugfs_dir,
-                       &dispc_dump_irqs, &dss_debug_fops);
-#endif
-
-#if defined(CONFIG_OMAP2_DSS_DSI) && defined(CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS)
-       dsi_create_debugfs_files_irq(dss_debugfs_dir, &dss_debug_fops);
-#endif
-
-       debugfs_create_file("dss", S_IRUGO, dss_debugfs_dir,
-                       &dss_dump_regs, &dss_debug_fops);
-       debugfs_create_file("dispc", S_IRUGO, dss_debugfs_dir,
-                       &dispc_dump_regs, &dss_debug_fops);
-#ifdef CONFIG_OMAP2_DSS_RFBI
-       debugfs_create_file("rfbi", S_IRUGO, dss_debugfs_dir,
-                       &rfbi_dump_regs, &dss_debug_fops);
-#endif
-#ifdef CONFIG_OMAP2_DSS_DSI
-       dsi_create_debugfs_files_reg(dss_debugfs_dir, &dss_debug_fops);
-#endif
-#ifdef CONFIG_OMAP2_DSS_VENC
-       debugfs_create_file("venc", S_IRUGO, dss_debugfs_dir,
-                       &venc_dump_regs, &dss_debug_fops);
-#endif
-#ifdef CONFIG_OMAP4_DSS_HDMI
-       debugfs_create_file("hdmi", S_IRUGO, dss_debugfs_dir,
-                       &hdmi_dump_regs, &dss_debug_fops);
-#endif
        return 0;
 }
 
@@ -202,6 +174,19 @@ static void dss_uninitialize_debugfs(void)
        if (dss_debugfs_dir)
                debugfs_remove_recursive(dss_debugfs_dir);
 }
+
+int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *))
+{
+       struct dentry *d;
+
+       d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir,
+                       write, &dss_debug_fops);
+
+       if (IS_ERR(d))
+               return PTR_ERR(d);
+
+       return 0;
+}
 #else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
 static inline int dss_initialize_debugfs(void)
 {
@@ -210,6 +195,11 @@ static inline int dss_initialize_debugfs(void)
 static inline void dss_uninitialize_debugfs(void)
 {
 }
+static inline int dss_debugfs_create_file(const char *name,
+               void (*write)(struct seq_file *))
+{
+       return 0;
+}
 #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
 
 /* PLATFORM DEVICE */
index 25707732cb68ad2abb9efd4cdb6c105bcb41f6cd..534f931229cd4a9434dea8d481b7edde895aa89a 100644 (file)
@@ -2761,7 +2761,7 @@ void dispc_dump_irqs(struct seq_file *s)
 }
 #endif
 
-void dispc_dump_regs(struct seq_file *s)
+static void dispc_dump_regs(struct seq_file *s)
 {
        int i, j;
        const char *mgr_names[] = {
@@ -3551,6 +3551,11 @@ static int omap_dispchw_probe(struct platform_device *pdev)
 
        dispc_runtime_put();
 
+       dss_debugfs_create_file("dispc", dispc_dump_regs);
+
+#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
+       dss_debugfs_create_file("dispc_irq", dispc_dump_irqs);
+#endif
        return 0;
 
 err_runtime_get:
index 9fdeb213198765af9cb11c46f9d47086539d09d9..d5d80f92ce35c8c1dcd8a5a3121b6d1c6c9bff7e 100644 (file)
@@ -1852,22 +1852,6 @@ static void dsi2_dump_irqs(struct seq_file *s)
 
        dsi_dump_dsidev_irqs(dsidev, s);
 }
-
-void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir,
-               const struct file_operations *debug_fops)
-{
-       struct platform_device *dsidev;
-
-       dsidev = dsi_get_dsidev_from_id(0);
-       if (dsidev)
-               debugfs_create_file("dsi1_irqs", S_IRUGO, debugfs_dir,
-                       &dsi1_dump_irqs, debug_fops);
-
-       dsidev = dsi_get_dsidev_from_id(1);
-       if (dsidev)
-               debugfs_create_file("dsi2_irqs", S_IRUGO, debugfs_dir,
-                       &dsi2_dump_irqs, debug_fops);
-}
 #endif
 
 static void dsi_dump_dsidev_regs(struct platform_device *dsidev,
@@ -1968,21 +1952,6 @@ static void dsi2_dump_regs(struct seq_file *s)
        dsi_dump_dsidev_regs(dsidev, s);
 }
 
-void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir,
-               const struct file_operations *debug_fops)
-{
-       struct platform_device *dsidev;
-
-       dsidev = dsi_get_dsidev_from_id(0);
-       if (dsidev)
-               debugfs_create_file("dsi1_regs", S_IRUGO, debugfs_dir,
-                       &dsi1_dump_regs, debug_fops);
-
-       dsidev = dsi_get_dsidev_from_id(1);
-       if (dsidev)
-               debugfs_create_file("dsi2_regs", S_IRUGO, debugfs_dir,
-                       &dsi2_dump_regs, debug_fops);
-}
 enum dsi_cio_power_state {
        DSI_COMPLEXIO_POWER_OFF         = 0x0,
        DSI_COMPLEXIO_POWER_ON          = 0x1,
@@ -4733,6 +4702,17 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
 
        dsi_runtime_put(dsidev);
 
+       if (dsi_module == 0)
+               dss_debugfs_create_file("dsi1_regs", dsi1_dump_regs);
+       else if (dsi_module == 1)
+               dss_debugfs_create_file("dsi2_regs", dsi2_dump_regs);
+
+#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
+       if (dsi_module == 0)
+               dss_debugfs_create_file("dsi1_irqs", dsi1_dump_irqs);
+       else if (dsi_module == 1)
+               dss_debugfs_create_file("dsi2_irqs", dsi2_dump_irqs);
+#endif
        return 0;
 
 err_runtime_get:
index 900002a6c7ddf40b5f913d76ec6faa955818bec2..08bee78191d68e6e80d16668979297ca1c8ee6ac 100644 (file)
@@ -280,7 +280,7 @@ void dss_dump_clocks(struct seq_file *s)
        dss_runtime_put();
 }
 
-void dss_dump_regs(struct seq_file *s)
+static void dss_dump_regs(struct seq_file *s)
 {
 #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dss_read_reg(r))
 
@@ -795,6 +795,8 @@ static int omap_dsshw_probe(struct platform_device *pdev)
 
        dss_runtime_put();
 
+       dss_debugfs_create_file("dss", dss_dump_regs);
+
        return 0;
 
 err_runtime_get:
index ce0feb17c6421689c4d1aeca61639ec5fc28a6e6..5faddf06aa0b7f0857f6a54b422996acac6e1cdf 100644 (file)
@@ -163,6 +163,7 @@ int dss_get_ctx_loss_count(struct device *dev);
 int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask);
 void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask);
 int dss_set_min_bus_tput(struct device *dev, unsigned long tput);
+int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *));
 
 /* apply */
 void dss_apply_init(void);
@@ -238,7 +239,6 @@ enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void);
 const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src);
 void dss_dump_clocks(struct seq_file *s);
 
-void dss_dump_regs(struct seq_file *s);
 #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
 void dss_debug_dump_clocks(struct seq_file *s);
 #endif
@@ -285,10 +285,6 @@ int dsi_runtime_get(struct platform_device *dsidev);
 void dsi_runtime_put(struct platform_device *dsidev);
 
 void dsi_dump_clocks(struct seq_file *s);
-void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir,
-               const struct file_operations *debug_fops);
-void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir,
-               const struct file_operations *debug_fops);
 
 int dsi_init_display(struct omap_dss_device *display);
 void dsi_irq_handler(void);
@@ -371,8 +367,6 @@ int dpi_init_display(struct omap_dss_device *dssdev);
 int dispc_init_platform_driver(void);
 void dispc_uninit_platform_driver(void);
 void dispc_dump_clocks(struct seq_file *s);
-void dispc_dump_irqs(struct seq_file *s);
-void dispc_dump_regs(struct seq_file *s);
 void dispc_irq_handler(void);
 
 int dispc_runtime_get(void);
@@ -438,7 +432,6 @@ void dispc_mgr_setup(enum omap_channel channel,
 #ifdef CONFIG_OMAP2_DSS_VENC
 int venc_init_platform_driver(void);
 void venc_uninit_platform_driver(void);
-void venc_dump_regs(struct seq_file *s);
 int venc_init_display(struct omap_dss_device *display);
 unsigned long venc_get_pixel_clock(void);
 #else
@@ -455,7 +448,6 @@ int hdmi_init_platform_driver(void);
 void hdmi_uninit_platform_driver(void);
 int hdmi_init_display(struct omap_dss_device *dssdev);
 unsigned long hdmi_get_pixel_clock(void);
-void hdmi_dump_regs(struct seq_file *s);
 #else
 static inline int hdmi_init_display(struct omap_dss_device *dssdev)
 {
@@ -480,7 +472,6 @@ void hdmi_panel_exit(void);
 /* RFBI */
 int rfbi_init_platform_driver(void);
 void rfbi_uninit_platform_driver(void);
-void rfbi_dump_regs(struct seq_file *s);
 int rfbi_init_display(struct omap_dss_device *display);
 
 
index 45e98419d95288812b489cad5dc132f99e996ed0..e0ab10808a7859b1a5b6cad4d4fc7628ca23eea5 100644 (file)
@@ -420,7 +420,7 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev)
        }
 }
 
-void hdmi_dump_regs(struct seq_file *s)
+static void hdmi_dump_regs(struct seq_file *s)
 {
        mutex_lock(&hdmi.lock);
 
@@ -810,6 +810,8 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
 
        hdmi_panel_init();
 
+       dss_debugfs_create_file("hdmi", hdmi_dump_regs);
+
 #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
        defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
 
index c5e69068489dcd5709b78f03dde337a1a2baed0c..6adbea97332ecbda2318f0d9a4b0bc537d9766e0 100644 (file)
@@ -819,7 +819,7 @@ int omap_rfbi_update(struct omap_dss_device *dssdev,
 }
 EXPORT_SYMBOL(omap_rfbi_update);
 
-void rfbi_dump_regs(struct seq_file *s)
+static void rfbi_dump_regs(struct seq_file *s)
 {
 #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, rfbi_read_reg(r))
 
@@ -976,6 +976,8 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
 
        rfbi_runtime_put();
 
+       dss_debugfs_create_file("rfbi", rfbi_dump_regs);
+
        return 0;
 
 err_runtime_get:
index 90b57c5317bf70ab93c2ed91e4100196ca3e6c38..ebb6ec60e9a86ab55a831207f49352cfe61f7e53 100644 (file)
@@ -745,7 +745,7 @@ int venc_init_display(struct omap_dss_device *dssdev)
        return 0;
 }
 
-void venc_dump_regs(struct seq_file *s)
+static void venc_dump_regs(struct seq_file *s)
 {
 #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, venc_read_reg(r))
 
@@ -874,6 +874,8 @@ static int omap_venchw_probe(struct platform_device *pdev)
        if (r)
                goto err_reg_panel_driver;
 
+       dss_debugfs_create_file("venc", venc_dump_regs);
+
        return 0;
 
 err_reg_panel_driver:
This page took 0.041992 seconds and 5 git commands to generate.