diff mbox series

[05/22] drm/gma500: Use simple encoder

Message ID 20200305155950.2705-6-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm: Convert drivers to drm_simple_encoder_init() | expand

Commit Message

Thomas Zimmermann March 5, 2020, 3:59 p.m. UTC
The gma500 driver uses empty implementations for some of its encoders.
Replace the code with the generic simple encoder. As a side effect, the
patch also removes an indirection in the encoder setup for Medfield.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/gma500/cdv_intel_crt.c     | 14 +++-----------
 drivers/gpu/drm/gma500/cdv_intel_dp.c      | 16 +++-------------
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c    |  4 ++--
 drivers/gpu/drm/gma500/cdv_intel_lvds.c    | 17 +++--------------
 drivers/gpu/drm/gma500/mdfld_dsi_dpi.c     |  7 +++----
 drivers/gpu/drm/gma500/mdfld_output.h      |  1 -
 drivers/gpu/drm/gma500/mdfld_tmd_vid.c     |  6 ------
 drivers/gpu/drm/gma500/mdfld_tpo_vid.c     |  6 ------
 drivers/gpu/drm/gma500/oaktrail_hdmi.c     | 14 ++------------
 drivers/gpu/drm/gma500/oaktrail_lvds.c     |  5 +++--
 drivers/gpu/drm/gma500/psb_intel_drv.h     |  1 -
 drivers/gpu/drm/gma500/psb_intel_lvds.c    | 18 +++---------------
 drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c |  5 -----
 13 files changed, 22 insertions(+), 92 deletions(-)

Comments

kernel test robot March 6, 2020, 12:44 a.m. UTC | #1
Hi Thomas,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20200305]
[also build test ERROR on v5.6-rc4]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/gma500/psb_intel_lvds.c: In function 'psb_intel_lvds_init':
>> drivers/gpu/drm/gma500/psb_intel_lvds.c:676:2: error: implicit declaration of function 'drm_simple_encoder_init'; did you mean 'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/cdv_intel_crt.c: In function 'cdv_intel_crt_init':
>> drivers/gpu/drm/gma500/cdv_intel_crt.c:267:2: error: implicit declaration of function 'drm_simple_encoder_init'; did you mean 'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/cdv_intel_hdmi.c: In function 'cdv_hdmi_init':
>> drivers/gpu/drm/gma500/cdv_intel_hdmi.c:315:2: error: implicit declaration of function 'drm_simple_encoder_init'; did you mean 'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/cdv_intel_dp.c: In function 'cdv_intel_dp_init':
>> drivers/gpu/drm/gma500/cdv_intel_dp.c:2010:2: error: implicit declaration of function 'drm_simple_encoder_init'; did you mean 'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/cdv_intel_lvds.c: In function 'cdv_intel_lvds_init':
>> drivers/gpu/drm/gma500/cdv_intel_lvds.c:611:2: error: implicit declaration of function 'drm_simple_encoder_init'; did you mean 'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/oaktrail_lvds.c: In function 'oaktrail_lvds_init':
>> drivers/gpu/drm/gma500/oaktrail_lvds.c:316:2: error: implicit declaration of function 'drm_simple_encoder_init'; did you mean 'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/oaktrail_hdmi.c: In function 'oaktrail_hdmi_init':
>> drivers/gpu/drm/gma500/oaktrail_hdmi.c:646:2: error: implicit declaration of function 'drm_simple_encoder_init'; did you mean 'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/mdfld_dsi_dpi.c: In function 'mdfld_dsi_dpi_init':
>> drivers/gpu/drm/gma500/mdfld_dsi_dpi.c:998:2: error: implicit declaration of function 'drm_simple_encoder_init'; did you mean 'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors

