Skip to contentSkip to conversation

media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format

RFC PATCH Superseded Jacob Chen 1 participant 5 messages Nov 15, 2017

Subsystems (4)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Jacob Chen

author
#0 lore raw

RFC PATCH 1/5 media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format

From: Shunqian Zheng <[email protected]>

Add the Rockchip ISP1 specific processing parameter format V4L2_META_FMT_RK_ISP1_PARAMS and metadata format V4L2_META_FMT_RK_ISP1_STAT_3A for 3A.

---
 drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
 include/uapi/linux/videodev2.h       | 4 ++++
 2 files changed, 6 insertions(+)
drivers/media/v4l2-core/v4l2-ioctl.c +2 -0
index d6587b3ec33e..0604ae9ea444 100644
@@ -1252,6 +1252,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
 	case V4L2_TCH_FMT_TU08:		descr = "8-bit unsigned touch data"; break;
 	case V4L2_META_FMT_VSP1_HGO:	descr = "R-Car VSP1 1-D Histogram"; break;
 	case V4L2_META_FMT_VSP1_HGT:	descr = "R-Car VSP1 2-D Histogram"; break;
+	case V4L2_META_FMT_RK_ISP1_PARAMS:	descr = "Rockchip ISP1 3A params"; break;
+	case V4L2_META_FMT_RK_ISP1_STAT_3A:	descr = "Rockchip ISP1 3A statistics"; break;
 
 	default:
 		/* Compressed formats */
