Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp2110148rdb; Sun, 21 Jan 2024 07:51:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXRfz1bEeArA3wwqnLlbYyQkFRBtvdeBOP5HmfhOhOQOD85HVC+COXdT/SvKYzDfc/PQR6 X-Received: by 2002:a6b:6318:0:b0:7be:ee18:6bde with SMTP id p24-20020a6b6318000000b007beee186bdemr4710352iog.14.1705852272821; Sun, 21 Jan 2024 07:51:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705852272; cv=pass; d=google.com; s=arc-20160816; b=ZzuvAAmZbuPmGq1yKCTN2yMy79Dz31GaaP6dVQbn6aV444+fifnl3C02EGc/QXNAQ8 EnuBUqJNcpQo4BGZ/B+6ghIe1t8yAnrZACyghYXf9nVRFmyr1JqJ9ohK6O06cEsJYNU3 yvtKfS1m8MJQ6/fXvJVfYxPzf4IpVJt0dWVSdVsPM/yAtaejkjpYTgundvcIa25Lu7e+ LEIiFVSwOrmYbP6KlKW1b+vPI9O9LgUIppUsu9V9ZGHgVlNwhGsKr3iwmApRL4Mx+ZjC mKMSzRNOZ0YOlgowISqf8MCoZNIRVnQzgtfsTyUqu0zLBPMqtFEtsodvK7mJFpATwGGh LNkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=ZhVjquoKEjqGwHp5Y48BBP6mMuyrdmmSM4caXneqiKc=; fh=6HEulA5jwsTU+iAYe9i6lL4MVio8o8NtdwsgDg87ZgY=; b=f7+rIXgFPKKkMFEyYbLaJZpDL6RnrRcKddCYJxYc0AgrRUu8McH+rgRMKvye8poKUu 6+3DRfxDhnTU6tCZH+WRvXVK0JpX/KIiMj7qCeOWChxQkgbxBwN9qk8yMgOvZgZYNR0s /qGl3jq2gyRD5YN0ORWpObapYiP/eLx41xbM1E5KAMFyapckRq9Bq1LcoWutmGuMPaMk 2tD6Bbv36n73Zfwp4bUCew6Ud4P0p/KR2Lf7qC/9Yzs6KNRpD9wwWpHBK2sV7NalUIau L2aI5H8vJQNh3FiJakEzYa9CkY765RP9dmACOJvPteA9MKXYIK1SimCHUP1SenQl8mh0 3mQg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KQWPmWOR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-32104-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id k10-20020a170902c40a00b001d6f28b7031si6892732plk.193.2024.01.21.07.51.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 07:51:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32104-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KQWPmWOR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-32104-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A4600B227C7 for ; Sun, 21 Jan 2024 15:51:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66C5537704; Sun, 21 Jan 2024 15:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KQWPmWOR" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EEAA376E2; Sun, 21 Jan 2024 15:51:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705852260; cv=none; b=lEW1tZ87Ceym1e2neV/hCb/pGUM7a4VhE7yfz+2Jvd//HV4QCLzTl7zPCgn0KaUxdD7ECFV+ZRV4AQz9CKc2gv0MHC/V77YfScAZIChRyhB/Q0fMOgmdxukLeixD21w1h1Ub7+h/zhD6xFtLYN1wp5WUiP/VCR0Frx0aMOn0aJE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705852260; c=relaxed/simple; bh=m7HC1AJf4lC007wsALDSYwzESPJy1H9H/qWpdRD1HeQ=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=afB42G9kym8tzvadIPGdbtiw7C5p9G1spfmRYjIZC6nunvapZI/uBKpfeVjKtJ5PkyVX4ak1zdZymEaZ7IhTlbvz0Bnvo25iHIxU8NWZCb2abpfNAU5UoGyXsT/bixn3DjHM0wCTAo1JhdBzUbYeYs7AR1tEmF49olSaRCUUVP0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KQWPmWOR; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE3BEC433C7; Sun, 21 Jan 2024 15:50:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705852259; bh=m7HC1AJf4lC007wsALDSYwzESPJy1H9H/qWpdRD1HeQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KQWPmWORh39g0L5LGb7nbuomiZVA678SA6uaElGVr2QbTpyEj0lZ6T2uBF+wdiKUm zjateRZIyx4x5yT4s06XqvXm+oWTR9tIkSSRuLMI0kOkJjl5VIlrb6zudwL5X2QJUn cg+UipVg9zEUDjy3A5/xFOTE3SKkdGJK5pMnRfrehE4qpB06ZrzGqNLOorCTook0ng qFWpnjfEo74IppYZHI9kVPUwET6GgLj20eD10jULi3F/xKptKEedn3Sf8AajRb1jne WUebZpEuya303UoILZI72nzH0U5HWpC4oneJlJx0TDQpGd54i+T1PgdnQLXpEy4oYv V/fuY6RHs19Hw== Date: Sun, 21 Jan 2024 15:50:41 +0000 From: Jonathan Cameron To: Dumitru Ceclan Cc: linus.walleij@linaro.org, brgl@bgdev.pl, andy@kernel.org, linux-gpio@vger.kernel.org, Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Walle , Andy Shevchenko , Arnd Bergmann , ChiaEn Wu , Niklas Schnelle , Leonard =?UTF-8?B?R8O2aHJz?= , Mike Looijmans , Haibo Chen , Hugo Villeneuve , David Lechner , Ceclan Dumitru , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v12 2/2] iio: adc: ad7173: add AD7173 driver Message-ID: <20240121155041.3fc1a85d@jic23-huawei> In-Reply-To: <20240118125001.12809-2-mitrutzceclan@gmail.com> References: <20240118125001.12809-1-mitrutzceclan@gmail.com> <20240118125001.12809-2-mitrutzceclan@gmail.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.40; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 18 Jan 2024 14:49:23 +0200 Dumitru Ceclan wrote: > The AD7173 family offer a complete integrated Sigma-Delta ADC solution > which can be used in high precision, low noise single channel > applications or higher speed multiplexed applications. The Sigma-Delta > ADC is intended primarily for measurement of signals close to DC but also > delivers outstanding performance with input bandwidths out to ~10kHz. > > Reviewed-by: Andy Shevchenko > Reviewed-by: Michael Walle # for gpio-regmap > Signed-off-by: Dumitru Ceclan One comment following through from adding the named irq support to the binding. The driver needs to check that it has the right one as perhaps only the error one is wired, or it is the first one specified in the binding. > +static int ad7173_probe(struct spi_device *spi) > +{ > + struct device *dev = &spi->dev; > + struct ad7173_state *st; > + struct iio_dev *indio_dev; > + int ret; > + > + indio_dev = devm_iio_device_alloc(dev, sizeof(*st)); > + if (!indio_dev) > + return -ENOMEM; > + > + st = iio_priv(indio_dev); > + st->info = spi_get_device_match_data(spi); > + if (!st->info) > + return -ENODEV; > + > + ida_init(&st->cfg_slots_status); > + ret = devm_add_action_or_reset(dev, ad7173_ida_destroy, st); > + if (ret) > + return ret; > + > + indio_dev->name = st->info->name; > + indio_dev->modes = INDIO_DIRECT_MODE; > + indio_dev->info = &ad7173_info; > + > + spi->mode = SPI_MODE_3; > + > + ad7173_sigma_delta_info.num_slots = st->info->num_configs; > + ret = ad_sd_init(&st->sd, indio_dev, spi, &ad7173_sigma_delta_info); > + if (ret) > + return ret; > + > + ret = ad7173_fw_parse_channel_config(indio_dev); > + if (ret) > + return ret; > + > + ret = devm_ad_sd_setup_buffer_and_trigger(dev, indio_dev); If the error interrupt is provided either first, or as the only interrupt this is going to use the wrong one. Probably need to have a variant of that which takes an explicit irq so that figuring out which irq is relevant becomes a driver problem rather than the library having a go based on spi->irq. > + if (ret) > + return ret; > + > + ret = ad7173_setup(indio_dev); > + if (ret) > + return ret; > + > + ret = devm_iio_device_register(dev, indio_dev); > + if (ret) > + return ret; > + > + if (IS_ENABLED(CONFIG_GPIOLIB)) > + return ad7173_gpio_init(st); > + > + return 0; > +}