From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752268AbbJaAjG (ORCPT ); Fri, 30 Oct 2015 20:39:06 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:35896 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751093AbbJaAjE (ORCPT ); Fri, 30 Oct 2015 20:39:04 -0400 From: bjorn@kryo.se To: David Airlie Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] drm/dsi: Add support for Turn on/Shutdown peripheral packets Date: Fri, 30 Oct 2015 17:38:26 -0700 Message-Id: <1446251908-2603-1-git-send-email-bjorn@kryo.se> X-Mailer: git-send-email 2.3.2 (Apple Git-55) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Werner Johansson The MIPI_DSI_TURN_ON_PERIPHERAL and MIPI_DSI_SHUTDOWN_PERIPHERAL packets are required for some panels, one example being the Panasonic VVX10F034N00 panel. Signed-off-by: Werner Johansson Signed-off-by: Bjorn Andersson --- drivers/gpu/drm/drm_mipi_dsi.c | 47 ++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_mipi_dsi.h | 3 +++ 2 files changed, 50 insertions(+) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 2d5ca8ee..13b4a9c 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -862,6 +862,53 @@ int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format) } EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format); +/** + * mipi_dsi_raw_short_write() - Sends a data-less short DSI packet + * @dsi: DSI peripheral device + * @type: Data Type of packet to send + * + * Return: 0 on success or a negative error code on failure. + */ +static ssize_t mipi_dsi_raw_short_write(struct mipi_dsi_device *dsi, u8 type) +{ + u8 dummy[2] = { 0, 0 }; + struct mipi_dsi_msg msg = { + .channel = dsi->channel, + .tx_buf = dummy, + .tx_len = sizeof(dummy), + .type = type + }; + + if (mipi_dsi_packet_format_is_short(type)) + return mipi_dsi_device_transfer(dsi, &msg); + else + return -1; +} + +/** + * mipi_dsi_turn_on_peripheral() - Sends Turn On Peripheral DSI command + * @dsi: DSI peripheral device + * + * Return: 0 on success or a negative error code on failure. + */ +ssize_t mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi) +{ + return mipi_dsi_raw_short_write(dsi, MIPI_DSI_TURN_ON_PERIPHERAL); +} +EXPORT_SYMBOL(mipi_dsi_turn_on_peripheral); + +/** + * mipi_dsi_shutdown_peripheral() - Sends Shutdown Peripheral DSI command + * @dsi: DSI peripheral device + * + * Return: 0 on success or a negative error code on failure. + */ +ssize_t mipi_dsi_shutdown_peripheral(struct mipi_dsi_device *dsi) +{ + return mipi_dsi_raw_short_write(dsi, MIPI_DSI_SHUTDOWN_PERIPHERAL); +} +EXPORT_SYMBOL(mipi_dsi_shutdown_peripheral); + 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 f1d8d0d..2e0f057 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -215,6 +215,9 @@ 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); +ssize_t mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi); +ssize_t mipi_dsi_shutdown_peripheral(struct mipi_dsi_device *dsi); + /** * struct mipi_dsi_driver - DSI driver * @driver: device driver model driver -- 2.3.2 (Apple Git-55)