From: Vinay Simha BN <simhavcs@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Vinay Simha BN <simhavcs@gmail.com>,
John Stultz <john.stultz@linaro.org>,
Sumit Semwal <sumit.semwal@linaro.org>,
Archit Taneja <archit.taneja@gmail.com>,
Rob Clark <robdclark@gmail.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org (open list:DRM DRIVERS),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v2 1/2] drm/dsi: Implement dcs set/get display brightness
Date: Mon, 13 Jun 2016 15:55:27 +0530 [thread overview]
Message-ID: <1465813529-30621-1-git-send-email-simhavcs@gmail.com> (raw)
Provide a small convenience wrapper that set/get the
display brightness value
Cc: John Stultz <john.stultz@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Archit Taneja <archit.taneja@gmail.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Vinay Simha BN <simhavcs@gmail.com>
--
v1:
*tested in nexus7 2nd gen.
v2:
* implemented jani review comments
-functions name mapped accordingly
-bl value increased from 0xff to 0xffff
-backlight interface will be handled in panel driver,
so it is moved from the mipi_dsi helper function
---
drivers/gpu/drm/drm_mipi_dsi.c | 49 ++++++++++++++++++++++++++++++++++++++++++
include/drm/drm_mipi_dsi.h | 4 ++++
2 files changed, 53 insertions(+)
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 7938ce7..5661a00 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -1025,6 +1025,55 @@ int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format)
}
EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
+/**
+ * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
+ * of the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * 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)
+{
+ ssize_t err;
+
+ err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
+ brightness, sizeof(*brightness));
+ if (err < 0) {
+ if (err == 0)
+ err = -ENODATA;
+
+ return err;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
+
+/**
+ * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of
+ * the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * 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)
+{
+ ssize_t err;
+ u8 bl_value[2] = { brightness & 0xff, brightness >> 8 };
+
+ err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+ bl_value, sizeof(bl_value));
+ if (err < 0)
+ return err;
+
+ return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);
+
static int mipi_dsi_drv_probe(struct device *dev)
{
struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index ec55285..4494641 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -268,6 +268,10 @@ int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
enum mipi_dsi_dcs_tear_mode mode);
int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+ u16 *brightness);
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+ u16 brightness);
/**
* struct mipi_dsi_driver - DSI driver
--
2.1.2
next reply other threads:[~2016-06-13 10:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 10:25 Vinay Simha BN [this message]
2016-06-13 10:25 ` [PATCH v4 2/2] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel Vinay Simha BN
2016-06-13 12:35 ` Thierry Reding
2016-06-14 10:57 ` Vinay Simha
2016-06-14 11:25 ` Thierry Reding
2016-06-14 17:03 ` Vinay Simha
2016-06-15 13:11 ` Vinay Simha
2016-06-16 3:00 [PATCH v2 1/2] drm/dsi: Implement dcs set/get display brightness Vinay Simha BN
2016-06-17 18:23 Vinay Simha BN
2016-06-20 5:53 Vinay Simha BN
2016-06-28 15:59 ` Vinay Simha
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=1465813529-30621-1-git-send-email-simhavcs@gmail.com \
--to=simhavcs@gmail.com \
--cc=airlied@linux.ie \
--cc=archit.taneja@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robdclark@gmail.com \
--cc=sumit.semwal@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;
as well as URLs for NNTP newsgroup(s).