video/drm: analogix_dp: Implement detect callback
Change-Id: I1e6746768092747920afcb3af07e36c1ecae9856 Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
This commit is contained in:
parent
2b75673259
commit
d90a0d9f94
|
|
@ -900,11 +900,20 @@ static int analogix_dp_connector_disable(struct display_state *state)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int analogix_dp_connector_detect(struct display_state *state)
|
||||||
|
{
|
||||||
|
struct connector_state *conn_state = &state->conn_state;
|
||||||
|
struct analogix_dp_device *dp = dev_get_priv(conn_state->dev);
|
||||||
|
|
||||||
|
return analogix_dp_detect(dp);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct rockchip_connector_funcs analogix_dp_connector_funcs = {
|
static const struct rockchip_connector_funcs analogix_dp_connector_funcs = {
|
||||||
.init = analogix_dp_connector_init,
|
.init = analogix_dp_connector_init,
|
||||||
.get_edid = analogix_dp_connector_get_edid,
|
.get_edid = analogix_dp_connector_get_edid,
|
||||||
.enable = analogix_dp_connector_enable,
|
.enable = analogix_dp_connector_enable,
|
||||||
.disable = analogix_dp_connector_disable,
|
.disable = analogix_dp_connector_disable,
|
||||||
|
.detect = analogix_dp_connector_detect,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int analogix_dp_probe(struct udevice *dev)
|
static int analogix_dp_probe(struct udevice *dev)
|
||||||
|
|
@ -933,6 +942,8 @@ static int analogix_dp_probe(struct udevice *dev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dp->force_hpd = dev_read_bool(dev, "force-hpd");
|
||||||
|
|
||||||
dp->plat_data.dev_type = ROCKCHIP_DP;
|
dp->plat_data.dev_type = ROCKCHIP_DP;
|
||||||
dp->plat_data.subdev_type = pdata->chip_type;
|
dp->plat_data.subdev_type = pdata->chip_type;
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -1075,6 +1075,7 @@ struct analogix_dp_device {
|
||||||
void *grf;
|
void *grf;
|
||||||
struct reset_ctl reset;
|
struct reset_ctl reset;
|
||||||
struct gpio_desc hpd_gpio;
|
struct gpio_desc hpd_gpio;
|
||||||
|
bool force_hpd;
|
||||||
struct video_info video_info;
|
struct video_info video_info;
|
||||||
struct link_train link_train;
|
struct link_train link_train;
|
||||||
struct drm_display_mode *mode;
|
struct drm_display_mode *mode;
|
||||||
|
|
@ -1105,7 +1106,7 @@ enum dp_irq_type analogix_dp_get_irq_type(struct analogix_dp_device *dp);
|
||||||
void analogix_dp_clear_hotplug_interrupts(struct analogix_dp_device *dp);
|
void analogix_dp_clear_hotplug_interrupts(struct analogix_dp_device *dp);
|
||||||
void analogix_dp_reset_aux(struct analogix_dp_device *dp);
|
void analogix_dp_reset_aux(struct analogix_dp_device *dp);
|
||||||
void analogix_dp_init_aux(struct analogix_dp_device *dp);
|
void analogix_dp_init_aux(struct analogix_dp_device *dp);
|
||||||
int analogix_dp_get_plug_in_status(struct analogix_dp_device *dp);
|
int analogix_dp_detect(struct analogix_dp_device *dp);
|
||||||
void analogix_dp_enable_sw_function(struct analogix_dp_device *dp);
|
void analogix_dp_enable_sw_function(struct analogix_dp_device *dp);
|
||||||
int analogix_dp_start_aux_transaction(struct analogix_dp_device *dp);
|
int analogix_dp_start_aux_transaction(struct analogix_dp_device *dp);
|
||||||
int analogix_dp_write_byte_to_dpcd(struct analogix_dp_device *dp,
|
int analogix_dp_write_byte_to_dpcd(struct analogix_dp_device *dp,
|
||||||
|
|
|
||||||
|
|
@ -495,20 +495,21 @@ void analogix_dp_init_aux(struct analogix_dp_device *dp)
|
||||||
analogix_dp_write(dp, ANALOGIX_DP_FUNC_EN_2, reg);
|
analogix_dp_write(dp, ANALOGIX_DP_FUNC_EN_2, reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int analogix_dp_get_plug_in_status(struct analogix_dp_device *dp)
|
int analogix_dp_detect(struct analogix_dp_device *dp)
|
||||||
{
|
{
|
||||||
u32 reg;
|
u32 reg;
|
||||||
|
|
||||||
if (dm_gpio_is_valid(&dp->hpd_gpio)) {
|
if (dm_gpio_is_valid(&dp->hpd_gpio))
|
||||||
if (dm_gpio_get_value(&dp->hpd_gpio))
|
return dm_gpio_get_value(&dp->hpd_gpio);
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
reg = analogix_dp_read(dp, ANALOGIX_DP_SYS_CTL_3);
|
|
||||||
if (reg & HPD_STATUS)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -EINVAL;
|
if (dp->force_hpd)
|
||||||
|
analogix_dp_force_hpd(dp);
|
||||||
|
|
||||||
|
reg = analogix_dp_read(dp, ANALOGIX_DP_SYS_CTL_3);
|
||||||
|
if (reg & HPD_STATUS)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void analogix_dp_enable_sw_function(struct analogix_dp_device *dp)
|
void analogix_dp_enable_sw_function(struct analogix_dp_device *dp)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue