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: 7716791 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1D1EEBEEE5 for ; Sat, 28 Nov 2015 10:45:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 38ACD205F9 for ; Sat, 28 Nov 2015 10:45:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 55DCC205F7 for ; Sat, 28 Nov 2015 10:45:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a2cyX-00068G-36; Sat, 28 Nov 2015 10:43:29 +0000 Received: from mail-vk0-x230.google.com ([2607:f8b0:400c:c05::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a2cws-0004dn-KO for linux-arm-kernel@lists.infradead.org; Sat, 28 Nov 2015 10:41:48 +0000 Received: by vkha189 with SMTP id a189so79383020vkh.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=LkctIBvONtCLlvf+L6J4jQ4p3uY/YX/yoZMiPd2WgreSU7auE77Y4nJxK9+kPcbrdh 9GIh0bButUCL20WlqEmssEYb23n9ZWzMYziCNZ3OYWmCVHABMn5VU/RwR4FOjWb9pA6t NQuJeDmTN+Q5dM7rb3+VVZ0JukN/CfTQEil5c1p8MR+jWKs6CQzmvTbC1tyLUP5/F3u8 sAGvo20LxjuhEks2ZODT/Snor7XPomh4ILeBaKDYhjG3IDdMCnwH/sOSYQ15DfuykEkr 98Yq2S2D5lxYZRqnFQcesjjUfIQlzo5d227OOaD92JlfalLxm2JkEZjHEY9iAQldTssi VlnQ== X-Gm-Message-State: ALoCoQmfqTj4kYdfhnC0i8xlKSMAy4HC42B5C+/lc7/06Ed4xR32XBesnKLVSDGaGv39Vp8iR1uR 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151128_024147_019191_19BC3A05 X-CRM114-Status: GOOD ( 13.46 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andy.green@linaro.org, xuyiping@hisilicon.com, linux-doc@vger.kernel.org, Xinliang Liu , w.f@huawei.com, zourongrong@huawei.com, linuxarm@huawei.com, xuwei5@hisilicon.com, kong.kongxinwei@hisilicon.com, bintian.wang@huawei.com, haojian.zhuang@linaro.org, benjamin.gaignard@linaro.org, puck.chen@hisilicon.com, lijianhua@huawei.com, liguozhu@hisilicon.com, sumit.semwal@linaro.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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; }