From patchwork Thu Jan 2 21:28:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 3431841 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5A53CC02DC for ; Fri, 3 Jan 2014 15:23:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11DA720108 for ; Fri, 3 Jan 2014 15:23:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 664782010C for ; Fri, 3 Jan 2014 15:23:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A89DFAAE3; Fri, 3 Jan 2014 07:23:28 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pandora.arm.linux.org.uk (gw-1.arm.linux.org.uk [78.32.30.217]) by gabe.freedesktop.org (Postfix) with ESMTP id DF354FB913 for ; Thu, 2 Jan 2014 13:31:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora; h=Date:Sender:Message-Id:Subject:Cc:To:From:References:In-Reply-To; bh=QX95PtCGSOvNjAyW29ObTxkDWDiCEtg0Cll7aGxpQgY=; b=BQChr3km8KnquwjLmTBvJ+ZwL4TeF2Ob9UhY0TSz1Yl36aKVmi4FtTdsxIBezBHA9tQSOpOxNHKxrB7vjY2GvwImonQP5Q/vHldfDJJ7aXu0lSQtk/VnZ4rvPxiTmVgMhPhdYiPgfOzMWH2W/TQmgQ6HXUaWFl0df9kknF77zrE=; Received: from [2001:4d48:ad52:3201:222:68ff:fe15:37dd] (port=58620 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1Vypow-0004Bg-BK; Thu, 02 Jan 2014 21:28:50 +0000 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1Vypov-0007Fv-Pp; Thu, 02 Jan 2014 21:28:49 +0000 In-Reply-To: <20140102212528.GD7383@n2100.arm.linux.org.uk> References: <20140102212528.GD7383@n2100.arm.linux.org.uk> From: Russell King To: David Airlie , Greg Kroah-Hartman , Sascha Hauer , Shawn Guo Subject: [PATCH RFC 36/46] imx-drm: imx-hdmi: initialise drm components directly Message-Id: Date: Thu, 02 Jan 2014 21:28:49 +0000 X-Mailman-Approved-At: Fri, 03 Jan 2014 07:21:55 -0800 Cc: devel@driverdev.osuosl.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 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 Signed-off-by: Russell King --- drivers/staging/imx-drm/imx-hdmi.c | 56 +++++++++-------------------------- 1 files changed, 15 insertions(+), 41 deletions(-) diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c index d81940a8904f..512b39710530 100644 --- a/drivers/staging/imx-drm/imx-hdmi.c +++ b/drivers/staging/imx-drm/imx-hdmi.c @@ -117,9 +117,7 @@ struct hdmi_data_info { struct imx_hdmi { struct drm_connector connector; - struct imx_drm_connector *imx_drm_connector; struct drm_encoder encoder; - struct imx_drm_encoder *imx_drm_encoder; enum imx_hdmi_devtype dev_type; struct device *dev; @@ -1382,10 +1380,6 @@ static enum drm_connector_status imx_hdmi_connector_detect(struct drm_connector return connector_status_connected; } -static void imx_hdmi_connector_destroy(struct drm_connector *connector) -{ -} - static int imx_hdmi_connector_get_modes(struct drm_connector *connector) { struct imx_hdmi *hdmi = container_of(connector, struct imx_hdmi, @@ -1471,13 +1465,8 @@ static void imx_hdmi_encoder_commit(struct drm_encoder *encoder) imx_hdmi_poweron(hdmi); } -static void imx_hdmi_encoder_destroy(struct drm_encoder *encoder) -{ - return; -} - static struct drm_encoder_funcs imx_hdmi_encoder_funcs = { - .destroy = imx_hdmi_encoder_destroy, + .destroy = imx_drm_encoder_destroy, }; static struct drm_encoder_helper_funcs imx_hdmi_encoder_helper_funcs = { @@ -1493,7 +1482,7 @@ static struct drm_connector_funcs imx_hdmi_connector_funcs = { .dpms = drm_helper_connector_dpms, .fill_modes = drm_helper_probe_single_connector_modes, .detect = imx_hdmi_connector_detect, - .destroy = imx_hdmi_connector_destroy, + .destroy = imx_drm_connector_destroy, }; static struct drm_connector_helper_funcs imx_hdmi_connector_helper_funcs = { @@ -1533,34 +1522,23 @@ static irqreturn_t imx_hdmi_irq(int irq, void *dev_id) return IRQ_HANDLED; } -static int imx_hdmi_register(struct imx_hdmi *hdmi) +static int imx_hdmi_register(struct drm_device *drm, struct imx_hdmi *hdmi) { int ret; - hdmi->connector.funcs = &imx_hdmi_connector_funcs; - hdmi->encoder.funcs = &imx_hdmi_encoder_funcs; - - hdmi->encoder.encoder_type = DRM_MODE_ENCODER_TMDS; - hdmi->connector.connector_type = DRM_MODE_CONNECTOR_HDMIA; + ret = imx_drm_encoder_parse_of(drm, &hdmi->encoder, + hdmi->dev->of_node); + if (ret) + return ret; drm_encoder_helper_add(&hdmi->encoder, &imx_hdmi_encoder_helper_funcs); - ret = imx_drm_add_encoder(&hdmi->encoder, &hdmi->imx_drm_encoder, - THIS_MODULE); - if (ret) { - dev_err(hdmi->dev, "adding encoder failed: %d\n", ret); - return ret; - } + drm_encoder_init(drm, &hdmi->encoder, &imx_hdmi_encoder_funcs, + DRM_MODE_ENCODER_TMDS); drm_connector_helper_add(&hdmi->connector, &imx_hdmi_connector_helper_funcs); - - ret = imx_drm_add_connector(&hdmi->connector, - &hdmi->imx_drm_connector, THIS_MODULE); - if (ret) { - imx_drm_remove_encoder(hdmi->imx_drm_encoder); - dev_err(hdmi->dev, "adding connector failed: %d\n", ret); - return ret; - } + drm_connector_init(drm, &hdmi->connector, &imx_hdmi_connector_funcs, + DRM_MODE_CONNECTOR_HDMIA); hdmi->connector.encoder = &hdmi->encoder; @@ -1592,6 +1570,7 @@ static int imx_hdmi_bind(struct device *dev, struct device *master, void *data) struct platform_device *pdev = to_platform_device(dev); const struct of_device_id *of_id = of_match_device(imx_hdmi_dt_ids, dev); + struct drm_device *drm = data; struct device_node *np = dev->of_node; struct device_node *ddc_node; struct imx_hdmi *hdmi; @@ -1699,12 +1678,10 @@ static int imx_hdmi_bind(struct device *dev, struct device *master, void *data) if (ret) goto err_iahb; - ret = imx_hdmi_register(hdmi); + ret = imx_hdmi_register(drm, hdmi); if (ret) goto err_iahb; - imx_drm_encoder_add_possible_crtcs(hdmi->imx_drm_encoder, np); - dev_set_drvdata(dev, hdmi); return 0; @@ -1721,12 +1698,9 @@ static void imx_hdmi_unbind(struct device *dev, struct device *master, void *data) { struct imx_hdmi *hdmi = dev_get_drvdata(dev); - struct drm_connector *connector = &hdmi->connector; - struct drm_encoder *encoder = &hdmi->encoder; - drm_mode_connector_detach_encoder(connector, encoder); - imx_drm_remove_connector(hdmi->imx_drm_connector); - imx_drm_remove_encoder(hdmi->imx_drm_encoder); + hdmi->connector.funcs->destroy(&hdmi->connector); + hdmi->encoder.funcs->destroy(&hdmi->encoder); clk_disable_unprepare(hdmi->iahb_clk); clk_disable_unprepare(hdmi->isfr_clk);