Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1371796ybl; Wed, 14 Aug 2019 15:57:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqKT30xAT5l0JqgeRpo/HHd+Z3xWGglvPfun9gmtm2aqO8hjoWVQ+avNrvAD5PNe9ybFG2 X-Received: by 2002:a62:2aca:: with SMTP id q193mr2370010pfq.209.1565823432165; Wed, 14 Aug 2019 15:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565823432; cv=none; d=google.com; s=arc-20160816; b=WhPQqvEiP1KFqD4uf6PXOH2xIUf2gi2tc4DyoQ8pFDOHtpWB8hhLB3WZcBLJ/JUVht KZ9yTCTrmFW/ZoiBubL3WnlBAb/uwZFwvtGRd1nUlG0/wEcOYrR2p8dnAgdn/SQlYk8t koKPtgIcMreonfdqh+xZa/pK4S+nkB4sgIYADFEt94hQVkkQq/FarXYXhnFMolPrOMmi xNZSFBENEGaA9QIiCr5yi+gysMlG9R8hQ2jhwOXMb75iflIQO03z6A9igNOQh8TOo0sR Pvlbvt4k18afjma4q3S+If1muQMsbZvVOPSXs0Ry/R2JLvAd+OrkUmOKMkP2n7anU3f7 ceow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=l/8nKRI+V2cVoeN1alU6QQeQq4HEFLn2GAv3HvjIeLE=; b=yAhhxROedDDuzyulRjqZwbmAFphKnhiGLIpVWrfC5591u1ANlPZ2CkCER5cn1Y2ncy shaGkiYTcvffcub83kzs8bZ7v2tzPagK5qGPNyd4hBALeeguooMSMI16ySLiqF51OcZ/ 3+zQeVf/3xQkvkP/TdVtuVz6RqgY5SvA4cVFaQtiMjgBY3HCOZF6oCOwM1p8EJOaTohW 9MTtU+6D7WPt7AVJGS9C5EbdOLCaj0S7MYBPRDY/+YwLqmzv89eIP/bKFSnLzQGmHOy7 YltEuY/5T+WYCp11AENDR8TC7YZZmZvpOcv6xjO4S5BOetlaYi4xuNS781kZdF+d86De yTrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pgLKdYEe; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 70si733056ple.282.2019.08.14.15.56.56; Wed, 14 Aug 2019 15:57:12 -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; dkim=pass header.i=@kernel.org header.s=default header.b=pgLKdYEe; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728976AbfHNVUQ (ORCPT + 99 others); Wed, 14 Aug 2019 17:20:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:44786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728014AbfHNVUQ (ORCPT ); Wed, 14 Aug 2019 17:20:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AEF2A2133F; Wed, 14 Aug 2019 21:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565817615; bh=2E2JMCEsGfJgUZSIcsEX9gpK1QWJbGLg/k/y//c7LnY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pgLKdYEea1VQuEuz1Gv3VbFrCYN2PEZ4jEbCkHoJwkSePk2JWz6kFI/uZ+uK+7dMF b0JQUzgonM4/XQ+1OafG24te3op3Ut/QA4FsqW9o6Qw+mMQu+ERyz3OqmgUD4GFDH3 KpH/YdphbCyf+VobkIuFmnck9Dpp+wIQGoT3wL5U= Date: Wed, 14 Aug 2019 23:20:12 +0200 From: Greg Kroah-Hartman To: Nick Crews Cc: linux-usb@vger.kernel.org, Enric Balletbo i Serra , linux-kernel , Daniel Kurtz Subject: Re: Policy to keep USB ports powered in low-power states Message-ID: <20190814212012.GB22618@kroah.com> References: <20190813060249.GD6670@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 14, 2019 at 02:12:07PM -0600, Nick Crews wrote: > Thanks for the fast response! > > On Tue, Aug 13, 2019 at 12:02 AM Greg Kroah-Hartman > wrote: > > > > On Mon, Aug 12, 2019 at 06:08:43PM -0600, Nick Crews wrote: > > > Hi Greg! > > > > Hi! > > > > First off, please fix your email client to not send html so that vger > > does not reject your messages :) > > Thanks, should be good now. > > > > > > I am working on a Chrome OS device that supports a policy called "USB Power > > > Share," which allows users to turn the laptop into a charge pack for their > > > phone. When the policy is enabled, power will be supplied to the USB ports > > > even when the system is in low power states such as S3 and S5. When > > > disabled, then no power will be supplied in S3 and S5. I wrote a driver > > > for this already as part > > > of drivers/platform/chrome/, but Enric Balletbo i Serra, the maintainer, > > > had the reasonable suggestion of trying to move this into the USB subsystem. > > > > Correct suggestion. > > > > > Has anything like this been done before? Do you have any preliminary > > > thoughts on this before I start writing code? A few things that I haven't > > > figured out yet: > > > - How to make this feature only available on certain devices. Using device > > > tree? Kconfig? Making a separate driver just for this device that plugs > > > into the USB core? > > > - The feature is only supported on some USB ports, so we need a way of > > > filtering on a per-port basis. > > > > Look at the drivers/usb/typec/ code, I think that should do everything > > you need here as this is a typec standard functionality, right? > > Unfortunately this is for USB 2.0 ports, so it's not type-C. > Is the type-C code still worth looking at? If this is for USB 2, does it use the "non-standard" hub commands to turn on and off power? If so, why not just use the usbreset userspace program for that? And how are you turning a USB 2 port into a power source? That feels really odd given the spec. Is this part of the standard somewhere or just a firmware/hardware hack that you are adding to a device? Is there some port information in the firmware that describes this functionality? If so, can you expose it through sysfs to the port that way? thanks, greg k-h