Received: by 10.223.185.116 with SMTP id b49csp1478926wrg; Sun, 4 Mar 2018 02:53:06 -0800 (PST) X-Google-Smtp-Source: AG47ELuwcCTiLiYR/lADerw6xRMX1znffRYEzsqdTgjWWHfrC5gFeqfyp80XsRAzfzi9ONa2RBzO X-Received: by 10.99.110.131 with SMTP id j125mr9438526pgc.382.1520160786306; Sun, 04 Mar 2018 02:53:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520160786; cv=none; d=google.com; s=arc-20160816; b=OAlnrDVyg+r8hKHBFNEiGfG3RrkjUHdzm4ofqI9dMQZ8FSzt0ML5Mn24NoP9V8m4J/ N9mfLo3zFPph9HcuKx0BFC7Z3L7EnlzdzBx3LKg6DBjpXjBSzvlCnJzqKN7elgEjsSVc u2RpIT9N2mXAi6X8XGTn2PymnoYcuWh8Np06BEizFh8XB+rfpC1yONEFvi0UgK7OZNKJ grl7WlPoWfP8hEF71RGb2uJQ7UgTNsBYRHSNK9b3ExLYebEH4f0bEQm831YqMM+UlzmY fIG13Sc4OakcIEqto7KUETYS0mp+Jvb7AUlHOyjKHyp7VB3XDFI+y6ko4hNuW5LsrJFS mI+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Y7ht9jy+v6xJOZob2z9aW0kjv3ddXi8YThZjM0ABX6I=; b=Ra54rivXMilMiNo/byReeqFh/qzYCFRWM+pm/iCIP7hkJSZz92opMTCRexG57o2OxS XR8j+DKf4v0uGox4mrW/pAhNDNqdwLcbss5LpMaJ2BDWpVLfnd+magVkXBQUbchC9e5J zFMyLxh5PKVRRlQcMPwgfX4kXecegzr2ZSlTWufmQsH1jdJ0jwffi69+gbfSdQm8IBon sbJgXG8nOZdgb16QSg8d9SsvM6XkvrzlxO2YYRylwIyVGhFF954/sRAo6Tjx5tiWGAqg zQ6CzMqZPONUbAOcX5Twkm9iUSVnPVx+OpmLVUcv95cKOuD3O1BJtEBG926if3nt4mBm kAIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=eSmtKaSO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8si8190437pfi.117.2018.03.04.02.52.38; Sun, 04 Mar 2018 02:53:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=eSmtKaSO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752577AbeCDKiL (ORCPT + 99 others); Sun, 4 Mar 2018 05:38:11 -0500 Received: from mail.micronovasrl.com ([212.103.203.10]:40796 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751844AbeCDKiJ (ORCPT ); Sun, 4 Mar 2018 05:38:09 -0500 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 6960AB0095D for ; Sun, 4 Mar 2018 11:38:08 +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 X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] autolearn=unavailable autolearn_force=no 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 TtjsfivNttFm 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 Cc: David Airlie , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Giulio Benetti 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.7.4