Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3662933pxb; Mon, 1 Feb 2021 01:01:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHmU0rwOEGKuK5FV+JgIydMm/rf2fwt9pFLUyWLzQW95/eK3f6m8LPUruMDFlUQ/Kz3TeR X-Received: by 2002:a17:906:388b:: with SMTP id q11mr16786348ejd.421.1612170106655; Mon, 01 Feb 2021 01:01:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612170106; cv=none; d=google.com; s=arc-20160816; b=YL+jB0wWoiN+7s3YEWHwwRB3FbEQCEaoUB246+6E5n2bHlMVXiwAXTvRKkw8Ry9Z2+ Q/jaouMzlaK/OViCcQgC6O4598xBfQ9Z4xkH7tJ9b2/lGINkjf4hwgTz4mf1AZ8Qo42h JvnGOO68OQW2zes1qfT9z6Mcqrbooz2b9Wyzhb+zduvLJFeIl1PHfHxeUCG42ExoYe6j uWlW5F9Owet2nD5a/tW9yUsuXu5zOeh0lmPALsvV06ylFioHYPDwmq6f/9r7WEc42uv+ Ogekfwn+ZJTYnAfm+mI5g0rq/aQwjbOEOYdh0RTPRB0h5Z0h5Qj/OcVz+66Jnf5A5JWG loow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=GyxsNnWu7EqjyU0NKMwi2dzcVL+ptjeCIPcsXEH/9OY=; b=znUbdp2OoWce/AntwKi02dlktDGBFplgrMfW1Xw6k6n+GxFMlqNQRr3B4OTNCJr5U1 tjqplQqPae4a6W5unmI3ySm+1TBjxZpwgZGyGQMF3J+XhDaONrrMa2jvbh8ibbOgRdTp 4nsU29s+PUAIPMyxFZfcGz0d0CjFoJ+oWmR/puR3wNm9VKqpk15M7l3DGU8b4z6sS+6c L/9rP4TuabQvhhP24wp8qmNCSfgHYaPQULgSxMwaKuB9riCdsZ/R2MqRhPVl14hSgVRr O1Ocz6m2g5p1Yltdw5aCXC8VSMJ8p9kbzfSR8K/fViEBGON6+jZBcJK0/LPKGjZAVG/v GRIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=i6PdTJrb; 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 f19si2846161ejb.315.2021.02.01.01.01.22; Mon, 01 Feb 2021 01:01:46 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=i6PdTJrb; 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 S232363AbhBAI7J (ORCPT + 99 others); Mon, 1 Feb 2021 03:59:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231992AbhBAI6y (ORCPT ); Mon, 1 Feb 2021 03:58:54 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D13AC06174A for ; Mon, 1 Feb 2021 00:57:48 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id s5so5037985edw.8 for ; Mon, 01 Feb 2021 00:57:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=GyxsNnWu7EqjyU0NKMwi2dzcVL+ptjeCIPcsXEH/9OY=; b=i6PdTJrbTgfPEq1qvNzYS4t4VsejQHvBMA2i45CHObKGwPzTKS4X3R5W02R02DNRfr 9F48UgomgbOq6gppxgT4+6tuQmsSHf5a7Vr2bMdmt57Uk39z4OU49+Do6uCOXRqHkV4f XE510R+cNphZYBjIKhw5YlVF955NPuWlSvhpasOICJu+nCFpU8GkzQKIg6AxYZ2wOFOx 7fxMDR9GSb9IaenWC1mMrNc2pzs6J+uQqfoAp42APYhs+a4ElJZZ0CIgjXBbfND2wQFw 2uJbWV+HCa/Z5qJx2c+Oo0Etw5ORVx5jgX00rHyrO1+Ug3riu1gD7nHgATlqC2gexrji lbYw== 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=GyxsNnWu7EqjyU0NKMwi2dzcVL+ptjeCIPcsXEH/9OY=; b=ZVoD2AcZOqUCGE/2mkVGZoaxfeQGevVOhXHUTYST05EjCAQCy6nPA3QL/uEsfAdfhO S/mWmkDsT74THXFn57Fuj6zulbdimz3N8//C2Rqj+Ciz6wCi2PKO1Zc1stlicZVJripb ypP4xI910TMH+ZKKYkCaXqf8yteM5gWNOfCPXmsGMC7iwwCcg2sPzq6AohHA35yOm3wu 5PyKYLfA35n/tfX8738xB+f4IJYHuim6n2MvjsgGJTlRlE/S1tdSsAdDN/IYGZdz+Dtw pOobTkKzfCIXN4ySvTG583XmfAxFl41VU2kXV5WpKPP5RTBGbIlKOuNoxN1ZOAmlZTnR HWQA== X-Gm-Message-State: AOAM533Ux/Pell1ekd6AohQdsXJl157exV5Rfik0DVoVLrIbs041WB5t Z4nYfaCvUPnRH7bvoFt7FXolqtz+H2HoOcu5l1VIDw== X-Received: by 2002:a05:6402:35ca:: with SMTP id z10mr17750262edc.186.1612169867171; Mon, 01 Feb 2021 00:57:47 -0800 (PST) MIME-Version: 1.0 References: <20200903081550.6012-1-sakari.ailus@linux.intel.com> <20210128232729.16064-7-sakari.ailus@linux.intel.com> <20210129121955.GH32460@paasikivi.fi.intel.com> In-Reply-To: <20210129121955.GH32460@paasikivi.fi.intel.com> From: Bartosz Golaszewski Date: Mon, 1 Feb 2021 09:57:36 +0100 Message-ID: Subject: Re: [PATCH v9 7/7] at24: Support probing while off To: Sakari Ailus , "Rafael J. Wysocki" Cc: linux-i2c , Wolfram Sang , ACPI Devel Maling List , LKML , Greg Kroah-Hartman , Rajmohan Mani , Tomasz Figa , Bingbu Cao , Chiranjeevi Rapolu , Hyungwoo Yang , linux-media Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 29, 2021 at 1:20 PM Sakari Ailus wrote: > > Hi Bartosz, > > Thanks for the review. > > On Fri, Jan 29, 2021 at 11:56:00AM +0100, Bartosz Golaszewski wrote: > > On Fri, Jan 29, 2021 at 12:27 AM Sakari Ailus > > wrote: > > > > > > In certain use cases (where the chip is part of a camera module, and = the > > > camera module is wired together with a camera privacy LED), powering = on > > > the device during probe is undesirable. Add support for the at24 to > > > execute probe while being powered off. For this to happen, a hint in = form > > > of a device property is required from the firmware. > > > > > > Signed-off-by: Sakari Ailus > > > --- > > > drivers/misc/eeprom/at24.c | 43 +++++++++++++++++++++++-------------= -- > > > 1 file changed, 26 insertions(+), 17 deletions(-) > > > > > > diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c > > > index 926408b41270c..dd0b3f24e3808 100644 > > > --- a/drivers/misc/eeprom/at24.c > > > +++ b/drivers/misc/eeprom/at24.c > > > @@ -595,6 +595,7 @@ static int at24_probe(struct i2c_client *client) > > > bool i2c_fn_i2c, i2c_fn_block; > > > unsigned int i, num_addresses; > > > struct at24_data *at24; > > > + bool low_power; > > > struct regmap *regmap; > > > bool writable; > > > u8 test_byte; > > > @@ -750,14 +751,16 @@ static int at24_probe(struct i2c_client *client= ) > > > > > > i2c_set_clientdata(client, at24); > > > > > > - err =3D regulator_enable(at24->vcc_reg); > > > - if (err) { > > > - dev_err(dev, "Failed to enable vcc regulator\n"); > > > - return err; > > > - } > > > + low_power =3D acpi_dev_state_low_power(&client->dev); > > > > I've raised my concern about the naming of this before but no > > discussion followed. Do we really want to name it: "low power"? This > > is misleading as the device can actually be powered off at probe(). > > "Low power" suggests some low-power state or even low battery IMO. > > This was suggested by Rafael in place of "powered off" as it's not know t= he > device is powered off. The same terms should be used in all contexts (ACP= I > and I=C2=B2C frameworks and drivers). Others haven't expressed concerns. > So we're describing a situation where "device may be powered off" by calling it "low_power". This doesn't make sense. Why not something like: acpi_dev_may_be_off(), acpi_dev_powerdown_possible(), acpi_dev_possibly_off(). If I'm reading a driver's code an see "acpi_dev_state_low_power()", I would have never guessed it refers to a situation where the device may be potentially powered-down. > ACPI spec appears to be using terms "on" and "off". > > The use of the function is not limited to driver probe time. > > > > > If anything: I'd prefer the 'low_power' local variable be changed to > > "no_test_read". > > That misses the power management related suggestion now present in the na= me > --- the device needs to be suspended using runtime PM if probe fails and > it's not in "low power state". > > How about "off_during_probe"? > Yes, this is much better than low_power. Bartosz > -- > Kind regards, > > Sakari Ailus