* g 19:10
* b 29:20
*/
-void vdin_get_prob_rgb(unsigned int offset,
+void vdin_prob_get_rgb(unsigned int offset,
unsigned int *r, unsigned int *g, unsigned int *b)
{
*b = rgb_info_b = rd_bits(offset, VDIN_MATRIX_PROBE_COLOR,
COMPONENT0_PROBE_COLOR_BIT, COMPONENT0_PROBE_COLOR_WID);
}
+void vdin_prob_get_yuv(unsigned int offset,
+ unsigned int *rgb_yuv0,
+ unsigned int *rgb_yuv1,
+ unsigned int *rgb_yuv2)
+{
+ *rgb_yuv0 = ((rd_bits(offset, VDIN_MATRIX_PROBE_COLOR,
+ COMPONENT2_PROBE_COLOR_BIT, COMPONENT2_PROBE_COLOR_WID)
+ << 8) >> 10);
+ *rgb_yuv1 = ((rd_bits(offset, VDIN_MATRIX_PROBE_COLOR,
+ COMPONENT1_PROBE_COLOR_BIT, COMPONENT1_PROBE_COLOR_WID)
+ << 8) >> 10);
+ *rgb_yuv2 = ((rd_bits(offset, VDIN_MATRIX_PROBE_COLOR,
+ COMPONENT0_PROBE_COLOR_BIT, COMPONENT0_PROBE_COLOR_WID)
+ << 8) >> 10);
+}
+
+#if 0
+void vdin_prob_set_xy(unsigned int offset,
+ unsigned int x, unsigned int y, struct vdin_dev_s *devp)
+{
+
+ if (devp->fmt_info_p->scan_mode == TVIN_SCAN_MODE_INTERLACED)
+ y = y / 2;
+
+ wr_bits(offset, VDIN_MATRIX_PROBE_POS, y,
+ PROBE_POX_Y_BIT, PROBE_POX_Y_WID);
+ wr_bits(offset, VDIN_MATRIX_PROBE_POS, x,
+ PROBE_POS_X_BIT, PROBE_POS_X_WID);
+}
+#endif
+void vdin_prob_set_before_or_after_mat(unsigned int offset,
+ unsigned int x, struct vdin_dev_s *devp)
+{
+ if ((x != 0) && (x != 1))
+ return;
+ /* 1:probe pixel data after matrix */
+ wr_bits(offset, VDIN_MATRIX_CTRL, x,
+ VDIN_PROBE_POST_BIT, VDIN_PROBE_POST_WID);
+}
+
+void vdin_prob_matrix_sel(unsigned int offset,
+ unsigned int sel, struct vdin_dev_s *devp)
+{
+ unsigned int x;
+
+ x = sel & 0x03;
+ /* 1:select matrix 1 */
+ wr_bits(offset, VDIN_MATRIX_CTRL, x,
+ VDIN_PROBE_SEL_BIT, VDIN_PROBE_SEL_WID);
+}
+
+
+/* this function set flowing parameters:
+ *a.rgb_info_x b.rgb_info_y
+ *debug usage:
+ *echo rgb_xy x y > /sys/class/vdin/vdinx/attr
+ */
+void vdin_prob_set_xy(unsigned int offset,
+ unsigned int x, unsigned int y, struct vdin_dev_s *devp)
+{
+#if 0
+ enum vdin_format_convert_e format_convert_matrix0;
+ enum vdin_format_convert_e format_convert_matrix1;
+
+ /* set matrix */
+ rgb_info_enable = 1;
+ format_convert_matrix0 = vdin_get_format_convert_matrix0(devp);
+ format_convert_matrix1 = vdin_get_format_convert_matrix1(devp);
+ vdin_set_color_matrix1(devp->addr_offset, devp->fmt_info_p,
+ format_convert_matrix1,
+ devp->parm.port,
+ devp->prop.color_fmt_range,
+ devp->prop.vdin_hdr_Flag,
+ devp->color_range_mode);
+ if (is_meson_g12a_cpu() || is_meson_g12b_cpu() ||
+ is_meson_sm1_cpu() || is_meson_tm2_cpu())
+ vdin_set_color_matrix0_g12a(devp->addr_offset,
+ devp->fmt_info_p,
+ devp->format_convert,
+ devp->parm.port,
+ devp->prop.color_fmt_range,
+ devp->prop.vdin_hdr_Flag,
+ devp->color_range_mode);
+ else
+ vdin_set_color_matrix0(devp->addr_offset, devp->fmt_info_p,
+ format_convert_matrix0,
+ devp->parm.port,
+ devp->prop.color_fmt_range,
+ devp->prop.vdin_hdr_Flag,
+ devp->color_range_mode);
+#endif
+
+ /* set position */
+ rgb_info_x = x;
+ if (devp->fmt_info_p->scan_mode == TVIN_SCAN_MODE_INTERLACED)
+ rgb_info_y = y / 2;
+ else
+ rgb_info_y = y;
+/* #if defined(VDIN_V1) */
+ wr_bits(offset, VDIN_MATRIX_PROBE_POS, rgb_info_y,
+ PROBE_POX_Y_BIT, PROBE_POX_Y_WID);
+ wr_bits(offset, VDIN_MATRIX_PROBE_POS, rgb_info_x,
+ PROBE_POS_X_BIT, PROBE_POS_X_WID);
+ #if 0
+ /* 1:probe pixel data after matrix */
+ wr_bits(offset, VDIN_MATRIX_CTRL, 1,
+ VDIN_PROBE_POST_BIT, VDIN_PROBE_POST_WID);
+ /* 1:select matrix 1 */
+ wr_bits(offset, VDIN_MATRIX_CTRL, 1,
+ VDIN_PROBE_SEL_BIT, VDIN_PROBE_SEL_WID);
+ #endif
+}
+
+
/*function:
* 1.set meas mux based on port_:
* 0x01: /mpeg/ 0x10: /CVBS/
}
}
-/* this function set flowing parameters:
- *a.rgb_info_x b.rgb_info_y
- *debug usage:
- *echo rgb_xy x y > /sys/class/vdin/vdinx/attr
- */
-void vdin_set_prob_xy(unsigned int offset,
- unsigned int x, unsigned int y, struct vdin_dev_s *devp)
-{
- enum vdin_format_convert_e format_convert_matrix0;
- enum vdin_format_convert_e format_convert_matrix1;
-
- /* set matrix */
- rgb_info_enable = 1;
- format_convert_matrix0 = vdin_get_format_convert_matrix0(devp);
- format_convert_matrix1 = vdin_get_format_convert_matrix1(devp);
- vdin_set_color_matrix1(devp->addr_offset, devp->fmt_info_p,
- format_convert_matrix1,
- devp->parm.port,
- devp->prop.color_fmt_range,
- devp->prop.vdin_hdr_Flag,
- devp->color_range_mode);
- if (is_meson_g12a_cpu() || is_meson_g12b_cpu() ||
- is_meson_sm1_cpu() || is_meson_tm2_cpu())
- vdin_set_color_matrix0_g12a(devp->addr_offset,
- devp->fmt_info_p,
- devp->format_convert,
- devp->parm.port,
- devp->prop.color_fmt_range,
- devp->prop.vdin_hdr_Flag,
- devp->color_range_mode);
- else
- vdin_set_color_matrix0(devp->addr_offset, devp->fmt_info_p,
- format_convert_matrix0,
- devp->parm.port,
- devp->prop.color_fmt_range,
- devp->prop.vdin_hdr_Flag,
- devp->color_range_mode);
- /* set position */
- rgb_info_x = x;
- if (devp->fmt_info_p->scan_mode == TVIN_SCAN_MODE_INTERLACED)
- rgb_info_y = y/2;
- else
- rgb_info_y = y;
-/* #if defined(VDIN_V1) */
- wr_bits(offset, VDIN_MATRIX_PROBE_POS, rgb_info_y,
- PROBE_POX_Y_BIT, PROBE_POX_Y_WID);
- wr_bits(offset, VDIN_MATRIX_PROBE_POS, rgb_info_x,
- PROBE_POS_X_BIT, PROBE_POS_X_WID);
- /* 1:probe pixel data after matrix */
- wr_bits(offset, VDIN_MATRIX_CTRL, 1,
- VDIN_PROBE_POST_BIT, VDIN_PROBE_POST_WID);
- /* 1:select matrix 1 */
- wr_bits(offset, VDIN_MATRIX_CTRL, 1,
- VDIN_PROBE_SEL_BIT, VDIN_PROBE_SEL_WID);
-/* #endif */
-}
-
/*set block bar
*base on flowing parameters:
*a.h_active b.v_active
struct vdin_dev_s *devp);
extern void vdin_set_prob_xy(unsigned int offset, unsigned int x,
unsigned int y, struct vdin_dev_s *devp);
-extern void vdin_get_prob_rgb(unsigned int offset, unsigned int *r,
+extern void vdin_prob_get_rgb(unsigned int offset, unsigned int *r,
unsigned int *g, unsigned int *b);
extern void vdin_set_all_regs(struct vdin_dev_s *devp);
extern void vdin_set_default_regmap(unsigned int offset);
extern void vdin_set_dolby_ll_tunnel(struct vdin_dev_s *devp);
extern void vdin_check_hdmi_hdr(struct vdin_dev_s *devp);
extern void vdin_dobly_mdata_write_en(unsigned int offset, unsigned int en);
+extern void vdin_prob_set_xy(unsigned int offset,
+ unsigned int x, unsigned int y, struct vdin_dev_s *devp);
+extern void vdin_prob_set_before_or_after_mat(unsigned int offset,
+ unsigned int x, struct vdin_dev_s *devp);
+extern void vdin_prob_get_yuv(unsigned int offset,
+ unsigned int *rgb_yuv0, unsigned int *rgb_yuv1,
+ unsigned int *rgb_yuv2);
+extern void vdin_prob_matrix_sel(unsigned int offset,
+ unsigned int sel, struct vdin_dev_s *devp);
#endif
#include <linux/seq_file.h>
#include <linux/debugfs.h>
-static void vdin_get_vdin_yuv_rgb_mat0(unsigned int offset,
- unsigned int *rgb_yuv0,
- unsigned int *rgb_yuv1,
- unsigned int *rgb_yuv2)
-{
- *rgb_yuv0 = 0; *rgb_yuv1 = 0; *rgb_yuv2 = 0;
-
- *rgb_yuv0 = ((rd_bits(offset, VDIN_MATRIX_PROBE_COLOR,
- COMPONENT2_PROBE_COLOR_BIT, COMPONENT2_PROBE_COLOR_WID)
- << 8) >> 10);
- *rgb_yuv1 = ((rd_bits(offset, VDIN_MATRIX_PROBE_COLOR,
- COMPONENT1_PROBE_COLOR_BIT, COMPONENT1_PROBE_COLOR_WID)
- << 8) >> 10);
- *rgb_yuv2 = ((rd_bits(offset, VDIN_MATRIX_PROBE_COLOR,
- COMPONENT0_PROBE_COLOR_BIT, COMPONENT0_PROBE_COLOR_WID)
- << 8) >> 10);
-}
-
-static void vdin_set_prob_matrix0_xy(unsigned int offset,
- unsigned int x, unsigned int y, struct vdin_dev_s *devp)
-{
-
- if (devp->fmt_info_p->scan_mode == TVIN_SCAN_MODE_INTERLACED)
- y = y/2;
-
- wr_bits(offset, VDIN_MATRIX_PROBE_POS, y,
- PROBE_POX_Y_BIT, PROBE_POX_Y_WID);
- wr_bits(offset, VDIN_MATRIX_PROBE_POS, x,
- PROBE_POS_X_BIT, PROBE_POS_X_WID);
-}
-
-static void vdin_set_before_after_mat0(unsigned int offset,
- unsigned int x, struct vdin_dev_s *devp)
-{
- if ((x != 0) && (x != 1))
- return;
-
- wr_bits(offset, VDIN_MATRIX_CTRL, x,
- VDIN_PROBE_POST_BIT, VDIN_PROBE_POST_WID);
-}
static void vdin_parse_param(char *buf_orig, char **parm)
{
reg = VDIN_MISC_CTRL;
pr_info("0x%04x = 0x%08x\n", (reg), R_VCBUS(reg));
pr_info("\n");
- } else if (!strcmp(parm[0], "rgb_xy")) {
+ } else if (!strcmp(parm[0], "prob_xy")) {
unsigned int x = 0, y = 0;
#ifdef CONFIG_AMLOGIC_PIXEL_PROBE
vdin_probe_enable();
x = val;
if (kstrtoul(parm[2], 10, &val) == 0)
y = val;
- vdin_set_prob_xy(devp->addr_offset, x, y, devp);
+ vdin_prob_set_xy(devp->addr_offset, x, y, devp);
} else
pr_err("miss parameters .\n");
- } else if (!strcmp(parm[0], "rgb_info")) {
+ } else if (!strcmp(parm[0], "prob_rgb")) {
unsigned int r, g, b;
- vdin_get_prob_rgb(devp->addr_offset, &r, &g, &b);
+ vdin_prob_get_rgb(devp->addr_offset, &r, &g, &b);
pr_info("rgb_info-->r:%x,g:%x,b:%x\n", r, g, b);
+ } else if (!strcmp(parm[0], "prob_yuv")) {
+ unsigned int r, g, b;
+
+ vdin_prob_get_yuv(devp->addr_offset, &r, &g, &b);
+ pr_info("yuv_info-->u:%x,v:%x,y:%x\n", r, g, b);
+ } else if (!strcmp(parm[0], "prob_pre_post")) {
+ unsigned int x = 0;
+
+ if (!parm[1])
+ pr_err("miss parameters .\n");
+ if (kstrtoul(parm[1], 10, &val) == 0)
+ x = val;
+ pr_info("matrix post sel: %d\n", x);
+ vdin_prob_set_before_or_after_mat(devp->addr_offset, x, devp);
+ } else if (!strcmp(parm[0], "prob_mat_sel")) {
+ unsigned int x = 0;
+
+ if (!parm[1])
+ pr_err("miss parameters .\n");
+ if (kstrtoul(parm[1], 10, &val) == 0)
+ x = val;
+ pr_info("matrix sel : %d\n", x);
+ vdin_prob_matrix_sel(devp->addr_offset, x, devp);
} else if (!strcmp(parm[0], "mpeg2vdin")) {
if (parm[1] && parm[2]) {
if (kstrtoul(parm[1], 10, &val) == 0)
devp->h_active, devp->v_active);
} else
pr_err("miss parameters .\n");
- } else if (!strcmp(parm[0], "yuv_rgb_info")) {
- unsigned int rgb_yuv0, rgb_yuv1, rgb_yuv2;
- vdin_get_vdin_yuv_rgb_mat0(devp->addr_offset,
- &rgb_yuv0, &rgb_yuv1, &rgb_yuv2);
- pr_info("rgb_yuv0 :%d, rgb_yuv1 :%d , rgb_yuv2 :%d\n",
- rgb_yuv0, rgb_yuv1, rgb_yuv2);
- } else if (!strcmp(parm[0], "mat0_xy")) {
- unsigned int x = 0, y = 0;
-#ifdef CONFIG_AMLOGIC_PIXEL_PROBE
- vdin_probe_enable();
-#endif
- if (parm[1] && parm[2]) {
- if (kstrtoul(parm[1], 10, &val) == 0)
- x = val;
- if (kstrtoul(parm[2], 10, &val) == 0)
- y = val;
- pr_info("pos x :%d, pos y :%d\n", x, y);
- vdin_set_prob_matrix0_xy(devp->addr_offset, x, y, devp);
- } else
- pr_err("miss parameters .\n");
- } else if (!strcmp(parm[0], "mat0_set")) {
- unsigned int x = 0;
-
- if (!parm[1])
- pr_err("miss parameters .\n");
- if (kstrtoul(parm[1], 10, &val) == 0)
- x = val;
- pr_info("matrix set : %d\n", x);
- vdin_set_before_after_mat0(devp->addr_offset, x, devp);
} else if (!strcmp(parm[0], "hdr")) {
int i;
struct vframe_master_display_colour_s *prop;
/* Ref.2019/04/25: tl1 vdin0 afbce dynamically switch support,
* vpp also should support this function
*/
-#define VDIN_VER "Ref.2019/08/2:hdmi yuv422 vdin set 10 bit mode"
+#define VDIN_VER "Ref.2019/08/22:add vdin pixel probe feature"
/*the counter of vdin*/
#define VDIN_MAX_DEVS 2