Re: [PATCH 4/5] nouveau: Change the backlight parent device to the connector, not the PCI dev

2011-01-14 Thread Anca Emanuel
On Fri, Jan 14, 2011 at 9:24 PM, Matthew Garrett m...@redhat.com wrote:
 We may eventually end up with per-connector backlights, especially with
 ddcci devices. Make sure that the parent node for the backlight device is
 the connector rather than the PCI device.

 Signed-off-by: Matthew Garrett m...@redhat.com
 ---
  drivers/gpu/drm/nouveau/nouveau_backlight.c |   24 ++--
  drivers/gpu/drm/nouveau/nouveau_connector.c |    9 +
  drivers/gpu/drm/nouveau/nouveau_drv.h       |    8 
  drivers/gpu/drm/nouveau/nouveau_state.c     |    6 --
  4 files changed, 27 insertions(+), 20 deletions(-)

 diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c 
 b/drivers/gpu/drm/nouveau/nouveau_backlight.c
 index 18d7bcc..00a55df 100644
 --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
 +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
 @@ -88,10 +88,11 @@ static const struct backlight_ops nv50_bl_ops = {
        .update_status = nv50_set_intensity,
  };

 -static int nouveau_nv40_backlight_init(struct drm_device *dev)
 +static int nouveau_nv40_backlight_init(struct drm_connector *connector)
  {
 -       struct backlight_properties props;
 +       struct drm_device *dev = connector-dev;
        struct drm_nouveau_private *dev_priv = dev-dev_private;
 +       struct backlight_properties props;
        struct backlight_device *bd;

        if (!(nv_rd32(dev, NV40_PMC_BACKLIGHT)  NV40_PMC_BACKLIGHT_MASK))
 @@ -100,7 +101,7 @@ static int nouveau_nv40_backlight_init(struct drm_device 
 *dev)
        memset(props, 0, sizeof(struct backlight_properties));
        props.type = BACKLIGHT_RAW;
        props.max_brightness = 31;
 -       bd = backlight_device_register(nv_backlight, dev-pdev-dev, dev,
 +       bd = backlight_device_register(nv_backlight, connector-kdev, dev,
                                       nv40_bl_ops, props);
        if (IS_ERR(bd))
                return PTR_ERR(bd);
 @@ -112,10 +113,11 @@ static int nouveau_nv40_backlight_init(struct 
 drm_device *dev)
        return 0;
  }

 -static int nouveau_nv50_backlight_init(struct drm_device *dev)
 +static int nouveau_nv50_backlight_init(struct drm_connector *connector)
  {
 -       struct backlight_properties props;
 +       struct drm_device *dev = connector-dev;
        struct drm_nouveau_private *dev_priv = dev-dev_private;
 +       struct backlight_properties props;
        struct backlight_device *bd;

        if (!nv_rd32(dev, NV50_PDISPLAY_SOR_BACKLIGHT))
 @@ -124,7 +126,7 @@ static int nouveau_nv50_backlight_init(struct drm_device 
 *dev)
        memset(props, 0, sizeof(struct backlight_properties));
        props.type = BACKLIGHT_RAW;
        props.max_brightness = 1025;
 -       bd = backlight_device_register(nv_backlight, dev-pdev-dev, dev,
 +       bd = backlight_device_register(nv_backlight, connector-kdev, dev,
                                       nv50_bl_ops, props);
        if (IS_ERR(bd))
                return PTR_ERR(bd);
 @@ -135,8 +137,9 @@ static int nouveau_nv50_backlight_init(struct drm_device 
 *dev)
        return 0;
  }

 -int nouveau_backlight_init(struct drm_device *dev)
 +int nouveau_backlight_init(struct drm_connector *connector)
  {
 +       struct drm_device *dev = connector-dev;
        struct drm_nouveau_private *dev_priv = dev-dev_private;

  #ifdef CONFIG_ACPI
 @@ -149,9 +152,9 @@ int nouveau_backlight_init(struct drm_device *dev)

        switch (dev_priv-card_type) {
        case NV_40:
 -               return nouveau_nv40_backlight_init(dev);
 +               return nouveau_nv40_backlight_init(connector);
        case NV_50:
 -               return nouveau_nv50_backlight_init(dev);
 +               return nouveau_nv50_backlight_init(connector);
        default:
                break;
        }
 @@ -159,8 +162,9 @@ int nouveau_backlight_init(struct drm_device *dev)
        return 0;
  }

 -void nouveau_backlight_exit(struct drm_device *dev)
 +void nouveau_backlight_exit(struct drm_connector *connector)
  {
 +       struct drm_device *dev = connector-dev;
        struct drm_nouveau_private *dev_priv = dev-dev_private;

        if (dev_priv-backlight) {
 diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c 
 b/drivers/gpu/drm/nouveau/nouveau_connector.c
 index a21e000..3a1ecc7 100644
 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c
 +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
 @@ -116,6 +116,10 @@ nouveau_connector_destroy(struct drm_connector 
 *connector)
                                      nouveau_connector_hotplug, connector);
        }

 +       if (connector-connector_type == DRM_MODE_CONNECTOR_LVDS ||
 +           connector-connector_type == DRM_MODE_CONNECTOR_eDP)
 +               nouveau_backlight_exit(connector);
 +
        kfree(nv_connector-edid);
        drm_sysfs_connector_remove(connector);
        drm_connector_cleanup(connector);
 @@ -893,6 +897,11 @@ nouveau_connector_create(struct drm_device *dev, int 
 index)
        }

        

Re: [PATCH 4/5] nouveau: Change the backlight parent device to the connector, not the PCI dev

2011-01-14 Thread Matthew Garrett
On Fri, Jan 14, 2011 at 09:30:19PM +0200, Anca Emanuel wrote:

 Hi Matthew Garrett,
 I have problems with nouveau.
 Do you know ?

Your best bet is to follow the instructions on 
http://nouveau.freedesktop.org/wiki/Bugs to report a bug.

-- 
Matthew Garrett | mj...@srcf.ucam.org
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel