From patchwork Fri Feb 14 12:24:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 204810 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AEE1C2BA83 for ; Fri, 14 Feb 2020 12:24:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 11F6822314 for ; Fri, 14 Feb 2020 12:24:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cerno.tech header.i=@cerno.tech header.b="Rj3Vaeua"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="xct+q5D+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728223AbgBNMYq (ORCPT ); Fri, 14 Feb 2020 07:24:46 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:53557 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727970AbgBNMYq (ORCPT ); Fri, 14 Feb 2020 07:24:46 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id D95287177; Fri, 14 Feb 2020 07:24:45 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 14 Feb 2020 07:24:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=dnk7pJKP+HgrN 4lk8DCUSISIcaYg2wPtGi46T6k0vVo=; b=Rj3VaeuanI9A6ew5xyhcXLuCAkzMo FOy5E4ddX5rzZlhz0YWun3R0J+lOC37ZCT3S/+xMT1wHhHy/LOzkImg+zj/o/gam 7fPo3Es5jEb8MG9Bg062foRqpnyADxRuiSsXXnnyoP0aDbzUqyRoCheR9KziYZgd YZoNXJWBu1wElllTXhzPoqKHyIvfUSoag7Q/wKszDT6A/oUf3XyyABiWIIb7dYxI fIhoQQaPtfguX6oExT5Gxek0OXx9hRSXg7bsX0XYtL0heuwDN83e45JVAqaibZxh zGh0uzAdVnZLBXw+IgGdbs+9QhKtorFSITMP4paF3sTrkANpXzrLWbZtA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=dnk7pJKP+HgrN4lk8DCUSISIcaYg2wPtGi46T6k0vVo=; b=xct+q5D+ b/EK9Seh9XoyEIz37AF7H+iIcE706DypIxNIdMMsHHHAfkZxngw3N9KewiXEt8jq z24XBahyMUPsUN6xnu/mOtrfL3EoJ+Yh6vCZfrQ2C6zAZg0c9uM3tr3gL3fC9SUh g023XieIOJXAzvHB92YtEOdiY3Vw2L8osfk9tdM29ZRjuIaXnfSjHCDBEQL7TsqH MuJkMpGRwS9W8KGAiAK5L9WqsEb1o+3CEzs1QOw9lqC89WUeJS7nHPoLxJ6CmVwF eBsXLC6qTo5gYgsyYN7UxNbs8dgyxjt3yxTMsiuLSE1QSMJoUp1XmsLGBro0kYOB GFz5O6hTLS6DGQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrjedtgdegtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucfkphepledtrd ekledrieekrdejieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 70B13328005A; Fri, 14 Feb 2020 07:24:45 -0500 (EST) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , dri-devel@lists.freedesktop.org Cc: Maarten Lankhorst , Sean Paul , Daniel Vetter , David Airlie , devicetree@vger.kernel.org, Mark Rutland , Rob Herring , Frank Rowand , Sam Ravnborg , Thierry Reding , linux-arm-kernel@lists.infradead.org, Maxime Ripard Subject: [PATCH 1/4] drm/connector: Add data polarity flags Date: Fri, 14 Feb 2020 13:24:38 +0100 Message-Id: X-Mailer: git-send-email 2.24.1 In-Reply-To: References: MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Some LVDS encoders can change the polarity of the data signals being sent. Add a DRM bus flag to reflect this. Signed-off-by: Maxime Ripard --- include/drm/drm_connector.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 221910948b37..9a08fe6ab7c2 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -330,6 +330,8 @@ enum drm_panel_orientation { * edge of the pixel clock * @DRM_BUS_FLAG_SHARP_SIGNALS: Set if the Sharp-specific signals * (SPL, CLS, PS, REV) must be used + * @DRM_BUS_FLAG_DATA_LOW: The Data signals are active low + * @DRM_BUS_FLAG_DATA_HIGH: The Data signals are active high */ enum drm_bus_flags { DRM_BUS_FLAG_DE_LOW = BIT(0), @@ -349,6 +351,8 @@ enum drm_bus_flags { DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE = DRM_BUS_FLAG_SYNC_NEGEDGE, DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE = DRM_BUS_FLAG_SYNC_POSEDGE, DRM_BUS_FLAG_SHARP_SIGNALS = BIT(8), + DRM_BUS_FLAG_DATA_LOW = BIT(9), + DRM_BUS_FLAG_DATA_HIGH = BIT(10), }; /** From patchwork Fri Feb 14 12:24:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 204809 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7975FC2BA83 for ; Fri, 14 Feb 2020 12:24:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4BDED222C4 for ; Fri, 14 Feb 2020 12:24:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cerno.tech header.i=@cerno.tech header.b="tUVxtqrh"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="U6HoPEPH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729125AbgBNMYu (ORCPT ); Fri, 14 Feb 2020 07:24:50 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:44445 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727970AbgBNMYt (ORCPT ); Fri, 14 Feb 2020 07:24:49 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id B3A9C7352; Fri, 14 Feb 2020 07:24:48 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 14 Feb 2020 07:24:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=aGIlfA2KuBAok WapNsxvxuUq+3OyrK2C0WS49FNUGu4=; b=tUVxtqrh+vW/O2BpQj+bR9+uhbZPd RjCe0jJLlss1RVaLKUAyd5JM9rv6a79cHUJatJfwAJZxJOA1gyTylKKtglYHNntl ikL+X2ThGq/5hvjDk9wwC/ZY2Gw5QjHMccH8zJAAqnrB/zLMiWqKwtuJpn5yl2Nc 3GFuiupwc3/Yw8Epp6dzR9QAF5oeuGbtdmTfS7s8pV0gI6w5/2na9VXkhq49hU6J TgspOkIPpZMdd3b61kOohpUUoxOopEQ1mzwwUByeLzMlBAgEH87osj19/PJcO3Q1 edlxfw1g32sCH0Al41pXOOBVkp/3Onhn69eLVh0s343SIX61pNdFtqcYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=aGIlfA2KuBAokWapNsxvxuUq+3OyrK2C0WS49FNUGu4=; b=U6HoPEPH k5ZpvAkq40wNODLGmqWtZlTHImZwFZWPlu6GJoUTUkUzruh09ULKlzRAJkB4PhQg ddlewVly7VXFAC7CG3qrLr6RwIektH7Ln6xPco0Nh/DFUlaSepGhwbMxfE2+g+OI 9qPaKKsBI9lVbX+F+XyvbH3IM5gFY1/Jic19yH8ybzmSsX4U/iNH0fGHuc0gf1+D WmqS/RH4nqcjyxoXhboEaPz3VmhWNqhTXwflF5r7GXOBeoHpjkl6uD4q2Fd42jfD wkqIQyoKC6vtGKVwiYlvfq+QD7Vf+n+clpTh+5//NdvwfnfFjNJz/trYdIXR3cMk m+LFhvhCA5GtAA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrjedtgdegtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucfkphepledtrd ekledrieekrdejieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 51D1E328005A; Fri, 14 Feb 2020 07:24:48 -0500 (EST) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , dri-devel@lists.freedesktop.org Cc: Maarten Lankhorst , Sean Paul , Daniel Vetter , David Airlie , devicetree@vger.kernel.org, Mark Rutland , Rob Herring , Frank Rowand , Sam Ravnborg , Thierry Reding , linux-arm-kernel@lists.infradead.org, Maxime Ripard Subject: [PATCH 3/4] drm/panel: lvds: Support data and clock polarity flags Date: Fri, 14 Feb 2020 13:24:40 +0100 Message-Id: X-Mailer: git-send-email 2.24.1 In-Reply-To: References: MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add device tree properties to the panel-lvds driver to set the bus flags properly. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/panel/panel-lvds.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c index 5ce3f4a2b7a1..c0d6dcd9e9fc 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -31,6 +31,8 @@ struct panel_lvds { unsigned int height; struct videomode video_mode; unsigned int bus_format; + bool clk_active_low; + bool data_active_low; bool data_mirror; struct regulator *supply; @@ -83,6 +85,7 @@ static int panel_lvds_get_modes(struct drm_panel *panel, { struct panel_lvds *lvds = to_panel_lvds(panel); struct drm_display_mode *mode; + unsigned int flags = 0; mode = drm_mode_create(connector->dev); if (!mode) @@ -96,9 +99,23 @@ static int panel_lvds_get_modes(struct drm_panel *panel, connector->display_info.height_mm = lvds->height; drm_display_info_set_bus_formats(&connector->display_info, &lvds->bus_format, 1); - connector->display_info.bus_flags = lvds->data_mirror - ? DRM_BUS_FLAG_DATA_LSB_TO_MSB - : DRM_BUS_FLAG_DATA_MSB_TO_LSB; + + if (lvds->data_mirror) + flags |= DRM_BUS_FLAG_DATA_LSB_TO_MSB; + else + flags |= DRM_BUS_FLAG_DATA_MSB_TO_LSB; + + if (lvds->clk_active_low) + flags |= DRM_BUS_FLAG_PIXDATA_NEGEDGE; + else + flags |= DRM_BUS_FLAG_PIXDATA_POSEDGE; + + if (lvds->data_active_low) + flags |= DRM_BUS_FLAG_DATA_LOW; + else + flags |= DRM_BUS_FLAG_DATA_HIGH; + + connector->display_info.bus_flags = flags; return 1; } @@ -159,6 +176,8 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds) return -EINVAL; } + lvds->clk_active_low = of_property_read_bool(np, "clock-active-low"); + lvds->data_active_low = of_property_read_bool(np, "data-active-low"); lvds->data_mirror = of_property_read_bool(np, "data-mirror"); return 0;