Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3629684ybl; Sun, 8 Dec 2019 19:49:22 -0800 (PST) X-Google-Smtp-Source: APXvYqwPX9UD+pmMs6zCUiao2ZhAU0K1DRc7RwEb79Z7qZaIJAgR6oM2butv+CvO/dZt98S5ZO16 X-Received: by 2002:a05:6830:2098:: with SMTP id y24mr20140992otq.312.1575863362420; Sun, 08 Dec 2019 19:49:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575863362; cv=none; d=google.com; s=arc-20160816; b=ajDjQ/JgGE17Co2RUj5nBB4KmYYA6+uwBimLHk/o7BLdBrrN7Xo+bE+oJB5Ho4qfE9 pHOBppg11bNOwAyYoLmsApVOvCexswH81NsMA7qYBgOn9h7+59frermakf7/xzYNa8+d Xw/j0hpHCAimik5sJCeOX8CC6Nz++5KPIqlP7Xq/qYQ6Rc0uLui+N8msx3bN8NQLsJ9z 3AdAFoC9y0BShYKU/tf/hBO1FdmhjuBYUGEOjG/Rm9suBtuKNYMWNutID9VndDE1L/S7 aNyPuxoMQ+WoS0N8OcFaI/1PCnqsOMSAHuZ097FVaFYzhIFBvliYPrrGOEWjBQy1oC/o sczw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Y+vxa3qCisuYX81ZvQKh/06NrXG6iSdwdH4Sz/s9g3g=; b=z1o39AHMHQrqBXQUI0GBXj//SMrnTLKaL1ikXoNHl84EOXHxlfp3zA6oVZG1ank6Hx +VFNHZ+3GhE9v7j8Yx+iq9B3jfu1b9ul3CnIGykj7XW3IYBSQrl4XbXRm1x5i96ajf8v MWDaIaZXnQAvuePUJAK0767/T91eN2ncf53pfbEz3vuijJ7kMmSYamVPKYw/5d9HB+Hp +4IoRccoSESG8duZLjhNyaeEdSXnHyOzP3pRF2Vno1kQgCiCahbf/XggTiHxTWm30wwU ejomXorer1bUSelOlMBKcQ7ACE49uUqy4oJthPYGRVgMUOnQVl2PB7IvCKayeY2zaT5m RrSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=k8jJUyVS; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 8si10634791ota.266.2019.12.08.19.49.11; Sun, 08 Dec 2019 19:49:22 -0800 (PST) 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=@chromium.org header.s=google header.b=k8jJUyVS; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727081AbfLIDsB (ORCPT + 99 others); Sun, 8 Dec 2019 22:48:01 -0500 Received: from mail-ua1-f68.google.com ([209.85.222.68]:37508 "EHLO mail-ua1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727073AbfLIDsA (ORCPT ); Sun, 8 Dec 2019 22:48:00 -0500 Received: by mail-ua1-f68.google.com with SMTP id f9so4707618ual.4 for ; Sun, 08 Dec 2019 19:47:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Y+vxa3qCisuYX81ZvQKh/06NrXG6iSdwdH4Sz/s9g3g=; b=k8jJUyVSl6cE4W+fWhINdIPhwRBP5gNyjYOHsG6BtSo72KlCvh7X4RDiFph7rJprIi XyazImi+bK0wINFqmmHwu03wtt5n94j9ydqfRE1VwIEqu6u4HXz3sipGT/0IrBaoGQFT OcGMO3nxsp+5D+E0hapuUO37q/Xcf3Z0IImYE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Y+vxa3qCisuYX81ZvQKh/06NrXG6iSdwdH4Sz/s9g3g=; b=iUDi9PMglo1SOloiyGIYVrI5qdqjzfXQwcAeH3c03AhhiJgaJNUDYw2tM2AORB0spz mMgNe5i+BSu2y7cEKI8XqIk7VF3aEcnmb/eWJYlh/Cn2JOlqYN2VHO4PwZrfFXq0GMTb UXL3XDsitHZhw/UzduYu14M1+i+M+LHXpoKEG3W46F6IfVKLRG4bn4sjBdSKSsiKMY26 BahtlqbjlbZ0CBnwqgNQ4SZEL5NJKkQrrmmMHdjj3sDzPhBJyZa9O+9lTnOJsrQ3PUWp T2qdHzry+dqA467Ucv4SAh/sfg/SfLASBoK3bqlkWeGTlN9tp6HgxpPk2aV3kCGVTAd/ zRpQ== X-Gm-Message-State: APjAAAW1KVXPcrVcgs4DnWzAxEWTL4Y5zfOWLp9vtXEiLno/v3ph8Xd9 eARyxhwqyn9hbPVwhVcuj4GV5s5tmlrM2Pc3QFxIiQ== X-Received: by 2002:ab0:3487:: with SMTP id c7mr20535526uar.25.1575863278400; Sun, 08 Dec 2019 19:47:58 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ikjoon Jang Date: Mon, 9 Dec 2019 11:47:47 +0800 Message-ID: Subject: Re: [PATCH v4 2/2] usb: overridable hub bInterval by device node To: Alan Stern Cc: Johan Hovold , linux-usb@vger.kernel.org, GregKroah-Hartman , RobHerring , MarkRutland , SuwanKim , "GustavoA . R . Silva" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas Boichat Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 6, 2019 at 11:00 PM Alan Stern wrote: > > On Fri, 6 Dec 2019, Ikjoon Jang wrote: > > > On Thu, Dec 5, 2019 at 10:26 PM Johan Hovold wrote: > > > > > > On Thu, Dec 05, 2019 at 03:32:38PM +0800, Ikjoon Jang wrote: > > > > On Wed, Dec 4, 2019 at 3:55 PM Johan Hovold wrote: > > > > > > > > But related to my question above, why do you need to do this during > > > > > enumeration? Why not just set the lower interval value in the hub > > > > > driver? > > > > > > > > Because I want device tree's bInterval to be checked against the same rules > > > > defined in usb_parse_endpoint(). e.g. although hardware says its maximum > > > > is 255, but the practical limit is still 0 to 16, so the code can > > > > print warnings when bInterval from device node is too weird. > > > > > > But that could be handled refactoring the code in question or similar. > > > > > > > Yes, that should be worked. I can't exactly figure out how to refactor > > the code for now, but maybe parsed endpoint descriptors are being > > checked with default hard wired bInterval value and after that > > an overridden value should be checked again. > > > > Actually I don't care about the details of software policies. I just want > > all devices to be handled in the same manner without any further > > special treatments. > > > > > The fundamental problem here is that you're using devicetree, which is > > > supposed to only describe the hardware, to encode policy which should be > > > deferred to user space. > > > > The hub hardware has a default bInterval inside which is actually > > adjustable. So I can think setting bInterval is to describe the hardware > > rather than policy. > > If the hardware is adjustable, why don't you adjust the hardware > instead of changing the software? sorry, I meant "hardware has a default value but it's actually adjustable (by software)". Adjusting hardware is the best option but our hub doesn't allow to do that, so the current approach is patching a hardware descriptor on enumeration stage. > > > > So I think you need to figure out an interface that allows user space to > > > set the polling interval for any hub at runtime instead. > > > > Changing the interval at runtime is an another way to solve the > > power consumption problem, but it's not so easy. At least xhci needs > > to restart an endpoint and no devices are changing the interval after > > enumeration stage. > > Restarting endpoints is easy; just call usb_set_interface(). I thought just changing urb->interval at runtime will be more acceptable. Maybe I'll need an another approach if this patch is unacceptable. Thank you! > > Alan Stern >