* [RFC PATCH] drm/mipi-dsi: add some generic functions for DCS
@ 2014-07-31 4:14 YoungJun Cho
2014-08-05 10:08 ` Thierry Reding
2014-08-07 6:01 ` Andrzej Hajda
0 siblings, 2 replies; 3+ messages in thread
From: YoungJun Cho @ 2014-07-31 4:14 UTC (permalink / raw)
To: airlied, dri-devel; +Cc: sw0312.kim, a.hajda, kyungmin.park
This patch adds some generic functions for DCS like below
to standize on common APIs rather than per-driver
implementations.
mipi_dcs_enter_sleep_mode() / mipi_dcs_exit_sleep_mode()
- These are required to disable / enable all blocks inside
the display module.
mipi_dcs_set_display_off() / mipi_dcs_set_display_on()
- These are required to stop / start displaying the image
data on the display device.
mipi_dcs_set_tear_off() / mipi_dcs_set_tear_on()
- These are required to turn off or on the display module's
TE output signal on the TE signal line.
mipi_dsi_set_maximum_return_packet_size()
- Although it is not related with DCS, it is required before
using mipi_dsi_dcs_read() to specify the maximum size of
the payload in a long packet.
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/gpu/drm/drm_mipi_dsi.c | 113 +++++++++++++++++++++++++++++++++++++++++
include/drm/drm_mipi_dsi.h | 14 +++++
2 files changed, 127 insertions(+)
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 6b2bbda..ba506d7 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -269,6 +269,119 @@ ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel,
}
EXPORT_SYMBOL(mipi_dsi_dcs_read);
+/**
+ * mipi_dsi_set_maximum_return_packet_size
+ * - specify the maximum size of the payload in a Long packet transmitted from
+ * peripheral back to the host processor
+ * @dsi: DSI peripheral device
+ * @size: the maximum size of the payload
+ */
+int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
+ u16 size)
+{
+ const struct mipi_dsi_host_ops *ops = dsi->host->ops;
+ struct mipi_dsi_msg msg;
+
+ if (!ops || !ops->transfer)
+ return -ENOSYS;
+
+ memset(&msg, 0, sizeof(msg));
+ msg.channel = dsi->channel;
+ msg.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE;
+ msg.tx_len = sizeof(size);
+ msg.tx_buf = (const void *)(&size);
+
+ return ops->transfer(dsi->host, &msg);
+}
+EXPORT_SYMBOL(mipi_dsi_set_maximum_return_packet_size);
+
+/**
+ * mipi_dcs_enter_sleep_mode - disable all unnecessary blocks inside the display
+ * module except interface communication
+ * @dsi: DSI peripheral device
+ */
+int mipi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi)
+{
+ u8 data = MIPI_DCS_ENTER_SLEEP_MODE;
+
+ return mipi_dsi_dcs_write(dsi, dsi->channel, (const void *)&data,
+ sizeof(data));
+}
+EXPORT_SYMBOL(mipi_dcs_enter_sleep_mode);
+
+/**
+ * mipi_dcs_exit_sleep_mode - enable all blocks inside the display module
+ * @dsi: DSI peripheral device
+ */
+int mipi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi)
+{
+ u8 data = MIPI_DCS_EXIT_SLEEP_MODE;
+
+ return mipi_dsi_dcs_write(dsi, dsi->channel, (const void *)&data,
+ sizeof(data));
+}
+EXPORT_SYMBOL(mipi_dcs_exit_sleep_mode);
+
+/**
+ * mipi_dcs_set_display_off - stop displaying the image data on the display device
+ * @dsi: DSI peripheral device
+ */
+int mipi_dcs_set_display_off(struct mipi_dsi_device *dsi)
+{
+ u8 data = MIPI_DCS_SET_DISPLAY_OFF;
+
+ return mipi_dsi_dcs_write(dsi, dsi->channel, (const void *)&data,
+ sizeof(data));
+}
+EXPORT_SYMBOL(mipi_dcs_set_display_off);
+
+/**
+ * mipi_dcs_set_display_on - start displaying the image data on the display device
+ * @dsi: DSI peripheral device
+ */
+int mipi_dcs_set_display_on(struct mipi_dsi_device *dsi)
+{
+ u8 data = MIPI_DCS_SET_DISPLAY_ON;
+
+ return mipi_dsi_dcs_write(dsi, dsi->channel, (const void *)&data,
+ sizeof(data));
+}
+EXPORT_SYMBOL(mipi_dcs_set_display_on);
+
+/**
+ * mipi_dcs_set_tear_off - turn off the display module's Tearing Effect output
+ * signal on the TE signal line
+ * @dsi: DSI peripheral device
+ */
+int mipi_dcs_set_tear_off(struct mipi_dsi_device *dsi)
+{
+ u8 data = MIPI_DCS_SET_TEAR_OFF;
+
+ return mipi_dsi_dcs_write(dsi, dsi->channel, (const void *)&data,
+ sizeof(data));
+}
+EXPORT_SYMBOL(mipi_dcs_set_tear_off);
+
+/**
+ * mipi_dcs_set_tear_on - turn on the display module's Tearing Effect output
+ * signal on the TE signal line.
+ * @dsi: DSI peripheral device
+ * @mode: the Tearing Effect output line mode
+ * - MIPI_DCS_TEAR_MODE_VBLANK: the TE output line consists of V-Blanking
+ * information only
+ * - MIPI_DCS_TEAR_MODE_VHBLANK : the TE output line consists of both
+ * V-Blanking and H-Blanking information
+ */
+int mipi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
+ enum mipi_dcs_tear_mode mode)
+{
+ u8 data[2] = { MIPI_DCS_SET_TEAR_ON, mode };
+
+ return mipi_dsi_dcs_write(dsi, dsi->channel, (const void *)data,
+ sizeof(data));
+}
+EXPORT_SYMBOL(mipi_dcs_set_tear_on);
+
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 1c41e49..5af2d0e 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -106,6 +106,11 @@ enum mipi_dsi_pixel_format {
MIPI_DSI_FMT_RGB565,
};
+enum mipi_dcs_tear_mode {
+ MIPI_DCS_TEAR_MODE_VBLANK,
+ MIPI_DCS_TEAR_MODE_VHBLANK,
+};
+
/**
* struct mipi_dsi_device - DSI peripheral device
* @host: DSI host for this peripheral
@@ -133,6 +138,15 @@ int mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, unsigned int channel,
const void *data, size_t len);
ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel,
u8 cmd, void *data, size_t len);
+int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
+ u16 size);
+int mipi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi);
+int mipi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi);
+int mipi_dcs_set_display_off(struct mipi_dsi_device *dsi);
+int mipi_dcs_set_display_on(struct mipi_dsi_device *dsi);
+int mipi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
+int mipi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
+ enum mipi_dcs_tear_mode mode);
/**
* struct mipi_dsi_driver - DSI driver
--
1.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] drm/mipi-dsi: add some generic functions for DCS
2014-07-31 4:14 [RFC PATCH] drm/mipi-dsi: add some generic functions for DCS YoungJun Cho
@ 2014-08-05 10:08 ` Thierry Reding
2014-08-07 6:01 ` Andrzej Hajda
1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2014-08-05 10:08 UTC (permalink / raw)
To: YoungJun Cho; +Cc: sw0312.kim, dri-devel, a.hajda, kyungmin.park
[-- Attachment #1.1: Type: text/plain, Size: 1616 bytes --]
On Thu, Jul 31, 2014 at 01:14:42PM +0900, YoungJun Cho wrote:
> This patch adds some generic functions for DCS like below
> to standize on common APIs rather than per-driver
> implementations.
>
> mipi_dcs_enter_sleep_mode() / mipi_dcs_exit_sleep_mode()
> - These are required to disable / enable all blocks inside
> the display module.
>
> mipi_dcs_set_display_off() / mipi_dcs_set_display_on()
> - These are required to stop / start displaying the image
> data on the display device.
>
> mipi_dcs_set_tear_off() / mipi_dcs_set_tear_on()
> - These are required to turn off or on the display module's
> TE output signal on the TE signal line.
>
> mipi_dsi_set_maximum_return_packet_size()
> - Although it is not related with DCS, it is required before
> using mipi_dsi_dcs_read() to specify the maximum size of
> the payload in a long packet.
>
> Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
> Acked-by: Inki Dae <inki.dae@samsung.com>
> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> drivers/gpu/drm/drm_mipi_dsi.c | 113 +++++++++++++++++++++++++++++++++++++++++
> include/drm/drm_mipi_dsi.h | 14 +++++
> 2 files changed, 127 insertions(+)
I've applied this patch after applying some cleanup and rebasing onto
some changes I've been working on. I also broke it up into two separate
patches, one for the mipi_dsi_set_maximum_return_packet_size() function
and another for the DCS command implementations.
I also have a bunch of other functions that I need for a panel driver
that I'm working on. I'll send those out shortly.
Thierry
[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] drm/mipi-dsi: add some generic functions for DCS
2014-07-31 4:14 [RFC PATCH] drm/mipi-dsi: add some generic functions for DCS YoungJun Cho
2014-08-05 10:08 ` Thierry Reding
@ 2014-08-07 6:01 ` Andrzej Hajda
1 sibling, 0 replies; 3+ messages in thread
From: Andrzej Hajda @ 2014-08-07 6:01 UTC (permalink / raw)
To: YoungJun Cho, airlied, dri-devel; +Cc: kyungmin.park, sw0312.kim
Hi YoungJun, Thierry,
On 07/31/2014 06:14 AM, YoungJun Cho wrote:
> This patch adds some generic functions for DCS like below
> to standize on common APIs rather than per-driver
> implementations.
>
> mipi_dcs_enter_sleep_mode() / mipi_dcs_exit_sleep_mode()
> - These are required to disable / enable all blocks inside
> the display module.
>
> mipi_dcs_set_display_off() / mipi_dcs_set_display_on()
> - These are required to stop / start displaying the image
> data on the display device.
>
> mipi_dcs_set_tear_off() / mipi_dcs_set_tear_on()
> - These are required to turn off or on the display module's
> TE output signal on the TE signal line.
I wonder if it wouldn't be better to make these functions inline.
Regards
Andrzej
>
> mipi_dsi_set_maximum_return_packet_size()
> - Although it is not related with DCS, it is required before
> using mipi_dsi_dcs_read() to specify the maximum size of
> the payload in a long packet.
>
> Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
> Acked-by: Inki Dae <inki.dae@samsung.com>
> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> drivers/gpu/drm/drm_mipi_dsi.c | 113 +++++++++++++++++++++++++++++++++++++++++
> include/drm/drm_mipi_dsi.h | 14 +++++
> 2 files changed, 127 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index 6b2bbda..ba506d7 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -269,6 +269,119 @@ ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel,
> }
> EXPORT_SYMBOL(mipi_dsi_dcs_read);
>
> +/**
> + * mipi_dsi_set_maximum_return_packet_size
> + * - specify the maximum size of the payload in a Long packet transmitted from
> + * peripheral back to the host processor
> + * @dsi: DSI peripheral device
> + * @size: the maximum size of the payload
> + */
> +int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
> + u16 size)
> +{
> + const struct mipi_dsi_host_ops *ops = dsi->host->ops;
> + struct mipi_dsi_msg msg;
> +
> + if (!ops || !ops->transfer)
> + return -ENOSYS;
> +
> + memset(&msg, 0, sizeof(msg));
> + msg.channel = dsi->channel;
> + msg.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE;
> + msg.tx_len = sizeof(size);
> + msg.tx_buf = (const void *)(&size);
> +
> + return ops->transfer(dsi->host, &msg);
> +}
> +EXPORT_SYMBOL(mipi_dsi_set_maximum_return_packet_size);
> +
> +/**
> + * mipi_dcs_enter_sleep_mode - disable all unnecessary blocks inside the display
> + * module except interface communication
> + * @dsi: DSI peripheral device
> + */
> +int mipi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi)
> +{
> + u8 data = MIPI_DCS_ENTER_SLEEP_MODE;
> +
> + return mipi_dsi_dcs_write(dsi, dsi->channel, (const void *)&data,
> + sizeof(data));
> +}
> +EXPORT_SYMBOL(mipi_dcs_enter_sleep_mode);
> +
> +/**
> + * mipi_dcs_exit_sleep_mode - enable all blocks inside the display module
> + * @dsi: DSI peripheral device
> + */
> +int mipi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi)
> +{
> + u8 data = MIPI_DCS_EXIT_SLEEP_MODE;
> +
> + return mipi_dsi_dcs_write(dsi, dsi->channel, (const void *)&data,
> + sizeof(data));
> +}
> +EXPORT_SYMBOL(mipi_dcs_exit_sleep_mode);
> +
> +/**
> + * mipi_dcs_set_display_off - stop displaying the image data on the display device
> + * @dsi: DSI peripheral device
> + */
> +int mipi_dcs_set_display_off(struct mipi_dsi_device *dsi)
> +{
> + u8 data = MIPI_DCS_SET_DISPLAY_OFF;
> +
> + return mipi_dsi_dcs_write(dsi, dsi->channel, (const void *)&data,
> + sizeof(data));
> +}
> +EXPORT_SYMBOL(mipi_dcs_set_display_off);
> +
> +/**
> + * mipi_dcs_set_display_on - start displaying the image data on the display device
> + * @dsi: DSI peripheral device
> + */
> +int mipi_dcs_set_display_on(struct mipi_dsi_device *dsi)
> +{
> + u8 data = MIPI_DCS_SET_DISPLAY_ON;
> +
> + return mipi_dsi_dcs_write(dsi, dsi->channel, (const void *)&data,
> + sizeof(data));
> +}
> +EXPORT_SYMBOL(mipi_dcs_set_display_on);
> +
> +/**
> + * mipi_dcs_set_tear_off - turn off the display module's Tearing Effect output
> + * signal on the TE signal line
> + * @dsi: DSI peripheral device
> + */
> +int mipi_dcs_set_tear_off(struct mipi_dsi_device *dsi)
> +{
> + u8 data = MIPI_DCS_SET_TEAR_OFF;
> +
> + return mipi_dsi_dcs_write(dsi, dsi->channel, (const void *)&data,
> + sizeof(data));
> +}
> +EXPORT_SYMBOL(mipi_dcs_set_tear_off);
> +
> +/**
> + * mipi_dcs_set_tear_on - turn on the display module's Tearing Effect output
> + * signal on the TE signal line.
> + * @dsi: DSI peripheral device
> + * @mode: the Tearing Effect output line mode
> + * - MIPI_DCS_TEAR_MODE_VBLANK: the TE output line consists of V-Blanking
> + * information only
> + * - MIPI_DCS_TEAR_MODE_VHBLANK : the TE output line consists of both
> + * V-Blanking and H-Blanking information
> + */
> +int mipi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
> + enum mipi_dcs_tear_mode mode)
> +{
> + u8 data[2] = { MIPI_DCS_SET_TEAR_ON, mode };
> +
> + return mipi_dsi_dcs_write(dsi, dsi->channel, (const void *)data,
> + sizeof(data));
> +}
> +EXPORT_SYMBOL(mipi_dcs_set_tear_on);
> +
> 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 1c41e49..5af2d0e 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -106,6 +106,11 @@ enum mipi_dsi_pixel_format {
> MIPI_DSI_FMT_RGB565,
> };
>
> +enum mipi_dcs_tear_mode {
> + MIPI_DCS_TEAR_MODE_VBLANK,
> + MIPI_DCS_TEAR_MODE_VHBLANK,
> +};
> +
> /**
> * struct mipi_dsi_device - DSI peripheral device
> * @host: DSI host for this peripheral
> @@ -133,6 +138,15 @@ int mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, unsigned int channel,
> const void *data, size_t len);
> ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel,
> u8 cmd, void *data, size_t len);
> +int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
> + u16 size);
> +int mipi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi);
> +int mipi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi);
> +int mipi_dcs_set_display_off(struct mipi_dsi_device *dsi);
> +int mipi_dcs_set_display_on(struct mipi_dsi_device *dsi);
> +int mipi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
> +int mipi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
> + enum mipi_dcs_tear_mode mode);
>
> /**
> * struct mipi_dsi_driver - DSI driver
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-07 6:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-31 4:14 [RFC PATCH] drm/mipi-dsi: add some generic functions for DCS YoungJun Cho
2014-08-05 10:08 ` Thierry Reding
2014-08-07 6:01 ` Andrzej Hajda
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.