Revert "drm/dsi: Fix byte order of DCS set/get brightness"
The commit 8a744ca663
("ANDROID: drm/dsi: Fix byte order of DCS
set/get brightness") modified the upstream API and this makes us
hard to reconcile it to android-4.19 without breaking APIs for GKI.
Rollback the upstream API and implement it in the downstream side.
Bug: 156865857
Change-Id: I0f11aec2249d305dbed77b05b197f67ffbfb00dd
Signed-off-by: Ken Huang <kenbshuang@google.com>
Signed-off-by: Chris Lu <luchris@google.com>
Signed-off-by: Will Mcvicker <willmcvicker@google.com>
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
This commit is contained in:
parent
d6bbbe0157
commit
62003388f2
4 changed files with 10 additions and 44 deletions
|
@ -1052,33 +1052,17 @@ EXPORT_SYMBOL(mipi_dsi_dcs_set_tear_scanline);
|
|||
* display
|
||||
* @dsi: DSI peripheral device
|
||||
* @brightness: brightness value
|
||||
* @num_params: Number of parameters (bytes) to encode brightness value in. The
|
||||
* MIPI specification states that one parameter shall be sent for
|
||||
* devices that support 8-bit brightness levels. For devices that
|
||||
* support brightness levels wider than 8-bit, two parameters
|
||||
* shall be sent.
|
||||
*
|
||||
* Return: 0 on success or a negative error code on failure.
|
||||
*/
|
||||
int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
|
||||
u16 brightness, size_t num_params)
|
||||
u16 brightness)
|
||||
{
|
||||
u8 payload[2];
|
||||
u8 payload[2] = { brightness & 0xff, brightness >> 8 };
|
||||
ssize_t err;
|
||||
|
||||
switch (num_params) {
|
||||
case 1:
|
||||
payload[0] = brightness & 0xff;
|
||||
break;
|
||||
case 2:
|
||||
payload[0] = brightness >> 8;
|
||||
payload[1] = brightness & 0xff;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
|
||||
payload, num_params);
|
||||
payload, sizeof(payload));
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@ -1091,25 +1075,16 @@ EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);
|
|||
* of the display
|
||||
* @dsi: DSI peripheral device
|
||||
* @brightness: brightness value
|
||||
* @num_params: Number of parameters (i.e. bytes) the brightness value is
|
||||
* encoded in. The MIPI specification states that one parameter
|
||||
* shall be returned from devices that support 8-bit brightness
|
||||
* levels. Devices that support brightness levels wider than
|
||||
* 8-bit return two parameters (i.e. bytes).
|
||||
*
|
||||
* Return: 0 on success or a negative error code on failure.
|
||||
*/
|
||||
int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
|
||||
u16 *brightness, size_t num_params)
|
||||
u16 *brightness)
|
||||
{
|
||||
u8 payload[2];
|
||||
ssize_t err;
|
||||
|
||||
if (!(num_params == 1 || num_params == 2))
|
||||
return -EINVAL;
|
||||
|
||||
err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
|
||||
payload, num_params);
|
||||
brightness, sizeof(*brightness));
|
||||
if (err <= 0) {
|
||||
if (err == 0)
|
||||
err = -ENODATA;
|
||||
|
@ -1117,15 +1092,6 @@ int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
|
|||
return err;
|
||||
}
|
||||
|
||||
switch (num_params) {
|
||||
case 1:
|
||||
*brightness = payload[0];
|
||||
break;
|
||||
case 2:
|
||||
*brightness = payload[0] << 8 || payload[1];
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
|
||||
|
|
|
@ -341,7 +341,7 @@ static int dsi_dcs_bl_get_brightness(struct backlight_device *bl)
|
|||
|
||||
dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
|
||||
|
||||
ret = mipi_dsi_dcs_get_display_brightness(dsi, &brightness, 1);
|
||||
ret = mipi_dsi_dcs_get_display_brightness(dsi, &brightness);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -357,7 +357,7 @@ static int dsi_dcs_bl_update_status(struct backlight_device *bl)
|
|||
|
||||
dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
|
||||
|
||||
ret = mipi_dsi_dcs_set_display_brightness(dsi, bl->props.brightness, 1);
|
||||
ret = mipi_dsi_dcs_set_display_brightness(dsi, bl->props.brightness);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ static int s6e63j0x03_enable(struct drm_panel *panel)
|
|||
return ret;
|
||||
|
||||
/* set default white brightness */
|
||||
ret = mipi_dsi_dcs_set_display_brightness(dsi, 0x00ff, 1);
|
||||
ret = mipi_dsi_dcs_set_display_brightness(dsi, 0x00ff);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -283,9 +283,9 @@ int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
|
|||
int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
|
||||
int mipi_dsi_dcs_set_tear_scanline(struct mipi_dsi_device *dsi, u16 scanline);
|
||||
int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
|
||||
u16 brightness, size_t num_params);
|
||||
u16 brightness);
|
||||
int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
|
||||
u16 *brightness, size_t num_params);
|
||||
u16 *brightness);
|
||||
|
||||
/**
|
||||
* struct mipi_dsi_driver - DSI driver
|
||||
|
|
Loading…
Reference in a new issue