include/uapi/linux/videodev2.h +4 -0
index e507b29ba1e0..14efa6513126 100644
@@ -690,6 +690,10 @@ struct v4l2_pix_format {
 #define V4L2_META_FMT_VSP1_HGO    v4l2_fourcc('V', 'S', 'P', 'H') /* R-Car VSP1 1-D Histogram */
 #define V4L2_META_FMT_VSP1_HGT    v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */
 
+/* Vendor specific - used for IPU3 camera sub-system */
+#define V4L2_META_FMT_RK_ISP1_PARAMS	v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 params */
+#define V4L2_META_FMT_RK_ISP1_STAT_3A	v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A statistics */
+
 /* priv field value to indicates that subsequent fields are valid. */
 #define V4L2_PIX_FMT_PRIV_MAGIC		0xfeedcafe
 
Signature · 1 line
2.14.2
author
#1 lore raw

RFC PATCH 2/5 media: rkisp1: Add user space ABI definitions

From: Jeffy Chen <[email protected]>

Add the header for userspace

---
 include/uapi/linux/rkisp1-config.h | 554 +++++++++++++++++++++++++++++++++++++
 1 file changed, 554 insertions(+)
 create mode 100644 include/uapi/linux/rkisp1-config.h
include/uapi/linux/rkisp1-config.h new file +554 -0
new file mode 100644
index 000000000000..a801fbc9ef47
@@ -0,0 +1,554 @@
+/*
+ * Rockchip isp1 driver
+ *
+ * Copyright (C) 2017 Rockchip Electronics Co., Ltd.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef _UAPI_RKISP1_CONFIG_H
+#define _UAPI_RKISP1_CONFIG_H
+
+#include <linux/types.h>
+#include <linux/v4l2-controls.h>
+
+#define CIFISP_MODULE_DPCC              (1 << 0)
+#define CIFISP_MODULE_BLS               (1 << 1)
+#define CIFISP_MODULE_SDG               (1 << 2)
+#define CIFISP_MODULE_HST               (1 << 3)
+#define CIFISP_MODULE_LSC               (1 << 4)
+#define CIFISP_MODULE_AWB_GAIN          (1 << 5)
+#define CIFISP_MODULE_FLT               (1 << 6)
+#define CIFISP_MODULE_BDM               (1 << 7)
+#define CIFISP_MODULE_CTK               (1 << 8)
+#define CIFISP_MODULE_GOC               (1 << 9)
+#define CIFISP_MODULE_CPROC             (1 << 10)
+#define CIFISP_MODULE_AFC               (1 << 11)
+#define CIFISP_MODULE_AWB               (1 << 12)
+#define CIFISP_MODULE_IE                (1 << 13)
+#define CIFISP_MODULE_AEC               (1 << 14)
+#define CIFISP_MODULE_WDR               (1 << 15)
+#define CIFISP_MODULE_DPF               (1 << 16)
+#define CIFISP_MODULE_DPF_STRENGTH      (1 << 17)
+
+#define CIFISP_CTK_COEFF_MAX            0x100
+#define CIFISP_CTK_OFFSET_MAX           0x800
+
+#define CIFISP_AE_MEAN_MAX              25
+#define CIFISP_HIST_BIN_N_MAX           16
+#define CIFISP_AFM_MAX_WINDOWS          3
+#define CIFISP_DEGAMMA_CURVE_SIZE       17
+
+#define CIFISP_BDM_MAX_TH               0xFF
+
+/* maximum value for horizontal start address */
+#define CIFISP_BLS_START_H_MAX             0x00000FFF
+/* maximum value for horizontal stop address */
+#define CIFISP_BLS_STOP_H_MAX              0x00000FFF
+/* maximum value for vertical start address */
+#define CIFISP_BLS_START_V_MAX             0x00000FFF
+/* maximum value for vertical stop address */
+#define CIFISP_BLS_STOP_V_MAX              0x00000FFF
+/* maximum is 2^18 = 262144*/
+#define CIFISP_BLS_SAMPLES_MAX             0x00000012
+/* maximum value for fixed black level */
+#define CIFISP_BLS_FIX_SUB_MAX             0x00000FFF
+/* minimum value for fixed black level */
+#define CIFISP_BLS_FIX_SUB_MIN             0xFFFFF000
+/* 13 bit range (signed)*/
+#define CIFISP_BLS_FIX_MASK                0x00001FFF
+/* AWB */
+#define CIFISP_AWB_MAX_GRID                1
+#define CIFISP_AWB_MAX_FRAMES              7
+
+/* Gamma out*/
+/* Maximum number of color samples supported */
+#define CIFISP_GAMMA_OUT_MAX_SAMPLES       17
+
+/* LSC */
+#define CIFISP_LSC_GRAD_TBL_SIZE           8
+#define CIFISP_LSC_SIZE_TBL_SIZE           8
+/*
+ * The following matches the tuning process,
+ * not the max capabilities of the chip.
+ * Last value unused.
+ */
+#define	CIFISP_LSC_DATA_TBL_SIZE           290
+/* HIST */
+/* Last 3 values unused. */
+#define CIFISP_HISTOGRAM_WEIGHT_GRIDS_SIZE 28
+
+/* DPCC */
+#define CIFISP_DPCC_METHODS_MAX       3
+
+/* DPF */
+#define CIFISP_DPF_MAX_NLF_COEFFS      17
+#define CIFISP_DPF_MAX_SPATIAL_COEFFS  6
+
+/* measurement types */
+#define CIFISP_STAT_AWB           (1 << 0)
+#define CIFISP_STAT_AUTOEXP       (1 << 1)
+#define CIFISP_STAT_AFM_FIN       (1 << 2)
+#define CIFISP_STAT_HIST          (1 << 3)
+
+enum cifisp_histogram_mode {
+	CIFISP_HISTOGRAM_MODE_DISABLE,
+	CIFISP_HISTOGRAM_MODE_RGB_COMBINED,
+	CIFISP_HISTOGRAM_MODE_R_HISTOGRAM,
+	CIFISP_HISTOGRAM_MODE_G_HISTOGRAM,
+	CIFISP_HISTOGRAM_MODE_B_HISTOGRAM,
+	CIFISP_HISTOGRAM_MODE_Y_HISTOGRAM
+};
+
+enum cifisp_exp_meas_mode {
+/* < Y = 16 + 0.25R + 0.5G + 0.1094B */
+	CIFISP_EXP_MEASURING_MODE_0,
+/* < Y = (R + G + B) x (85/256) */
+	CIFISP_EXP_MEASURING_MODE_1,
+};
+
+enum cifisp_exp_ctrl_auotostop {
+	CIFISP_EXP_CTRL_AUTOSTOP_0 = 0,
+	CIFISP_EXP_CTRL_AUTOSTOP_1 = 1,
+};
+
+struct cifisp_window {
+	unsigned short h_offs;
+	unsigned short v_offs;
+	unsigned short h_size;
+	unsigned short v_size;
+};
+
+enum cifisp_awb_mode_type {
+	CIFISP_AWB_MODE_MANUAL,
+	CIFISP_AWB_MODE_RGB,
+	CIFISP_AWB_MODE_YCBCR
+};
+
+enum cifisp_flt_mode {
+	CIFISP_FLT_STATIC_MODE,
+	CIFISP_FLT_DYNAMIC_MODE
+};
+
+/*
+ * BLS fixed subtraction values. The values will be subtracted from the sensor
+ * values. Therefore a negative value means addition instead of subtraction!
+ */
+struct cifisp_bls_fixed_val {
+	/*! Fixed (signed!) subtraction value for Bayer pattern R. */
+	signed short r;
+	/*! Fixed (signed!) subtraction value for Bayer pattern Gr. */
+	signed short gr;
+	/*! Fixed (signed!) subtraction value for Bayer pattern Gb. */
+	signed short gb;
+	/*! Fixed (signed!) subtraction value for Bayer pattern B. */
+	signed short b;
+};
+
+/* Configuration used by black level subtraction */
+struct cifisp_bls_config {
+	/*
+	 * Automatic mode activated means that the measured values
+	 * are subtracted.Otherwise the fixed subtraction
+	 * values will be subtracted.
+	 */
+	bool enable_auto;
+	unsigned char en_windows;
+	struct cifisp_window bls_window1;	/* < Measurement window 1. */
+	struct cifisp_window bls_window2;	/* !< Measurement window 2 */
+	/*
+	 * Set amount of measured pixels for each Bayer position
+	 * (A, B,C and D) to 2^bls_samples.
+	 */
+	unsigned char bls_samples;
+	/* !< Fixed subtraction values. */
+	struct cifisp_bls_fixed_val fixed_val;
+};
+
+struct cifisp_dpcc_methods_config {
+	unsigned int method;
+	unsigned int line_thresh;
+	unsigned int line_mad_fac;
+	unsigned int pg_fac;
+	unsigned int rnd_thresh;
+	unsigned int rg_fac;
+};
+
+struct cifisp_dpcc_config {
+	unsigned int mode;
+	unsigned int output_mode;
+	unsigned int set_use;
+	struct cifisp_dpcc_methods_config methods[CIFISP_DPCC_METHODS_MAX];
+	unsigned int ro_limits;
+	unsigned int rnd_offs;
+};
+
+struct cifisp_gamma_corr_curve {
+	unsigned short gamma_y[CIFISP_DEGAMMA_CURVE_SIZE];
+};
+
+struct cifisp_gamma_curve_x_axis_pnts {
+	unsigned int gamma_dx0;
+	unsigned int gamma_dx1;
+};
+
+/* Configuration used by sensor degamma */
+struct cifisp_sdg_config {
+	struct cifisp_gamma_corr_curve curve_r;
+	struct cifisp_gamma_corr_curve curve_g;
+	struct cifisp_gamma_corr_curve curve_b;
+	struct cifisp_gamma_curve_x_axis_pnts xa_pnts;
+};
+
+/* Configuration used by Lens shading correction */
+struct cifisp_lsc_config {
+	unsigned int r_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];
+	unsigned int gr_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];
+	unsigned int gb_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];
+	unsigned int b_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];
+
+	unsigned int x_grad_tbl[CIFISP_LSC_GRAD_TBL_SIZE];
+	unsigned int y_grad_tbl[CIFISP_LSC_GRAD_TBL_SIZE];
+
+	unsigned int x_size_tbl[CIFISP_LSC_SIZE_TBL_SIZE];
+	unsigned int y_size_tbl[CIFISP_LSC_SIZE_TBL_SIZE];
+	unsigned short config_width;
+	unsigned short config_height;
+};
+
+struct cifisp_ie_config {
+	enum v4l2_colorfx effect;
+	unsigned short color_sel;
+	/* 3x3 Matrix Coefficients for Emboss Effect 1 */
+	unsigned short eff_mat_1;
+	/* 3x3 Matrix Coefficients for Emboss Effect 2 */
+	unsigned short eff_mat_2;
+	/* 3x3 Matrix Coefficients for Emboss 3/Sketch 1 */
+	unsigned short eff_mat_3;
+	/* 3x3 Matrix Coefficients for Sketch Effect 2 */
+	unsigned short eff_mat_4;
+	/* 3x3 Matrix Coefficients for Sketch Effect 3 */
+	unsigned short eff_mat_5;
+	/* Chrominance increment values of tint (used for sepia effect) */
+	unsigned short eff_tint;
+};
+
+struct cifisp_cproc_config {
+	unsigned char c_out_range;
+	unsigned char y_in_range;
+	unsigned char y_out_range;
+	unsigned char contrast;
+	unsigned char brightness;
+	unsigned char sat;
+	unsigned char hue;
+};
+
+/* Configuration used by auto white balance */
+struct cifisp_awb_meas_config {
+	/*
+	 * white balance measurement window (in pixels)
+	 * Note: currently the h and v offsets are mapped to grid offsets
+	 */
+	struct cifisp_window awb_wnd;
+	enum cifisp_awb_mode_type awb_mode;
+	/*
+	 * only pixels values < max_y contribute to awb measurement
+	 * (set to 0 to disable this feature)
+	 */
+	unsigned char max_y;
+	/* only pixels values > min_y contribute to awb measurement */
+	unsigned char min_y;
+	/*
+	 * Chrominance sum maximum value, only consider pixels with Cb+Cr
+	 * smaller than threshold for awb measurements
+	 */
+	unsigned char max_csum;
+	/*
+	 * Chrominance minimum value, only consider pixels with Cb/Cr
+	 * each greater than threshold value for awb measurements
+	 */
+	unsigned char min_c;
+	/*
+	 * number of frames - 1 used for mean value calculation
+	 * (ucFrames=0 means 1 Frame)
+	 */
+	unsigned char frames;
+	/* reference Cr value for AWB regulation, target for AWB */
+	unsigned char awb_ref_cr;
+	/* reference Cb value for AWB regulation, target for AWB */
+	unsigned char awb_ref_cb;
+	bool enable_ymax_cmp;
+};
+
+struct cifisp_awb_gain_config {
+	unsigned short gain_red;
+	unsigned short gain_green_r;
+	unsigned short gain_blue;
+	unsigned short gain_green_b;
+};
+
+/* Configuration used by ISP filtering */
+struct cifisp_flt_config {
+	enum cifisp_flt_mode mode;	/* ISP_FILT_MODE register fields */
+	unsigned char grn_stage1;	/* ISP_FILT_MODE register fields */
+	unsigned char chr_h_mode;	/* ISP_FILT_MODE register fields */
+	unsigned char chr_v_mode;	/* ISP_FILT_MODE register fields */
+	unsigned int thresh_bl0;
+	unsigned int thresh_bl1;
+	unsigned int thresh_sh0;
+	unsigned int thresh_sh1;
+	unsigned int lum_weight;
+	unsigned int fac_sh1;
+	unsigned int fac_sh0;
+	unsigned int fac_mid;
+	unsigned int fac_bl0;
+	unsigned int fac_bl1;
+};
+
+/* Configuration used by Bayer DeMosaic */
+struct cifisp_bdm_config {
+	unsigned char demosaic_th;
+};
+
+/* Configuration used by Cross Talk correction */
+struct cifisp_ctk_config {
+	unsigned short coeff0;
+	unsigned short coeff1;
+	unsigned short coeff2;
+	unsigned short coeff3;
+	unsigned short coeff4;
+	unsigned short coeff5;
+	unsigned short coeff6;
+	unsigned short coeff7;
+	unsigned short coeff8;
+	/* offset for the crosstalk correction matrix */
+	unsigned short ct_offset_r;
+	unsigned short ct_offset_g;
+	unsigned short ct_offset_b;
+};
+
+enum cifisp_goc_mode {
+	CIFISP_GOC_MODE_LOGARITHMIC,
+	CIFISP_GOC_MODE_EQUIDISTANT
+};
+
+/* Configuration used by Gamma Out correction */
+struct cifisp_goc_config {
+	enum cifisp_goc_mode mode;
+	unsigned short gamma_y[CIFISP_GAMMA_OUT_MAX_SAMPLES];
+};
+
+/* Configuration used by Histogram */
+struct cifisp_hst_config {
+	enum cifisp_histogram_mode mode;
+	unsigned char histogram_predivider;
+	struct cifisp_window meas_window;
+	unsigned char hist_weight[CIFISP_HISTOGRAM_WEIGHT_GRIDS_SIZE];
+};
+
+/* Configuration used by Auto Exposure Control */
+struct cifisp_aec_config {
+	enum cifisp_exp_meas_mode mode;
+	__u32 autostop;
+	struct cifisp_window meas_window;
+};
+
+struct cifisp_afc_config {
+	unsigned char num_afm_win;	/* max CIFISP_AFM_MAX_WINDOWS */
+	struct cifisp_window afm_win[CIFISP_AFM_MAX_WINDOWS];
+	unsigned int thres;
+	unsigned int var_shift;
+};
+
+enum cifisp_dpf_gain_usage {
+/* don't use any gains in preprocessing stage */
+	CIFISP_DPF_GAIN_USAGE_DISABLED,
+/* use only the noise function gains  from registers DPF_NF_GAIN_R, ... */
+	CIFISP_DPF_GAIN_USAGE_NF_GAINS,
+/* use only the gains from LSC module */
+	CIFISP_DPF_GAIN_USAGE_LSC_GAINS,
+/* use the moise function gains and the gains from LSC module */
+	CIFISP_DPF_GAIN_USAGE_NF_LSC_GAINS,
+/* use only the gains from AWB module */
+	CIFISP_DPF_GAIN_USAGE_AWB_GAINS,
+/* use the gains from AWB and LSC module */
+	CIFISP_DPF_GAIN_USAGE_AWB_LSC_GAINS,
+/* upper border (only for an internal evaluation) */
+	CIFISP_DPF_GAIN_USAGE_MAX
+};
+
+enum cifisp_dpf_rb_filtersize {
+/* red and blue filter kernel size 13x9 (means 7x5 active pixel) */
+	CIFISP_DPF_RB_FILTERSIZE_13x9,
+/* red and blue filter kernel size 9x9 (means 5x5 active pixel) */
+	CIFISP_DPF_RB_FILTERSIZE_9x9,
+};
+
+enum cifisp_dpf_nll_scale_mode {
+/* use a linear scaling */
+	CIFISP_NLL_SCALE_LINEAR,
+/* use a logarithmic scaling */
+	CIFISP_NLL_SCALE_LOGARITHMIC,
+};
+
+struct cifisp_dpf_nll {
+	unsigned short coeff[CIFISP_DPF_MAX_NLF_COEFFS];
+	enum cifisp_dpf_nll_scale_mode scale_mode;
+};
+
+struct cifisp_dpf_rb_flt {
+	enum cifisp_dpf_rb_filtersize fltsize;
+	unsigned char spatial_coeff[CIFISP_DPF_MAX_SPATIAL_COEFFS];
+	bool r_enable;
+	bool b_enable;
+};
+
+struct cifisp_dpf_g_flt {
+	unsigned char spatial_coeff[CIFISP_DPF_MAX_SPATIAL_COEFFS];
+	bool gr_enable;
+	bool gb_enable;
+};
+
+struct cifisp_dpf_gain {
+	enum cifisp_dpf_gain_usage mode;
+	unsigned short nf_r_gain;
+	unsigned short nf_b_gain;
+	unsigned short nf_gr_gain;
+	unsigned short nf_gb_gain;
+};
+
+struct cifisp_dpf_config {
+	struct cifisp_dpf_gain gain;
+	struct cifisp_dpf_g_flt g_flt;
+	struct cifisp_dpf_rb_flt rb_flt;
+	struct cifisp_dpf_nll nll;
+};
+
+struct cifisp_dpf_strength_config {
+	unsigned char r;
+	unsigned char g;
+	unsigned char b;
+};
+
+struct cifisp_isp_other_cfg {
+	struct cifisp_dpcc_config dpcc_config;
+	struct cifisp_bls_config bls_config;
+	struct cifisp_sdg_config sdg_config;
+	struct cifisp_lsc_config lsc_config;
+	struct cifisp_awb_gain_config awb_gain_config;
+	struct cifisp_flt_config flt_config;
+	struct cifisp_bdm_config bdm_config;
+	struct cifisp_ctk_config ctk_config;
+	struct cifisp_goc_config goc_config;
+	struct cifisp_dpf_config dpf_config;
+	struct cifisp_dpf_strength_config dpf_strength_config;
+	/* post process configs, including hue, sharpness, brightness, contrast, color effect */
+	/* TODO: removed from here ? set by standard v4l2 controls ? */
+	struct cifisp_cproc_config cproc_config;
+	struct cifisp_ie_config ie_config;
+};
+
+struct cifisp_isp_meas_cfg {
+	struct cifisp_awb_meas_config awb_meas_config;
+	struct cifisp_hst_config hst_config;
+	struct cifisp_aec_config aec_config;
+	struct cifisp_afc_config afc_config;
+};
+
+struct rkisp1_isp_params_cfg {
+	/* mask the enable bits of which module  should be updated */
+	unsigned int module_en_update;
+	/* mask the enable value of each module, only update the module which correspond
+	  * bit was set in module_en_update
+	  */
+	unsigned int module_ens;
+	/* mask the config bits of which module  should be updated */
+	unsigned int module_cfg_update;
+
+	struct cifisp_isp_meas_cfg meas;
+	struct cifisp_isp_other_cfg others;
+};
+
+/* measurement statistics */
+
+struct cifisp_awb_meas {
+	unsigned int cnt;
+	unsigned char mean_y_or_g;
+	unsigned char mean_cb_or_b;
+	unsigned char mean_cr_or_r;
+};
+
+struct cifisp_awb_stat {
+	struct cifisp_awb_meas awb_mean[CIFISP_AWB_MAX_GRID];
+};
+
+struct cifisp_hist_stat {
+	unsigned short hist_bins[CIFISP_HIST_BIN_N_MAX];
+};
+
+/*! BLS mean measured values */
+struct cifisp_bls_meas_val {
+	/*! Mean measured value for Bayer pattern R. */
+	unsigned short meas_r;
+	/*! Mean measured value for Bayer pattern Gr. */
+	unsigned short meas_gr;
+	/*! Mean measured value for Bayer pattern Gb. */
+	unsigned short meas_gb;
+	/*! Mean measured value for Bayer pattern B. */
+	unsigned short meas_b;
+};
+
+struct cifisp_ae_stat {
+	unsigned char exp_mean[CIFISP_AE_MEAN_MAX];
+	struct cifisp_bls_meas_val bls_val;	/* available wit exposure results */
+};
+
+struct cifisp_af_meas_val {
+	unsigned int sum;
+	unsigned int lum;
+};
+
+struct cifisp_af_stat {
+	struct cifisp_af_meas_val window[CIFISP_AFM_MAX_WINDOWS];
+};
+
+struct cifisp_stat {
+	struct cifisp_awb_stat awb;
+	struct cifisp_ae_stat ae;
+	struct cifisp_af_stat af;
+	struct cifisp_hist_stat hist;
+};
+
+struct rkisp1_stat_buffer {
+	unsigned int meas_type;
+	unsigned int frame_id;
+	struct cifisp_stat params;
+};
+
+#endif /* _UAPI_RKISP1_CONFIG_H */
Signature · 1 line
2.14.2
author
#2 lore raw

