Received: by 2002:a4f:b056:0:0:0:0:0 with SMTP id m22csp2665337ivi; Tue, 15 Sep 2020 16:07:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWTe5HzFZ6LYab/HCr8N5bF3EDSdI0sBCRDTrjFEMQG1zaiz+0be5uxrKTVwNDuXbd/D7t X-Received: by 2002:a50:ec12:: with SMTP id g18mr15434908edr.309.1600211247742; Tue, 15 Sep 2020 16:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600211247; cv=none; d=google.com; s=arc-20160816; b=kV+ONkXOIitDrjzT7WMQflJ4XIwra1+Uov6wt26PvwC4FMnLBHe39hGj4zn6/R41+9 fVwFl4oLA1rPy+FG7ChTaAH6wc77jpF4GMRo6B+tY2elUILFQ8qsm3VqDnefefZspE3j my8G7lt8v9Z1eLhBN7a4XxhBFraoG8hCLFRjRFAqHarCurRhfNG72cY4W4IlEt1TE35G S//YYi+pu4n+Wa1I/iAmBlQOV8hVkVX45WB0U+rft2la6nKx52aimOKqGPJKADOQRf1S xNgQTd6/SE9NZF3JyYKUXuKT3G4tAe5cL8u8TV1gewIsRKGogHxms9xotvEDX1oCqnHa KjvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Szj4HEGLJCAo0focZEdIAz4HSdQqUNWGrF8lTpz41tg=; b=rGuot8pXLYlMXtzL+XY1Oqfgi8orChX3NM3mXMlHj5i4UIIPwAdVCfqDJfq8cc4hCo rnvpNJuVEPfEbtzEtrfYRP9gJzzlDxq6a7KMXem1oR6P2DTzXs3TDTfKdah/0lud2S05 HPYiXp4t++m7Fqai38Cc0xA+pG4CV4va+sFvEsA7BD0Ic02uzKu7oiPvzvnNmQ1f80ND o7sjzuimfENovYnsMZM48NKtksWaH9si8zov+e+6I3JAldL4OcyeKMS2e9CHs9n1PY40 vEiiFI+hhKsTtf7PtRbIupJejPWIzgZfTIk4NN+wyxcr31visAlMhSld/DUjPMKh82K2 VPmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Al/ywHXk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id br19si10022074ejb.151.2020.09.15.16.07.04; Tue, 15 Sep 2020 16:07:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Al/ywHXk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727383AbgIOXER (ORCPT + 99 others); Tue, 15 Sep 2020 19:04:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727443AbgIOXDr (ORCPT ); Tue, 15 Sep 2020 19:03:47 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 917A9C06178A for ; Tue, 15 Sep 2020 16:03:47 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id r19so2128497pls.1 for ; Tue, 15 Sep 2020 16:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Szj4HEGLJCAo0focZEdIAz4HSdQqUNWGrF8lTpz41tg=; b=Al/ywHXkCLn66C3fB4LS0wK1RSE8K1XgfVUSsuH9bvAtw0RLdo2wBFXwerM1pAgULA /VBg8L6Xm1vtYDF0bYsOMv2/j+akKykQ4U9gd6R66+jRn7mUdHj7ddSOoJ7JnzEd7qsH ladfCPczQpkBnRc+aFmReIhIhDepPYqdxSZO4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Szj4HEGLJCAo0focZEdIAz4HSdQqUNWGrF8lTpz41tg=; b=YPBjzipAJfVoe2z2A8l7C5KfyGqxE5IRY7WxS7vzunPzDJwXkGxJMmcDpu7WtYXyF7 0rwcZ2Fo1GSebtpc+3j1tWna9Gfpzyg9guLFanWgi1jbq7vAdfeTXy7ien+ghw6+XYyO twjIE/wjkDb9sgsGJ0e1um1IilvnirA92T0U60T4YjPB6C7RBdKhRsB8Rw0zMzHLa0da c7sztdD1kv/nMO2w/71TeumlfU649MM8tHUA90WTC7/bprF7kR/fmHv6p++N0lqWjnkf 7q1CqSXjk45lVht0K9ZCxGK3fnnp+5xBEXgnPZCagmMm0em6kNTXX9YatvU08gwkpNJI dJKw== X-Gm-Message-State: AOAM5305cmPuLCVQXQvJ2sq/LeuX24Ppw8p0o+BLGnkClTPF28kVx3d0 Q2LK1HemoCWDiaePeRlGwfPWQQ== X-Received: by 2002:a17:90a:b702:: with SMTP id l2mr1476282pjr.82.1600211027113; Tue, 15 Sep 2020 16:03:47 -0700 (PDT) Received: from localhost ([2620:15c:202:1:f693:9fff:fef4:e70a]) by smtp.gmail.com with ESMTPSA id a20sm14251840pfa.59.2020.09.15.16.03.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Sep 2020 16:03:46 -0700 (PDT) Date: Tue, 15 Sep 2020 16:03:45 -0700 From: Matthias Kaehlcke To: Peter Chen Cc: Greg Kroah-Hartman , Rob Herring , Frank Rowand , Alan Stern , Krzysztof Kozlowski , Bastien Nocera , Ravi Chandra Sadineni , "linux-usb@vger.kernel.org" , Stephen Boyd , "devicetree@vger.kernel.org" , Douglas Anderson , "linux-kernel@vger.kernel.org" , "Alexander A. Klimov" , Masahiro Yamada Subject: Re: [PATCH 2/2] USB: misc: Add onboard_usb_hub driver Message-ID: <20200915230345.GF2771744@google.com> References: <20200914112716.1.I248292623d3d0f6a4f0c5bc58478ca3c0062b49a@changeid> <20200914112716.2.I7c9a1f1d6ced41dd8310e8a03da666a32364e790@changeid> <20200915025426.GA17450@b29397-desktop> <20200915050207.GF2022397@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, On Tue, Sep 15, 2020 at 07:05:38AM +0000, Peter Chen wrote: > > > > > + hub->cfg.power_off_in_suspend = > > of_property_read_bool(dev->of_node, "power-off-in-suspend"); > > > > + hub->cfg.wakeup_source = of_property_read_bool(dev->of_node, > > > > +"wakeup-source"); > > > > > > Do you really need these two properties? If the device (and its > > > children if existed) has wakeup enabled, you keep power in suspend, > > > otherwise, you could close it, any exceptions? > > > > That would work for my use case, but I'm not sure it's a universally good > > configuration. > > > > I don't have a specific USB device in mind, but you could have a device that > > shouldn't lose it's context during suspend or keep operating autonomously (e.g. > > a sensor with a large buffer collecting samples). Not sure if something like this > > exists in the real though. > > > > I'm not an expert, but it seems there are USB controllers with wakeup support > > which is always enabled. A board with such a controller then couldn't have a > > policy to power down the hub regardless of wakeup capable devices being > > connected. > > > > Whether or not it is a wakeup_source, it could get through its or its children's > /sys/../power/wakeup value, you have already used usb_wakeup_enabled_descendants > to know it. I conceptually agree, but in practice there are some conflicting details: wakeup for the hubs on my system is by default disabled, yet USB wakeup works regardless, so the flag doesn't really provide useful information. I guess we could still use it if there is no better way, but it doesn't seem ideal. Similar for udev->bus->controller, according to sysfs it doesn't even have wakeup support. Please let me know if there is a reliable way to check if wakeup is enabled on the controller of a device. > If the onboard HUB needs to reflect wakeup signal, it should not power off its regulator. > > For another property power-off-in-suspend, I think it is also a user option, > but not a hardware feature. Ok, I think you are suggesting a sysfs attribute instead of a DT property, that sounds good to me.