From patchwork Sat Oct 31 00:38:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 7530121 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 325999F399 for ; Sat, 31 Oct 2015 00:39:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3CEB22073F for ; Sat, 31 Oct 2015 00:39:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 437BC2073B for ; Sat, 31 Oct 2015 00:39:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EEE86E2D6; Fri, 30 Oct 2015 17:39:06 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 134E66E288 for ; Fri, 30 Oct 2015 17:39:03 -0700 (PDT) Received: by padhy1 with SMTP id hy1so82224051pad.0 for ; Fri, 30 Oct 2015 17:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kryo_se.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=4YrI9v9HGsw1RZHRXbI03AXDm65kw67PT3QPI+St2wo=; b=Ic2JJ+SsXXuoLd0q4dP0v0XXUvidGvwWVZLAJQWnFQFeMryisI8knJeyM1oX3EzWSK JxO6SVerW/yQmCzBCFoezo/yomPAikTVPKrPwdQLCrhlP5HwdQcIn9eR3EN1MNXmgQ+d wRQeQOK4RmzmygbVEww1KCfGODlJqfDsJ7MwkfTIvQomqnXZSlanyzcyNLc6lPDGefwY p/SHKc9kGDkCMK6fBceux1t6xai5bBXSNUJd+Qd2hp0pd9x66VbT8lONWwzL5zLERZY9 8vD4qQygPpv37b4EGsFq57/QwXnNcDYv0JZYJASkwVRBN3IAoZVQrdxVbcWCcjXHdaXE mnAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=4YrI9v9HGsw1RZHRXbI03AXDm65kw67PT3QPI+St2wo=; b=CIatwsmM8K7vOfeAv1lpAyuMd3k5acBONS00F8jGTQpE/i2yVcf2y4Zy+QV66k8Reh Oxho2iZ2imE87cbQ5ljsqaBz/GN7HFXfx941SRpIFUSPZaJdoWIYiHRoSfNCYKQ3Z7hc c+Grokah2uUZr693bjdyZMJuwg6FsJ09wkUusSd6C+Ufxv7z353nBHPe49NN0edER54R PMUaLSJl2VcUykaQaeGUDrA4Zepa33gtRrRH9Bs2UGsL6qilrGTWxUQeo/npZOs0dkub zWuoTe1jEaUd/L91fCZFM01R6Nk369fSFgLfjrZIOveDpGRqXQnD6JB0EQ5tWWlR7O+H J1Tw== X-Gm-Message-State: ALoCoQnplDpr9n1IciVjoq+UV6IENFLGgVyxsf0/Va9Z2ossUL8OM7f6Ix8SI90wvynXTokG7s77 X-Received: by 10.68.170.101 with SMTP id al5mr12071418pbc.38.1446251942610; Fri, 30 Oct 2015 17:39:02 -0700 (PDT) Received: from Bjorns-MacBook-Pro.local.com (cpe-76-167-68-231.natsow.res.rr.com. [76.167.68.231]) by smtp.gmail.com with ESMTPSA id z12sm10406547pbt.30.2015.10.30.17.39.01 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Oct 2015 17:39:01 -0700 (PDT) From: bjorn@kryo.se To: David Airlie 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) Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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