From patchwork Sat Nov 28 10:39:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinliang Liu X-Patchwork-Id: 7716671 Return-Path: X-Original-To: patchwork-dri-devel@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 A1D0D9F1C0 for ; Sat, 28 Nov 2015 10:41:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B889A205FC for ; Sat, 28 Nov 2015 10:41:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C01CB205F7 for ; Sat, 28 Nov 2015 10:41:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E10BE6E212; Sat, 28 Nov 2015 02:41:09 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vk0-f52.google.com (mail-vk0-f52.google.com [209.85.213.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id B7B636E212 for ; Sat, 28 Nov 2015 02:41:08 -0800 (PST) Received: by vkay187 with SMTP id y187so79399222vka.3 for ; Sat, 28 Nov 2015 02:41:08 -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=V+CNlLm8K1cfyiO+2gRSczI2Mvt02OlCwycLFuse67U=; b=GGGmcOAU5MxqsD4kB+Z4ni2sbUA56lx/e/AekjdEb1s67rbTDJAFwMdwZ8h6PfYxxs xprAORIifcqwX4643SaVaDVpit38BIeOXwVJi5vY/VFphRf3WmPluyPVgViOQh1oOMd2 P7ogAmspG+PxH11ZAtGQng0gl/hTkGpGNEXS501JyYsdCf4MDHlO2n3jkEuWpo8Vygb0 LS4wdjAMNWbQ5j+PDVtCw+UFyOkjDHLRW+aPQQgfSenbcAjLQPyjotyjh7EPWwNN4yuK oTD9Fj1eT7jbCi2URkFBjm5vfmO1jF6rGVBBDYp0QaU+x7/OOUgwDTngrSxfO3tHy38l EwZg== 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=V+CNlLm8K1cfyiO+2gRSczI2Mvt02OlCwycLFuse67U=; b=W7BtWwIUmi8Z4giu9bvhKAPNfbyIjRKwEYZTJbvgSt2vmXJHjoo5ajRFpnRzK6ddyh MupIh3wkVEpO7OkyPYanODTpyCg2wCs3HlmeQ6JTfa4UTfaN8zomFpDWwk8v48WEKfGn WJ5T0mMFEqbPCCc+zzQYR8AwYElGhPtB1P8txdte+jhmLRQqwAz+Yqt76xo+2UxhtmPd kb92pkse3sEhu0nr2Yn2XbV5f3fEjHb5Gb6MjU8zyevgDxmqdee342t1NNlQjWH4neSt geSxpNLPUpGcNrYre+6lkmann6RN6od2KElnM/738om3Sh69+21VYekopqbuoVd/QluX DXWg== X-Gm-Message-State: ALoCoQl3/mafA0ingBMSzIgqm7DYU0/swncMnoUsPGeG8yBlKIQolr/08WMciDlsDxWSljQSEVKf X-Received: by 10.31.190.211 with SMTP id o202mr47939802vkf.100.1448707267952; Sat, 28 Nov 2015 02:41:07 -0800 (PST) Received: from localhost.localdomain ([14.153.35.143]) by smtp.gmail.com with ESMTPSA id o135sm19989822vkd.3.2015.11.28.02.40.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 28 Nov 2015 02:41:07 -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 07/10] drm/hisilicon: Add cma fbdev and hotplug Date: Sat, 28 Nov 2015 18:39:02 +0800 Message-Id: <1448707145-69348-8-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 cma Fbdev, Fbdev is legency and optional, you can enable/disable it by configuring DRM_FBDEV_EMULATION. Add hotplug. Signed-off-by: Xinliang Liu Signed-off-by: Xinwei Kong Signed-off-by: Andy Green --- drivers/gpu/drm/hisilicon/hisi_drm_drv.c | 34 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/hisilicon/hisi_drm_drv.h | 3 +++ 2 files changed, 37 insertions(+) diff --git a/drivers/gpu/drm/hisilicon/hisi_drm_drv.c b/drivers/gpu/drm/hisilicon/hisi_drm_drv.c index 13f59aa..76eb711 100644 --- a/drivers/gpu/drm/hisilicon/hisi_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/hisi_drm_drv.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "hisi_drm_ade.h" #include "hisi_drm_drv.h" @@ -30,6 +31,13 @@ static int hisi_drm_unload(struct drm_device *dev) { struct hisi_drm_private *priv = dev->dev_private; +#ifdef CONFIG_DRM_FBDEV_EMULATION + if (priv->fbdev) { + drm_fbdev_cma_fini(priv->fbdev); + priv->fbdev = NULL; + } +#endif + drm_kms_helper_poll_fini(dev); drm_vblank_cleanup(dev); drm_mode_config_cleanup(dev); devm_kfree(dev->dev, priv); @@ -38,8 +46,28 @@ static int hisi_drm_unload(struct drm_device *dev) return 0; } +#ifdef CONFIG_DRM_FBDEV_EMULATION +static void hisi_fbdev_output_poll_changed(struct drm_device *dev) +{ + struct hisi_drm_private *priv = dev->dev_private; + + if (priv->fbdev) { + drm_fbdev_cma_hotplug_event(priv->fbdev); + } else { + priv->fbdev = drm_fbdev_cma_init(dev, 32, + dev->mode_config.num_crtc, + dev->mode_config.num_connector); + if (IS_ERR(priv->fbdev)) + priv->fbdev = NULL; + } +} +#endif + static const struct drm_mode_config_funcs hisi_drm_mode_config_funcs = { .fb_create = drm_fb_cma_create, +#ifdef CONFIG_DRM_FBDEV_EMULATION + .output_poll_changed = hisi_fbdev_output_poll_changed, +#endif .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, }; @@ -90,6 +118,12 @@ static int hisi_drm_load(struct drm_device *dev, unsigned long flags) /* reset all the states of crtc/plane/encoder/connector */ drm_mode_config_reset(dev); + /* init kms poll for handling hpd */ + drm_kms_helper_poll_init(dev); + + /* force detection after connectors init */ + (void)drm_helper_hpd_irq_event(dev); + return 0; err_unbind_all: diff --git a/drivers/gpu/drm/hisilicon/hisi_drm_drv.h b/drivers/gpu/drm/hisilicon/hisi_drm_drv.h index a10229e..984121f 100644 --- a/drivers/gpu/drm/hisilicon/hisi_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/hisi_drm_drv.h @@ -11,6 +11,9 @@ #define __HISI_DRM_DRV_H__ struct hisi_drm_private { +#ifdef CONFIG_DRM_FBDEV_EMULATION + struct drm_fbdev_cma *fbdev; +#endif }; #endif /* __HISI_DRM_DRV_H__ */