From patchwork Thu Jun 9 07:27:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12874926 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1208FC43334 for ; Thu, 9 Jun 2022 07:27:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D596C10F7D7; Thu, 9 Jun 2022 07:27:41 +0000 (UTC) Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 648FC10F7D7 for ; Thu, 9 Jun 2022 07:27:40 +0000 (UTC) Received: by mail-pl1-x62f.google.com with SMTP id s14so19594240plk.8 for ; Thu, 09 Jun 2022 00:27:40 -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=bSY8PN7v8lUTRFzxoXQ+q0czheJOMexRG2Ekt+dl1cw=; b=STJ78LHWIq3C6SkgzJ/vmNYE8VNnAJLKUqWHPZRVIUmZBSKT92GoA4MlA2UUn+zELj Hecy+rWHtXRTwVJWiNpg4XrX00FawpR2IH3ajUFEBTJ39rvjrxyMYGCLADFePJ90Fxl+ vrYyOqQ1njaCv4FURyE3Kxlnv7lisKIFrKmC0= 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=bSY8PN7v8lUTRFzxoXQ+q0czheJOMexRG2Ekt+dl1cw=; b=jnx29CQgLiW2eWSJEus5lRP1w7V/sjiDs0eMjOiSa+8MacKM8OW3vN4+TdOPVCLiCf tq96uggAMhpUWiOzQ9NiGjidsUOi6jhyW414G+cpi8KkaPOZNKksIYpSjE7Leus+sbSx 8CIJ/AeaT+Fk4+tn+ilzVj2QiQpntxyreD0pFGmPZIv6tVHyfR19xd2bqduvWhyRKeKv +7zxT6olBOUHB3c+N0vTikpqEG8avoj62UvpQ8IlzIWOfpovk9QwKCiZkohjfnU6SlxJ Ptr+Y6ac26QOEhzyl7jF98ZyswxBDFEy3l3es9oFn3g13HaWrm6kewo2ako4hzaO9a7A hGVw== X-Gm-Message-State: AOAM533kBeqenhMST7NWsInniKhLHGKc3dwGKWYYOJJ71EjVefmYpr8t IoLgCffYncc7fxnUhD6cTzaHGA== X-Google-Smtp-Source: ABdhPJwo9bGpZq3j3Hg8vWR6yfq0caGSeW49YqnFYPqIpd3sh6CRePqPT5MMChG5397aZoHFHAVPCA== X-Received: by 2002:a17:902:8b89:b0:168:ab37:3283 with SMTP id ay9-20020a1709028b8900b00168ab373283mr1151222plb.101.1654759659616; Thu, 09 Jun 2022 00:27:39 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:5119:d95b:c6cd:77fb]) by smtp.gmail.com with ESMTPSA id p16-20020a1709027ed000b0016403cae7desm15312221plb.276.2022.06.09.00.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 00:27:39 -0700 (PDT) From: Hsin-Yi Wang To: Hans de Goede , Sam Ravnborg , Stephen Boyd , Douglas Anderson Subject: [PATCH v7 1/8] drm/panel: Add an API to allow drm to set orientation from panel Date: Thu, 9 Jun 2022 15:27:15 +0800 Message-Id: <20220609072722.3488207-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220609072722.3488207-1-hsinyi@chromium.org> References: <20220609072722.3488207-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Thomas Zimmermann , David Airlie , linux-kernel@vger.kernel.org, Rob Herring , Thierry Reding , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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_orientation_from_panel() before drm_dev_register(). Suggested-by: Hans de Goede Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson Reviewed-by: Stephen Boyd --- v6->v7: remane variable. --- drivers/gpu/drm/drm_connector.c | 31 +++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 4 ++++ include/drm/drm_panel.h | 9 +++++++++ 3 files changed, 44 insertions(+) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 1c48d162c77e3..ab066a063f3ba 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -2320,6 +2321,9 @@ EXPORT_SYMBOL(drm_connector_set_vrr_capable_property); * It is allowed to call this function with a panel_orientation of * DRM_MODE_PANEL_ORIENTATION_UNKNOWN, in which case it is a no-op. * + * The function shouldn't be called in panel after drm is registered (i.e. + * drm_dev_register() is called in drm). + * * Returns: * Zero on success, negative errno on failure. */ @@ -2389,6 +2393,33 @@ int drm_connector_set_panel_orientation_with_quirk( } EXPORT_SYMBOL(drm_connector_set_panel_orientation_with_quirk); +/** + * drm_connector_set_orientation_from_panel - + * set the connector's panel_orientation from panel's callback. + * @connector: connector for which to init the panel-orientation property. + * @panel: panel that can provide orientation information. + * + * Drm drivers should call this function before drm_dev_register(). + * Orientation is obtained from panel's .get_orientation() callback. + * + * Returns: + * Zero on success, negative errno on failure. + */ +int drm_connector_set_orientation_from_panel( + struct drm_connector *connector, + struct drm_panel *panel) +{ + enum drm_panel_orientation orientation; + + if (panel && panel->funcs && panel->funcs->get_orientation) + orientation = panel->funcs->get_orientation(panel); + else + orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; + + return drm_connector_set_panel_orientation(connector, orientation); +} +EXPORT_SYMBOL(drm_connector_set_orientation_from_panel); + static const struct drm_prop_enum_list privacy_screen_enum[] = { { PRIVACY_SCREEN_DISABLED, "Disabled" }, { PRIVACY_SCREEN_ENABLED, "Enabled" }, diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 3ac4bf87f2571..94b422b55cc1f 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -38,6 +38,7 @@ struct drm_modeset_acquire_ctx; struct drm_device; struct drm_crtc; struct drm_encoder; +struct drm_panel; struct drm_property; struct drm_property_blob; struct drm_printer; @@ -1802,6 +1803,9 @@ int drm_connector_set_panel_orientation_with_quirk( struct drm_connector *connector, enum drm_panel_orientation panel_orientation, int width, int height); +int drm_connector_set_orientation_from_panel( + struct drm_connector *connector, + struct drm_panel *panel); int drm_connector_attach_max_bpc_property(struct drm_connector *connector, int min, int max); void drm_connector_create_privacy_screen_properties(struct drm_connector *conn); diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index d279ee455f014..3a271128c0784 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -116,6 +116,15 @@ struct drm_panel_funcs { int (*get_modes)(struct drm_panel *panel, struct drm_connector *connector); + /** + * @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); + /** * @get_timings: * From patchwork Thu Jun 9 07:27:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12874927 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 244E0C43334 for ; Thu, 9 Jun 2022 07:27:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 912BC10F932; Thu, 9 Jun 2022 07:27:45 +0000 (UTC) Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by gabe.freedesktop.org (Postfix) with ESMTPS id 13D5B10F932 for ; Thu, 9 Jun 2022 07:27:44 +0000 (UTC) Received: by mail-pg1-x532.google.com with SMTP id 184so5133935pga.12 for ; Thu, 09 Jun 2022 00:27:44 -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=6cns58U7ETFcRJZ3rxmYxEFcjgwqUT9LK1/jcMIzzTI=; b=d5E1HKLGWGQ+MJC1zhqIlaMdVqsmrJIiSTzfeCCJ8GRtmrxDluI8Nr3EsxGpB97Ios Kr+asgLmD6JQ2jgDM5t0DTd/FRpUUoJo7U0ZIe+nMxZDSiXb5ewCvsLZMX/tOZhbUVGs glzUZY+7Ruud+lKjcMEk+WIHOm2Nd1Jvp7emc= 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=6cns58U7ETFcRJZ3rxmYxEFcjgwqUT9LK1/jcMIzzTI=; b=Nw+qtivCDfTH/H7BCMnWiX3ocqJU2zh8rzRih8yITV+sKhIvGXOOO8+cVFttjyhyuM e1fqhChutyQhVtvb8kCa2Gs1NwZiQfXbjpH9LNc56lFuqdv1Gei5s9E7l3qx7YBmnuwM LRamaPxFIR5IQybmHBiE8tta3yWwRvVM85bwrvscVg7W8SY1px6f/IwOoIeAM7aXaOH3 nYC4BGXepVe5fzgAENRkMndNv0FA8jBRMYfvwm/YpGezMrc9+Yw4jfPGEkhNbmTs6GyI TqoYvNOkoZylQvTXxpXjFZToa+ePFhJHIjfJtt74r48aFtO5gmNcjcrkgnkRbH/Slpl7 nqDg== X-Gm-Message-State: AOAM532vFEC5ZYZf0A+auTry0mQ1tYEdKc15dHAwZYPe5quRAdfK4EZT ipP8QMIp0gCoDWi/X9grOIfgIw== X-Google-Smtp-Source: ABdhPJxEW2aEZOOk3eVwTOVHc08TJtKl0jc1RGX7hhglR738NBHPdiIFVkzAMa8GiWT2HYaWCqw6DA== X-Received: by 2002:a63:483:0:b0:3fc:9128:60a5 with SMTP id 125-20020a630483000000b003fc912860a5mr34278819pge.606.1654759663639; Thu, 09 Jun 2022 00:27:43 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:5119:d95b:c6cd:77fb]) by smtp.gmail.com with ESMTPSA id p16-20020a1709027ed000b0016403cae7desm15312221plb.276.2022.06.09.00.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 00:27:43 -0700 (PDT) From: Hsin-Yi Wang To: Hans de Goede , Sam Ravnborg , Stephen Boyd , Douglas Anderson Subject: [PATCH v7 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback Date: Thu, 9 Jun 2022 15:27:16 +0800 Message-Id: <20220609072722.3488207-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220609072722.3488207-1-hsinyi@chromium.org> References: <20220609072722.3488207-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Thomas Zimmermann , David Airlie , linux-kernel@vger.kernel.org, Rob Herring , Thierry Reding , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson Reviewed-by: Stephen Boyd --- drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c index 1be150ac758f5..07f722f33fc5b 100644 --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c @@ -1511,16 +1511,28 @@ static int boe_panel_get_modes(struct drm_panel *panel, connector->display_info.width_mm = boe->desc->size.width_mm; connector->display_info.height_mm = boe->desc->size.height_mm; connector->display_info.bpc = boe->desc->bpc; + /* + * TODO: Remove once all drm drivers call + * drm_connector_set_orientation_from_panel() + */ drm_connector_set_panel_orientation(connector, boe->orientation); return 1; } +static enum drm_panel_orientation boe_panel_get_orientation(struct drm_panel *panel) +{ + struct boe_panel *boe = to_boe_panel(panel); + + return boe->orientation; +} + static const struct drm_panel_funcs boe_panel_funcs = { .unprepare = boe_panel_unprepare, .prepare = boe_panel_prepare, .enable = boe_panel_enable, .get_modes = boe_panel_get_modes, + .get_orientation = boe_panel_get_orientation, }; static int boe_panel_add(struct boe_panel *boe) From patchwork Thu Jun 9 07:27:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12874928 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03D2CC43334 for ; Thu, 9 Jun 2022 07:27:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C07B10F93C; Thu, 9 Jun 2022 07:27:49 +0000 (UTC) Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by gabe.freedesktop.org (Postfix) with ESMTPS id DE96510F93C for ; Thu, 9 Jun 2022 07:27:47 +0000 (UTC) Received: by mail-pg1-x52a.google.com with SMTP id e66so21059093pgc.8 for ; Thu, 09 Jun 2022 00:27:47 -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=/3gA/gCwNifa063k5zO2io8sIa7XPaHVQ/76HnmkOsg=; b=NMwQPNA8GcvOzDm4isJzui7YhPgnhg1xX3kh0UaVTH2jfU4mkwDoRC0quvFK4/QecR arfnWRpveJ0pUy0K4Zn7eItprSorYSdiUF0DxIYSzy+sPVzUfh/4UU+9GQWFSrnbBwol 4dws/dn+SgtfP55mhYaY5yVIN0hIRkMuNotpU= 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=/3gA/gCwNifa063k5zO2io8sIa7XPaHVQ/76HnmkOsg=; b=ol/Re7YKjJn3Mq3uVM6J6aSVna/uah28EzS55r3p8plkRk/dLvP7vTEko7ULmbjzUK dVaXok28RWCCT90/WFrkX9jrow8uSIXq/S28gWnkFRYotL6O46bir0mU6ivVYwbyFZp7 pZf51wgIw/sgz25nz8WUUiHJWWv5ClEoB7/A7/arlbakXFFZcCsrAp7rbj8ihCAAMSW6 71tOTvLAfE0JZ+wL2l+9zUIgLs9AXdegj6bBxPRwVB1TKRPAdZopyB1VLxtnh/2BzN/u Qli7ndjiuOO2sysibv5LpwEZI7gFmgiNF8div+wQ4ikwY62Xa1aXK2/LPJ8mi+hGg6LM iyZg== X-Gm-Message-State: AOAM533bD6mUXkIDxrKMT5jsQ/OnIB249RG4I1hFtmIh82MWrO9tbcJE wRlNaB1C2EuNJGPJcjjGfVC1sw== X-Google-Smtp-Source: ABdhPJxNBX/FBxOUBMeGOirfu/EQZDMrKKnPoYbe2fo82dpTd1VenDY+rtKnkXplac6gWM5VzUu+0Q== X-Received: by 2002:a05:6a00:15d3:b0:51c:1a20:f8d8 with SMTP id o19-20020a056a0015d300b0051c1a20f8d8mr19746114pfu.57.1654759667464; Thu, 09 Jun 2022 00:27:47 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:5119:d95b:c6cd:77fb]) by smtp.gmail.com with ESMTPSA id p16-20020a1709027ed000b0016403cae7desm15312221plb.276.2022.06.09.00.27.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 00:27:47 -0700 (PDT) From: Hsin-Yi Wang To: Hans de Goede , Sam Ravnborg , Stephen Boyd , Douglas Anderson Subject: [PATCH v7 3/8] drm/panel: panel-edp: Implement .get_orientation callback Date: Thu, 9 Jun 2022 15:27:17 +0800 Message-Id: <20220609072722.3488207-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220609072722.3488207-1-hsinyi@chromium.org> References: <20220609072722.3488207-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Thomas Zimmermann , David Airlie , linux-kernel@vger.kernel.org, Rob Herring , Thierry Reding , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson Reviewed-by: Stephen Boyd --- drivers/gpu/drm/panel/panel-edp.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index c96014464355c..ee622c1dd5322 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -586,7 +586,10 @@ static int panel_edp_get_modes(struct drm_panel *panel, else if (!num) dev_warn(p->base.dev, "No display modes\n"); - /* set up connector's "panel orientation" property */ + /* + * TODO: Remove once all drm drivers call + * drm_connector_set_orientation_from_panel() + */ drm_connector_set_panel_orientation(connector, p->orientation); return num; @@ -609,6 +612,13 @@ static int panel_edp_get_timings(struct drm_panel *panel, return p->desc->num_timings; } +static enum drm_panel_orientation panel_edp_get_orientation(struct drm_panel *panel) +{ + struct panel_edp *p = to_panel_edp(panel); + + return p->orientation; +} + static int detected_panel_show(struct seq_file *s, void *data) { struct drm_panel *panel = s->private; @@ -637,6 +647,7 @@ static const struct drm_panel_funcs panel_edp_funcs = { .prepare = panel_edp_prepare, .enable = panel_edp_enable, .get_modes = panel_edp_get_modes, + .get_orientation = panel_edp_get_orientation, .get_timings = panel_edp_get_timings, .debugfs_init = panel_edp_debugfs_init, }; From patchwork Thu Jun 9 07:27:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12874929 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E680EC433EF for ; Thu, 9 Jun 2022 07:27:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0695810F94C; Thu, 9 Jun 2022 07:27:53 +0000 (UTC) Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7EA6B10FA97 for ; Thu, 9 Jun 2022 07:27:51 +0000 (UTC) Received: by mail-pj1-x1031.google.com with SMTP id j7so20639320pjn.4 for ; Thu, 09 Jun 2022 00:27: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=979njmg3lDINGZi/hjk1WmVdoXok3WEPuAqEU9cZJ2k=; b=j9KpAI/b9qRseLDWsOBweqGi86kh7wYZQ3ofyFDfkDqIfZ+/HB8ErM8G4QPMbx/1K/ wrn500+3sYP2OfOeyGIlRevPsuSzxegJU4bDZ01Hl0kdJZqsMwrQoTkyshushfeQtZor gqU3O6bM87DjmVq4Kln8bX86DBr+n1dbNzoV4= 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=979njmg3lDINGZi/hjk1WmVdoXok3WEPuAqEU9cZJ2k=; b=sE9VpZ//1sRDqNqKiGzEI6sLJS/k2Ifyl1exKVo4U/MNtwM1h0bXifawf74I+fL0DH i3WXOuMAV8PY2e3KBhrjipkOtdR7dvW6vI5qGA7pxvU2kcz6oY3OE0zOdlbrEWpo22Z/ prGSPRysc+hjtFOO7tDq4XRyQQM8h2Bu5O3bgqvfAUtXoHqyWsWWcdHauZEAaqOn6Igx FUZ9szLfJjrNGmlzcpsyRYEvKQlpjYgDq19NKkqgwsTapdfjLdkU0/MgPqFjVw8fT4x2 BG9ALdj7EJuvZVbn8ywu5kBniBlkC3+7NJhQyIKZP37VMZdeY9DVpHiSPWp+XUBixUwq sOhw== X-Gm-Message-State: AOAM53335VRUALN+s4hyKlzFEpkm0u5KNU5OFpH1qZoZdYJ2bHKYZHw2 H0JB47oFlbRm2GqgwjYxp7lmoA== X-Google-Smtp-Source: ABdhPJzUtYiKc+YHbz9WSYk2PsW/dDB6EjjkY/X/5kiQ0m6h6L5dfv1hbOR67mOKxuCqT6BPA0oK+g== X-Received: by 2002:a17:90a:4e82:b0:1ea:3f61:51b with SMTP id o2-20020a17090a4e8200b001ea3f61051bmr2127811pjh.16.1654759671059; Thu, 09 Jun 2022 00:27:51 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:5119:d95b:c6cd:77fb]) by smtp.gmail.com with ESMTPSA id p16-20020a1709027ed000b0016403cae7desm15312221plb.276.2022.06.09.00.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 00:27:50 -0700 (PDT) From: Hsin-Yi Wang To: Hans de Goede , Sam Ravnborg , Stephen Boyd , Douglas Anderson Subject: [PATCH v7 4/8] drm/panel: lvds: Implement .get_orientation callback Date: Thu, 9 Jun 2022 15:27:18 +0800 Message-Id: <20220609072722.3488207-5-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220609072722.3488207-1-hsinyi@chromium.org> References: <20220609072722.3488207-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Thomas Zimmermann , David Airlie , linux-kernel@vger.kernel.org, Rob Herring , Thierry Reding , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson Reviewed-by: Stephen Boyd --- drivers/gpu/drm/panel/panel-lvds.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c index f11252fb00fea..7a4fedc63e8ec 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -99,15 +99,28 @@ static int panel_lvds_get_modes(struct drm_panel *panel, drm_display_info_set_bus_formats(&connector->display_info, &lvds->bus_format, 1); connector->display_info.bus_flags = lvds->bus_flags; + + /* + * TODO: Remove once all drm drivers call + * drm_connector_set_orientation_from_panel() + */ drm_connector_set_panel_orientation(connector, lvds->orientation); return 1; } +static enum drm_panel_orientation panel_lvds_get_orientation(struct drm_panel *panel) +{ + struct panel_lvds *lvds = to_panel_lvds(panel); + + return lvds->orientation; +} + static const struct drm_panel_funcs panel_lvds_funcs = { .unprepare = panel_lvds_unprepare, .prepare = panel_lvds_prepare, .get_modes = panel_lvds_get_modes, + .get_orientation = panel_lvds_get_orientation, }; static int panel_lvds_parse_dt(struct panel_lvds *lvds) From patchwork Thu Jun 9 07:27:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12874930 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B7E2C43334 for ; Thu, 9 Jun 2022 07:27:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2855B10FAF1; Thu, 9 Jun 2022 07:27:56 +0000 (UTC) Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 152CF10F960 for ; Thu, 9 Jun 2022 07:27:55 +0000 (UTC) Received: by mail-pf1-x42d.google.com with SMTP id y196so20361738pfb.6 for ; Thu, 09 Jun 2022 00:27: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=wQhOn/YiixyOJw4v/o8WRfr7u50AUleNhUdb032jkoc=; b=L7jS/0Ul8GyfGFjRHSjlC/3V1YgWm5fckAx4cb0ozB4CuNwCbDePiYLy99VKkO4eYR vsIEwXCARojXs6cMBuEgOpj5milTERUvgpkWcuL7Sfsn8AInOOdQvfSoVcc334NhuGZ4 7TUKV91TAvpAbsMABW8YLDZN6I2yI6bugPIPI= 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=wQhOn/YiixyOJw4v/o8WRfr7u50AUleNhUdb032jkoc=; b=v/IA3shppwk0NcGGSVzZF8B5cBJ0Yag7HmCwJLjyMYR9Db/fdz0vQ3biI/Nmq78yab 55jhrYFInjd1lclOfzR4B+/KFqQjshcQ51jbYUTLdsQbraRsIrK/tlzXEG1qUIJu71TJ mKt5R/kLcmxrwxaZxCCR835WlhyW8H7EMTwdsCl9fCdXZ8QoUT+ofFQiSDwWZhJxwH11 hVA3MC9dTI9iWp/umEaKdp9r60aGr0ueVCJZ8v8CKzKjHQeI8NoZaMSlfXS8rF7ZzAww pKTx/b7VrYJRyk/T7JU5DU6m6ma/2G6kWobAnBiAKz449sZmkYVxgyfrF+lfLXOtkt1I dapw== X-Gm-Message-State: AOAM531TsjaRVK1BoX2Hv+bbk1YHrhD++WdrIsMzu4ctTG+UhU5DzGWK P+aHlWy77DFquqr6ZDQ6XTI2PQ== X-Google-Smtp-Source: ABdhPJwaokvXUJTqJoAx08HJzYQQnKmSiU3Qu9ykQ3bFrg5pAH7mwkib4XyJbC+tUSapAx+aGXawRQ== X-Received: by 2002:a05:6a00:1805:b0:51c:3a7:54dc with SMTP id y5-20020a056a00180500b0051c03a754dcmr23846453pfa.15.1654759674657; Thu, 09 Jun 2022 00:27:54 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:5119:d95b:c6cd:77fb]) by smtp.gmail.com with ESMTPSA id p16-20020a1709027ed000b0016403cae7desm15312221plb.276.2022.06.09.00.27.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 00:27:54 -0700 (PDT) From: Hsin-Yi Wang To: Hans de Goede , Sam Ravnborg , Stephen Boyd , Douglas Anderson Subject: [PATCH v7 5/8] drm/panel: panel-simple: Implement .get_orientation callback Date: Thu, 9 Jun 2022 15:27:19 +0800 Message-Id: <20220609072722.3488207-6-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220609072722.3488207-1-hsinyi@chromium.org> References: <20220609072722.3488207-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Thomas Zimmermann , David Airlie , linux-kernel@vger.kernel.org, Rob Herring , Thierry Reding , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson Reviewed-by: Sam Ravnborg Reviewed-by: Stephen Boyd --- drivers/gpu/drm/panel/panel-simple.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 4a2e580a2f7b7..b4b9195251891 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -411,7 +411,10 @@ static int panel_simple_get_modes(struct drm_panel *panel, /* add hard-coded panel modes */ num += panel_simple_get_non_edid_modes(p, connector); - /* set up connector's "panel orientation" property */ + /* + * TODO: Remove once all drm drivers call + * drm_connector_set_orientation_from_panel() + */ drm_connector_set_panel_orientation(connector, p->orientation); return num; @@ -434,12 +437,21 @@ static int panel_simple_get_timings(struct drm_panel *panel, return p->desc->num_timings; } +static enum drm_panel_orientation panel_simple_get_orientation(struct drm_panel *panel) +{ + struct panel_simple *p = to_panel_simple(panel); + + return p->orientation; +} + + static const struct drm_panel_funcs panel_simple_funcs = { .disable = panel_simple_disable, .unprepare = panel_simple_unprepare, .prepare = panel_simple_prepare, .enable = panel_simple_enable, .get_modes = panel_simple_get_modes, + .get_orientation = panel_simple_get_orientation, .get_timings = panel_simple_get_timings, }; From patchwork Thu Jun 9 07:27:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12874931 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2025C43334 for ; Thu, 9 Jun 2022 07:28:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C73810FA97; Thu, 9 Jun 2022 07:28:00 +0000 (UTC) Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by gabe.freedesktop.org (Postfix) with ESMTPS id C113810FDE7 for ; Thu, 9 Jun 2022 07:27:58 +0000 (UTC) Received: by mail-pj1-x102a.google.com with SMTP id gc3-20020a17090b310300b001e33092c737so20326796pjb.3 for ; Thu, 09 Jun 2022 00:27:58 -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=K7MRkR8auhgUPzxY/AhWyDzJkPMHJW4gIp7+t1KlPCE=; b=l7ZtrVUBq2GYXh2+SH235Ub+vP7lWLaHmSegb5FpWeD2UBMVxBbbSg+yfXe8Ha0sHa sRrJmsQrI/ZCdxQ+/mkSj46cerzBPD3JKq3Y5+z0BBzUgbEQ/2VS82VzI3LUsJM4QZbp QiY5PgrIjbT2MZf10Yl5LRotp6JHblUn1MP+c= 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=K7MRkR8auhgUPzxY/AhWyDzJkPMHJW4gIp7+t1KlPCE=; b=OTfSv1+aODg6qotkJsKrtHzuA7q9Ktke3T34UmyL6iRP0elehpPAaW33RkGltTTlHc uKfrT3KqPhS+bWD44oiqQkWgS08mZlKSJE2+M4phT/pjkxnrJSevPLFfWnSowtXaIROl l21VcK7u2uhJxSm5srQi+YPrsjEMjviLKrdJTvudHsEVBAgkfCu+D1hJRHRZYeILxQ5M PU0OZ29N/sRDocxaNfKL1OvIczCkBz/gEtzz9xuaaeb2A5v1jDI6a5OXT5VGqe/lbRN8 JjSGB/TY/DKW5/xX1wVJjDjvox7AsCVAvHSP0VmIqRLxKpCYXUWWwHNrfIk4cIY7p3fh O40A== X-Gm-Message-State: AOAM5317lmF9b1VFGxd6wOYUnH2PbDYDw0dPRfIGBL3ZVWTm/hAM9bFe 8evPF/o7AKVJ9mZmztP6SC8+wg== X-Google-Smtp-Source: ABdhPJz4dqkjFokdBYRKpv24v7t0WqPiApCHL3ML7AXlrOqT/NAZMvUv0SYaTx3mNhk2+YTvTonvkA== X-Received: by 2002:a17:902:74c3:b0:167:6811:40 with SMTP id f3-20020a17090274c300b0016768110040mr25200983plt.120.1654759678228; Thu, 09 Jun 2022 00:27:58 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:5119:d95b:c6cd:77fb]) by smtp.gmail.com with ESMTPSA id p16-20020a1709027ed000b0016403cae7desm15312221plb.276.2022.06.09.00.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 00:27:57 -0700 (PDT) From: Hsin-Yi Wang To: Hans de Goede , Sam Ravnborg , Stephen Boyd , Douglas Anderson Subject: [PATCH v7 6/8] drm/panel: ili9881c: Implement .get_orientation callback Date: Thu, 9 Jun 2022 15:27:20 +0800 Message-Id: <20220609072722.3488207-7-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220609072722.3488207-1-hsinyi@chromium.org> References: <20220609072722.3488207-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Thomas Zimmermann , David Airlie , linux-kernel@vger.kernel.org, Rob Herring , Thierry Reding , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson Reviewed-by: Stephen Boyd --- drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c index ba30d11547ade..58d6798c25ed8 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c @@ -853,17 +853,29 @@ static int ili9881c_get_modes(struct drm_panel *panel, connector->display_info.width_mm = mode->width_mm; connector->display_info.height_mm = mode->height_mm; + /* + * TODO: Remove once all drm drivers call + * drm_connector_set_orientation_from_panel() + */ drm_connector_set_panel_orientation(connector, ctx->orientation); return 1; } +static enum drm_panel_orientation ili9881c_get_orientation(struct drm_panel *panel) +{ + struct ili9881c *ctx = panel_to_ili9881c(panel); + + return ctx->orientation; +} + static const struct drm_panel_funcs ili9881c_funcs = { .prepare = ili9881c_prepare, .unprepare = ili9881c_unprepare, .enable = ili9881c_enable, .disable = ili9881c_disable, .get_modes = ili9881c_get_modes, + .get_orientation = ili9881c_get_orientation, }; static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi) From patchwork Thu Jun 9 07:27:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12874932 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F278DC43334 for ; Thu, 9 Jun 2022 07:28:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4650010FE54; Thu, 9 Jun 2022 07:28:03 +0000 (UTC) Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by gabe.freedesktop.org (Postfix) with ESMTPS id A4BE810FE54 for ; Thu, 9 Jun 2022 07:28:02 +0000 (UTC) Received: by mail-pf1-x434.google.com with SMTP id e11so20359471pfj.5 for ; Thu, 09 Jun 2022 00:28:02 -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=G916ndi6znAFvnEdjgirXsQTXINNxUlsFrUsl3kkHpM=; b=Ab/Ic+N3PYzvVY9rC4wLHn0KuEQnNGOKYgz5k7NDX1sDl+NPwdPDWR2BTqZJmMuyl7 pJCNL0LMj1LMqRy0fVBiGW/q7oiDb1RPX14nYbfqbrOyJwmIWOPP49WI3ESH+OQb3CwZ BdcdiPGm/oVRjmwfOeH/hiY03hlkzKvGPKMWo= 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=G916ndi6znAFvnEdjgirXsQTXINNxUlsFrUsl3kkHpM=; b=cyScrl1QNMrZZg/MI9eK3BYDb1MjNfjVr6DmLJrIz3wj7+yjKWJQIZk51CMhAOIyeZ d8UNLRclc8oPPWa0ES0K8q8kXM7C2HB2x40KLF/lr7FNP3vrYt2NFM3y4Gm/v2JA50p4 6kDLe8n2qehs/ucan8xmQaihHO/8fH7NuoOYaa/jSv2PL8J641WJNAyPGH37a6gihmt8 wYXDO44uKngi9I+heb6acVHg1q0DYNMBESb+zeIVD9TSAdeLkmcOGlF9Z7SsmUhPl+Uk f8sfhCNj5tbEjxMM4/9156FuClPaoYzmIm/XAjLqTRi4JyAC8Gv3xG6UMD0FK1XhiVPF sNDw== X-Gm-Message-State: AOAM5334N2v1GZQt9XcOGwAQCf2uG5wsmOEXjHvrUe0zItzbnRByC5gR Mx6ysu+1jQxNtPhOE83P1L61LQ== X-Google-Smtp-Source: ABdhPJye6fPlx4aQdZZkt+w0q0qfXmG0AQ+D0AlqoMudVOh6zefu4Y7cFZKkoiaVOrEQnuzP7CFd/g== X-Received: by 2002:a63:2cd7:0:b0:3fe:1c0a:75ce with SMTP id s206-20020a632cd7000000b003fe1c0a75cemr9121819pgs.602.1654759681962; Thu, 09 Jun 2022 00:28:01 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:5119:d95b:c6cd:77fb]) by smtp.gmail.com with ESMTPSA id p16-20020a1709027ed000b0016403cae7desm15312221plb.276.2022.06.09.00.27.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 00:28:01 -0700 (PDT) From: Hsin-Yi Wang To: Hans de Goede , Sam Ravnborg , Stephen Boyd , Douglas Anderson Subject: [PATCH v7 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback Date: Thu, 9 Jun 2022 15:27:21 +0800 Message-Id: <20220609072722.3488207-8-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220609072722.3488207-1-hsinyi@chromium.org> References: <20220609072722.3488207-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Thomas Zimmermann , David Airlie , linux-kernel@vger.kernel.org, Rob Herring , Thierry Reding , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson Reviewed-by: Stephen Boyd --- drivers/gpu/drm/panel/panel-elida-kd35t133.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c index 80227617a4d6e..fa613d1d7a8ff 100644 --- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c +++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c @@ -217,15 +217,27 @@ static int kd35t133_get_modes(struct drm_panel *panel, connector->display_info.width_mm = mode->width_mm; connector->display_info.height_mm = mode->height_mm; drm_mode_probed_add(connector, mode); + /* + * TODO: Remove once all drm drivers call + * drm_connector_set_orientation_from_panel() + */ drm_connector_set_panel_orientation(connector, ctx->orientation); return 1; } +static enum drm_panel_orientation kd35t133_get_orientation(struct drm_panel *panel) +{ + struct kd35t133 *ctx = panel_to_kd35t133(panel); + + return ctx->orientation; +} + static const struct drm_panel_funcs kd35t133_funcs = { .unprepare = kd35t133_unprepare, .prepare = kd35t133_prepare, .get_modes = kd35t133_get_modes, + .get_orientation = kd35t133_get_orientation, }; static int kd35t133_probe(struct mipi_dsi_device *dsi) From patchwork Thu Jun 9 07:27:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12874933 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 73C96C43334 for ; Thu, 9 Jun 2022 07:28:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B09B910FFEF; Thu, 9 Jun 2022 07:28:12 +0000 (UTC) Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 90D0D10FFEF for ; Thu, 9 Jun 2022 07:28:11 +0000 (UTC) Received: by mail-pl1-x62b.google.com with SMTP id f9so9138367plg.0 for ; Thu, 09 Jun 2022 00:28:11 -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=EU3KV+nUfeIhuNF/Ro7jf0eLAkt330a3bAydA7XSi+w=; b=VqbUTr3H73qk7OZZz/TA+W+HpQdKZ3GSi8c1Gz+F66d9XD1DhQZtcZj9tYoGnBFCMH 9jxzZQrJD2AuqpJhiITLGgJFsgqcH4cZdZ4DMvOA/HAXrFenxq9XEcffHdqI51W5b0+R vgKEqD5AT7EuudEvdhCxmhMR6bB4DJJnlMh60= 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=EU3KV+nUfeIhuNF/Ro7jf0eLAkt330a3bAydA7XSi+w=; b=XikF1mz1MDOH3F36XPYyoHkt688qn4722/Fur4kjVfSDvltvgt25gVGkp86Icg1Gt2 deY3UoobZUN1X/sHTL3YTZyGYel4wCTb4tRjJxZe+ouhnzLTuVIzrg7hAtWUrQ2XoF3Y gXE0I+nGGBUb5UTWbV36klNk9Cn1u00tFBnHnwu80Byl9luJLttzZ8XkuYdTu+ymxryV omvH0QDRN6qNaUz26us3aJv+q5jQysrhcbPSkDvYnZr3EgdLO+oXYmuVetvcGXFy2kbu UD+KxpOjs7AxNPDMxcvfXiaaJoHvVR5bysalvRd06TxA8H9cUi31K6zPaYa+0ia2mXMZ xsIw== X-Gm-Message-State: AOAM532IEkLd/rylavznBaAs9Lgi6GoGC5v89TeAgcLbPLX5FiHJgWBa WMPYPWBEKdfP48/zsuhfhFh+5Q== X-Google-Smtp-Source: ABdhPJx0y6DchLUvvk/yuIYEnoMtoscHMuzTnupHjzPr0+cwAebGuaRDhnVQTQoMdt/AcKvuivAq0Q== X-Received: by 2002:a17:903:24f:b0:15c:e3b8:a640 with SMTP id j15-20020a170903024f00b0015ce3b8a640mr38088332plh.5.1654759691087; Thu, 09 Jun 2022 00:28:11 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:5119:d95b:c6cd:77fb]) by smtp.gmail.com with ESMTPSA id p16-20020a1709027ed000b0016403cae7desm15312221plb.276.2022.06.09.00.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 00:28:10 -0700 (PDT) From: Hsin-Yi Wang To: Hans de Goede , Sam Ravnborg , Stephen Boyd , Douglas Anderson Subject: [PATCH v7 8/8] drm: Config orientation property if panel provides it Date: Thu, 9 Jun 2022 15:27:23 +0800 Message-Id: <20220609072722.3488207-9-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220609072722.3488207-1-hsinyi@chromium.org> References: <20220609072722.3488207-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Thomas Zimmermann , David Airlie , linux-kernel@vger.kernel.org, Rob Herring , Thierry Reding , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Panel orientation property should be set before drm_dev_register(). Some 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. In drm_bridge_connector_init(), if a bridge is a panel bridge, use it to set the connector's panel orientation property. Suggested-by: Doug Anderson Signed-off-by: Hsin-Yi Wang Reviewed-by: Doug Anderson Reviewed-by: Stephen Boyd --- v6->v7: remove redundant check and fix config issue. --- drivers/gpu/drm/bridge/panel.c | 34 ++++++++++++++++++++++++++ drivers/gpu/drm/drm_bridge_connector.c | 8 +++++- include/drm/drm_bridge.h | 14 +++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index 0ee563eb2b6f9..4277bf4f032be 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -170,6 +170,19 @@ static const struct drm_bridge_funcs panel_bridge_bridge_funcs = { .debugfs_init = panel_bridge_debugfs_init, }; +/** + * drm_bridge_is_panel - Checks if a drm_bridge is a panel_bridge. + * + * @bridge: The drm_bridge to be checked. + * + * Returns true if the bridge is a panel bridge, or false otherwise. + */ +bool drm_bridge_is_panel(const struct drm_bridge *bridge) +{ + return bridge->funcs == &panel_bridge_bridge_funcs; +} +EXPORT_SYMBOL(drm_bridge_is_panel); + /** * drm_panel_bridge_add - Creates a &drm_bridge and &drm_connector that * just calls the appropriate functions from &drm_panel. @@ -269,6 +282,27 @@ void drm_panel_bridge_remove(struct drm_bridge *bridge) } EXPORT_SYMBOL(drm_panel_bridge_remove); +/** + * drm_panel_bridge_set_orientation - Set the connector's panel orientation + * from the bridge that can be transformed to panel bridge. + * + * @connector: The connector to be set panel orientation. + * @bridge: The drm_bridge to be transformed to panel bridge. + * + * Returns 0 on success, negative errno on failure. + */ +int drm_panel_bridge_set_orientation(struct drm_connector *connector, + struct drm_bridge *bridge) +{ + struct panel_bridge *panel_bridge; + + panel_bridge = drm_bridge_to_panel_bridge(bridge); + + return drm_connector_set_orientation_from_panel(connector, + panel_bridge->panel); +} +EXPORT_SYMBOL(drm_panel_bridge_set_orientation); + static void devm_drm_panel_bridge_release(struct device *dev, void *res) { struct drm_bridge **bridge = res; diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c index 6b3dad03d77d0..1c7d936523df5 100644 --- a/drivers/gpu/drm/drm_bridge_connector.c +++ b/drivers/gpu/drm/drm_bridge_connector.c @@ -331,7 +331,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, struct drm_bridge_connector *bridge_connector; struct drm_connector *connector; struct i2c_adapter *ddc = NULL; - struct drm_bridge *bridge; + struct drm_bridge *bridge, *panel_bridge = NULL; int connector_type; bridge_connector = kzalloc(sizeof(*bridge_connector), GFP_KERNEL); @@ -373,6 +373,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, if (bridge->ddc) ddc = bridge->ddc; + + if (drm_bridge_is_panel(bridge)) + panel_bridge = bridge; } if (connector_type == DRM_MODE_CONNECTOR_Unknown) { @@ -392,6 +395,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; + if (panel_bridge) + drm_panel_bridge_set_orientation(connector, panel_bridge); + return connector; } EXPORT_SYMBOL_GPL(drm_bridge_connector_init); diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index f27b4060faa2f..bd11bbe5e9b33 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -917,16 +917,30 @@ void drm_bridge_hpd_notify(struct drm_bridge *bridge, enum drm_connector_status status); #ifdef CONFIG_DRM_PANEL_BRIDGE +bool drm_bridge_is_panel(const struct drm_bridge *bridge); struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel); struct drm_bridge *drm_panel_bridge_add_typed(struct drm_panel *panel, u32 connector_type); void drm_panel_bridge_remove(struct drm_bridge *bridge); +int drm_panel_bridge_set_orientation(struct drm_connector *connector, + struct drm_bridge *bridge); struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev, struct drm_panel *panel); struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev, struct drm_panel *panel, u32 connector_type); struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge); +#else +static inline bool drm_bridge_is_panel(const struct drm_bridge *bridge) +{ + return false; +} + +static inline int drm_panel_bridge_set_orientation(struct drm_connector *connector, + struct drm_bridge *bridge) +{ + return -EINVAL; +} #endif #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL_BRIDGE)