From: Sam Ravnborg <sam@ravnborg.org>
To: dri-devel@lists.freedesktop.org,
Jingoo Han <jingoohan1@gmail.com>,
Lee Jones <lee.jones@linaro.org>,
Daniel Thompson <daniel.thompson@linaro.org>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Sam Ravnborg" <sam@ravnborg.org>,
"Christian König" <christian.koenig@amd.com>,
amd-gfx@lists.freedesktop.org
Subject: [PATCH v2 21/24] drm/amdgpu/atom: Backlight update
Date: Sun, 23 Aug 2020 12:45:29 +0200 [thread overview]
Message-ID: <20200823104532.1024798-22-sam@ravnborg.org> (raw)
In-Reply-To: <20200823104532.1024798-1-sam@ravnborg.org>
- Use macros for initialization
- Replace direct access to backlight_properties with get and set
operations
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: Sam Ravnborg <sam@ravnborg.org>
---
.../gpu/drm/amd/amdgpu/atombios_encoders.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
index 1e94a9b652f7..882e1a3dad8b 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
@@ -122,15 +122,16 @@ amdgpu_atombios_encoder_set_backlight_level(struct amdgpu_encoder *amdgpu_encode
static u8 amdgpu_atombios_encoder_backlight_level(struct backlight_device *bd)
{
+ int brightness = backlight_get_brightness(bd);
u8 level;
/* Convert brightness to hardware level */
- if (bd->props.brightness < 0)
+ if (brightness < 0)
level = 0;
- else if (bd->props.brightness > AMDGPU_MAX_BL_LEVEL)
+ else if (brightness > AMDGPU_MAX_BL_LEVEL)
level = AMDGPU_MAX_BL_LEVEL;
else
- level = bd->props.brightness;
+ level = brightness;
return level;
}
@@ -165,13 +166,12 @@ static const struct backlight_ops amdgpu_atombios_encoder_backlight_ops = {
void amdgpu_atombios_encoder_init_backlight(struct amdgpu_encoder *amdgpu_encoder,
struct drm_connector *drm_connector)
{
+ DECLARE_BACKLIGHT_INIT_RAW(props, 0, AMDGPU_MAX_BL_LEVEL);
struct drm_device *dev = amdgpu_encoder->base.dev;
struct amdgpu_device *adev = dev->dev_private;
struct backlight_device *bd;
- struct backlight_properties props;
struct amdgpu_backlight_privdata *pdata;
struct amdgpu_encoder_atom_dig *dig;
- u8 backlight_level;
char bl_name[16];
/* Mac laptops with multiple GPUs use the gmux driver for backlight
@@ -193,9 +193,6 @@ void amdgpu_atombios_encoder_init_backlight(struct amdgpu_encoder *amdgpu_encode
goto error;
}
- memset(&props, 0, sizeof(props));
- props.max_brightness = AMDGPU_MAX_BL_LEVEL;
- props.type = BACKLIGHT_RAW;
snprintf(bl_name, sizeof(bl_name),
"amdgpu_bl%d", dev->primary->index);
bd = backlight_device_register(bl_name, drm_connector->kdev,
@@ -207,14 +204,10 @@ void amdgpu_atombios_encoder_init_backlight(struct amdgpu_encoder *amdgpu_encode
pdata->encoder = amdgpu_encoder;
- backlight_level = amdgpu_atombios_encoder_get_backlight_level_from_reg(adev);
-
dig = amdgpu_encoder->enc_priv;
dig->bl_dev = bd;
- bd->props.brightness = amdgpu_atombios_encoder_get_backlight_brightness(bd);
- bd->props.power = FB_BLANK_UNBLANK;
- backlight_update_status(bd);
+ backlight_enable_brightness(bd, amdgpu_atombios_encoder_get_backlight_brightness(bd));
DRM_INFO("amdgpu atom DIG backlight initialized\n");
--
2.25.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2020-08-23 10:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-23 10:45 [PATCH v2 0/24] backlight: add init macros and accessors Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 20/24] drm/radeon: Backlight update Sam Ravnborg
2020-08-23 10:45 ` Sam Ravnborg [this message]
2020-08-28 9:40 ` [PATCH v2 0/24] backlight: add init macros and accessors Linus Walleij
2020-09-02 11:29 ` Daniel Thompson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200823104532.1024798-22-sam@ravnborg.org \
--to=sam@ravnborg.org \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel.thompson@linaro.org \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jingoohan1@gmail.com \
--cc=lee.jones@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox