From patchwork Fri Dec 2 17:19:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 2547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp981202wrr; Fri, 2 Dec 2022 09:24:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf5tVw0oOdlTr4Td/hbsYZHyuoPwKIKx2EH8FwPC3k0+ndaj+UD66q1XOZGyOVEMDlZhoQtQ X-Received: by 2002:aa7:db90:0:b0:459:aa70:d4fd with SMTP id u16-20020aa7db90000000b00459aa70d4fdmr62608580edt.162.1670001860145; Fri, 02 Dec 2022 09:24:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670001860; cv=none; d=google.com; s=arc-20160816; b=JjBuZNQqkQx2FDI2oKldwq0PtI9xG3SY28grN0T1Hyby3eQ2xgByCIwlgMX8cUip0q 64ZttYpIOw73FsEIvAjLiUioWHOmIUPLc1Rhru5bLpkGj7EkeJzgccBloG2UZq08gl2M 3rkv3mZt/yIeVmkDbXuFvtsoXQrkaIgHQaenjvUAqRx3rd5DEIJdx7/Z/5pjGlW40j8K 96ws7eNvST9+JuEtlVTkd5yBBOMZO7NNne30LlkorISrK/pEgUhDMRuc+kvMSxM97u1X buSFfKs3AmQkGuLb4cp+BwJDZg9tEQXkz931LZ/hkZ3tYmU0jnHGmyMK+eRF4Oa8MNC+ MO4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:date:from :content-transfer-encoding:mime-version:subject:dkim-signature; bh=r/RdQpRDc/P3p5PuMcx3RxG10Ut5U2wPQz1yCcrQs0Q=; b=Xe5GsLzHtSSv2f9L0orccgMLMZhxVtkiyfft/ZJrI9awNMYscAT7s7NE3z73v2pFNa gkKWmFGXPaovd4yXy5jrWjk8Lccc0re9PRQ+XVuFZfxwJ0i/Vk+KIL3SBBh5vICQua4y VALjIsI6sA8Egz23HBpvdzAmQflZa5OB7qfHFuzQSVCDkUWKtaniZk+uDiDJQT6Z/kuB pcNX5vBH5DNGZHOpoLUj9LNQ52GLkW1M241AAmOf25U0zVg+5rsqnXEBnUGQ1Lw5YxC2 OhIbLAP7WiI99HLXGVhtq9mpFJ8C1aO10MSy0D+vPHRxJETV3fKDKRLW76WYOcD0hvTE fUHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HzxHuLou; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg12-20020a170907a40c00b007918f58458bsi6986480ejc.441.2022.12.02.09.23.55; Fri, 02 Dec 2022 09:24:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HzxHuLou; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233770AbiLBRTu (ORCPT + 99 others); Fri, 2 Dec 2022 12:19:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233760AbiLBRTr (ORCPT ); Fri, 2 Dec 2022 12:19:47 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FF11E785B for ; Fri, 2 Dec 2022 09:19:45 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id ml11so13068729ejb.6 for ; Fri, 02 Dec 2022 09:19:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:message-id:date:from:content-transfer-encoding:mime-version :subject:from:to:cc:subject:date:message-id:reply-to; bh=r/RdQpRDc/P3p5PuMcx3RxG10Ut5U2wPQz1yCcrQs0Q=; b=HzxHuLouTRvA3KjA2OBUGJkyjrJsTTCyeds0LYUc4MEDNmtV4h1eSfqOa4jK6SWkqX zT7TdZry17LePKM+EvXbOs5xTw19lJEFcUWIPbNyboDMq14qQninfXyWf5BjAFyXIgpG Z6VUGquxvE2DzNiryD+Jfj/yagd+CKvckd2nA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:message-id:date:from:content-transfer-encoding:mime-version :subject:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=r/RdQpRDc/P3p5PuMcx3RxG10Ut5U2wPQz1yCcrQs0Q=; b=vbsb1/NfjN/YzdexIuDqRRxBuE6z3yM1o9MWHlUkJgGSpOuyENvrzMidRigFNwCXa6 cn3MweEAV7OOQn28+A4JLKT+mcKqQ/hUfL5+v2VOWPFvWyCZOYovcb/pvudPoJ1X0F6e 3MmB5kq/3G+CuJyaU7/rlQvzBd+ZymT7pKVFkC+ULPor3+fJrGbKvL4A4Rbv6f4nVJ/3 B/vUO6QV7MAWcy2TRBsdzOgvW9U2XpEVnbtFBVTh3aEt4//KeHFMhc0a2lCAOL88dkdt n7irEhSly/tpF9A42QNHj3Fm1gxP3Vzj1jlB60qd+6++7HeudKnfknMHsAbt8NjuUjpe gEWQ== X-Gm-Message-State: ANoB5pnVMLYg9XHqb1Uyt6QIJQI5nNFQS4bgZ105aYtYO+C7fsPfjJYr NzAbxmfQT/V3CTqs4KMC5v5b3A== X-Received: by 2002:a17:906:39c8:b0:7ad:79c0:5482 with SMTP id i8-20020a17090639c800b007ad79c05482mr51357594eje.730.1670001584143; Fri, 02 Dec 2022 09:19:44 -0800 (PST) Received: from alco.roam.corp.google.com (80.71.134.83.ipv4.parknet.dk. [80.71.134.83]) by smtp.gmail.com with ESMTPSA id l4-20020aa7c304000000b00458dc7e8ecasm3117864edq.72.2022.12.02.09.19.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 09:19:43 -0800 (PST) Subject: [PATCH v4 0/2] media: uvcvideo: Implement granular power management MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAKIzimMC/4XNTQrCMBAF4KtI1kaaSdOkrryHuMjPYAOaSGIjUn p3B5ciuhreg/fNwiqWiJXtNwsr2GKNOVHotxvmJ5vOyGOgzKAD6EboeMGKKfBbfmCptiFXoxFajB hg0IxmzlbkrtjkJxqm+XKhcor1nsvz/aYJOscfYhO84wKkteCsNHI4+Knka5yvu1zO7EReg38GkK GEVEE4J7w0Xwz5z5Bk+F4bNQSjlcYPY13XF0lCe9xAAQAA From: Ricardo Ribalda Date: Fri, 02 Dec 2022 18:19:30 +0100 Message-Id: <20220920-resend-powersave-v4-0-47484ae40761@chromium.org> To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, Yunke Cao , Max Staudt , Hans Verkuil , Laurent Pinchart , Tomasz Figa , Guenter Roeck , Sergey Senozhatsky , Alan Stern , Ricardo Ribalda , linux-kernel@vger.kernel.org X-Mailer: b4 0.11.0-dev-696ae X-Developer-Signature: v=1; a=openpgp-sha256; l=1945; i=ribalda@chromium.org; h=from:subject:message-id; bh=kciBkpg9OytuPzxiqiWfbkAo1WlMycZv7Sn0Qh/anFY=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBjijOlKg2WE+mgx19kj8BfWLXFrt21VuBIwjiigxpp S4ciJfCJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY4ozpQAKCRDRN9E+zzrEiGlND/ 9de/F0ouT85wAcxMUsezJriMfv2tJLWDFZA0+HYtzm3cgRovk/352X+3fEv8WQTgLNmJsl1hbQFK2g 8iNOjYeW/O0HciAtITljyDQi1udgCvcIOcAVv3gLXlUClMNQHJYhC96lysYhMCh9OOi/1R4a5G3TbN yVjiU5gQR2hCDVfdHlqo25XKTpXrFl+MDm7btoJN9JcIOA5xP0wJqZocICS3yt9TYhjBJESSV/KZLX HEdMKKVZ3tmK3xnyOrbcJK1o7McsrgHVu/kc3Kte1Urfqd/by4DDyoWSZnCXYltBjmgWElAJh5POVp 1xFPCtKiVqNQTnMZmLeKQVoP+UewDxg6pg1b35psB5Slha75rjhSVmPBCrhuATsx/b2aNmjZk/x/xI ZOtNOZTs3L4Wail5H2NIfgr8dL8HDdE1zOT82msp2/siKWkJVc8Qk6y/pdXOYfPQP4eNQPEXpsRdeF eFmNXtBZr3UcjlDFzDh/oXlkdhOsDn9pbcWwXoM6ksjAau7mZqIC8I0PlVA3bbxTgnMhc/Mx7VBszz qpnj8VIaP1t5Ab3M3RfQZDA+T6nfuq5uPLh2fBgXtk7YMvOMXQtSRsUsSTUNdRJhP1ZiRZnmqtHf2g pfOHt6aQGfnmIu0dZsSucura6lggiY5b+gLWp+YOfN4dMOwGncEgfqID2N1w== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751123870727982815?= X-GMAIL-MSGID: =?utf-8?q?1751123870727982815?= Instead of suspending/resume the USB device at open()/close(), do it when the device is actually used. This way we can reduce the power consumption when a service is holding the video device and leaving it in an idle state. To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Laurent Pinchart Cc: Tomasz Figa Cc: Alan Stern Cc: Hans Verkuil Cc: Guenter Roeck Cc: Max Staudt Cc: Sergey Senozhatsky Cc: Yunke Cao Signed-off-by: Ricardo Ribalda --- Changes in v4: - Remove patches to avoid crashes during device removal - Link to v3: https://lore.kernel.org/r/20220920-resend-powersave-v3-0-c47856d8757e@chromium.org Changes in v3: - Rebase on top of uvc/next - Reorder series, and put "controversial" patches at the end. - Fix "use-before-set" bug. Thanks Max! - Link to v2: https://lore.kernel.org/r/20220920-resend-powersave-v2-0-5135d1bb1c38@chromium.org Changes in v2: - Make access to uvc_status contitional - Merge with Guenter race condition patchset: https://lore.kernel.org/lkml/20200917022547.198090-1-linux@roeck-us.net/ - Link to v1: https://lore.kernel.org/r/20220920-resend-powersave-v1-0-123aa2ba3836@chromium.org --- Ricardo Ribalda (2): media: uvcvideo: Refactor streamon/streamoff media: uvcvideo: Do power management granularly drivers/media/usb/uvc/uvc_v4l2.c | 193 ++++++++++++++++++++++++++++++++------- drivers/media/usb/uvc/uvcvideo.h | 1 + 2 files changed, 159 insertions(+), 35 deletions(-) --- base-commit: 58540610e464d8b2ba46a11b81c3e6fcc4118fae change-id: 20220920-resend-powersave-5981719ed267 Best regards,