[21/21] drm/bridge: tc358767: implement naive HPD handling
Tomi Valkeinen
tomi.valkeinen at ti.com
Wed Mar 20 07:06:22 UTC 2019
On 20/03/2019 07:55, Andrey Smirnov wrote:
> On Tue, Mar 19, 2019 at 11:18 AM Andrey Smirnov
> <andrew.smirnov at gmail.com> wrote:
>>
>>> tc358767 driver doesn't have any HPD handling at the moment, as it was
>>> originally developed to support only eDP.
>>
>>> This patch implements a naive, polling-based HPD handling, which is used
>>> when the driver is in DP mode.
>>
>>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ti.com>
>>> ---
>>> drivers/gpu/drm/bridge/tc358767.c | 56 +++++++++++++++++++++----------
>>> 1 file changed, 38 insertions(+), 18 deletions(-)
>>
>>> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
>>> index 8606de29c9b2..2b252f7ac070 100644
>>> --- a/drivers/gpu/drm/bridge/tc358767.c
>>> +++ b/drivers/gpu/drm/bridge/tc358767.c
>>> @@ -1095,6 +1095,12 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
>>> struct tc_data *tc = bridge_to_tc(bridge);
>>> int ret;
>>
>>> + ret = tc_get_display_props(tc);
>>> + if (ret < 0) {
>>> + dev_err(tc->dev, "failed to read display props: %d\n", ret);
>>> + return;
>>> + }
>>> +
>>> ret = tc_main_link_enable(tc);
>>> if (ret < 0) {
>>> dev_err(tc->dev, "main link enable error: %d\n", ret);
>>> @@ -1200,19 +1206,35 @@ static int tc_connector_get_modes(struct drm_connector *connector)
>>> return count;
>>> }
>>
>>> -static void tc_connector_set_polling(struct tc_data *tc,
>>> - struct drm_connector *connector)
>>> -{
>>> - /* TODO: add support for HPD */
>>> - connector->polled = DRM_CONNECTOR_POLL_CONNECT |
>>> - DRM_CONNECTOR_POLL_DISCONNECT;
>>> -}
>>> -
>>> static const struct drm_connector_helper_funcs tc_connector_helper_funcs = {
>>> .get_modes = tc_connector_get_modes,
>>> };
>>
>>> +static enum drm_connector_status tc_connector_detect(struct drm_connector *connector, bool force)
>>> +{
>>> + struct tc_data *tc = connector_to_tc(connector);
>>> + u32 val;
>>> + int ret;
>>> + bool conn;
>>> +
>>> + tc_read(GPIOI, &val);
>>> +
>>> + conn = val & BIT(0);
>
> Another thing I noticed when trying this patch is that
> tc_connector_detect() will get called via drm_helper_probe_detect()
> even if tc->panel is not NULL and tc->connector.polled is zero, which
> creates a problem for eDP use-case.
Ok, thanks for testing. So we need to return "connected" from the detect
function for eDP cases.
I think I need to create a fake setup where I can also run with an eDP
panel to test this series properly. Probably I can create a "panel"
driver for my DP monitor, so I would still get a picture.
Tomi
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
More information about the dri-devel
mailing list