diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c index 630f6e8..20dbcc1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c @@ -174,6 +174,23 @@ static const struct backlight_ops nva3_bl_ops = { .update_status = nva3_set_intensity, }; +int +nouveau_backlight_config(struct nouveau_drm *drm) +{ + struct backlight_device *bd = drm->backlight; + struct nouveau_encoder *nv_encoder = bl_get_data(bd); + struct nouveau_device *device = nv_device(drm->device); + int or = nv_encoder->or; + + if (device->card_type == NV_50 && + (device->chipset <= 0xa0 || + device->chipset == 0xaa || + device->chipset == 0xac)) + nv_wr32(device, NV50_PDISP_SOR_PWM_DIV(or), 0x5e); + + return 0; +} + static int nv50_backlight_init(struct drm_connector *connector) { @@ -191,9 +208,6 @@ nv50_backlight_init(struct drm_connector *connector) return -ENODEV; } - if (!nv_rd32(device, NV50_PDISP_SOR_PWM_CTL(nv_encoder->or))) - return 0; - if (device->chipset <= 0xa0 || device->chipset == 0xaa || device->chipset == 0xac) diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index da764a4..9b506ba 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -379,6 +379,7 @@ static struct nouveau_drm_prop_enum_list dither_depth[] = { int nouveau_display_init(struct drm_device *dev) { + struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_display *disp = nouveau_display(dev); struct drm_connector *connector; int ret; @@ -396,6 +397,10 @@ nouveau_display_init(struct drm_device *dev) if (conn->hpd_func) nouveau_event_get(conn->hpd_func); } + /* configure backlight params */ + if(drm->backlight) + nouveau_backlight_config(drm); + return ret; } diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h index a71cf77..c8c9f5b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.h +++ b/drivers/gpu/drm/nouveau/nouveau_display.h @@ -85,6 +85,7 @@ void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *); int nouveau_crtc_set_config(struct drm_mode_set *set); #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT extern int nouveau_backlight_init(struct drm_device *); +extern int nouveau_backlight_config(struct nouveau_drm *); extern void nouveau_backlight_exit(struct drm_device *); #else static inline int @@ -93,6 +94,12 @@ nouveau_backlight_init(struct drm_device *dev) return 0; } +static inline int +nouveau_backlight_config(struct nouveau_drm *drm) +{ + return 0; +} + static inline void nouveau_backlight_exit(struct drm_device *dev) { }