Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2025888rdf; Mon, 6 Nov 2023 02:27:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFx3oGQPNoP03PHDIvmmseLw+vq23uyFQcynXDXKpfcgYQmJzdWnqTQkkFFLpCKTxURAkiv X-Received: by 2002:a05:6830:4af:b0:6c4:e81f:59b8 with SMTP id l15-20020a05683004af00b006c4e81f59b8mr26657759otd.22.1699266466184; Mon, 06 Nov 2023 02:27:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699266466; cv=none; d=google.com; s=arc-20160816; b=wqqsDB3PY6REjjJbPFHrD+MBT7bOW3B5Z8ZhZ9Ioj7DRvcfn/Ed0qPkFanOhz8cwgL EQcP1M/WdZoUs0tjOU0/pSiVMqFLvj0F9n2ccArg2rFVsZVW+0tExVQG5kJwoX1AZS9S gZfQCpBbbAyNS4KeFJLoAhoXsHXeRu/h6gNRqTIMZPuK2WcZQ+/rrsy6eUkHoZkpjAFf HvX5p1DwTdAixkiMEc9cLjin781e/UEImq5AUmFFAi4ZRthtt4L28baFsbAtQpWCVWJd Xv+DkFireNYCXR/aImhPS9pDZ2zSOT7lzcNNXY4W/iNtMAAUO34Lko+hI6F02AjutET5 VROA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=bM4HsF0BgMD7Nod4LCs0sMCWJlfH+hCkezVz3gEsN3w=; fh=S6j7wRQiLjNsZWuKZPdHqmqavmBwwjhJ8sE0SWOz/yU=; b=uFZethKirT8Gjwq1K44hyM2w2e7SE2Z2WTGXHc8q7JaWxJPNnw5NrhSCvUTqjjWI2E qdsuvuPOFq774q+gzEZnX7f592U+x/LLfhK/GaOHaognwl+bTpVCBWYYsxPNL5oZ7cer E4xOxCOdj35lag1iIjC8XMz4Hqd4CL1JU2lNivt+PWp2y2EO9ecT97x00nlbsW8Uc6JS w+raMhBZdHZ1Iz4z99D61T5Mw0xlDICaMjF1v7Fceiph/zu9R84btkRcwaGzaOKkHBj4 Z6ULhGokOnHxdxCNpu18oix2wf6BuZhPJyLk1PrqjB8pt38p3T8LHnjmOV2UWwGvj/st JKDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=V7jfu8o0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id x184-20020a6386c1000000b005b8817e562dsi7510442pgd.92.2023.11.06.02.27.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 02:27:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=V7jfu8o0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 589B580BE2FE; Mon, 6 Nov 2023 02:27:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230475AbjKFK1n (ORCPT + 99 others); Mon, 6 Nov 2023 05:27:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbjKFK1m (ORCPT ); Mon, 6 Nov 2023 05:27:42 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9A7CD8; Mon, 6 Nov 2023 02:27:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699266460; x=1730802460; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=VV8FhN3eu/AlRFbG+72mkF5xgKloicJTe1Nvqf9cbbs=; b=V7jfu8o0XDeBstCe/3s0cmyxvdUkCfcUH0sgr9sUivztgpZuCZAZWEqg 2E4Xs05SxZzLwJ/91Hbe8/8nudJRffPEGSV5sJUQ/baHTpfrdbHq8vdvv J7Ri7vRIuPULJ0SOkUJLoIjpYm1P6sfdza3jFLLXL/zdiwKO6I/0Z+noo AAbjBWxVQeYg1kDY75J0lC5naUcuY70fFVwtKQAQO9mzAQE4ZC6+Tlvx/ Xkyd5KDNyHWG3kXWKd8fzxqoEpjCf6fUnZ2Lafch6km+kHk9dMt8hxzY5 6Pb7tXvzYpQKTlonjfNDFJyFWMoH3Wi4L42+Bt1LHghkOMKBAY++apB29 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10885"; a="2157336" X-IronPort-AV: E=Sophos;i="6.03,281,1694761200"; d="scan'208";a="2157336" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2023 02:27:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10885"; a="738761530" X-IronPort-AV: E=Sophos;i="6.03,281,1694761200"; d="scan'208";a="738761530" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga006.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2023 02:27:33 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC3) (envelope-from ) id 1qzwpN-0000000BlGy-385G; Mon, 06 Nov 2023 12:27:29 +0200 Date: Mon, 6 Nov 2023 12:27:29 +0200 From: Andy Shevchenko To: alisadariana@gmail.com Cc: Alisa-Dariana Roman , Alexandru Tachici , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maksim Kiselev , Arnd Bergmann , Cosmin Tanislav , Okan Sahin , Ibrahim Tilki , Marius Cristea , ChiaEn Wu , Marcus Folkesson , Niklas Schnelle , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] iio: adc: ad7192: Add AD7194 support Message-ID: References: <20231105193132.47009-1-alisadariana@gmail.com> <20231105193132.47009-4-alisadariana@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231105193132.47009-4-alisadariana@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 06 Nov 2023 02:27:44 -0800 (PST) On Sun, Nov 05, 2023 at 09:31:31PM +0200, alisadariana@gmail.com wrote: > From: Alisa-Dariana Roman > > Unlike the other AD719Xs, AD7194 has configurable differential > channels. The default configuration for these channels can be changed > from the devicetree. > > The default configuration is hardcoded in order to have a stable number > of channels. ... > config AD7192 > - tristate "Analog Devices AD7190 AD7192 AD7193 AD7195 ADC driver" > + tristate "Analog Devices AD7190 AD7192 AD7193 AD7194 AD7195 ADC driver" This doesn't scale. Please change this and below like: tristate "Analog Devices AD719x ADC driver" > depends on SPI > select AD_SIGMA_DELTA > help > Say yes here to build support for Analog Devices AD7190, > - AD7192, AD7193 or AD7195 SPI analog to digital converters (ADC). > + AD7192, AD7193, AD7194 or AD7195 SPI analog to digital converters (ADC). Say yes here to build support for Analog Devices SPI analog to digital converters (ADC): - AD7190 - AD7192 - AD7193 - AD7194 - AD7195 > If unsure, say N (but it's safe to say "Y"). With above change adding a new one will be just a mater of adding a single line. ... > +static int ad7192_parse_channel(struct iio_dev *indio_dev, > + struct fwnode_handle *child) > +{ > + u32 reg, ain[2]; > + int ret; > + > + ret = fwnode_property_read_u32(child, "reg", ®); > + if (ret) > + return ret; > + if (reg < AD7194_CH_DIFF_NR_MIN || reg > AD7194_CH_DIFF_NR_MAX) > + return -EINVAL; in_range() > + ret = fwnode_property_read_u32_array(child, "diff-channels", ain, > + ARRAY_SIZE(ain)); > + if (ret) > + return ret; > + > + if (ain[0] < AD7194_CH_AIN_MIN || ain[0] > AD7194_CH_AIN_MAX || > + ain[1] < AD7194_CH_AIN_MIN || ain[1] > AD7194_CH_AIN_MAX) Ditto. > + return -EINVAL; > + > + ad7194_channels[reg].channel = ain[0]; > + ad7194_channels[reg].channel2 = ain[1]; > + ad7194_channels[reg].address = AD7194_CH_DIFF(ain[0], ain[1]); > + > + return 0; > +} -- With Best Regards, Andy Shevchenko