RFC PATCH 3/5 media: rkisp1: add rockchip isp1 driver

In reply to Jacob Chen

From: Jacob Chen <[email protected]>

This commit adds a ISP(Camera) v4l2 driver for rockchip rk3288/rk3399 SoC.

---
 drivers/media/platform/Kconfig                     |   10 +
 drivers/media/platform/Makefile                    |    1 +
 drivers/media/platform/rockchip/isp1/Makefile      |    9 +
 drivers/media/platform/rockchip/isp1/capture.c     | 1678 ++++++++++++++++++++
 drivers/media/platform/rockchip/isp1/capture.h     |   46 +
 drivers/media/platform/rockchip/isp1/common.h      |  327 ++++
 drivers/media/platform/rockchip/isp1/dev.c         |  728 +++++++++
 drivers/media/platform/rockchip/isp1/isp_params.c  | 1556 ++++++++++++++++++
 drivers/media/platform/rockchip/isp1/isp_params.h  |   81 +
 drivers/media/platform/rockchip/isp1/isp_stats.c   |  537 +++++++
 drivers/media/platform/rockchip/isp1/isp_stats.h   |   81 +
 .../media/platform/rockchip/isp1/mipi_dphy_sy.c    |  619 ++++++++
 .../media/platform/rockchip/isp1/mipi_dphy_sy.h    |   42 +
 drivers/media/platform/rockchip/isp1/regs.c        |  251 +++
 drivers/media/platform/rockchip/isp1/regs.h        | 1578 ++++++++++++++++++
 drivers/media/platform/rockchip/isp1/rkisp1.c      | 1132 +++++++++++++
 drivers/media/platform/rockchip/isp1/rkisp1.h      |  130 ++
 17 files changed, 8806 insertions(+)
 create mode 100644 drivers/media/platform/rockchip/isp1/Makefile
 create mode 100644 drivers/media/platform/rockchip/isp1/capture.c
 create mode 100644 drivers/media/platform/rockchip/isp1/capture.h
 create mode 100644 drivers/media/platform/rockchip/isp1/common.h
 create mode 100644 drivers/media/platform/rockchip/isp1/dev.c
 create mode 100644 drivers/media/platform/rockchip/isp1/isp_params.c
 create mode 100644 drivers/media/platform/rockchip/isp1/isp_params.h
 create mode 100644 drivers/media/platform/rockchip/isp1/isp_stats.c
 create mode 100644 drivers/media/platform/rockchip/isp1/isp_stats.h
 create mode 100644 drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c
 create mode 100644 drivers/media/platform/rockchip/isp1/mipi_dphy_sy.h
 create mode 100644 drivers/media/platform/rockchip/isp1/regs.c
 create mode 100644 drivers/media/platform/rockchip/isp1/regs.h
 create mode 100644 drivers/media/platform/rockchip/isp1/rkisp1.c
 create mode 100644 drivers/media/platform/rockchip/isp1/rkisp1.h
