Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1381185pxy; Fri, 23 Apr 2021 06:54:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxarh4O8nI8ekbdydawu8dD/3SA4HN0X9sqACGYGDfoLKu7jzi0nbmDE0dVGaH547CKIJ39 X-Received: by 2002:a17:903:149:b029:eb:6372:9be0 with SMTP id r9-20020a1709030149b02900eb63729be0mr4182102plc.53.1619186071523; Fri, 23 Apr 2021 06:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619186071; cv=none; d=google.com; s=arc-20160816; b=Z92nhIcxDJd1KnnitEA4z90plM8nlmK5ih9HvIhSn9Kp5acX2g6dmwc0eGrHqYpDe/ KBfrrNVSijhkZcT8bSgSP2dtzo+9U/klVjWPSDgx3De414+/IP11rejj0fUJwOVJGNds JqhWxWodRrUW8ZpIsVATVrxuh+CxBP1Bvf/kluIcF7sGfp6wjRcyLZCE2bj0r+De8w+C 1ROce9ok+lLc5Jh3sH5YA01J3kUl++lXVgimyvXQfDQpsoIMebS1BC80bSb+HDs+6OzQ Ge+fXQqRavw3GnGgwPcuee4j4LfClszJkbB5MACoxkVcCUKH9D+xqQDRnQ4S0r5kPjgJ KZhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=enxA0jDxQH8/90qRuPZ7QUhg+lPFtjYbIroTnbfeeGo=; b=Z/8hwPrzmwbX4oPAS0F90dGbLBauQrX/bn5X2/kDF+xz5Se7cqeq589joJOPcjf5ty cI7q5kuuRkEOkdj6WuGZ/7NZYJbmq30T96bJzi7W/UQYIqKQmEVdZiDDo/THncMxDGpN SbYkSRFSpVocIFWFmY6HQB5GlqAHnOESMPxd81DgNSMVi67uMNkoZx8aJBhNbzyuN321 oonNZ8OGIFEAZ/+3Wc2OR0h0noVdHkR9w03ceVcxPeqEZUvvG3qcrEWklVt+nDFWqoa2 GJgP4sv1fDeUP2ROIzAU1zA8R89K6SSm82z0P0Nd0JeVTauidl+BFTypeNQlTvHz8Vfx AT4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=HkKewWUB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lb6si6688336pjb.153.2021.04.23.06.54.14; Fri, 23 Apr 2021 06:54:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=HkKewWUB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229871AbhDWNyQ (ORCPT + 99 others); Fri, 23 Apr 2021 09:54:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229794AbhDWNyP (ORCPT ); Fri, 23 Apr 2021 09:54:15 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E113C06174A for ; Fri, 23 Apr 2021 06:53:39 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id j12so26860547ils.4 for ; Fri, 23 Apr 2021 06:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=enxA0jDxQH8/90qRuPZ7QUhg+lPFtjYbIroTnbfeeGo=; b=HkKewWUBtZjysoTAN+6Napt2wK6vPpLfXArsR5jUF8bzLiOFZh5DHyYlQurNDqFCbg u9VdeqfbQoUhfKoZTsX9T0nXEybXc3mSuvKFfvsauiLZ8CULjE9pNibAvZAj5NrmlISi XA+qD0bBQqAtclwX8gCV+/RPZFVK1rpb099YEIutnqSfBUOe2WwOFW97MoHURyrShGMe An6gTkGr2o6fFCsLcarHTQF1jxVCQCpLXJSxx69SqflELDov2G3O7APVfjRGDr7u8/D0 OO9l4OQ9mpA1HpRAiw2xXnkFZLf4PmelUEIZlZajQ09Y9SXbuvNLH+ENDaj3HHLbmehK 2Wlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=enxA0jDxQH8/90qRuPZ7QUhg+lPFtjYbIroTnbfeeGo=; b=r6xZz8VVC2UEO3/kiWVx+kFD63o/N4U9BE0Re10MNad7hIMkeg8BZcyArL3bO2HCo1 zeNX3DUw0QDvgNVVdb57j67szhwVm2y+cjdzwSueGsr/PD6f1iukIDdmEN0epNt0+msV r97eu9JUP9xn2gd2h3bpPFCqi0R9NcpqKJacvrYNxhz8yCu7vrcqn/dGIlYvS7N80U4q FM4SSRBw5uIULGnFDUbPvznvp7woCyKBmzVjtuJnw0YayZ1TgKOdTzdmQ9kYT0AITxQQ CnfcQDsqyw9ZWS8OEmCKbRaMadBB1mcFtAknq6RR/FXy04m7WBZPXTU2MHGsyh7XavrY FzHQ== X-Gm-Message-State: AOAM532BJbVtBLu8oEBGNU8TkQr0mTk2g8mkOrMMF4/widE37QBUsIQw vt5nt/VQ8sUcUlPyaut0BgvgsQMIHuOXAEnkqSSCVg== X-Received: by 2002:a05:6e02:1d06:: with SMTP id i6mr3030247ila.165.1619186018640; Fri, 23 Apr 2021 06:53:38 -0700 (PDT) MIME-Version: 1.0 References: <20210409045314.3420733-1-hsinyi@chromium.org> In-Reply-To: <20210409045314.3420733-1-hsinyi@chromium.org> From: Sean Paul Date: Fri, 23 Apr 2021 09:53:02 -0400 Message-ID: Subject: Re: [PATCH 1/2] drm/mediatek: set panel orientation before drm_dev_register(). To: Hsin-Yi Wang Cc: Chun-Kuang Hu , Matthias Brugger , Enric Balletbo i Serra , Philipp Zabel , David Airlie , Daniel Vetter , dri-devel , "moderated list:ARM/Mediatek SoC support" , linux-arm-kernel , LKML , Rob Herring , devicetree Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 9, 2021 at 12:53 AM Hsin-Yi Wang wrote: > > drm_dev_register() sets connector->registration_state to > DRM_CONNECTOR_REGISTERED and dev->registered to true. If > drm_connector_set_panel_orientation() is first called after > drm_dev_register(), it will fail several checks and results in following > warning. So set panel orientation in dsi before drm_dev_register() is > called. > > [ 4.480976] ------------[ cut here ]------------ > [ 4.485603] WARNING: CPU: 5 PID: 369 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xb4/0xbc > > [ 4.609772] Call trace: > [ 4.612208] __drm_mode_object_add+0xb4/0xbc > [ 4.616466] drm_mode_object_add+0x20/0x2c > [ 4.620552] drm_property_create+0xdc/0x174 > [ 4.624723] drm_property_create_enum+0x34/0x98 > [ 4.629241] drm_connector_set_panel_orientation+0x64/0xa0 > [ 4.634716] boe_panel_get_modes+0x88/0xd8 > [ 4.638802] drm_panel_get_modes+0x2c/0x48 > [ 4.642887] panel_bridge_get_modes+0x1c/0x28 > [ 4.647233] drm_bridge_connector_get_modes+0xa0/0xd4 > [ 4.652273] drm_helper_probe_single_connector_modes+0x218/0x700 > [ 4.658266] drm_mode_getconnector+0x1b4/0x45c > [ 4.662699] drm_ioctl_kernel+0xac/0x128 > [ 4.666611] drm_ioctl+0x268/0x410 > [ 4.670002] drm_compat_ioctl+0xdc/0xf0 > [ 4.673829] __arm64_compat_sys_ioctl+0xc8/0x100 > [ 4.678436] el0_svc_common+0xf4/0x1c0 > [ 4.682174] do_el0_svc_compat+0x28/0x3c > [ 4.686088] el0_svc_compat+0x10/0x1c > [ 4.689738] el0_sync_compat_handler+0xa8/0xcc > [ 4.694171] el0_sync_compat+0x178/0x180 > [ 4.698082] ---[ end trace b4f2db9d9c88610b ]--- > [ 4.702721] ------------[ cut here ]------------ > [ 4.707329] WARNING: CPU: 5 PID: 369 at drivers/gpu/drm/drm_mode_object.c:243 drm_object_attach_property+0x48/0xb8 > > [ 4.833830] Call trace: > [ 4.836266] drm_object_attach_property+0x48/0xb8 > [ 4.840958] drm_connector_set_panel_orientation+0x84/0xa0 > [ 4.846432] boe_panel_get_modes+0x88/0xd8 > [ 4.850516] drm_panel_get_modes+0x2c/0x48 > [ 4.854600] panel_bridge_get_modes+0x1c/0x28 > [ 4.858946] drm_bridge_connector_get_modes+0xa0/0xd4 > [ 4.863984] drm_helper_probe_single_connector_modes+0x218/0x700 > [ 4.869978] drm_mode_getconnector+0x1b4/0x45c > [ 4.874410] drm_ioctl_kernel+0xac/0x128 > [ 4.878320] drm_ioctl+0x268/0x410 > [ 4.881711] drm_compat_ioctl+0xdc/0xf0 > [ 4.885536] __arm64_compat_sys_ioctl+0xc8/0x100 > [ 4.890142] el0_svc_common+0xf4/0x1c0 > [ 4.893879] do_el0_svc_compat+0x28/0x3c > [ 4.897791] el0_svc_compat+0x10/0x1c > [ 4.901441] el0_sync_compat_handler+0xa8/0xcc > [ 4.905873] el0_sync_compat+0x178/0x180 > [ 4.909783] ---[ end trace b4f2db9d9c88610c ]--- > > Signed-off-by: Hsin-Yi Wang > --- > drivers/gpu/drm/mediatek/mtk_dsi.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c > index ae403c67cbd9..45a702ee09f3 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > @@ -205,6 +205,7 @@ struct mtk_dsi { > u32 irq_data; > wait_queue_head_t irq_wait_queue; > const struct mtk_dsi_driver_data *driver_data; > + enum drm_panel_orientation orientation; > }; > > static inline struct mtk_dsi *bridge_to_dsi(struct drm_bridge *b) > @@ -966,6 +967,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) > } > drm_connector_attach_encoder(dsi->connector, &dsi->encoder); > > + drm_connector_set_panel_orientation(dsi->connector, dsi->orientation); > + > return 0; > > err_cleanup_encoder: > @@ -1029,6 +1032,12 @@ static int mtk_dsi_probe(struct platform_device *pdev) > ret = PTR_ERR(dsi->next_bridge); > goto err_unregister_host; > } > + > + ret = of_drm_get_panel_orientation(panel->dev->of_node, &dsi->orientation); > + if (ret) { > + dev_err(dev, "failed to get panel orientation %d\n", ret); > + return ret; > + } I don't think this is the right place to mine orientation since it duplicates the call from the panel driver. Instead, how about splitting out property_create_enum/attach_orientation_property from set_panel_orientation such that you can attach the property (with UNKNOWN value) in the connector init and then leave the panel to set it properly in get_modes (I kind of disagree with populating this in get_modes as well, but I don't think there's anywhere else to stick it right now)? AFAICT orientation is the only property which has the create/attach calls in the set function which seems like a perfect recipe for this type of failure. Sean > } > > dsi->driver_data = of_device_get_match_data(dev); > -- > 2.31.1.295.g9ea45b61b8-goog >