mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 11:50:43 +09:00
misc: rk628: dsi: add color bar debugfs node
enable dsi color bar echo 1 > /sys/kernel/debug/rk628/2-0050/dsi_color_bar disable dsi color bar echo 0 > /sys/kernel/debug/rk628/2-0050/dsi_color_bar Change-Id: Ib3eabeab685ab0f2ab9c5bcef8034117d7b513a7 Signed-off-by: Guochun Huang <hero.huang@rock-chips.com>
This commit is contained in:
@@ -1215,6 +1215,18 @@ static int rk628_version_info(struct rk628 *rk628)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void rk628_debugfs_create(struct rk628 *rk628)
|
||||
{
|
||||
rk628->debug_dir = debugfs_create_dir(dev_name(rk628->dev), debugfs_lookup("rk628", NULL));
|
||||
if (IS_ERR(rk628->debug_dir))
|
||||
return;
|
||||
|
||||
/* path example: /sys/kernel/debug/rk628/2-0050/summary */
|
||||
debugfs_create_file("summary", 0400, rk628->debug_dir, rk628,
|
||||
&rk628_debugfs_summary_fops);
|
||||
rk628_mipi_dsi_create_debugfs_file(rk628);
|
||||
}
|
||||
|
||||
static int
|
||||
rk628_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||
{
|
||||
@@ -1380,12 +1392,7 @@ rk628_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||
}
|
||||
|
||||
pm_runtime_enable(dev);
|
||||
rk628->debug_dir = debugfs_create_dir(dev_name(dev), debugfs_lookup("rk628", NULL));
|
||||
if (IS_ERR(rk628->debug_dir))
|
||||
return 0;
|
||||
|
||||
/* path example: /sys/kernel/debug/rk628/2-0050/summary */
|
||||
debugfs_create_file("summary", 0400, rk628->debug_dir, rk628, &rk628_debugfs_summary_fops);
|
||||
rk628_debugfs_create(rk628);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1400,6 +1407,7 @@ static int rk628_i2c_remove(struct i2c_client *client)
|
||||
struct device *dev = &client->dev;
|
||||
|
||||
debugfs_remove_recursive(rk628->debug_dir);
|
||||
|
||||
if (rk628_output_is_dsi(rk628)) {
|
||||
cancel_delayed_work_sync(&rk628->dsi_delay_work);
|
||||
destroy_workqueue(rk628->dsi_wq);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <asm/unaligned.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include "rk628.h"
|
||||
#include "rk628_cru.h"
|
||||
#include "rk628_dsi.h"
|
||||
@@ -1223,6 +1224,65 @@ static void rk628_dsi_bridge_enable(struct rk628 *rk628,
|
||||
dsi_write(rk628, dsi, DSI_PWR_UP, POWER_UP);
|
||||
}
|
||||
|
||||
static int rk628_dsi_color_bar_show(struct seq_file *s, void *data)
|
||||
{
|
||||
seq_puts(s, " Enable color bar:\n");
|
||||
seq_puts(s, " example: echo 1 > /sys/kernel/debug/rk628/2-0050/dsi_color_bar\n");
|
||||
seq_puts(s, " Disable color bar:\n");
|
||||
seq_puts(s, " example: echo 0 > /sys/kernel/debug/rk628/2-0050/dsi_color_bar\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rk628_dsi_color_bar_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, rk628_dsi_color_bar_show, inode->i_private);
|
||||
}
|
||||
|
||||
static ssize_t rk628_dsi_color_bar_write(struct file *file, const char __user *ubuf,
|
||||
size_t len, loff_t *offp)
|
||||
{
|
||||
struct rk628 *rk628 = ((struct seq_file *)file->private_data)->private;
|
||||
struct rk628_dsi *dsi = &rk628->dsi0;
|
||||
struct rk628_dsi *dsi1 = &rk628->dsi1;
|
||||
u8 mode;
|
||||
|
||||
if (kstrtou8_from_user(ubuf, len, 0, &mode))
|
||||
return -EFAULT;
|
||||
|
||||
dsi_update_bits(rk628, dsi, DSI_VID_MODE_CFG, VPG_EN, mode ? VPG_EN : 0);
|
||||
if (!mode) {
|
||||
dsi_write(rk628, dsi, DSI_PWR_UP, RESET);
|
||||
dsi_write(rk628, dsi, DSI_PWR_UP, POWER_UP);
|
||||
}
|
||||
|
||||
if (dsi->slave) {
|
||||
dsi_update_bits(rk628, dsi1, DSI_VID_MODE_CFG, VPG_EN, mode ? VPG_EN : 0);
|
||||
if (!mode) {
|
||||
dsi_write(rk628, dsi1, DSI_PWR_UP, RESET);
|
||||
dsi_write(rk628, dsi1, DSI_PWR_UP, POWER_UP);
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static const struct file_operations rk628_dsi_color_bar_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = rk628_dsi_color_bar_open,
|
||||
.read = seq_read,
|
||||
.write = rk628_dsi_color_bar_write,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
void rk628_mipi_dsi_create_debugfs_file(struct rk628 *rk628)
|
||||
{
|
||||
if (rk628_output_is_dsi(rk628))
|
||||
debugfs_create_file("dsi_color_bar", 0600, rk628->debug_dir,
|
||||
rk628, &rk628_dsi_color_bar_fops);
|
||||
}
|
||||
|
||||
void rk628_mipi_dsi_pre_enable(struct rk628 *rk628)
|
||||
{
|
||||
struct rk628_dsi *dsi = &rk628->dsi0;
|
||||
|
||||
@@ -155,4 +155,5 @@ int rk628_dsi_parse(struct rk628 *rk628, struct device_node *dsi_np);
|
||||
void rk628_mipi_dsi_pre_enable(struct rk628 *rk628);
|
||||
void rk628_mipi_dsi_enable(struct rk628 *rk628);
|
||||
void rk628_dsi_disable(struct rk628 *rk628);
|
||||
void rk628_mipi_dsi_create_debugfs_file(struct rk628 *rk628);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user