History

media: rppx1: awbg: Add support for white balance gain settings

Extend the RPPX1 driver to allow setting the white balance gain configuration parameters. It uses the RPPX1 framework for parameters and its writer abstraction to allow the user to control how, and when, configuration is applied to the RPPX1.

Niklas Söderlund committed 3 months ago

Commit 9ebf5001 parent 884d6794 files · +77 −1Browse files

Showing the changes to include/uapi (1 of 4 files). Show all

Unified · Split

include/uapi/linux/media/dreamchip/rppx1-config.h+39−1
@@ -47,9 +47,15 @@ struct rppx1_window { · 46 unmodified lines
4747 * NOTE: Only append to the enumeration as the numbers are uAPI.
4848 *
4949 * @RPPX1_PARAMS_BLOCK_TYPE_WBMEAS_POST: AWB Measurement Configuration
50+ * @RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1: PRE1 pipe White Balance Gains
51+ * @RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2: PRE2 White Balance Gains
52+ * @RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST: MAIN_POST White Balance Gains
5053 */
5154 enum rppx1_params_block_type {
5255 RPPX1_PARAMS_BLOCK_TYPE_WBMEAS_POST,
56+ RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1,
57+ RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2,
58+ RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST,
5359 };
5460
5561 /**
@@ -114,6 +120,35 @@ struct rppx1_wbmeas_params { · 58 unmodified lines
114120 __u32 reserved3;
115121 };
116122
123+/**
124+ * struct rppx1_awbg_params - WB gain configuration
125+ *
126+ * The RPP-X1 White Balance Gain module is available in the PRE1 and PRE2
127+ * pre-fusion pipes and in the MAIN_POST post-fusion pipe. Userspace selects
128+ * which pipe to operate by setting the @header.type field to
129+ * RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1, RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2
130+ * or RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST.
131+ *
132+ * The White Balance module allows to specify per-color channel gains, expressed
133+ * as unsigned fixed-point values as 18 bits unsigned integers in Q6.12 format
134+ * with a maximum of 63.999.
135+ *
136+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1 or
137+ * type = RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2 or
138+ * type = RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST)
139+ * @gain_red: gain for red component, 18-bit (unsigned Q6.12)
140+ * @gain_green_r: gain for green component in red lines, 18-bit (unsigned Q6.12)
141+ * @gain_blue: gain for blue component, 18-bit (unsigned Q6.12)
142+ * @gain_green_b: gain for green component in blue lines, 18-bit (unsigned Q6.12)
143+ */
144+struct rppx1_awbg_params {
145+ struct v4l2_isp_params_block_header header;
146+ __u32 gain_red;
147+ __u32 gain_green_r;
148+ __u32 gain_blue;
149+ __u32 gain_green_b;
150+};
151+
117152 /**
118153 * RPPX1_PARAMS_MAX_SIZE - Maximum size of all RPP-X1 parameter blocks
119154 *
@@ -121,7 +156,10 @@ struct rppx1_wbmeas_params { · 1 unmodified line
121156 * multiple pipes.
122157 */
123158 #define RPPX1_PARAMS_MAX_SIZE \
124− (sizeof(struct rppx1_wbmeas_params))
159+ (sizeof(struct rppx1_wbmeas_params) + \
160+ sizeof(struct rppx1_awbg_params) + \
161+ sizeof(struct rppx1_awbg_params) + \
162+ sizeof(struct rppx1_awbg_params))
125163
126164 /* ---------------------------------------------------------------------------
127165 * Statistics Structures