misc: rk628: bt1120: yc-swap and uv-swap property are also used in encoder

The rk628's bt1120 encoder data type is yuv 4:2:2 packed format,
i.e., it supports four types of packing (YUYV, YVYU, UYVY, and
VYUY). The difference is that in the 16 lanel, there are 8
transmitting Y data, 8 transmitting UV data, and the UV data is
transmitted alternately. Adding these two properties can support
the packing method switching.

For example:
-- Assuming that these two properties are not configured, YUYV
format will be used to transfer data by default.
-- If you need to output YVYU format (i.e., the VU transfer order
is reversed), you need to configure the bt1120-uv-swap property.
-- If you need to output UYVY format (i.e., the Y and UV lane order
is reversed), you need to configure the bt1120-yc-swap property.
-- If you need to output VYUY format, both properties need to be
configured;

Type: Function
Redmine ID: N/A
Associated modifications: Ie1c54ac3fbc01d76d32eff8d2857f68339654b70
Test: N/A

Signed-off-by: Zhibin Huang <zhibin.huang@rock-chips.com>
Change-Id: I25692e0713b68a8f9d7099086d00f927b9e26a02
This commit is contained in:
Zhibin Huang 2024-08-09 08:38:13 +08:00 committed by Tao Huang
commit d7d3217791
2 changed files with 6 additions and 6 deletions

View file

@ -147,6 +147,7 @@
#define GRF_RGB_DEC_CON2 0x0048
#define GRF_RGB_ENC_CON 0x004c
#define BT1120_UV_SWAP(x) HIWORD_UPDATE(x, 5, 5)
#define BT1120_YC_SWAP(x) HIWORD_UPDATE(x, 4, 4)
#define ENC_DUALEDGE_EN(x) HIWORD_UPDATE(x, 3, 3)
#define GRF_MIPI_LANE_DELAY_CON0 0x0050
#define GRF_MIPI_LANE_DELAY_CON1 0x0054

View file

@ -22,12 +22,10 @@ int rk628_rgb_parse(struct rk628 *rk628, struct device_node *rgb_np)
rk628->rgb.vccio_rgb = NULL;
/* input/output: bt1120 */
if ((rk628_input_is_bt1120(rk628) || rk628_output_is_bt1120(rk628)) &&
of_property_read_bool(rk628->dev->of_node, "bt1120-dual-edge"))
rk628->rgb.bt1120_dual_edge = true;
if ((rk628_input_is_bt1120(rk628) || rk628_output_is_bt1120(rk628))) {
if (of_property_read_bool(rk628->dev->of_node, "bt1120-dual-edge"))
rk628->rgb.bt1120_dual_edge = true;
/* input: bt1120 */
if (rk628_input_is_bt1120(rk628)) {
if (of_property_read_bool(rk628->dev->of_node, "bt1120-yc-swap"))
rk628->rgb.bt1120_yc_swap = true;
@ -397,7 +395,8 @@ static void rk628_bt1120_encoder_enable(struct rk628 *rk628)
}
}
val |= BT1120_UV_SWAP(1);
val |= rk628->rgb.bt1120_yc_swap ? BT1120_YC_SWAP(1) : BT1120_YC_SWAP(0);
val |= rk628->rgb.bt1120_uv_swap ? BT1120_UV_SWAP(1) : BT1120_UV_SWAP(0);
rk628_i2c_write(rk628, GRF_RGB_ENC_CON, val);
}