From patchwork Fri Mar 15 13:08:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10854691 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A03BE15AC for ; Fri, 15 Mar 2019 13:08:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A6F52A9B0 for ; Fri, 15 Mar 2019 13:08:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DC342A9B2; Fri, 15 Mar 2019 13:08:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3FB832A9B0 for ; Fri, 15 Mar 2019 13:08:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 091846E408; Fri, 15 Mar 2019 13:08:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id A174A6E408 for ; Fri, 15 Mar 2019 13:08:42 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id r124so6462854pgr.3 for ; Fri, 15 Mar 2019 06:08:42 -0700 (PDT) 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=NP9T09HEiV9lz6LnHjqB2XMYT7hhusLm/ZYVSxXup6g=; b=sOz+3WI0p7+kv6sjvcaEjUQ8AprPjdy5TFb+0FhxY5+pyT8FnS6tzpffiZhGZZcP2S D+Ga4fgZKsz8ygcgshwMuDaPv9ZfRUxt2p4Jc7WrRAMClAnTitYsjzNo4rIQymAiKi1V bsEJ2VUONq13KB1MnIHtVNAFJN/r9SQJw1d/BwM+Nx1Ignuky14T2d8yOjDNZTl+iuUv g1r5ot0zm7Mlt3YoeG/+lLt4mHYEcuUtRi9NNZVhOAJWdTOTp87xJ3MfjeqzWoCwoiSg FKG1wsYFC1UhnhkriqUimDxP9qbmX3fShO01eyKEszGzsRU4P/Fe/6roCHkzP7rpEOFp lsKQ== X-Gm-Message-State: APjAAAU1DxRLiI73PHnZjzAuqBSMqgC1saS9lyqL4FVA0NIVTSUjJFap a6Gm8wFAW487az4v9BazDc/Ndw== X-Google-Smtp-Source: APXvYqwL+qZQkIGf8dCF8nSsgFBq32iO5p+TWJ2TYpdyylmsFWb0ti61kcJ07cVPtUKJfRHTzxxLPw== X-Received: by 2002:aa7:85cc:: with SMTP id z12mr4016902pfn.196.1552655321804; Fri, 15 Mar 2019 06:08:41 -0700 (PDT) Received: from localhost.localdomain ([183.82.230.185]) by smtp.gmail.com with ESMTPSA id e2sm854008pfa.64.2019.03.15.06.08.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Mar 2019 06:08:41 -0700 (PDT) From: Jagan Teki To: Andrzej Hajda , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland Subject: [PATCH 1/6] drm/bridge: Export drm_bridge_detach Date: Fri, 15 Mar 2019 18:38:20 +0530 Message-Id: <20190315130825.9005-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190315130825.9005-1-jagan@amarulasolutions.com> References: <20190315130825.9005-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NP9T09HEiV9lz6LnHjqB2XMYT7hhusLm/ZYVSxXup6g=; b=EEr7kbm4JScUqx4A4oujEtivANfVxlny5trpDbvGToZFduknY7uvBJOGtUXvUklyyI mYgVuKZ2qnBMvEqSEhwLq8+13FQza7H/G5r3CunAF3cviHpE3qt9hySo0/QVFTa7cy4s Rp7lpHcP2UhE2EDfJbptquEjM91CAHVTzwNOg= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Export drm_bridge_detach from drm bridge core so-that it can use on respective interface or bridge driver while detaching the bridge. Signed-off-by: Jagan Teki --- drivers/gpu/drm/drm_bridge.c | 1 + include/drm/drm_bridge.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 138b2711d389..569d4f345429 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -159,6 +159,7 @@ void drm_bridge_detach(struct drm_bridge *bridge) bridge->dev = NULL; } +EXPORT_SYMBOL(drm_bridge_detach); /** * DOC: bridge callbacks diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 9da8c93f7976..4955e3e50fa4 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -301,6 +301,7 @@ void drm_bridge_remove(struct drm_bridge *bridge); struct drm_bridge *of_drm_find_bridge(struct device_node *np); int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, struct drm_bridge *previous); +void drm_bridge_detach(struct drm_bridge *bridge); bool drm_bridge_mode_fixup(struct drm_bridge *bridge, const struct drm_display_mode *mode, From patchwork Fri Mar 15 13:08:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10854693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E3FF15AC for ; Fri, 15 Mar 2019 13:08:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 483992A9B2 for ; Fri, 15 Mar 2019 13:08:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C7AF2A9B4; Fri, 15 Mar 2019 13:08:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8F7B2A9B6 for ; Fri, 15 Mar 2019 13:08:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B65BD6E409; Fri, 15 Mar 2019 13:08:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id E10016E409 for ; Fri, 15 Mar 2019 13:08:47 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id d25so6315597pfn.8 for ; Fri, 15 Mar 2019 06:08:47 -0700 (PDT) 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=iy5X5nQ4JgXGLF8UMM2hZ+8DxyqREPSMFw8EUbSF9/Y=; b=m3nh9zG8adr5EW0r3IXPlHcKGiMPvFXj/wWLae2IKjdfUxHa5Rg1rGc/RtWMGi74Q5 zAhIhArdbpbLWMAtVQ4o5HVtBZTIwEfkBEzy8uxDB4suYfw829ki9jAdzYrLT4wLJfHu nGwjMZWRHUhBfDMubWX+w6k/ytPDwmeLhcuT/wfG3hf77XxJO1OWkUADDBXHVU8gIj7y zNCTP9c6iIyvCZ6tJrqRhOoBh66l81z+yCayKu01NzuHLiDrWd5oK+sCJuXqyAv/R8IZ MqgbYe0X4AWhmRz5/4CVWf5yyqd/nkgItufRdFdL/e+IZZuHrQeVW9kWCiWD7ild1rJS gGkQ== X-Gm-Message-State: APjAAAUDmEMelrmeqhOVnjFOBzvz5696oAJi0VYofOmLTbUfxSz55MAf dCvI7zQ5nT0or53M7jVX2SSQHw== X-Google-Smtp-Source: APXvYqydZg7PQXvS2Bgd7RPRfKpHQih5xMbZt34Kjaiwt0O75Jd/UYNWjPeusZb2G04Eq0ACxQjnWA== X-Received: by 2002:a62:48c1:: with SMTP id q62mr3983492pfi.113.1552655327466; Fri, 15 Mar 2019 06:08:47 -0700 (PDT) Received: from localhost.localdomain ([183.82.230.185]) by smtp.gmail.com with ESMTPSA id e2sm854008pfa.64.2019.03.15.06.08.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Mar 2019 06:08:46 -0700 (PDT) From: Jagan Teki To: Andrzej Hajda , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland Subject: [PATCH 2/6] drm/exynos: dsi: Use drm_bridge_detach Date: Fri, 15 Mar 2019 18:38:21 +0530 Message-Id: <20190315130825.9005-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190315130825.9005-1-jagan@amarulasolutions.com> References: <20190315130825.9005-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iy5X5nQ4JgXGLF8UMM2hZ+8DxyqREPSMFw8EUbSF9/Y=; b=pO8ssjEaKNDM2gxwo2eZOJi3BFaU6Z7wYIQ4I1OHhb5JrmiQNN0ar47vhmtlIHkIIS RWpk/5+cRl/iPVEgCzavRKeDJR9Reyhu/r0oLuNT3v4gMsylvwqauvz+kHlcHWDVmVAi l7EbSBu8e14tkwTzn5igylZZLTf6sv4LmqOw4= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Seung-Woo Kim , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, Jagan Teki , Kyungmin Park , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP drm_bridge_detach now available to use while detaching bridge, use this core wrapper instead of explicitly pointing the bridge funcs. Cc: Dae Cc: Joonyoung Shim Cc: Seung-Woo Kim Cc: Kyungmin Park Signed-off-by: Jagan Teki Acked-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index a4253dd55f86..5daf43d02768 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1583,8 +1583,7 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host, dsi->connector.status = connector_status_disconnected; mutex_unlock(&drm->mode_config.mutex); } else { - if (dsi->out_bridge->funcs->detach) - dsi->out_bridge->funcs->detach(dsi->out_bridge); + drm_bridge_detach(dsi->out_bridge); dsi->out_bridge = NULL; } From patchwork Fri Mar 15 13:08:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10854695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB42E17EF for ; Fri, 15 Mar 2019 13:08:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3ACD2A9B4 for ; Fri, 15 Mar 2019 13:08:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A78842A9B7; Fri, 15 Mar 2019 13:08:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2FC812A9B4 for ; Fri, 15 Mar 2019 13:08:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 110666E40A; Fri, 15 Mar 2019 13:08:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id A9E4E6E40A for ; Fri, 15 Mar 2019 13:08:52 +0000 (UTC) Received: by mail-pf1-x443.google.com with SMTP id n22so6338823pfa.3 for ; Fri, 15 Mar 2019 06:08:52 -0700 (PDT) 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=MUOsJO/ekVDHiTmtCVq8d27ElQS89ZxoIWk8a+ZsNC8=; b=HWk3eAyF7fncQTknAdn7s9GGwrPsjMMSf+15gKY5mGuaCKGysZKR4U0mN93K7U95wQ O2MgqNxQTJ6AfvBk8NSJ/S7mEfKCy/HaxaHa1KsYXY1Kmx9FMHe47L61r1QJ3KdNXPK+ oIyU8rwd4mKQJMjee9X21CEoPXiZ5ZnkYWQWJlTTauyMe0orJ9l3GImO6RY1MkPPmz/K KZ/lS5zPG59CT4mU9Wj/y30DBC34+hAYzR4l8qWkPL2mujPKp0VvH7P9LyqUtbSreUPq mme3OQh79MVQGgladov+ce8y4CoTuMQOYdbqKXb4Rblq611o8T6KDg12clSfySChrfCP qMGA== X-Gm-Message-State: APjAAAVhVJpluUUpsRPE7SeSknGBwNyWCDkXrQoMguDyBoLNbvJ7B9Rv 9Jjzf03KM+IX7olu7bc2CGMvTA== X-Google-Smtp-Source: APXvYqyPmR5Date1E23A+mrwxJzoBMabdA1BAZmkp5dMCISLQ8NpBn1aclAupLxAkrJgT0eBGNdF0A== X-Received: by 2002:a63:5321:: with SMTP id h33mr3378181pgb.168.1552655332222; Fri, 15 Mar 2019 06:08:52 -0700 (PDT) Received: from localhost.localdomain ([183.82.230.185]) by smtp.gmail.com with ESMTPSA id e2sm854008pfa.64.2019.03.15.06.08.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Mar 2019 06:08:51 -0700 (PDT) From: Jagan Teki To: Andrzej Hajda , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland Subject: [PATCH 3/6] drm/sun4i: dsi: Add bridge support Date: Fri, 15 Mar 2019 18:38:22 +0530 Message-Id: <20190315130825.9005-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190315130825.9005-1-jagan@amarulasolutions.com> References: <20190315130825.9005-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MUOsJO/ekVDHiTmtCVq8d27ElQS89ZxoIWk8a+ZsNC8=; b=B2hki3AVn28hYRpt5WblRY/Vca49463pFaNwvrqpHWdi3Q+mwBSfv1Vs2vjfcAGpRm 7h24qEjbfhNQ/C15zsOs0GEucNfdebhmiBYEC71Sl8tHFCMhamO1C/BCjEuHSy5LPNdX 22yifrbUWp3bv2AUBl5Qu6ljUpOc/zESnsyIQ= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Some display panels would come up with a non-DSI output which can have an option to connect DSI interface by means of bridge convertor. This DSI to non-DSI bridge convertor would require a bridge driver that would communicate the DSI controller for bridge functionalities. So, add support for bridge functionalities in Allwinner DSI controller. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 65 +++++++++++++++++++------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 + 2 files changed, 49 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 0960b96b62cc..64d74313b842 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -781,6 +781,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) if (!IS_ERR(dsi->panel)) drm_panel_prepare(dsi->panel); + if (!IS_ERR(dsi->bridge)) + drm_bridge_pre_enable(dsi->bridge); + /* * FIXME: This should be moved after the switch to HS mode. * @@ -796,6 +799,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) if (!IS_ERR(dsi->panel)) drm_panel_enable(dsi->panel); + if (!IS_ERR(dsi->bridge)) + drm_bridge_enable(dsi->bridge); + sun6i_dsi_start(dsi, DSI_START_HSC); udelay(1000); @@ -812,6 +818,9 @@ static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder) if (!IS_ERR(dsi->panel)) { drm_panel_disable(dsi->panel); drm_panel_unprepare(dsi->panel); + } else if (!IS_ERR(dsi->bridge)) { + drm_bridge_disable(dsi->bridge); + drm_bridge_post_disable(dsi->bridge); } phy_power_off(dsi->dphy); @@ -973,11 +982,16 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host, struct sun6i_dsi *dsi = host_to_sun6i_dsi(host); dsi->device = device; - dsi->panel = of_drm_find_panel(device->dev.of_node); - if (IS_ERR(dsi->panel)) - return PTR_ERR(dsi->panel); - dev_info(host->dev, "Attached device %s\n", device->name); + dsi->bridge = of_drm_find_bridge(device->dev.of_node); + if (!dsi->bridge) { + dsi->panel = of_drm_find_panel(device->dev.of_node); + if (IS_ERR(dsi->panel)) + return PTR_ERR(dsi->panel); + } + + dev_info(host->dev, "Attached %s %s\n", + dsi->bridge ? "bridge" : "panel", device->name); return 0; } @@ -1055,8 +1069,10 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, struct sun4i_tcon *tcon0 = sun4i_get_tcon0(drm); int ret; - if (!dsi->panel) + if (!(dsi->panel || dsi->bridge)) { + dev_info(drm->dev, "No panel or bridge found... DSI output disabled\n"); return -EPROBE_DEFER; + } dsi->drv = drv; @@ -1078,19 +1094,29 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, } dsi->encoder.possible_crtcs = BIT(0); - drm_connector_helper_add(&dsi->connector, - &sun6i_dsi_connector_helper_funcs); - ret = drm_connector_init(drm, &dsi->connector, - &sun6i_dsi_connector_funcs, - DRM_MODE_CONNECTOR_DSI); - if (ret) { - dev_err(dsi->dev, - "Couldn't initialise the DSI connector\n"); - goto err_cleanup_connector; + if (dsi->panel) { + drm_connector_helper_add(&dsi->connector, + &sun6i_dsi_connector_helper_funcs); + ret = drm_connector_init(drm, &dsi->connector, + &sun6i_dsi_connector_funcs, + DRM_MODE_CONNECTOR_DSI); + if (ret) { + dev_err(dsi->dev, + "Couldn't initialise the DSI connector\n"); + goto err_cleanup_connector; + } + + drm_connector_attach_encoder(&dsi->connector, &dsi->encoder); + drm_panel_attach(dsi->panel, &dsi->connector); } - drm_connector_attach_encoder(&dsi->connector, &dsi->encoder); - drm_panel_attach(dsi->panel, &dsi->connector); + if (dsi->bridge) { + ret = drm_bridge_attach(&dsi->encoder, dsi->bridge, NULL); + if (ret) { + dev_err(dsi->dev, "Couldn't attach the DSI bridge\n"); + goto err_cleanup_connector; + } + } return 0; @@ -1104,7 +1130,12 @@ static void sun6i_dsi_unbind(struct device *dev, struct device *master, { struct sun6i_dsi *dsi = dev_get_drvdata(dev); - drm_panel_detach(dsi->panel); + if (dsi->panel) + drm_panel_detach(dsi->panel); + + if (dsi->bridge) + drm_bridge_detach(dsi->bridge); + } static const struct component_ops sun6i_dsi_ops = { diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index 5c4983212f89..76874ff8e3ef 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -36,6 +36,7 @@ struct sun6i_dsi { struct sun4i_tcon *tcon; struct mipi_dsi_device *device; struct drm_panel *panel; + struct drm_bridge *bridge; const struct sun6i_dsi_variant *variant; }; From patchwork Fri Mar 15 13:08:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10854699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 99DE515AC for ; Fri, 15 Mar 2019 13:09:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 826852A9B0 for ; Fri, 15 Mar 2019 13:09:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 766C32A9B2; Fri, 15 Mar 2019 13:09:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1709F2A9B0 for ; Fri, 15 Mar 2019 13:09:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D0D166E40B; Fri, 15 Mar 2019 13:08:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 51D766E40B for ; Fri, 15 Mar 2019 13:08:57 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id e17so6458357pgd.2 for ; Fri, 15 Mar 2019 06:08:57 -0700 (PDT) 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=AAGhTSDHAoMycmwWhiYuqV20infnrcRGhVpZHstA2bg=; b=knPOZC6MGeiehK3KNeomf2SEERMGxp0VAxQm2rU1c5k00+3Tf+RCm4ols1or8DB35x 9LWibKZP8FaOo/iXaeFaksFZluBoIi2GKCPOmZI/ganAxgdYrdW4iEXZz8NTzH4Kmsjs oe4c2AA153kCIv4ZOYemQeSEPeT4UT85rDKvLNgJ6ZE+Cwtus+G53CDDwkOGbyUvTYCS 7rE4fQS9rOqEXDFDzcwYW1JgRcSZVuvJjat6oHw6eDp3+7q4a5yClKTebk8hbJjJrJCu WHb9KCJxm/4hWPtQuX3rlhug1wlzoxFZvLMu5icu/pEq5tN8BrsZnsugmriPlg33BTVn IVpg== X-Gm-Message-State: APjAAAUphd2s7ell1FrspSI8cVmtjO7QLD7NgcqFUwnG5Mp543Nrch4D H5imnjLsgEu2j9IMvMBPz136ow== X-Google-Smtp-Source: APXvYqwcggiwzRNyL5wb9wjvS6uJ2yZ3aXzKDLXnQmN7h6tse4rgW0S1r+UhaABSrbJyIOG6jy4rwg== X-Received: by 2002:a17:902:234b:: with SMTP id n11mr4218595plg.89.1552655336942; Fri, 15 Mar 2019 06:08:56 -0700 (PDT) Received: from localhost.localdomain ([183.82.230.185]) by smtp.gmail.com with ESMTPSA id e2sm854008pfa.64.2019.03.15.06.08.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Mar 2019 06:08:56 -0700 (PDT) From: Jagan Teki To: Andrzej Hajda , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland Subject: [PATCH 4/6] dt-bindings: display: bridge: Add ICN6211 MIPI-DSI to RGB convertor bridge Date: Fri, 15 Mar 2019 18:38:23 +0530 Message-Id: <20190315130825.9005-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190315130825.9005-1-jagan@amarulasolutions.com> References: <20190315130825.9005-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AAGhTSDHAoMycmwWhiYuqV20infnrcRGhVpZHstA2bg=; b=MBPaO0Zlx6KmpReudelpodsNyJVUCGSCpbLXUCDBE4Gk4lNLmH9Q962W2iZrzcb1kI p7uKF6K4R+IWlpYpsYu7ulJfwNAANlIB7a9ergDTeD5hLXTBPi4l5SDkuwl0PPCAhJ17 2+842mCm9/OLFiH12q0RCeoQIFTZ2ilmfrjjA= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP ICN6211 is MIPI-DSI/RGB converter bridge from chipone. It has a flexible configuration of MIPI DSI signal input and produce RGB565, RGB666, RGB888 output format. Add dt-bingings for it. Signed-off-by: Jagan Teki --- .../display/bridge/chipone,icn6211.txt | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.txt diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.txt b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.txt new file mode 100644 index 000000000000..7f13efd7ee7f --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.txt @@ -0,0 +1,36 @@ +Chipone ICN6211 MIPI-DSI to RGB Convertor Bridge + +ICN6211 is MIPI-DSI/RGB converter bridge from chipone. +It has a flexible configuration of MIPI DSI signal input +and produce RGB565, RGB666, RGB888 output format. + +Required properties for RGB: +- compatible: must be "chipone,icn6211" and one of: + * "bananapi,icn6211" +- reg: the virtual channel number of a DSI peripheral +- reset-gpios: a GPIO phandle for the reset pin + +The device node can contain following 'port' child nodes, +according to the OF graph bindings defined in [1]: + 0: DSI Input, not required, if the bridge is DSI controlled + 1: RGB Output, mandatory + +[1]: Documentation/devicetree/bindings/media/video-interfaces.txt + +Example: + + bridge@0 { + compatible = "bananapi,icn6211", "chipone,icn6211"; + reg = <0>; + reset-gpios = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* LCD-RST: PD6 */ + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + + bridge_out_ep: endpoint { + remote-endpoint = <&panel_ep>; + }; + }; + }; From patchwork Fri Mar 15 13:08:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10854703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60FEC1823 for ; Fri, 15 Mar 2019 13:09:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A431289C5 for ; Fri, 15 Mar 2019 13:09:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E7D828B58; Fri, 15 Mar 2019 13:09:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 476DD2931D for ; Fri, 15 Mar 2019 13:09:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C3776E40C; Fri, 15 Mar 2019 13:09:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C2AE6E40C for ; Fri, 15 Mar 2019 13:09:02 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id r124so6463441pgr.3 for ; Fri, 15 Mar 2019 06:09:02 -0700 (PDT) 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=l7jDKekA1zKlo/xV9xtxEUytM5+wSMRdUwycfkyRP+g=; b=B3FR+J6AUXE2vWTjB0+YFd9xQdAu3t8+qm3Szy4LWOOrOqmMdvuK+OqTPJuRsLDGY9 nQ9M9y2KC5GEmvY5LRCAAEp397VSPnrv+nlIOTj8MoYPYushuVVail7l0h0hUh64LhY2 pzjLfxIZa8LAQLn/S1NblVnGoUl2lBMKHhzu+y6/bIcR08Vl0Z742BmqAEN76KtDFr0D ouTzE4zyYobesxGJCeNXuffgBLGGuWvZ+x86Wtxi0JBsor9LOqOgc6ATdCYkqcXKkpHd mDLXV8Q8F5XXUmUyTNZXxyEZ62kzOtKV3eUMc6LjMX6zMm9n8caIyQxGnskZEjHFCjFQ Zj4Q== X-Gm-Message-State: APjAAAVxV5wbN+FBXHTDZIS3ziExj7XYZObOI95jPbuy7zwxhTcNx8hG szEivN/AXXIl+TKn5Pj9LIelRw== X-Google-Smtp-Source: APXvYqypv/Smqvslg2YxlLM5fRm478mf9x7+17zGZcTMm96oI5CPCDsw3xFIdx+nWU2L6p4l6Kwdag== X-Received: by 2002:a63:e40b:: with SMTP id a11mr3347314pgi.259.1552655341691; Fri, 15 Mar 2019 06:09:01 -0700 (PDT) Received: from localhost.localdomain ([183.82.230.185]) by smtp.gmail.com with ESMTPSA id e2sm854008pfa.64.2019.03.15.06.08.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Mar 2019 06:09:01 -0700 (PDT) From: Jagan Teki To: Andrzej Hajda , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland Subject: [PATCH 5/6] drm/bridge: Add Chipone ICN6211 MIPI-DSI/RGB convertor bridge Date: Fri, 15 Mar 2019 18:38:24 +0530 Message-Id: <20190315130825.9005-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190315130825.9005-1-jagan@amarulasolutions.com> References: <20190315130825.9005-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l7jDKekA1zKlo/xV9xtxEUytM5+wSMRdUwycfkyRP+g=; b=dD9jLFn+eWX5ZemwH/7VZLAS4Z1aRh0G6t9F2/w3RcHu1j8rqeWZKNROXUS3Q4Thiq y+RR/YsM9RzeKUlMKWywHgtLvyVaXLkSL/VTlle6m/Z2pbJ4ka04vOvtYZy4avqdeEkv sK2GwJknCURcb4T+dS9GvTYOdNgoE3BzUrO6M= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP ICN6211 is MIPI-DSI/RGB converter bridge from chipone. It has a flexible configuration of MIPI DSI signal input and produce RGB565, RGB666, RGB888 output format. Add bridge driver for it. Signed-off-by: Jagan Teki --- MAINTAINERS | 6 + drivers/gpu/drm/bridge/Kconfig | 10 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/chipone-icn6211.c | 275 +++++++++++++++++++++++ 4 files changed, 292 insertions(+) create mode 100644 drivers/gpu/drm/bridge/chipone-icn6211.c diff --git a/MAINTAINERS b/MAINTAINERS index 4de80222cffb..e529addd30f5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4897,6 +4897,12 @@ T: git git://anongit.freedesktop.org/drm/drm-misc S: Maintained F: drivers/gpu/drm/bochs/ +DRM DRIVER FOR CHIPONE ICN6211 MIPI-DSI to RGB CONVERTOR BRIDGE +M: Jagan Teki +S: Maintained +F: drivers/gpu/drm/bridge/chipone-icn6211.c +F: Documentation/devicetree/bindings/display/bridge/chipone,icn6211.txt + DRM DRIVER FOR FARADAY TVE200 TV ENCODER M: Linus Walleij T: git git://anongit.freedesktop.org/drm/drm-misc diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 8840f396a7b6..cd314572e4ed 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -36,6 +36,16 @@ config DRM_CDNS_DSI Support Cadence DPI to DSI bridge. This is an internal bridge and is meant to be directly embedded in a SoC. +config DRM_CHIPONE_ICN6211 + tristate "Chipone ICN6211 MIPI-DSI/RGB converter bridge" + depends on DRM && DRM_PANEL + depends on OF + select DRM_MIPI_DSI + help + ICN6211 is MIPI-DSI/RGB converter bridge from chipone. + It has a flexible configuration of MIPI DSI signal input + and produce RGB565, RGB666, RGB888 output format. + config DRM_DUMB_VGA_DAC tristate "Dumb VGA DAC Bridge support" depends on OF diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index 4934fcf5a6f8..541fdccad10b 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o +obj-$(CONFIG_DRM_CHIPONE_ICN6211) += chipone-icn6211.o obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bridge/chipone-icn6211.c new file mode 100644 index 000000000000..cd2f3505f845 --- /dev/null +++ b/drivers/gpu/drm/bridge/chipone-icn6211.c @@ -0,0 +1,275 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Amarula Solutions + * Author: Jagan Teki + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define ICN6211_INIT_CMD_LEN 2 + +struct chipone { + struct device *dev; + struct drm_bridge bridge; + struct drm_connector connector; + struct drm_panel *panel; + + struct gpio_desc *reset; +}; + +static inline struct chipone *bridge_to_chipone(struct drm_bridge *bridge) +{ + return container_of(bridge, struct chipone, bridge); +} + +static inline +struct chipone *connector_to_chipone(struct drm_connector *connector) +{ + return container_of(connector, struct chipone, connector); +} + +struct icn6211_init_cmd { + u8 data[ICN6211_INIT_CMD_LEN]; +}; + +static const struct icn6211_init_cmd icn6211_init_cmds[] = { + { .data = { 0x7A, 0xC1 } }, + { .data = { 0x20, 0x20 } }, + { .data = { 0x21, 0xE0 } }, + { .data = { 0x22, 0x13 } }, + { .data = { 0x23, 0x28 } }, + { .data = { 0x24, 0x30 } }, + { .data = { 0x25, 0x28 } }, + { .data = { 0x26, 0x00 } }, + { .data = { 0x27, 0x0D } }, + { .data = { 0x28, 0x03 } }, + { .data = { 0x29, 0x1D } }, + { .data = { 0x34, 0x80 } }, + { .data = { 0x36, 0x28 } }, + { .data = { 0xB5, 0xA0 } }, + { .data = { 0x5C, 0xFF } }, + { .data = { 0x2A, 0x01 } }, + { .data = { 0x56, 0x92 } }, + { .data = { 0x6B, 0x71 } }, + { .data = { 0x69, 0x2B } }, + { .data = { 0x10, 0x40 } }, + { .data = { 0x11, 0x98 } }, + { .data = { 0xB6, 0x20 } }, + { .data = { 0x51, 0x20 } }, + { .data = { 0x09, 0x10 } }, +}; + +static int chipone_get_modes(struct drm_connector *connector) +{ + struct chipone *icn = connector_to_chipone(connector); + + return drm_panel_get_modes(icn->panel); +} + +static const +struct drm_connector_helper_funcs chipone_connector_helper_funcs = { + .get_modes = chipone_get_modes, +}; + +static const struct drm_connector_funcs chipone_connector_funcs = { + .fill_modes = drm_helper_probe_single_connector_modes, + .destroy = drm_connector_cleanup, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, +}; + +static void chipone_disable(struct drm_bridge *bridge) +{ + struct chipone *icn = bridge_to_chipone(bridge); + int ret = drm_panel_disable(bridge_to_chipone(bridge)->panel); + + if (ret < 0) + DRM_DEV_ERROR(icn->dev, "error disabling panel (%d)\n", ret); +} + +static void chipone_post_disable(struct drm_bridge *bridge) +{ + struct chipone *icn = bridge_to_chipone(bridge); + int ret; + + ret = drm_panel_unprepare(icn->panel); + if (ret < 0) + DRM_DEV_ERROR(icn->dev, "error unpreparing panel (%d)\n", ret); + + msleep(50); + + gpiod_set_value(icn->reset, 0); +} + +static void chipone_pre_enable(struct drm_bridge *bridge) +{ + struct chipone *icn = bridge_to_chipone(bridge); + struct mipi_dsi_device *dsi = to_mipi_dsi_device(icn->dev); + unsigned int i; + int ret; + + gpiod_set_value(icn->reset, 0); + msleep(20); + + gpiod_set_value(icn->reset, 1); + msleep(50); + + for (i = 0; i < ARRAY_SIZE(icn6211_init_cmds); i++) { + const struct icn6211_init_cmd *cmd = &icn6211_init_cmds[i]; + + ret = mipi_dsi_generic_write(dsi, cmd->data, + ICN6211_INIT_CMD_LEN); + if (ret < 0) { + DRM_DEV_ERROR(icn->dev, + "failed to write cmd %d: %d\n", i, ret); + return; + } + } + + ret = drm_panel_prepare(icn->panel); + if (ret < 0) + DRM_DEV_ERROR(icn->dev, "error preparing panel (%d)\n", ret); +} + +static void chipone_enable(struct drm_bridge *bridge) +{ + struct chipone *icn = bridge_to_chipone(bridge); + int ret = drm_panel_enable(icn->panel); + + if (ret < 0) + DRM_DEV_ERROR(icn->dev, "error enabling panel (%d)\n", ret); +} + +static int chipone_attach(struct drm_bridge *bridge) +{ + struct chipone *icn = bridge_to_chipone(bridge); + struct drm_device *drm = bridge->dev; + int ret; + + icn->connector.polled = DRM_CONNECTOR_POLL_HPD; + ret = drm_connector_init(drm, &icn->connector, + &chipone_connector_funcs, + DRM_MODE_CONNECTOR_Unknown); + if (ret) { + DRM_ERROR("Failed to initialize connector\n"); + return ret; + } + + drm_connector_helper_add(&icn->connector, + &chipone_connector_helper_funcs); + drm_connector_attach_encoder(&icn->connector, bridge->encoder); + drm_panel_attach(icn->panel, &icn->connector); + icn->connector.funcs->reset(&icn->connector); + drm_fb_helper_add_one_connector(drm->fb_helper, &icn->connector); + drm_connector_register(&icn->connector); + + return 0; +} + +static void chipone_detach(struct drm_bridge *bridge) +{ + struct chipone *icn = bridge_to_chipone(bridge); + struct drm_device *drm = bridge->dev; + + drm_connector_unregister(&icn->connector); + drm_fb_helper_remove_one_connector(drm->fb_helper, &icn->connector); + drm_panel_detach(icn->panel); + icn->panel = NULL; + drm_connector_put(&icn->connector); +} + +static const struct drm_bridge_funcs chipone_bridge_funcs = { + .disable = chipone_disable, + .post_disable = chipone_post_disable, + .enable = chipone_enable, + .pre_enable = chipone_pre_enable, + .attach = chipone_attach, + .detach = chipone_detach, +}; + +static int chipone_probe(struct mipi_dsi_device *dsi) +{ + struct device *dev = &dsi->dev; + struct chipone *icn; + int ret; + + icn = devm_kzalloc(dev, sizeof(struct chipone), GFP_KERNEL); + if (!icn) + return -ENOMEM; + + mipi_dsi_set_drvdata(dsi, icn); + + icn->dev = dev; + dsi->lanes = 4; + dsi->format = MIPI_DSI_FMT_RGB888; + dsi->mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE; + + icn->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(icn->reset)) { + DRM_DEV_ERROR(dev, "no reset GPIO pin provided\n"); + return PTR_ERR(icn->reset); + } + + ret = drm_of_find_panel_or_bridge(icn->dev->of_node, 1, 0, + &icn->panel, NULL); + if (ret && ret != -EPROBE_DEFER) { + DRM_DEV_ERROR(dev, "failed to find panel (ret = %d)\n", ret); + return ret; + } + + icn->bridge.funcs = &chipone_bridge_funcs; + icn->bridge.of_node = dev->of_node; + + drm_bridge_add(&icn->bridge); + + ret = mipi_dsi_attach(dsi); + if (ret < 0) { + drm_bridge_remove(&icn->bridge); + DRM_DEV_ERROR(dev, "failed to attach dsi (ret = %d)\n", ret); + } + + return ret; +} + +static int chipone_remove(struct mipi_dsi_device *dsi) +{ + struct chipone *icn = mipi_dsi_get_drvdata(dsi); + + mipi_dsi_detach(dsi); + drm_bridge_remove(&icn->bridge); + + return 0; +} + +static const struct of_device_id chipone_of_match[] = { + { .compatible = "bananapi,icn6211" }, + { } +}; +MODULE_DEVICE_TABLE(of, chipone_of_match); + +static struct mipi_dsi_driver chipone_driver = { + .probe = chipone_probe, + .remove = chipone_remove, + .driver = { + .name = "chipone-icn6211", + .owner = THIS_MODULE, + .of_match_table = chipone_of_match, + }, +}; +module_mipi_dsi_driver(chipone_driver); + +MODULE_AUTHOR("Jagan Teki "); +MODULE_DESCRIPTION("Chipone ICN6211 MIPI-DSI to RGB Convertor Bridge"); +MODULE_LICENSE("GPL v2"); From patchwork Fri Mar 15 13:08:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10854705 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A268215AC for ; Fri, 15 Mar 2019 13:09:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D2022931D for ; Fri, 15 Mar 2019 13:09:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8096B2A12F; Fri, 15 Mar 2019 13:09:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2ACD42931D for ; Fri, 15 Mar 2019 13:09:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07F006E40D; Fri, 15 Mar 2019 13:09:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id CA35E6E40E for ; Fri, 15 Mar 2019 13:09:06 +0000 (UTC) Received: by mail-pf1-x443.google.com with SMTP id r15so3567842pfn.9 for ; Fri, 15 Mar 2019 06:09:06 -0700 (PDT) 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=fgjvITMSu4P9dEIyxGHg+50sb9yJF4/343qaf5B+0M4=; b=P7qxnO2V/TTciPKTv9GhyJfkJ1kNp02FpYeB63Ok+NNbTkW5LU7J5NbeMIg1IMSvEm i2KzgcIwb1h43C/u5qmIopJCXpXVml0BeKiDT1voAgHS164z0xfTWM+mlyhDB/7hOnmE TXU6m6j20pyBzFwPH3a1SNZYpdWqqI/8Jvw24/U2KE6xfYC97/fAXll7kJniwmVQjoeU GSEq4uqr64cUTVyV6X1pBShX9nyLr4uMlTYxUFwrV1UW8QfWnHoohqHnzELcUoD7VWUa 4KJaBg+pmaV1D3faMr0BSVQrQw9nTSIGK14kD0aHFr+oOZTvCFf7Ee2qX3opEGpcbr8Y 0j/w== X-Gm-Message-State: APjAAAV0lfeFotlEOJ2cth2FT7YhE0d5KBeyPNUZtKK8uQ37id/YizuT gkZE7QdKwFkSS44Hjy//xciYXw== X-Google-Smtp-Source: APXvYqxVc/fKWezAMXctlfIKXy+8b2DkfDBT/ADV0Gwx2+8aTtr1GEODEGakDg6K+Luj6lxZ1BZEmA== X-Received: by 2002:aa7:9102:: with SMTP id 2mr3913621pfh.179.1552655346407; Fri, 15 Mar 2019 06:09:06 -0700 (PDT) Received: from localhost.localdomain ([183.82.230.185]) by smtp.gmail.com with ESMTPSA id e2sm854008pfa.64.2019.03.15.06.09.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Mar 2019 06:09:05 -0700 (PDT) From: Jagan Teki To: Andrzej Hajda , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland Subject: [PATCH 6/6] arm64: dts: allwinner: bananapi-m64: Enable S070WV20-CT16 DSI panel Date: Fri, 15 Mar 2019 18:38:25 +0530 Message-Id: <20190315130825.9005-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190315130825.9005-1-jagan@amarulasolutions.com> References: <20190315130825.9005-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fgjvITMSu4P9dEIyxGHg+50sb9yJF4/343qaf5B+0M4=; b=BTB4zVgub30H5MtT6pq8TsVFBePGZEx5YhRKZGDqnCan9mHIf4Nf9ntbuNLWrMnCNP UZXuk3m3T73k7UuXMkeGkEPq7xUGm5i6aswJRXmBp5prmiBa3VgnDq/pUVd5m8wIKckT 30fG/0/QtZ1VcM3c6j6xmBgz8ZDGLqNvODj0Q= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch add support for Bananapi S070WV20-CT16 DSI panel to BPI-M64 board. Bananapi S070WV20-CT16 is a pure RGB output panel with ICN6211 DSI/RGB convertor bridge, so enable bridge along with associated panel. DSI panel connected via board DSI port with, - DLDO1 as VCC-DSI supply - PD6 gpio for reset pin - PD5 gpio for backlight enable pin - PD7 gpio for backlight vdd supply Signed-off-by: Jagan Teki --- .../dts/allwinner/sun50i-a64-bananapi-m64.dts | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts index 7793ebb5d2b8..f31083aa4521 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts @@ -45,6 +45,7 @@ #include "sun50i-a64.dtsi" #include +#include / { model = "BananaPi-M64"; @@ -56,6 +57,15 @@ serial1 = &uart1; }; + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>; + brightness-levels = <1 2 4 8 16 32 64 128 512>; + default-brightness-level = <2>; + enable-gpios = <&pio 3 5 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PD5 */ + power-supply = <®_vdd_backlight>; + }; + chosen { stdout-path = "serial0:115200n8"; }; @@ -91,6 +101,26 @@ }; }; + panel-connector { + compatible = "bananapi,s070wv20-ct16", "simple-panel"; + + port { + backlight = <&backlight>; + panel_ep: endpoint { + remote-endpoint = <&bridge_out_ep>; + }; + }; + }; + + reg_vdd_backlight: vdd-backlight { + compatible = "regulator-fixed"; + regulator-name = "vdd-backlight"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&pio 3 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PD7 */ + enable-active-high; + }; + wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */ @@ -116,6 +146,33 @@ status = "okay"; }; +&dphy { + status = "okay"; +}; + +&dsi { + vcc-dsi-supply = <®_dldo1>; /* VCC3V3-DSI */ + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + bridge@0 { + compatible = "bananapi,icn6211", "chipone, icn6211"; + reg = <0>; + reset-gpios = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* LCD-RST: PD6 */ + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + + bridge_out_ep: endpoint { + remote-endpoint = <&panel_ep>; + }; + }; + }; +}; + &ehci0 { status = "okay"; }; @@ -208,6 +265,12 @@ status = "okay"; }; +&r_pwm { + pinctrl-names = "default"; + pinctrl-0 = <&r_pwm_pin>; + status = "okay"; +}; + &r_rsb { status = "okay";