summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_mipi_dsi.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-08-05 13:18:46 +0400
committerThierry Reding <treding@nvidia.com>2014-11-13 15:56:07 +0300
commit5cc0af16fc08cfb749fd0635e5e9187c31826827 (patch)
tree685f65db180ffc6e76381038de087fe6f8462670 /drivers/gpu/drm/drm_mipi_dsi.c
parent3d9a8fcf1c6a9032eb389d3c90323ae980c9d50a (diff)
downloadlinux-5cc0af16fc08cfb749fd0635e5e9187c31826827.tar.xz
drm/dsi: Implement DCS {get,set}_pixel_format commands
Provide small convenience wrappers to query or set the pixel format used by the interface. Reviewed-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/drm_mipi_dsi.c')
-rw-r--r--drivers/gpu/drm/drm_mipi_dsi.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 80d930191ce7..eb5ed0bcba65 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -628,6 +628,31 @@ int mipi_dsi_dcs_get_power_mode(struct mipi_dsi_device *dsi, u8 *mode)
EXPORT_SYMBOL(mipi_dsi_dcs_get_power_mode);
/**
+ * mipi_dsi_dcs_get_pixel_format() - gets the pixel format for the RGB image
+ * data used by the interface
+ * @dsi: DSI peripheral device
+ * @format: return location for the pixel format
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format)
+{
+ ssize_t err;
+
+ err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_PIXEL_FORMAT, format,
+ sizeof(*format));
+ if (err <= 0) {
+ if (err == 0)
+ err = -ENODATA;
+
+ return err;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_get_pixel_format);
+
+/**
* mipi_dsi_dcs_enter_sleep_mode() - disable all unnecessary blocks inside the
* display module except interface communication
* @dsi: DSI peripheral device
@@ -745,6 +770,27 @@ int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
}
EXPORT_SYMBOL(mipi_dsi_dcs_set_tear_on);
+/**
+ * mipi_dsi_dcs_set_pixel_format() - sets the pixel format for the RGB image
+ * data used by the interface
+ * @dsi: DSI peripheral device
+ * @format: pixel format
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format)
+{
+ ssize_t err;
+
+ err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_PIXEL_FORMAT, &format,
+ sizeof(format));
+ if (err < 0)
+ return err;
+
+ return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
+
static int mipi_dsi_drv_probe(struct device *dev)
{
struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);