Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3737150ybt; Tue, 23 Jun 2020 09:29:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDO/dNq1nUz9WFQgVjRN95q4Bp2GqgKkOvqVWRZXreRPDZfCYaEujd4DyFj8xGs7UgDCb1 X-Received: by 2002:a17:906:edb3:: with SMTP id sa19mr14432118ejb.21.1592929778760; Tue, 23 Jun 2020 09:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592929778; cv=none; d=google.com; s=arc-20160816; b=P5O0UgIZ/EfzCz1x6c4g1Mkm72PgeDlI43fVyf0tJUygJ7lJEklKUfeayKhIJMO/St HREAm6RDTPhMjqVlcpmaafQy+PxjFvhxM2oixAWYVABnamFlbmt7uawVJ9ex1OKhUWSQ cKKZcNlZT0OQBohfMYYy1xAVskMH6TZ3kbrZkm2QxVaqBT1RL7MESyXU1TWDbZEQby0J UU0GxYg2DGwA12HSYRZbCGIdrUo+2B7gG6F7WjAN3FUrsqURTjj418aleXFdL5J9jZ7B EQ7OYMnFPnpCDhh3Gr/KS5/GP9NiV6fe3gPcMLe2taoUyp/TCwCG0IwfTdWZWaAtqKXJ 0U6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=2HfYUl27ws6rzUdD3KtQEV+gfmF8af8Ah+cfE/GhpU0=; b=USq3nop3MYUcJUTDVFLd/+jxHLEwSN4BoedPtUcxOXAw47imwkJBK7ox65/SJcbbHe nU92ptJhkmDcRe6d/FH/2x5Lk7bjyIZ3cCIqF+W7wIEyt8AqPok3dl+K4vzUsG8iAGAu HWmogg5MpMGYitEfSZC7U2RE0YfZRJBrUvyiepAkMv2WxkDRwD8k709eLs/mV6W+yU2N eJ1wAJ9uyaXLk7C+Fijl3o7EaOD0UzNWlSwZlc5492crEVIBV1yoqJQuQYrhkcRhTVqA 1SyliLr65uLdn1x3VF9l0U2v9+bwMtBa+wMO5vtRV7WS04eATFb8IncDhIaTgh/vLSTA XNYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=rNfsLC2j; 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 b27si4513798ejb.308.2020.06.23.09.29.14; Tue, 23 Jun 2020 09:29:38 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=rNfsLC2j; 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 S1732551AbgFWQ1T (ORCPT + 99 others); Tue, 23 Jun 2020 12:27:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732212AbgFWQ1T (ORCPT ); Tue, 23 Jun 2020 12:27:19 -0400 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE82EC061573 for ; Tue, 23 Jun 2020 09:27:17 -0700 (PDT) Received: by mail-il1-x144.google.com with SMTP id i18so8564025ilk.10 for ; Tue, 23 Jun 2020 09:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=2HfYUl27ws6rzUdD3KtQEV+gfmF8af8Ah+cfE/GhpU0=; b=rNfsLC2jhNPskzrBCvMUiHmMQhtgQHZRNee+zxTRxsUSJ9sABsKMttIhODtAJEKc5Y ScZo4QlGKQZWPhsJ/n02X2L/URyh8JSsNhSmkT+OCYBiRLamvRZ7wCorHduH4pbUKmPC XgZGwZJ+VAIxJCX9rAlvnABk2Sv/XTe4g/vAiINxGvKjqaJ+msVJ4gQzyECvqGdXct7I GzYmJjf7Q0KbSU7qxIYlDOO+KRq/iZqe2yOmCpyN5uKCkmyTEUqY2Ler9C7PSVWe8JNP mEX2+5Ff4/qzcIN96B5xb5NyyEHc8oiHh8tuiDCAQQMVHvM04XX+j8WGQLMHSGs3O7HS 2ldQ== 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:content-transfer-encoding; bh=2HfYUl27ws6rzUdD3KtQEV+gfmF8af8Ah+cfE/GhpU0=; b=d5pz5P69ST3uBXK4DkELj8XKnp5L/WPXZM04eIsHybIpDfkY9kZbpIXUm1D+B9P6jd pymnky+KgO5tE1pIDqKE/eIzcSw3MC1+Jn9QzF/ZCSYpJ8u8jb0vTkptv8+e4J94an+1 3tGjWiZRnb7HvZNgJetJh8IqsI7D8TRdJBwgQwHWNcY4b6NFYe+6L8umtt1a70JqJ0v1 lSQ6bfzdhbssQ/h4HMnahBqZZkSLMw8eWv9e4WnmWmoqnRMsCDXZiNj5NOBy6lTRqMFI wFZOvZpcgENr2pmnd1dkhBKT3rf2BjBwY8cwnqd1z6TFh4jABxkKj7H/voDeR71jhmD9 hTEw== X-Gm-Message-State: AOAM533LY2S9+SDgFERN+6r2L1nxpkhVRZGau99HgpzNPOqL2aQLYmmA lgGK9nAwzlbj02nugxhaO3auKyyThuWhPikcIhPupA== X-Received: by 2002:a92:c509:: with SMTP id r9mr22887128ilg.189.1592929637036; Tue, 23 Jun 2020 09:27:17 -0700 (PDT) MIME-Version: 1.0 References: <20200622093744.13685-1-brgl@bgdev.pl> <20200622093744.13685-15-brgl@bgdev.pl> <20200622132921.GI1551@shell.armlinux.org.uk> <20200623094252.GS1551@shell.armlinux.org.uk> <20200623095646.GT1551@shell.armlinux.org.uk> In-Reply-To: <20200623095646.GT1551@shell.armlinux.org.uk> From: Bartosz Golaszewski Date: Tue, 23 Jun 2020 18:27:06 +0200 Message-ID: Subject: Re: [PATCH 14/15] net: phy: add PHY regulator support To: Russell King - ARM Linux admin Cc: Bartosz Golaszewski , Andrew Lunn , Alexandre Belloni , devicetree , Vladimir Oltean , Linux Kernel Mailing List , Fabien Parent , Iyappan Subramanian , Quan Nguyen , Frank Rowand , Florian Fainelli , Jakub Kicinski , Vivien Didelot , Tom Lendacky , Andrew Perepech , Stephane Le Provost , Keyur Chudgar , Jassi Brar , Claudiu Manoil , Mark Brown , "moderated list:ARM/Mediatek SoC..." , Matthias Brugger , Linux ARM , netdev , Ilias Apalodimas , Liam Girdwood , Rob Herring , Philipp Zabel , Pedro Tsai , "David S . Miller" , Heiner Kallweit Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org wt., 23 cze 2020 o 11:56 Russell King - ARM Linux admin napisa=C5=82(a): > > On Tue, Jun 23, 2020 at 11:46:15AM +0200, Bartosz Golaszewski wrote: > > wt., 23 cze 2020 o 11:43 Russell King - ARM Linux admin > > napisa=C5=82(a): > > > > > > On Tue, Jun 23, 2020 at 11:41:11AM +0200, Bartosz Golaszewski wrote: > > > > pon., 22 cze 2020 o 15:29 Russell King - ARM Linux admin > > > > napisa=C5=82(a): > > > > > > > > > > > > > [snip!] > > > > > > > > > > > > > > This is likely to cause issues for some PHY drivers. Note that w= e have > > > > > some PHY drivers which register a temperature sensor in the probe > > > > > function, which means they can be accessed independently of the l= ifetime > > > > > of the PHY bound to the network driver (which may only be while t= he > > > > > network device is "up".) We certainly do not want hwmon failing = just > > > > > because the network device is down. > > > > > > > > > > That's kind of worked around for the reset stuff, because there a= re two > > > > > layers to that: the mdio device layer reset support which knows n= othing > > > > > of the PHY binding state to the network driver, and the phylib re= set > > > > > support, but it is not nice. > > > > > > > > > > > > > Regulators are reference counted so if the hwmon driver enables it > > > > using mdio_device_power_on() it will stay on even after the PHY dri= ver > > > > calls phy_device_power_off(), right? Am I missing something? > > > > > > If that is true, you will need to audit the PHY drivers to add that. > > > > > > > This change doesn't have any effect on devices which don't have a > > regulator assigned in DT though. The one I'm adding in the last patch > > is the first to use this. > > It's quality of implementation. > > Should we wait for someone else to make use of the new regulator > support that has been added with a PHY that uses hwmon, and they > don't realise that it breaks hwmon on it, and several kernel versions > go by without it being noticed. It will only be a noticable issue > when the associated network device is down, and that network device > driver detaches from the PHY, so _is_ likely not to be noticed. > > Or should we do a small amount of work now to properly implement > regulator support, which includes a trivial grep for "hwmon" amongst > the PHY drivers, and add the necessary call to avoid the regulator > being shut off. > I'm not sure what the correct approach is here. Provide some helper that, when called, would increase the regulator's reference count even more to keep it enabled from the moment hwmon is registered to when the driver is detached? Bart