From patchwork Fri Jun 23 02:20:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Stark X-Patchwork-Id: 13289952 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0FAD7C0015E for ; Fri, 23 Jun 2023 02:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=74HefqhXuuuQj3cRR3VV+Ab3oFUogWQuUA8lMAk5N54=; b=2BqVbtpp9ej6Hf tk0BDz8qWV/8RyYgK1YzOVpyFzK2nEMV3NGooskA9hOguT6HEfjjXFDn9/ieQ9+IRqJs/WdiMuP+8 6Qu7n3QhNbuN7ZypNUWBLGaH3mPLhc6DvBaZRFZz5sqKGTQgI3vm+7PMkuOPQfoG6PH944tQ0lXqs Di3kPjZm2kmIs3ZhTQ1RqqQ7cCxdzxUxoB0HwG6J7PYj2Y/hbj3E1iO8WpIgUxhyD5fvoy+GC3nYh IKDaHvkWNn9QS4zeygUoK0hYPhQdeLqES94HxvS7pGQ7fuRtmVObc+7m+Y+8AMtxijOmwP6icuSx8 kWHSMg8KZ1JK2RJQV+Fw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCWTF-002K4n-29; Fri, 23 Jun 2023 02:24:21 +0000 Received: from mx.sberdevices.ru ([45.89.227.171]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCWSw-002Jt2-1p; Fri, 23 Jun 2023 02:24:04 +0000 Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id A65DB5FD66; Fri, 23 Jun 2023 05:23:54 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1687487034; bh=yGw6bp8rvMgtKlw7MfG3NQJsW3rgZ+48z4t6tgdQl5A=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=SQfezWoQUw91CXnAJuGgsda09wgT4veJgufAKFqHIVzEWuGMW9zal7vDWqaRDhaRL lt9ZGqr/oqWg1CZ9khRL8kgyWLc6Sqv0GI6hBnjK91uwLxeE+FoeFgB40Z33ZbA3Js vY3fVKzvmPCb9+S/tcniHM3OE3XrP6C233+tZ45foRlT/5uCtbmkyFmjXeythZi7lg StvbLYLOw6qGXpnFYj4PDRPs1yrBJ0NijYiMglo6K/UecY5DLchEMsD3zo2AB4O8Ni 1/5LX0iCC0k7VZOcu412pn3Mo8MD0VZdsAW8qy+GkK10oIcpNufSiLdgtlO94Mto3C 8eziUJpe906tw== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) by mx.sberdevices.ru (Postfix) with ESMTP; Fri, 23 Jun 2023 05:23:54 +0300 (MSK) From: George Stark To: , , , , , , , , CC: , , , , , George Stark Subject: [PATCH v2 5/6] meson saradc: add channel labels Date: Fri, 23 Jun 2023 05:20:13 +0300 Message-ID: <20230623022334.791026-6-gnstark@sberdevices.ru> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230623022334.791026-1-gnstark@sberdevices.ru> References: <20230623022334.791026-1-gnstark@sberdevices.ru> MIME-Version: 1.0 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/06/22 21:10:00 #21557945 X-KSMG-AntiVirus-Status: Clean, skipped X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230622_192402_793757_3A7BB4C6 X-CRM114-Status: UNSURE ( 8.87 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add attribute 'label' to all iio channles Signed-off-by: George Stark --- Changelog: v1->v2: update commit message from [1] [1] https://lore.kernel.org/lkml/20230621062715.455652-3-gnstark@sberdevices.ru/ --- drivers/iio/adc/meson_saradc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c index 7ef006650982..e7eb154b151f 100644 --- a/drivers/iio/adc/meson_saradc.c +++ b/drivers/iio/adc/meson_saradc.c @@ -1044,8 +1044,20 @@ static int meson_sar_adc_calib(struct iio_dev *indio_dev) return ret; } +static int read_label(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + char *label) +{ + if (chan->type == IIO_TEMP) + return sprintf(label, "%s\n", "temp-sensor"); + if (chan->type == IIO_VOLTAGE) + return sprintf(label, "channel-%d\n", chan->channel); + return 0; +} + static const struct iio_info meson_sar_adc_iio_info = { .read_raw = meson_sar_adc_iio_info_read_raw, + .read_label = read_label, }; static const struct meson_sar_adc_param meson_sar_adc_meson8_param = {