Re: [PATCH] radeon: Expose backlight class device for legacy LVDSencoder

From: Michel Dänzer
Date: Wed Sep 15 2010 - 07:39:01 EST


On Mon, 2010-09-13 at 09:54 +0200, Michel DÃnzer wrote:
> On Mit, 2010-09-08 at 12:32 -0400, Matthew Garrett wrote:
> > From: Michel DÃnzer <michel@xxxxxxxxxxx>
> >
> > Allows e.g. power management daemons to control the backlight level. Inspired
> > by the corresponding code in radeonfb.
> >
> > (Updated to add backlight type and make the connector the parent device - mjg)
> >
> > Signed-off-by: Michel DÃnzer <daenzer@xxxxxxxxxx>
> > Signed-off-by: Matthew Garrett <mjg@xxxxxxxxxx>
>
> Thanks for picking this up, Matthew.
>
> Unfortunately, it fails to build here:
>
> CC [M] drivers/gpu/drm/radeon/radeon_legacy_encoders.o
> drivers/gpu/drm/radeon/radeon_legacy_encoders.c: In function âradeon_legacy_backlight_initâ:
> drivers/gpu/drm/radeon/radeon_legacy_encoders.c:358: error: implicit declaration of function âpmac_has_backlight_typeâ
> drivers/gpu/drm/radeon/radeon_legacy_encoders.c:403: error: implicit declaration of function âmachine_is_compatibleâ
> make[1]: *** [drivers/gpu/drm/radeon/radeon_legacy_encoders.o] Error 1
> make: *** [_module_drivers/gpu/drm/radeon] Error 2

Also, radeon_get_connector_for_encoder() only works when a mode is set,
connector->kdev is only initialized after drm_sysfs_connector_add(), and
I deliberately chose the backlight device name ending in "bl" because
that's what pbbuttonsd looks for (though of course that could be fixed
there).

The updated patch below fixes these issues, successfully using this
right now.