Received: by 10.223.185.116 with SMTP id b49csp1478928wrg; Sun, 4 Mar 2018 02:53:06 -0800 (PST) X-Google-Smtp-Source: AG47ELsbQoNWJeLYwlHwIx1I9qc5+NPhNi+KXRmXDyd2o5i0XHAKPmf6W3VrxyG8iRciQoveouVU X-Received: by 10.167.129.24 with SMTP id b24mr11650568pfi.183.1520160786330; 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=B9zGOdQBv1dL3XhpirjlDIqe5mNO49QFtUtIq7hNAc3+r5qZJXWphtlS98kIETJhHB PlUQgUVf+TGLAgrblr8nqzhhiOKiiz8M7OXzvYdC4MHqqGyUP0PpFvWRLKQJZkKEusuT v840U4INTcsaZ3a7ZjAWSVRRDEsI6dNW0PI0JAIXaxWj20M1Tb3aGz9Bsi0EJY7i4thD Lu7Y3Xus7wy/lRnTkGNdSU2Vd/1ePwXBmIab/sFCBCT+fwK5x5ksZP5AaF/XBgbuFVSi PXmJwQa8OkZRPzljBjYLxKKoi7n8LRAv14Sd6WSLuTAHMGO93mW70v31aVJCzdnQSlvB dljw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=3+LpcV6vU9wcx9SjS5EWsfHG69YMCYWZYhDHuZmANI8=; b=MxFwoThQ6USWMGnibkvMtZqnBhrquA/7G7kbOAL+0oPlG2jpI6g/mJWMEuZeSvZcLv cQriaGwMQcAbyLxexLPCRJLdN/bSl7UbqmvAi2tyPnnhgOk6y1hbuA2FDPyVvxuvRfO3 ChbVQ1cE9E7nn2HZC75+DbisA5ZnM0k8A8RrcFuhMJxBr4fuj6e5IMMyaq9mJowfUgU3 8/d0tUBqQp0vV/PTh4kqc+jvoGd6nlME1BK51cVZnLa/kTPHMHF31Rv3YmCYIO6gFg4W bHT0Wzu1x2xVyKitIgxtke7pNO1x/L120rU3baoxLePyriZJupjMjXEslXPY7JCX16bU n0cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=SeMxuxTG; 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 i187si8302829pfe.175.2018.03.04.02.52.39; 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=SeMxuxTG; 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 S1752652AbeCDKo5 (ORCPT + 99 others); Sun, 4 Mar 2018 05:44:57 -0500 Received: from mail.micronovasrl.com ([212.103.203.10]:40990 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751844AbeCDKo4 (ORCPT ); Sun, 4 Mar 2018 05:44:56 -0500 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 91363B0088C for ; Sun, 4 Mar 2018 11:44:54 +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=content-transfer-encoding:content-language:content-type :content-type:in-reply-to:mime-version:user-agent:date:date :message-id:from:from:references:to:subject:subject; s=dkim; t= 1520160293; x=1521024294; bh=/1HrIrnt40KSAWEFDOGxYhowCjDFBHMQ60C AiLT5cRM=; b=SeMxuxTGg0mZ5n+ngFQKhk35BBr4ItekOwjIt1aW4+TUzm2F0Xt JcIkj8NtiriKSHJyW/fSJa12K0TOqxmpomQQWdbFyiKzP7Hx2GgSNcFQs0sTKDOo ZeGcW9z2Vqa63e/Ecl8jKcWB4H7624AaNtNY1z1EzRBUPTplUkuV2cYo= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.899 X-Spam-Level: X-Spam-Status: No, score=-2.899 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, LOTS_OF_MONEY=0.001] 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 H3a-8j740GdL for ; Sun, 4 Mar 2018 11:44:53 +0100 (CET) Received: from [192.168.123.31] (unknown [192.168.123.31]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 60097B0018D; Sun, 4 Mar 2018 11:44:53 +0100 (CET) Subject: Re: [PATCH] drm/sun4i: move rgb mode_valid from connector to encoder 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 References: <1520159870-41286-1-git-send-email-giulio.benetti@micronovasrl.com> From: Giulio Benetti Message-ID: <29f8b108-4087-9908-9e47-255100a32149@micronovasrl.com> Date: Sun, 4 Mar 2018 11:44:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1520159870-41286-1-git-send-email-giulio.benetti@micronovasrl.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Language: it Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello everybody, I wanted to move function sun4i_rgb_encoder_mode_valid from connector section to encoder section. This is why it changes so many things, I don't know if it is the right way to do this. Let me know. Thanks -- Giulio Benetti CTO MICRONOVA SRL Sede: Via A. Niedda 3 - 35010 Vigonza (PD) Tel. 049/8931563 - Fax 049/8931346 Cod.Fiscale - P.IVA 02663420285 Capitale Sociale ? 26.000 i.v. Iscritta al Reg. Imprese di Padova N. 02663420285 Numero R.E.A. 258642 Il 04/03/2018 11:37, Giulio Benetti ha scritto: > 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) >