Re: [PATCH 04/10] drm/i915: Backlight setup requires connector so pass it as parameter

Jesse Barnes
2012-10-19T16:53:39Z

On Fri, 19 Oct 2012 14:51:46 +0300
Jani Nikula <jani.nikula@intel.com> wrote:

> Get rid of saved int_lvds_connector and int_edp_connector in
> drm_i915_private.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 2 --
> drivers/gpu/drm/i915/intel_dp.c | 6 ++----
> drivers/gpu/drm/i915/intel_drv.h | 2 +-
> drivers/gpu/drm/i915/intel_lvds.c | 4 +---
> drivers/gpu/drm/i915/intel_panel.c | 15 ++++-----------
> 5 files changed, 8 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index f63ae1c..79dd42a 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -826,8 +826,6 @@ typedef struct drm_i915_private {
> u16 orig_clock;
> int child_dev_num;
> struct child_device_config *child_dev;
> - struct drm_connector *int_lvds_connector;
> - struct drm_connector *int_edp_connector;
>
> bool mchbar_need_disable;
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 697b176..09244f3 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2836,10 +2836,8 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
>
> intel_encoder->hot_plug = intel_dp_hot_plug;
>
> - if (is_edp(intel_dp)) {
> - dev_priv->int_edp_connector = connector;
> - intel_panel_setup_backlight(dev);
> - }
> + if (is_edp(intel_dp))
> + intel_panel_setup_backlight(connector);
>
> intel_dp_add_properties(intel_dp, connector);
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 95cbd67..e5cdf3d 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -444,7 +444,7 @@ extern void intel_pch_panel_fitting(struct drm_device *dev,
> struct drm_display_mode *adjusted_mode);
> extern u32 intel_panel_get_max_backlight(struct drm_device *dev);
> extern void intel_panel_set_backlight(struct drm_device *dev, u32 level);
> -extern int intel_panel_setup_backlight(struct drm_device *dev);
> +extern int intel_panel_setup_backlight(struct drm_connector *connector);
> extern void intel_panel_enable_backlight(struct drm_device *dev,
> enum pipe pipe);
> extern void intel_panel_disable_backlight(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index f3edbf6..cdee7bf 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -1104,11 +1104,9 @@ out:
> DRM_DEBUG_KMS("lid notifier registration failed\n");
> lvds_connector->lid_notifier.notifier_call = NULL;
> }
> - /* keep the LVDS connector */
> - dev_priv->int_lvds_connector = connector;
> drm_sysfs_connector_add(connector);
>
> - intel_panel_setup_backlight(dev);
> + intel_panel_setup_backlight(connector);
>
> return true;
>
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index e019b23..d9752a3 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -416,21 +416,14 @@ static const struct backlight_ops intel_panel_bl_ops = {
> .get_brightness = intel_panel_get_brightness,
> };
>
> -int intel_panel_setup_backlight(struct drm_device *dev)
> +int intel_panel_setup_backlight(struct drm_connector *connector)
> {
> + struct drm_device *dev = connector->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct backlight_properties props;
> - struct drm_connector *connector;
>
> intel_panel_init_backlight(dev);
>
> - if (dev_priv->int_lvds_connector)
> - connector = dev_priv->int_lvds_connector;
> - else if (dev_priv->int_edp_connector)
> - connector = dev_priv->int_edp_connector;
> - else
> - return -ENODEV;
> -
> memset(&props, 0, sizeof(props));
> props.type = BACKLIGHT_RAW;
> props.max_brightness = _intel_panel_get_max_backlight(dev);
> @@ -460,9 +453,9 @@ void intel_panel_destroy_backlight(struct drm_device *dev)
> backlight_device_unregister(dev_priv->backlight);
> }
> #else
> -int intel_panel_setup_backlight(struct drm_device *dev)
> +int intel_panel_setup_backlight(struct drm_connector *connector)
> {
> - intel_panel_init_backlight(dev);
> + intel_panel_init_backlight(connector->dev);
> return 0;
> }
>

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
--
Jesse Barnes, Intel Open Source Technology Center