vim +676 drivers/gpu/drm/gma500/psb_intel_lvds.c

   625	
   626	/**
   627	 * psb_intel_lvds_init - setup LVDS connectors on this device
   628	 * @dev: drm device
   629	 *
   630	 * Create the connector, register the LVDS DDC bus, and try to figure out what
   631	 * modes we can display on the LVDS panel (if present).
   632	 */
   633	void psb_intel_lvds_init(struct drm_device *dev,
   634				 struct psb_intel_mode_device *mode_dev)
   635	{
   636		struct gma_encoder *gma_encoder;
   637		struct gma_connector *gma_connector;
   638		struct psb_intel_lvds_priv *lvds_priv;
   639		struct drm_connector *connector;
   640		struct drm_encoder *encoder;
   641		struct drm_display_mode *scan;	/* *modes, *bios_mode; */
   642		struct drm_crtc *crtc;
   643		struct drm_psb_private *dev_priv = dev->dev_private;
   644		u32 lvds;
   645		int pipe;
   646	
   647		gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
   648		if (!gma_encoder) {
   649			dev_err(dev->dev, "gma_encoder allocation error\n");
   650			return;
   651		}
   652	
   653		gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
   654		if (!gma_connector) {
   655			dev_err(dev->dev, "gma_connector allocation error\n");
   656			goto failed_encoder;
   657		}
   658	
   659		lvds_priv = kzalloc(sizeof(struct psb_intel_lvds_priv), GFP_KERNEL);
   660		if (!lvds_priv) {
   661			dev_err(dev->dev, "LVDS private allocation error\n");
   662			goto failed_connector;
   663		}
   664	
   665		gma_encoder->dev_priv = lvds_priv;
   666	
   667		connector = &gma_connector->base;
   668		gma_connector->save = psb_intel_lvds_save;
   669		gma_connector->restore = psb_intel_lvds_restore;
   670	
   671		encoder = &gma_encoder->base;
   672		drm_connector_init(dev, connector,
   673				   &psb_intel_lvds_connector_funcs,
   674				   DRM_MODE_CONNECTOR_LVDS);
   675	
 > 676		drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
   677	
   678		gma_connector_attach_encoder(gma_connector, gma_encoder);
   679		gma_encoder->type = INTEL_OUTPUT_LVDS;
   680	
   681		drm_encoder_helper_add(encoder, &psb_intel_lvds_helper_funcs);
   682		drm_connector_helper_add(connector,
   683					 &psb_intel_lvds_connector_helper_funcs);
   684		connector->display_info.subpixel_order = SubPixelHorizontalRGB;
   685		connector->interlace_allowed = false;
   686		connector->doublescan_allowed = false;
   687	
   688		/*Attach connector properties*/
   689		drm_object_attach_property(&connector->base,
   690					      dev->mode_config.scaling_mode_property,
   691					      DRM_MODE_SCALE_FULLSCREEN);
   692		drm_object_attach_property(&connector->base,
   693					      dev_priv->backlight_property,
   694					      BRIGHTNESS_MAX_LEVEL);
   695	
   696		/*
   697		 * Set up I2C bus
   698		 * FIXME: distroy i2c_bus when exit
   699		 */
   700		lvds_priv->i2c_bus = psb_intel_i2c_create(dev, GPIOB, "LVDSBLC_B");
   701		if (!lvds_priv->i2c_bus) {
   702			dev_printk(KERN_ERR,
   703				&dev->pdev->dev, "I2C bus registration failed.\n");
   704			goto failed_blc_i2c;
   705		}
   706		lvds_priv->i2c_bus->slave_addr = 0x2C;
   707		dev_priv->lvds_i2c_bus =  lvds_priv->i2c_bus;
   708	
   709		/*
   710		 * LVDS discovery:
   711		 * 1) check for EDID on DDC
   712		 * 2) check for VBT data
   713		 * 3) check to see if LVDS is already on
   714		 *    if none of the above, no panel
   715		 * 4) make sure lid is open
   716		 *    if closed, act like it's not there for now
   717		 */
   718	
   719		/* Set up the DDC bus. */
   720		lvds_priv->ddc_bus = psb_intel_i2c_create(dev, GPIOC, "LVDSDDC_C");
   721		if (!lvds_priv->ddc_bus) {
   722			dev_printk(KERN_ERR, &dev->pdev->dev,
   723				   "DDC bus registration " "failed.\n");
   724			goto failed_ddc;
   725		}
   726	
   727		/*
   728		 * Attempt to get the fixed panel mode from DDC.  Assume that the
   729		 * preferred mode is the right one.
   730		 */
   731		mutex_lock(&dev->mode_config.mutex);
   732		psb_intel_ddc_get_modes(connector, &lvds_priv->ddc_bus->adapter);
   733		list_for_each_entry(scan, &connector->probed_modes, head) {
   734			if (scan->type & DRM_MODE_TYPE_PREFERRED) {
   735				mode_dev->panel_fixed_mode =
   736				    drm_mode_duplicate(dev, scan);
   737				DRM_DEBUG_KMS("Using mode from DDC\n");
   738				goto out;	/* FIXME: check for quirks */
   739			}
   740		}
   741	
   742		/* Failed to get EDID, what about VBT? do we need this? */
   743		if (dev_priv->lfp_lvds_vbt_mode) {
   744			mode_dev->panel_fixed_mode =
   745				drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode);
   746	
   747			if (mode_dev->panel_fixed_mode) {
   748				mode_dev->panel_fixed_mode->type |=
   749					DRM_MODE_TYPE_PREFERRED;
   750				DRM_DEBUG_KMS("Using mode from VBT\n");
   751				goto out;
   752			}
   753		}
   754	
   755		/*
   756		 * If we didn't get EDID, try checking if the panel is already turned
   757		 * on.	If so, assume that whatever is currently programmed is the
   758		 * correct mode.
   759		 */
   760		lvds = REG_READ(LVDS);
   761		pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0;
   762		crtc = psb_intel_get_crtc_from_pipe(dev, pipe);
   763	
   764		if (crtc && (lvds & LVDS_PORT_EN)) {
   765			mode_dev->panel_fixed_mode =
   766			    psb_intel_crtc_mode_get(dev, crtc);
   767			if (mode_dev->panel_fixed_mode) {
   768				mode_dev->panel_fixed_mode->type |=
   769				    DRM_MODE_TYPE_PREFERRED;
   770				DRM_DEBUG_KMS("Using pre-programmed mode\n");
   771				goto out;	/* FIXME: check for quirks */
   772			}
   773		}
   774	
   775		/* If we still don't have a mode after all that, give up. */
   776		if (!mode_dev->panel_fixed_mode) {
   777			dev_err(dev->dev, "Found no modes on the lvds, ignoring the LVDS\n");
   778			goto failed_find;
   779		}
   780	
   781		/*
   782		 * Blacklist machines with BIOSes that list an LVDS panel without
   783		 * actually having one.
   784		 */
   785	out:
   786		mutex_unlock(&dev->mode_config.mutex);
   787		drm_connector_register(connector);
   788		return;
   789	
   790	failed_find:
   791		mutex_unlock(&dev->mode_config.mutex);
   792		psb_intel_i2c_destroy(lvds_priv->ddc_bus);
   793	failed_ddc:
   794		psb_intel_i2c_destroy(lvds_priv->i2c_bus);
   795	failed_blc_i2c:
   796		drm_encoder_cleanup(encoder);
   797		drm_connector_cleanup(connector);
   798	failed_connector:
   799		kfree(gma_connector);
   800	failed_encoder:
   801		kfree(gma_encoder);
   802	}
   803	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Sam Ravnborg March 6, 2020, 9:35 p.m. UTC | #2
Hi Thomas.

On Thu, Mar 05, 2020 at 04:59:33PM +0100, Thomas Zimmermann wrote:
> The gma500 driver uses empty implementations for some of its encoders.
> Replace the code with the generic simple encoder.
This parts looks good.


> As a side effect, the
> patch also removes an indirection in the encoder setup for Medfield.

I failed to see where this was done. Maybe too late for me to review
patches, so I will stop now.


No matter - patch is:
Acked-by: Sam Ravnborg <sam@ravnborg.org>

> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/gma500/cdv_intel_crt.c     | 14 +++-----------
>  drivers/gpu/drm/gma500/cdv_intel_dp.c      | 16 +++-------------
>  drivers/gpu/drm/gma500/cdv_intel_hdmi.c    |  4 ++--
>  drivers/gpu/drm/gma500/cdv_intel_lvds.c    | 17 +++--------------
>  drivers/gpu/drm/gma500/mdfld_dsi_dpi.c     |  7 +++----
>  drivers/gpu/drm/gma500/mdfld_output.h      |  1 -
>  drivers/gpu/drm/gma500/mdfld_tmd_vid.c     |  6 ------
>  drivers/gpu/drm/gma500/mdfld_tpo_vid.c     |  6 ------
>  drivers/gpu/drm/gma500/oaktrail_hdmi.c     | 14 ++------------
>  drivers/gpu/drm/gma500/oaktrail_lvds.c     |  5 +++--
>  drivers/gpu/drm/gma500/psb_intel_drv.h     |  1 -
>  drivers/gpu/drm/gma500/psb_intel_lvds.c    | 18 +++---------------
>  drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c |  5 -----
>  13 files changed, 22 insertions(+), 92 deletions(-)
> 
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c b/drivers/gpu/drm/gma500/cdv_intel_crt.c
> index 29c36d63b20e..88535f5aacc5 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
> @@ -28,6 +28,8 @@
>  #include <linux/i2c.h>
>  #include <linux/pm_runtime.h>
>  
> +#include <drm/drm_simple_kms_helper.h>
> +
>  #include "cdv_device.h"
>  #include "intel_bios.h"
>  #include "power.h"
> @@ -237,15 +239,6 @@ static const struct drm_connector_helper_funcs
>  	.best_encoder = gma_best_encoder,
>  };
>  
> -static void cdv_intel_crt_enc_destroy(struct drm_encoder *encoder)
> -{
> -	drm_encoder_cleanup(encoder);
> -}
> -
> -static const struct drm_encoder_funcs cdv_intel_crt_enc_funcs = {
> -	.destroy = cdv_intel_crt_enc_destroy,
> -};
> -
>  void cdv_intel_crt_init(struct drm_device *dev,
>  			struct psb_intel_mode_device *mode_dev)
>  {
> @@ -271,8 +264,7 @@ void cdv_intel_crt_init(struct drm_device *dev,
>  		&cdv_intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
>  
>  	encoder = &gma_encoder->base;
> -	drm_encoder_init(dev, encoder,
> -		&cdv_intel_crt_enc_funcs, DRM_MODE_ENCODER_DAC, NULL);
> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC);
>  
>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>  
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
> index 5772b2dce0d6..13947ec06dbb 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
> @@ -32,6 +32,7 @@
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_dp_helper.h>
> +#include <drm/drm_simple_kms_helper.h>
>  
>  #include "gma_display.h"
>  #include "psb_drv.h"
> @@ -1908,11 +1909,6 @@ cdv_intel_dp_destroy(struct drm_connector *connector)
>  	kfree(connector);
>  }
>  
> -static void cdv_intel_dp_encoder_destroy(struct drm_encoder *encoder)
> -{
> -	drm_encoder_cleanup(encoder);
> -}
> -
>  static const struct drm_encoder_helper_funcs cdv_intel_dp_helper_funcs = {
>  	.dpms = cdv_intel_dp_dpms,
>  	.mode_fixup = cdv_intel_dp_mode_fixup,
> @@ -1935,11 +1931,6 @@ static const struct drm_connector_helper_funcs cdv_intel_dp_connector_helper_fun
>  	.best_encoder = gma_best_encoder,
>  };
>  
> -static const struct drm_encoder_funcs cdv_intel_dp_enc_funcs = {
> -	.destroy = cdv_intel_dp_encoder_destroy,
> -};
> -
> -
>  static void cdv_intel_dp_add_properties(struct drm_connector *connector)
>  {
>  	cdv_intel_attach_force_audio_property(connector);
> @@ -2016,8 +2007,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
>  	encoder = &gma_encoder->base;
>  
>  	drm_connector_init(dev, connector, &cdv_intel_dp_connector_funcs, type);
> -	drm_encoder_init(dev, encoder, &cdv_intel_dp_enc_funcs,
> -			 DRM_MODE_ENCODER_TMDS, NULL);
> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
>  
>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>  
> @@ -2120,7 +2110,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
>  		if (ret == 0) {
>  			/* if this fails, presume the device is a ghost */
>  			DRM_INFO("failed to retrieve link info, disabling eDP\n");
> -			cdv_intel_dp_encoder_destroy(encoder);
> +			drm_encoder_cleanup(encoder);
>  			cdv_intel_dp_destroy(connector);
>  			goto err_priv;
>  		} else {
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
> index 1711a41acc16..0d12c6ffbc40 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
> @@ -32,6 +32,7 @@
>  #include <drm/drm.h>
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_edid.h>
> +#include <drm/drm_simple_kms_helper.h>
>  
>  #include "cdv_device.h"
>  #include "psb_drv.h"
> @@ -311,8 +312,7 @@ void cdv_hdmi_init(struct drm_device *dev,
>  			   &cdv_hdmi_connector_funcs,
>  			   DRM_MODE_CONNECTOR_DVID);
>  
> -	drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
> -			 DRM_MODE_ENCODER_TMDS, NULL);
> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
>  
>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>  	gma_encoder->type = INTEL_OUTPUT_HDMI;
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> index ea0a5d9a0acc..18de10e9ff9a 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> @@ -12,6 +12,8 @@
>  #include <linux/i2c.h>
>  #include <linux/pm_runtime.h>
>  
> +#include <drm/drm_simple_kms_helper.h>
> +
>  #include "cdv_device.h"
>  #include "intel_bios.h"
>  #include "power.h"
> @@ -499,16 +501,6 @@ static const struct drm_connector_funcs cdv_intel_lvds_connector_funcs = {
>  	.destroy = cdv_intel_lvds_destroy,
>  };
>  
> -
> -static void cdv_intel_lvds_enc_destroy(struct drm_encoder *encoder)
> -{
> -	drm_encoder_cleanup(encoder);
> -}
> -
> -static const struct drm_encoder_funcs cdv_intel_lvds_enc_funcs = {
> -	.destroy = cdv_intel_lvds_enc_destroy,
> -};
> -
>  /*
>   * Enumerate the child dev array parsed from VBT to check whether
>   * the LVDS is present.
> @@ -616,10 +608,7 @@ void cdv_intel_lvds_init(struct drm_device *dev,
>  			   &cdv_intel_lvds_connector_funcs,
>  			   DRM_MODE_CONNECTOR_LVDS);
>  
> -	drm_encoder_init(dev, encoder,
> -			 &cdv_intel_lvds_enc_funcs,
> -			 DRM_MODE_ENCODER_LVDS, NULL);
> -
> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
>  
>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>  	gma_encoder->type = INTEL_OUTPUT_LVDS;
> diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
> index d4c65f268922..aa5aa293ddb6 100644
> --- a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
> +++ b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
> @@ -27,6 +27,8 @@
>  
>  #include <linux/delay.h>
>  
> +#include <drm/drm_simple_kms_helper.h>
> +
>  #include "mdfld_dsi_dpi.h"
>  #include "mdfld_dsi_pkg_sender.h"
>  #include "mdfld_output.h"
> @@ -993,10 +995,7 @@ struct mdfld_dsi_encoder *mdfld_dsi_dpi_init(struct drm_device *dev,
>  	/*create drm encoder object*/
>  	connector = &dsi_connector->base.base;
>  	encoder = &dpi_output->base.base.base;
> -	drm_encoder_init(dev,
> -			encoder,
> -			p_funcs->encoder_funcs,
> -			DRM_MODE_ENCODER_LVDS, NULL);
> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
>  	drm_encoder_helper_add(encoder,
>  				p_funcs->encoder_helper_funcs);
>  
> diff --git a/drivers/gpu/drm/gma500/mdfld_output.h b/drivers/gpu/drm/gma500/mdfld_output.h
> index ab2b27c0f037..17a944d70add 100644
> --- a/drivers/gpu/drm/gma500/mdfld_output.h
> +++ b/drivers/gpu/drm/gma500/mdfld_output.h
> @@ -51,7 +51,6 @@ struct panel_info {
>  };
>  
>  struct panel_funcs {
> -	const struct drm_encoder_funcs *encoder_funcs;
>  	const struct drm_encoder_helper_funcs *encoder_helper_funcs;
>  	struct drm_display_mode * (*get_config_mode)(struct drm_device *);
>  	int (*get_panel_info)(struct drm_device *, int, struct panel_info *);
> diff --git a/drivers/gpu/drm/gma500/mdfld_tmd_vid.c b/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
> index 49c92debb7b2..25e897b98f86 100644
> --- a/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
> +++ b/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
> @@ -188,13 +188,7 @@ static const struct drm_encoder_helper_funcs
>  	.commit = mdfld_dsi_dpi_commit,
>  };
>  
> -/*TPO DPI encoder funcs*/
> -static const struct drm_encoder_funcs mdfld_tpo_dpi_encoder_funcs = {
> -	.destroy = drm_encoder_cleanup,
> -};
> -
>  const struct panel_funcs mdfld_tmd_vid_funcs = {
> -	.encoder_funcs = &mdfld_tpo_dpi_encoder_funcs,
>  	.encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs,
>  	.get_config_mode = &tmd_vid_get_config_mode,
>  	.get_panel_info = tmd_vid_get_panel_info,
> diff --git a/drivers/gpu/drm/gma500/mdfld_tpo_vid.c b/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
> index a9420bf9a419..11845978fb0a 100644
> --- a/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
> +++ b/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
> @@ -76,13 +76,7 @@ static const struct drm_encoder_helper_funcs
>  	.commit = mdfld_dsi_dpi_commit,
>  };
>  
> -/*TPO DPI encoder funcs*/
> -static const struct drm_encoder_funcs mdfld_tpo_dpi_encoder_funcs = {
> -	.destroy = drm_encoder_cleanup,
> -};
> -
>  const struct panel_funcs mdfld_tpo_vid_funcs = {
> -	.encoder_funcs = &mdfld_tpo_dpi_encoder_funcs,
>  	.encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs,
>  	.get_config_mode = &tpo_vid_get_config_mode,
>  	.get_panel_info = tpo_vid_get_panel_info,
> diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
> index f4370232767d..b25086f252ae 100644
> --- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
> +++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
> @@ -27,6 +27,7 @@
>  #include <linux/delay.h>
>  
>  #include <drm/drm.h>
> +#include <drm/drm_simple_kms_helper.h>
>  
>  #include "psb_drv.h"
>  #include "psb_intel_drv.h"
> @@ -620,15 +621,6 @@ static const struct drm_connector_funcs oaktrail_hdmi_connector_funcs = {
>  	.destroy = oaktrail_hdmi_destroy,
>  };
>  
> -static void oaktrail_hdmi_enc_destroy(struct drm_encoder *encoder)
> -{
> -	drm_encoder_cleanup(encoder);
> -}
> -
> -static const struct drm_encoder_funcs oaktrail_hdmi_enc_funcs = {
> -	.destroy = oaktrail_hdmi_enc_destroy,
> -};
> -
>  void oaktrail_hdmi_init(struct drm_device *dev,
>  					struct psb_intel_mode_device *mode_dev)
>  {
> @@ -651,9 +643,7 @@ void oaktrail_hdmi_init(struct drm_device *dev,
>  			   &oaktrail_hdmi_connector_funcs,
>  			   DRM_MODE_CONNECTOR_DVID);
>  
> -	drm_encoder_init(dev, encoder,
> -			 &oaktrail_hdmi_enc_funcs,
> -			 DRM_MODE_ENCODER_TMDS, NULL);
> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
>  
>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>  
> diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c
> index 582e09597500..2828360153d1 100644
> --- a/drivers/gpu/drm/gma500/oaktrail_lvds.c
> +++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c
> @@ -13,6 +13,8 @@
>  
>  #include <asm/intel-mid.h>
>  
> +#include <drm/drm_simple_kms_helper.h>
> +
>  #include "intel_bios.h"
>  #include "power.h"
>  #include "psb_drv.h"
> @@ -311,8 +313,7 @@ void oaktrail_lvds_init(struct drm_device *dev,
>  			   &psb_intel_lvds_connector_funcs,
>  			   DRM_MODE_CONNECTOR_LVDS);
>  
> -	drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
> -			 DRM_MODE_ENCODER_LVDS, NULL);
> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
>  
>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>  	gma_encoder->type = INTEL_OUTPUT_LVDS;
> diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h
> index 16c6136f778b..fb601983cef0 100644
> --- a/drivers/gpu/drm/gma500/psb_intel_drv.h
> +++ b/drivers/gpu/drm/gma500/psb_intel_drv.h
> @@ -252,7 +252,6 @@ extern int psb_intel_lvds_set_property(struct drm_connector *connector,
>  					struct drm_property *property,
>  					uint64_t value);
>  extern void psb_intel_lvds_destroy(struct drm_connector *connector);
> -extern const struct drm_encoder_funcs psb_intel_lvds_enc_funcs;
>  
>  /* intel_gmbus.c */
>  extern void gma_intel_i2c_reset(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c
> index afaebab7bc17..063c66bb946d 100644
> --- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
> +++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
> @@ -11,6 +11,8 @@
>  #include <linux/i2c.h>
>  #include <linux/pm_runtime.h>
>  
> +#include <drm/drm_simple_kms_helper.h>
> +
>  #include "intel_bios.h"
>  #include "power.h"
>  #include "psb_drv.h"
> @@ -621,18 +623,6 @@ const struct drm_connector_funcs psb_intel_lvds_connector_funcs = {
>  	.destroy = psb_intel_lvds_destroy,
>  };
>  
> -
> -static void psb_intel_lvds_enc_destroy(struct drm_encoder *encoder)
> -{
> -	drm_encoder_cleanup(encoder);
> -}
> -
> -const struct drm_encoder_funcs psb_intel_lvds_enc_funcs = {
> -	.destroy = psb_intel_lvds_enc_destroy,
> -};
> -
> -
> -
>  /**
>   * psb_intel_lvds_init - setup LVDS connectors on this device
>   * @dev: drm device
> @@ -683,9 +673,7 @@ void psb_intel_lvds_init(struct drm_device *dev,
>  			   &psb_intel_lvds_connector_funcs,
>  			   DRM_MODE_CONNECTOR_LVDS);
>  
> -	drm_encoder_init(dev, encoder,
> -			 &psb_intel_lvds_enc_funcs,
> -			 DRM_MODE_ENCODER_LVDS, NULL);
> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
>  
>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>  	gma_encoder->type = INTEL_OUTPUT_LVDS;
> diff --git a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
> index 9e8224456ea2..f7e121f4c609 100644
> --- a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
> +++ b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
> @@ -765,12 +765,7 @@ static const struct drm_encoder_helper_funcs tc35876x_encoder_helper_funcs = {
>  	.commit = mdfld_dsi_dpi_commit,
>  };
>  
> -static const struct drm_encoder_funcs tc35876x_encoder_funcs = {
> -	.destroy = drm_encoder_cleanup,
> -};
> -
>  const struct panel_funcs mdfld_tc35876x_funcs = {
> -	.encoder_funcs = &tc35876x_encoder_funcs,
>  	.encoder_helper_funcs = &tc35876x_encoder_helper_funcs,
>  	.get_config_mode = tc35876x_get_config_mode,
>  	.get_panel_info = tc35876x_get_panel_info,
> -- 
> 2.25.1
Thomas Zimmermann March 9, 2020, 7:32 a.m. UTC | #3
Hi Sam

Am 06.03.20 um 22:35 schrieb Sam Ravnborg:
> Hi Thomas.
> 
> On Thu, Mar 05, 2020 at 04:59:33PM +0100, Thomas Zimmermann wrote:
>> The gma500 driver uses empty implementations for some of its encoders.
>> Replace the code with the generic simple encoder.
> This parts looks good.
> 
> 
>> As a side effect, the
>> patch also removes an indirection in the encoder setup for Medfield.
> 
> I failed to see where this was done. Maybe too late for me to review
> patches, so I will stop now.

The indirection is in setting the encoder functions. Defined in
drivers/gpu/drm/gma500/mdfld_output.h, struct panel_funcs.encoder_funcs
is filled by various Medfield backends with encoder callbacks. But it's
always the same and the encoder_funcs field can be removed. A call to
drm_simple_encoder_init() works for all Medfield code.

Best regards
Thomas

> 
> 
> No matter - patch is:
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> 
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/gma500/cdv_intel_crt.c     | 14 +++-----------
>>  drivers/gpu/drm/gma500/cdv_intel_dp.c      | 16 +++-------------
>>  drivers/gpu/drm/gma500/cdv_intel_hdmi.c    |  4 ++--
>>  drivers/gpu/drm/gma500/cdv_intel_lvds.c    | 17 +++--------------
>>  drivers/gpu/drm/gma500/mdfld_dsi_dpi.c     |  7 +++----
>>  drivers/gpu/drm/gma500/mdfld_output.h      |  1 -
>>  drivers/gpu/drm/gma500/mdfld_tmd_vid.c     |  6 ------
>>  drivers/gpu/drm/gma500/mdfld_tpo_vid.c     |  6 ------
>>  drivers/gpu/drm/gma500/oaktrail_hdmi.c     | 14 ++------------
>>  drivers/gpu/drm/gma500/oaktrail_lvds.c     |  5 +++--
>>  drivers/gpu/drm/gma500/psb_intel_drv.h     |  1 -
>>  drivers/gpu/drm/gma500/psb_intel_lvds.c    | 18 +++---------------
>>  drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c |  5 -----
>>  13 files changed, 22 insertions(+), 92 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c b/drivers/gpu/drm/gma500/cdv_intel_crt.c
>> index 29c36d63b20e..88535f5aacc5 100644
>> --- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
>> +++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
>> @@ -28,6 +28,8 @@
>>  #include <linux/i2c.h>
>>  #include <linux/pm_runtime.h>
>>  
>> +#include <drm/drm_simple_kms_helper.h>
>> +
>>  #include "cdv_device.h"
>>  #include "intel_bios.h"
>>  #include "power.h"
>> @@ -237,15 +239,6 @@ static const struct drm_connector_helper_funcs
>>  	.best_encoder = gma_best_encoder,
>>  };
>>  
>> -static void cdv_intel_crt_enc_destroy(struct drm_encoder *encoder)
>> -{
>> -	drm_encoder_cleanup(encoder);
>> -}
>> -
>> -static const struct drm_encoder_funcs cdv_intel_crt_enc_funcs = {
>> -	.destroy = cdv_intel_crt_enc_destroy,
>> -};
>> -
>>  void cdv_intel_crt_init(struct drm_device *dev,
>>  			struct psb_intel_mode_device *mode_dev)
>>  {
>> @@ -271,8 +264,7 @@ void cdv_intel_crt_init(struct drm_device *dev,
>>  		&cdv_intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
>>  
>>  	encoder = &gma_encoder->base;
>> -	drm_encoder_init(dev, encoder,
>> -		&cdv_intel_crt_enc_funcs, DRM_MODE_ENCODER_DAC, NULL);
>> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC);
>>  
>>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>>  
>> diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
>> index 5772b2dce0d6..13947ec06dbb 100644
>> --- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
>> +++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
>> @@ -32,6 +32,7 @@
>>  #include <drm/drm_crtc.h>
>>  #include <drm/drm_crtc_helper.h>
>>  #include <drm/drm_dp_helper.h>
>> +#include <drm/drm_simple_kms_helper.h>
>>  
>>  #include "gma_display.h"
>>  #include "psb_drv.h"
>> @@ -1908,11 +1909,6 @@ cdv_intel_dp_destroy(struct drm_connector *connector)
>>  	kfree(connector);
>>  }
>>  
>> -static void cdv_intel_dp_encoder_destroy(struct drm_encoder *encoder)
>> -{
>> -	drm_encoder_cleanup(encoder);
>> -}
>> -
>>  static const struct drm_encoder_helper_funcs cdv_intel_dp_helper_funcs = {
>>  	.dpms = cdv_intel_dp_dpms,
>>  	.mode_fixup = cdv_intel_dp_mode_fixup,
>> @@ -1935,11 +1931,6 @@ static const struct drm_connector_helper_funcs cdv_intel_dp_connector_helper_fun
>>  	.best_encoder = gma_best_encoder,
>>  };
>>  
>> -static const struct drm_encoder_funcs cdv_intel_dp_enc_funcs = {
>> -	.destroy = cdv_intel_dp_encoder_destroy,
>> -};
>> -
>> -
>>  static void cdv_intel_dp_add_properties(struct drm_connector *connector)
>>  {
>>  	cdv_intel_attach_force_audio_property(connector);
>> @@ -2016,8 +2007,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
>>  	encoder = &gma_encoder->base;
>>  
>>  	drm_connector_init(dev, connector, &cdv_intel_dp_connector_funcs, type);
>> -	drm_encoder_init(dev, encoder, &cdv_intel_dp_enc_funcs,
>> -			 DRM_MODE_ENCODER_TMDS, NULL);
>> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
>>  
>>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>>  
>> @@ -2120,7 +2110,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
>>  		if (ret == 0) {
>>  			/* if this fails, presume the device is a ghost */
>>  			DRM_INFO("failed to retrieve link info, disabling eDP\n");
>> -			cdv_intel_dp_encoder_destroy(encoder);
>> +			drm_encoder_cleanup(encoder);
>>  			cdv_intel_dp_destroy(connector);
>>  			goto err_priv;
>>  		} else {
>> diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
>> index 1711a41acc16..0d12c6ffbc40 100644
>> --- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
>> +++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
>> @@ -32,6 +32,7 @@
>>  #include <drm/drm.h>
>>  #include <drm/drm_crtc.h>
>>  #include <drm/drm_edid.h>
>> +#include <drm/drm_simple_kms_helper.h>
>>  
>>  #include "cdv_device.h"
>>  #include "psb_drv.h"
>> @@ -311,8 +312,7 @@ void cdv_hdmi_init(struct drm_device *dev,
>>  			   &cdv_hdmi_connector_funcs,
>>  			   DRM_MODE_CONNECTOR_DVID);
>>  
>> -	drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
>> -			 DRM_MODE_ENCODER_TMDS, NULL);
>> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
>>  
>>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>>  	gma_encoder->type = INTEL_OUTPUT_HDMI;
>> diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
>> index ea0a5d9a0acc..18de10e9ff9a 100644
>> --- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
>> +++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
>> @@ -12,6 +12,8 @@
>>  #include <linux/i2c.h>
>>  #include <linux/pm_runtime.h>
>>  
>> +#include <drm/drm_simple_kms_helper.h>
>> +
>>  #include "cdv_device.h"
>>  #include "intel_bios.h"
>>  #include "power.h"
>> @@ -499,16 +501,6 @@ static const struct drm_connector_funcs cdv_intel_lvds_connector_funcs = {
>>  	.destroy = cdv_intel_lvds_destroy,
>>  };
>>  
>> -
>> -static void cdv_intel_lvds_enc_destroy(struct drm_encoder *encoder)
>> -{
>> -	drm_encoder_cleanup(encoder);
>> -}
>> -
>> -static const struct drm_encoder_funcs cdv_intel_lvds_enc_funcs = {
>> -	.destroy = cdv_intel_lvds_enc_destroy,
>> -};
>> -
>>  /*
>>   * Enumerate the child dev array parsed from VBT to check whether
>>   * the LVDS is present.
>> @@ -616,10 +608,7 @@ void cdv_intel_lvds_init(struct drm_device *dev,
>>  			   &cdv_intel_lvds_connector_funcs,
>>  			   DRM_MODE_CONNECTOR_LVDS);
>>  
>> -	drm_encoder_init(dev, encoder,
>> -			 &cdv_intel_lvds_enc_funcs,
>> -			 DRM_MODE_ENCODER_LVDS, NULL);
>> -
>> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
>>  
>>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>>  	gma_encoder->type = INTEL_OUTPUT_LVDS;
>> diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
>> index d4c65f268922..aa5aa293ddb6 100644
>> --- a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
>> +++ b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
>> @@ -27,6 +27,8 @@
>>  
>>  #include <linux/delay.h>
>>  
>> +#include <drm/drm_simple_kms_helper.h>
>> +
>>  #include "mdfld_dsi_dpi.h"
>>  #include "mdfld_dsi_pkg_sender.h"
>>  #include "mdfld_output.h"
>> @@ -993,10 +995,7 @@ struct mdfld_dsi_encoder *mdfld_dsi_dpi_init(struct drm_device *dev,
>>  	/*create drm encoder object*/
>>  	connector = &dsi_connector->base.base;
>>  	encoder = &dpi_output->base.base.base;
>> -	drm_encoder_init(dev,
>> -			encoder,
>> -			p_funcs->encoder_funcs,
>> -			DRM_MODE_ENCODER_LVDS, NULL);
>> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
>>  	drm_encoder_helper_add(encoder,
>>  				p_funcs->encoder_helper_funcs);
>>  
>> diff --git a/drivers/gpu/drm/gma500/mdfld_output.h b/drivers/gpu/drm/gma500/mdfld_output.h
>> index ab2b27c0f037..17a944d70add 100644
>> --- a/drivers/gpu/drm/gma500/mdfld_output.h
>> +++ b/drivers/gpu/drm/gma500/mdfld_output.h
>> @@ -51,7 +51,6 @@ struct panel_info {
>>  };
>>  
>>  struct panel_funcs {
>> -	const struct drm_encoder_funcs *encoder_funcs;
>>  	const struct drm_encoder_helper_funcs *encoder_helper_funcs;
>>  	struct drm_display_mode * (*get_config_mode)(struct drm_device *);
>>  	int (*get_panel_info)(struct drm_device *, int, struct panel_info *);
>> diff --git a/drivers/gpu/drm/gma500/mdfld_tmd_vid.c b/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
>> index 49c92debb7b2..25e897b98f86 100644
>> --- a/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
>> +++ b/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
>> @@ -188,13 +188,7 @@ static const struct drm_encoder_helper_funcs
>>  	.commit = mdfld_dsi_dpi_commit,
>>  };
>>  
>> -/*TPO DPI encoder funcs*/
>> -static const struct drm_encoder_funcs mdfld_tpo_dpi_encoder_funcs = {
>> -	.destroy = drm_encoder_cleanup,
>> -};
>> -
>>  const struct panel_funcs mdfld_tmd_vid_funcs = {
>> -	.encoder_funcs = &mdfld_tpo_dpi_encoder_funcs,
>>  	.encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs,
>>  	.get_config_mode = &tmd_vid_get_config_mode,
>>  	.get_panel_info = tmd_vid_get_panel_info,
>> diff --git a/drivers/gpu/drm/gma500/mdfld_tpo_vid.c b/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
>> index a9420bf9a419..11845978fb0a 100644
>> --- a/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
>> +++ b/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
>> @@ -76,13 +76,7 @@ static const struct drm_encoder_helper_funcs
>>  	.commit = mdfld_dsi_dpi_commit,
>>  };
>>  
>> -/*TPO DPI encoder funcs*/
>> -static const struct drm_encoder_funcs mdfld_tpo_dpi_encoder_funcs = {
>> -	.destroy = drm_encoder_cleanup,
>> -};
>> -
>>  const struct panel_funcs mdfld_tpo_vid_funcs = {
>> -	.encoder_funcs = &mdfld_tpo_dpi_encoder_funcs,
>>  	.encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs,
>>  	.get_config_mode = &tpo_vid_get_config_mode,
>>  	.get_panel_info = tpo_vid_get_panel_info,
>> diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
>> index f4370232767d..b25086f252ae 100644
>> --- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
>> +++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
>> @@ -27,6 +27,7 @@
>>  #include <linux/delay.h>
>>  
>>  #include <drm/drm.h>
>> +#include <drm/drm_simple_kms_helper.h>
>>  
>>  #include "psb_drv.h"
>>  #include "psb_intel_drv.h"
>> @@ -620,15 +621,6 @@ static const struct drm_connector_funcs oaktrail_hdmi_connector_funcs = {
>>  	.destroy = oaktrail_hdmi_destroy,
>>  };
>>  
>> -static void oaktrail_hdmi_enc_destroy(struct drm_encoder *encoder)
>> -{
>> -	drm_encoder_cleanup(encoder);
>> -}
>> -
>> -static const struct drm_encoder_funcs oaktrail_hdmi_enc_funcs = {
>> -	.destroy = oaktrail_hdmi_enc_destroy,
>> -};
>> -
>>  void oaktrail_hdmi_init(struct drm_device *dev,
>>  					struct psb_intel_mode_device *mode_dev)
>>  {
>> @@ -651,9 +643,7 @@ void oaktrail_hdmi_init(struct drm_device *dev,
>>  			   &oaktrail_hdmi_connector_funcs,
>>  			   DRM_MODE_CONNECTOR_DVID);
>>  
>> -	drm_encoder_init(dev, encoder,
>> -			 &oaktrail_hdmi_enc_funcs,
>> -			 DRM_MODE_ENCODER_TMDS, NULL);
>> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
>>  
>>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>>  
>> diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c
>> index 582e09597500..2828360153d1 100644
>> --- a/drivers/gpu/drm/gma500/oaktrail_lvds.c
>> +++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c
>> @@ -13,6 +13,8 @@
>>  
>>  #include <asm/intel-mid.h>
>>  
>> +#include <drm/drm_simple_kms_helper.h>
>> +
>>  #include "intel_bios.h"
>>  #include "power.h"
>>  #include "psb_drv.h"
>> @@ -311,8 +313,7 @@ void oaktrail_lvds_init(struct drm_device *dev,
>>  			   &psb_intel_lvds_connector_funcs,
>>  			   DRM_MODE_CONNECTOR_LVDS);
>>  
>> -	drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
>> -			 DRM_MODE_ENCODER_LVDS, NULL);
>> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
>>  
>>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>>  	gma_encoder->type = INTEL_OUTPUT_LVDS;
>> diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h
>> index 16c6136f778b..fb601983cef0 100644
>> --- a/drivers/gpu/drm/gma500/psb_intel_drv.h
>> +++ b/drivers/gpu/drm/gma500/psb_intel_drv.h
>> @@ -252,7 +252,6 @@ extern int psb_intel_lvds_set_property(struct drm_connector *connector,
>>  					struct drm_property *property,
>>  					uint64_t value);
>>  extern void psb_intel_lvds_destroy(struct drm_connector *connector);
>> -extern const struct drm_encoder_funcs psb_intel_lvds_enc_funcs;
>>  
>>  /* intel_gmbus.c */
>>  extern void gma_intel_i2c_reset(struct drm_device *dev);
>> diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c
>> index afaebab7bc17..063c66bb946d 100644
>> --- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
>> +++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
>> @@ -11,6 +11,8 @@
>>  #include <linux/i2c.h>
>>  #include <linux/pm_runtime.h>
>>  
>> +#include <drm/drm_simple_kms_helper.h>
>> +
>>  #include "intel_bios.h"
>>  #include "power.h"
>>  #include "psb_drv.h"
>> @@ -621,18 +623,6 @@ const struct drm_connector_funcs psb_intel_lvds_connector_funcs = {
>>  	.destroy = psb_intel_lvds_destroy,
>>  };
>>  
>> -
>> -static void psb_intel_lvds_enc_destroy(struct drm_encoder *encoder)
>> -{
>> -	drm_encoder_cleanup(encoder);
>> -}
>> -
>> -const struct drm_encoder_funcs psb_intel_lvds_enc_funcs = {
>> -	.destroy = psb_intel_lvds_enc_destroy,
>> -};
>> -
>> -
>> -
>>  /**
>>   * psb_intel_lvds_init - setup LVDS connectors on this device
>>   * @dev: drm device
>> @@ -683,9 +673,7 @@ void psb_intel_lvds_init(struct drm_device *dev,
>>  			   &psb_intel_lvds_connector_funcs,
>>  			   DRM_MODE_CONNECTOR_LVDS);
>>  
>> -	drm_encoder_init(dev, encoder,
>> -			 &psb_intel_lvds_enc_funcs,
>> -			 DRM_MODE_ENCODER_LVDS, NULL);
>> +	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
>>  
>>  	gma_connector_attach_encoder(gma_connector, gma_encoder);
>>  	gma_encoder->type = INTEL_OUTPUT_LVDS;
>> diff --git a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
>> index 9e8224456ea2..f7e121f4c609 100644
>> --- a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
>> +++ b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
>> @@ -765,12 +765,7 @@ static const struct drm_encoder_helper_funcs tc35876x_encoder_helper_funcs = {
>>  	.commit = mdfld_dsi_dpi_commit,
>>  };
>>  
>> -static const struct drm_encoder_funcs tc35876x_encoder_funcs = {
>> -	.destroy = drm_encoder_cleanup,
>> -};
>> -
>>  const struct panel_funcs mdfld_tc35876x_funcs = {
>> -	.encoder_funcs = &tc35876x_encoder_funcs,
>>  	.encoder_helper_funcs = &tc35876x_encoder_helper_funcs,
>>  	.get_config_mode = tc35876x_get_config_mode,
>>  	.get_panel_info = tc35876x_get_panel_info,
>> -- 
>> 2.25.1
diff mbox series

Patch

diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c b/drivers/gpu/drm/gma500/cdv_intel_crt.c
index 29c36d63b20e..88535f5aacc5 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
@@ -28,6 +28,8 @@ 
 #include <linux/i2c.h>
 #include <linux/pm_runtime.h>
 
+#include <drm/drm_simple_kms_helper.h>
+
 #include "cdv_device.h"
 #include "intel_bios.h"
 #include "power.h"
@@ -237,15 +239,6 @@  static const struct drm_connector_helper_funcs
 	.best_encoder = gma_best_encoder,
 };
 
-static void cdv_intel_crt_enc_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs cdv_intel_crt_enc_funcs = {
-	.destroy = cdv_intel_crt_enc_destroy,
-};
-
 void cdv_intel_crt_init(struct drm_device *dev,
 			struct psb_intel_mode_device *mode_dev)
 {
@@ -271,8 +264,7 @@  void cdv_intel_crt_init(struct drm_device *dev,
 		&cdv_intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
 
 	encoder = &gma_encoder->base;
-	drm_encoder_init(dev, encoder,
-		&cdv_intel_crt_enc_funcs, DRM_MODE_ENCODER_DAC, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 
diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
index 5772b2dce0d6..13947ec06dbb 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
@@ -32,6 +32,7 @@ 
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_dp_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "gma_display.h"
 #include "psb_drv.h"
@@ -1908,11 +1909,6 @@  cdv_intel_dp_destroy(struct drm_connector *connector)
 	kfree(connector);
 }
 
-static void cdv_intel_dp_encoder_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
 static const struct drm_encoder_helper_funcs cdv_intel_dp_helper_funcs = {
 	.dpms = cdv_intel_dp_dpms,
 	.mode_fixup = cdv_intel_dp_mode_fixup,
@@ -1935,11 +1931,6 @@  static const struct drm_connector_helper_funcs cdv_intel_dp_connector_helper_fun
 	.best_encoder = gma_best_encoder,
 };
 
-static const struct drm_encoder_funcs cdv_intel_dp_enc_funcs = {
-	.destroy = cdv_intel_dp_encoder_destroy,
-};
-
-
 static void cdv_intel_dp_add_properties(struct drm_connector *connector)
 {
 	cdv_intel_attach_force_audio_property(connector);
@@ -2016,8 +2007,7 @@  cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
 	encoder = &gma_encoder->base;
 
 	drm_connector_init(dev, connector, &cdv_intel_dp_connector_funcs, type);
-	drm_encoder_init(dev, encoder, &cdv_intel_dp_enc_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 
@@ -2120,7 +2110,7 @@  cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
 		if (ret == 0) {
 			/* if this fails, presume the device is a ghost */
 			DRM_INFO("failed to retrieve link info, disabling eDP\n");
-			cdv_intel_dp_encoder_destroy(encoder);
+			drm_encoder_cleanup(encoder);
 			cdv_intel_dp_destroy(connector);
 			goto err_priv;
 		} else {
diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
index 1711a41acc16..0d12c6ffbc40 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
@@ -32,6 +32,7 @@ 
 #include <drm/drm.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "cdv_device.h"
 #include "psb_drv.h"
@@ -311,8 +312,7 @@  void cdv_hdmi_init(struct drm_device *dev,
 			   &cdv_hdmi_connector_funcs,
 			   DRM_MODE_CONNECTOR_DVID);
 
-	drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 	gma_encoder->type = INTEL_OUTPUT_HDMI;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
index ea0a5d9a0acc..18de10e9ff9a 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
@@ -12,6 +12,8 @@ 
 #include <linux/i2c.h>
 #include <linux/pm_runtime.h>
 
+#include <drm/drm_simple_kms_helper.h>
+
 #include "cdv_device.h"
 #include "intel_bios.h"
 #include "power.h"
@@ -499,16 +501,6 @@  static const struct drm_connector_funcs cdv_intel_lvds_connector_funcs = {
 	.destroy = cdv_intel_lvds_destroy,
 };
 
-
-static void cdv_intel_lvds_enc_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs cdv_intel_lvds_enc_funcs = {
-	.destroy = cdv_intel_lvds_enc_destroy,
-};
-
 /*
  * Enumerate the child dev array parsed from VBT to check whether
  * the LVDS is present.
@@ -616,10 +608,7 @@  void cdv_intel_lvds_init(struct drm_device *dev,
 			   &cdv_intel_lvds_connector_funcs,
 			   DRM_MODE_CONNECTOR_LVDS);
 
-	drm_encoder_init(dev, encoder,
-			 &cdv_intel_lvds_enc_funcs,
-			 DRM_MODE_ENCODER_LVDS, NULL);
-
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 	gma_encoder->type = INTEL_OUTPUT_LVDS;
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
index d4c65f268922..aa5aa293ddb6 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
@@ -27,6 +27,8 @@ 
 
 #include <linux/delay.h>
 
+#include <drm/drm_simple_kms_helper.h>
+
 #include "mdfld_dsi_dpi.h"
 #include "mdfld_dsi_pkg_sender.h"
 #include "mdfld_output.h"
@@ -993,10 +995,7 @@  struct mdfld_dsi_encoder *mdfld_dsi_dpi_init(struct drm_device *dev,
 	/*create drm encoder object*/
 	connector = &dsi_connector->base.base;
 	encoder = &dpi_output->base.base.base;
-	drm_encoder_init(dev,
-			encoder,
-			p_funcs->encoder_funcs,
-			DRM_MODE_ENCODER_LVDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
 	drm_encoder_helper_add(encoder,
 				p_funcs->encoder_helper_funcs);
 
diff --git a/drivers/gpu/drm/gma500/mdfld_output.h b/drivers/gpu/drm/gma500/mdfld_output.h
index ab2b27c0f037..17a944d70add 100644
--- a/drivers/gpu/drm/gma500/mdfld_output.h
+++ b/drivers/gpu/drm/gma500/mdfld_output.h
@@ -51,7 +51,6 @@  struct panel_info {
 };
 
 struct panel_funcs {
-	const struct drm_encoder_funcs *encoder_funcs;
 	const struct drm_encoder_helper_funcs *encoder_helper_funcs;
 	struct drm_display_mode * (*get_config_mode)(struct drm_device *);
 	int (*get_panel_info)(struct drm_device *, int, struct panel_info *);
diff --git a/drivers/gpu/drm/gma500/mdfld_tmd_vid.c b/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
index 49c92debb7b2..25e897b98f86 100644
--- a/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
+++ b/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
@@ -188,13 +188,7 @@  static const struct drm_encoder_helper_funcs
 	.commit = mdfld_dsi_dpi_commit,
 };
 
-/*TPO DPI encoder funcs*/
-static const struct drm_encoder_funcs mdfld_tpo_dpi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 const struct panel_funcs mdfld_tmd_vid_funcs = {
-	.encoder_funcs = &mdfld_tpo_dpi_encoder_funcs,
 	.encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs,
 	.get_config_mode = &tmd_vid_get_config_mode,
 	.get_panel_info = tmd_vid_get_panel_info,
diff --git a/drivers/gpu/drm/gma500/mdfld_tpo_vid.c b/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
index a9420bf9a419..11845978fb0a 100644
--- a/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
+++ b/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
@@ -76,13 +76,7 @@  static const struct drm_encoder_helper_funcs
 	.commit = mdfld_dsi_dpi_commit,
 };
 
-/*TPO DPI encoder funcs*/
-static const struct drm_encoder_funcs mdfld_tpo_dpi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 const struct panel_funcs mdfld_tpo_vid_funcs = {
-	.encoder_funcs = &mdfld_tpo_dpi_encoder_funcs,
 	.encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs,
 	.get_config_mode = &tpo_vid_get_config_mode,
 	.get_panel_info = tpo_vid_get_panel_info,
diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
index f4370232767d..b25086f252ae 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
@@ -27,6 +27,7 @@ 
 #include <linux/delay.h>
 
 #include <drm/drm.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "psb_drv.h"
 #include "psb_intel_drv.h"
@@ -620,15 +621,6 @@  static const struct drm_connector_funcs oaktrail_hdmi_connector_funcs = {
 	.destroy = oaktrail_hdmi_destroy,
 };
 
-static void oaktrail_hdmi_enc_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs oaktrail_hdmi_enc_funcs = {
-	.destroy = oaktrail_hdmi_enc_destroy,
-};
-
 void oaktrail_hdmi_init(struct drm_device *dev,
 					struct psb_intel_mode_device *mode_dev)
 {
@@ -651,9 +643,7 @@  void oaktrail_hdmi_init(struct drm_device *dev,
 			   &oaktrail_hdmi_connector_funcs,
 			   DRM_MODE_CONNECTOR_DVID);
 
-	drm_encoder_init(dev, encoder,
-			 &oaktrail_hdmi_enc_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 
diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c
index 582e09597500..2828360153d1 100644
--- a/drivers/gpu/drm/gma500/oaktrail_lvds.c
+++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c
@@ -13,6 +13,8 @@ 
 
 #include <asm/intel-mid.h>
 
+#include <drm/drm_simple_kms_helper.h>
+
 #include "intel_bios.h"
 #include "power.h"
 #include "psb_drv.h"
@@ -311,8 +313,7 @@  void oaktrail_lvds_init(struct drm_device *dev,
 			   &psb_intel_lvds_connector_funcs,
 			   DRM_MODE_CONNECTOR_LVDS);
 
-	drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
-			 DRM_MODE_ENCODER_LVDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 	gma_encoder->type = INTEL_OUTPUT_LVDS;
diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h
index 16c6136f778b..fb601983cef0 100644
--- a/drivers/gpu/drm/gma500/psb_intel_drv.h
+++ b/drivers/gpu/drm/gma500/psb_intel_drv.h
@@ -252,7 +252,6 @@  extern int psb_intel_lvds_set_property(struct drm_connector *connector,
 					struct drm_property *property,
 					uint64_t value);
 extern void psb_intel_lvds_destroy(struct drm_connector *connector);
-extern const struct drm_encoder_funcs psb_intel_lvds_enc_funcs;
 
 /* intel_gmbus.c */
 extern void gma_intel_i2c_reset(struct drm_device *dev);
diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c
index afaebab7bc17..063c66bb946d 100644
--- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
@@ -11,6 +11,8 @@ 
 #include <linux/i2c.h>
 #include <linux/pm_runtime.h>
 
+#include <drm/drm_simple_kms_helper.h>
+
 #include "intel_bios.h"
 #include "power.h"
 #include "psb_drv.h"
@@ -621,18 +623,6 @@  const struct drm_connector_funcs psb_intel_lvds_connector_funcs = {
 	.destroy = psb_intel_lvds_destroy,
 };
 
-
-static void psb_intel_lvds_enc_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-const struct drm_encoder_funcs psb_intel_lvds_enc_funcs = {
-	.destroy = psb_intel_lvds_enc_destroy,
-};
-
-
-
 /**
  * psb_intel_lvds_init - setup LVDS connectors on this device
  * @dev: drm device
@@ -683,9 +673,7 @@  void psb_intel_lvds_init(struct drm_device *dev,
 			   &psb_intel_lvds_connector_funcs,
 			   DRM_MODE_CONNECTOR_LVDS);
 
-	drm_encoder_init(dev, encoder,
-			 &psb_intel_lvds_enc_funcs,
-			 DRM_MODE_ENCODER_LVDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 	gma_encoder->type = INTEL_OUTPUT_LVDS;
diff --git a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
index 9e8224456ea2..f7e121f4c609 100644
--- a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
+++ b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
@@ -765,12 +765,7 @@  static const struct drm_encoder_helper_funcs tc35876x_encoder_helper_funcs = {
 	.commit = mdfld_dsi_dpi_commit,
 };
 
-static const struct drm_encoder_funcs tc35876x_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 const struct panel_funcs mdfld_tc35876x_funcs = {
-	.encoder_funcs = &tc35876x_encoder_funcs,
 	.encoder_helper_funcs = &tc35876x_encoder_helper_funcs,
 	.get_config_mode = tc35876x_get_config_mode,
 	.get_panel_info = tc35876x_get_panel_info,