Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp57545pxb; Tue, 10 Nov 2020 19:46:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhzOI7a+dmNqcpo18fCNxYUtBOeIF7nCFYfFf1qgGhkkDHGH/4TjYf6e1J4J47CzdZGneF X-Received: by 2002:a50:ed14:: with SMTP id j20mr25239125eds.247.1605066400380; Tue, 10 Nov 2020 19:46:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605066400; cv=none; d=google.com; s=arc-20160816; b=dSuDxiXKVkQJbqA69/krO2f80hpMGYhjOUHZx/wUdk3Vlg7WTKNybn+x4LJEl02Gg6 92UKTG/0iVKdW5BgL6/TIGKinopGQTiNLZ0vTDbA+WrAAr42Qzy/RZXxLVY4UtV2bigN Vj0tHr3ZkUQAFfZaiHqg6mb4LfqTOr/0nlf8NJZiZdEMI5apiRQcM2EQXgGS3Kyyb3+T lQbLEnt2BWFXNU74/mVskyn4LuoqHEpkwarMc+huzeAY+GKP1+8tSbvKw2fH1qU7vnHp 4V9V9Q1W95azlK/ekJjZZmAnoDPHWvlboRKKdFtKvoyq3PSFoj0AHtfSIw74wprr0v2L F4Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-signature; bh=MbK62lfa8XqQ5uQpEMNmODTXXUW5ssZlsBtuCAcsjHw=; b=qJqAhPVoIfbmhVxfUa5GOBAHLfTIuxILmeHdgQ66kW18PAX6VC2fCVz3d9CBCqf0a6 3sLsay82V0XG+Tq7ZzOIsif5JvfpX6GskZBZukg3R/ml94IE3YCqh+GIPhiGUSZJpIKv i6GTmMJTft80XsRx9gbJTZEpM7papmcdKTqq0Yqws8Quqvdy9DB/oO0f79AjlmI6mFni u6avIVYAbNhzwSdY4nmSiMUybeAEQrxy344/NNYxn1JSvXHp5hCGRXleyZE0xg8T7AAP 7v9coYIFzl0RapXoHqMLwJ3Vfi4jbWDI/OkeKXoY1fkfcDp3/hnzBRShVvWwt0i1WSJv 1GpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=ZQeRRIlu; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=l9wDrZpx; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ch5si591634edb.190.2020.11.10.19.46.17; Tue, 10 Nov 2020 19:46:40 -0800 (PST) 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=@sholland.org header.s=fm1 header.b=ZQeRRIlu; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=l9wDrZpx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725898AbgKKDos (ORCPT + 99 others); Tue, 10 Nov 2020 22:44:48 -0500 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:57591 "EHLO wout3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725849AbgKKDon (ORCPT ); Tue, 10 Nov 2020 22:44:43 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id C45DB168A; Tue, 10 Nov 2020 22:44:41 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 10 Nov 2020 22:44:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=M bK62lfa8XqQ5uQpEMNmODTXXUW5ssZlsBtuCAcsjHw=; b=ZQeRRIlu5RRQSjaJV DabQsIHjtrX9diTzh1dbhHfKBKg9gxux67QCjj7dvZTlBFLGclnObL3rJkFwIbno Pyp+1Dy2Ze8Nq+0Y/t5g+HR5i9lq6S4IQORd1XDBNFrOEi7jtB89TFwZTfxMzOIb O+z5SopD5RWMJkue3kXVw795qIySgLDDQRZa0oGh96prI63hm3vg/0up1sKS73i9 H22zMeK5VrQD9MFWiGLgewjmywnBVxkFEpmErFaC07jK3TloBqAc48LVWQrvJFWF cJEtg0VhH16zIPrACcmCodChMVVFGLN23D3CwqLf+u+oU7Ych86WazUVwenz+/SK gtnVg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=MbK62lfa8XqQ5uQpEMNmODTXXUW5ssZlsBtuCAcsj Hw=; b=l9wDrZpxX9ozjQp14/v2qpNp4v3anPxU1/7XiQtzgrH2VMPqHbq6cGM1M JtYgroDNJ64e75liN3mIcijWMJtg4G95JuyPr7B4fcGmkG08nnGavjc8hKCf+gHQ h3rE0ittFD+q2XPP2bJRMjTNCqrpuVzlDYomelg0TiMRrUt+Av9w7fmJIvR1GIeD nXWJFYW4Mb5fU1tx85UjmoG+rIrhuSt/aGhYFPRU5RZBQvTzz1fd/i/aiT16vHCz 3XP+lfMsJJ1TuUu5kfKnsn7UYiZski9wrc6rp6olO0QLaQxlaCV0ZDP9xXl9iO/P 2+2g+HjSerHlmjPuYmR5QmYqyHc0g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudduledggeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepgfevffetleehffejueekvdekvdeitdehveegfeekheeuieeiueet uefgtedtgeegnecukfhppeejtddrudefhedrudegkedrudehudenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsrghmuhgvlhesshhhohhllhgr nhgurdhorhhg X-ME-Proxy: Received: from [192.168.50.169] (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id C7E32328005E; Tue, 10 Nov 2020 22:44:38 -0500 (EST) Subject: Re: [PATCH 3/3] phy: sun4i-usb: Use power efficient workqueue for debounce and poll To: Frank Lee , vkoul@kernel.org, mripard@kernel.org, wens@csie.org, krzk@kernel.org, colin.king@canonical.com, tiny.windzz@gmail.com Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20201109121214.19012-1-frank@allwinnertech.com> From: Samuel Holland Message-ID: Date: Tue, 10 Nov 2020 21:44:37 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20201109121214.19012-1-frank@allwinnertech.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/9/20 6:12 AM, Frank Lee wrote: > From: Yangtao Li > > The debounce and poll time is generally quite long and the work not > performance critical so allow the scheduler to run the work anywhere > rather than in the normal per-CPU workqueue. > > Signed-off-by: Yangtao Li > --- > drivers/phy/allwinner/phy-sun4i-usb.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c > index 651d5e2a25ce..4787ad13b255 100644 > --- a/drivers/phy/allwinner/phy-sun4i-usb.c > +++ b/drivers/phy/allwinner/phy-sun4i-usb.c > @@ -326,7 +326,7 @@ static int sun4i_usb_phy_init(struct phy *_phy) > /* Force ISCR and cable state updates */ > data->id_det = -1; > data->vbus_det = -1; > - queue_delayed_work(system_wq, &data->detect, 0); > + queue_delayed_work(system_power_efficient_wq, &data->detect, 0); > } > > return 0; > @@ -444,7 +444,7 @@ static int sun4i_usb_phy_power_on(struct phy *_phy) > > /* We must report Vbus high within OTG_TIME_A_WAIT_VRISE msec. */ This doesn't sound like "not performance critical" to me. My understanding is the debouncing has a deadline from the USB spec. Maybe this is more flexible than the comment makes it sound? > if (phy->index == 0 && sun4i_usb_phy0_poll(data)) > - mod_delayed_work(system_wq, &data->detect, DEBOUNCE_TIME); > + mod_delayed_work(system_power_efficient_wq, &data->detect, DEBOUNCE_TIME); > > return 0; > } > @@ -465,7 +465,7 @@ static int sun4i_usb_phy_power_off(struct phy *_phy) > * Vbus gpio to not trigger an edge irq on Vbus off, so force a rescan. > */ > if (phy->index == 0 && !sun4i_usb_phy0_poll(data)) > - mod_delayed_work(system_wq, &data->detect, POLL_TIME); > + mod_delayed_work(system_power_efficient_wq, &data->detect, POLL_TIME); > > return 0; > } > @@ -504,7 +504,7 @@ static int sun4i_usb_phy_set_mode(struct phy *_phy, > > data->id_det = -1; /* Force reprocessing of id */ > data->force_session_end = true; > - queue_delayed_work(system_wq, &data->detect, 0); > + queue_delayed_work(system_power_efficient_wq, &data->detect, 0); > > return 0; > } > @@ -616,7 +616,7 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work) > extcon_set_state_sync(data->extcon, EXTCON_USB, vbus_det); > > if (sun4i_usb_phy0_poll(data)) > - queue_delayed_work(system_wq, &data->detect, POLL_TIME); > + queue_delayed_work(system_power_efficient_wq, &data->detect, POLL_TIME); > } > > static irqreturn_t sun4i_usb_phy0_id_vbus_det_irq(int irq, void *dev_id) > @@ -624,7 +624,7 @@ static irqreturn_t sun4i_usb_phy0_id_vbus_det_irq(int irq, void *dev_id) > struct sun4i_usb_phy_data *data = dev_id; > > /* vbus or id changed, let the pins settle and then scan them */ > - mod_delayed_work(system_wq, &data->detect, DEBOUNCE_TIME); > + mod_delayed_work(system_power_efficient_wq, &data->detect, DEBOUNCE_TIME); > > return IRQ_HANDLED; > } > @@ -638,7 +638,7 @@ static int sun4i_usb_phy0_vbus_notify(struct notifier_block *nb, > > /* Properties on the vbus_power_supply changed, scan vbus_det */ > if (val == PSY_EVENT_PROP_CHANGED && psy == data->vbus_power_supply) > - mod_delayed_work(system_wq, &data->detect, DEBOUNCE_TIME); > + mod_delayed_work(system_power_efficient_wq, &data->detect, DEBOUNCE_TIME); > > return NOTIFY_OK; > } >