From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D27C4C433FE for ; Tue, 19 Oct 2021 22:54:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA604610E5 for ; Tue, 19 Oct 2021 22:54:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229905AbhJSW4g (ORCPT ); Tue, 19 Oct 2021 18:56:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229893AbhJSW4f (ORCPT ); Tue, 19 Oct 2021 18:56:35 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16205C06174E for ; Tue, 19 Oct 2021 15:54:22 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id f11so1242624pfc.12 for ; Tue, 19 Oct 2021 15:54:22 -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=cU3HJbTF7v8oN4m9QpyNLUi7Z2VsnXCEZXyNBnXavMs=; b=cuhVndCamK8/716BHL8VV3m6G8gcGkThTiSVQ6WCdR23cmkvS8BAdf5MUWNZ3+xdJh SXNvDs9u/lEzXmzt2H4VqFJR13EW1nC9xTyUpNjgvdyajBpGbxaWkVSkwru2zDmzhJL5 9+BvigGJweB1Imcox7fO16zbnV5IFg9bzbcUo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cU3HJbTF7v8oN4m9QpyNLUi7Z2VsnXCEZXyNBnXavMs=; b=L8aXYF0z8PBgeK2Wd46wypNKyQjdjbhwRKaUeFFfl2rxwmzO52Ui+DFmEEgdkQYhKp SKlyNDWUdTrDpDPrb1vF+CaiDHKUD+gLtWwhQX2OR8ydy1ErZiekcEoIspIlKro1pGjm PBERXzwKqrBBjXoKByPR6Dnafm7qOyvIQ63ocj32n9Hqh13hk3LTrnajbjg1t0BSQQr7 YMenWwT2YTLkRjwdwMzDMDD1/WJWAaQt4bCY2K7nYz+2C4fYUx+UBH43EClibN5POpoI sgq4+TkJuYiCN5ViyTFTKI3rYh4AjhOt1IJ66rJoU1hd59Dx+MUT6Uox1Kw/85ePVbIm niOA== X-Gm-Message-State: AOAM532RKQ6jk+HZzkpbhXw19ph5oJOjn4MDjBSnlSunq4pvKvSUItfA o0o99Xr97vHBMGDQ3mIX5VfZMQ== X-Google-Smtp-Source: ABdhPJwhFFyHmKUMVfxbdbUIRSGmuKpqlVMRtb5XW/S/r0SYWKyVbrnMtwygjRKH7m1CQn1PDJPYsw== X-Received: by 2002:a62:5804:0:b0:44b:b75b:ec8f with SMTP id m4-20020a625804000000b0044bb75bec8fmr2499812pfb.63.1634684061497; Tue, 19 Oct 2021 15:54:21 -0700 (PDT) Received: from localhost ([2620:15c:202:201:6c1f:a561:f56:7d16]) by smtp.gmail.com with UTF8SMTPSA id q6sm245804pgc.1.2021.10.19.15.54.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Oct 2021 15:54:21 -0700 (PDT) Date: Tue, 19 Oct 2021 15:54:18 -0700 From: Matthias Kaehlcke To: Dmitry Baryshkov Cc: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand , Mathias Nyman , Felipe Balbi , Bastien Nocera , Peter Chen , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Michal Simek , open list , Douglas Anderson , Krzysztof Kozlowski , linux-usb@vger.kernel.org, Ravi Chandra Sadineni , Stephen Boyd , Al Cooper , Andrey Zhizhikin , Andy Gross , Aswath Govindraju , Bjorn Andersson , Catalin Marinas , Dmitry Osipenko , Enric Balletbo i Serra , Fabio Estevam , Guido =?utf-8?Q?G=C3=BCnther?= , Jagan Teki , Nishanth Menon , Pawel Laszczak , Roger Quadros , Shawn Guo , Vinod Koul , Will Deacon , Linux ARM , "open list:DRM DRIVER FOR MSM ADRENO GPU" Subject: Re: [PATCH v15 0/6] usb: misc: Add onboard_usb_hub driver Message-ID: References: <20210727004118.2583774-1-mka@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Dmitry, On Tue, Oct 19, 2021 at 07:24:41PM +0300, Dmitry Baryshkov wrote: > On Tue, 27 Jul 2021 at 03:41, Matthias Kaehlcke wrote: > > > > This series adds: > > - the onboard_usb_hub_driver > > - glue in the xhci-plat driver to create and destroy the > > onboard_usb_hub platform devices if needed > > - a device tree binding for the Realtek RTS5411 USB hub controller > > - device tree changes that add RTS5411 entries for the QCA SC7180 > > based boards trogdor and lazor > > - a couple of stubs for platform device functions to avoid > > unresolved symbols with certain kernel configs > > > > The main issue the driver addresses is that a USB hub needs to be > > powered before it can be discovered. For discrete onboard hubs (an > > example for such a hub is the Realtek RTS5411) this is often solved > > by supplying the hub with an 'always-on' regulator, which is kind > > of a hack. Some onboard hubs may require further initialization > > steps, like changing the state of a GPIO or enabling a clock, which > > requires even more hacks. This driver creates a platform device > > representing the hub which performs the necessary initialization. > > Currently it only supports switching on a single regulator, support > > for multiple regulators or other actions can be added as needed. > > Different initialization sequences can be supported based on the > > compatible string. > > I have the feeling that you might want to check if you can use pwrseq > subsystem being proposed at > https://lore.kernel.org/linux-arm-msm/20211006035407.1147909-1-dmitry.baryshkov@linaro.org/. > It has been created for exactly the same reason of handling complex > power up/down requirements in a bus-neutral way. So instead of > creating an onboard-usb-hub, you might want to populate the hub node > with the reference to pwrseq device and make usb core call into > pwrseq. How does that sound to you? Thanks for the pointer, it's good to see another attempt to sort out power sequencing. The pwrseq framework could potentially be used by the onboard_usb_hub driver, but it probably can't replace it completely. Besides powering the USB hub on before enumeration the driver also can optionally power it off during system suspend when no wakeup capable USB devices are connected, which can result in signifcant power savings on battery powered devices. For this the driver needs knowledge about the USB (hub) devices that are provided by a hub chip. That part is probably best implemented by a driver under drivers/usb/. It might be an option to have the USB core and the onboard_usb_hub driver use the pwrseq framework, though we'd have to ensure that it isn't a problem that the USB core turns power on (before enumeration) and the onboard_usb_hub driver turns it off during system suspend (and on again on resume).