Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2122922pxv; Sun, 11 Jul 2021 03:26:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylZYAHzGuLitAo7Ki4kqbJhnXAG6a9tTepnVvuPHxCOXDrVRHWNc7qFmEy9GoNe+wD2a/J X-Received: by 2002:a5e:df08:: with SMTP id f8mr16027155ioq.172.1625999172457; Sun, 11 Jul 2021 03:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625999172; cv=none; d=google.com; s=arc-20160816; b=pNae8QLeP3Y8fdou5+iH1XUXCbEaIBHm29k+ZGUgtexyvXihL2bCfG13qeec/+ArP4 Q5XKreU0tFbvf0rVJNP/M4uqk/92iqVsrvB+0Hr5oPYDqBkI7OzAx6ZO0qyQWGh8avao fpumY7e4TWMbwX+JPXKZI7kjjeml6I9KEGUvkvGdC2S0yKoo3HjBoyIeyfg1wdJ5I+XP 8AWUgkKsD6cDZj8a6t3o6ZGWhtyFhAJCXz3sS298U7Ydl64f9UUS9aQLu254VAPwiWLV UdrjYcF7HKXxwhDoS6Hq2QckJaWjE93wdwpgWYqK2rLDbyIxGJsEdDy+WIkg9LqC4NO2 d2ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=N8XUPQvT+WKM76IeBeV17ywr4JJoANLEWOcoaKl88cc=; b=WNkckJLV38+N5mCjpDinEDDsDMP0m7mg656sgTGAPGTkKqYzBnU3EsTCojdW18nxS4 M3VUCI4krK3PBBkHmuObwD67CuERWJzPL7L4FYh9ZGsG6HGmXguygwznf2XrSPfsWDr3 DicOk99ejtWwwbRd/aqXfTKyf1+ieQAZa7B7wqmmt0CyzdfG2n7RoySyipeoYE4mKWBk KAjFf4iyVxcVOjfwmfoB08ZYZ2p/B8q7GeExugOugX0UO8870zypRQO9QkVK2ZI55LkG iydo8NSRimNroaZK8SO6LbXKAS+PrFdYjZLnmzqdgs7eekLegGAKL/VMuHzow6WISniE bmgg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q5si2596614jaj.40.2021.07.11.03.26.00; Sun, 11 Jul 2021 03:26:12 -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; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232030AbhGKKWE (ORCPT + 99 others); Sun, 11 Jul 2021 06:22:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:36912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231998AbhGKKWD (ORCPT ); Sun, 11 Jul 2021 06:22:03 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B6A2A6124B; Sun, 11 Jul 2021 10:19:14 +0000 (UTC) Date: Sun, 11 Jul 2021 11:21:30 +0100 From: Jonathan Cameron To: Andreas Kemnade Cc: lars@metafoo.de, sre@kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, letux-kernel@openphoenux.org Subject: Re: [PATCH v2 1/2] iio: adc: rn5t618: Add iio map Message-ID: <20210711112130.45339212@jic23-huawei> In-Reply-To: <20210705113637.28908-2-andreas@kemnade.info> References: <20210705113637.28908-1-andreas@kemnade.info> <20210705113637.28908-2-andreas@kemnade.info> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 5 Jul 2021 13:36:36 +0200 Andreas Kemnade wrote: > Add iio map to allow power driver to read out values as a consumer. > This approach does not block later addition of devicetree support > which would be helpful if there is an in-kernel consumer for AIN0/1. > > Signed-off-by: Andreas Kemnade Looks good. I'm assuming this will go via the power tree, perhaps with an immutable branch on off chance we have any other changes in the same driver this cycle. Acked-by: Jonathan Cameron > --- > Changes in v2: > - provide consumer mapping via iio_map instead of devicetree > > drivers/iio/adc/rn5t618-adc.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/drivers/iio/adc/rn5t618-adc.c b/drivers/iio/adc/rn5t618-adc.c > index 7010c4276947..c56fccb2c8e1 100644 > --- a/drivers/iio/adc/rn5t618-adc.c > +++ b/drivers/iio/adc/rn5t618-adc.c > @@ -16,6 +16,8 @@ > #include > #include > #include > +#include > +#include > #include > > #define RN5T618_ADC_CONVERSION_TIMEOUT (msecs_to_jiffies(500)) > @@ -189,6 +191,19 @@ static const struct iio_chan_spec rn5t618_adc_iio_channels[] = { > RN5T618_ADC_CHANNEL(AIN0, IIO_VOLTAGE, "AIN0") > }; > > +static struct iio_map rn5t618_maps[] = { > + IIO_MAP("VADP", "rn5t618-power", "vadp"), > + IIO_MAP("VUSB", "rn5t618-power", "vusb"), > + { /* sentinel */ } > +}; > + > +static void unregister_map(void *data) > +{ > + struct iio_dev *iio_dev = (struct iio_dev *) data; > + > + iio_map_array_unregister(iio_dev); > +} > + > static int rn5t618_adc_probe(struct platform_device *pdev) > { > int ret; > @@ -239,6 +254,14 @@ static int rn5t618_adc_probe(struct platform_device *pdev) > return ret; > } > > + ret = iio_map_array_register(iio_dev, rn5t618_maps); > + if (ret < 0) > + return ret; > + > + ret = devm_add_action_or_reset(adc->dev, unregister_map, iio_dev); > + if (ret < 0) > + return ret; > + > return devm_iio_device_register(adc->dev, iio_dev); > } >