Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37386278rwd; Tue, 11 Jul 2023 13:34:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlHUwvVugML78b010hYQ4PGIvsDFVlRO4LAL2rdtvhXlO3GTINA5mR3smglJkXm+KZpDTV34 X-Received: by 2002:a17:906:3c0d:b0:98e:1156:1a35 with SMTP id h13-20020a1709063c0d00b0098e11561a35mr13171049ejg.74.1689107684927; Tue, 11 Jul 2023 13:34:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689107684; cv=none; d=google.com; s=arc-20160816; b=wvMwP70Bxkch2Tbsk6HaAWFAR7IHddPBwEWwVpvr5BMKtDGHLTH02lMbPSi17j1py1 PVv1j1e+xGEMfOdSsOKG5pe3c+EANXSQbnMLjcRPVUyyKIjcMJjjWNo5dKurowYNCXv+ PMJdg/wEitneFpfZDve+dhOewdCkKFxSoH9CYDOf2USFcXjrVCz/X8aj0pQc34JxvaLe erKqZNC/rzDLmuO1daEU4OP1r/Hm7F34fxPPxB4QRGLENhH0v5nxWTc/jOFvZ4vHGQXV NqynKvYvlPCpLjiurpU6Szp3IWOnj37vryDnu2Wl94yf4z/ygw2Y2/Yt2LMLn2D/6hrr d0xA== 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:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=g/m3jgQvRqComsOjcKXElElHR44H0s8Y7oshWvPitXo=; fh=Nkpk7VjQstRrk/SIKeFB2DsfhHIA7OANQWPD54Aly/o=; b=ayA60LKsksw+if2t95gE4pbaGGMzFPM5i/5FIcaLXCirLtn/9DcZnIy+SqeyqCbyc0 ZD8PbB9RsUC2CIFckYKUsSPhG8gl0hnyuG6ULE6QmKqgIfBLGhOTfBZRHMEieR8+gMaJ I0u+rUnkJnOfxwSsNyNOgnBrvMMzTfm7AjWz3C9MWJ7r0/vFUpK9heBRnfyCr5yHK3Hy wVQEWxoi1wEazdj0FRMvegMAakrYrY6sY9JmH2CgsuqoE/kkhD1zB+DaIkx2Dc9icaj4 yx9OlLhC+sAcal9p5+k4eH+prfVi0lu/lwPtwCeBaqYe662+wYtYfvqonCRVakL1HZFe oe5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=pjVwo0uy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j5-20020a170906830500b00992be03096dsi2475311ejx.846.2023.07.11.13.34.20; Tue, 11 Jul 2023 13:34:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=pjVwo0uy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231782AbjGKUCG (ORCPT + 99 others); Tue, 11 Jul 2023 16:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230490AbjGKUBz (ORCPT ); Tue, 11 Jul 2023 16:01:55 -0400 Received: from mx1.sberdevices.ru (mx2.sberdevices.ru [45.89.224.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C73AA170F; Tue, 11 Jul 2023 13:01:53 -0700 (PDT) Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 68913120014; Tue, 11 Jul 2023 23:01:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 68913120014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1689105711; bh=g/m3jgQvRqComsOjcKXElElHR44H0s8Y7oshWvPitXo=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=pjVwo0uyubwPbkRc0FHCf5A8xiVRcZGanUGf6Q3/OvyDZFJ/ztTvabSkQLzGhwHur u74kN/5ZsqdNhw2vSdnEwIgFVb96DZuJTPFmsALcGv7BxMVbkLXAu3JNQDAW/4i506 KdyrIXLXd3aCVSWKvUGqMEYWFp3jhQLfAVk0JOcDUe6sluaXbVXuylVAZ+cvm8Ll/4 t4TkebQ4wJ3NC+UGoqlJLRnHWmqPy0xzY+XHJ2SmZt6AJVJAQ1ASVAmaQiQtybPdFx fcPNYnw5HWMRiozRIXT8UQCl0yOFWdN1bzC6sll1UjIBkbqd8V+NJrAeA2HFS0biss 0ugSvtx9s4lVQ== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Tue, 11 Jul 2023 23:01:51 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Tue, 11 Jul 2023 23:01:40 +0300 From: George Stark To: , , , , , , , , CC: , , , , , George Stark Subject: [PATCH v5 5/6] iio: adc: meson: add channel labels Date: Tue, 11 Jul 2023 23:00:21 +0300 Message-ID: <20230711200141.239025-6-gnstark@sberdevices.ru> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230711200141.239025-1-gnstark@sberdevices.ru> References: <20230711200141.239025-1-gnstark@sberdevices.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 178558 [Jul 11 2023] X-KSMG-AntiSpam-Version: 5.9.59.0 X-KSMG-AntiSpam-Envelope-From: GNStark@sberdevices.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 521 521 0c3391dd6036774f2e1052158c81e48587b96e95, {Tracking_from_domain_doesnt_match_to}, 100.64.160.123:7.1.2;127.0.0.199:7.1.2;sberdevices.ru:5.0.1,7.1.1;p-i-exch-sc-m01.sberdevices.ru:5.0.1,7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1, FromAlignment: s, {Tracking_white_helo}, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/07/11 13:07:00 #21597915 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add channel labels to provide human-readable names for the inputs. Signed-off-by: George Stark --- 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 b14c66656bcc..918bd5da3605 100644 --- a/drivers/iio/adc/meson_saradc.c +++ b/drivers/iio/adc/meson_saradc.c @@ -1055,8 +1055,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, "temp-sensor\n"); + 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 = { -- 2.38.4