From patchwork Sat Feb 6 03:24:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinliang Liu X-Patchwork-Id: 61369 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp321465lbl; Fri, 5 Feb 2016 19:26:19 -0800 (PST) X-Received: by 10.98.19.205 with SMTP id 74mr25013301pft.31.1454729177261; Fri, 05 Feb 2016 19:26:17 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z12si28086471pas.77.2016.02.05.19.26.17; Fri, 05 Feb 2016 19:26:17 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751360AbcBFD0Q (ORCPT + 6 others); Fri, 5 Feb 2016 22:26:16 -0500 Received: from mail-pf0-f177.google.com ([209.85.192.177]:32768 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbcBFD0P (ORCPT ); Fri, 5 Feb 2016 22:26:15 -0500 Received: by mail-pf0-f177.google.com with SMTP id w123so79054118pfb.0 for ; Fri, 05 Feb 2016 19:26:15 -0800 (PST) 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; bh=88rNis8iP1BwmmUwNdw04UC61u6TDGsyDldo2f9nSE8=; b=ErCt6d9+qgogCPpcHYqZVtTj+GtbE0lNTAgdId0t3Da8JC44zDSSk4xHRQM9xKirC+ E92BAeTI6dEcv6bUd8Bwz6V/1nE3KUzd84yVJz8LJJVZPX7CW3T3X010IWEXaLnhHVXR tEmGbMkNDTEewf5KmUcfPWUSXoUZQrssoYcP0= 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=88rNis8iP1BwmmUwNdw04UC61u6TDGsyDldo2f9nSE8=; b=dV/+dX0LM3bsIu6AZIx7QJcat9/6a4yZE7xbpFECNxiLSLii0s9zTLs7aeYf6j3UJW Gqgw/7zUULaPIE1zk8WoIUaKBFdSbONc378/vLnQgdUtvZVLzvNd5w6+aqNyoRm6fqb3 fi+bSd4foxadG0Nr4OrXOCD9QBhIrxV8bBScQ9w7t3YLus3SaKGBLFxbmxvaH0XHhJla /Bm0K92+dUHEaO1w/DNQP6yyGY+zDnHct9+xhg8iD/AhMt4QcaC/q606ZKoWehAFY2pD qJotC6zwCd0w9vcE05SP8IYapPyVw5CPtVoZeDxexSscV3WOt5mOqiE6A76Wkdq0PX9f 0rDg== X-Gm-Message-State: AG10YOQxzrF1oePaX/pmN61BCYjccvL18uwjJ0ickLVpQEdRtC/o6p1KBNcFoknmP7+yFub4 X-Received: by 10.98.8.80 with SMTP id c77mr3224627pfd.42.1454729175164; Fri, 05 Feb 2016 19:26:15 -0800 (PST) Received: from localhost.localdomain ([219.134.80.72]) by smtp.gmail.com with ESMTPSA id a21sm27472023pfj.40.2016.02.05.19.26.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Feb 2016 19:26:14 -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, emil.l.velikov@gmail.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, guodong.xu@linaro.org, Xinliang Liu Subject: [PATCH v4 08/11] drm/hisilicon: Add designware dsi host driver Date: Sat, 6 Feb 2016 11:24:55 +0800 Message-Id: <1454729098-79807-9-git-send-email-xinliang.liu@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454729098-79807-1-git-send-email-xinliang.liu@linaro.org> References: <1454729098-79807-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 DesignWare dsi host driver for hi6220 SoC. v4: None. v3: None. v2: - Remove abtraction layer. Signed-off-by: Xinliang Liu --- drivers/gpu/drm/hisilicon/kirin/dw_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/kirin/dw_drm_dsi.c b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c index 7c9423537b71..2837af01e935 100644 --- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c +++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c @@ -79,6 +79,7 @@ struct dsi_hw_ctx { struct dw_dsi { struct drm_encoder encoder; + struct mipi_dsi_host host; struct drm_display_mode cur_mode; struct dsi_hw_ctx *ctx; struct mipi_phy_params phy; @@ -642,6 +643,51 @@ static int dw_drm_encoder_init(struct device *dev, return 0; } +static int dsi_host_attach(struct mipi_dsi_host *host, + struct mipi_dsi_device *mdsi) +{ + struct dw_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 const 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 dw_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); @@ -653,6 +699,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; }