From patchwork Thu Feb 7 08:36:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 157681 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp366075jaa; Thu, 7 Feb 2019 00:37:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IZZR4NjZ8141LHDJJdcmVU/kUS8lnMRkR1+VQlrP+mBSjds1tc5K901OKAj7UY3QgYS6xpU X-Received: by 2002:a62:4549:: with SMTP id s70mr14892862pfa.233.1549528626883; Thu, 07 Feb 2019 00:37:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549528626; cv=none; d=google.com; s=arc-20160816; b=ApOqQiCI37yzkMYQuAS9kYix0rj4XLVmuUzFvSKwBm/POm3UDG/MsnCH0UcuEWPYyK qXV8hyspka7rafHLlcy0RanHKLQ1eSEHvL87PwlIAXv0iGBIXxQTg+CYwksu0dEfGeNV /5aof+qiYHc9nkiA6rbUpDmvOH3XsBjIOwRy6dtbtaSM8pSBbBa1erjJ4eVAKe/Hf+e2 8b7ELEsBSWx8bsS9n53HiEZlwUW9J1Yi5X51T0SMdDDmwz8R51i1ZXPwjOsX9n2FaTtA SDjsllZ193yhWyslER9Q3FWzAhuSbRLFqHCwIdhqKc0xyzkgTNnWxwZ8DG2og/4cH3lF 8C8Q== 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:delivered-to; bh=FsT3rvJ1IY4YF69t41yZqS51SGton20uMgdPwi8mOJM=; b=JqV0Ui2wzfL8VS/Y7wOphDp9SWC68xwS60Y8M81GgzwMT3GmDwaCOFhNmWbImNNkYA 63R9rQA9roth7DbhkXLYQ1sX+Q+sz7JdW11RVEvZ8HmA0/l3XGuuwZJpNnnicY2GtK8D o+fCo6cWjduw5/+GGjy8ivGSm3Ar6XgWYbzKkeNakngsMPbDHQO3luSuEM6AFmjpZijM 7mOW/5S5fFMTxt3l6jrMwyq6RYkT6hLy0GthqQRs3rE/QHkkH7/Wa5WWiOd9ObiXex25 YbX3+vtvXEGRIRZuvhByflRNoymZGksIxNOpDVe3WugjMRK2jqt2UwP7gK4zK+J1XEFb 6MAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id a8si8655871ple.216.2019.02.07.00.37.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Feb 2019 00:37:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F4D86EC1A; Thu, 7 Feb 2019 08:37:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id B230B6EC1A for ; Thu, 7 Feb 2019 08:37:04 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id z25-v6so2040064ljk.7 for ; Thu, 07 Feb 2019 00:37:04 -0800 (PST) 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=wZHPggfSt3jojrbcWHOqN6DfKMWRWCRtzNWm965aV4w=; b=dD8FV7FyLwOPXIjq8W0GKqeY0lpVME1VQ8gLv8sdXHqIFDUSt7kN2yNItvWPFFaoPn M+XOREH3/KqyTcfAQBIukzega25jEdhl3vR4kMSmFlOOVUqX9XsZodCafOd431eOUzoA LnxmqnS/Td30yhuRZWZxClk5Ybs7T7kWQSqW+vHUTOi8jGAxAywDA1htOT0IU+asTMFJ Q1qM/imkqbfKwhYWXrypP5mUNxRdLv8YpY8/ACaw5eW2wh5VDagNjdo2rIgCoCQrrVg9 fJtdq3AHYJ2+nK34yGmRXpxPjhkSa77v6uBEYu9EubMBY+28x6vG42FVZEVMVP43kLF/ mYLQ== X-Gm-Message-State: AHQUAuZ4fLGwYhr8CfRAehAdmsz/7vQ3QDSfHpb4w+sCVX15t2/DnoBa 2cMklHGM+aDkjjZhk3J6GWQaT2RN8wI= X-Received: by 2002:a2e:e02:: with SMTP id 2-v6mr2779845ljo.10.1549528621358; Thu, 07 Feb 2019 00:37:01 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l72sm470910lfg.75.2019.02.07.00.36.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Feb 2019 00:37:00 -0800 (PST) From: Linus Walleij To: dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie Subject: [PATCH 1/4] drm/simple_kms_helper: enable use of external encoder Date: Thu, 7 Feb 2019 09:36:44 +0100 Message-Id: <20190207083647.20615-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190207083647.20615-1-linus.walleij@linaro.org> References: <20190207083647.20615-1-linus.walleij@linaro.org> MIME-Version: 1.0 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: linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This makes it possible to pass a connector with an already attached external encoder into the simple KMS helper. This is helpful for my MCDE drivers, as it is pretty simple but uses DSI to communicate with the displays and bridges. DSI requires the use of the DSI bus which in turn requires us to set up a custom connector from the display driver. Signed-off-by: Linus Walleij --- drivers/gpu/drm/drm_simple_kms_helper.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c index 917812448d1b..e7499b939235 100644 --- a/drivers/gpu/drm/drm_simple_kms_helper.c +++ b/drivers/gpu/drm/drm_simple_kms_helper.c @@ -266,7 +266,7 @@ int drm_simple_display_pipe_init(struct drm_device *dev, const uint64_t *format_modifiers, struct drm_connector *connector) { - struct drm_encoder *encoder = &pipe->encoder; + struct drm_encoder *encoder; struct drm_plane *plane = &pipe->plane; struct drm_crtc *crtc = &pipe->crtc; int ret; @@ -289,10 +289,23 @@ int drm_simple_display_pipe_init(struct drm_device *dev, if (ret) return ret; - encoder->possible_crtcs = drm_crtc_mask(crtc); - ret = drm_encoder_init(dev, encoder, &drm_simple_kms_encoder_funcs, - DRM_MODE_ENCODER_NONE, NULL); - if (ret || !connector) + /* Other encoder already attached to the connector */ + if (connector->encoder_ids[0] != 0) { + encoder = drm_encoder_find(connector->dev, NULL, + connector->encoder_ids[0]); + encoder->possible_crtcs = drm_crtc_mask(crtc); + DRM_INFO("an encoder is already attached to the connector\n"); + } else { + encoder = &pipe->encoder; + encoder->possible_crtcs = drm_crtc_mask(crtc); + ret = drm_encoder_init(dev, encoder, + &drm_simple_kms_encoder_funcs, + DRM_MODE_ENCODER_NONE, NULL); + if (ret) + return ret; + } + + if (!connector) return ret; return drm_connector_attach_encoder(connector, encoder);