drivers/media/platform/Kconfig +10 -0
index fd0c99859d6f..062fffc9ffb6 100644
@@ -117,6 +117,16 @@ config VIDEO_QCOM_CAMSS
 	select VIDEOBUF2_DMA_SG
 	select V4L2_FWNODE
 
+config VIDEO_ROCKCHIP_ISP1
+	tristate "Rockchip Image Signal Processing v1 Unit driver"
+	depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+	depends on ARCH_ROCKCHIP || COMPILE_TEST
+	select VIDEOBUF2_DMA_CONTIG
+	select V4L2_FWNODE
+	default n
+	---help---
+	  Support for ISP1 on the rockchip SoC.
+
 config VIDEO_S3C_CAMIF
 	tristate "Samsung S3C24XX/S3C64XX SoC Camera Interface driver"
 	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
drivers/media/platform/Makefile +1 -0
index 012eb4782156..0896bb014a7f 100644
@@ -66,6 +66,7 @@ obj-$(CONFIG_VIDEO_RENESAS_FDP1)	+= rcar_fdp1.o
 obj-$(CONFIG_VIDEO_RENESAS_JPU) 	+= rcar_jpu.o
 obj-$(CONFIG_VIDEO_RENESAS_VSP1)	+= vsp1/
 
+obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1)	+= rockchip/isp1/
 obj-$(CONFIG_VIDEO_ROCKCHIP_RGA)	+= rockchip/rga/
 
 obj-y	+= omap/
