From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"wenst@chromium.org" <wenst@chromium.org>,
"kernel@collabora.com" <kernel@collabora.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"nfraprado@collabora.com" <nfraprado@collabora.com>
Subject: Re: [PATCH v5 01/10] drm/mediatek: dp: Move AUX and panel poweron/off sequence to function
Date: Tue, 18 Jul 2023 07:40:23 +0000 [thread overview]
Message-ID: <827cc3730c949e38eafd3786631135bcc7c7591c.camel@mediatek.com> (raw)
In-Reply-To: <20230713090152.140060-2-angelogioacchino.delregno@collabora.com>
Hi, Angelo:
On Thu, 2023-07-13 at 11:01 +0200, AngeloGioacchino Del Regno wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> Everytime we run bridge detection and/or EDID read we run a poweron
> and poweroff sequence for both the AUX and the panel; moreover, this
> is also done when enabling the bridge in the .atomic_enable()
> callback.
>
> Move this power on/off sequence to a new mtk_dp_aux_panel_poweron()
> function as to commonize it.
> Note that, before this commit, in mtk_dp_bridge_atomic_enable() only
> the AUX was getting powered on but the panel was left powered off if
> the DP cable wasn't plugged in while now we unconditionally send a D0
> request and this is done for two reasons:
> - First, whether this request fails or not, it takes the same time
> and anyway the DP hardware won't produce any error (or, if it
> does, it's ignorable because it won't block further commands)
> - Second, training the link between a sleeping/standby/unpowered
> display makes little sense.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
>
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>
> Tested-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> drivers/gpu/drm/mediatek/mtk_dp.c | 76 ++++++++++++-----------------
> --
> 1 file changed, 30 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c
> b/drivers/gpu/drm/mediatek/mtk_dp.c
> index 64eee77452c0..8b7ded1746f3 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> @@ -1251,6 +1251,29 @@ static void mtk_dp_audio_mute(struct mtk_dp
> *mtk_dp, bool mute)
> val[2], AU_TS_CFG_DP_ENC0_P0_MASK);
> }
>
> +static void mtk_dp_aux_panel_poweron(struct mtk_dp *mtk_dp, bool
> pwron)
> +{
> + if (pwron) {
> + /* power on aux */
> + mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> + DP_PWR_STATE_BANDGAP_TPLL_LANE,
> + DP_PWR_STATE_MASK);
> +
> + /* power on panel */
> + drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER,
> DP_SET_POWER_D0);
> + usleep_range(2000, 5000);
> + } else {
> + /* power off panel */
> + drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER,
> DP_SET_POWER_D3);
> + usleep_range(2000, 3000);
> +
> + /* power off aux */
> + mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> + DP_PWR_STATE_BANDGAP_TPLL,
> + DP_PWR_STATE_MASK);
> + }
> +}
> +
> static void mtk_dp_power_enable(struct mtk_dp *mtk_dp)
> {
> mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_RESET_AND_PROBE,
> @@ -1936,16 +1959,9 @@ static enum drm_connector_status
> mtk_dp_bdg_detect(struct drm_bridge *bridge)
> if (!mtk_dp->train_info.cable_plugged_in)
> return ret;
>
> - if (!enabled) {
> - /* power on aux */
> - mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> - DP_PWR_STATE_BANDGAP_TPLL_LANE,
> - DP_PWR_STATE_MASK);
> + if (!enabled)
> + mtk_dp_aux_panel_poweron(mtk_dp, true);
>
> - /* power on panel */
> - drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER,
> DP_SET_POWER_D0);
> - usleep_range(2000, 5000);
> - }
> /*
> * Some dongles still source HPD when they do not connect to
> any
> * sink device. To avoid this, we need to read the sink count
> @@ -1957,16 +1973,8 @@ static enum drm_connector_status
> mtk_dp_bdg_detect(struct drm_bridge *bridge)
> if (DP_GET_SINK_COUNT(sink_count))
> ret = connector_status_connected;
>
> - if (!enabled) {
> - /* power off panel */
> - drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER,
> DP_SET_POWER_D3);
> - usleep_range(2000, 3000);
> -
> - /* power off aux */
> - mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> - DP_PWR_STATE_BANDGAP_TPLL,
> - DP_PWR_STATE_MASK);
> - }
> + if (!enabled)
> + mtk_dp_aux_panel_poweron(mtk_dp, false);
>
> return ret;
> }
> @@ -1982,15 +1990,7 @@ static struct edid *mtk_dp_get_edid(struct
> drm_bridge *bridge,
>
> if (!enabled) {
> drm_atomic_bridge_chain_pre_enable(bridge, connector-
> >state->state);
> -
> - /* power on aux */
> - mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> - DP_PWR_STATE_BANDGAP_TPLL_LANE,
> - DP_PWR_STATE_MASK);
> -
> - /* power on panel */
> - drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER,
> DP_SET_POWER_D0);
> - usleep_range(2000, 5000);
> + mtk_dp_aux_panel_poweron(mtk_dp, true);
> }
>
> new_edid = drm_get_edid(connector, &mtk_dp->aux.ddc);
> @@ -2010,15 +2010,7 @@ static struct edid *mtk_dp_get_edid(struct
> drm_bridge *bridge,
> }
>
> if (!enabled) {
> - /* power off panel */
> - drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER,
> DP_SET_POWER_D3);
> - usleep_range(2000, 3000);
> -
> - /* power off aux */
> - mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> - DP_PWR_STATE_BANDGAP_TPLL,
> - DP_PWR_STATE_MASK);
> -
> + mtk_dp_aux_panel_poweron(mtk_dp, false);
> drm_atomic_bridge_chain_post_disable(bridge, connector-
> >state->state);
> }
>
> @@ -2178,15 +2170,7 @@ static void mtk_dp_bridge_atomic_enable(struct
> drm_bridge *bridge,
> return;
> }
>
> - /* power on aux */
> - mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> - DP_PWR_STATE_BANDGAP_TPLL_LANE,
> - DP_PWR_STATE_MASK);
> -
> - if (mtk_dp->train_info.cable_plugged_in) {
> - drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER,
> DP_SET_POWER_D0);
> - usleep_range(2000, 5000);
> - }
> + mtk_dp_aux_panel_poweron(mtk_dp, true);
>
> /* Training */
> ret = mtk_dp_training(mtk_dp);
> --
> 2.40.1
next prev parent reply other threads:[~2023-07-18 7:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 9:01 [PATCH v5 00/10] MediaTek DisplayPort: support eDP and aux-bus AngeloGioacchino Del Regno
2023-07-13 9:01 ` [PATCH v5 01/10] drm/mediatek: dp: Move AUX and panel poweron/off sequence to function AngeloGioacchino Del Regno
2023-07-18 7:40 ` CK Hu (胡俊光) [this message]
2023-07-18 7:41 ` Chen-Yu Tsai
2023-07-13 9:01 ` [PATCH v5 02/10] drm/mediatek: dp: Change logging to dev for mtk_dp_aux_transfer() AngeloGioacchino Del Regno
2023-07-13 9:01 ` [PATCH v5 03/10] drm/mediatek: dp: Use devm variant of drm_bridge_add() AngeloGioacchino Del Regno
2023-07-13 9:01 ` [PATCH v5 04/10] drm/mediatek: dp: Move AUX_P0 setting to mtk_dp_initialize_aux_settings() AngeloGioacchino Del Regno
2023-07-13 9:01 ` [PATCH v5 05/10] drm/mediatek: dp: Enable event interrupt only when bridge attached AngeloGioacchino Del Regno
2023-07-13 9:01 ` [PATCH v5 06/10] drm/mediatek: dp: Avoid mutex locks if audio is not supported/enabled AngeloGioacchino Del Regno
2023-07-13 9:01 ` [PATCH v5 07/10] drm/mediatek: dp: Move PHY registration to new function AngeloGioacchino Del Regno
2023-07-13 9:01 ` [PATCH v5 08/10] drm/mediatek: dp: Add support for embedded DisplayPort aux-bus AngeloGioacchino Del Regno
2023-07-13 9:01 ` [PATCH v5 09/10] drm/mediatek: dp: Add .wait_hpd_asserted() for AUX bus AngeloGioacchino Del Regno
2023-07-13 9:01 ` [PATCH v5 10/10] drm/mediatek: dp: Don't register HPD interrupt handler for eDP case AngeloGioacchino Del Regno
2023-07-13 9:54 ` [PATCH v5 00/10] MediaTek DisplayPort: support eDP and aux-bus Chen-Yu Tsai
2023-07-13 9:57 ` AngeloGioacchino Del Regno
2023-07-13 10:03 ` Chen-Yu Tsai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=827cc3730c949e38eafd3786631135bcc7c7591c.camel@mediatek.com \
--to=ck.hu@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=nfraprado@collabora.com \
--cc=wenst@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®