From patchwork Sat Apr 8 08:20:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Travkin X-Patchwork-Id: 81143 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp755973vqo; Sat, 8 Apr 2023 01:50:46 -0700 (PDT) X-Google-Smtp-Source: AKy350bB51IS6eFsArIVSPhVg9Co6KqbgxAHsPGbur65hdqaiZLY7fRPxT19DV+zEYgKHLwLHa/o X-Received: by 2002:a17:907:76b5:b0:93f:9b68:a0f4 with SMTP id jw21-20020a17090776b500b0093f9b68a0f4mr1679050ejc.26.1680943846638; Sat, 08 Apr 2023 01:50:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680943846; cv=none; d=google.com; s=arc-20160816; b=UrOXqxzxFAKx70iVbu8roSjEYyU4STml9NKYkYME93vP5Ojq3UpBD7lOYcLqoGLwXm 6oFbVdSX9MzVyw/NUwsLCdk5fuMPEX3cbj756mfJ9tz5dzZ5c2KPhgitXnkUuDMP+Paf 5+1IDkiAYN8A9xzwX9Hfh8mmpXz4lb/+hMo8P0omNJ14Z+WaCsGO8VKen9h+XzpCAhy0 dQY4VlpukHw1GAB1SZk5EICcFxtBOIkYfGipREs6vOZEeE9m02yIyxe7NUFJ+Upo7qng bjVym9oI2nOwGEs1DXIDcbBkauKFf+peaEXQUdY5uVlSBENUK0BCgelovMWkP6+/uKa3 l1cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=e9Gq7uKwKZL5hOwXYdIT8Ev8NHhM+ppIjTKBPHuxw1o=; b=SB8OrigYgYeXtMaOTCnspY4jMy9+24CDIXBbuc5m5C4h3dkLaTcxQ1eQy7DqwrLidg Q2xAMT7FiuNG0VRQU020iNRM9+b41FqwCMUrtDcyeFQNtLSwE8KFoPMqP6HoEquS5ivU 8aY9fj0n8GnsJ71B9H5onl39yrLKeR9S+JIryASnE6FhczaATCjvyW/zHyd2qhGEf9cK bmXcUuQQsFlWBzR4VGRdYFV5UKGn52PNq+igTRgXr6LKXqjkNf9PdantdAIGE7CAeO5l Ld2xkO2qt8hORwu8SeWdJYxheVlkWnk1If1803JY9PM8HVdCk53TU8pkh6YBKqBLgWIn DKYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=3vKEgYBG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id tl13-20020a170907c30d00b0091fff42ea83si5263274ejc.273.2023.04.08.01.50.21; Sat, 08 Apr 2023 01:50:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=3vKEgYBG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbjDHIUm (ORCPT + 99 others); Sat, 8 Apr 2023 04:20:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjDHIUj (ORCPT ); Sat, 8 Apr 2023 04:20:39 -0400 Received: from box.trvn.ru (box.trvn.ru [194.87.146.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70523C148 for ; Sat, 8 Apr 2023 01:20:38 -0700 (PDT) Received: from authenticated-user (box.trvn.ru [194.87.146.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by box.trvn.ru (Postfix) with ESMTPSA id 4E41A403B9; Sat, 8 Apr 2023 13:20:22 +0500 (+05) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=trvn.ru; s=mail; t=1680942024; bh=Y181UBUuQt0Yz6wrLdhP3fSIP/gjJyv15QxkjEagobQ=; h=From:To:Cc:Subject:Date:From; b=3vKEgYBGornwzWMelWt7EtctVaQhOrdarn9z1whe/u/khh7eTECg5YFqUmEcdP3gM Mp52s7Co+rpXFfU+/nsApePsmXMAVAK1wlriErVpMYeXdOf1STHQDdtmazfRpxFfg+ /fd1KYDqR4YavhwXU6JyPNXcQ+KKVECUbj1LYzY2RK0+JUdwnVjasHGP6Q5tUk78bA nZkczZqyqtWtJVrpPFbs4AeEaiV9v/h0JlysiMecVCVESrEWEpxloaTT/J55Lva8NF buvbimuxWHRZ3gHEzZWysYCp9c1AIdqXrMbCcVfwk9Zc+FTL8lntcX3Pcx7HovGhAI hLUJ6jeKkFWDA== From: Nikita Travkin To: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org Cc: airlied@gmail.com, daniel@ffwll.ch, dianders@chromium.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Nikita Travkin Subject: [PATCH] drm/bridge: ti-sn65dsi86: Implement wait_hpd_asserted Date: Sat, 8 Apr 2023 13:20:14 +0500 Message-Id: <20230408082014.235425-1-nikita@trvn.ru> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762597375129288714?= X-GMAIL-MSGID: =?utf-8?q?1762597375129288714?= This bridge doesn't actually implement HPD due to it being way too slow but instead expects the panel driver to wait enough to assume HPD is asserted. However some panels (such as the generic 'edp-panel') expect the bridge to deal with the delay and pass maximum delay to the aux instead. In order to support such panels, add a dummy implementation of wait that would just sleep the maximum delay and assume no failure has happened. Signed-off-by: Nikita Travkin Reviewed-by: Douglas Anderson --- This was suggested in [1] to make sure DT users can be semantically correct (not adding no-hpd when the line is actually there) while still using a hard delay to be faster than waiting the long debounce time. [1] - https://lore.kernel.org/all/CAD=FV=VR7sKsquE25eF7joc7gPApu-vqwduZzjE=wFCoXjMYnQ@mail.gmail.com/ --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 7a748785c545..260cad1fd1da 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -618,6 +618,24 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux, return len; } +static int ti_sn_aux_wait_hpd_asserted(struct drm_dp_aux *aux, unsigned long wait_us) +{ + /* + * The HPD in this chip is a bit useless (See comment in + * ti_sn65dsi86_enable_comms) so if our driver is expected to wait + * for HPD, we just assume it's asserted after the wait_us delay. + * + * In case we are asked to wait forever (wait_us=0) take conservative + * 500ms delay. + */ + if (wait_us == 0) + wait_us = 500000; + + usleep_range(wait_us, wait_us + 1000); + + return 0; +} + static int ti_sn_aux_probe(struct auxiliary_device *adev, const struct auxiliary_device_id *id) { @@ -627,6 +645,7 @@ static int ti_sn_aux_probe(struct auxiliary_device *adev, pdata->aux.name = "ti-sn65dsi86-aux"; pdata->aux.dev = &adev->dev; pdata->aux.transfer = ti_sn_aux_transfer; + pdata->aux.wait_hpd_asserted = ti_sn_aux_wait_hpd_asserted; drm_dp_aux_init(&pdata->aux); ret = devm_of_dp_aux_populate_ep_devices(&pdata->aux);