drivers/media/platform/rockchip/isp1/Makefile new file +9 -0
new file mode 100644
index 000000000000..5cd0747c03c0
@@ -0,0 +1,9 @@
+
+obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1) += 	video_rkisp1.o
+video_rkisp1-objs 	   += 	rkisp1.o \
+				dev.o \
+				regs.o \
+				isp_stats.o \
+				isp_params.o \
+				mipi_dphy_sy.o \
+				capture.o
drivers/media/platform/rockchip/isp1/capture.c new file +1678 -0

1,678 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/capture.h new file +46 -0

46 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/common.h new file +327 -0

327 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/dev.c new file +728 -0

728 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/isp_params.c new file +1556 -0

189 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/isp_params.h new file +81 -0

81 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/isp_stats.c new file +537 -0

537 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/isp_stats.h new file +81 -0

81 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c new file +619 -0

619 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/mipi_dphy_sy.h new file +42 -0

42 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/regs.c new file +251 -0

251 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/regs.h new file +1578 -0

1,578 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/rkisp1.c new file +1132 -0

1,132 lines not on this page · raw message

drivers/media/platform/rockchip/isp1/rkisp1.h new file +130 -0

130 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.14.2

Part of the diff is not shown here. View the raw message.

author
#3 lore raw

RFC PATCH 4/5 arm64: dts: rockchip: add isp0 node for rk3399

