From patchwork Fri Apr 3 12:57:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6156671 Return-Path: X-Original-To: patchwork-linux-media@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 836B29F1BE for ; Fri, 3 Apr 2015 13:00:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B1555203E1 for ; Fri, 3 Apr 2015 13:00:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B30C2202BE for ; Fri, 3 Apr 2015 13:00:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753315AbbDCM74 (ORCPT ); Fri, 3 Apr 2015 08:59:56 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:33702 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753011AbbDCM6d (ORCPT ); Fri, 3 Apr 2015 08:58:33 -0400 Received: by wgin8 with SMTP id n8so21121128wgi.0; Fri, 03 Apr 2015 05:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=pSBR5by2mdQIXc/jpac5smtowI7UC1jB1g9Qta3laAM=; b=Iey2LDPCPDvlvZy/I1mM0jVNAfWIx4GEUcGiDdSMmox+RRytf3RXKqliLjux8zoUiQ kiL1/3NRt+4PHsLLglMkLXbIAFcVsY0t4oRQ0OBFjmBtfxR1bTe5ZNtu0a9TaJffcGzG 7zZs9qP15j+5AH5VRGRrMtN+Cb+cJMtWG3YYmYzka+TspYnPVw8MaME6hhM1R2Qkkj+L F422Zm08Dp/5VecpIF4eIHQgHk0ojtty/jxwBHwmEZCgCI7ngYMRM2J5KcFqz6FkgZfd NnUazQxZ2pxbCpJ8Jgjx1hDTxlC/xIQ//TeYVRZYKTpig3GZkLcs9uomDzWPQuqtunH5 Vthg== X-Received: by 10.194.19.166 with SMTP id g6mr4766114wje.150.1428065911861; Fri, 03 Apr 2015 05:58:31 -0700 (PDT) Received: from cizrna.lan ([109.72.12.93]) by mx.google.com with ESMTPSA id n6sm2664610wiw.6.2015.04.03.05.58.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Apr 2015 05:58:30 -0700 (PDT) From: Tomeu Vizoso To: linux-pm@vger.kernel.org Cc: Tomeu Vizoso , Laurent Pinchart , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/7] [media] uvcvideo: Enable runtime PM of descendant devices Date: Fri, 3 Apr 2015 14:57:53 +0200 Message-Id: <1428065887-16017-5-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.3.4 In-Reply-To: <1428065887-16017-1-git-send-email-tomeu.vizoso@collabora.com> References: <1428065887-16017-1-git-send-email-tomeu.vizoso@collabora.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,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 So UVC devices can remain runtime-suspended when the system goes into a sleep state, they and all of their descendant devices need to have runtime PM enable. Signed-off-by: Tomeu Vizoso --- drivers/media/usb/uvc/uvc_driver.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index cf27006..687e5fb 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1855,6 +1855,15 @@ static int uvc_register_chains(struct uvc_device *dev) return 0; } +static int uvc_pm_runtime_enable(struct device *dev, void *data) +{ + pm_runtime_enable(dev); + + device_for_each_child(dev, NULL, uvc_pm_runtime_enable); + + return 0; +} + /* ------------------------------------------------------------------------ * USB probe, disconnect, suspend and resume */ @@ -1959,6 +1968,8 @@ static int uvc_probe(struct usb_interface *intf, "supported.\n", ret); } + device_for_each_child(&dev->intf->dev, NULL, uvc_pm_runtime_enable); + uvc_trace(UVC_TRACE_PROBE, "UVC device initialized.\n"); usb_enable_autosuspend(udev); return 0;