void __iomem *base;
struct dss_device *dss;
+ struct dss_debugfs_entry *debugfs;
+
int irq;
irq_handler_t user_handler;
void *user_data;
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[] = {
#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);
#undef DISPC_REG
#undef DUMPREG
+
+ return 0;
}
/* calculate clock rates using dividers in cinfo */
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;
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);
#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;
#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
#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 {
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;
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);
}
#endif
-static void dss_dump_regs(struct seq_file *s)
+static int dss_dump_regs(struct seq_file *s, void *p)
{
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))
- return;
+ return 0;
DUMPREG(dss, DSS_REVISION);
DUMPREG(dss, DSS_SYSCONFIG);
dss_runtime_put(dss);
#undef DUMPREG
+ return 0;
}
static int dss_get_channel_index(enum omap_channel channel)
/* DEBUGFS */
#if defined(CONFIG_OMAP2_DSS_DEBUGFS)
-static void dss_debug_dump_clocks(struct seq_file *s)
+static int dss_debug_dump_clocks(struct seq_file *s, void *p)
{
struct dss_device *dss = s->private;
#ifdef CONFIG_OMAP2_DSS_DSI
dsi_dump_clocks(s);
#endif
-}
-
-static int dss_debug_show(struct seq_file *s, void *unused)
-{
- void (*func)(struct seq_file *) = s->private;
-
- func(s);
return 0;
}
-static int dss_debug_open(struct inode *inode, struct file *file)
-{
- return single_open(file, dss_debug_show, inode->i_private);
-}
-
-static const struct file_operations dss_debug_fops = {
- .open = dss_debug_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
static struct dentry *dss_debugfs_dir;
static int dss_initialize_debugfs(struct dss_device *dss)
return err;
}
- debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir,
- &dss_debug_dump_clocks, &dss_debug_fops);
-
return 0;
}
debugfs_remove_recursive(dss_debugfs_dir);
}
-int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *))
+struct dss_debugfs_entry {
+ struct dentry *dentry;
+ int (*show_fn)(struct seq_file *s, void *data);
+ void *data;
+};
+
+static int dss_debug_open(struct inode *inode, struct file *file)
+{
+ struct dss_debugfs_entry *entry = inode->i_private;
+
+ return single_open(file, entry->show_fn, entry->data);
+}
+
+static const struct file_operations dss_debug_fops = {
+ .open = dss_debug_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .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 *entry;
struct dentry *d;
- d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir,
- write, &dss_debug_fops);
+ entry = kzalloc(sizeof(*entry), GFP_KERNEL);
+ if (!entry)
+ return ERR_PTR(-ENOMEM);
+
+ entry->show_fn = show_fn;
+ entry->data = data;
- return PTR_ERR_OR_ZERO(d);
+ d = debugfs_create_file(name, 0444, dss_debugfs_dir, entry,
+ &dss_debug_fops);
+ if (IS_ERR(d)) {
+ kfree(entry);
+ return ERR_PTR(PTR_ERR(d));
+ }
+
+ entry->dentry = d;
+ return entry;
+}
+
+void dss_debugfs_remove_file(struct dss_debugfs_entry *entry)
+{
+ if (IS_ERR_OR_NULL(entry))
+ return;
+
+ debugfs_remove(entry->dentry);
+ kfree(entry);
}
+
#else /* CONFIG_OMAP2_DSS_DEBUGFS */
static inline int dss_initialize_debugfs(struct dss_device *dss)
{
if (r)
goto err_pm_runtime_disable;
- dss_debugfs_create_file("dss", dss_dump_regs);
+ dss->debugfs.clk = dss_debugfs_create_file("clk", dss_debug_dump_clocks,
+ 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);
return 0;
err_uninit_debugfs:
+ dss_debugfs_remove_file(dss->debugfs.clk);
+ dss_debugfs_remove_file(dss->debugfs.dss);
dss_uninitialize_debugfs();
err_pm_runtime_disable:
component_master_del(&pdev->dev, &dss_component_ops);
+ dss_debugfs_remove_file(dss->debugfs.clk);
+ dss_debugfs_remove_file(dss->debugfs.dss);
dss_uninitialize_debugfs();
pm_runtime_disable(&pdev->dev);
#include "omapdss.h"
+struct dss_debugfs_entry;
+struct platform_device;
+struct seq_file;
+
#define MAX_DSS_LCD_MANAGERS 3
#define MAX_NUM_DSI 2
int lcden_sig_polarity;
};
-struct seq_file;
-struct platform_device;
-
#define DSS_SZ_REGS SZ_512
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;
};
/* 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 */
#ifdef CONFIG_OMAP2_DSS_DSI
-struct dentry;
-struct file_operations;
-
void dsi_dump_clocks(struct seq_file *s);
void dsi_irq_handler(void);
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;
*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);
hdmi_runtime_put();
mutex_unlock(&hdmi.lock);
+ return 0;
}
static int read_edid(u8 *buf, int len)
return r;
}
- dss_debugfs_create_file("hdmi", hdmi_dump_regs);
+ hdmi.debugfs = dss_debugfs_create_file("hdmi", hdmi_dump_regs, &hdmi);
return 0;
err:
{
struct platform_device *pdev = to_platform_device(dev);
+ dss_debugfs_remove_file(hdmi.debugfs);
+
if (hdmi.audio_pdev)
platform_device_unregister(hdmi.audio_pdev);
*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);
hdmi_runtime_put();
mutex_unlock(&hdmi.lock);
+ return 0;
}
static int read_edid(u8 *buf, int len)
return r;
}
- dss_debugfs_create_file("hdmi", hdmi_dump_regs);
+ hdmi.debugfs = dss_debugfs_create_file("hdmi", hdmi_dump_regs, &hdmi);
return 0;
err:
{
struct platform_device *pdev = to_platform_device(dev);
+ dss_debugfs_remove_file(hdmi.debugfs);
+
if (hdmi.audio_pdev)
platform_device_unregister(hdmi.audio_pdev);
struct regulator *vdda_dac_reg;
struct dss_device *dss;
+ struct dss_debugfs_entry *debugfs;
+
struct clk *tv_dac_clk;
struct videomode vm;
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);
venc_runtime_put();
#undef DUMPREG
+ return 0;
}
static int venc_get_clocks(struct platform_device *pdev)
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);
{
struct platform_device *pdev = to_platform_device(dev);
+ dss_debugfs_remove_file(venc.debugfs);
+
venc_uninit_output(pdev);
pm_runtime_disable(&pdev->dev);