From patchwork Mon Apr 11 08:55:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinliang Liu X-Patchwork-Id: 65489 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp1346462lbl; Mon, 11 Apr 2016 02:01:35 -0700 (PDT) X-Received: by 10.98.89.157 with SMTP id k29mr31302996pfj.4.1460365295406; Mon, 11 Apr 2016 02:01:35 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g29si2373107pfj.135.2016.04.11.02.01.35; Mon, 11 Apr 2016 02:01:35 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@linaro.org; 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; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753894AbcDKJBe (ORCPT + 7 others); Mon, 11 Apr 2016 05:01:34 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:33839 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753484AbcDKJBd (ORCPT ); Mon, 11 Apr 2016 05:01:33 -0400 Received: by mail-pa0-f52.google.com with SMTP id ot11so34392041pab.1 for ; Mon, 11 Apr 2016 02:01:33 -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; bh=NVmlh3xA8+EPq6uJNh0JSHeq9PG95oWdKvkQ9pDXYNg=; b=hLKMLBk752vVV1Oo5ElZMJTqQmJ2T2X94qsPpfWutBtbQdcokXLSZJP8RSCJJZ1MY9 ZYVSazMZOETMUH140yOOwOkdkf6hSyceuhqvdh9WjoF2r2VOQol2okkoSNa9baXsDI96 rwyHymA74e5qacjZWadBQKzX+dx6yYXjnDTd4= 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=NVmlh3xA8+EPq6uJNh0JSHeq9PG95oWdKvkQ9pDXYNg=; b=TOX87hJchSlBg8JVWCDv0y9+jl/ml1o+HORclNqposYGbgygun48dJlomjyYmDFnf1 XCARIsnBRmM5Rznr/W34wAf+RQBEaFSVJBMwnAujFuUG9DX7AbWMHY/qtqGr0ueGn4/J jSJLDmqI6L5vsB9Oq+hTmD4x+XAZiBzUlnslZYXF1RDkQPHwpXwMgGHdyBV+lIXoBf1u Sql53nWXSCRdbXbHBjcTZOFD+6eTxabLDB0O1tk0TBi1KRlB1IwTADoCmTyVLhDibzR3 chcLNjYFsbFWZ1vXtQpAimGlDH1MHeSNhx0VP8+UMFZuv7jRuIN4loM6cReELoC/vkxD RPwA== X-Gm-Message-State: AD7BkJIWjojrEo/XLNQdOo9KKk+ymJ3GFOT7rURihHctSTd+XatXYwq0Qz/LFJEuunanWBYO X-Received: by 10.66.66.167 with SMTP id g7mr30606924pat.111.1460365292637; Mon, 11 Apr 2016 02:01:32 -0700 (PDT) Received: from localhost.localdomain ([14.154.190.52]) by smtp.gmail.com with ESMTPSA id v9sm34360332pfi.50.2016.04.11.02.01.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Apr 2016 02:01:31 -0700 (PDT) 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, mark.rutland@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, guodong.xu@linaro.org, Xinliang Liu Subject: [PATCH v8 08/10] drm/hisilicon: Add designware dsi host driver Date: Mon, 11 Apr 2016 16:55:41 +0800 Message-Id: <1460364943-76135-9-git-send-email-xinliang.liu@linaro.org> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1460364943-76135-1-git-send-email-xinliang.liu@linaro.org> References: <1460364943-76135-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. v8: None. v7: None. v6: None. v5: None. v4: None. v3: None. v2: - Remove abtraction layer. Signed-off-by: Xinliang Liu Signed-off-by: Xinwei Kong Reviewed-by: Archit Taneja --- drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) -- 2.8.0 -- 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 1a930b77ec53..ea7711832959 100644 --- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c +++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c @@ -80,6 +80,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; @@ -654,6 +655,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); @@ -665,6 +711,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; }