From patchwork Tue Apr 29 15:28:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 4088131 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ECA14C0ACC for ; Tue, 29 Apr 2014 15:31:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B294201D5 for ; Tue, 29 Apr 2014 15:31:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 50B74201D3 for ; Tue, 29 Apr 2014 15:31:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756515AbaD2Pad (ORCPT ); Tue, 29 Apr 2014 11:30:33 -0400 Received: from mail-ee0-f53.google.com ([74.125.83.53]:37207 "EHLO mail-ee0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756419AbaD2Pac (ORCPT ); Tue, 29 Apr 2014 11:30:32 -0400 Received: by mail-ee0-f53.google.com with SMTP id b57so458547eek.26 for ; Tue, 29 Apr 2014 08:30:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=7iv0ROw8ZqRZeom0QrESTbWzyIe7lWEUhzIKZAVeIYE=; b=HdYUafdwpa7EvEzIsiuFw/os9jJIh4cxm7R3QC6bUuA3QqWvgakWnuF8zIBrZ8INsz 72VZsDwVdp3J3/I4jdq9GZgDbxnr2Ft1Hgf+G0OLJrG0/2HICYfxo+Cp0e219Y+HbZqs Xfse0n898jAcF4DwfvEETv4wHpanX3qCRwhED9AidAzj90UJH+WzFCUbPqTvMXFXWK9R lQDfkw2XEzBvUg/SqIgUqxp+iDNjBPyfWky8x16tac/BpPaplvT9pIpTnaikdZD8+vZL ueJiPcSgunoLCMsWf1TjsKHYtAG4Sw+3MVh0G4UiixpztsVgcU0N4dxsDLe/jnV8ZNz6 r0Gw== X-Received: by 10.15.49.65 with SMTP id i41mr3156966eew.87.1398785431038; Tue, 29 Apr 2014 08:30:31 -0700 (PDT) Received: from localhost (port-22200.pppoe.wtnet.de. [46.59.148.101]) by mx.google.com with ESMTPSA id l42sm60065497eew.19.2014.04.29.08.30.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Apr 2014 08:30:29 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Cc: Stephen Warren Subject: [PATCH 1/3] drm/dsi: Support device shutdown Date: Tue, 29 Apr 2014 17:28:57 +0200 Message-Id: <1398785339-8107-1-git-send-email-thierry.reding@gmail.com> X-Mailer: git-send-email 1.9.2 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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: Thierry Reding Hook up the MIPI DSI bus's .shutdown() function to allow drivers to implement code that should be run when a device is shut down. Signed-off-by: Thierry Reding Tested-by: Stephen Warren --- drivers/gpu/drm/drm_mipi_dsi.c | 10 ++++++++++ include/drm/drm_mipi_dsi.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 09821f46d768..e633df2f68d8 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -282,6 +282,14 @@ static int mipi_dsi_drv_remove(struct device *dev) return drv->remove(dsi); } +static void mipi_dsi_drv_shutdown(struct device *dev) +{ + struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver); + struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev); + + drv->shutdown(dsi); +} + /** * mipi_dsi_driver_register - register a driver for DSI devices * @drv: DSI driver structure @@ -293,6 +301,8 @@ int mipi_dsi_driver_register(struct mipi_dsi_driver *drv) drv->driver.probe = mipi_dsi_drv_probe; if (drv->remove) drv->driver.remove = mipi_dsi_drv_remove; + if (drv->shutdown) + drv->driver.shutdown = mipi_dsi_drv_shutdown; return driver_register(&drv->driver); } diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 7209df15a3cd..944f33f8ba38 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -135,11 +135,13 @@ ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel, * @driver: device driver model driver * @probe: callback for device binding * @remove: callback for device unbinding + * @shutdown: called at shutdown time to quiesce the device */ struct mipi_dsi_driver { struct device_driver driver; int(*probe)(struct mipi_dsi_device *dsi); int(*remove)(struct mipi_dsi_device *dsi); + void (*shutdown)(struct mipi_dsi_device *dsi); }; #define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver)