Re: [PATCH 1/4] drm/exynos: hdmi: move hdmi subsystem registration to drm common hdmi

2013-05-03 Thread Rahul Sharma
On Mon, Apr 29, 2013 at 10:06 PM, Sean Paul seanp...@google.com wrote:
 On Mon, Apr 29, 2013 at 10:50 AM, Rahul Sharma rahul.sha...@samsung.com 
 wrote:
 Exynos hdmi sub-system consists of mixer, hdmi ip, hdmi-phy and hdmi-ddc
 components. Currently, drivers for these components are getting registered
 in exynos_drm_drv.c, which is meant for registration of drm sub-drivers.

 In this patch, registration of drm hdmi sub-driver and device, drivers for
 hdmi sub-system components are moved to exynos_drm_hdmi.c. This ensures
 limited  relevant exposure of hdmi-sub-system components to 
 exynos_drm_drv.c.
 It will also help in handling the hdmi-sub-system diversities within the
 exynos-common-hdmi.

 Signed-off-by: Rahul Sharma rahul.sha...@samsung.com
 ---
  drivers/gpu/drm/exynos/exynos_drm_drv.c  |   25 ++--
  drivers/gpu/drm/exynos/exynos_drm_drv.h  |   14 -
  drivers/gpu/drm/exynos/exynos_drm_hdmi.c |   46 
 --
  drivers/gpu/drm/exynos/exynos_drm_hdmi.h |3 ++
  4 files changed, 49 insertions(+), 39 deletions(-)

 diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
 b/drivers/gpu/drm/exynos/exynos_drm_drv.c
 index ba6d995..4eabb6e 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
 @@ -331,19 +331,9 @@ static int __init exynos_drm_init(void)
  #endif

  #ifdef CONFIG_DRM_EXYNOS_HDMI
 -   ret = platform_driver_register(hdmi_driver);
 +   ret = exynos_common_hdmi_register();
 if (ret  0)
 goto out_hdmi;
 -   ret = platform_driver_register(mixer_driver);
 -   if (ret  0)
 -   goto out_mixer;
 -   ret = platform_driver_register(exynos_drm_common_hdmi_driver);
 -   if (ret  0)
 -   goto out_common_hdmi;
 -
 -   ret = exynos_platform_device_hdmi_register();
 -   if (ret  0)
 -   goto out_common_hdmi_dev;
  #endif

  #ifdef CONFIG_DRM_EXYNOS_VIDI
 @@ -436,13 +426,7 @@ out_vidi:
  #endif

  #ifdef CONFIG_DRM_EXYNOS_HDMI
 -   exynos_platform_device_hdmi_unregister();
 -out_common_hdmi_dev:
 -   platform_driver_unregister(exynos_drm_common_hdmi_driver);
 -out_common_hdmi:
 -   platform_driver_unregister(mixer_driver);
 -out_mixer:
 -   platform_driver_unregister(hdmi_driver);
 +   exynos_common_hdmi_unregister();
  out_hdmi:
  #endif

 @@ -483,10 +467,7 @@ static void __exit exynos_drm_exit(void)
  #endif

  #ifdef CONFIG_DRM_EXYNOS_HDMI
 -   exynos_platform_device_hdmi_unregister();
 -   platform_driver_unregister(exynos_drm_common_hdmi_driver);
 -   platform_driver_unregister(mixer_driver);
 -   platform_driver_unregister(hdmi_driver);
 +   exynos_common_hdmi_unregister();
  #endif

  #ifdef CONFIG_DRM_EXYNOS_VIDI
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
 b/drivers/gpu/drm/exynos/exynos_drm_drv.h
 index eaa1966..34aa36d 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
 +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
 @@ -319,15 +319,16 @@ int exynos_drm_subdrv_open(struct drm_device *dev, 
 struct drm_file *file);
  void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file);

  /*
 - * this function registers exynos drm hdmi platform device. It ensures only 
 one
 - * instance of the device is created.
 + * this function registers exynos drm hdmi platform driver and singleton
 + * device. It also registers subdrivers like mixer, hdmi and hdmiphy.
   */
 -int exynos_platform_device_hdmi_register(void);
 +int exynos_common_hdmi_register(void);

  /*
 - * this function unregisters exynos drm hdmi platform device if it exists.
 + * this function unregisters exynos drm hdmi platform driver and device,
 + * subdrivers for mixer, hdmi and hdmiphy.
   */
 -void exynos_platform_device_hdmi_unregister(void);
 +void exynos_common_hdmi_unregister(void);

  /*
   * this function registers exynos drm ipp platform device.
 @@ -340,9 +341,6 @@ int exynos_platform_device_ipp_register(void);
  void exynos_platform_device_ipp_unregister(void);

  extern struct platform_driver fimd_driver;
 -extern struct platform_driver hdmi_driver;
 -extern struct platform_driver mixer_driver;
 -extern struct platform_driver exynos_drm_common_hdmi_driver;
  extern struct platform_driver vidi_driver;
  extern struct platform_driver g2d_driver;
  extern struct platform_driver fimc_driver;
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c 
 b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
 index 060fbe8..7ab5f9f 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
 @@ -41,6 +41,8 @@ static struct exynos_drm_hdmi_context *mixer_ctx;
  static struct exynos_hdmi_ops *hdmi_ops;
  static struct exynos_mixer_ops *mixer_ops;

 +struct platform_driver exynos_drm_common_hdmi_driver;

 What's the point of even having this driver? It doesn't do anything.
 You call exynos_common_hdmi_register/unregister in drm_drv anyways.
 Why not just register the 

Re: [PATCH 1/4] drm/exynos: hdmi: move hdmi subsystem registration to drm common hdmi

2013-05-03 Thread Sean Paul
On Fri, May 3, 2013 at 2:04 AM, Rahul Sharma r.sh.o...@gmail.com wrote:
 On Mon, Apr 29, 2013 at 10:06 PM, Sean Paul seanp...@google.com wrote:
 On Mon, Apr 29, 2013 at 10:50 AM, Rahul Sharma rahul.sha...@samsung.com 
 wrote:
 Exynos hdmi sub-system consists of mixer, hdmi ip, hdmi-phy and hdmi-ddc
 components. Currently, drivers for these components are getting registered
 in exynos_drm_drv.c, which is meant for registration of drm sub-drivers.

 In this patch, registration of drm hdmi sub-driver and device, drivers for
 hdmi sub-system components are moved to exynos_drm_hdmi.c. This ensures
 limited  relevant exposure of hdmi-sub-system components to 
 exynos_drm_drv.c.
 It will also help in handling the hdmi-sub-system diversities within the
 exynos-common-hdmi.

 Signed-off-by: Rahul Sharma rahul.sha...@samsung.com
 ---
  drivers/gpu/drm/exynos/exynos_drm_drv.c  |   25 ++--
  drivers/gpu/drm/exynos/exynos_drm_drv.h  |   14 -
  drivers/gpu/drm/exynos/exynos_drm_hdmi.c |   46 
 --
  drivers/gpu/drm/exynos/exynos_drm_hdmi.h |3 ++
  4 files changed, 49 insertions(+), 39 deletions(-)

 diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
 b/drivers/gpu/drm/exynos/exynos_drm_drv.c
 index ba6d995..4eabb6e 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
 @@ -331,19 +331,9 @@ static int __init exynos_drm_init(void)
  #endif

  #ifdef CONFIG_DRM_EXYNOS_HDMI
 -   ret = platform_driver_register(hdmi_driver);
 +   ret = exynos_common_hdmi_register();
 if (ret  0)
 goto out_hdmi;
 -   ret = platform_driver_register(mixer_driver);
 -   if (ret  0)
 -   goto out_mixer;
 -   ret = platform_driver_register(exynos_drm_common_hdmi_driver);
 -   if (ret  0)
 -   goto out_common_hdmi;
 -
 -   ret = exynos_platform_device_hdmi_register();
 -   if (ret  0)
 -   goto out_common_hdmi_dev;
  #endif

  #ifdef CONFIG_DRM_EXYNOS_VIDI
 @@ -436,13 +426,7 @@ out_vidi:
  #endif

  #ifdef CONFIG_DRM_EXYNOS_HDMI
 -   exynos_platform_device_hdmi_unregister();
 -out_common_hdmi_dev:
 -   platform_driver_unregister(exynos_drm_common_hdmi_driver);
 -out_common_hdmi:
 -   platform_driver_unregister(mixer_driver);
 -out_mixer:
 -   platform_driver_unregister(hdmi_driver);
 +   exynos_common_hdmi_unregister();
  out_hdmi:
  #endif

 @@ -483,10 +467,7 @@ static void __exit exynos_drm_exit(void)
  #endif

  #ifdef CONFIG_DRM_EXYNOS_HDMI
 -   exynos_platform_device_hdmi_unregister();
 -   platform_driver_unregister(exynos_drm_common_hdmi_driver);
 -   platform_driver_unregister(mixer_driver);
 -   platform_driver_unregister(hdmi_driver);
 +   exynos_common_hdmi_unregister();
  #endif

  #ifdef CONFIG_DRM_EXYNOS_VIDI
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
 b/drivers/gpu/drm/exynos/exynos_drm_drv.h
 index eaa1966..34aa36d 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
 +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
 @@ -319,15 +319,16 @@ int exynos_drm_subdrv_open(struct drm_device *dev, 
 struct drm_file *file);
  void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file 
 *file);

  /*
 - * this function registers exynos drm hdmi platform device. It ensures 
 only one
 - * instance of the device is created.
 + * this function registers exynos drm hdmi platform driver and singleton
 + * device. It also registers subdrivers like mixer, hdmi and hdmiphy.
   */
 -int exynos_platform_device_hdmi_register(void);
 +int exynos_common_hdmi_register(void);

  /*
 - * this function unregisters exynos drm hdmi platform device if it exists.
 + * this function unregisters exynos drm hdmi platform driver and device,
 + * subdrivers for mixer, hdmi and hdmiphy.
   */
 -void exynos_platform_device_hdmi_unregister(void);
 +void exynos_common_hdmi_unregister(void);

  /*
   * this function registers exynos drm ipp platform device.
 @@ -340,9 +341,6 @@ int exynos_platform_device_ipp_register(void);
  void exynos_platform_device_ipp_unregister(void);

  extern struct platform_driver fimd_driver;
 -extern struct platform_driver hdmi_driver;
 -extern struct platform_driver mixer_driver;
 -extern struct platform_driver exynos_drm_common_hdmi_driver;
  extern struct platform_driver vidi_driver;
  extern struct platform_driver g2d_driver;
  extern struct platform_driver fimc_driver;
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c 
 b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
 index 060fbe8..7ab5f9f 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
 @@ -41,6 +41,8 @@ static struct exynos_drm_hdmi_context *mixer_ctx;
  static struct exynos_hdmi_ops *hdmi_ops;
  static struct exynos_mixer_ops *mixer_ops;

 +struct platform_driver exynos_drm_common_hdmi_driver;

 What's the point of even having this driver? It doesn't do anything.
 You call 

Re: [PATCH 1/4] drm/exynos: hdmi: move hdmi subsystem registration to drm common hdmi

2013-04-29 Thread Sean Paul
On Mon, Apr 29, 2013 at 10:50 AM, Rahul Sharma rahul.sha...@samsung.com wrote:
 Exynos hdmi sub-system consists of mixer, hdmi ip, hdmi-phy and hdmi-ddc
 components. Currently, drivers for these components are getting registered
 in exynos_drm_drv.c, which is meant for registration of drm sub-drivers.

 In this patch, registration of drm hdmi sub-driver and device, drivers for
 hdmi sub-system components are moved to exynos_drm_hdmi.c. This ensures
 limited  relevant exposure of hdmi-sub-system components to exynos_drm_drv.c.
 It will also help in handling the hdmi-sub-system diversities within the
 exynos-common-hdmi.

 Signed-off-by: Rahul Sharma rahul.sha...@samsung.com
 ---
  drivers/gpu/drm/exynos/exynos_drm_drv.c  |   25 ++--
  drivers/gpu/drm/exynos/exynos_drm_drv.h  |   14 -
  drivers/gpu/drm/exynos/exynos_drm_hdmi.c |   46 
 --
  drivers/gpu/drm/exynos/exynos_drm_hdmi.h |3 ++
  4 files changed, 49 insertions(+), 39 deletions(-)

 diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
 b/drivers/gpu/drm/exynos/exynos_drm_drv.c
 index ba6d995..4eabb6e 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
 @@ -331,19 +331,9 @@ static int __init exynos_drm_init(void)
  #endif

  #ifdef CONFIG_DRM_EXYNOS_HDMI
 -   ret = platform_driver_register(hdmi_driver);
 +   ret = exynos_common_hdmi_register();
 if (ret  0)
 goto out_hdmi;
 -   ret = platform_driver_register(mixer_driver);
 -   if (ret  0)
 -   goto out_mixer;
 -   ret = platform_driver_register(exynos_drm_common_hdmi_driver);
 -   if (ret  0)
 -   goto out_common_hdmi;
 -
 -   ret = exynos_platform_device_hdmi_register();
 -   if (ret  0)
 -   goto out_common_hdmi_dev;
  #endif

  #ifdef CONFIG_DRM_EXYNOS_VIDI
 @@ -436,13 +426,7 @@ out_vidi:
  #endif

  #ifdef CONFIG_DRM_EXYNOS_HDMI
 -   exynos_platform_device_hdmi_unregister();
 -out_common_hdmi_dev:
 -   platform_driver_unregister(exynos_drm_common_hdmi_driver);
 -out_common_hdmi:
 -   platform_driver_unregister(mixer_driver);
 -out_mixer:
 -   platform_driver_unregister(hdmi_driver);
 +   exynos_common_hdmi_unregister();
  out_hdmi:
  #endif

 @@ -483,10 +467,7 @@ static void __exit exynos_drm_exit(void)
  #endif

  #ifdef CONFIG_DRM_EXYNOS_HDMI
 -   exynos_platform_device_hdmi_unregister();
 -   platform_driver_unregister(exynos_drm_common_hdmi_driver);
 -   platform_driver_unregister(mixer_driver);
 -   platform_driver_unregister(hdmi_driver);
 +   exynos_common_hdmi_unregister();
  #endif

  #ifdef CONFIG_DRM_EXYNOS_VIDI
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
 b/drivers/gpu/drm/exynos/exynos_drm_drv.h
 index eaa1966..34aa36d 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
 +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
 @@ -319,15 +319,16 @@ int exynos_drm_subdrv_open(struct drm_device *dev, 
 struct drm_file *file);
  void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file);

  /*
 - * this function registers exynos drm hdmi platform device. It ensures only 
 one
 - * instance of the device is created.
 + * this function registers exynos drm hdmi platform driver and singleton
 + * device. It also registers subdrivers like mixer, hdmi and hdmiphy.
   */
 -int exynos_platform_device_hdmi_register(void);
 +int exynos_common_hdmi_register(void);

  /*
 - * this function unregisters exynos drm hdmi platform device if it exists.
 + * this function unregisters exynos drm hdmi platform driver and device,
 + * subdrivers for mixer, hdmi and hdmiphy.
   */
 -void exynos_platform_device_hdmi_unregister(void);
 +void exynos_common_hdmi_unregister(void);

  /*
   * this function registers exynos drm ipp platform device.
 @@ -340,9 +341,6 @@ int exynos_platform_device_ipp_register(void);
  void exynos_platform_device_ipp_unregister(void);

  extern struct platform_driver fimd_driver;
 -extern struct platform_driver hdmi_driver;
 -extern struct platform_driver mixer_driver;
 -extern struct platform_driver exynos_drm_common_hdmi_driver;
  extern struct platform_driver vidi_driver;
  extern struct platform_driver g2d_driver;
  extern struct platform_driver fimc_driver;
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c 
 b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
 index 060fbe8..7ab5f9f 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
 @@ -41,6 +41,8 @@ static struct exynos_drm_hdmi_context *mixer_ctx;
  static struct exynos_hdmi_ops *hdmi_ops;
  static struct exynos_mixer_ops *mixer_ops;

 +struct platform_driver exynos_drm_common_hdmi_driver;

What's the point of even having this driver? It doesn't do anything.
You call exynos_common_hdmi_register/unregister in drm_drv anyways.
Why not just register the mixer/hdmi/hdmiphy drivers and exynos subdrv
in those functions directly?

 +