From patchwork Fri Feb 26 08:40:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinliang Liu X-Patchwork-Id: 8432971 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 6FA60C0553 for ; Fri, 26 Feb 2016 08:47:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97C7520212 for ; Fri, 26 Feb 2016 08:47:04 +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 520F720115 for ; Fri, 26 Feb 2016 08:47:03 +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 1aZE1Z-0004XI-ND; Fri, 26 Feb 2016 08:45:21 +0000 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aZDzd-0002GI-Uj for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2016 08:43:23 +0000 Received: by mail-pa0-x234.google.com with SMTP id fl4so47732118pad.0 for ; Fri, 26 Feb 2016 00:43:01 -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=1S7sqesdMhGpzKcP2QiOvfR2vOGsmYynpgoR+z/jTjc=; b=b1s/q0PizJ//hKZKspMNlP3X3Ndt83531+uNv1pCAM/HUAPensZ+6SsbUeBRpfJvZD KBWLq9oOK9qY2MJI4qLkkAuft8VSTDAlOxavAyA0kBY0UzXh3hp9R5G7/25e69k0T2w/ VBy3e5rYIINv0ikNp4hIN7U10CyQ529vazMSQ= 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=1S7sqesdMhGpzKcP2QiOvfR2vOGsmYynpgoR+z/jTjc=; b=YkhoMiy+BTxqyRczSZ0Tf909a8E4DU6KuK0bnQQi4cm8hhSfHR2nbvdWuekT3IxlQP OUv/eqxXyK/BGQhpHyFw6HOIreVj3xJHYPaNKOJdU3hMRAk812WYtRVTQVVsYTglG8Ga qT0V5QWHhNn2NGEWNLwMZsXVaLOZwHB6fsCd11M0JZP7YH23ZXCqUWiDEN9PvBy0HZbp EriQDeXmo46TelZUtCO5k6Dyk1OOFoyQNTfx7jWRpiXMaD1yoHhqMOSFsEaigTqNtWVf grbfJxH3E60bi0M7WTP56g2S9mEqeTdJsF5B2CX06b3pLtK2dLPkx+05sR6U5hOcjeGP y9Fw== X-Gm-Message-State: AD7BkJIn5E1IAsTIOuu49Dh8jaCVQIlhDCYUX+LNtG7nS0JALJ0bviWIDs8XDqlx3+LHBG6c X-Received: by 10.66.62.132 with SMTP id y4mr385757par.55.1456476181571; Fri, 26 Feb 2016 00:43:01 -0800 (PST) Received: from localhost.localdomain ([119.139.127.18]) by smtp.gmail.com with ESMTPSA id r68sm17470178pfb.51.2016.02.26.00.42.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Feb 2016 00:43:00 -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, mark.rutland@arm.com Subject: [PATCH v6 08/11] drm/hisilicon: Add designware dsi host driver Date: Fri, 26 Feb 2016 16:40:25 +0800 Message-Id: <1456476028-36880-9-git-send-email-xinliang.liu@linaro.org> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1456476028-36880-1-git-send-email-xinliang.liu@linaro.org> References: <1456476028-36880-1-git-send-email-xinliang.liu@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160226_004322_343100_25116D66 X-CRM114-Status: GOOD ( 13.21 ) X-Spam-Score: -2.0 (--) 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, guodong.xu@linaro.org, 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,RP_MATCHES_RCVD,T_DKIM_INVALID,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 DesignWare dsi host driver for hi6220 SoC. v6: None. v5: None. v4: None. v3: None. v2: - Remove abtraction layer. Signed-off-by: Xinliang Liu Reviewed-by: Archit Taneja --- drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c index 8329148cc89d..f15798b61451 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; }