Commit 0da28d5f authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Geert Uytterhoeven

drm: renesas: shmobile: Remove backlight support

Backlight support should be implemented by panels, not by the LCDC
driver.  As the feature is currently unused anyway, remove it.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
[geert: Cleanups]
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/69707650245bc2193d072f24723d4d5482ea590b.1694767209.git.geert+renesas@glider.be
parent 7802ca6b
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
shmob-drm-y := shmob_drm_backlight.o \ shmob-drm-y := shmob_drm_crtc.o \
shmob_drm_crtc.o \
shmob_drm_drv.o \ shmob_drm_drv.o \
shmob_drm_kms.o \ shmob_drm_kms.o \
shmob_drm_plane.o shmob_drm_plane.o
......
// SPDX-License-Identifier: GPL-2.0+
/*
* shmob_drm_backlight.c -- SH Mobile DRM Backlight
*
* Copyright (C) 2012 Renesas Electronics Corporation
*
* Laurent Pinchart (laurent.pinchart@ideasonboard.com)
*/
#include <linux/backlight.h>
#include "shmob_drm_backlight.h"
#include "shmob_drm_crtc.h"
#include "shmob_drm_drv.h"
static int shmob_drm_backlight_update(struct backlight_device *bdev)
{
struct shmob_drm_connector *scon = bl_get_data(bdev);
struct shmob_drm_device *sdev = scon->connector.dev->dev_private;
const struct shmob_drm_backlight_data *bdata = &sdev->pdata->backlight;
int brightness = backlight_get_brightness(bdev);
return bdata->set_brightness(brightness);
}
static int shmob_drm_backlight_get_brightness(struct backlight_device *bdev)
{
struct shmob_drm_connector *scon = bl_get_data(bdev);
struct shmob_drm_device *sdev = scon->connector.dev->dev_private;
const struct shmob_drm_backlight_data *bdata = &sdev->pdata->backlight;
return bdata->get_brightness();
}
static const struct backlight_ops shmob_drm_backlight_ops = {
.options = BL_CORE_SUSPENDRESUME,
.update_status = shmob_drm_backlight_update,
.get_brightness = shmob_drm_backlight_get_brightness,
};
void shmob_drm_backlight_dpms(struct shmob_drm_connector *scon, int mode)
{
if (scon->backlight == NULL)
return;
scon->backlight->props.power = mode == DRM_MODE_DPMS_ON
? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
backlight_update_status(scon->backlight);
}
int shmob_drm_backlight_init(struct shmob_drm_connector *scon)
{
struct shmob_drm_device *sdev = scon->connector.dev->dev_private;
const struct shmob_drm_backlight_data *bdata = &sdev->pdata->backlight;
struct drm_connector *connector = &scon->connector;
struct drm_device *dev = connector->dev;
struct backlight_device *backlight;
if (!bdata->max_brightness)
return 0;
backlight = backlight_device_register(bdata->name, dev->dev, scon,
&shmob_drm_backlight_ops, NULL);
if (IS_ERR(backlight)) {
dev_err(dev->dev, "unable to register backlight device: %ld\n",
PTR_ERR(backlight));
return PTR_ERR(backlight);
}
backlight->props.max_brightness = bdata->max_brightness;
backlight->props.brightness = bdata->max_brightness;
backlight->props.power = FB_BLANK_POWERDOWN;
backlight_update_status(backlight);
scon->backlight = backlight;
return 0;
}
void shmob_drm_backlight_exit(struct shmob_drm_connector *scon)
{
backlight_device_unregister(scon->backlight);
}
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* shmob_drm_backlight.h -- SH Mobile DRM Backlight
*
* Copyright (C) 2012 Renesas Electronics Corporation
*
* Laurent Pinchart (laurent.pinchart@ideasonboard.com)
*/
#ifndef __SHMOB_DRM_BACKLIGHT_H__
#define __SHMOB_DRM_BACKLIGHT_H__
struct shmob_drm_connector;
void shmob_drm_backlight_dpms(struct shmob_drm_connector *scon, int mode);
int shmob_drm_backlight_init(struct shmob_drm_connector *scon);
void shmob_drm_backlight_exit(struct shmob_drm_connector *scon);
#endif /* __SHMOB_DRM_BACKLIGHT_H__ */
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* Laurent Pinchart (laurent.pinchart@ideasonboard.com) * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
*/ */
#include <linux/backlight.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
...@@ -24,7 +23,6 @@ ...@@ -24,7 +23,6 @@
#include <drm/drm_simple_kms_helper.h> #include <drm/drm_simple_kms_helper.h>
#include <drm/drm_vblank.h> #include <drm/drm_vblank.h>
#include "shmob_drm_backlight.h"
#include "shmob_drm_crtc.h" #include "shmob_drm_crtc.h"
#include "shmob_drm_drv.h" #include "shmob_drm_drv.h"
#include "shmob_drm_kms.h" #include "shmob_drm_kms.h"
...@@ -487,21 +485,9 @@ int shmob_drm_crtc_create(struct shmob_drm_device *sdev) ...@@ -487,21 +485,9 @@ int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
* Encoder * Encoder
*/ */
#define to_shmob_encoder(e) \
container_of(e, struct shmob_drm_encoder, encoder)
static void shmob_drm_encoder_dpms(struct drm_encoder *encoder, int mode) static void shmob_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
{ {
struct shmob_drm_encoder *senc = to_shmob_encoder(encoder); /* No-op, everything is handled in the CRTC code. */
struct shmob_drm_device *sdev = encoder->dev->dev_private;
struct shmob_drm_connector *scon = &sdev->connector;
if (senc->dpms == mode)
return;
shmob_drm_backlight_dpms(scon, mode);
senc->dpms = mode;
} }
static bool shmob_drm_encoder_mode_fixup(struct drm_encoder *encoder, static bool shmob_drm_encoder_mode_fixup(struct drm_encoder *encoder,
...@@ -553,11 +539,9 @@ static const struct drm_encoder_helper_funcs encoder_helper_funcs = { ...@@ -553,11 +539,9 @@ static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
int shmob_drm_encoder_create(struct shmob_drm_device *sdev) int shmob_drm_encoder_create(struct shmob_drm_device *sdev)
{ {
struct drm_encoder *encoder = &sdev->encoder.encoder; struct drm_encoder *encoder = &sdev->encoder;
int ret; int ret;
sdev->encoder.dpms = DRM_MODE_DPMS_OFF;
encoder->possible_crtcs = 1; encoder->possible_crtcs = 1;
ret = drm_simple_encoder_init(sdev->ddev, encoder, ret = drm_simple_encoder_init(sdev->ddev, encoder,
...@@ -622,9 +606,6 @@ static const struct drm_connector_helper_funcs connector_helper_funcs = { ...@@ -622,9 +606,6 @@ static const struct drm_connector_helper_funcs connector_helper_funcs = {
static void shmob_drm_connector_destroy(struct drm_connector *connector) static void shmob_drm_connector_destroy(struct drm_connector *connector)
{ {
struct shmob_drm_connector *scon = to_shmob_connector(connector);
shmob_drm_backlight_exit(scon);
drm_connector_unregister(connector); drm_connector_unregister(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
} }
...@@ -653,13 +634,9 @@ int shmob_drm_connector_create(struct shmob_drm_device *sdev, ...@@ -653,13 +634,9 @@ int shmob_drm_connector_create(struct shmob_drm_device *sdev,
drm_connector_helper_add(connector, &connector_helper_funcs); drm_connector_helper_add(connector, &connector_helper_funcs);
ret = shmob_drm_backlight_init(&sdev->connector);
if (ret < 0)
goto err_cleanup;
ret = drm_connector_attach_encoder(connector, encoder); ret = drm_connector_attach_encoder(connector, encoder);
if (ret < 0) if (ret < 0)
goto err_backlight; goto error;
drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
drm_object_property_set_value(&connector->base, drm_object_property_set_value(&connector->base,
...@@ -667,9 +644,7 @@ int shmob_drm_connector_create(struct shmob_drm_device *sdev, ...@@ -667,9 +644,7 @@ int shmob_drm_connector_create(struct shmob_drm_device *sdev,
return 0; return 0;
err_backlight: error:
shmob_drm_backlight_exit(&sdev->connector);
err_cleanup:
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
return ret; return ret;
} }
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <drm/drm_connector.h> #include <drm/drm_connector.h>
#include <drm/drm_encoder.h> #include <drm/drm_encoder.h>
struct backlight_device;
struct drm_pending_vblank_event; struct drm_pending_vblank_event;
struct shmob_drm_device; struct shmob_drm_device;
struct shmob_drm_format_info; struct shmob_drm_format_info;
...@@ -31,16 +30,9 @@ struct shmob_drm_crtc { ...@@ -31,16 +30,9 @@ struct shmob_drm_crtc {
bool started; bool started;
}; };
struct shmob_drm_encoder {
struct drm_encoder encoder;
int dpms;
};
struct shmob_drm_connector { struct shmob_drm_connector {
struct drm_connector connector; struct drm_connector connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct backlight_device *backlight;
}; };
int shmob_drm_crtc_create(struct shmob_drm_device *sdev); int shmob_drm_crtc_create(struct shmob_drm_device *sdev);
......
...@@ -35,7 +35,7 @@ struct shmob_drm_device { ...@@ -35,7 +35,7 @@ struct shmob_drm_device {
struct drm_device *ddev; struct drm_device *ddev;
struct shmob_drm_crtc crtc; struct shmob_drm_crtc crtc;
struct shmob_drm_encoder encoder; struct drm_encoder encoder;
struct shmob_drm_connector connector; struct shmob_drm_connector connector;
}; };
......
...@@ -159,7 +159,7 @@ int shmob_drm_modeset_init(struct shmob_drm_device *sdev) ...@@ -159,7 +159,7 @@ int shmob_drm_modeset_init(struct shmob_drm_device *sdev)
shmob_drm_crtc_create(sdev); shmob_drm_crtc_create(sdev);
shmob_drm_encoder_create(sdev); shmob_drm_encoder_create(sdev);
shmob_drm_connector_create(sdev, &sdev->encoder.encoder); shmob_drm_connector_create(sdev, &sdev->encoder);
drm_kms_helper_poll_init(sdev->ddev); drm_kms_helper_poll_init(sdev->ddev);
......
...@@ -40,13 +40,6 @@ enum shmob_drm_interface { ...@@ -40,13 +40,6 @@ enum shmob_drm_interface {
SHMOB_DRM_IFACE_SYS24, /* 24bpp */ SHMOB_DRM_IFACE_SYS24, /* 24bpp */
}; };
struct shmob_drm_backlight_data {
const char *name;
int max_brightness;
int (*get_brightness)(void);
int (*set_brightness)(int brightness);
};
struct shmob_drm_panel_data { struct shmob_drm_panel_data {
unsigned int width_mm; /* Panel width in mm */ unsigned int width_mm; /* Panel width in mm */
unsigned int height_mm; /* Panel height in mm */ unsigned int height_mm; /* Panel height in mm */
...@@ -83,7 +76,6 @@ struct shmob_drm_platform_data { ...@@ -83,7 +76,6 @@ struct shmob_drm_platform_data {
enum shmob_drm_clk_source clk_source; enum shmob_drm_clk_source clk_source;
struct shmob_drm_interface_data iface; struct shmob_drm_interface_data iface;
struct shmob_drm_panel_data panel; struct shmob_drm_panel_data panel;
struct shmob_drm_backlight_data backlight;
}; };
#endif /* __SHMOB_DRM_H__ */ #endif /* __SHMOB_DRM_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment