From patchwork Sun Feb 16 21:02:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11384715 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 B6914139A for ; Sun, 16 Feb 2020 21:04:05 +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 95B0024125 for ; Sun, 16 Feb 2020 21:04:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="j5p3e0ej" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95B0024125 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.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 4B8A76E487; Sun, 16 Feb 2020 21:03:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by gabe.freedesktop.org (Postfix) with ESMTPS id DA76D6E2A9 for ; Sun, 16 Feb 2020 21:03:41 +0000 (UTC) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 302652D2; Sun, 16 Feb 2020 22:03:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1581887019; bh=+bjrK0V/Nh57IrixRUshgP/GW2hT6yNbeSvdYptFAqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j5p3e0ejvPWPEFoqB+D/BTVZBd/V0qdF5oFqm+xKZZ5+jzm1mkBkkwK3GePHAXoom N1YXjyyE2Q9Jv6r9vsCSYO0d5qDAMgNxWMD7+C4IsYDqEexrbcE2j1f0JReEyXtDFu H817ZWtZPYrKyHzXsPUWCRUTHIKLOIJg6NArTrT8= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH v6 09/51] drm/bridge: simple-bridge: Add support for non-VGA bridges Date: Sun, 16 Feb 2020 23:02:26 +0200 Message-Id: <20200216210308.17312-10-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200216210308.17312-1-laurent.pinchart@ideasonboard.com> References: <20200216210308.17312-1-laurent.pinchart@ideasonboard.com> 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: Tomi Valkeinen , Sam Ravnborg , Sebastian Reichel , Boris Brezillon Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Create a new simple_bridge_info structure that stores information about the bridge model, and store the bridge timings in there, along with the connector type. Use that new structure for of_device_id data. This enables support for non-VGA bridges. Signed-off-by: Laurent Pinchart Reviewed-by: Andrzej Hajda Reviewed-by: Stefan Agner Reviewed-by: Boris Brezillon Reviewed-by: Maxime Ripard Acked-by: Sam Ravnborg --- Changes since v1: - Renamed simple_bridge_info.type field to connector_type --- drivers/gpu/drm/bridge/simple-bridge.c | 41 ++++++++++++++++++-------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridge/simple-bridge.c index 00d810c99193..20866c1230de 100644 --- a/drivers/gpu/drm/bridge/simple-bridge.c +++ b/drivers/gpu/drm/bridge/simple-bridge.c @@ -17,10 +17,17 @@ #include #include +struct simple_bridge_info { + const struct drm_bridge_timings *timings; + unsigned int connector_type; +}; + struct simple_bridge { struct drm_bridge bridge; struct drm_connector connector; + const struct simple_bridge_info *info; + struct i2c_adapter *ddc; struct regulator *vdd; }; @@ -120,7 +127,7 @@ static int simple_bridge_attach(struct drm_bridge *bridge, &simple_bridge_con_helper_funcs); ret = drm_connector_init_with_ddc(bridge->dev, &sbridge->connector, &simple_bridge_con_funcs, - DRM_MODE_CONNECTOR_VGA, + sbridge->info->connector_type, sbridge->ddc); if (ret) { DRM_ERROR("Failed to initialize connector\n"); @@ -190,6 +197,8 @@ static int simple_bridge_probe(struct platform_device *pdev) return -ENOMEM; platform_set_drvdata(pdev, sbridge); + sbridge->info = of_device_get_match_data(&pdev->dev); + sbridge->vdd = devm_regulator_get_optional(&pdev->dev, "vdd"); if (IS_ERR(sbridge->vdd)) { int ret = PTR_ERR(sbridge->vdd); @@ -213,7 +222,7 @@ static int simple_bridge_probe(struct platform_device *pdev) sbridge->bridge.funcs = &simple_bridge_bridge_funcs; sbridge->bridge.of_node = pdev->dev.of_node; - sbridge->bridge.timings = of_device_get_match_data(&pdev->dev); + sbridge->bridge.timings = sbridge->info->timings; drm_bridge_add(&sbridge->bridge); @@ -273,19 +282,27 @@ static const struct drm_bridge_timings ti_ths8135_bridge_timings = { static const struct of_device_id simple_bridge_match[] = { { .compatible = "dumb-vga-dac", - .data = NULL, - }, - { + .data = &(const struct simple_bridge_info) { + .connector_type = DRM_MODE_CONNECTOR_VGA, + }, + }, { .compatible = "adi,adv7123", - .data = &default_bridge_timings, - }, - { + .data = &(const struct simple_bridge_info) { + .timings = &default_bridge_timings, + .connector_type = DRM_MODE_CONNECTOR_VGA, + }, + }, { .compatible = "ti,ths8135", - .data = &ti_ths8135_bridge_timings, - }, - { + .data = &(const struct simple_bridge_info) { + .timings = &ti_ths8135_bridge_timings, + .connector_type = DRM_MODE_CONNECTOR_VGA, + }, + }, { .compatible = "ti,ths8134", - .data = &ti_ths8134_bridge_timings, + .data = &(const struct simple_bridge_info) { + .timings = &ti_ths8134_bridge_timings, + .connector_type = DRM_MODE_CONNECTOR_VGA, + }, }, {}, };