In reply to Jacob Chen

From: Shunqian Zheng <[email protected]>

rk3399 have two ISP, but we havn't test isp1, so just add isp0 at present.

---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +26 -0
index ab7629c5b856..f696e62d09dd 100644
@@ -1577,6 +1577,32 @@
 		status = "disabled";
 	};
 
+	isp0: isp0 at ff910000 {
+		compatible = "rockchip,rk3399-cif-isp";
+		reg = <0x0 0xff910000 0x0 0x4000>;
+		interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH 0>;
+		clocks = <&cru SCLK_ISP0>,
+			 <&cru ACLK_ISP0>, <&cru ACLK_ISP0_WRAPPER>,
+			 <&cru HCLK_ISP0>, <&cru HCLK_ISP0_WRAPPER>;
+		clock-names = "clk_isp",
+			      "aclk_isp", "aclk_isp_wrap",
+			      "hclk_isp", "hclk_isp_wrap";
+		power-domains = <&power RK3399_PD_ISP0>;
+		iommus = <&isp0_mmu>;
+		status = "disabled";
+
+		isp_mipi_dphy_rx0: isp-mipi-dphy-rx0 {
+			compatible = "rockchip,rk3399-mipi-dphy";
+			rockchip,grf = <&grf>;
+			clocks = <&cru SCLK_MIPIDPHY_REF>,
+				 <&cru SCLK_DPHY_RX0_CFG>,
+				 <&cru PCLK_VIO_GRF>;
+			clock-names = "dphy-ref", "dphy-cfg", "grf";
+			power-domains = <&power RK3399_PD_VIO>;
+			status = "disabled";
+		};
+	};
+
 	isp0_mmu: iommu at ff914000 {
 		compatible = "rockchip,iommu";
 		reg = <0x0 0xff914000 0x0 0x100>, <0x0 0xff915000 0x0 0x100>;
Signature · 1 line
2.14.2
author
#4 lore raw

RFC PATCH 5/5 ARM: dts: rockchip: add isp node for rk3288

In reply to Jacob Chen

From: Jacob Chen <[email protected]>

rk3288 have a Embedded 13M ISP and MIPI-CSI2 interface.

---
 arch/arm/boot/dts/rk3288.dtsi | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm/boot/dts/rk3288.dtsi +24 -0
index 60658c5c9a48..f9a81137146d 100644
@@ -962,6 +962,30 @@
 		status = "disabled";
 	};
 
