From patchwork Tue Sep 15 09:37:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinwei Kong X-Patchwork-Id: 7183051 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6CCA49F336 for ; Tue, 15 Sep 2015 09:44:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1CF4520569 for ; Tue, 15 Sep 2015 09:44:32 +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 C7B9120553 for ; Tue, 15 Sep 2015 09:44:29 +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 1Zbmkt-0006sQ-IR; Tue, 15 Sep 2015 09:42:27 +0000 Received: from szxga03-in.huawei.com ([119.145.14.66]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zbmkk-0006GJ-DM for linux-arm-kernel@lists.infradead.org; Tue, 15 Sep 2015 09:42:23 +0000 Received: from 172.24.1.50 (EHLO SZXEML424-HUB.china.huawei.com) ([172.24.1.50]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BMY28259; Tue, 15 Sep 2015 17:37:40 +0800 (CST) Received: from localhost (10.46.72.58) by SZXEML424-HUB.china.huawei.com (10.82.67.153) with Microsoft SMTP Server id 14.3.235.1; Tue, 15 Sep 2015 17:37:31 +0800 From: Xinwei Kong To: , , , Subject: [PATCH RFC 5/8] drm: hisilicon: fill interface function of encoder\connector part Date: Tue, 15 Sep 2015 17:37:11 +0800 Message-ID: <1442309834-21420-6-git-send-email-kong.kongxinwei@hisilicon.com> X-Mailer: git-send-email 1.9.4.msysgit.2 In-Reply-To: <1442309834-21420-1-git-send-email-kong.kongxinwei@hisilicon.com> References: <1442309834-21420-1-git-send-email-kong.kongxinwei@hisilicon.com> MIME-Version: 1.0 X-Originating-IP: [10.46.72.58] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.55F7E6E5.026D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3824eb4742523985ed8c262b535c470a X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150915_024219_403063_60A5C48E X-CRM114-Status: GOOD ( 21.01 ) X-Spam-Score: -4.2 (----) 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: linux-doc@vger.kernel.org, xinliang.liu@linaro.org, w.f@huawei.com, linuxarm@huawei.com, dri-devel@lists.freedesktop.org, haojian.zhuang@linaro.org, benjamin.gaignard@linaro.org, james.yanglong@hisilicon.com, yinshengbao@hisilicon.com, xuyiping@hisilicon.com, yimin@huawei.com, xuwei5@hisilicon.com, kong.kongxinwei@hisilicon.com, qijiwen@hisilicon.com, devicetree@vger.kernel.org, bintian.wang@huawei.com, puck.chen@hisilicon.com, yanhaifeng@hisilicon.com, fangdechun@hisilicon.com, linux-arm-kernel@lists.infradead.org, andy.green@linaro.org, gongyu@hisilicon.com, linux-kernel@vger.kernel.org, ml.yang@hisilicon.com, liguozhu@hisilicon.com 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 This patch enables the adv7533 module which is connecting hisilicon SOC by dsi module. while using DSI module and adv7533 module to implement the encoder/connector interface of DRM\KMS. Signed-off-by: Xinliang Liu Signed-off-by: Xinwei Kong Signed-off-by: Andy Green Signed-off-by: Jiwen Qi Signed-off-by: Yu Gong --- drivers/gpu/drm/hisilicon/Kconfig | 10 + drivers/gpu/drm/hisilicon/hisi_drm_connector.c | 34 ++ drivers/gpu/drm/hisilicon/hisi_drm_connector.h | 8 + drivers/gpu/drm/hisilicon/hisi_drm_dsi.c | 670 +++++++++++++++++++++++++ drivers/gpu/drm/hisilicon/hisi_drm_encoder.c | 52 ++ drivers/gpu/drm/hisilicon/hisi_drm_encoder.h | 19 + drivers/gpu/drm/hisilicon/hisi_dsi_reg.h | 91 ++++ 7 files changed, 884 insertions(+) create mode 100644 drivers/gpu/drm/hisilicon/hisi_dsi_reg.h diff --git a/drivers/gpu/drm/hisilicon/Kconfig b/drivers/gpu/drm/hisilicon/Kconfig index 60b42e4..105dbcb 100644 --- a/drivers/gpu/drm/hisilicon/Kconfig +++ b/drivers/gpu/drm/hisilicon/Kconfig @@ -7,3 +7,13 @@ config DRM_HISI Choose this option if you have a hisilicon terminal chipset. If M is selected the module will be called hisi-drm. +if DRM_HISI + +config DRM_HISI_HAS_SLAVE_ENCODER + bool "Support slave encoder output" + default y + help + Support slave encoder output device such as DSI interface connecting + HDMI converter by i2c. + +endif diff --git a/drivers/gpu/drm/hisilicon/hisi_drm_connector.c b/drivers/gpu/drm/hisilicon/hisi_drm_connector.c index 62efdc7..57ab2e8 100644 --- a/drivers/gpu/drm/hisilicon/hisi_drm_connector.c +++ b/drivers/gpu/drm/hisilicon/hisi_drm_connector.c @@ -23,8 +23,21 @@ int hisi_drm_connector_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { + struct hisi_connector *hconnector = to_hisi_connector(connector); + struct drm_encoder *encoder = hconnector->encoder; + struct hisi_connector_funcs *ops = hconnector->ops; + struct drm_encoder_slave_funcs *sfuncs = get_slave_funcs(encoder); int ret = MODE_OK; + if (ops->modes_valid) + ops->modes_valid(connector); + + if (sfuncs && sfuncs->mode_valid) { + ret = sfuncs->mode_valid(encoder, mode); + if (ret != MODE_OK) + return ret; + } + return ret; } @@ -39,8 +52,19 @@ hisi_drm_best_encoder(struct drm_connector *connector) int hisi_drm_get_modes(struct drm_connector *connector) { + struct hisi_connector *hconnector = to_hisi_connector(connector); + struct hisi_connector_funcs *ops = hconnector->ops; + struct drm_encoder *encoder = hconnector->encoder; + struct drm_encoder_slave_funcs *sfuncs = get_slave_funcs(encoder); int count = 0; + if (ops->get_modes) { + count += ops->get_modes(connector); + } else { + if (sfuncs && sfuncs->get_modes) + count += sfuncs->get_modes(encoder, connector); + } + return count; } @@ -59,8 +83,18 @@ void hisi_drm_connector_destroy(struct drm_connector *connector) enum drm_connector_status hisi_drm_detect(struct drm_connector *connector, bool force) { + struct hisi_connector *hconnector = to_hisi_connector(connector); + struct drm_encoder *encoder = hconnector->encoder; + struct hisi_connector_funcs *ops = hconnector->ops; + struct drm_encoder_slave_funcs *sfuncs = get_slave_funcs(encoder); enum drm_connector_status status = connector_status_unknown; + if (ops->detect) + ops->detect(connector); + + if (sfuncs && sfuncs->detect) + status = sfuncs->detect(encoder, connector); + return status; } diff --git a/drivers/gpu/drm/hisilicon/hisi_drm_connector.h b/drivers/gpu/drm/hisilicon/hisi_drm_connector.h index 114391c..a8b8409 100644 --- a/drivers/gpu/drm/hisilicon/hisi_drm_connector.h +++ b/drivers/gpu/drm/hisilicon/hisi_drm_connector.h @@ -13,9 +13,17 @@ #ifndef __HISI_DRM_CONNECTOR_H__ #define __HISI_DRM_CONNECTOR_H__ +struct hisi_connector_funcs { + enum drm_connector_status + (*detect) (struct drm_connector *connector); + int (*get_modes)(struct drm_connector *connector); + int (*modes_valid)(struct drm_connector *connector); +}; + struct hisi_connector { struct drm_connector connector; struct drm_encoder *encoder; + void *ops; }; void hisi_drm_connector_init(struct drm_device *dev, diff --git a/drivers/gpu/drm/hisilicon/hisi_drm_dsi.c b/drivers/gpu/drm/hisilicon/hisi_drm_dsi.c index 046fd8e..8509ced 100644 --- a/drivers/gpu/drm/hisilicon/hisi_drm_dsi.c +++ b/drivers/gpu/drm/hisilicon/hisi_drm_dsi.c @@ -12,18 +12,72 @@ #include #include +#include