From patchwork Wed Jun 17 23:18:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11611533 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54E2A14B7 for ; Thu, 18 Jun 2020 07:18:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 341CD21532 for ; Thu, 18 Jun 2020 07:18:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DhL6Q+i9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 341CD21532 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A55446EAC5; Thu, 18 Jun 2020 07:17:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id 93E5A6E21A for ; Wed, 17 Jun 2020 23:20:16 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id t74so2363034lff.2 for ; Wed, 17 Jun 2020 16:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9RXXDREzEvi9GJkz9Ew+kxIBw0+JCmn+dwyV4+Iogjo=; b=DhL6Q+i9H1kTLhsx/jJL8lSuJaElavKhd6ST9db/CbXsuk6jwmsjgZ8MTjd/YRdQHS SKta33F1AQVLw5b9TN66Y9hcba3AGfeV5ZPKOXhDqYXwex8bqtnbbZAxdzpaAXhILZed /Kn9oJ+sFyuvJ7UvBz3MVt0FUOMGPIrziDbxhLup6Iy+p+04IZesaJaUqbeg/wDVdh2G a8xPi+4E/rnOwFs85KQz2nlZzNckhUdRF0nnb4pT9rd8pQGWce1WsmD4fOcoBq+DAb7q YmtirL6GsWZu5GJ9fTuAhTIKqBX9atSzwRZmGZe5QRKEI7Tdy9quNl7rTkBvhNx/72Oa jXeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9RXXDREzEvi9GJkz9Ew+kxIBw0+JCmn+dwyV4+Iogjo=; b=UwiHApbfLWSMrVrzx4GdwmUw9Reo6g5FtZ6InehyQSoZrvlcZ+AIfESBa/EXnvP8Gn j0V2rN/VZaH9JTpcOx96SUcbosRmQK2JS2x1B9sf20jalGu/Q3rZxMgRU+8CA+FyIbPO RtzHa+lsSNPGgthDpf8oAbBgrucDf0Ho45cpcqwCZT3ppvXSctP9v6ljLXZ+KekD60DI 09TBF06XJAMiON2EY3D1ppdgV7zmtg1t7GQfD8XA658uC0g1h7dnyZRIpEK5o1v8EvGo hMIOpi6y+t0LP52aQMaR88L0NZ0uYIg9/98bmxmshrQzmUdJf2Vu2pd02lcxUjtlUdSw mM1Q== X-Gm-Message-State: AOAM533a8olvWS7n6EU0Rrk89JW4S4CykqMub3Zu11h5fxvA2oOZrQf1 U1uubYV7i4BpsT186s9e/a/8xydW X-Google-Smtp-Source: ABdhPJwZXIhog4dfoVtf01rQeNtS3EPm83m3tQ88S1ioAOIyLA+qbTylfDrp24rpcDGN50czElcYXQ== X-Received: by 2002:a19:c797:: with SMTP id x145mr680536lff.143.1592436014944; Wed, 17 Jun 2020 16:20:14 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id x3sm235100ljc.82.2020.06.17.16.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 16:20:14 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul , Daniel Vetter , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Emil Velikov , Daniel Stone Subject: [PATCH v11 1/4] drm/panel: Add helper for reading DT rotation Date: Thu, 18 Jun 2020 02:18:39 +0300 Message-Id: <20200617231842.30671-2-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200617231842.30671-1-digetx@gmail.com> References: <20200617231842.30671-1-digetx@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 18 Jun 2020 07:17:31 +0000 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: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Derek Basehore This adds a helper function for reading the rotation (panel orientation) from the device tree. Signed-off-by: Derek Basehore Reviewed-by: Sam Ravnborg Tested-by: Dmitry Osipenko --- drivers/gpu/drm/drm_panel.c | 43 +++++++++++++++++++++++++++++++++++++ include/drm/drm_panel.h | 9 ++++++++ 2 files changed, 52 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 8c7bac85a793..5557c75301f1 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -300,6 +300,49 @@ struct drm_panel *of_drm_find_panel(const struct device_node *np) return ERR_PTR(-EPROBE_DEFER); } EXPORT_SYMBOL(of_drm_find_panel); + +/** + * of_drm_get_panel_orientation - look up the orientation of the panel through + * the "rotation" binding from a device tree node + * @np: device tree node of the panel + * @orientation: orientation enum to be filled in + * + * Looks up the rotation of a panel in the device tree. The orientation of the + * panel is expressed as a property name "rotation" in the device tree. The + * rotation in the device tree is counter clockwise. + * + * Return: 0 when a valid rotation value (0, 90, 180, or 270) is read or the + * rotation property doesn't exist. -EERROR otherwise. + */ +int of_drm_get_panel_orientation(const struct device_node *np, + enum drm_panel_orientation *orientation) +{ + int rotation, ret; + + ret = of_property_read_u32(np, "rotation", &rotation); + if (ret == -EINVAL) { + /* Don't return an error if there's no rotation property. */ + *orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; + return 0; + } + + if (ret < 0) + return ret; + + if (rotation == 0) + *orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; + else if (rotation == 90) + *orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; + else if (rotation == 180) + *orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; + else if (rotation == 270) + *orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP; + else + return -EINVAL; + + return 0; +} +EXPORT_SYMBOL(of_drm_get_panel_orientation); #endif #if IS_REACHABLE(CONFIG_BACKLIGHT_CLASS_DEVICE) diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 6193cb555acc..781c735f0f9b 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -35,6 +35,8 @@ struct drm_device; struct drm_panel; struct display_timing; +enum drm_panel_orientation; + /** * struct drm_panel_funcs - perform operations on a given panel * @@ -191,11 +193,18 @@ int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL) struct drm_panel *of_drm_find_panel(const struct device_node *np); +int of_drm_get_panel_orientation(const struct device_node *np, + enum drm_panel_orientation *orientation); #else static inline struct drm_panel *of_drm_find_panel(const struct device_node *np) { return ERR_PTR(-ENODEV); } +static inline int of_drm_get_panel_orientation(const struct device_node *np, + enum drm_panel_orientation *orientation) +{ + return -ENODEV; +} #endif #if IS_ENABLED(CONFIG_DRM_PANEL) && (IS_BUILTIN(CONFIG_BACKLIGHT_CLASS_DEVICE) || \ From patchwork Wed Jun 17 23:18:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11611547 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6493C618 for ; Thu, 18 Jun 2020 07:18:28 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 438A021532 for ; Thu, 18 Jun 2020 07:18:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FoJaxzrF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 438A021532 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2EF716EB1D; Thu, 18 Jun 2020 07:17:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by gabe.freedesktop.org (Postfix) with ESMTPS id 851B76E21A for ; Wed, 17 Jun 2020 23:20:17 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id i8so2360195lfo.4 for ; Wed, 17 Jun 2020 16:20:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8a80cd6rsqQPYsCUSUM1tVHpjysV4lBd8Pl7EvdCM6E=; b=FoJaxzrFflE6LaxOfQk0IXXpNw1TcB02BfpukudUJvvz0sjvCgMY8OmLJaKiwz6XDx C/gDE3IRJKA2HqRaebAbdKt3EM4L0NCotHTWYsjSM/Mo+wvbvRSzwV0vKZdqaEs8YHHw Q4yN2ni8w97tvCST897K2FmpQWGITAxaGsNkGnZQ7dP/MXpaR1zkfQgG7yVdgXBq1hvS 4tNNMXJAeC5nwzeVdBpl+XLE3E9umAlbP515ioqawoagpNJMgNrwWNiUMTOaqpJQI95M eweugxKOUmR8JXv6E2amCZgwBBDFAaS/mlBa79sH6in53tIFz2lVaVJEMD1AGdg95Jy+ RPoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8a80cd6rsqQPYsCUSUM1tVHpjysV4lBd8Pl7EvdCM6E=; b=A5572o7/xvIrvI806NvWXJjFDr4unsMTVjldTaT4yV0LE6R5Ov/DW04Cyz7CJdtS/R FhJaMIqKzirLWOaJzyY/msfnesd6OS13P38eKcX4ZTPidT4VR81tFYiAPW3tBw5gJU9L fIaPTHCOJol0XnWvaz8rZjfrDF+9UFo14cuQD6PP1r92OyV3lCOxtCcE1WBxJ0q1ffDc JFkLCcf1CdV76p8CXHsI0Ve56ABO4IWHH3Tri8YePv9udMHbcWnXSY9+gAfzrwz59mAY P0kY04QqGVUqPSBeFFRpY/3IJYoBYC4e8aaIZKV7z9YBWqlH+COmI5+2xOJGorcGiNPj 8ydg== X-Gm-Message-State: AOAM5331SWRi2cqBq2fhc6mc7Xe1rjBixDgfBp8QH20e66qExCIR2+dI si+E40LDvFMBiTGTQKiD3Cc= X-Google-Smtp-Source: ABdhPJyQaSu56OgPGPclXqeIRJpQaUDkKkpFcF+C8Dt6uF1baj+c8borYAv8N0iz6g9JAlKh/k/ULw== X-Received: by 2002:ac2:560f:: with SMTP id v15mr704327lfd.160.1592436015981; Wed, 17 Jun 2020 16:20:15 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id x3sm235100ljc.82.2020.06.17.16.20.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 16:20:15 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul , Daniel Vetter , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Emil Velikov , Daniel Stone Subject: [PATCH v11 2/4] drm/panel: Read panel orientation for BOE TV101WUM-NL6 Date: Thu, 18 Jun 2020 02:18:40 +0300 Message-Id: <20200617231842.30671-3-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200617231842.30671-1-digetx@gmail.com> References: <20200617231842.30671-1-digetx@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 18 Jun 2020 07:17:31 +0000 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: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Derek Basehore This reads the DT setting for the panel rotation to set the panel orientation in the get_modes callback. Reviewed-by: Dmitry Osipenko Signed-off-by: Derek Basehore --- drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c index db5b866357f2..4bd9397972e8 100644 --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -43,6 +44,7 @@ struct boe_panel { const struct panel_desc *desc; + enum drm_panel_orientation orientation; struct regulator *pp1800; struct regulator *avee; struct regulator *avdd; @@ -740,6 +742,7 @@ 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; + drm_connector_set_panel_orientation(connector, boe->orientation); return 1; } @@ -779,6 +782,9 @@ static int boe_panel_add(struct boe_panel *boe) drm_panel_init(&boe->base, dev, &boe_panel_funcs, DRM_MODE_CONNECTOR_DSI); + err = of_drm_get_panel_orientation(dev->of_node, &boe->orientation); + if (err < 0) + return err; err = drm_panel_of_backlight(&boe->base); if (err) From patchwork Wed Jun 17 23:18:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11611523 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C1FDC618 for ; Thu, 18 Jun 2020 07:17:59 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A13AD21532 for ; Thu, 18 Jun 2020 07:17:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YWp4V8jl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A13AD21532 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C7CDA6EA8A; Thu, 18 Jun 2020 07:17:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F0A36E7EF for ; Wed, 17 Jun 2020 23:20:18 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id 9so4964408ljc.8 for ; Wed, 17 Jun 2020 16:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cpCBAuxLIibpWTrEfnZ4pOnO24Bo4VASqlc3TYxbEqA=; b=YWp4V8jl4qNCfkH09ImPEg/X26d+XB7NXB0OmvxCehmOoqyI+rVejTY8WifV7InUUq QkgGFYEemD4osjkVU1bByc0u2A+3nUiZzY0JNph9iVtYoY92hpcAPVVJpVGXckxJ5oPa 1W9A4T6fctWq1rjEuBd53ew0n9zGPf2uWnkIvRWu1SWd7+Afck1GfhPsJJCXLqDL9Pqs m+DJ1EqPiZvF8bD7mvze+DNK9Kgi4kUfzCYY7YQ10cIAbie5wFyzDd/ptBRaXpXcVgxU uLEIU7TqsCNKYdLJapIfLKge5eh3KX80nQ5oJ/Jen/YM0INukDi8k9KV7F+R3AtVHcqS glzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cpCBAuxLIibpWTrEfnZ4pOnO24Bo4VASqlc3TYxbEqA=; b=jLNifG78SZQ2DfdCF3QFVszr5eH0szQPxZJRh2+0h+jiRtGf4kgX7hbyiH8zcNVAlg 9lV0fPvoXxg2uuEGaZijpJHsNerimBzZqS5NVK2TySVj5rDk0j7wH+tgKa4Y7IugRBzw hIf2f8k/jwFvQepMLfAFyJAxP5LIKVWCB0mPVOZm7a4+AM0xR+nYSq3q+6JVZY5akn2Q HYELHRUBTP8wP1LBdC+3kkmDGLAkabbM7MBSYHeP5yle0vtsvtmO20nXWtpAL/hpG4Qt IEH2GcHvoi5jAQ/A4EbxoAcGo8jJb+5801vpSzSvvZ05S9+Vw1Kb5J3/uwCR+zk/5ZBe qayg== X-Gm-Message-State: AOAM5337Oe6dkFwUGyn1eSVBrjpoZSjUKCdTgjsDwZUmGnf5mHdS+Jcb 0UIxFof0pQziashpyQn7VPj7NF6m X-Google-Smtp-Source: ABdhPJw86GF1deCwvykUE9oiRjzFg8hcTUyO2I001jtlm7SREpb4mqoGvWD8uzGQ/IAZGl+tkwwkFg== X-Received: by 2002:a2e:6a05:: with SMTP id f5mr830817ljc.272.1592436017044; Wed, 17 Jun 2020 16:20:17 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id x3sm235100ljc.82.2020.06.17.16.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 16:20:16 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul , Daniel Vetter , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Emil Velikov , Daniel Stone Subject: [PATCH v11 3/4] drm/panel: lvds: Read panel orientation Date: Thu, 18 Jun 2020 02:18:41 +0300 Message-Id: <20200617231842.30671-4-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200617231842.30671-1-digetx@gmail.com> References: <20200617231842.30671-1-digetx@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 18 Jun 2020 07:17:31 +0000 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: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The panel orientation needs to parsed from a device-tree and assigned to the panel's connector in order to make orientation property available to userspace. That's what this patch does for the generic LVDS panel. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/panel/panel-lvds.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c index 5ce3f4a2b7a1..f62227059090 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -37,6 +37,8 @@ struct panel_lvds { struct gpio_desc *enable_gpio; struct gpio_desc *reset_gpio; + + enum drm_panel_orientation orientation; }; static inline struct panel_lvds *to_panel_lvds(struct drm_panel *panel) @@ -99,6 +101,7 @@ static int panel_lvds_get_modes(struct drm_panel *panel, connector->display_info.bus_flags = lvds->data_mirror ? DRM_BUS_FLAG_DATA_LSB_TO_MSB : DRM_BUS_FLAG_DATA_MSB_TO_LSB; + drm_connector_set_panel_orientation(connector, lvds->orientation); return 1; } @@ -116,6 +119,13 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds) const char *mapping; int ret; + ret = of_drm_get_panel_orientation(np, &lvds->orientation); + if (ret < 0) { + dev_err(lvds->dev, "%pOF: problems parsing rotation (%d)\n", + np, ret); + return ret; + } + ret = of_get_display_timing(np, "panel-timing", &timing); if (ret < 0) { dev_err(lvds->dev, "%pOF: problems parsing panel-timing (%d)\n", From patchwork Wed Jun 17 23:18:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11611537 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2C9A618 for ; Thu, 18 Jun 2020 07:18:18 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C11A221655 for ; Thu, 18 Jun 2020 07:18:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g5Lw8nME" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C11A221655 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A5D86EADA; Thu, 18 Jun 2020 07:17:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD2AD6EA03 for ; Wed, 17 Jun 2020 23:20:19 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id i3so4994518ljg.3 for ; Wed, 17 Jun 2020 16:20:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xDuNPkLsn+qFGP55GoH5xYzbgggRa+4B+kAR6hG962I=; b=g5Lw8nME1Hx+IKrcWvFOiOO3x5pYdTMxJsp+tioyT1hBv02M1bMp5s01sY8XgGifIG So0Ny31B115rEJ9QMjDp8X36aSgKBRzJ2CatKNoSGXImoQh3Qx7fue8sdYY9qh+MDLNJ bGkpUXtm00F4oUHZqwtlOflj2lGUYqYqSiip1o1TdsYhFYJ24inX8mpaj8I6qFht7eaw gGdhYgGitPewoIYECH11D3uCl4slXBSWGKjprY+5/PZinDjsXNg48UdQMI9LI3xnKkG2 zMRBNZoGnnQVZ+1a1jURa/3L6pxFCMPAYiGoKEYJduzsOsIeN5hN7nBLpP1YT6KKzZ4l M19w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xDuNPkLsn+qFGP55GoH5xYzbgggRa+4B+kAR6hG962I=; b=gnWrhKYDJwmCuBgGvDtjUk3hniPlpCmmPNrYgXenYup74LuBRMvzETjJnR7utFfIzF UPUA7jlz5OwO2rlQMz2ReaQV1n9jWRWFKjPcRzKYyPHSIjM5W2jGlpqKWXYZxpm/GYfM wqaWs5CWBJ4KpH6HWk3284eEBQs8sAOsaupV1/TlBvNTMjJYZGDzm3tG9xxfyi4fAy7E aJvI3YhyqOcCcUrIDWhjtzTPzU+b+fdDIJQcsCFxzC7imE0DtwfCkI+kqQqg3c1dtMWm +HbFnWMMRlD0ZyH6YPBCBBivYL67azYWytMBix/R2BOiGu/jb+Ix2xr9as0RTsqtqru+ nReg== X-Gm-Message-State: AOAM533+IC3WDNaLtaZeQrfIRdf/oR/8mWuznkcz2Fjn/p1I1ZP+6hFe ucRB8FSvz/ulTKFptNcmA/I= X-Google-Smtp-Source: ABdhPJxT3+3ITtvZoxfpauwQtWfxUAcDCm937r+DCvi1iRnPkjGrWGExiRvyaUOt2t6UOl7y6A9wsQ== X-Received: by 2002:a2e:b550:: with SMTP id a16mr830166ljn.345.1592436018131; Wed, 17 Jun 2020 16:20:18 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id x3sm235100ljc.82.2020.06.17.16.20.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 16:20:17 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul , Daniel Vetter , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Emil Velikov , Daniel Stone Subject: [PATCH v11 4/4] drm/panel-simple: Read panel orientation Date: Thu, 18 Jun 2020 02:18:42 +0300 Message-Id: <20200617231842.30671-5-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200617231842.30671-1-digetx@gmail.com> References: <20200617231842.30671-1-digetx@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 18 Jun 2020 07:17:31 +0000 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: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The panel orientation needs to parsed from a device-tree and assigned to the panel's connector in order to make orientation property available to userspace. That's what this patch does for the panel-simple driver. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/panel/panel-simple.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 6764ac630e22..2dee1320216c 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -112,6 +112,8 @@ struct panel_simple { struct gpio_desc *hpd_gpio; struct drm_display_mode override_mode; + + enum drm_panel_orientation orientation; }; static inline struct panel_simple *to_panel_simple(struct drm_panel *panel) @@ -371,6 +373,9 @@ 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 */ + drm_connector_set_panel_orientation(connector, p->orientation); + return num; } @@ -530,6 +535,12 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) return err; } + err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation); + if (err) { + dev_err(dev, "failed to parse rotation property: %d\n", err); + return err; + } + ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0); if (ddc) { panel->ddc = of_find_i2c_adapter_by_node(ddc);