From patchwork Sat Nov 28 10:39:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinliang Liu X-Patchwork-Id: 57384 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp366144lbb; Sat, 28 Nov 2015 02:41:28 -0800 (PST) X-Received: by 10.98.68.83 with SMTP id r80mr54605361pfa.120.1448707288008; Sat, 28 Nov 2015 02:41:28 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y17si14199265pfa.33.2015.11.28.02.41.27; Sat, 28 Nov 2015 02:41:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751844AbbK1Kl1 (ORCPT + 6 others); Sat, 28 Nov 2015 05:41:27 -0500 Received: from mail-vk0-f49.google.com ([209.85.213.49]:35652 "EHLO mail-vk0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751428AbbK1Kl0 (ORCPT ); Sat, 28 Nov 2015 05:41:26 -0500 Received: by vkha189 with SMTP id a189so79383019vkh.2 for ; Sat, 28 Nov 2015 02:41:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gzwCnhiYZn4LusZEbA1tBmbCXcpEcRoNrZlODGSrE8s=; b=Xo37NCa5ZL/R3KjUFrgkgu4fG5RlwZx2uMK4ixShGFaTDQnHDGSAIBLIORRAupB3w0 GLEvEECBhclrRf65gmlmIzvZ+GKQ7tSES0RxTeWtaeVKT1sbDtFAmZ/Vwlnb6pOt2/gp kU+KNLKLka8P8FRefD3t27FOXnVkHSqKB6FuZ56gf/zkq4HDs57VNvuIt9PCgeIFRtAa /+fWEA0lNiHyTlN8WYr9w+ADQe1hc4euFkQ+NZCZLTOfkVi9uSMvrpsZ1coa+PW1PyIH uYgcDQ57DYC+3iR9MF6Pc3lTHdgy2W7OoIp68yFeLCmxDvdeaqgpgTUsEvYh9vRl2vHw 8gvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gzwCnhiYZn4LusZEbA1tBmbCXcpEcRoNrZlODGSrE8s=; b=mEBBYS8jGEenWSRVQufQb7/HwKR5Nctcti1dTqaAYo/VdoijevS1fdpTATQ6iLfNtx qRkt08+tUCXvxTHFaZJt1RzC9Ou01hqNwjhdVeZk1jx7OlAkcxM4AozWwTf7xUWJReCd AA0jou7P/naWxbgwBZlP+krVn2hUGU3va4FBkfmrDQIlUe8ZaPVfy4rLqr3otimm6Z6j u08HLLZ99E6msRYyMtXo8KVD+tPlKyRqjg1eA811QFVrUF1d4xe876ZpdQUA2ATlsGnz sC0Hkq8OJQvqcBMDJ8hAyZ9h74sFmgyW9z0+LhJld+moKocVarUiaQsj9QkVm7UgqWHq +I3A== X-Gm-Message-State: ALoCoQlqlbJr5Cq8wMWT9RBsV1KoWEK6xCg+n6C5HB3kZLAWqawX1J2YhMcqQb3C1E4RmZOeEDc/ X-Received: by 10.31.6.193 with SMTP id 184mr46555032vkg.105.1448707285767; Sat, 28 Nov 2015 02:41:25 -0800 (PST) Received: from localhost.localdomain ([14.153.35.143]) by smtp.gmail.com with ESMTPSA id o135sm19989822vkd.3.2015.11.28.02.41.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 28 Nov 2015 02:41:25 -0800 (PST) From: Xinliang Liu To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, daniel@ffwll.ch, robh@kernel.org, daniel@fooishbar.org, architt@codeaurora.org, airlied@linux.ie, corbet@lwn.net, catalin.marinas@arm.com, will.deacon@arm.com Cc: linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com, andy.green@linaro.org, haojian.zhuang@linaro.org, liguozhu@hisilicon.com, xuwei5@hisilicon.com, w.f@huawei.com, puck.chen@hisilicon.com, bintian.wang@huawei.com, benjamin.gaignard@linaro.org, xuyiping@hisilicon.com, kong.kongxinwei@hisilicon.com, zourongrong@huawei.com, lijianhua@huawei.com, sumit.semwal@linaro.org, Xinliang Liu Subject: [PATCH v2 09/10] drm/hisilicon: Add dsi host driver Date: Sat, 28 Nov 2015 18:39:04 +0800 Message-Id: <1448707145-69348-10-git-send-email-xinliang.liu@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448707145-69348-1-git-send-email-xinliang.liu@linaro.org> References: <1448707145-69348-1-git-send-email-xinliang.liu@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add dsi host driver for hi6220 SoC. Signed-off-by: Xinliang Liu Signed-off-by: Xinwei Kong Signed-off-by: Andy Green --- drivers/gpu/drm/hisilicon/hisi_drm_dsi.c | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpu/drm/hisilicon/hisi_drm_dsi.c b/drivers/gpu/drm/hisilicon/hisi_drm_dsi.c index 7a6cf66..066e08d 100644 --- a/drivers/gpu/drm/hisilicon/hisi_drm_dsi.c +++ b/drivers/gpu/drm/hisilicon/hisi_drm_dsi.c @@ -78,6 +78,7 @@ struct dsi_hw_ctx { struct hisi_dsi { struct drm_encoder encoder; + struct mipi_dsi_host host; struct drm_display_mode cur_mode; struct dsi_hw_ctx *ctx; struct mipi_phy_register phy; @@ -625,6 +626,51 @@ static int hisi_drm_encoder_init(struct drm_device *dev, return 0; } +static int dsi_host_attach(struct mipi_dsi_host *host, + struct mipi_dsi_device *mdsi) +{ + struct hisi_dsi *dsi = host_to_dsi(host); + + if (mdsi->lanes < 1 || mdsi->lanes > 4) { + DRM_ERROR("dsi device params invalid\n"); + return -EINVAL; + } + + dsi->lanes = mdsi->lanes; + dsi->format = mdsi->format; + dsi->mode_flags = mdsi->mode_flags; + + return 0; +} + +static int dsi_host_detach(struct mipi_dsi_host *host, + struct mipi_dsi_device *mdsi) +{ + /* do nothing */ + return 0; +} + +static struct mipi_dsi_host_ops dsi_host_ops = { + .attach = dsi_host_attach, + .detach = dsi_host_detach, +}; + +static int dsi_host_init(struct device *dev, struct hisi_dsi *dsi) +{ + struct mipi_dsi_host *host = &dsi->host; + int ret; + + host->dev = dev; + host->ops = &dsi_host_ops; + ret = mipi_dsi_host_register(host); + if (ret) { + DRM_ERROR("failed to register dsi host\n"); + return ret; + } + + return 0; +} + static int dsi_bind(struct device *dev, struct device *master, void *data) { struct dsi_data *ddata = dev_get_drvdata(dev); @@ -636,6 +682,10 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) if (ret) return ret; + ret = dsi_host_init(dev, dsi); + if (ret) + return ret; + return 0; }