Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1479947ybz; Wed, 29 Apr 2020 23:32:12 -0700 (PDT) X-Google-Smtp-Source: APiQypL0CHDH6ecfLoJE2y8DWduN2hrzUcNhbbdNlBBa8SAEqoqzkcWhHoZeQ9vBuDmSRaI7PFoi X-Received: by 2002:a05:6402:1a2f:: with SMTP id be15mr1282791edb.385.1588228331861; Wed, 29 Apr 2020 23:32:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1588228331; cv=pass; d=google.com; s=arc-20160816; b=VtBEfAka7Gq/LbA2JQL8VHd6wzXREkAQiTcrFR1kBCT0dG7AVZi/FXiSflHsDCkQxj CnfWrl4aOVrinH3/JvAIXXOQjA1NBMZBNi+4ssvrISbIBFpWx7ItmZXNM+meLbVlxnGo apMZ8HUkOc/8M8Dims5/JiookNAmtPo/GkkBx/BjEfaqTQo8qd8RilBSp9h/Ae1FzepQ wSGFT3yVRsfs1VR+EBIJmgp1giH2BZYQ8KTbIB/FLTrbOIyc/I0aBdHwKcqpvTtZJ/n3 P0Or2aIuIyi0d3e/tukyUwyLzvpEx9oglG4tVwK8lorO5wIp1Z5OHjTEjDf7WT1jYIIe g/Og== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:in-reply-to :content-disposition:references:message-id:subject:cc:to:from:date :dkim-signature; bh=n4CKdKTaHkawzkG8/J6NtHtPBaJqgw3IFr+wP29/e1Y=; b=zza0zXyN2OevEiWWvz0DwSx7T/LsWCxtWSYw4ICT9J+xYCSkREtBU2mPqiM+YCFfe9 PWyMD6SYpOKs2qc/Fy3F1/NgoBzZoHn/A/0X3aMznwPxQ1B5x6/KOB3bfRvr0/djp9uA duCIWWEHyXunzkpWURXQw/CQ7b/ohvfXKVsG/ew42WmGGDm0axtH3yAF+bQVQcuQ0vQZ LBero9eim4gEzOBA+5QxV/fQrVww6PJJtmwmU0lytRGcemE6brj6rODLYn3xRGCyxPsN LI4+ZecI7DmDfVy29BOF9xt8sQDdr6p54bdgBhKlArBirVuX/t6Q8oqGBU4atpiQINmp JeiQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Analogixsemi.onmicrosoft.com header.s=selector2-Analogixsemi-onmicrosoft-com header.b="J5h/8HVD"; arc=pass (i=1 spf=pass spfdomain=analogixsemi.com dkim=pass dkdomain=analogixsemi.com dmarc=pass fromdomain=analogixsemi.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=analogixsemi.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b61si4492336edf.322.2020.04.29.23.31.48; Wed, 29 Apr 2020 23:32:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Analogixsemi.onmicrosoft.com header.s=selector2-Analogixsemi-onmicrosoft-com header.b="J5h/8HVD"; arc=pass (i=1 spf=pass spfdomain=analogixsemi.com dkim=pass dkdomain=analogixsemi.com dmarc=pass fromdomain=analogixsemi.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=analogixsemi.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726449AbgD3GaY (ORCPT + 99 others); Thu, 30 Apr 2020 02:30:24 -0400 Received: from mail-dm6nam10on2114.outbound.protection.outlook.com ([40.107.93.114]:25879 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726358AbgD3GaY (ORCPT ); Thu, 30 Apr 2020 02:30:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DZYjOMvpkq9+8B/kxyL/A58MXIUeoMAZu5ltqiUSYZZpRN/gtFlY7VWwLXSc+GjveyNso1JtEQcIw0I2Mk2+qpp7b/4V/qWdnj69yFgfvXfquRT1fVxbdmNhDKr+l1seGCb0nOuh6NbxjBfYcIKqnXg/NBT5p8R/yN4qqqrJF9wLm8RPSISyerbzz6JT3d9+KDczOvkBiZQmhDoVvPoQdZc3FhK0vHza70JpEV7yK0FLdMMuqj78Y26H5aDlT95ghIpv2VVCbVdHlEQ7jxKkFQ0szIma+3S0oqHRibYYKGyB1Jlblw1wCQzkflTfd7zjJ51dJNKr/JjJhtjuP0pCMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n4CKdKTaHkawzkG8/J6NtHtPBaJqgw3IFr+wP29/e1Y=; b=EyBpJNW7RHOhmqm+FTWRF6hEVWiYArntZs54L8+b1vQhWNA1LmZBC2ABUJVFaMiHvFLEgbarteJprmmB+syO7drbDxpsS/HFaBeFuMXmUpdwA0k4eb0k7IWm3GRHdvl6H7sNbUDPUBZvca2RElFagY4/dVsNfcseLfswgfuSHRpSwklyqi5iDkot0MJ4oQ7wzcH1ATqwPToeIc1hCJea5xnQY3NYDWte1aZZ+0FrqnuJxfJCjX+XIoqupzQMjPdmNE80AHTY/R8CM/L5XHE7lPkOr76/7RTBBW2NDGa+VskKfbntQaGUfy3JppjYdQaHGcHw2wLj7+FMNgffUJQVsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=analogixsemi.com; dmarc=pass action=none header.from=analogixsemi.com; dkim=pass header.d=analogixsemi.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Analogixsemi.onmicrosoft.com; s=selector2-Analogixsemi-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n4CKdKTaHkawzkG8/J6NtHtPBaJqgw3IFr+wP29/e1Y=; b=J5h/8HVD7brn6xSCv0jcIBbcspDvAudXdxmtjtkZ0VI1LjxMegPQMkrVD3ZtCfgXJKyK1eOzA0UpTYlkJChgio8RFqmeW1s1Qgb0i6I3s6wlVDMv6L7aLVFgxNwS2j3uFrFEF3OeUKD6g+8/O0btoGEOIS0pdZ0GV/mDlZNFhAY= Authentication-Results: analogixsemi.com; dkim=none (message not signed) header.d=none;analogixsemi.com; dmarc=none action=none header.from=analogixsemi.com; Received: from BY5PR04MB6739.namprd04.prod.outlook.com (2603:10b6:a03:229::8) by BY5PR04MB7105.namprd04.prod.outlook.com (2603:10b6:a03:222::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Thu, 30 Apr 2020 06:30:19 +0000 Received: from BY5PR04MB6739.namprd04.prod.outlook.com ([fe80::4517:bcc8:a3bd:407f]) by BY5PR04MB6739.namprd04.prod.outlook.com ([fe80::4517:bcc8:a3bd:407f%6]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 06:30:19 +0000 Date: Thu, 30 Apr 2020 14:30:12 +0800 From: Xin Ji To: Nicolas Boichat , Sam Ravnborg Cc: devel@driverdev.osuosl.org, Laurent Pinchart , Dan Carpenter , Andrzej Hajda , Neil Armstrong , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Pi-Hsun Shih , Sheng Pan Subject: Re: [PATCH v8 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver Message-ID: <20200430063012.GE6645@xin-VirtualBox> References: <4d14400b6c19f17c28267f6ebdbce9673333c05c.1587880280.git.xji@analogixsemi.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-ClientProxiedBy: HK2PR06CA0006.apcprd06.prod.outlook.com (2603:1096:202:2e::18) To BY5PR04MB6739.namprd04.prod.outlook.com (2603:10b6:a03:229::8) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xin-VirtualBox (114.247.245.254) by HK2PR06CA0006.apcprd06.prod.outlook.com (2603:1096:202:2e::18) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.2958.20 via Frontend Transport; Thu, 30 Apr 2020 06:30:18 +0000 X-Originating-IP: [114.247.245.254] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 89705d86-d65a-477f-ea3f-08d7eccff3ff X-MS-TrafficTypeDiagnostic: BY5PR04MB7105: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-Forefront-PRVS: 0389EDA07F X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR04MB6739.namprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(396003)(366004)(39840400004)(136003)(346002)(376002)(7416002)(5660300002)(4326008)(6666004)(478600001)(107886003)(66946007)(9686003)(66476007)(55016002)(66556008)(6496006)(33656002)(54906003)(8936002)(16526019)(26005)(33716001)(316002)(110136005)(8676002)(1076003)(2906002)(186003)(53546011)(956004)(86362001)(52116002);DIR:OUT;SFP:1102; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5wG7x1kZyH75kfW+qqEpJEWY7Ah00RUkK/10M+y/aHGmWpT8JMjJ313b/NoPXvxpPRj9PKozGW7cOUf90IdR2ehkLZWTiraoffG9vvOLy7+NNXUNDGT51mlFdSxEOLWQOwgSQAZOm7THrOHsGq/v5ljIZSZ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a8mNYYCVEH0wMJX7WEM1GyGu1rYMMeTu4O9tRiu8ymfis9l4D2EaSV X-OriginatorOrg: analogixsemi.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89705d86-d65a-477f-ea3f-08d7eccff3ff X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 06:30:19.5580 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b099b0b4-f26c-4cf5-9a0f-d5be9acab205 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GnMEgivEtunC3mB1Hl2p7gOTt8MHoo7lpvnvtWj64W0h23Pv/8C2K1tm4piSzEXFfAKHCA5rSicU6nsudPStVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR04MB7105 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 29, 2020 at 10:10:05AM +0800, Nicolas Boichat wrote: > On Mon, Apr 27, 2020 at 2:18 PM Xin Ji wrote: > > > > The ANX7625 is an ultra-low power 4K Mobile HD Transmitter designed > > for portable device. It converts MIPI DSI/DPI to DisplayPort 1.3 4K. > > > > The ANX7625 can support both USB Type-C PD feature and MIPI DSI/DPI > > to DP feature. This driver only enabled MIPI DSI/DPI to DP feature. > > > > Signed-off-by: Xin Ji > > --- > > drivers/gpu/drm/bridge/Makefile | 2 +- > > drivers/gpu/drm/bridge/analogix/Kconfig | 6 + > > drivers/gpu/drm/bridge/analogix/Makefile | 1 + > > drivers/gpu/drm/bridge/analogix/anx7625.c | 2158 +++++++++++++++++++++++++++++ > > drivers/gpu/drm/bridge/analogix/anx7625.h | 410 ++++++ > > 5 files changed, 2576 insertions(+), 1 deletion(-) > > create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.c > > create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.h > > > > diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile > > index 4934fcf..bcd388a 100644 > > --- a/drivers/gpu/drm/bridge/Makefile > > +++ b/drivers/gpu/drm/bridge/Makefile > > @@ -12,8 +12,8 @@ obj-$(CONFIG_DRM_SII9234) += sii9234.o > > obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o > > obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o > > obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o > > -obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/ > > obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/ > > obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o > > obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o > > +obj-y += analogix/ > > obj-y += synopsys/ > > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig > > index e930ff9..b2f127e 100644 > > --- a/drivers/gpu/drm/bridge/analogix/Kconfig > > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig > > @@ -2,3 +2,9 @@ > > config DRM_ANALOGIX_DP > > tristate > > depends on DRM > > + > > +config ANALOGIX_ANX7625 > > + tristate "Analogix MIPI to DP interface support" > > + help > > + ANX7625 is an ultra-low power 4K mobile HD transmitter designed > > + for portable devices. It converts MIPI/DPI to DisplayPort1.3 4K. > > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile > > index fdbf3fd..8a52867 100644 > > --- a/drivers/gpu/drm/bridge/analogix/Makefile > > +++ b/drivers/gpu/drm/bridge/analogix/Makefile > > @@ -1,3 +1,4 @@ > > # SPDX-License-Identifier: GPL-2.0-only > > +obj-$(CONFIG_ANALOGIX_ANX7625) += anx7625.o > > analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o > > obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o > > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c > > new file mode 100644 > > index 0000000..fff7a49 > > [snip] > > +static int anx7625_attach_dsi(struct anx7625_data *ctx) > > +{ > > + struct mipi_dsi_host *host; > > + struct mipi_dsi_device *dsi; > > + struct device_node *mipi_host_node; > > + struct device *dev = &ctx->client->dev; > > + const struct mipi_dsi_device_info info = { > > + .type = "anx7625", > > + .channel = 0, > > + .node = NULL, > > + }; > > + > > + DRM_DEV_DEBUG_DRIVER(dev, "attach dsi\n"); > > + > > + if (ctx->pdata.dsi_supported) > > + mipi_host_node = ctx->pdata.node.mipi_dsi_host_node; > > + else > > + mipi_host_node = ctx->pdata.node.mipi_dpi_host_node; > > + > > + if (!mipi_host_node) { > > + DRM_ERROR("dsi host is not configured.\n"); > > + return -EINVAL; > > + } > > + > > + host = of_find_mipi_dsi_host_by_node(mipi_host_node); > > I tried this driver when connected to a dpi interface, and this fails, > as of_find_mipi_dsi_host_by_node is not able to find the dpi interface > from the SoC. > > I'm not too familiar with how dpi bridges are supposed to work in the > kernel, but should we even call "anx7625_attach_dsi" for DPI > interface? DPI needs hardware support, and I don't know how to register DPI interface in the driver too, I'll remove the DPI support in the next serial. > > > + if (!host) { > > + DRM_ERROR("failed to find dsi host.\n"); > > + return -EINVAL; > > + } > > + > > + dsi = mipi_dsi_device_register_full(host, &info); > > + if (IS_ERR(dsi)) { > > + DRM_ERROR("failed to create dsi device.\n"); > > + return -EINVAL; > > + } > > + > > + dsi->lanes = 4; > > + dsi->format = MIPI_DSI_FMT_RGB888; > > + dsi->mode_flags = MIPI_DSI_MODE_VIDEO | > > + MIPI_DSI_MODE_VIDEO_SYNC_PULSE | > > + MIPI_DSI_MODE_EOT_PACKET | > > + MIPI_DSI_MODE_VIDEO_HSE; > > + > > + if (mipi_dsi_attach(dsi) < 0) { > > + DRM_ERROR("failed to attach dsi to host.\n"); > > + mipi_dsi_device_unregister(dsi); > > + return -EINVAL; > > + } > > + > > + ctx->dsi = dsi; > > + > > + DRM_DEV_DEBUG_DRIVER(dev, "attach dsi succeeded.\n"); > > + > > + return 0; > > +} > > + > > [snip] > > +static int anx7625_bridge_attach(struct drm_bridge *bridge) > > +{ > > + struct anx7625_data *ctx = bridge_to_anx7625(bridge); > > + int err; > > + struct device *dev = &ctx->client->dev; > > + > > + DRM_DEV_DEBUG_DRIVER(dev, "drm attach\n"); > > + if (!bridge->encoder) { > > + DRM_ERROR("Parent encoder object not found"); > > + return -ENODEV; > > + } > > + > > + err = drm_connector_init(bridge->dev, &ctx->connector, > > + &anx7625_connector_funcs, > > + ctx->pdata.internal_panel ? > > + DRM_MODE_CONNECTOR_eDP : > > + DRM_MODE_CONNECTOR_DisplayPort); > > + if (err) { > > + DRM_ERROR("Failed to initialize connector: %d\n", err); > > + return err; > > + } > > + > > + drm_connector_helper_add(&ctx->connector, > > + &anx7625_connector_helper_funcs); > > + > > + err = drm_connector_register(&ctx->connector); > > + if (err) { > > + DRM_ERROR("Failed to register connector: %d\n", err); > > + return err; > > + } > > + > > + ctx->connector.polled = DRM_CONNECTOR_POLL_HPD; > > + > > + err = drm_connector_attach_encoder(&ctx->connector, bridge->encoder); > > + if (err) { > > + DRM_ERROR("Failed to link up connector to encoder: %d\n", err); > > + drm_connector_unregister(&ctx->connector); > > + return err; > > + } > > + > > + err = anx7625_attach_dsi(ctx); > > + if (err) { > > + DRM_ERROR("Failed to attach to dsi : %d\n", err); > > + drm_connector_unregister(&ctx->connector); > > + return err; > > + } > > + > > + ctx->bridge_attached = 1; > > + > > + return 0; > > +} > > +