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: 7716691 Return-Path: X-Original-To: patchwork-dri-devel@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 86B2DBEEE1 for ; Sat, 28 Nov 2015 10:41:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 216DE205F7 for ; Sat, 28 Nov 2015 10:41:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2FEB7205F9 for ; Sat, 28 Nov 2015 10:41:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E8A96E214; Sat, 28 Nov 2015 02:41:28 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vk0-f46.google.com (mail-vk0-f46.google.com [209.85.213.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7DB426E214 for ; Sat, 28 Nov 2015 02:41:26 -0800 (PST) Received: by vkha189 with SMTP id a189so79383018vkh.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=SXSAiH7hBAMPfTdKK9gQ2Awn98+OwfP16ZkzcgsLGD1UqPgAz1He/+F+m3xGFn4+FD bzEkqRwPu6SqM6GIoUnvNSw3BHe35bGfinZWcaKF2FfJyOnAkdpRdVbU9Kf5wHKWZaT/ JofNJ3mI4EEZ7vCHcMwydV7Nb6VBLbPm9D7Uy3lVzwAy0qF7Yv3FWV4v+KnrvR21d/Wf 94O8Xv/6nUuPRFL4nrlrFV710b/uzct/8fHs6P356UV37poLE21GlAb5BtK2GpaC77y3 b/gGNjzE91dPydwVsiNfBSeaQx5pUDVU/wV23TIZSUX0jRKoQCmU3wmI4Z81N09pPsW2 LZ4A== X-Gm-Message-State: ALoCoQlW0620eAV4IueURSDXKqhrW59Nl0yoEqMfKdC1Od1UGA9CWAQzo/d0wv4PKH+Nytb3vLAz 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> Cc: andy.green@linaro.org, xuyiping@hisilicon.com, linux-doc@vger.kernel.org, w.f@huawei.com, zourongrong@huawei.com, linuxarm@huawei.com, xuwei5@hisilicon.com, bintian.wang@huawei.com, haojian.zhuang@linaro.org, benjamin.gaignard@linaro.org, puck.chen@hisilicon.com, lijianhua@huawei.com, liguozhu@hisilicon.com, linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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; }