|
29 | 29 | #include <drm/drm_atomic_helper.h> |
30 | 30 | #include <drm/drm_bridge.h> |
31 | 31 | #include <drm/drm_bridge_connector.h> |
| 32 | +#include <drm/drm_edid.h> |
32 | 33 | #include <drm/drm_mipi_dsi.h> |
33 | 34 | #include <drm/drm_of.h> |
34 | 35 | #include <drm/drm_panel.h> |
|
68 | 69 | #define BPP_18_RGB BIT(0) |
69 | 70 | #define SN_HPD_DISABLE_REG 0x5C |
70 | 71 | #define HPD_DISABLE BIT(0) |
| 72 | +#define HPD_DEBOUNCED_STATE BIT(4) |
71 | 73 | #define SN_GPIO_IO_REG 0x5E |
72 | 74 | #define SN_GPIO_INPUT_SHIFT 4 |
73 | 75 | #define SN_GPIO_OUTPUT_SHIFT 0 |
@@ -1158,10 +1160,33 @@ static void ti_sn_bridge_atomic_post_disable(struct drm_bridge *bridge, |
1158 | 1160 | pm_runtime_put_sync(pdata->dev); |
1159 | 1161 | } |
1160 | 1162 |
|
| 1163 | +static enum drm_connector_status ti_sn_bridge_detect(struct drm_bridge *bridge) |
| 1164 | +{ |
| 1165 | + struct ti_sn65dsi86 *pdata = bridge_to_ti_sn65dsi86(bridge); |
| 1166 | + int val = 0; |
| 1167 | + |
| 1168 | + pm_runtime_get_sync(pdata->dev); |
| 1169 | + regmap_read(pdata->regmap, SN_HPD_DISABLE_REG, &val); |
| 1170 | + pm_runtime_put_autosuspend(pdata->dev); |
| 1171 | + |
| 1172 | + return val & HPD_DEBOUNCED_STATE ? connector_status_connected |
| 1173 | + : connector_status_disconnected; |
| 1174 | +} |
| 1175 | + |
| 1176 | +static struct edid *ti_sn_bridge_get_edid(struct drm_bridge *bridge, |
| 1177 | + struct drm_connector *connector) |
| 1178 | +{ |
| 1179 | + struct ti_sn65dsi86 *pdata = bridge_to_ti_sn65dsi86(bridge); |
| 1180 | + |
| 1181 | + return drm_get_edid(connector, &pdata->aux.ddc); |
| 1182 | +} |
| 1183 | + |
1161 | 1184 | static const struct drm_bridge_funcs ti_sn_bridge_funcs = { |
1162 | 1185 | .attach = ti_sn_bridge_attach, |
1163 | 1186 | .detach = ti_sn_bridge_detach, |
1164 | 1187 | .mode_valid = ti_sn_bridge_mode_valid, |
| 1188 | + .get_edid = ti_sn_bridge_get_edid, |
| 1189 | + .detect = ti_sn_bridge_detect, |
1165 | 1190 | .atomic_pre_enable = ti_sn_bridge_atomic_pre_enable, |
1166 | 1191 | .atomic_enable = ti_sn_bridge_atomic_enable, |
1167 | 1192 | .atomic_disable = ti_sn_bridge_atomic_disable, |
@@ -1257,6 +1282,9 @@ static int ti_sn_bridge_probe(struct auxiliary_device *adev, |
1257 | 1282 | pdata->bridge.type = pdata->next_bridge->type == DRM_MODE_CONNECTOR_DisplayPort |
1258 | 1283 | ? DRM_MODE_CONNECTOR_DisplayPort : DRM_MODE_CONNECTOR_eDP; |
1259 | 1284 |
|
| 1285 | + if (pdata->bridge.type == DRM_MODE_CONNECTOR_DisplayPort) |
| 1286 | + pdata->bridge.ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_DETECT; |
| 1287 | + |
1260 | 1288 | drm_bridge_add(&pdata->bridge); |
1261 | 1289 |
|
1262 | 1290 | ret = ti_sn_attach_host(pdata); |
|
0 commit comments