From nobody Sat Sep 21 23:29:55 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B4CFC433EF for ; Mon, 6 Jun 2022 05:06:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229535AbiFFFG2 (ORCPT ); Mon, 6 Jun 2022 01:06:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbiFFFGW (ORCPT ); Mon, 6 Jun 2022 01:06:22 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43E624991C for ; Sun, 5 Jun 2022 21:47:31 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id e9so1340492pju.5 for ; Sun, 05 Jun 2022 21:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8MQxz8kqIDAZ2fZ4kfRiAMdgAPZT0OSWTELIOXH4bpA=; b=bijG36Pt+M1nDEyjoGMrkaI9t4WYfcYdP+WZvFtG4qqKlRVCURyenQorZwvdwzgOV2 rgV2/0rYZAVwdMhSIzPujdPzeTd3lkGeRkbFI1yuY0dQnqMJr+1tpT4r0onWdGqgqkHa GqYdc69FSkzbyYjUAq914jSACIJVZt8JnQi1I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8MQxz8kqIDAZ2fZ4kfRiAMdgAPZT0OSWTELIOXH4bpA=; b=Akhk+zS1iYiHl8V9k0nDG8jOfGqDLHAl4djPhCrvanHgKnlymGuxS/b/ilTNvP0ZQk u1A3q/lUfg7b75rIEFxjVNjcQo82oka3Kn8nA2/CQJ/sRLDDOftIkD5ZJEHZao4w9WwN HSu9az3maYcI3ivEE+vsASErmXylMuZCMzo1rAaRKlqAmcndluo8TXveel4eiEA6sSVe JBbqDw74BecYUwP7OOM/iAa8txZrMArtt7KttIrRugYZOqgM1rwY8LxJVqZ8JqCn5TCE PQM5dxG/atgQ7IcicnFNS+9S93T+tHvjnj4K1uBO3hlTnILHQU8gJ47qlufxKG5wcYJh 6phA== X-Gm-Message-State: AOAM531vMKYgmM7deybELpqKptir23i7EuRV102TWi79lRow3utaDTxq GHp5l4XxYFxW3xOTfsCnHnlbVw== X-Google-Smtp-Source: ABdhPJyEhyggeaOMzIgoDx50rqIZ96LmNePoBj+W9JhZTpmi9YNIR5A0G9TFAJu584hNP5KsKh6jeg== X-Received: by 2002:a17:90b:38c1:b0:1e8:5df7:cfd8 with SMTP id nn1-20020a17090b38c100b001e85df7cfd8mr10240268pjb.79.1654490850677; Sun, 05 Jun 2022 21:47:30 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ced3:b110:401b:b32c]) by smtp.gmail.com with ESMTPSA id t190-20020a6381c7000000b003db7de758besm9718609pgd.5.2022.06.05.21.47.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:47:30 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu Cc: Hans de Goede , Thierry Reding , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Rob Clark , Stephen Boyd , Douglas Anderson , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation Date: Mon, 6 Jun 2022 12:47:13 +0800 Message-Id: <20220606044720.945964-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606044720.945964-1-hsinyi@chromium.org> References: <20220606044720.945964-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Panels usually call drm_connector_set_panel_orientation(), which is later than drm/kms driver calling drm_dev_register(). This leads to a WARN(). The orientation property is known earlier. For example, some panels parse the property through device tree during probe. Add an API to return the property from panel to drm/kms driver, so the drivers are able to call drm_connector_set_panel_orientation() before drm_dev_register(). Suggested-by: Hans de Goede Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- v2->v3: no change --- drivers/gpu/drm/drm_panel.c | 8 ++++++++ include/drm/drm_panel.h | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index f634371c717a..4a512ca80673 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -223,6 +223,14 @@ int drm_panel_get_modes(struct drm_panel *panel, } EXPORT_SYMBOL(drm_panel_get_modes); =20 +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *pan= el) +{ + if (panel && panel->funcs && panel->funcs->get_orientation) + return panel->funcs->get_orientation(panel); + + return DRM_MODE_PANEL_ORIENTATION_UNKNOWN; +} +EXPORT_SYMBOL(drm_panel_get_orientation); #ifdef CONFIG_OF /** * of_drm_find_panel - look up a panel using a device tree node diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 1ba2d424a53f..d1bd3be4bbdf 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -133,6 +133,15 @@ struct drm_panel_funcs { * Allows panels to create panels-specific debugfs files. */ void (*debugfs_init)(struct drm_panel *panel, struct dentry *root); + + /** + * @get_orientation: + * + * Return the panel orientation set by device tree or EDID. + * + * This function is optional. + */ + enum drm_panel_orientation (*get_orientation)(struct drm_panel *panel); }; =20 /** @@ -195,6 +204,7 @@ int drm_panel_enable(struct drm_panel *panel); int drm_panel_disable(struct drm_panel *panel); =20 int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *con= nector); +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *pan= el); =20 #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL) struct drm_panel *of_drm_find_panel(const struct device_node *np); --=20 2.36.1.255.ge46751e96f-goog From nobody Sat Sep 21 23:29:55 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A8C0C433EF for ; Mon, 6 Jun 2022 04:50:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229508AbiFFEuX (ORCPT ); Mon, 6 Jun 2022 00:50:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbiFFEuV (ORCPT ); Mon, 6 Jun 2022 00:50:21 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB05C2F1F32 for ; Sun, 5 Jun 2022 21:47:34 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id mh16-20020a17090b4ad000b001e8313301f1so4907459pjb.1 for ; Sun, 05 Jun 2022 21:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hGnDD5r5M3UXCU6BZiTbTzLZsBiSocgUQfxs0cDS1G4=; b=l30rCOLic8LaKGIFsKhI6vz67rGgjxbrO3jiCldFNIW8I5OkLf9aDeJzRGh8jMUXQr SdCvlbgXiwhwr5/BW2rNXyL5J0Ps9u1DEZr8MjIpgqYLPWpvNzo7Yl+yZKxpXm2JIANR IIiMhDTbZV4a5Cc7egdsQqqF+o3IIyQ41+HPU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hGnDD5r5M3UXCU6BZiTbTzLZsBiSocgUQfxs0cDS1G4=; b=UgbquxQb1V6Lz7ZXR1KVCtotfAyYAjGyHHKDtKpC5KBeaFZ6Wn0pU8pW4LCWEaAmLK kRhRuZZDCA/8HHR6uQJrokgDtjmzAcelKAWBO/UIjaFqdWE56E/Nk4ZzGQjtJGZoXU36 VZ/91cD5c2Mvb1bpj6ueqf87nw5HA1x/C8iGwG0oh1yT0Qo1QgJF1Sgjd9wKALwAr0iL D0Q1kvm2MiS9Cuvh8JCZsN12Pyxt21v3bczaczj0xPK/KkBZtHjPJDVLLwbEmlSLg42x UmJ9qi0scOdRQmj7s2rUhkKaWU4G6hPUi5UrW39/S59k0QdvpIiWGYMKfy4RKU+7RR7X cluA== X-Gm-Message-State: AOAM533tnqrJdRrUM21Xraaio73Feq78tCDzt1HxG+A45b0QcieAWu6h CdSaO1Ul4lKg/GiYkqmCZ+OEQg== X-Google-Smtp-Source: ABdhPJzbBbErXs2PWbpEsxPCivcXPl2J9WhwCBQUubS9o01KqgtcAIWDGinwPaxoXPioh5PpozS7CA== X-Received: by 2002:a17:902:c407:b0:163:df01:bbbc with SMTP id k7-20020a170902c40700b00163df01bbbcmr22376780plk.4.1654490854118; Sun, 05 Jun 2022 21:47:34 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ced3:b110:401b:b32c]) by smtp.gmail.com with ESMTPSA id t190-20020a6381c7000000b003db7de758besm9718609pgd.5.2022.06.05.21.47.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:47:33 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu Cc: Hans de Goede , Thierry Reding , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Rob Clark , Stephen Boyd , Douglas Anderson , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback Date: Mon, 6 Jun 2022 12:47:14 +0800 Message-Id: <20220606044720.945964-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606044720.945964-1-hsinyi@chromium.org> References: <20220606044720.945964-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- v2->v3: add comments for notice. --- drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/d= rm/panel/panel-boe-tv101wum-nl6.c index 1be150ac758f..a9cd07234179 100644 --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c @@ -1511,16 +1511,30 @@ static int boe_panel_get_modes(struct drm_panel *pa= nel, connector->display_info.width_mm =3D boe->desc->size.width_mm; connector->display_info.height_mm =3D boe->desc->size.height_mm; connector->display_info.bpc =3D boe->desc->bpc; + /* + * drm drivers are expected to call drm_panel_get_orientation() to get + * panel's orientation then drm_connector_set_panel_orientation() to + * set the property before drm_dev_register(). Otherwise there will be + * a WARN_ON if orientation is set after drm is registered. + */ drm_connector_set_panel_orientation(connector, boe->orientation); =20 return 1; } =20 +static enum drm_panel_orientation boe_panel_get_orientation(struct drm_pan= el *panel) +{ + struct boe_panel *boe =3D to_boe_panel(panel); + + return boe->orientation; +} + static const struct drm_panel_funcs boe_panel_funcs =3D { .unprepare =3D boe_panel_unprepare, .prepare =3D boe_panel_prepare, .enable =3D boe_panel_enable, .get_modes =3D boe_panel_get_modes, + .get_orientation =3D boe_panel_get_orientation, }; =20 static int boe_panel_add(struct boe_panel *boe) --=20 2.36.1.255.ge46751e96f-goog From nobody Sat Sep 21 23:29:55 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 295D3C43334 for ; Mon, 6 Jun 2022 04:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229548AbiFFEui (ORCPT ); Mon, 6 Jun 2022 00:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229525AbiFFEu1 (ORCPT ); Mon, 6 Jun 2022 00:50:27 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74A242F2969 for ; Sun, 5 Jun 2022 21:47:38 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id n8so11251467plh.1 for ; Sun, 05 Jun 2022 21:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j5js470YBzKdTaXPl+QQ3rHxeotAooP4m8EcPovVk7E=; b=jsy7p+Ffk83iH0WeQKhkJUtkuFwG2INATX6huMKL3o2tgG0gGW3qfw6O/Y1Oi1MDyg 86riQ5YlrwYS7iGY1PePFPe+QKpOOSPUS/fFSgbsGS9/VB15qANkhc1m6SHZ/SEYuU7k 2XcBTzVWeh3t3DXe0/FAfRY1xILCc0/LrypXU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j5js470YBzKdTaXPl+QQ3rHxeotAooP4m8EcPovVk7E=; b=NyhfNIKDY19YRNsAGzNCFQSW9HPD8xk32PIRibOWFoal4RgzgpaIoBpp6s3PKALcAb Q9tYxcMaUR3U6NC7zUdK5rU/fNV0C2huW/2Cdb/rsASodkImrdaID9Sfcix9BeMuJJ0D OgiFwj86f2kN6SBFrumFFgvDsThsZhvBhC0yeFFGQWtvB0s7kVZztIYp3Xw4m8QsZucq 9UC2NH3NxFhAgIUpX6H6Hc1+uJVdg2xHV1hltAPTX0u0U4oksJnMJQad1l6ySWUBt6jO EF25Bs93QTnu0BiHhDLaoSCSvayRPdPArQyfYbmX4CfNQIGPf9LPzSu6JFq7mv7visus 8LtA== X-Gm-Message-State: AOAM533h6g8XQ0m5GpDnth/AUk7cmL7rCO+DCSeAQW/xFImnjdrj71M/ bUdjpr62uiL85uQl/LNpSXYt7g== X-Google-Smtp-Source: ABdhPJy42F5uKW7n3PhvsBm2Wpi4Be0H0h9tOi7rmAJO1h8CZRqP4ccOd2jEJ378wYUXbDk+hWrJJg== X-Received: by 2002:a17:902:8648:b0:167:86f2:aec3 with SMTP id y8-20020a170902864800b0016786f2aec3mr986607plt.172.1654490857525; Sun, 05 Jun 2022 21:47:37 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ced3:b110:401b:b32c]) by smtp.gmail.com with ESMTPSA id t190-20020a6381c7000000b003db7de758besm9718609pgd.5.2022.06.05.21.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:47:37 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu Cc: Hans de Goede , Thierry Reding , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Rob Clark , Stephen Boyd , Douglas Anderson , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/8] drm/panel: panel-edp: Implement .get_orientation callback Date: Mon, 6 Jun 2022 12:47:15 +0800 Message-Id: <20220606044720.945964-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606044720.945964-1-hsinyi@chromium.org> References: <20220606044720.945964-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- v2->v3: add comments for notice. --- drivers/gpu/drm/panel/panel-edp.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/pane= l-edp.c index 1732b4f56e38..5fa208005395 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -586,7 +586,12 @@ static int panel_edp_get_modes(struct drm_panel *panel, else if (!num) dev_warn(p->base.dev, "No display modes\n"); =20 - /* set up connector's "panel orientation" property */ + /* + * drm drivers are expected to call drm_panel_get_orientation() to get + * panel's orientation then drm_connector_set_panel_orientation() to + * set the property before drm_dev_register(). Otherwise there will be + * a WARN_ON if orientation is set after drm is registered. + */ drm_connector_set_panel_orientation(connector, p->orientation); =20 return num; @@ -609,6 +614,13 @@ static int panel_edp_get_timings(struct drm_panel *pan= el, return p->desc->num_timings; } =20 +static enum drm_panel_orientation panel_edp_get_orientation(struct drm_pan= el *panel) +{ + struct panel_edp *p =3D to_panel_edp(panel); + + return p->orientation; +} + static int detected_panel_show(struct seq_file *s, void *data) { struct drm_panel *panel =3D s->private; @@ -637,6 +649,7 @@ static const struct drm_panel_funcs panel_edp_funcs =3D= { .prepare =3D panel_edp_prepare, .enable =3D panel_edp_enable, .get_modes =3D panel_edp_get_modes, + .get_orientation =3D panel_edp_get_orientation, .get_timings =3D panel_edp_get_timings, .debugfs_init =3D panel_edp_debugfs_init, }; --=20 2.36.1.255.ge46751e96f-goog From nobody Sat Sep 21 23:29:55 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0BC4C433EF for ; Mon, 6 Jun 2022 04:50:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229540AbiFFEua (ORCPT ); Mon, 6 Jun 2022 00:50:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbiFFEuY (ORCPT ); Mon, 6 Jun 2022 00:50:24 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D37B42F4497 for ; Sun, 5 Jun 2022 21:47:41 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id c18so3667124pgh.11 for ; Sun, 05 Jun 2022 21:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jJ29kS9c54d0XZMXg/mI13/u5APCZGzRFuqJAJLTaSY=; b=Kx8+twWhs/MPzSGyOLbfniqa2/hFoAzxdS5zJtPY3HxAawuRcw8KkL4mgSmRFD6xAy TLCEAO9autEMesNlLsqrz0eEEQehlWzf4CMj7ow9KfICb0QKPZKvjj9jjU0uLAN+BCde ZWUMw6pzqRfkezTfLlpU8gnUUiZhoVvmX6dWI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jJ29kS9c54d0XZMXg/mI13/u5APCZGzRFuqJAJLTaSY=; b=R6XCHdnmVeZcRV67uR2nEa9bblRDaClcXzlQ+8Q49DwWxCFo/1HtMpwFXL9wY2Pa20 49wNc0IRPUL1R4wRDCp8QZG+4j/skyPoYFcPguNfCCoHXJ1i2fS9XMq2X60OsF6g0na+ hAYKHdvvMiiooYTHdt2LncmfEkQFQuMixxrFBONA2xTArYwU894aEhsDXuwKSWA78xga pN1TA3s/LcIiE4RCE71PlHCe+zb3WItf9E6S1APBzmh9nznqwMAXwNsdMptiRhUeAGJr rpjlpIymi+nT5nRkWP5NmcEypzkHmMW4SOIVU65zrfsPLxD4ceCUomIBd5qJDVBj0Gqb 6KEw== X-Gm-Message-State: AOAM533JSq4sp5XLk4VVDP15XcZKhr4vh5UKTkegdC6nv3o4aesqX9J5 Z4v5ZYDcNf6Pm1ZJntqgQpHCXw== X-Google-Smtp-Source: ABdhPJxboXw4784UYCoUHqaFDgjTzJl4vu2MwUNiNzP8AEvIWZFJ27MkePTqp5g456Y0NeSDSc3yvg== X-Received: by 2002:a62:e116:0:b0:51b:c452:47e6 with SMTP id q22-20020a62e116000000b0051bc45247e6mr21890310pfh.25.1654490861026; Sun, 05 Jun 2022 21:47:41 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ced3:b110:401b:b32c]) by smtp.gmail.com with ESMTPSA id t190-20020a6381c7000000b003db7de758besm9718609pgd.5.2022.06.05.21.47.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:47:40 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu Cc: Hans de Goede , Thierry Reding , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Rob Clark , Stephen Boyd , Douglas Anderson , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/8] drm/panel: lvds: Implement .get_orientation callback Date: Mon, 6 Jun 2022 12:47:16 +0800 Message-Id: <20220606044720.945964-5-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606044720.945964-1-hsinyi@chromium.org> References: <20220606044720.945964-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- v2->v3: add comments for notice. --- drivers/gpu/drm/panel/panel-lvds.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/pan= el-lvds.c index 27a1c9923b09..239527409b00 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -102,15 +102,29 @@ static int panel_lvds_get_modes(struct drm_panel *pan= el, connector->display_info.bus_flags =3D lvds->data_mirror ? DRM_BUS_FLAG_DATA_LSB_TO_MSB : DRM_BUS_FLAG_DATA_MSB_TO_LSB; + /* + * drm drivers are expected to call drm_panel_get_orientation() to get + * panel's orientation then drm_connector_set_panel_orientation() to + * set the property before drm_dev_register(). Otherwise there will be + * a WARN_ON if orientation is set after drm is registered. + */ drm_connector_set_panel_orientation(connector, lvds->orientation); =20 return 1; } =20 +static enum drm_panel_orientation panel_lvds_get_orientation,(struct drm_p= anel *panel) +{ + struct panel_lvds *lvds =3D to_panel_lvds(panel); + + return lvds->orientation; +} + static const struct drm_panel_funcs panel_lvds_funcs =3D { .unprepare =3D panel_lvds_unprepare, .prepare =3D panel_lvds_prepare, .get_modes =3D panel_lvds_get_modes, + .get_orientation =3D panel_lvds_get_orientation, }; =20 static int panel_lvds_parse_dt(struct panel_lvds *lvds) --=20 2.36.1.255.ge46751e96f-goog From nobody Sat Sep 21 23:29:55 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE59FC43334 for ; Mon, 6 Jun 2022 05:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229550AbiFFFGe (ORCPT ); Mon, 6 Jun 2022 01:06:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbiFFFG2 (ORCPT ); Mon, 6 Jun 2022 01:06:28 -0400 Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8694F2F5AAA for ; Sun, 5 Jun 2022 21:47:55 -0700 (PDT) Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-f33f0f5b1dso17862891fac.8 for ; Sun, 05 Jun 2022 21:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WQSi4k5+DH2NNzeThmAR4iQ0/H0TraV3Wr+JMjHmwJQ=; b=FAtsRXTGQSRmHF3KZa8qcRDi7ZgeV0IHUdd6bGueBBcGZLOnTBmR2RxZuazS+y9q7o OjsxgIujdZ2ZNgJQ78+1g6rHMvJ+klHfBwJQ4oMAZXFks8cmh/P7/ooETatdAdTB3Byg 4eII/roHshTB7nk8UYbDpl+zs1uOsVrtysWCs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WQSi4k5+DH2NNzeThmAR4iQ0/H0TraV3Wr+JMjHmwJQ=; b=z0Db2uBHVbu2DdfgHJUOc1slbsXw7gt663LXCIClkQ/nahGGwRBZQGP+NRs114TkET wfAKltAskZlyuVEthX4T+bjGAA/e9ZV+aAdVdot1V82t4iGFulKBN1bhdYMQvaFF6nS8 ThCOQjAQZco11kv3TxGi0b5FOvhsY8ee4G5UHr9+6tSKqE6ZiDQxWsr0Hn61Ic4A5CQz UGU+345q6gP23PWwRxEkh+4bJExzCxaJ9nQ5U2hsgB0ySZK1J2/pqu9ahxAt4zLzL5vM U+ytJqR820M5SdDPP/LXxSZVK38PSR5rev+GspTd2/6iRQ+tXVILTc3JnAtcxskdUR93 7Aqg== X-Gm-Message-State: AOAM532v2pJ0AcKnLkyAy44KY2RUq77bQLh+iSW7Xf2e6oSsQrRtSmnM bZ+i1ltIkDIPPQPLmCCycNAMAe/ckGT5Hw== X-Google-Smtp-Source: ABdhPJw+hjmyVd5Y3lxE71x0n/iIpqeWNV6iXQ9+/Kki/UAwcLC1/X8EJwlXese7X56/wWt85lzakA== X-Received: by 2002:a17:90a:4282:b0:1de:c783:4e79 with SMTP id p2-20020a17090a428200b001dec7834e79mr24215753pjg.235.1654490864436; Sun, 05 Jun 2022 21:47:44 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ced3:b110:401b:b32c]) by smtp.gmail.com with ESMTPSA id t190-20020a6381c7000000b003db7de758besm9718609pgd.5.2022.06.05.21.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:47:44 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu Cc: Hans de Goede , Thierry Reding , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Rob Clark , Stephen Boyd , Douglas Anderson , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/8] drm/panel: panel-simple: Implement .get_orientation callback Date: Mon, 6 Jun 2022 12:47:17 +0800 Message-Id: <20220606044720.945964-6-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606044720.945964-1-hsinyi@chromium.org> References: <20220606044720.945964-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- v2->v3: add comments for notice. --- drivers/gpu/drm/panel/panel-simple.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/p= anel-simple.c index a34f4198a534..82041cdb5478 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -411,7 +411,12 @@ static int panel_simple_get_modes(struct drm_panel *pa= nel, /* add hard-coded panel modes */ num +=3D panel_simple_get_non_edid_modes(p, connector); =20 - /* set up connector's "panel orientation" property */ + /* + * drm drivers are expected to call drm_panel_get_orientation() to get + * panel's orientation then drm_connector_set_panel_orientation() to + * set the property before drm_dev_register(). Otherwise there will be + * a WARN_ON if orientation is set after drm is registered. + */ drm_connector_set_panel_orientation(connector, p->orientation); =20 return num; @@ -434,6 +439,14 @@ static int panel_simple_get_timings(struct drm_panel *= panel, return p->desc->num_timings; } =20 +static enum drm_panel_orientation panel_simple_get_orientation(struct drm_= panel *panel) +{ + struct panel_simple *p =3D to_panel_simple(panel); + + return p->orientation; +} + + static const struct drm_panel_funcs panel_simple_funcs =3D { .disable =3D panel_simple_disable, .unprepare =3D panel_simple_unprepare, @@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = =3D { .enable =3D panel_simple_enable, .get_modes =3D panel_simple_get_modes, .get_timings =3D panel_simple_get_timings, + .get_orientation =3D panel_simple_get_orientation, }; =20 static struct panel_desc panel_dpi; --=20 2.36.1.255.ge46751e96f-goog From nobody Sat Sep 21 23:29:55 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF757C433EF for ; Mon, 6 Jun 2022 04:50:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229582AbiFFEun (ORCPT ); Mon, 6 Jun 2022 00:50:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbiFFEua (ORCPT ); Mon, 6 Jun 2022 00:50:30 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D2572F4F75 for ; Sun, 5 Jun 2022 21:47:48 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id gd1so11891603pjb.2 for ; Sun, 05 Jun 2022 21:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OBG3ddtj+ZgIQfqLNbcmwFIyPm4EVBcaHeaGb5pT53Q=; b=YTN/yrUXNy7AmhJsYdMLLEXrXzJNpCpiojsuW+/5T6R8odawYfdjXEzZ+B7EFnw/W6 vYpDD9rzbiFP9XqgXZteF3gEyBPpL6GV8oBttP2HW053YVX1vnDQASxMTW9EXSt4MaCX dydxq0zVhK/pKtHCsXczIiTtwm7cPPHuSBmBk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OBG3ddtj+ZgIQfqLNbcmwFIyPm4EVBcaHeaGb5pT53Q=; b=CvUCtv7LHImTHaMh+5YsK7HfCMwJLQeDNQcVZ5VZWZmev/MCyoAnRG8gxWh/gVvqsF r3t5eqvfYn/7Q41rABrvctU7DyoWvLcp3ROAqOw8p1oKXOi2M8HyqEGRWjo+2K9y9edM UiYa0DM9uWUls5+yfRf34pPixVgIwTbXee0p5YiWUVdMrH647qP2YVOIV85lGAygtGeL i3Pt+Gx6vyf5vrJAY/trkkodHQRq91thczQCkgy1qEuhML9GAicMZiB1w7uzsXM9ww6z NFWJfOsE/U+1IqGD26t69455YTzvzLrt1HLmOO5EPAmxUR2pi9kn1OBiGug2n+fkDakF 4cUw== X-Gm-Message-State: AOAM531baEqUCmrr65u02IWlZwxA3erlAbCv9Pp/b0sA4A4Ybn4GYoZ7 +UABAkMiz8k4l4JyxP1ZR58+XA== X-Google-Smtp-Source: ABdhPJy0cD/wB0NQeYXWO8VZhTzsLbFYO/xjtJmuOarvo+HHpEF1EMPNpX5LHTHmFds8OdivJ/CaRg== X-Received: by 2002:a17:90b:1e01:b0:1e3:1f4c:dd71 with SMTP id pg1-20020a17090b1e0100b001e31f4cdd71mr24916639pjb.168.1654490867923; Sun, 05 Jun 2022 21:47:47 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ced3:b110:401b:b32c]) by smtp.gmail.com with ESMTPSA id t190-20020a6381c7000000b003db7de758besm9718609pgd.5.2022.06.05.21.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:47:47 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu Cc: Hans de Goede , Thierry Reding , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Rob Clark , Stephen Boyd , Douglas Anderson , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 6/8] drm/panel: ili9881c: Implement .get_orientation callback Date: Mon, 6 Jun 2022 12:47:18 +0800 Message-Id: <20220606044720.945964-7-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606044720.945964-1-hsinyi@chromium.org> References: <20220606044720.945964-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- v2->v3: add comments for notice. --- drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/dr= m/panel/panel-ilitek-ili9881c.c index ba30d11547ad..c098a0ed6be7 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c @@ -853,17 +853,31 @@ static int ili9881c_get_modes(struct drm_panel *panel, connector->display_info.width_mm =3D mode->width_mm; connector->display_info.height_mm =3D mode->height_mm; =20 + /* + * drm drivers are expected to call drm_panel_get_orientation() to get + * panel's orientation then drm_connector_set_panel_orientation() to + * set the property before drm_dev_register(). Otherwise there will be + * a WARN_ON if orientation is set after drm is registered. + */ drm_connector_set_panel_orientation(connector, ctx->orientation); =20 return 1; } =20 +static enum drm_panel_orientation ili9881c_get_orientation(struct drm_pane= l *panel) +{ + struct ili9881c *ctx =3D panel_to_ili9881c(panel); + + return ctx->orientation; +} + static const struct drm_panel_funcs ili9881c_funcs =3D { .prepare =3D ili9881c_prepare, .unprepare =3D ili9881c_unprepare, .enable =3D ili9881c_enable, .disable =3D ili9881c_disable, .get_modes =3D ili9881c_get_modes, + .get_orientation =3D ili9881c_get_orientation, }; =20 static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi) --=20 2.36.1.255.ge46751e96f-goog From nobody Sat Sep 21 23:29:55 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CBE8C433EF for ; Mon, 6 Jun 2022 05:06:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229589AbiFFFGs (ORCPT ); Mon, 6 Jun 2022 01:06:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbiFFFGq (ORCPT ); Mon, 6 Jun 2022 01:06:46 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37AF72F5A73 for ; Sun, 5 Jun 2022 21:47:52 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id j7so11870850pjn.4 for ; Sun, 05 Jun 2022 21:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=97K3htkiWQw+INn8ETXNI7aVsJxE2gVqrlXYI1w5zzg=; b=dpNT3fTX/WPB28+JQiYWM7nrmX5TOOLvK8DrJSqzIIFhGqrpFbggxbj9UFaSCTSaAn LmuhI/pzBFe/vSEP67ajaAyBbveZCRa0Uw47P+OUvwnCR9uLK97wlNpW3/B55/T156Cd +NaBn/YN9zWbC4kRLOhAn6kg37+XSoHeweuDg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=97K3htkiWQw+INn8ETXNI7aVsJxE2gVqrlXYI1w5zzg=; b=3sztGaS79CyL1BNY+7hKLmCqM8Qw3k0M9cQ9aZaPKY/LAELNL9gDk+/S8FjfT8w0CN nbbr/YGnzLDeRZIdKqh6KbI7vnb49bLfjzkk6VTINlTEjrrooDj/juKpPq8rJNUb6U13 T3zj5hNZDwLgz3S+LQc/UHdafvZzTjYxpjZFxNRvyytBc2mx+XKRdRnpn0UY5IbqmLGh QbB+TF9XS3elgsDY7b1sH/PSBhc9m0TCyfDk2hBrpPZugHtCjwbBgc9JrjwZgNJ8DOfE j5oc/2jUK4B7dRz1XN1khLB5ciRMa6NYtVRwloG2GsMGYcDl+N0KApByfnviw/8QP13X RiHA== X-Gm-Message-State: AOAM533kcdVtibDVc3F8Yh3HSEevwCJwUxfjYFrEH7cDA5xGIEd3x8i7 7zRn2f6dSpx+YI1W5PGrzMQtVQ== X-Google-Smtp-Source: ABdhPJxWIJ5ysaq0U6xtUiPqFAzKyFZ1dwsPlcd06PakILavWh2loAFbXrXLsTBIY0LKdxgIA1tiYQ== X-Received: by 2002:a17:903:2cb:b0:14f:4fb6:2fb0 with SMTP id s11-20020a17090302cb00b0014f4fb62fb0mr22003917plk.172.1654490871310; Sun, 05 Jun 2022 21:47:51 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ced3:b110:401b:b32c]) by smtp.gmail.com with ESMTPSA id t190-20020a6381c7000000b003db7de758besm9718609pgd.5.2022.06.05.21.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:47:50 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu Cc: Hans de Goede , Thierry Reding , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Rob Clark , Stephen Boyd , Douglas Anderson , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback Date: Mon, 6 Jun 2022 12:47:19 +0800 Message-Id: <20220606044720.945964-8-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606044720.945964-1-hsinyi@chromium.org> References: <20220606044720.945964-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- v2->v3: add comments for notice. --- drivers/gpu/drm/panel/panel-elida-kd35t133.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm= /panel/panel-elida-kd35t133.c index 80227617a4d6..fa85a288afdc 100644 --- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c +++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c @@ -217,15 +217,29 @@ static int kd35t133_get_modes(struct drm_panel *panel, connector->display_info.width_mm =3D mode->width_mm; connector->display_info.height_mm =3D mode->height_mm; drm_mode_probed_add(connector, mode); + /* + * drm drivers are expected to call drm_panel_get_orientation() to get + * panel's orientation then drm_connector_set_panel_orientation() to + * set the property before drm_dev_register(). Otherwise there will be + * a WARN_ON if orientation is set after drm is registered. + */ drm_connector_set_panel_orientation(connector, ctx->orientation); =20 return 1; } =20 +static enum drm_panel_orientation kd35t133_get_orientation(struct drm_pane= l *panel) +{ + struct kd35t133 *ctx =3D panel_to_kd35t133(panel); + + return ctx->orientation; +} + static const struct drm_panel_funcs kd35t133_funcs =3D { .unprepare =3D kd35t133_unprepare, .prepare =3D kd35t133_prepare, .get_modes =3D kd35t133_get_modes, + .get_orientation =3D kd35t133_get_orientation, }; =20 static int kd35t133_probe(struct mipi_dsi_device *dsi) --=20 2.36.1.255.ge46751e96f-goog From nobody Sat Sep 21 23:29:55 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACAB4C433EF for ; Mon, 6 Jun 2022 05:06:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229569AbiFFFGj (ORCPT ); Mon, 6 Jun 2022 01:06:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbiFFFG2 (ORCPT ); Mon, 6 Jun 2022 01:06:28 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D6402F5AA8 for ; Sun, 5 Jun 2022 21:47:55 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id x4so3234075pfj.10 for ; Sun, 05 Jun 2022 21:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rFqpHuECGLqoarwvqRrQML/2d/T3XwkU1fNzjkmrThY=; b=nG1yyOS5j92wx36wFLjCQZuqCI8wBnye/wbubTHe2BewKZzQ9yMf1UIW4GqUrEowLO oNioyR4aXi/4ny+ODAKcr8PzVpr6DIY/BPv7GvZ70ptVaGPylbVMca7uastiacbDBQ4f ILJTMDta6UTJD0Pb6Sx2xdZNL3cnUMePfPSak= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rFqpHuECGLqoarwvqRrQML/2d/T3XwkU1fNzjkmrThY=; b=Ri9CKljUg1lXPre8ezObXawX2PZwp4EVmAbJTl6N8/9jJb6iDErnPQ/AZ8pXOKQuTR +ALvkEyHG7PY/UbpemtW+QuwAMpJYA8+sRo9nH4icnYFzn+kMN6hNRVBZPLVX6hloP0E cVYorwbNqB02uNT3aS1Z0VNy7P7IJoszqrO99X9gDe3KgK5FRLE7a5kGE7tZhJJfanfb lRtRD1PvilzTnU39shMsLfoZ9waQz17Tstis25i7DTFs/pTWQZWdorqOPJQkccDOS+gl 27/tz+Ryg3hDwdF9XlwTgxa7e0EQLOS8ojG0tRU+iQtb4q6FZvIK3qCMUDuGhCOkIQSq /S3A== X-Gm-Message-State: AOAM530jpUS5Cpn6hFdQI8tSNlSCHResseH2LdGG9AFRJpE7O090wZ/E aDkyAgqaP46MohmK/NeKOUb4Iw== X-Google-Smtp-Source: ABdhPJzMQinIyRVXtoVcfR4sTm2R3u3+0i2fuXPqOVvQzKi6bI2cScBSpS72MoNigiZHZpLbI2uKdA== X-Received: by 2002:a05:6a00:23c4:b0:51c:5e8:e8a9 with SMTP id g4-20020a056a0023c400b0051c05e8e8a9mr7064626pfc.62.1654490874687; Sun, 05 Jun 2022 21:47:54 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ced3:b110:401b:b32c]) by smtp.gmail.com with ESMTPSA id t190-20020a6381c7000000b003db7de758besm9718609pgd.5.2022.06.05.21.47.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:47:54 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu Cc: Hans de Goede , Thierry Reding , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Rob Clark , Stephen Boyd , Douglas Anderson , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 8/8] drm/mediatek: Config orientation property if panel provides it Date: Mon, 6 Jun 2022 12:47:20 +0800 Message-Id: <20220606044720.945964-9-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606044720.945964-1-hsinyi@chromium.org> References: <20220606044720.945964-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Panel orientation property should be set before drm_dev_register(). Mediatek drm driver calls drm_dev_register() in .bind(). However, most panels sets orientation property relatively late, mostly in .get_modes() callback, since this is when they are able to get the connector and binds the orientation property to it, though the value should be known when the panel is probed. Let the drm driver check if the remote end point is a panel and if it contains the orientation property. If it does, set it before drm_dev_register() is called. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: AngeloGioacchino Del Regno --- v2->v3: no change. --- drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index bd3f5b485085..86613360d2d9 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -185,6 +185,7 @@ struct mtk_dsi { struct drm_encoder encoder; struct drm_bridge bridge; struct drm_bridge *next_bridge; + struct drm_panel *panel; struct drm_connector *connector; struct phy *phy; =20 @@ -822,6 +823,12 @@ static int mtk_dsi_encoder_init(struct drm_device *drm= , struct mtk_dsi *dsi) ret =3D PTR_ERR(dsi->connector); goto err_cleanup_encoder; } + + /* Read panel orientation */ + if (dsi->panel) + drm_connector_set_panel_orientation(dsi->connector, + drm_panel_get_orientation(dsi->panel)); + drm_connector_attach_encoder(dsi->connector, &dsi->encoder); =20 return 0; @@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct devi= ce *master, void *data) struct drm_device *drm =3D data; struct mtk_dsi *dsi =3D dev_get_drvdata(dev); =20 + /* Get panel if existed */ + drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL); + ret =3D mtk_dsi_encoder_init(drm, dsi); if (ret) return ret; --=20 2.36.1.255.ge46751e96f-goog