mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 15:11:31 +00:00
Extensible parameters support for the rkisp1 driver
-----BEGIN PGP SIGNATURE----- iJgEABYKAEAWIQTAnvhxs4J7QT+XHKnMPy2AAyfeZAUCZry1ZyIcbGF1cmVudC5w aW5jaGFydEBpZGVhc29uYm9hcmQuY29tAAoJEMw/LYADJ95kkTQBAKZm34xgUyqh NjrFd4QEARsXbsH+6kZrh40prVzws97eAQDUM+OVykg6+mmuVOZITdX6+KRLxv5e bo+X5a+yYOW0BQ== =X2AX -----END PGP SIGNATURE----- Merge tag 'next-media-rkisp1-20240814' of git://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git Extensible parameters support for the rkisp1 driver. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
commit
a043ea54bb
@ -114,11 +114,18 @@ to be applied to the hardware during a video stream, allowing userspace
|
||||
to dynamically modify values such as black level, cross talk corrections
|
||||
and others.
|
||||
|
||||
The buffer format is defined by struct :c:type:`rkisp1_params_cfg`, and
|
||||
userspace should set
|
||||
The ISP driver supports two different parameters configuration methods, the
|
||||
`fixed parameters format` or the `extensible parameters format`.
|
||||
|
||||
When using the `fixed parameters` method the buffer format is defined by struct
|
||||
:c:type:`rkisp1_params_cfg`, and userspace should set
|
||||
:ref:`V4L2_META_FMT_RK_ISP1_PARAMS <v4l2-meta-fmt-rk-isp1-params>` as the
|
||||
dataformat.
|
||||
|
||||
When using the `extensible parameters` method the buffer format is defined by
|
||||
struct :c:type:`rkisp1_ext_params_cfg`, and userspace should set
|
||||
:ref:`V4L2_META_FMT_RK_ISP1_EXT_PARAMS <v4l2-meta-fmt-rk-isp1-ext-params>` as
|
||||
the dataformat.
|
||||
|
||||
Capturing Video Frames Example
|
||||
==============================
|
||||
|
@ -1,28 +1,67 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
.. _v4l2-meta-fmt-rk-isp1-params:
|
||||
|
||||
.. _v4l2-meta-fmt-rk-isp1-stat-3a:
|
||||
|
||||
*****************************************************************************
|
||||
V4L2_META_FMT_RK_ISP1_PARAMS ('rk1p'), V4L2_META_FMT_RK_ISP1_STAT_3A ('rk1s')
|
||||
*****************************************************************************
|
||||
************************************************************************************************************************
|
||||
V4L2_META_FMT_RK_ISP1_PARAMS ('rk1p'), V4L2_META_FMT_RK_ISP1_STAT_3A ('rk1s'), V4L2_META_FMT_RK_ISP1_EXT_PARAMS ('rk1e')
|
||||
************************************************************************************************************************
|
||||
|
||||
========================
|
||||
Configuration parameters
|
||||
========================
|
||||
|
||||
The configuration parameters are passed to the
|
||||
The configuration of the RkISP1 ISP is performed by userspace by providing
|
||||
parameters for the ISP to the driver using the :c:type:`v4l2_meta_format`
|
||||
interface.
|
||||
|
||||
There are two methods that allow to configure the ISP, the `fixed parameters`
|
||||
configuration format and the `extensible parameters` configuration
|
||||
format.
|
||||
|
||||
.. _v4l2-meta-fmt-rk-isp1-params:
|
||||
|
||||
Fixed parameters configuration format
|
||||
=====================================
|
||||
|
||||
When using the fixed configuration format, parameters are passed to the
|
||||
:ref:`rkisp1_params <rkisp1_params>` metadata output video node, using
|
||||
the :c:type:`v4l2_meta_format` interface. The buffer contains
|
||||
a single instance of the C structure :c:type:`rkisp1_params_cfg` defined in
|
||||
``rkisp1-config.h``. So the structure can be obtained from the buffer by:
|
||||
the `V4L2_META_FMT_RK_ISP1_PARAMS` meta format.
|
||||
|
||||
The buffer contains a single instance of the C structure
|
||||
:c:type:`rkisp1_params_cfg` defined in ``rkisp1-config.h``. So the structure can
|
||||
be obtained from the buffer by:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
struct rkisp1_params_cfg *params = (struct rkisp1_params_cfg*) buffer;
|
||||
|
||||
This method supports a subset of the ISP features only, new applications should
|
||||
use the extensible parameters method.
|
||||
|
||||
.. _v4l2-meta-fmt-rk-isp1-ext-params:
|
||||
|
||||
Extensible parameters configuration format
|
||||
==========================================
|
||||
|
||||
When using the extensible configuration format, parameters are passed to the
|
||||
:ref:`rkisp1_params <rkisp1_params>` metadata output video node, using
|
||||
the `V4L2_META_FMT_RK_ISP1_EXT_PARAMS` meta format.
|
||||
|
||||
The buffer contains a single instance of the C structure
|
||||
:c:type:`rkisp1_ext_params_cfg` defined in ``rkisp1-config.h``. The
|
||||
:c:type:`rkisp1_ext_params_cfg` structure is designed to allow userspace to
|
||||
populate the data buffer with only the configuration data for the ISP blocks it
|
||||
intends to configure. The extensible parameters format design allows developers
|
||||
to define new block types to support new configuration parameters, and defines a
|
||||
versioning scheme so that it can be extended and versioned without breaking
|
||||
compatibility with existing applications.
|
||||
|
||||
For these reasons, this configuration method is preferred over the `fixed
|
||||
parameters` format alternative.
|
||||
|
||||
.. rkisp1_stat_buffer
|
||||
|
||||
===========================
|
||||
3A and histogram statistics
|
||||
===========================
|
||||
|
||||
|
@ -178,3 +178,17 @@ void rkisp1_sd_adjust_crop(struct v4l2_rect *crop,
|
||||
|
||||
rkisp1_sd_adjust_crop_rect(crop, &crop_bounds);
|
||||
}
|
||||
|
||||
void rkisp1_bls_swap_regs(enum rkisp1_fmt_raw_pat_type pattern,
|
||||
const u32 input[4], u32 output[4])
|
||||
{
|
||||
static const unsigned int swap[4][4] = {
|
||||
[RKISP1_RAW_RGGB] = { 0, 1, 2, 3 },
|
||||
[RKISP1_RAW_GRBG] = { 1, 0, 3, 2 },
|
||||
[RKISP1_RAW_GBRG] = { 2, 3, 0, 1 },
|
||||
[RKISP1_RAW_BGGR] = { 3, 2, 1, 0 },
|
||||
};
|
||||
|
||||
for (unsigned int i = 0; i < 4; ++i)
|
||||
output[i] = input[swap[pattern][i]];
|
||||
}
|
||||
|
@ -33,9 +33,10 @@ struct regmap;
|
||||
#define RKISP1_ISP_SD_SRC BIT(0)
|
||||
#define RKISP1_ISP_SD_SINK BIT(1)
|
||||
|
||||
/* min and max values for the widths and heights of the entities */
|
||||
#define RKISP1_ISP_MAX_WIDTH 4032
|
||||
#define RKISP1_ISP_MAX_HEIGHT 3024
|
||||
/*
|
||||
* Minimum values for the width and height of entities. The maximum values are
|
||||
* model-specific and stored in the rkisp1_info structure.
|
||||
*/
|
||||
#define RKISP1_ISP_MIN_WIDTH 32
|
||||
#define RKISP1_ISP_MIN_HEIGHT 32
|
||||
|
||||
@ -115,6 +116,8 @@ enum rkisp1_isp_pad {
|
||||
* @RKISP1_FEATURE_SELF_PATH: The ISP has a self path
|
||||
* @RKISP1_FEATURE_DUAL_CROP: The ISP has the dual crop block at the resizer input
|
||||
* @RKISP1_FEATURE_DMA_34BIT: The ISP uses 34-bit DMA addresses
|
||||
* @RKISP1_FEATURE_BLS: The ISP has a dedicated BLS block
|
||||
* @RKISP1_FEATURE_COMPAND: The ISP has a companding block
|
||||
*
|
||||
* The ISP features are stored in a bitmask in &rkisp1_info.features and allow
|
||||
* the driver to implement support for features present in some ISP versions
|
||||
@ -126,6 +129,8 @@ enum rkisp1_feature {
|
||||
RKISP1_FEATURE_SELF_PATH = BIT(2),
|
||||
RKISP1_FEATURE_DUAL_CROP = BIT(3),
|
||||
RKISP1_FEATURE_DMA_34BIT = BIT(4),
|
||||
RKISP1_FEATURE_BLS = BIT(5),
|
||||
RKISP1_FEATURE_COMPAND = BIT(6),
|
||||
};
|
||||
|
||||
#define rkisp1_has_feature(rkisp1, feature) \
|
||||
@ -140,6 +145,8 @@ enum rkisp1_feature {
|
||||
* @isr_size: number of entries in the @isrs array
|
||||
* @isp_ver: ISP version
|
||||
* @features: bitmask of rkisp1_feature features implemented by the ISP
|
||||
* @max_width: maximum input frame width
|
||||
* @max_height: maximum input frame height
|
||||
*
|
||||
* This structure contains information about the ISP specific to a particular
|
||||
* ISP model, version, or integration in a particular SoC.
|
||||
@ -151,6 +158,8 @@ struct rkisp1_info {
|
||||
unsigned int isr_size;
|
||||
enum rkisp1_cif_isp_version isp_ver;
|
||||
unsigned int features;
|
||||
unsigned int max_width;
|
||||
unsigned int max_height;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -232,7 +241,7 @@ struct rkisp1_vdev_node {
|
||||
|
||||
/*
|
||||
* struct rkisp1_buffer - A container for the vb2 buffers used by the video devices:
|
||||
* params, stats, mainpath, selfpath
|
||||
* stats, mainpath, selfpath
|
||||
*
|
||||
* @vb: vb2 buffer
|
||||
* @queue: entry of the buffer in the queue
|
||||
@ -244,6 +253,26 @@ struct rkisp1_buffer {
|
||||
dma_addr_t buff_addr[VIDEO_MAX_PLANES];
|
||||
};
|
||||
|
||||
/*
|
||||
* struct rkisp1_params_buffer - A container for the vb2 buffers used by the
|
||||
* params video device
|
||||
*
|
||||
* @vb: vb2 buffer
|
||||
* @queue: entry of the buffer in the queue
|
||||
* @cfg: scratch buffer used for caching the ISP configuration parameters
|
||||
*/
|
||||
struct rkisp1_params_buffer {
|
||||
struct vb2_v4l2_buffer vb;
|
||||
struct list_head queue;
|
||||
void *cfg;
|
||||
};
|
||||
|
||||
static inline struct rkisp1_params_buffer *
|
||||
to_rkisp1_params_buffer(struct vb2_v4l2_buffer *vbuf)
|
||||
{
|
||||
return container_of(vbuf, struct rkisp1_params_buffer, vb);
|
||||
}
|
||||
|
||||
/*
|
||||
* struct rkisp1_dummy_buffer - A buffer to write the next frame to in case
|
||||
* there are no vb2 buffers available.
|
||||
@ -372,9 +401,11 @@ struct rkisp1_params_ops {
|
||||
* @ops: pointer to the variant-specific operations
|
||||
* @config_lock: locks the buffer list 'params'
|
||||
* @params: queue of rkisp1_buffer
|
||||
* @vdev_fmt: v4l2_format of the metadata format
|
||||
* @metafmt the currently enabled metadata format
|
||||
* @quantization: the quantization configured on the isp's src pad
|
||||
* @ycbcr_encoding the YCbCr encoding
|
||||
* @raw_type: the bayer pattern on the isp video sink pad
|
||||
* @enabled_blocks: bitmask of enabled ISP blocks
|
||||
*/
|
||||
struct rkisp1_params {
|
||||
struct rkisp1_vdev_node vnode;
|
||||
@ -383,11 +414,14 @@ struct rkisp1_params {
|
||||
|
||||
spinlock_t config_lock; /* locks the buffers list 'params' */
|
||||
struct list_head params;
|
||||
struct v4l2_format vdev_fmt;
|
||||
|
||||
const struct v4l2_meta_format *metafmt;
|
||||
|
||||
enum v4l2_quantization quantization;
|
||||
enum v4l2_ycbcr_encoding ycbcr_encoding;
|
||||
enum rkisp1_fmt_raw_pat_type raw_type;
|
||||
|
||||
u32 enabled_blocks;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -573,6 +607,9 @@ void rkisp1_sd_adjust_crop_rect(struct v4l2_rect *crop,
|
||||
void rkisp1_sd_adjust_crop(struct v4l2_rect *crop,
|
||||
const struct v4l2_mbus_framefmt *bounds);
|
||||
|
||||
void rkisp1_bls_swap_regs(enum rkisp1_fmt_raw_pat_type pattern,
|
||||
const u32 input[4], u32 output[4]);
|
||||
|
||||
/*
|
||||
* rkisp1_mbus_info_get_by_code - get the isp info of the media bus code
|
||||
*
|
||||
|
@ -307,6 +307,7 @@ static int rkisp1_csi_set_fmt(struct v4l2_subdev *sd,
|
||||
struct v4l2_subdev_state *sd_state,
|
||||
struct v4l2_subdev_format *fmt)
|
||||
{
|
||||
struct rkisp1_csi *csi = to_rkisp1_csi(sd);
|
||||
const struct rkisp1_mbus_info *mbus_info;
|
||||
struct v4l2_mbus_framefmt *sink_fmt, *src_fmt;
|
||||
|
||||
@ -326,10 +327,10 @@ static int rkisp1_csi_set_fmt(struct v4l2_subdev *sd,
|
||||
|
||||
sink_fmt->width = clamp_t(u32, fmt->format.width,
|
||||
RKISP1_ISP_MIN_WIDTH,
|
||||
RKISP1_ISP_MAX_WIDTH);
|
||||
csi->rkisp1->info->max_width);
|
||||
sink_fmt->height = clamp_t(u32, fmt->format.height,
|
||||
RKISP1_ISP_MIN_HEIGHT,
|
||||
RKISP1_ISP_MAX_HEIGHT);
|
||||
csi->rkisp1->info->max_height);
|
||||
|
||||
fmt->format = *sink_fmt;
|
||||
|
||||
|
@ -509,7 +509,10 @@ static const struct rkisp1_info px30_isp_info = {
|
||||
.isp_ver = RKISP1_V12,
|
||||
.features = RKISP1_FEATURE_MIPI_CSI2
|
||||
| RKISP1_FEATURE_SELF_PATH
|
||||
| RKISP1_FEATURE_DUAL_CROP,
|
||||
| RKISP1_FEATURE_DUAL_CROP
|
||||
| RKISP1_FEATURE_BLS,
|
||||
.max_width = 3264,
|
||||
.max_height = 2448,
|
||||
};
|
||||
|
||||
static const char * const rk3399_isp_clks[] = {
|
||||
@ -530,7 +533,10 @@ static const struct rkisp1_info rk3399_isp_info = {
|
||||
.isp_ver = RKISP1_V10,
|
||||
.features = RKISP1_FEATURE_MIPI_CSI2
|
||||
| RKISP1_FEATURE_SELF_PATH
|
||||
| RKISP1_FEATURE_DUAL_CROP,
|
||||
| RKISP1_FEATURE_DUAL_CROP
|
||||
| RKISP1_FEATURE_BLS,
|
||||
.max_width = 4416,
|
||||
.max_height = 3312,
|
||||
};
|
||||
|
||||
static const char * const imx8mp_isp_clks[] = {
|
||||
@ -550,7 +556,10 @@ static const struct rkisp1_info imx8mp_isp_info = {
|
||||
.isr_size = ARRAY_SIZE(imx8mp_isp_isrs),
|
||||
.isp_ver = RKISP1_V_IMX8MP,
|
||||
.features = RKISP1_FEATURE_MAIN_STRIDE
|
||||
| RKISP1_FEATURE_DMA_34BIT,
|
||||
| RKISP1_FEATURE_DMA_34BIT
|
||||
| RKISP1_FEATURE_COMPAND,
|
||||
.max_width = 4096,
|
||||
.max_height = 3072,
|
||||
};
|
||||
|
||||
static const struct of_device_id rkisp1_of_match[] = {
|
||||
|
@ -517,6 +517,7 @@ static int rkisp1_isp_enum_frame_size(struct v4l2_subdev *sd,
|
||||
struct v4l2_subdev_state *sd_state,
|
||||
struct v4l2_subdev_frame_size_enum *fse)
|
||||
{
|
||||
struct rkisp1_isp *isp = to_rkisp1_isp(sd);
|
||||
const struct rkisp1_mbus_info *mbus_info;
|
||||
|
||||
if (fse->pad == RKISP1_ISP_PAD_SINK_PARAMS ||
|
||||
@ -539,9 +540,9 @@ static int rkisp1_isp_enum_frame_size(struct v4l2_subdev *sd,
|
||||
return -EINVAL;
|
||||
|
||||
fse->min_width = RKISP1_ISP_MIN_WIDTH;
|
||||
fse->max_width = RKISP1_ISP_MAX_WIDTH;
|
||||
fse->max_width = isp->rkisp1->info->max_width;
|
||||
fse->min_height = RKISP1_ISP_MIN_HEIGHT;
|
||||
fse->max_height = RKISP1_ISP_MAX_HEIGHT;
|
||||
fse->max_height = isp->rkisp1->info->max_height;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -772,10 +773,10 @@ static void rkisp1_isp_set_sink_fmt(struct rkisp1_isp *isp,
|
||||
|
||||
sink_fmt->width = clamp_t(u32, format->width,
|
||||
RKISP1_ISP_MIN_WIDTH,
|
||||
RKISP1_ISP_MAX_WIDTH);
|
||||
isp->rkisp1->info->max_width);
|
||||
sink_fmt->height = clamp_t(u32, format->height,
|
||||
RKISP1_ISP_MIN_HEIGHT,
|
||||
RKISP1_ISP_MAX_HEIGHT);
|
||||
isp->rkisp1->info->max_height);
|
||||
|
||||
/*
|
||||
* Adjust the color space fields. Accept any color primaries and
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -704,6 +704,12 @@
|
||||
#define RKISP1_CIF_ISP_DPF_SPATIAL_COEFF_MAX 0x1f
|
||||
#define RKISP1_CIF_ISP_DPF_NLL_COEFF_N_MAX 0x3ff
|
||||
|
||||
/* COMPAND */
|
||||
#define RKISP1_CIF_ISP_COMPAND_CTRL_EXPAND_ENABLE BIT(0)
|
||||
#define RKISP1_CIF_ISP_COMPAND_CTRL_COMPRESS_ENABLE BIT(1)
|
||||
#define RKISP1_CIF_ISP_COMPAND_CTRL_SOFT_RESET_FLAG BIT(2)
|
||||
#define RKISP1_CIF_ISP_COMPAND_CTRL_BLS_ENABLE BIT(3)
|
||||
|
||||
/* =================================================================== */
|
||||
/* CIF Registers */
|
||||
/* =================================================================== */
|
||||
@ -1394,6 +1400,23 @@
|
||||
#define RKISP1_CIF_ISP_VSM_DELTA_H (RKISP1_CIF_ISP_VSM_BASE + 0x0000001c)
|
||||
#define RKISP1_CIF_ISP_VSM_DELTA_V (RKISP1_CIF_ISP_VSM_BASE + 0x00000020)
|
||||
|
||||
#define RKISP1_CIF_ISP_COMPAND_BASE 0x00003200
|
||||
#define RKISP1_CIF_ISP_COMPAND_CTRL (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000000)
|
||||
#define RKISP1_CIF_ISP_COMPAND_BLS_A_FIXED (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000004)
|
||||
#define RKISP1_CIF_ISP_COMPAND_BLS_B_FIXED (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000008)
|
||||
#define RKISP1_CIF_ISP_COMPAND_BLS_C_FIXED (RKISP1_CIF_ISP_COMPAND_BASE + 0x0000000c)
|
||||
#define RKISP1_CIF_ISP_COMPAND_BLS_D_FIXED (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000010)
|
||||
#define RKISP1_CIF_ISP_COMPAND_EXPAND_PX_N(n) (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000014 + (n) * 4)
|
||||
#define RKISP1_CIF_ISP_COMPAND_COMPRESS_PX_N(n) (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000040 + (n) * 4)
|
||||
#define RKISP1_CIF_ISP_COMPAND_EXPAND_Y_ADDR (RKISP1_CIF_ISP_COMPAND_BASE + 0x0000006c)
|
||||
#define RKISP1_CIF_ISP_COMPAND_EXPAND_Y_WRITE_DATA (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000070)
|
||||
#define RKISP1_CIF_ISP_COMPAND_COMPRESS_Y_ADDR (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000074)
|
||||
#define RKISP1_CIF_ISP_COMPAND_COMPRESS_Y_WRITE_DATA (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000078)
|
||||
#define RKISP1_CIF_ISP_COMPAND_EXPAND_X_ADDR (RKISP1_CIF_ISP_COMPAND_BASE + 0x0000007c)
|
||||
#define RKISP1_CIF_ISP_COMPAND_EXPAND_X_WRITE_DATA (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000080)
|
||||
#define RKISP1_CIF_ISP_COMPAND_COMPRESS_X_ADDR (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000084)
|
||||
#define RKISP1_CIF_ISP_COMPAND_COMPRESS_X_WRITE_DATA (RKISP1_CIF_ISP_COMPAND_BASE + 0x00000088)
|
||||
|
||||
#define RKISP1_CIF_ISP_CSI0_BASE 0x00007000
|
||||
#define RKISP1_CIF_ISP_CSI0_CTRL0 (RKISP1_CIF_ISP_CSI0_BASE + 0x00000000)
|
||||
|
||||
|
@ -494,10 +494,10 @@ static void rkisp1_rsz_set_sink_fmt(struct rkisp1_resizer *rsz,
|
||||
|
||||
sink_fmt->width = clamp_t(u32, format->width,
|
||||
RKISP1_ISP_MIN_WIDTH,
|
||||
RKISP1_ISP_MAX_WIDTH);
|
||||
rsz->rkisp1->info->max_width);
|
||||
sink_fmt->height = clamp_t(u32, format->height,
|
||||
RKISP1_ISP_MIN_HEIGHT,
|
||||
RKISP1_ISP_MAX_HEIGHT);
|
||||
rsz->rkisp1->info->max_height);
|
||||
|
||||
/*
|
||||
* Adjust the color space fields. Accept any color primaries and
|
||||
|
@ -304,48 +304,25 @@ static void rkisp1_stats_get_hst_meas_v12(struct rkisp1_stats *stats,
|
||||
static void rkisp1_stats_get_bls_meas(struct rkisp1_stats *stats,
|
||||
struct rkisp1_stat_buffer *pbuf)
|
||||
{
|
||||
static const u32 regs[] = {
|
||||
RKISP1_CIF_ISP_BLS_A_MEASURED,
|
||||
RKISP1_CIF_ISP_BLS_B_MEASURED,
|
||||
RKISP1_CIF_ISP_BLS_C_MEASURED,
|
||||
RKISP1_CIF_ISP_BLS_D_MEASURED,
|
||||
};
|
||||
struct rkisp1_device *rkisp1 = stats->rkisp1;
|
||||
const struct rkisp1_mbus_info *in_fmt = rkisp1->isp.sink_fmt;
|
||||
struct rkisp1_cif_isp_bls_meas_val *bls_val;
|
||||
u32 swapped[4];
|
||||
|
||||
rkisp1_bls_swap_regs(in_fmt->bayer_pat, regs, swapped);
|
||||
|
||||
bls_val = &pbuf->params.ae.bls_val;
|
||||
if (in_fmt->bayer_pat == RKISP1_RAW_BGGR) {
|
||||
bls_val->meas_b =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_A_MEASURED);
|
||||
bls_val->meas_gb =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_B_MEASURED);
|
||||
bls_val->meas_gr =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_C_MEASURED);
|
||||
bls_val->meas_r =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_D_MEASURED);
|
||||
} else if (in_fmt->bayer_pat == RKISP1_RAW_GBRG) {
|
||||
bls_val->meas_gb =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_A_MEASURED);
|
||||
bls_val->meas_b =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_B_MEASURED);
|
||||
bls_val->meas_r =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_C_MEASURED);
|
||||
bls_val->meas_gr =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_D_MEASURED);
|
||||
} else if (in_fmt->bayer_pat == RKISP1_RAW_GRBG) {
|
||||
bls_val->meas_gr =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_A_MEASURED);
|
||||
bls_val->meas_r =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_B_MEASURED);
|
||||
bls_val->meas_b =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_C_MEASURED);
|
||||
bls_val->meas_gb =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_D_MEASURED);
|
||||
} else if (in_fmt->bayer_pat == RKISP1_RAW_RGGB) {
|
||||
bls_val->meas_r =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_A_MEASURED);
|
||||
bls_val->meas_gr =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_B_MEASURED);
|
||||
bls_val->meas_gb =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_C_MEASURED);
|
||||
bls_val->meas_b =
|
||||
rkisp1_read(rkisp1, RKISP1_CIF_ISP_BLS_D_MEASURED);
|
||||
}
|
||||
|
||||
bls_val->meas_r = rkisp1_read(rkisp1, swapped[0]);
|
||||
bls_val->meas_gr = rkisp1_read(rkisp1, swapped[1]);
|
||||
bls_val->meas_gb = rkisp1_read(rkisp1, swapped[2]);
|
||||
bls_val->meas_b = rkisp1_read(rkisp1, swapped[3]);
|
||||
}
|
||||
|
||||
static const struct rkisp1_stats_ops rkisp1_v10_stats_ops = {
|
||||
|
@ -1458,6 +1458,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
|
||||
case V4L2_META_FMT_VIVID: descr = "Vivid Metadata"; break;
|
||||
case V4L2_META_FMT_RK_ISP1_PARAMS: descr = "Rockchip ISP1 3A Parameters"; break;
|
||||
case V4L2_META_FMT_RK_ISP1_STAT_3A: descr = "Rockchip ISP1 3A Statistics"; break;
|
||||
case V4L2_META_FMT_RK_ISP1_EXT_PARAMS: descr = "Rockchip ISP1 Ext 3A Params"; break;
|
||||
case V4L2_PIX_FMT_NV12_8L128: descr = "NV12 (8x128 Linear)"; break;
|
||||
case V4L2_PIX_FMT_NV12M_8L128: descr = "NV12M (8x128 Linear)"; break;
|
||||
case V4L2_PIX_FMT_NV12_10BE_8L128: descr = "10-bit NV12 (8x128 Linear, BE)"; break;
|
||||
|
@ -164,6 +164,11 @@
|
||||
#define RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS 17
|
||||
#define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS 6
|
||||
|
||||
/*
|
||||
* Compand
|
||||
*/
|
||||
#define RKISP1_CIF_ISP_COMPAND_NUM_POINTS 64
|
||||
|
||||
/*
|
||||
* Measurement types
|
||||
*/
|
||||
@ -851,6 +856,39 @@ struct rkisp1_params_cfg {
|
||||
struct rkisp1_cif_isp_isp_other_cfg others;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct rkisp1_cif_isp_compand_bls_config - Rockchip ISP1 Companding parameters (BLS)
|
||||
* @r: Fixed subtraction value for Bayer pattern R
|
||||
* @gr: Fixed subtraction value for Bayer pattern Gr
|
||||
* @gb: Fixed subtraction value for Bayer pattern Gb
|
||||
* @b: Fixed subtraction value for Bayer pattern B
|
||||
*
|
||||
* The values will be subtracted from the sensor values. Note that unlike the
|
||||
* dedicated BLS block, the BLS values in the compander are 20-bit unsigned.
|
||||
*/
|
||||
struct rkisp1_cif_isp_compand_bls_config {
|
||||
__u32 r;
|
||||
__u32 gr;
|
||||
__u32 gb;
|
||||
__u32 b;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct rkisp1_cif_isp_compand_curve_config - Rockchip ISP1 Companding
|
||||
* parameters (expand and compression curves)
|
||||
* @px: Compand curve x-values. Each value stores the distance from the
|
||||
* previous x-value, expressed as log2 of the distance on 5 bits.
|
||||
* @x: Compand curve x-values. The functionality of these parameters are
|
||||
* unknown due to do a lack of hardware documentation, but these are left
|
||||
* here for future compatibility purposes.
|
||||
* @y: Compand curve y-values
|
||||
*/
|
||||
struct rkisp1_cif_isp_compand_curve_config {
|
||||
__u8 px[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];
|
||||
__u32 x[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];
|
||||
__u32 y[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];
|
||||
};
|
||||
|
||||
/*---------- PART2: Measurement Statistics ------------*/
|
||||
|
||||
/**
|
||||
@ -996,4 +1034,544 @@ struct rkisp1_stat_buffer {
|
||||
struct rkisp1_cif_isp_stat params;
|
||||
};
|
||||
|
||||
/*---------- PART3: Extensible Configuration Parameters ------------*/
|
||||
|
||||
/**
|
||||
* enum rkisp1_ext_params_block_type - RkISP1 extensible params block type
|
||||
*
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS: Black level subtraction
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC: Defect pixel cluster correction
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG: Sensor de-gamma
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN: Auto white balance gains
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT: ISP filtering
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM: Bayer de-mosaic
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK: Cross-talk correction
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC: Gamma out correction
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF: De-noise pre-filter
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH: De-noise pre-filter strength
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC: Color processing
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_IE: Image effects
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC: Lens shading correction
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS: Auto white balance statistics
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS: Histogram statistics
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS: Auto exposure statistics
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS: Auto-focus statistics
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS: BLS in the compand block
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve
|
||||
* @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve
|
||||
*/
|
||||
enum rkisp1_ext_params_block_type {
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_IE,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND,
|
||||
RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS,
|
||||
};
|
||||
|
||||
#define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE (1U << 0)
|
||||
#define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE (1U << 1)
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_block_header - RkISP1 extensible parameters block
|
||||
* header
|
||||
*
|
||||
* This structure represents the common part of all the ISP configuration
|
||||
* blocks. Each parameters block shall embed an instance of this structure type
|
||||
* as its first member, followed by the block-specific configuration data. The
|
||||
* driver inspects this common header to discern the block type and its size and
|
||||
* properly handle the block content by casting it to the correct block-specific
|
||||
* type.
|
||||
*
|
||||
* The @type field is one of the values enumerated by
|
||||
* :c:type:`rkisp1_ext_params_block_type` and specifies how the data should be
|
||||
* interpreted by the driver. The @size field specifies the size of the
|
||||
* parameters block and is used by the driver for validation purposes.
|
||||
*
|
||||
* The @flags field is a bitmask of per-block flags RKISP1_EXT_PARAMS_FL_*.
|
||||
*
|
||||
* When userspace wants to configure and enable an ISP block it shall fully
|
||||
* populate the block configuration and set the
|
||||
* RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE bit in the @flags field.
|
||||
*
|
||||
* When userspace simply wants to disable an ISP block the
|
||||
* RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bit should be set in @flags field. The
|
||||
* driver ignores the rest of the block configuration structure in this case.
|
||||
*
|
||||
* If a new configuration of an ISP block has to be applied userspace shall
|
||||
* fully populate the ISP block configuration and omit setting the
|
||||
* RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits
|
||||
* in the @flags field.
|
||||
*
|
||||
* Setting both the RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE and
|
||||
* RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE bits in the @flags field is not allowed
|
||||
* and not accepted by the driver.
|
||||
*
|
||||
* Userspace is responsible for correctly populating the parameters block header
|
||||
* fields (@type, @flags and @size) and the block-specific parameters.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* .. code-block:: c
|
||||
*
|
||||
* void populate_bls(struct rkisp1_ext_params_block_header *block) {
|
||||
* struct rkisp1_ext_params_bls_config *bls =
|
||||
* (struct rkisp1_ext_params_bls_config *)block;
|
||||
*
|
||||
* bls->header.type = RKISP1_EXT_PARAMS_BLOCK_ID_BLS;
|
||||
* bls->header.flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE;
|
||||
* bls->header.size = sizeof(*bls);
|
||||
*
|
||||
* bls->config.enable_auto = 0;
|
||||
* bls->config.fixed_val.r = blackLevelRed_;
|
||||
* bls->config.fixed_val.gr = blackLevelGreenR_;
|
||||
* bls->config.fixed_val.gb = blackLevelGreenB_;
|
||||
* bls->config.fixed_val.b = blackLevelBlue_;
|
||||
* }
|
||||
*
|
||||
* @type: The parameters block type, see
|
||||
* :c:type:`rkisp1_ext_params_block_type`
|
||||
* @flags: A bitmask of block flags
|
||||
* @size: Size (in bytes) of the parameters block, including this header
|
||||
*/
|
||||
struct rkisp1_ext_params_block_header {
|
||||
__u16 type;
|
||||
__u16 flags;
|
||||
__u32 size;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_bls_config - RkISP1 extensible params BLS config
|
||||
*
|
||||
* RkISP1 extensible parameters Black Level Subtraction configuration block.
|
||||
* Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Black Level Subtraction configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_bls_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_bls_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_bls_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_dpcc_config - RkISP1 extensible params DPCC config
|
||||
*
|
||||
* RkISP1 extensible parameters Defective Pixel Cluster Correction configuration
|
||||
* block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Defective Pixel Cluster Correction configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_dpcc_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_dpcc_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_dpcc_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_sdg_config - RkISP1 extensible params SDG config
|
||||
*
|
||||
* RkISP1 extensible parameters Sensor Degamma configuration block. Identified
|
||||
* by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Sensor Degamma configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_sdg_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_sdg_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_sdg_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_lsc_config - RkISP1 extensible params LSC config
|
||||
*
|
||||
* RkISP1 extensible parameters Lens Shading Correction configuration block.
|
||||
* Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Lens Shading Correction configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_lsc_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_lsc_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_lsc_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_awb_gain_config - RkISP1 extensible params AWB
|
||||
* gain config
|
||||
*
|
||||
* RkISP1 extensible parameters Auto-White Balance Gains configuration block.
|
||||
* Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Auto-White Balance Gains configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_awb_gain_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_awb_gain_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_awb_gain_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_flt_config - RkISP1 extensible params FLT config
|
||||
*
|
||||
* RkISP1 extensible parameters Filter configuration block. Identified by
|
||||
* :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Filter configuration, see :c:type:`rkisp1_cif_isp_flt_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_flt_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_flt_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_bdm_config - RkISP1 extensible params BDM config
|
||||
*
|
||||
* RkISP1 extensible parameters Demosaicing configuration block. Identified by
|
||||
* :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Demosaicing configuration, see :c:type:`rkisp1_cif_isp_bdm_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_bdm_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_bdm_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_ctk_config - RkISP1 extensible params CTK config
|
||||
*
|
||||
* RkISP1 extensible parameters Cross-Talk configuration block. Identified by
|
||||
* :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Cross-Talk configuration, see :c:type:`rkisp1_cif_isp_ctk_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_ctk_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_ctk_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_goc_config - RkISP1 extensible params GOC config
|
||||
*
|
||||
* RkISP1 extensible parameters Gamma-Out configuration block. Identified by
|
||||
* :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Gamma-Out configuration, see :c:type:`rkisp1_cif_isp_goc_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_goc_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_goc_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_dpf_config - RkISP1 extensible params DPF config
|
||||
*
|
||||
* RkISP1 extensible parameters De-noise Pre-Filter configuration block.
|
||||
* Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: De-noise Pre-Filter configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_dpf_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_dpf_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_dpf_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_dpf_strength_config - RkISP1 extensible params DPF
|
||||
* strength config
|
||||
*
|
||||
* RkISP1 extensible parameters De-noise Pre-Filter strength configuration
|
||||
* block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: De-noise Pre-Filter strength configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_dpf_strength_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_dpf_strength_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_dpf_strength_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_cproc_config - RkISP1 extensible params CPROC config
|
||||
*
|
||||
* RkISP1 extensible parameters Color Processing configuration block.
|
||||
* Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Color processing configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_cproc_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_cproc_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_cproc_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_ie_config - RkISP1 extensible params IE config
|
||||
*
|
||||
* RkISP1 extensible parameters Image Effect configuration block. Identified by
|
||||
* :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_IE`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Image Effect configuration, see :c:type:`rkisp1_cif_isp_ie_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_ie_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_ie_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_awb_meas_config - RkISP1 extensible params AWB
|
||||
* Meas config
|
||||
*
|
||||
* RkISP1 extensible parameters Auto-White Balance Measurement configuration
|
||||
* block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Auto-White Balance measure configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_awb_meas_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_awb_meas_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_awb_meas_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_hst_config - RkISP1 extensible params Histogram config
|
||||
*
|
||||
* RkISP1 extensible parameters Histogram statistics configuration block.
|
||||
* Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Histogram statistics configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_hst_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_hst_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_hst_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_aec_config - RkISP1 extensible params AEC config
|
||||
*
|
||||
* RkISP1 extensible parameters Auto-Exposure statistics configuration block.
|
||||
* Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Auto-Exposure statistics configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_aec_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_aec_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_aec_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_afc_config - RkISP1 extensible params AFC config
|
||||
*
|
||||
* RkISP1 extensible parameters Auto-Focus statistics configuration block.
|
||||
* Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Auto-Focus statistics configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_afc_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_afc_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_afc_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_compand_bls_config - RkISP1 extensible params
|
||||
* Compand BLS config
|
||||
*
|
||||
* RkISP1 extensible parameters Companding configuration block (black level
|
||||
* subtraction). Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Companding BLS configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_compand_bls_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_compand_bls_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_compand_bls_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_compand_curve_config - RkISP1 extensible params
|
||||
* Compand curve config
|
||||
*
|
||||
* RkISP1 extensible parameters Companding configuration block (expand and
|
||||
* compression curves). Identified by
|
||||
* :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND` or
|
||||
* :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS`.
|
||||
*
|
||||
* @header: The RkISP1 extensible parameters header, see
|
||||
* :c:type:`rkisp1_ext_params_block_header`
|
||||
* @config: Companding curve configuration, see
|
||||
* :c:type:`rkisp1_cif_isp_compand_curve_config`
|
||||
*/
|
||||
struct rkisp1_ext_params_compand_curve_config {
|
||||
struct rkisp1_ext_params_block_header header;
|
||||
struct rkisp1_cif_isp_compand_curve_config config;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/*
|
||||
* The rkisp1_ext_params_compand_curve_config structure is counted twice as it
|
||||
* is used for both the COMPAND_EXPAND and COMPAND_COMPRESS block types.
|
||||
*/
|
||||
#define RKISP1_EXT_PARAMS_MAX_SIZE \
|
||||
(sizeof(struct rkisp1_ext_params_bls_config) +\
|
||||
sizeof(struct rkisp1_ext_params_dpcc_config) +\
|
||||
sizeof(struct rkisp1_ext_params_sdg_config) +\
|
||||
sizeof(struct rkisp1_ext_params_lsc_config) +\
|
||||
sizeof(struct rkisp1_ext_params_awb_gain_config) +\
|
||||
sizeof(struct rkisp1_ext_params_flt_config) +\
|
||||
sizeof(struct rkisp1_ext_params_bdm_config) +\
|
||||
sizeof(struct rkisp1_ext_params_ctk_config) +\
|
||||
sizeof(struct rkisp1_ext_params_goc_config) +\
|
||||
sizeof(struct rkisp1_ext_params_dpf_config) +\
|
||||
sizeof(struct rkisp1_ext_params_dpf_strength_config) +\
|
||||
sizeof(struct rkisp1_ext_params_cproc_config) +\
|
||||
sizeof(struct rkisp1_ext_params_ie_config) +\
|
||||
sizeof(struct rkisp1_ext_params_awb_meas_config) +\
|
||||
sizeof(struct rkisp1_ext_params_hst_config) +\
|
||||
sizeof(struct rkisp1_ext_params_aec_config) +\
|
||||
sizeof(struct rkisp1_ext_params_afc_config) +\
|
||||
sizeof(struct rkisp1_ext_params_compand_bls_config) +\
|
||||
sizeof(struct rkisp1_ext_params_compand_curve_config) +\
|
||||
sizeof(struct rkisp1_ext_params_compand_curve_config))
|
||||
|
||||
/**
|
||||
* enum rksip1_ext_param_buffer_version - RkISP1 extensible parameters version
|
||||
*
|
||||
* @RKISP1_EXT_PARAM_BUFFER_V1: First version of RkISP1 extensible parameters
|
||||
*/
|
||||
enum rksip1_ext_param_buffer_version {
|
||||
RKISP1_EXT_PARAM_BUFFER_V1 = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct rkisp1_ext_params_cfg - RkISP1 extensible parameters configuration
|
||||
*
|
||||
* This struct contains the configuration parameters of the RkISP1 ISP
|
||||
* algorithms, serialized by userspace into a data buffer. Each configuration
|
||||
* parameter block is represented by a block-specific structure which contains a
|
||||
* :c:type:`rkisp1_ext_params_block_header` entry as first member. Userspace
|
||||
* populates the @data buffer with configuration parameters for the blocks that
|
||||
* it intends to configure. As a consequence, the data buffer effective size
|
||||
* changes according to the number of ISP blocks that userspace intends to
|
||||
* configure and is set by userspace in the @data_size field.
|
||||
*
|
||||
* The parameters buffer is versioned by the @version field to allow modifying
|
||||
* and extending its definition. Userspace shall populate the @version field to
|
||||
* inform the driver about the version it intends to use. The driver will parse
|
||||
* and handle the @data buffer according to the data layout specific to the
|
||||
* indicated version and return an error if the desired version is not
|
||||
* supported.
|
||||
*
|
||||
* Currently the single RKISP1_EXT_PARAM_BUFFER_V1 version is supported.
|
||||
* When a new format version will be added, a mechanism for userspace to query
|
||||
* the supported format versions will be implemented in the form of a read-only
|
||||
* V4L2 control. If such control is not available, userspace should assume only
|
||||
* RKISP1_EXT_PARAM_BUFFER_V1 is supported by the driver.
|
||||
*
|
||||
* For each ISP block that userspace wants to configure, a block-specific
|
||||
* structure is appended to the @data buffer, one after the other without gaps
|
||||
* in between nor overlaps. Userspace shall populate the @data_size field with
|
||||
* the effective size, in bytes, of the @data buffer.
|
||||
*
|
||||
* The expected memory layout of the parameters buffer is::
|
||||
*
|
||||
* +-------------------- struct rkisp1_ext_params_cfg -------------------+
|
||||
* | version = RKISP_EXT_PARAMS_BUFFER_V1; |
|
||||
* | data_size = sizeof(struct rkisp1_ext_params_bls_config) |
|
||||
* | + sizeof(struct rkisp1_ext_params_dpcc_config); |
|
||||
* | +------------------------- data ---------------------------------+ |
|
||||
* | | +------------- struct rkisp1_ext_params_bls_config -----------+ | |
|
||||
* | | | +-------- struct rkisp1_ext_params_block_header ---------+ | | |
|
||||
* | | | | type = RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS; | | | |
|
||||
* | | | | flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE; | | | |
|
||||
* | | | | size = sizeof(struct rkisp1_ext_params_bls_config); | | | |
|
||||
* | | | +---------------------------------------------------------+ | | |
|
||||
* | | | +---------- struct rkisp1_cif_isp_bls_config -------------+ | | |
|
||||
* | | | | enable_auto = 0; | | | |
|
||||
* | | | | fixed_val.r = 256; | | | |
|
||||
* | | | | fixed_val.gr = 256; | | | |
|
||||
* | | | | fixed_val.gb = 256; | | | |
|
||||
* | | | | fixed_val.b = 256; | | | |
|
||||
* | | | +---------------------------------------------------------+ | | |
|
||||
* | | +------------ struct rkisp1_ext_params_dpcc_config -----------+ | |
|
||||
* | | | +-------- struct rkisp1_ext_params_block_header ---------+ | | |
|
||||
* | | | | type = RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC; | | | |
|
||||
* | | | | flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE; | | | |
|
||||
* | | | | size = sizeof(struct rkisp1_ext_params_dpcc_config); | | | |
|
||||
* | | | +---------------------------------------------------------+ | | |
|
||||
* | | | +---------- struct rkisp1_cif_isp_dpcc_config ------------+ | | |
|
||||
* | | | | mode = RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE; | | | |
|
||||
* | | | | output_mode = | | | |
|
||||
* | | | | RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER; | | | |
|
||||
* | | | | set_use = ... ; | | | |
|
||||
* | | | | ... = ... ; | | | |
|
||||
* | | | +---------------------------------------------------------+ | | |
|
||||
* | | +-------------------------------------------------------------+ | |
|
||||
* | +-----------------------------------------------------------------+ |
|
||||
* +---------------------------------------------------------------------+
|
||||
*
|
||||
* @version: The RkISP1 extensible parameters buffer version, see
|
||||
* :c:type:`rksip1_ext_param_buffer_version`
|
||||
* @data_size: The RkISP1 configuration data effective size, excluding this
|
||||
* header
|
||||
* @data: The RkISP1 extensible configuration data blocks
|
||||
*/
|
||||
struct rkisp1_ext_params_cfg {
|
||||
__u32 version;
|
||||
__u32 data_size;
|
||||
__u8 data[RKISP1_EXT_PARAMS_MAX_SIZE];
|
||||
};
|
||||
|
||||
#endif /* _UAPI_RKISP1_CONFIG_H */
|
||||
|
@ -854,6 +854,7 @@ struct v4l2_pix_format {
|
||||
/* Vendor specific - used for RK_ISP1 camera sub-system */
|
||||
#define V4L2_META_FMT_RK_ISP1_PARAMS v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */
|
||||
#define V4L2_META_FMT_RK_ISP1_STAT_3A v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */
|
||||
#define V4L2_META_FMT_RK_ISP1_EXT_PARAMS v4l2_fourcc('R', 'K', '1', 'E') /* Rockchip ISP1 3a Extensible Parameters */
|
||||
|
||||
/* Vendor specific - used for RaspberryPi PiSP */
|
||||
#define V4L2_META_FMT_RPI_BE_CFG v4l2_fourcc('R', 'P', 'B', 'C') /* PiSP BE configuration */
|
||||
|
Loading…
Reference in New Issue
Block a user