aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-03-02 11:01:07 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-05-11 07:44:52 -0400
commite40402cf182e798fd71824f4ad02fb51ce599bb2 (patch)
tree2b3c87838f5f53a4eb7e74738f6d792ab64d1c8d /drivers/video
parent461395c464e559a01cbc66d97ed4b8585b437cf9 (diff)
OMAPDSS: move the creation of debugfs files
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>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/dss/core.c46
-rw-r--r--drivers/video/omap2/dss/dispc.c7
-rw-r--r--drivers/video/omap2/dss/dsi.c42
-rw-r--r--drivers/video/omap2/dss/dss.c4
-rw-r--r--drivers/video/omap2/dss/dss.h11
-rw-r--r--drivers/video/omap2/dss/hdmi.c4
-rw-r--r--drivers/video/omap2/dss/rfbi.c4
-rw-r--r--drivers/video/omap2/dss/venc.c4
8 files changed, 48 insertions, 74 deletions
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 2a0cbaeed21..c54bba04cb0 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -166,34 +166,6 @@ static int dss_initialize_debugfs(void)
166 debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir, 166 debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir,
167 &dss_debug_dump_clocks, &dss_debug_fops); 167 &dss_debug_dump_clocks, &dss_debug_fops);
168 168
169#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
170 debugfs_create_file("dispc_irq", S_IRUGO, dss_debugfs_dir,
171 &dispc_dump_irqs, &dss_debug_fops);
172#endif
173
174#if defined(CONFIG_OMAP2_DSS_DSI) && defined(CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS)
175 dsi_create_debugfs_files_irq(dss_debugfs_dir, &dss_debug_fops);
176#endif
177
178 debugfs_create_file("dss", S_IRUGO, dss_debugfs_dir,
179 &dss_dump_regs, &dss_debug_fops);
180 debugfs_create_file("dispc", S_IRUGO, dss_debugfs_dir,
181 &dispc_dump_regs, &dss_debug_fops);
182#ifdef CONFIG_OMAP2_DSS_RFBI
183 debugfs_create_file("rfbi", S_IRUGO, dss_debugfs_dir,
184 &rfbi_dump_regs, &dss_debug_fops);
185#endif
186#ifdef CONFIG_OMAP2_DSS_DSI
187 dsi_create_debugfs_files_reg(dss_debugfs_dir, &dss_debug_fops);
188#endif
189#ifdef CONFIG_OMAP2_DSS_VENC
190 debugfs_create_file("venc", S_IRUGO, dss_debugfs_dir,
191 &venc_dump_regs, &dss_debug_fops);
192#endif
193#ifdef CONFIG_OMAP4_DSS_HDMI
194 debugfs_create_file("hdmi", S_IRUGO, dss_debugfs_dir,
195 &hdmi_dump_regs, &dss_debug_fops);
196#endif
197 return 0; 169 return 0;
198} 170}
199 171
@@ -202,6 +174,19 @@ static void dss_uninitialize_debugfs(void)
202 if (dss_debugfs_dir) 174 if (dss_debugfs_dir)
203 debugfs_remove_recursive(dss_debugfs_dir); 175 debugfs_remove_recursive(dss_debugfs_dir);
204} 176}
177
178int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *))
179{
180 struct dentry *d;
181
182 d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir,
183 write, &dss_debug_fops);
184
185 if (IS_ERR(d))
186 return PTR_ERR(d);
187
188 return 0;
189}
205#else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ 190#else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
206static inline int dss_initialize_debugfs(void) 191static inline int dss_initialize_debugfs(void)
207{ 192{
@@ -210,6 +195,11 @@ static inline int dss_initialize_debugfs(void)
210static inline void dss_uninitialize_debugfs(void) 195static inline void dss_uninitialize_debugfs(void)
211{ 196{
212} 197}
198static inline int dss_debugfs_create_file(const char *name,
199 void (*write)(struct seq_file *))
200{
201 return 0;
202}
213#endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ 203#endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
214 204
215/* PLATFORM DEVICE */ 205/* PLATFORM DEVICE */
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 25707732cb6..534f931229c 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2761,7 +2761,7 @@ void dispc_dump_irqs(struct seq_file *s)
2761} 2761}
2762#endif 2762#endif
2763 2763
2764void dispc_dump_regs(struct seq_file *s) 2764static void dispc_dump_regs(struct seq_file *s)
2765{ 2765{
2766 int i, j; 2766 int i, j;
2767 const char *mgr_names[] = { 2767 const char *mgr_names[] = {
@@ -3551,6 +3551,11 @@ static int omap_dispchw_probe(struct platform_device *pdev)
3551 3551
3552 dispc_runtime_put(); 3552 dispc_runtime_put();
3553 3553
3554 dss_debugfs_create_file("dispc", dispc_dump_regs);
3555
3556#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
3557 dss_debugfs_create_file("dispc_irq", dispc_dump_irqs);
3558#endif
3554 return 0; 3559 return 0;
3555 3560
3556err_runtime_get: 3561err_runtime_get:
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 9fdeb213198..d5d80f92ce3 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -1852,22 +1852,6 @@ static void dsi2_dump_irqs(struct seq_file *s)
1852 1852
1853 dsi_dump_dsidev_irqs(dsidev, s); 1853 dsi_dump_dsidev_irqs(dsidev, s);
1854} 1854}
1855
1856void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir,
1857 const struct file_operations *debug_fops)
1858{
1859 struct platform_device *dsidev;
1860
1861 dsidev = dsi_get_dsidev_from_id(0);
1862 if (dsidev)
1863 debugfs_create_file("dsi1_irqs", S_IRUGO, debugfs_dir,
1864 &dsi1_dump_irqs, debug_fops);
1865
1866 dsidev = dsi_get_dsidev_from_id(1);
1867 if (dsidev)
1868 debugfs_create_file("dsi2_irqs", S_IRUGO, debugfs_dir,
1869 &dsi2_dump_irqs, debug_fops);
1870}
1871#endif 1855#endif
1872 1856
1873static void dsi_dump_dsidev_regs(struct platform_device *dsidev, 1857static void dsi_dump_dsidev_regs(struct platform_device *dsidev,
@@ -1968,21 +1952,6 @@ static void dsi2_dump_regs(struct seq_file *s)
1968 dsi_dump_dsidev_regs(dsidev, s); 1952 dsi_dump_dsidev_regs(dsidev, s);
1969} 1953}
1970 1954
1971void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir,
1972 const struct file_operations *debug_fops)
1973{
1974 struct platform_device *dsidev;
1975
1976 dsidev = dsi_get_dsidev_from_id(0);
1977 if (dsidev)
1978 debugfs_create_file("dsi1_regs", S_IRUGO, debugfs_dir,
1979 &dsi1_dump_regs, debug_fops);
1980
1981 dsidev = dsi_get_dsidev_from_id(1);
1982 if (dsidev)
1983 debugfs_create_file("dsi2_regs", S_IRUGO, debugfs_dir,
1984 &dsi2_dump_regs, debug_fops);
1985}
1986enum dsi_cio_power_state { 1955enum dsi_cio_power_state {
1987 DSI_COMPLEXIO_POWER_OFF = 0x0, 1956 DSI_COMPLEXIO_POWER_OFF = 0x0,
1988 DSI_COMPLEXIO_POWER_ON = 0x1, 1957 DSI_COMPLEXIO_POWER_ON = 0x1,
@@ -4733,6 +4702,17 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
4733 4702
4734 dsi_runtime_put(dsidev); 4703 dsi_runtime_put(dsidev);
4735 4704
4705 if (dsi_module == 0)
4706 dss_debugfs_create_file("dsi1_regs", dsi1_dump_regs);
4707 else if (dsi_module == 1)
4708 dss_debugfs_create_file("dsi2_regs", dsi2_dump_regs);
4709
4710#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
4711 if (dsi_module == 0)
4712 dss_debugfs_create_file("dsi1_irqs", dsi1_dump_irqs);
4713 else if (dsi_module == 1)
4714 dss_debugfs_create_file("dsi2_irqs", dsi2_dump_irqs);
4715#endif
4736 return 0; 4716 return 0;
4737 4717
4738err_runtime_get: 4718err_runtime_get:
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 900002a6c7d..08bee78191d 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -280,7 +280,7 @@ void dss_dump_clocks(struct seq_file *s)
280 dss_runtime_put(); 280 dss_runtime_put();
281} 281}
282 282
283void dss_dump_regs(struct seq_file *s) 283static void dss_dump_regs(struct seq_file *s)
284{ 284{
285#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dss_read_reg(r)) 285#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dss_read_reg(r))
286 286
@@ -795,6 +795,8 @@ static int omap_dsshw_probe(struct platform_device *pdev)
795 795
796 dss_runtime_put(); 796 dss_runtime_put();
797 797
798 dss_debugfs_create_file("dss", dss_dump_regs);
799
798 return 0; 800 return 0;
799 801
800err_runtime_get: 802err_runtime_get:
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index ce0feb17c64..5faddf06aa0 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -163,6 +163,7 @@ int dss_get_ctx_loss_count(struct device *dev);
163int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask); 163int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask);
164void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask); 164void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask);
165int dss_set_min_bus_tput(struct device *dev, unsigned long tput); 165int dss_set_min_bus_tput(struct device *dev, unsigned long tput);
166int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *));
166 167
167/* apply */ 168/* apply */
168void dss_apply_init(void); 169void dss_apply_init(void);
@@ -238,7 +239,6 @@ enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void);
238const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src); 239const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src);
239void dss_dump_clocks(struct seq_file *s); 240void dss_dump_clocks(struct seq_file *s);
240 241
241void dss_dump_regs(struct seq_file *s);
242#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) 242#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
243void dss_debug_dump_clocks(struct seq_file *s); 243void dss_debug_dump_clocks(struct seq_file *s);
244#endif 244#endif
@@ -285,10 +285,6 @@ int dsi_runtime_get(struct platform_device *dsidev);
285void dsi_runtime_put(struct platform_device *dsidev); 285void dsi_runtime_put(struct platform_device *dsidev);
286 286
287void dsi_dump_clocks(struct seq_file *s); 287void dsi_dump_clocks(struct seq_file *s);
288void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir,
289 const struct file_operations *debug_fops);
290void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir,
291 const struct file_operations *debug_fops);
292 288
293int dsi_init_display(struct omap_dss_device *display); 289int dsi_init_display(struct omap_dss_device *display);
294void dsi_irq_handler(void); 290void dsi_irq_handler(void);
@@ -371,8 +367,6 @@ int dpi_init_display(struct omap_dss_device *dssdev);
371int dispc_init_platform_driver(void); 367int dispc_init_platform_driver(void);
372void dispc_uninit_platform_driver(void); 368void dispc_uninit_platform_driver(void);
373void dispc_dump_clocks(struct seq_file *s); 369void dispc_dump_clocks(struct seq_file *s);
374void dispc_dump_irqs(struct seq_file *s);
375void dispc_dump_regs(struct seq_file *s);
376void dispc_irq_handler(void); 370void dispc_irq_handler(void);
377 371
378int dispc_runtime_get(void); 372int dispc_runtime_get(void);
@@ -438,7 +432,6 @@ void dispc_mgr_setup(enum omap_channel channel,
438#ifdef CONFIG_OMAP2_DSS_VENC 432#ifdef CONFIG_OMAP2_DSS_VENC
439int venc_init_platform_driver(void); 433int venc_init_platform_driver(void);
440void venc_uninit_platform_driver(void); 434void venc_uninit_platform_driver(void);
441void venc_dump_regs(struct seq_file *s);
442int venc_init_display(struct omap_dss_device *display); 435int venc_init_display(struct omap_dss_device *display);
443unsigned long venc_get_pixel_clock(void); 436unsigned long venc_get_pixel_clock(void);
444#else 437#else
@@ -455,7 +448,6 @@ int hdmi_init_platform_driver(void);
455void hdmi_uninit_platform_driver(void); 448void hdmi_uninit_platform_driver(void);
456int hdmi_init_display(struct omap_dss_device *dssdev); 449int hdmi_init_display(struct omap_dss_device *dssdev);
457unsigned long hdmi_get_pixel_clock(void); 450unsigned long hdmi_get_pixel_clock(void);
458void hdmi_dump_regs(struct seq_file *s);
459#else 451#else
460static inline int hdmi_init_display(struct omap_dss_device *dssdev) 452static inline int hdmi_init_display(struct omap_dss_device *dssdev)
461{ 453{
@@ -480,7 +472,6 @@ void hdmi_panel_exit(void);
480/* RFBI */ 472/* RFBI */
481int rfbi_init_platform_driver(void); 473int rfbi_init_platform_driver(void);
482void rfbi_uninit_platform_driver(void); 474void rfbi_uninit_platform_driver(void);
483void rfbi_dump_regs(struct seq_file *s);
484int rfbi_init_display(struct omap_dss_device *display); 475int rfbi_init_display(struct omap_dss_device *display);
485 476
486 477
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 45e98419d95..e0ab10808a7 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -420,7 +420,7 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev)
420 } 420 }
421} 421}
422 422
423void hdmi_dump_regs(struct seq_file *s) 423static void hdmi_dump_regs(struct seq_file *s)
424{ 424{
425 mutex_lock(&hdmi.lock); 425 mutex_lock(&hdmi.lock);
426 426
@@ -810,6 +810,8 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
810 810
811 hdmi_panel_init(); 811 hdmi_panel_init();
812 812
813 dss_debugfs_create_file("hdmi", hdmi_dump_regs);
814
813#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ 815#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
814 defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) 816 defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
815 817
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index c5e69068489..6adbea97332 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -819,7 +819,7 @@ int omap_rfbi_update(struct omap_dss_device *dssdev,
819} 819}
820EXPORT_SYMBOL(omap_rfbi_update); 820EXPORT_SYMBOL(omap_rfbi_update);
821 821
822void rfbi_dump_regs(struct seq_file *s) 822static void rfbi_dump_regs(struct seq_file *s)
823{ 823{
824#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, rfbi_read_reg(r)) 824#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, rfbi_read_reg(r))
825 825
@@ -976,6 +976,8 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
976 976
977 rfbi_runtime_put(); 977 rfbi_runtime_put();
978 978
979 dss_debugfs_create_file("rfbi", rfbi_dump_regs);
980
979 return 0; 981 return 0;
980 982
981err_runtime_get: 983err_runtime_get:
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 90b57c5317b..ebb6ec60e9a 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -745,7 +745,7 @@ int venc_init_display(struct omap_dss_device *dssdev)
745 return 0; 745 return 0;
746} 746}
747 747
748void venc_dump_regs(struct seq_file *s) 748static void venc_dump_regs(struct seq_file *s)
749{ 749{
750#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, venc_read_reg(r)) 750#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, venc_read_reg(r))
751 751
@@ -874,6 +874,8 @@ static int omap_venchw_probe(struct platform_device *pdev)
874 if (r) 874 if (r)
875 goto err_reg_panel_driver; 875 goto err_reg_panel_driver;
876 876
877 dss_debugfs_create_file("venc", venc_dump_regs);
878
877 return 0; 879 return 0;
878 880
879err_reg_panel_driver: 881err_reg_panel_driver: