From patchwork Sun Mar 4 10:37:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giulio Benetti X-Patchwork-Id: 10257595 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 73DD860211 for ; Sun, 4 Mar 2018 10:38:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69CBE2878F for ; Sun, 4 Mar 2018 10:38:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E84428793; Sun, 4 Mar 2018 10:38:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D5F342878F for ; Sun, 4 Mar 2018 10:38:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=99z1KRCIp/tuiZxLjToaUilHzoUkn06XnWsvtodGbUU=; b=X2L tayV8IkMa6AXjzeoaiAtrrxKBvIklVMdgjjDDa8M+O0yIEI3+fsavxauPCdHAVTbVrF7a6LCaTaoV CcLdrFlhpO/EdepxRZBqJaZKzTU51tbZ/JTB++sPA3Vj0MOmyp0NMGdajAMWnbT/28Gx1UrqhSrsg 8N5c6HR1JVSyjMGx0wfKAB+aihHBsXwUKK6ps7d9WzmmVKwhbqCVL9rCXu2Jxa2kHmxm3XoKbYDMo m7URl7o2Qg4g5A6IaQd1LwZOipTeucDGkTRokqT9YFqAlQFC0mSmqdlRdZn8675V8AyfBcugCrAIj PrcX51dSAdpJZL+8p94wW5qrQ8mn39A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1esR2G-0004Tp-FZ; Sun, 04 Mar 2018 10:38:32 +0000 Received: from mail.micronovasrl.com ([212.103.203.10]) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1esR2C-0004Rs-EG for linux-arm-kernel@lists.infradead.org; Sun, 04 Mar 2018 10:38:30 +0000 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id CCAFEB0088C for ; Sun, 4 Mar 2018 11:38:07 +0100 (CET) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=x-mailer:message-id:date:date:subject:subject:to:from:from; s=dkim; t=1520159887; x=1521023888; bh=zh+1VanElOqy6Gg0Q4p66zVg mOfugJw+4AZok/BCkZw=; b=eSmtKaSOSodx5uddHdkFy7EvnptMsP1jdi+JGPGQ zHDTgumsSYxzObNp3qLHPS28+rrHBbQIpgRAe2pEKy88bF34K3qTBk/c1ru0xJPb NiMeyDGSErmHJV2jWFXv12qZIMhg0rzomwkjv5/nle0aCvXC/wNKZ8WUQIe3Ie8q ecE= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id mhjFonIQJ3xU for ; Sun, 4 Mar 2018 11:38:07 +0100 (CET) Received: from localhost.localdomain (unknown [192.168.123.31]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 7A99EB0018D; Sun, 4 Mar 2018 11:38:06 +0100 (CET) From: Giulio Benetti To: Maxime Ripard Subject: [PATCH] drm/sun4i: move rgb mode_valid from connector to encoder Date: Sun, 4 Mar 2018 11:37:50 +0100 Message-Id: <1520159870-41286-1-git-send-email-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180304_023828_687804_3EE5F6E0 X-CRM114-Status: UNSURE ( 9.87 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Chen-Yu Tsai , Giulio Benetti , 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-Virus-Scanned: ClamAV using ClamSMTP mode_valid function must be connected to encoder, not connector. Otherwise it doesn't get called by drm. Move mode_valid function pointer to encoder helper functions, changing its prototype according to encoder helper function pointer. Signed-off-by: Giulio Benetti --- drivers/gpu/drm/sun4i/sun4i_rgb.c | 102 +++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c index b8da5a5..6539dcc 100644 --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c @@ -52,11 +52,59 @@ static int sun4i_rgb_get_modes(struct drm_connector *connector) return drm_panel_get_modes(tcon->panel); } -static int sun4i_rgb_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) +static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = { + .get_modes = sun4i_rgb_get_modes, +}; + +static void +sun4i_rgb_connector_destroy(struct drm_connector *connector) { struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector); struct sun4i_tcon *tcon = rgb->tcon; + + drm_panel_detach(tcon->panel); + drm_connector_cleanup(connector); +} + +static const struct drm_connector_funcs sun4i_rgb_con_funcs = { + .fill_modes = drm_helper_probe_single_connector_modes, + .destroy = sun4i_rgb_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, +}; + +static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder) +{ + struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder); + struct sun4i_tcon *tcon = rgb->tcon; + + DRM_DEBUG_DRIVER("Enabling RGB output\n"); + + if (!IS_ERR(tcon->panel)) { + drm_panel_prepare(tcon->panel); + drm_panel_enable(tcon->panel); + } +} + +static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder) +{ + struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder); + struct sun4i_tcon *tcon = rgb->tcon; + + DRM_DEBUG_DRIVER("Disabling RGB output\n"); + + if (!IS_ERR(tcon->panel)) { + drm_panel_disable(tcon->panel); + drm_panel_unprepare(tcon->panel); + } +} + +static enum drm_mode_status sun4i_rgb_encoder_mode_valid(struct drm_encoder *crtc, + const struct drm_display_mode *mode) +{ + struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(crtc); + struct sun4i_tcon *tcon = rgb->tcon; u32 hsync = mode->hsync_end - mode->hsync_start; u32 vsync = mode->vsync_end - mode->vsync_start; unsigned long rate = mode->clock * 1000; @@ -106,58 +154,10 @@ static int sun4i_rgb_mode_valid(struct drm_connector *connector, return MODE_OK; } -static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = { - .get_modes = sun4i_rgb_get_modes, - .mode_valid = sun4i_rgb_mode_valid, -}; - -static void -sun4i_rgb_connector_destroy(struct drm_connector *connector) -{ - struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector); - struct sun4i_tcon *tcon = rgb->tcon; - - drm_panel_detach(tcon->panel); - drm_connector_cleanup(connector); -} - -static const struct drm_connector_funcs sun4i_rgb_con_funcs = { - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = sun4i_rgb_connector_destroy, - .reset = drm_atomic_helper_connector_reset, - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -}; - -static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder) -{ - struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder); - struct sun4i_tcon *tcon = rgb->tcon; - - DRM_DEBUG_DRIVER("Enabling RGB output\n"); - - if (!IS_ERR(tcon->panel)) { - drm_panel_prepare(tcon->panel); - drm_panel_enable(tcon->panel); - } -} - -static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder) -{ - struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder); - struct sun4i_tcon *tcon = rgb->tcon; - - DRM_DEBUG_DRIVER("Disabling RGB output\n"); - - if (!IS_ERR(tcon->panel)) { - drm_panel_disable(tcon->panel); - drm_panel_unprepare(tcon->panel); - } -} - static struct drm_encoder_helper_funcs sun4i_rgb_enc_helper_funcs = { .disable = sun4i_rgb_encoder_disable, .enable = sun4i_rgb_encoder_enable, + .mode_valid = sun4i_rgb_encoder_mode_valid, }; static void sun4i_rgb_enc_destroy(struct drm_encoder *encoder)