Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2967702imm; Mon, 13 Aug 2018 03:48:49 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx/35zXg3ttsdN7hf7pE35g7BJhiilFc5bWcb12EUxnrSfxXQV0jHWqzJugna1L4upGqPu9 X-Received: by 2002:a17:902:708b:: with SMTP id z11-v6mr15915027plk.262.1534157329929; Mon, 13 Aug 2018 03:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534157329; cv=none; d=google.com; s=arc-20160816; b=zGAkncQD0rX/NyxvKXQOM55rhs/p88kqUT9WQmyzLPpHU+d6s/yfVdaGBYr2MI5iSJ vEPNG4vZyI38dK9hUno+2B2gjNWNm1gAK1o8Viu/zmy59nWQraQ65GTOajBx7lINXa/a gtan2vAUJLEuS5X33LbyqQSPUTLmYr0d+Jj+/1umJiYYhaIXjLmnX6c7w6Bmeoh3WApf +5RZgeO8hvxVPvF1lHeEIHm94Hi7azKCFDvkRm6zsKFBnargT8rgKl1nYFfmM6IPE9jB 2iV2aVXhCt4UMqfco1IAgXlE1L0QpRrZLW5F+mhh0tj3QcHN0WE0eDIGtVuUKR4n+0/T O0gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=MZu2bGNbco1iZ1LpUT9oV16SXraSHJlzegtIMekr3Yc=; b=iFoByUPzubC0EY8V9A894B/ZEYE15n5uJgHKCLzpQ0aIYQgx2Bk7+M9MQUje+rOI2B Rcz13T5WmljRMdtYKjp+1d6VYWJIgU2HYY827IU6OL35TGaGH8ctt/RbnKA5fwzv6K/d EyXSK4Q/b9T0SxAPCHg9Gjt1IwoGWwqRavf/874ae5jOiGQ/F00ifTIxlylN43eEO8Pk HTtC6bA+V3PDd1veQHhUDffw1rszniL9JaUcoK02GTA/vDZ7tJkXFXLlJ/qKdaemBFhf T4fObRT28zK8nDCK34G6Z/5K2gKpBBbdyiX37JwTip87pn7OXn5viN3EhgVWusxktWQP GO7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r7-v6si18351583pgl.1.2018.08.13.03.48.34; Mon, 13 Aug 2018 03:48:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729069AbeHMN2t (ORCPT + 99 others); Mon, 13 Aug 2018 09:28:49 -0400 Received: from mga09.intel.com ([134.134.136.24]:35357 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728356AbeHMN2s (ORCPT ); Mon, 13 Aug 2018 09:28:48 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Aug 2018 03:47:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,233,1531810800"; d="scan'208";a="65726335" Received: from anshuma1-pnp-server.iind.intel.com ([10.223.107.119]) by orsmga006.jf.intel.com with ESMTP; 13 Aug 2018 03:47:04 -0700 From: Anshuman Gupta To: oneukum@suse.com, linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, anshuman.gupta@intel.com Subject: Re: [Query] USB device autosuspend and its runtime usage count. Date: Mon, 13 Aug 2018 16:15:02 +0530 Message-Id: <1534157102-29526-1-git-send-email-anshuman.gupta@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534146566.10070.5.camel@suse.com> References: <1534146566.10070.5.camel@suse.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 13, 2018 at 01:19:26PM +0530, Oliver Neukum wrote: > On Mo, 2018-08-13 at 12:15 +0530, Anshuman Gupta wrote: > > Hi , > > I need to test a functionality with USB autosuspend with latest kernel > > Linux 4.18-rc8. I am trying to autosuspend a USB key board, i enabled > > its autosuspend by doing echo "auto" to its "control" attributes. > > I am expecting USB keyboard to go to autosuspend after autosuspend_delay_ms. > > But USB key board is not going to autosuspend because its runtime usage > > count is not equal to zero. > > > > Below are the log snippets: > > > > root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5/power/runtime_enabled > > enabled > > root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5/power/control > > auto > > root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5/power/autosuspend_delay_ms > > 2000 > > root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5/power/runtime_status > > active > > root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5/power/runtime_usage > > 1 > > root@intel-Kabylake-Client-platform:# sleep 60; cat /sys/bus/usb/devices/1-5/power/runtime_usage > > 1 > > > > My USB keyboard runtime usage reference count is not decreasing to zero. > > Here am i missing something regarding runtime usage count or is it some issue with > > my kernel or OS? > > Very hard to say without further information. Is the HID device the > only interface of the whole device? yes, HID device is only the interface for given device, below here lsusb -t log for usb dev 1-5. root@intel-Kabylake-Client-platform:# lsusb -t /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M |__ Port 5: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M |__ Port 5: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M > Does the device support remote wakeup? yes, from lsusb logs it seems, it is supporting remote wakeup. root@intel-Kabylake-Client-platform:# lsusb Bus 001 Device 003: ID 04d9:1702 Holtek Semiconductor, Inc. Keyboard LKS02 root@intel-Kabylake-Client-platform:# lsusb -v -d 04d9:1702 | grep Remote Remote Wakeup > Is an LED on? Num lock led was on, but switching it off also does not help. > > Usbhid does support autosuspend, but its criteria must be met. > And all interface drivers must call the device idle. All of its interfaces are in runtime suspend root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5\:1.0/power/runtime_status suspended root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5\:1.1/power/runtime_status suspended root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5/power/runtime_active_kids 0 > Or you have discovered a kernel bug. > > Regards > Oliver > -- Thanks, Anshuman