+	isp: isp at ff910000 {
+		compatible = "rockchip,rk3288-cif-isp";
+		reg = <0x0 0xff910000 0x0 0x4000>;
+		interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru SCLK_ISP>, <&cru ACLK_ISP>,
+			 <&cru HCLK_ISP>, <&cru PCLK_ISP_IN>,
+			 <&cru SCLK_ISP_JPE>;
+		clock-names = "clk_isp", "aclk_isp",
+			      "hclk_isp", "pclk_isp_in",
+			      "sclk_isp_jpe";
+		assigned-clocks = <&cru SCLK_ISP>;
+		assigned-clock-rates = <400000000>;
+		power-domains = <&power RK3288_PD_VIO>;
+		iommus = <&isp_mmu>;
+		status = "disabled";
+		isp_mipi_phy_rx0: isp-mipi-phy-rx0 {
+			compatible = "rockchip,rk3288-mipi-dphy";
+			rockchip,grf = <&grf>;
+			clocks = <&cru SCLK_MIPIDSI_24M>, <&cru PCLK_MIPI_CSI>;
+			clock-names = "dphy-ref", "pclk";
+			status = "disabled";
+		};
+	};
+
 	isp_mmu: iommu at ff914000 {
 		compatible = "rockchip,iommu";
 		reg = <0x0 0xff914000 0x0 0x100>, <0x0 0xff915000 0x0 0x100>;
Signature · 1 line
2.14.2