mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
misc: rk628: rgb/bt1120: optimize dts parsing rgb/bt1120 properties
1. change the "bt1120_dual_edge" property from macro definition to parsing in dts 2. "bt1120_dual_edge" and "vccio_rgb" are unique to rk628 rgb, so put them in the rk628_rgb structure. 3. dts property related to rk628 rgb are parsed in rk628_rgb_parse function, including those related to rgb in/out and bt1120 in/out. Type: Fix Redmine ID: N/A Associated modifications: N/A Test: N/A Signed-off-by: Zhibin Huang <zhibin.huang@rock-chips.com> Change-Id: I1bd7edb9dd28a13cd298142e067e851ef98f83c5
This commit is contained in:
@@ -723,14 +723,17 @@ static int rk628_display_route_info_parse(struct rk628 *rk628)
|
||||
int ret = 0;
|
||||
u32 val;
|
||||
|
||||
if (of_property_read_bool(rk628->dev->of_node, "rk628,hdmi-in"))
|
||||
if (of_property_read_bool(rk628->dev->of_node, "rk628,hdmi-in")) {
|
||||
rk628->input_mode = BIT(INPUT_MODE_HDMI);
|
||||
else if (of_property_read_bool(rk628->dev->of_node, "rk628,rgb-in"))
|
||||
} else if (of_property_read_bool(rk628->dev->of_node, "rk628,rgb-in")) {
|
||||
rk628->input_mode = BIT(INPUT_MODE_RGB);
|
||||
else if (of_property_read_bool(rk628->dev->of_node, "rk628,bt1120-in"))
|
||||
ret = rk628_rgb_parse(rk628, NULL);
|
||||
} else if (of_property_read_bool(rk628->dev->of_node, "rk628,bt1120-in")) {
|
||||
rk628->input_mode = BIT(INPUT_MODE_BT1120);
|
||||
else
|
||||
ret = rk628_rgb_parse(rk628, NULL);
|
||||
} else {
|
||||
rk628->input_mode = BIT(INPUT_MODE_RGB);
|
||||
}
|
||||
|
||||
if ((np = of_get_child_by_name(rk628->dev->of_node, "rk628-gvi"))) {
|
||||
rk628->output_mode |= BIT(OUTPUT_MODE_GVI);
|
||||
@@ -751,10 +754,11 @@ static int rk628_display_route_info_parse(struct rk628 *rk628)
|
||||
rk628->output_mode |= BIT(OUTPUT_MODE_HDMI);
|
||||
|
||||
if (of_property_read_bool(rk628->dev->of_node, "rk628-rgb")) {
|
||||
ret = rk628_rgb_parse(rk628, NULL);
|
||||
rk628->output_mode |= BIT(OUTPUT_MODE_RGB);
|
||||
ret = rk628_rgb_parse(rk628, NULL);
|
||||
} else if (of_property_read_bool(rk628->dev->of_node, "rk628-bt1120")) {
|
||||
rk628->output_mode |= BIT(OUTPUT_MODE_BT1120);
|
||||
ret = rk628_rgb_parse(rk628, NULL);
|
||||
}
|
||||
|
||||
if (of_property_read_u32(rk628->dev->of_node, "mode-sync-pol", &val) < 0)
|
||||
@@ -1395,10 +1399,6 @@ rk628_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||
|
||||
clk_prepare_enable(rk628->soc_24M);
|
||||
|
||||
rk628->vccio_rgb = devm_regulator_get_optional(dev, "vccio-rgb");
|
||||
if (IS_ERR(rk628->vccio_rgb))
|
||||
rk628->vccio_rgb = NULL;
|
||||
|
||||
rk628->enable_gpio = devm_gpiod_get_optional(dev, "enable",
|
||||
GPIOD_OUT_LOW);
|
||||
if (IS_ERR(rk628->enable_gpio)) {
|
||||
|
||||
@@ -433,8 +433,6 @@ enum rk628_v4l2_colorspace {
|
||||
V4L2_COLORSPACE_DCI_P3 = 12,
|
||||
};
|
||||
|
||||
#undef BT1120_DUAL_EDGE
|
||||
|
||||
struct rk628_videomode {
|
||||
u32 pixelclock; /* pixelclock in Hz */
|
||||
|
||||
@@ -540,6 +538,11 @@ struct rk628_combtxphy {
|
||||
bool division_mode;
|
||||
};
|
||||
|
||||
struct rk628_rgb {
|
||||
struct regulator *vccio_rgb;
|
||||
bool bt1120_dual_edge;
|
||||
};
|
||||
|
||||
struct rk628 {
|
||||
struct device *dev;
|
||||
struct i2c_client *client;
|
||||
@@ -574,7 +577,7 @@ struct rk628 {
|
||||
void *csi;
|
||||
struct notifier_block fb_nb;
|
||||
u32 version;
|
||||
struct regulator *vccio_rgb;
|
||||
struct rk628_rgb rgb;
|
||||
int old_blank;
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,20 @@
|
||||
|
||||
int rk628_rgb_parse(struct rk628 *rk628, struct device_node *rgb_np)
|
||||
{
|
||||
return rk628_panel_info_get(rk628, rgb_np);
|
||||
int ret = 0;
|
||||
|
||||
rk628->rgb.vccio_rgb = devm_regulator_get_optional(rk628->dev, "vccio-rgb");
|
||||
if (IS_ERR(rk628->rgb.vccio_rgb))
|
||||
rk628->rgb.vccio_rgb = NULL;
|
||||
|
||||
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_output_is_bt1120(rk628) || rk628_output_is_rgb(rk628))
|
||||
ret = rk628_panel_info_get(rk628, rgb_np);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rk628_rgb_resolution_show(struct seq_file *s, void *data)
|
||||
@@ -123,8 +136,8 @@ static void rk628_rgb_encoder_enable(struct rk628 *rk628)
|
||||
* drive strength and DCLK delay need to be set for the power domains
|
||||
* of different voltages.
|
||||
*/
|
||||
if (rk628->vccio_rgb)
|
||||
voltage = regulator_get_voltage(rk628->vccio_rgb);
|
||||
if (rk628->rgb.vccio_rgb)
|
||||
voltage = regulator_get_voltage(rk628->rgb.vccio_rgb);
|
||||
|
||||
switch (voltage) {
|
||||
case 1800000:
|
||||
@@ -264,17 +277,18 @@ static void rk628_bt1120_decoder_enable(struct rk628 *rk628)
|
||||
|
||||
rk628_cru_clk_set_rate(rk628, CGU_BT1120DEC, mode->clock * 1000);
|
||||
|
||||
#ifdef BT1120_DUAL_EDGE
|
||||
rk628_i2c_update_bits(rk628, GRF_RGB_DEC_CON0,
|
||||
DEC_DUALEDGE_EN, DEC_DUALEDGE_EN);
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON0, 0x10000000);
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON1, 0);
|
||||
#else
|
||||
if (rk628->version == RK628F_VERSION) {
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON0, 0x10000);
|
||||
if (rk628->rgb.bt1120_dual_edge) {
|
||||
rk628_i2c_update_bits(rk628, GRF_RGB_DEC_CON0,
|
||||
DEC_DUALEDGE_EN, DEC_DUALEDGE_EN);
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON0, 0x10000000);
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON1, 0);
|
||||
} else {
|
||||
if (rk628->version == RK628F_VERSION) {
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON0,
|
||||
0x10000);
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON1, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
rk628_i2c_update_bits(rk628, GRF_RGB_DEC_CON1, SW_SET_X_MASK,
|
||||
SW_SET_X(mode->hdisplay));
|
||||
@@ -320,8 +334,8 @@ static void rk628_bt1120_encoder_enable(struct rk628 *rk628)
|
||||
* drive strength and DCLK delay need to be set for the power domains
|
||||
* of different voltages.
|
||||
*/
|
||||
if (rk628->vccio_rgb)
|
||||
voltage = regulator_get_voltage(rk628->vccio_rgb);
|
||||
if (rk628->rgb.vccio_rgb)
|
||||
voltage = regulator_get_voltage(rk628->rgb.vccio_rgb);
|
||||
|
||||
switch (voltage) {
|
||||
case 1800000:
|
||||
@@ -353,18 +367,19 @@ static void rk628_bt1120_encoder_enable(struct rk628 *rk628)
|
||||
rk628_i2c_write(rk628, GRF_GPIO3B_D_CON, strength & 0x000f000f);
|
||||
|
||||
/* rk628: modify DCLK delay for BT1120 */
|
||||
#ifdef BT1120_DUAL_EDGE
|
||||
val |= ENC_DUALEDGE_EN(1);
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON0, 0x10000000);
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON1, 0);
|
||||
#else
|
||||
if (rk628->version == RK628F_VERSION) {
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON0,
|
||||
dclk_delay & 0xffffffff);
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON1,
|
||||
dclk_delay >> 32);
|
||||
if (rk628->rgb.bt1120_dual_edge) {
|
||||
val |= ENC_DUALEDGE_EN(1);
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON0, 0x10000000);
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON1, 0);
|
||||
} else {
|
||||
if (rk628->version == RK628F_VERSION) {
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON0,
|
||||
dclk_delay & 0xffffffff);
|
||||
rk628_i2c_write(rk628, GRF_BT1120_DCLK_DELAY_CON1,
|
||||
dclk_delay >> 32);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
val |= BT1120_UV_SWAP(1);
|
||||
rk628_i2c_write(rk628, GRF_RGB_ENC_CON, val);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user