From patchwork Fri Aug 28 15:49:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 253244 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=-12.8 required=3.0 tests=BAYES_00,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=unavailable 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 086B9C433E2 for ; Fri, 28 Aug 2020 15:49:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CCCB820872 for ; Fri, 28 Aug 2020 15:49:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ObOhJQlc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728268AbgH1Pt3 (ORCPT ); Fri, 28 Aug 2020 11:49:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728039AbgH1PtS (ORCPT ); Fri, 28 Aug 2020 11:49:18 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FC4DC061264 for ; Fri, 28 Aug 2020 08:49:18 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id v12so1814440ljc.10 for ; Fri, 28 Aug 2020 08:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RzO/u82bhYkbGzYXqTgJ4HBSdRoIsJl4r3uZiLJLve4=; b=ObOhJQlcC2wrUZvz/Sa5WdH6CBtF1FirWagTSTjFA478ShCAfENPUBhWqBwSJsc7ph IBfCh4/UZVho2Zy0Z3a1Ww1HT3KpaWJU3MEY4WqznZRbdzfWbICAeWy+KNWiHrRHPx1l YBjp6QEYudGlvTQA9AibpmhCWGp4MqDic+eza712jiI5N1uvoL7ailsyn3MzRDNP7M8i SqxIJmTrT2GFx/o612QaG180NBIlYD9O1g7C/5+1gOwkIFi12ZHsYnmPQRB3aMHbEYcf MoGwDAmqwtpRS0kMdgka8hW2RReAgMVkokjZH3spi6HxzxoQPdQHJd+Nqgeg7dvyQhQw TEyg== 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=RzO/u82bhYkbGzYXqTgJ4HBSdRoIsJl4r3uZiLJLve4=; b=V1OMQmGdQ4upvLov1UHib7i5Q5o0iW4krmO6vkur2PIvqsX9AES+P0yr79eSUCl8PB h0pRuQiaRHymK0AZsgtXUJD06V+AJo1cnZ8+i75udkgBQ2pDqRcDDJfnWmxvdmENTML1 kgZeNJz1JgnldoJVLgn8NE+EeTtr+KakTlcv+9mdScuzzxo44bIi8luK8kJWbFeNe+v4 GPzGUlb+8v2S/IEXl4DFbiZ30Vx4Cfd3h2mu+dG9ZsHM0A4mpTwrpI/4j9pB3yJfhXWi MdjFjpjGMO0k1GgGBqAsT9nuSgxhgV/PsIir68tanqKKmfuU92S6as1xqPFoBME9jfNA JS/w== X-Gm-Message-State: AOAM533jzdyzGACYXbUTvtqXcXivYcQ60It9zhEtpXIV+eObHrjAaKQ0 K1NAG1E0pec5tY8rZQae5ymUcnlVDRGyCw== X-Google-Smtp-Source: ABdhPJxzFZT3xAeu/O5lodHhBa/sAIGF7iAxnNo9eQnh4WtgUBokeiPOTTMFNBe7D17Jmxr/83YieA== X-Received: by 2002:a2e:910d:: with SMTP id m13mr1266060ljg.240.1598629755378; Fri, 28 Aug 2020 08:49:15 -0700 (PDT) Received: from eriador.lan ([188.162.64.62]) by smtp.gmail.com with ESMTPSA id r16sm270215ljd.71.2020.08.28.08.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 08:49:14 -0700 (PDT) From: Dmitry Baryshkov To: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, Rob Herring , Daniel Vetter , David Airlie , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Vinod Koul , Sam Ravnborg Subject: [PATCH v2 1/3] dt-bindings: display: bridge: Add documentation for LT9611UXC Date: Fri, 28 Aug 2020 18:49:04 +0300 Message-Id: <20200828154906.1662611-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200828154906.1662611-1-dmitry.baryshkov@linaro.org> References: <20200828154906.1662611-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Lontium LT9611UXC is a DSI to HDMI bridge which supports 2 DSI ports and I2S port as input and one HDMI port as output. The LT9611UXC chip is handled by a separate driver, but the bindings used are fully compatible with the LT9611 chip, so let's reuse the lt9611.yaml schema. Signed-off-by: Dmitry Baryshkov Acked-by: Vinod Koul --- .../devicetree/bindings/display/bridge/lontium,lt9611.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/display/bridge/lontium,lt9611.yaml b/Documentation/devicetree/bindings/display/bridge/lontium,lt9611.yaml index d60208359234..7a1c89b995e2 100644 --- a/Documentation/devicetree/bindings/display/bridge/lontium,lt9611.yaml +++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt9611.yaml @@ -4,18 +4,19 @@ $id: http://devicetree.org/schemas/display/bridge/lontium,lt9611.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Lontium LT9611 2 Port MIPI to HDMI Bridge +title: Lontium LT9611(UXC) 2 Port MIPI to HDMI Bridge maintainers: - Vinod Koul description: | - The LT9611 is a bridge device which converts DSI to HDMI + The LT9611 and LT9611UXC are bridge devices which convert DSI to HDMI properties: compatible: enum: - lontium,lt9611 + - lontium,lt9611uxc reg: maxItems: 1 From patchwork Fri Aug 28 15:49:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 253243 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=-12.8 required=3.0 tests=BAYES_00,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=unavailable 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 D7E5AC433E6 for ; Fri, 28 Aug 2020 15:49:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD43220872 for ; Fri, 28 Aug 2020 15:49:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cFkKRoIi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726033AbgH1Ptk (ORCPT ); Fri, 28 Aug 2020 11:49:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728257AbgH1PtX (ORCPT ); Fri, 28 Aug 2020 11:49:23 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A1F2C061235 for ; Fri, 28 Aug 2020 08:49:22 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id j15so958385lfg.7 for ; Fri, 28 Aug 2020 08:49:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=egkk55sGDau+9n+stbkv1Ge3fT8d6jinbRQy2yb02Ng=; b=cFkKRoIiPAdeI4XAQN7af1kuUsXAmtAkmXC7pq/INbuny4p3+LmTxSSsOXiy748wNy 9gGGTjEdC0VNF4+pAC3YH21q5isuD0JN7KH18SJxTj+I+P8F5pJqvsnJ3vpDxZIXWxi7 /C9m5SDHMa81Sk244UESrXlCpCXtnjJdgLjACnT6DC5b61e3/C6Bf1bH1V6YqiYpzHSG OpZvtjk9RjiUc7LKeABF+ohRCaHn7/KOdb/ob0iQwmit/DqtLW8sHlmr+uqAQbglLgr8 zDF+0iHl6TGtD+PcA1r5K83hYaf3lXXm1Vz6I5PLCel/4sOcsqywM3vCM8ITKsmhuOsA Kb/w== 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=egkk55sGDau+9n+stbkv1Ge3fT8d6jinbRQy2yb02Ng=; b=ZSRhMrpo8y4oHzdHdOS7CY8PE203L3NNaAK4a8ejn/AJG2uxHzPk+xj869Lv8G84nl co780c4BtPGZEjYdnxCtqOsc6IwMs4N1TaO0wbYfMplbzgGs8nGG4EBGA+Vvu+6T3AeS Satq1UNt/BK770c32qsEORkm84omvXUMMfh0hAHSS53AYiP9fxyiFonjOs5XVl+Mu2ib xqpvVWxnRCFA0f+jqY1jPKza1SkgwB40hT1QsfjEP1wv+wBfmkQucDZSx0PPMi7DPEei jLKG8kHjf51fbsGXCA5DtwEdZWdtDPozv9lIp/XYvkMZEW/wyzeKtqzgVc0UIc7KESXu y4Mw== X-Gm-Message-State: AOAM530KX2Waq9Dj0OZyhnV/LzqBbwyfSmcV2L4eFjEHC61NpqowNRL1 04tB0Tsuzlj3qpVh+iN2fwe1QuIuMjg9+g== X-Google-Smtp-Source: ABdhPJxZQgMoUmV5ILdB4fxx6hPiQp1GIpcvpMnbMmO/U8ATGxmcZbUbyBDYpaVm+q6tSxwag9wfQw== X-Received: by 2002:a19:6e0f:: with SMTP id j15mr1100826lfc.112.1598629759935; Fri, 28 Aug 2020 08:49:19 -0700 (PDT) Received: from eriador.lan ([188.162.64.62]) by smtp.gmail.com with ESMTPSA id r16sm270215ljd.71.2020.08.28.08.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 08:49:19 -0700 (PDT) From: Dmitry Baryshkov To: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, Rob Herring , Daniel Vetter , David Airlie , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Vinod Koul , Sam Ravnborg Subject: [PATCH v2 3/3] drm: bridge: lt9611uxc: support working without DRM_BRIDGE_ATTACH_NO_CONNECTOR Date: Fri, 28 Aug 2020 18:49:06 +0300 Message-Id: <20200828154906.1662611-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200828154906.1662611-1-dmitry.baryshkov@linaro.org> References: <20200828154906.1662611-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org As the MSM driver does not specify DRM_BRIDGE_ATTACH_NO_CONNECTOR to bridges, support working without this flag for now. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 80 +++++++++++++++++++++- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c index 77c5aa5c6ad7..47a48e440bb3 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c @@ -31,6 +31,7 @@ struct lt9611uxc { struct device *dev; struct drm_bridge bridge; + struct drm_connector connector; struct regmap *regmap; /* Protects all accesses to registers by stopping the on-chip MCU */ @@ -105,6 +106,11 @@ static struct lt9611uxc *bridge_to_lt9611uxc(struct drm_bridge *bridge) return container_of(bridge, struct lt9611uxc, bridge); } +static struct lt9611uxc *connector_to_lt9611uxc(struct drm_connector *connector) +{ + return container_of(connector, struct lt9611uxc, connector); +} + static void lt9611uxc_lock(struct lt9611uxc *lt9611uxc) { mutex_lock(<9611uxc->ocm_lock); @@ -246,6 +252,75 @@ static struct mipi_dsi_device *lt9611uxc_attach_dsi(struct lt9611uxc *lt9611uxc, return dsi; } +static int lt9611uxc_connector_get_modes(struct drm_connector *connector) +{ + struct lt9611uxc *lt9611uxc = connector_to_lt9611uxc(connector); + unsigned int count; + struct edid *edid; + + if (lt9611uxc->bridge.ops & DRM_BRIDGE_OP_MODES) + return lt9611uxc->bridge.funcs->get_modes(<9611uxc->bridge, connector); + + edid = lt9611uxc->bridge.funcs->get_edid(<9611uxc->bridge, connector); + drm_connector_update_edid_property(connector, edid); + count = drm_add_edid_modes(connector, edid); + kfree(edid); + + return count; +} + +static enum drm_connector_status lt9611uxc_connector_detect(struct drm_connector *connector, + bool force) +{ + struct lt9611uxc *lt9611uxc = connector_to_lt9611uxc(connector); + + return lt9611uxc->bridge.funcs->detect(<9611uxc->bridge); +} + +static enum drm_mode_status lt9611uxc_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + struct lt9611uxc_mode *lt9611uxc_mode = lt9611uxc_find_mode(mode); + + return lt9611uxc_mode ? MODE_OK : MODE_BAD; +} + +static const struct drm_connector_helper_funcs lt9611uxc_bridge_connector_helper_funcs = { + .get_modes = lt9611uxc_connector_get_modes, + .mode_valid = lt9611uxc_connector_mode_valid, +}; + +static const struct drm_connector_funcs lt9611uxc_bridge_connector_funcs = { + .fill_modes = drm_helper_probe_single_connector_modes, + .detect = lt9611uxc_connector_detect, + .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 int lt9611uxc_connector_init(struct drm_bridge *bridge, struct lt9611uxc *lt9611uxc) +{ + int ret; + + if (!bridge->encoder) { + DRM_ERROR("Parent encoder object not found"); + return -ENODEV; + } + + drm_connector_helper_add(<9611uxc->connector, + <9611uxc_bridge_connector_helper_funcs); + ret = drm_connector_init(bridge->dev, <9611uxc->connector, + <9611uxc_bridge_connector_funcs, + DRM_MODE_CONNECTOR_HDMIA); + if (ret) { + DRM_ERROR("Failed to initialize connector with drm\n"); + return ret; + } + + return drm_connector_attach_encoder(<9611uxc->connector, bridge->encoder); +} + static void lt9611uxc_bridge_detach(struct drm_bridge *bridge) { struct lt9611uxc *lt9611uxc = bridge_to_lt9611uxc(bridge); @@ -266,8 +341,9 @@ static int lt9611uxc_bridge_attach(struct drm_bridge *bridge, int ret; if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { - dev_err(lt9611uxc->dev, "This bridge driver does not support providing connector!"); - return -EINVAL; + ret = lt9611uxc_connector_init(bridge, lt9611uxc); + if (ret < 0) + return ret; } /* Attach primary DSI */