mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
misc: rk628: post_process: add scaler color_bar debugfs node
Enable horizontal color bar echo 1 > /sys/kernel/debug/rk628/2-0050/scaler_color_bar Enable vertical color bar echo 2 > /sys/kernel/debug/rk628/2-0050/scaler_color_bar Disable color bar echo 0 > /sys/kernel/debug/rk628/2-0050/scaler_color_bar Change-Id: Ic47d7edf27f174b16ea1c2841cbf7b9df8c63546 Signed-off-by: Guochun Huang <hero.huang@rock-chips.com>
This commit is contained in:
@@ -1224,6 +1224,8 @@ static void rk628_debugfs_create(struct rk628 *rk628)
|
||||
/* path example: /sys/kernel/debug/rk628/2-0050/summary */
|
||||
debugfs_create_file("summary", 0400, rk628->debug_dir, rk628,
|
||||
&rk628_debugfs_summary_fops);
|
||||
|
||||
rk628_post_process_create_debugfs_file(rk628);
|
||||
rk628_mipi_dsi_create_debugfs_file(rk628);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@
|
||||
#define GRF_AS_DSIPHY(x) UPDATE(x, 0, 0)
|
||||
#define GRF_SCALER_CON0 0x0010
|
||||
#define SCL_8_PIXEL_ALIGN(x) HIWORD_UPDATE(x, 12, 12)
|
||||
#define SCL_COLOR_VER_EN(x) HIWORD_UPDATE(x, 10, 10)
|
||||
#define SCL_COLOR_BAR_EN(x) HIWORD_UPDATE(x, 9, 9)
|
||||
#define SCL_VER_DOWN_MODE(x) HIWORD_UPDATE(x, 8, 8)
|
||||
#define SCL_HOR_DOWN_MODE(x) HIWORD_UPDATE(x, 7, 7)
|
||||
#define SCL_BIC_COE_SEL(x) HIWORD_UPDATE(x, 6, 5)
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
*
|
||||
* Author: Wyon Bi <bivvy.bi@rock-chips.com>
|
||||
*/
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
#include "rk628.h"
|
||||
#include "rk628_config.h"
|
||||
#include "rk628_cru.h"
|
||||
@@ -198,6 +200,64 @@ static void rk628_post_process_scaler_init(struct rk628 *rk628,
|
||||
DSP_VBOR_ST(dsp_vbor_st));
|
||||
}
|
||||
|
||||
static int rk628_scaler_color_bar_show(struct seq_file *s, void *data)
|
||||
{
|
||||
seq_puts(s, " Enable horizontal color bar:\n");
|
||||
seq_puts(s, " example: echo 1 > /sys/kernel/debug/rk628/2-0050/scaler_color_bar\n");
|
||||
seq_puts(s, " Enable vertical color bar:\n");
|
||||
seq_puts(s, " example: echo 2 > /sys/kernel/debug/rk628/2-0050/scaler_color_bar\n");
|
||||
seq_puts(s, " Disable color bar:\n");
|
||||
seq_puts(s, " example: echo 0 > /sys/kernel/debug/rk628/2-0050/scaler_color_bar\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rk628_scaler_color_bar_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, rk628_scaler_color_bar_show, inode->i_private);
|
||||
}
|
||||
|
||||
static ssize_t rk628_scaler_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;
|
||||
u8 mode;
|
||||
|
||||
if (kstrtou8_from_user(ubuf, len, 0, &mode))
|
||||
return -EFAULT;
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
rk628_i2c_write(rk628, GRF_SCALER_CON0, SCL_COLOR_BAR_EN(0));
|
||||
break;
|
||||
case 1:
|
||||
rk628_i2c_write(rk628, GRF_SCALER_CON0, SCL_COLOR_BAR_EN(1));
|
||||
rk628_i2c_write(rk628, GRF_SCALER_CON0, SCL_COLOR_VER_EN(0));
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
rk628_i2c_write(rk628, GRF_SCALER_CON0, SCL_COLOR_BAR_EN(1));
|
||||
rk628_i2c_write(rk628, GRF_SCALER_CON0, SCL_COLOR_VER_EN(1));
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static const struct file_operations rk628_scaler_color_bar_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = rk628_scaler_color_bar_open,
|
||||
.read = seq_read,
|
||||
.write = rk628_scaler_color_bar_write,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
void rk628_post_process_create_debugfs_file(struct rk628 *rk628)
|
||||
{
|
||||
debugfs_create_file("scaler_color_bar", 0600, rk628->debug_dir,
|
||||
rk628, &rk628_scaler_color_bar_fops);
|
||||
}
|
||||
|
||||
void rk628_post_process_init(struct rk628 *rk628)
|
||||
{
|
||||
struct rk628_display_mode *src = &rk628->src_mode;
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
void rk628_post_process_init(struct rk628 *rk628);
|
||||
void rk628_post_process_enable(struct rk628 *rk628);
|
||||
void rk628_post_process_disable(struct rk628 *rk628);
|
||||
|
||||
void rk628_post_process_create_debugfs_file(struct rk628 *rk628);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user