From patchwork Thu Feb 22 17:07:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 129300 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp817774lja; Thu, 22 Feb 2018 09:08:08 -0800 (PST) X-Google-Smtp-Source: AH8x226jlNb2uyxUFhdVKG1YxiqGZTacrMqIMuEYk2pMBDhfq2Kt/ly8CTvxSx4myHpA1vOHed+o X-Received: by 2002:a17:902:52cd:: with SMTP id a71-v6mr4904927pli.389.1519319288727; Thu, 22 Feb 2018 09:08:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519319288; cv=none; d=google.com; s=arc-20160816; b=dfZpAoJDu3MyrRURbP03h/J+iNKODOHjMI9Mp14D0/00pEbWb8djYL9iE8yiei3Ay1 bVq9gW0JRnwek2g3LwK6erI2KDsaG1EZgzVYXbDR0y71Wd+C7GHWaVGIUyFOyniDpOoa QYMaFKwVDrRKLZB6LIXd+rSwB2Ersi4HLIwmWqoJrEDcCOk2TUmnqxMPCeXs4/1/gf5b kyhhOWHrUMhqasF4/vzFBL8JjB4ET4N/EkW0lw727fHQVvR4JSCQGHmvFg6d/78GUWY6 vKLmi4S2DmpVSNFif8Cje0ecnL2F2IwJeNjQWtTqkZUyTccJNBQ//WDplvCoYQmyvVcC h2fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=N8nltXh1jPflNE81oENlVuhW/RvRoiR2X9oT8JF3Qaw=; b=GfMymr/GBlLbigz2eoAuho3rP9lGFgXbuosQmu+KUeOubgMzx5w68LZMyvkE3uOJwy yWQMbKly0zpvlRKYNSbznkFKS4wbmYSkrPs0KLPRYC52MvyAcpAExU2dKXNzaFGFwiVk FTtNAQbrHQb22NoxnSLVgFDasZmQVSUWE9XW5aqBbr/sxdweAfYuj//xhylAgq03K/gg zWsmFoE09MVRr3ueaNPwufxonGKs/6M1Bw4tMiHK4Ge33ru+W1MqSQD5QxciKHfGPiv8 Ggi5Z2UUfsoTzALGHG7+M+Ekl45B5PBGE4m7uh25cU4EyEErRz7hcVO8R6bFCgk4tQyg VZqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=JQ/a8IKk; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id k66si317648pfa.415.2018.02.22.09.08.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Feb 2018 09:08:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=JQ/a8IKk; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1E9376EED0; Thu, 22 Feb 2018 17:08:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id B05656EECE for ; Thu, 22 Feb 2018 17:08:04 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1MH7rIb007623; Thu, 22 Feb 2018 11:07:53 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519319273; bh=lshjS8zugz2sA/NbVgtrRAo7JYRq09Cc4TcQrXBw1EM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JQ/a8IKk/gWRcWwBJje4g59NXik41WSCx160BYjyIY2eiahfR+IbyFfHUL5DcRiFz jnVxo8gNHFvWxBJpHrAKyJU6/ndCSVSVxXOnx2MTeVtCTWaEipwy2h5TotEoC9EFIH OLlOypntWK3ZHRrfF/cC6tEDFbZVxJ/+xSTB6Q3c= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1MH7r0N032112; Thu, 22 Feb 2018 11:07:53 -0600 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Thu, 22 Feb 2018 11:07:53 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Thu, 22 Feb 2018 11:07:53 -0600 Received: from jadmar.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1MH7mQS014515; Thu, 22 Feb 2018 11:07:51 -0600 From: Jyri Sarha To: Subject: [PATCH 1/4] drm/tilcdc: Add support for drm panels Date: Thu, 22 Feb 2018 19:07:42 +0200 Message-ID: <2ae6a45a36b6e7fd666e72124a458a75a0099545.1519318304.git.jsarha@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: airlied@linux.ie, Jyri Sarha , tony@atomide.com, tomi.valkeinen@ti.com, thierry.reding@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add support for drm panels to tilcdc. Adding the support on top of the existing bridge support needs only couple of lines of code when using using the drm panel bridge helpers. Signed-off-by: Jyri Sarha --- drivers/gpu/drm/tilcdc/Kconfig | 2 ++ drivers/gpu/drm/tilcdc/tilcdc_external.c | 29 ++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/Kconfig b/drivers/gpu/drm/tilcdc/Kconfig index 81ac824..5259804 100644 --- a/drivers/gpu/drm/tilcdc/Kconfig +++ b/drivers/gpu/drm/tilcdc/Kconfig @@ -4,6 +4,8 @@ config DRM_TILCDC select DRM_KMS_HELPER select DRM_KMS_CMA_HELPER select DRM_GEM_CMA_HELPER + select DRM_BRIDGE + select DRM_PANEL_BRIDGE select VIDEOMODE_HELPERS select BACKLIGHT_CLASS_DEVICE select BACKLIGHT_LCD_SUPPORT diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c index 711c7b3..d651bdd 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_external.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c @@ -188,18 +188,16 @@ int tilcdc_attach_bridge(struct drm_device *ddev, struct drm_bridge *bridge) int tilcdc_attach_external_device(struct drm_device *ddev) { struct tilcdc_drm_private *priv = ddev->dev_private; - struct device_node *remote_node; struct drm_bridge *bridge; + struct drm_panel *panel; int ret; - remote_node = of_graph_get_remote_node(ddev->dev->of_node, 0, 0); - if (!remote_node) + ret = drm_of_find_panel_or_bridge(ddev->dev->of_node, 0, 0, + &panel, &bridge); + if (ret == -ENODEV) return 0; - - bridge = of_drm_find_bridge(remote_node); - of_node_put(remote_node); - if (!bridge) - return -EPROBE_DEFER; + else if (ret) + return ret; priv->external_encoder = devm_kzalloc(ddev->dev, sizeof(*priv->external_encoder), @@ -215,10 +213,23 @@ int tilcdc_attach_external_device(struct drm_device *ddev) return ret; } + if (panel) { + bridge = devm_drm_panel_bridge_add(ddev->dev, panel, + DRM_MODE_CONNECTOR_DPI); + if (IS_ERR(bridge)) { + ret = PTR_ERR(bridge); + goto err_encoder_cleanup; + } + } + ret = tilcdc_attach_bridge(ddev, bridge); if (ret) - drm_encoder_cleanup(priv->external_encoder); + goto err_encoder_cleanup; + + return 0; +err_encoder_cleanup: + drm_encoder_cleanup(priv->external_encoder); return ret; }