Received: by 2002:a05:7208:3188:b0:7e:5202:c8b4 with SMTP id r8csp869945rbd; Fri, 23 Feb 2024 06:13:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVrbIJuB3bppQr5JOdBlfPasqlJtQ5q4NryateyJ7TazJjakoYh3kqWZvjXM6hQfjqYhat3jfhOOp2VkqpfT1R5GMD6ioDkT3YfrvuwaQ== X-Google-Smtp-Source: AGHT+IHH0ec1bNZgYRmRud4PJLl0NFScGWN0Og6WlIoPal9NRkfma1Or7OHqRkoD15MUjC7YWXDR X-Received: by 2002:a05:6a20:7912:b0:19e:9d92:b6a6 with SMTP id b18-20020a056a20791200b0019e9d92b6a6mr1491095pzg.44.1708697580648; Fri, 23 Feb 2024 06:13:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708697580; cv=pass; d=google.com; s=arc-20160816; b=l2bu8GrPn+Q4sMpZk9tVOe9aZdBb6zysdgbeTiJi+fjKjE2v2twLCtUCBbrVLitxL+ I0UDJ+vnIGIbeZdtyAoSTCu0l9Eft0taFVcHkldU2oQ+LsI59gbslOcgzn1F94Pea0Ht pjOR29t4c6SyIjkiAaw/T8baQZ8rHO3WU+48J14+HQJM95I6KbzeRa4JO8kSVhrwFMxk qgMAjIsz+XdWT89RLlqkEbVdUgnx35nLS2PVHfFlJFh6wjViWdJGZBvwt026eI2DouA3 Bcnjut0RnWxm/PR3nycMlQWedJcSLYDPKdKbTpR3a1skLr665CheObQOZG95G6JrZBSJ TskQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=P4gYPQDKRW28f/+Hb98TaIICcu3K1spSmQnj/lPb0BY=; fh=EUC25uZwgpkuauWjvk8Iy443TF0y2kem8XeEtEvyAgw=; b=gVggX4bACZZFvd/uw+8/LYE0tv8I0hRTmKBla8hMQqlbflgSd3Wks2yGZggBUg7y3P 4TcokW5C0QlSE1TsnJU2Pgp5KMjY/NLDvm9hjBa5IXswFn8N9tC6mWH6C5buwW1fDVTR ibwXtYyLwFAbyXaEA+EXAkQ4VoPUageGXlNp7+xXmFmKPAYR/pd3zbmVSgCCUvrGfJge 39Z6daxCsqHFhaifdFEZm9KRSRUKf2SqI5K+3w3uOyUkdTsHvq9EQ6KuUGvjFqr/fnSY zSwHxAyuHvzYVO/eWNQdSp8z0Bac4VUIUKvxC1DHjpa5OcmH9n9aBajZAoNWBtSczugZ m8YQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cGJ2F8h0; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-78451-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78451-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l8-20020a63ba48000000b005dc8922fe5csi12192402pgu.457.2024.02.23.06.13.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 06:13:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78451-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=@gmail.com header.s=20230601 header.b=cGJ2F8h0; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-78451-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78451-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 EC4A6B21D8A for ; Fri, 23 Feb 2024 14:12:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5961E80BEE; Fri, 23 Feb 2024 14:12:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cGJ2F8h0" Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DABD7F46E; Fri, 23 Feb 2024 14:12:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708697568; cv=none; b=apFq1g1M6WGcx5rXRmapiLVhKmxMs7+KyEKXZjANUes0x8giwTN0uQ5nYKKC1tP7vnc8Ys59yeSIRaawmAHT/IQU+tWosbJqGae9Yq1R5xeK26KBk4sfbw7bQU70Tb7hUU9SkeNktlYFGaN4FS9P3T+sVb8sh8ZUdBockoz/yWs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708697568; c=relaxed/simple; bh=bUlp46Zm9bHTWoStRR28lGnePyraKkEGReXUW7v5XGA=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=mw0zZYQG4+VW0sNpD+WN6NSqHScktRSYqKHK8PCoX+Xy6BP3bl7Schgp21iUY8ohTM6Cm1zUl4GvmMzPBMeqMrz9djDp8ntoinqUchjUKFU8Uzqq3j5jKk2S1ekyV0BJd5kP+Irvc1Ke4n9oiL9pJISSv7BtWpTUxGPrHxXR6+I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cGJ2F8h0; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-41294136c27so3593935e9.3; Fri, 23 Feb 2024 06:12:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708697564; x=1709302364; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=P4gYPQDKRW28f/+Hb98TaIICcu3K1spSmQnj/lPb0BY=; b=cGJ2F8h0FLbwYerfoOvThEPAieJFAPxsC50iB5V8ikb1/fXNXLo2FJhv4gU2ba6XwN 6eSkFddNlxNwBlv71zPLL/+4b5w9zVtODxx99FTxCfH2iZ2t1TVHAXeXGbyDmICF5Zn7 9b8Y2oiijgTSzgyJRMppSs2TtVgMGj/8BezYwGcIVxpfzbVEmompGXdcKNuyVTegtDeM /ORgxFYi/bHm/CwHIEaixWSOIydH31pKwdJWZFdlAnR/dPq2hyPoLfHYZyBevg0bzPOI s/jygUwwM31tsnDb1Ckc7DkakTuQh+UQWZmdD1uew3Z7AnWltKclJW8MyaoacTpi2j5r DAUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708697564; x=1709302364; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=P4gYPQDKRW28f/+Hb98TaIICcu3K1spSmQnj/lPb0BY=; b=MF643JJQTNHcRLUz2xagM6/RBVHHzQxglF0O1Ijnavt28QsRSkHTQZN3OY9UDB2ar1 JLS63VJbiwN/FJlqEXd11JgySgJNXR0qnaWOwf3oyA302wzRGtbsuj4uMkrEBW45yX4t HMsH7iDbuz0/I+fblf5Eh2IUDsbleSZ05GP4xym0TTa6S9P7PZQ/kxKmpN6QQ1j+SciS 0Cu46SHaF6wrsohwYtRHb0SagqZJQC2vLuc/DgCC0MdtTkA1lifNU/0ZK0O/NRuFzkmP X1qV8fjSnYxk2TJhqbJ52CXVftadnMFryVRRQXqGaMyyUzJhbH8pQzndO5+Eu86yH0xh wzaQ== X-Forwarded-Encrypted: i=1; AJvYcCV/xxRvilrz7PRhsjaeoSXOfjJuFImn8TsHUqsWKO2KkvOn8z10TGDRmIKsrtEKOXT/98heZ2bPGahIFXr69AbWmAyWPbvAcCgeqolwsvOh3U7JnLyyH/D3SHu1Mv0X66bTQ4FFAofaYN9N76NKlepaxIPyDTtHdM4na7FkYQrUBnpxTjmg4zWqZR6DFlqPh5br4D0YX6e+MHHZVsIyFag= X-Gm-Message-State: AOJu0YztRbS6PnU7+WjkeI85/1i/Ksex9eMqHSUSsaHx1C2APlZjx0yb s85UTWgrvWZ80ty5og0t1wusmpvmbISQOrDAt8xc/IVMpVNcEdci X-Received: by 2002:adf:fd81:0:b0:33d:2710:b424 with SMTP id d1-20020adffd81000000b0033d2710b424mr1590190wrr.22.1708697564206; Fri, 23 Feb 2024 06:12:44 -0800 (PST) Received: from ?IPv6:2003:f6:ef1b:2000:944c:cbc7:1e1c:2c47? (p200300f6ef1b2000944ccbc71e1c2c47.dip0.t-ipconnect.de. [2003:f6:ef1b:2000:944c:cbc7:1e1c:2c47]) by smtp.gmail.com with ESMTPSA id u2-20020a056000038200b0033db0bbc2ccsm1313636wrf.3.2024.02.23.06.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 06:12:43 -0800 (PST) Message-ID: Subject: Re: [PATCH v15 2/3] iio: adc: ad_sigma_delta: Add optional irq selection From: Nuno =?ISO-8859-1?Q?S=E1?= To: Dumitru Ceclan Cc: linus.walleij@linaro.org, brgl@bgdev.pl, andy@kernel.org, linux-gpio@vger.kernel.org, Lars-Peter Clausen , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Walle , Andy Shevchenko , Arnd Bergmann , ChiaEn Wu , Niklas Schnelle , Leonard =?ISO-8859-1?Q?G=F6hrs?= , Mike Looijmans , Haibo Chen , Hugo Villeneuve , David Lechner , Ceclan Dumitru , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 23 Feb 2024 15:16:04 +0100 In-Reply-To: <20240223133758.9787-2-mitrutzceclan@gmail.com> References: <20240223133758.9787-1-mitrutzceclan@gmail.com> <20240223133758.9787-2-mitrutzceclan@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2024-02-23 at 15:37 +0200, Dumitru Ceclan wrote: > Add optional irq_num attribute to ad_sigma_delta_info structure for > selecting the used interrupt line for ADC's conversion completion. >=20 > Signed-off-by: Dumitru Ceclan > --- Reviewed-by: Nuno Sa > V15->V14 > =C2=A0- Uppercase ADC acronym in commit message > =C2=A0- Rename irq_num to irq_line, change type to int > V13->V14 > =C2=A0- Invert logic checking the presence of the optional irq_num attrib= ute > V1->V12 > > =C2=A0drivers/iio/adc/ad_sigma_delta.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 | 23 ++++++++++++++--------- > =C2=A0include/linux/iio/adc/ad_sigma_delta.h |=C2=A0 3 +++ > =C2=A02 files changed, 17 insertions(+), 9 deletions(-) >=20 > diff --git a/drivers/iio/adc/ad_sigma_delta.c > b/drivers/iio/adc/ad_sigma_delta.c > index 7e2192870743..03c170b638a8 100644 > --- a/drivers/iio/adc/ad_sigma_delta.c > +++ b/drivers/iio/adc/ad_sigma_delta.c > @@ -222,11 +222,11 @@ int ad_sd_calibrate(struct ad_sigma_delta *sigma_de= lta, > =C2=A0 goto out; > =C2=A0 > =C2=A0 sigma_delta->irq_dis =3D false; > - enable_irq(sigma_delta->spi->irq); > + enable_irq(sigma_delta->irq_line); > =C2=A0 timeout =3D wait_for_completion_timeout(&sigma_delta->completion, = 2 * > HZ); > =C2=A0 if (timeout =3D=3D 0) { > =C2=A0 sigma_delta->irq_dis =3D true; > - disable_irq_nosync(sigma_delta->spi->irq); > + disable_irq_nosync(sigma_delta->irq_line); > =C2=A0 ret =3D -EIO; > =C2=A0 } else { > =C2=A0 ret =3D 0; > @@ -295,7 +295,7 @@ int ad_sigma_delta_single_conversion(struct iio_dev > *indio_dev, > =C2=A0 ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_SINGLE); > =C2=A0 > =C2=A0 sigma_delta->irq_dis =3D false; > - enable_irq(sigma_delta->spi->irq); > + enable_irq(sigma_delta->irq_line); > =C2=A0 ret =3D wait_for_completion_interruptible_timeout( > =C2=A0 &sigma_delta->completion, HZ); > =C2=A0 > @@ -315,7 +315,7 @@ int ad_sigma_delta_single_conversion(struct iio_dev > *indio_dev, > =C2=A0 > =C2=A0out: > =C2=A0 if (!sigma_delta->irq_dis) { > - disable_irq_nosync(sigma_delta->spi->irq); > + disable_irq_nosync(sigma_delta->irq_line); > =C2=A0 sigma_delta->irq_dis =3D true; > =C2=A0 } > =C2=A0 > @@ -396,7 +396,7 @@ static int ad_sd_buffer_postenable(struct iio_dev > *indio_dev) > =C2=A0 goto err_unlock; > =C2=A0 > =C2=A0 sigma_delta->irq_dis =3D false; > - enable_irq(sigma_delta->spi->irq); > + enable_irq(sigma_delta->irq_line); > =C2=A0 > =C2=A0 return 0; > =C2=A0 > @@ -414,7 +414,7 @@ static int ad_sd_buffer_postdisable(struct iio_dev > *indio_dev) > =C2=A0 wait_for_completion_timeout(&sigma_delta->completion, HZ); > =C2=A0 > =C2=A0 if (!sigma_delta->irq_dis) { > - disable_irq_nosync(sigma_delta->spi->irq); > + disable_irq_nosync(sigma_delta->irq_line); > =C2=A0 sigma_delta->irq_dis =3D true; > =C2=A0 } > =C2=A0 > @@ -516,7 +516,7 @@ static irqreturn_t ad_sd_trigger_handler(int irq, voi= d *p) > =C2=A0irq_handled: > =C2=A0 iio_trigger_notify_done(indio_dev->trig); > =C2=A0 sigma_delta->irq_dis =3D false; > - enable_irq(sigma_delta->spi->irq); > + enable_irq(sigma_delta->irq_line); > =C2=A0 > =C2=A0 return IRQ_HANDLED; > =C2=A0} > @@ -586,9 +586,9 @@ static int devm_ad_sd_probe_trigger(struct device *de= v, > struct iio_dev *indio_de > =C2=A0 sigma_delta->irq_dis =3D true; > =C2=A0 > =C2=A0 /* the IRQ core clears IRQ_DISABLE_UNLAZY flag when freeing an IRQ= */ > - irq_set_status_flags(sigma_delta->spi->irq, IRQ_DISABLE_UNLAZY); > + irq_set_status_flags(sigma_delta->irq_line, IRQ_DISABLE_UNLAZY); > =C2=A0 > - ret =3D devm_request_irq(dev, sigma_delta->spi->irq, > + ret =3D devm_request_irq(dev, sigma_delta->irq_line, > =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ad_sd_data_rdy_trig_poll, > =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sigma_delta->info->irq_flag= s | IRQF_NO_AUTOEN, > =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 indio_dev->name, > @@ -668,6 +668,11 @@ int ad_sd_init(struct ad_sigma_delta *sigma_delta, s= truct > iio_dev *indio_dev, > =C2=A0 } > =C2=A0 } > =C2=A0 > + if (info->irq_line) > + sigma_delta->irq_line =3D info->irq_line; > + else > + sigma_delta->irq_line =3D spi->irq; > + > =C2=A0 iio_device_set_drvdata(indio_dev, sigma_delta); > =C2=A0 > =C2=A0 return 0; > diff --git a/include/linux/iio/adc/ad_sigma_delta.h > b/include/linux/iio/adc/ad_sigma_delta.h > index 7852f6c9a714..576eb617939d 100644 > --- a/include/linux/iio/adc/ad_sigma_delta.h > +++ b/include/linux/iio/adc/ad_sigma_delta.h > @@ -45,6 +45,7 @@ struct iio_dev; > =C2=A0 * @data_reg: Address of the data register, if 0 the default addres= s of 0x3 > will > =C2=A0 *=C2=A0=C2=A0 be used. > =C2=A0 * @irq_flags: flags for the interrupt used by the triggered buffer > + * @irq_line: IRQ for reading conversions. If 0, spi->irq will be used > =C2=A0 * @num_slots: Number of sequencer slots > =C2=A0 */ > =C2=A0struct ad_sigma_delta_info { > @@ -60,6 +61,7 @@ struct ad_sigma_delta_info { > =C2=A0 unsigned int data_reg; > =C2=A0 unsigned long irq_flags; > =C2=A0 unsigned int num_slots; > + int irq_line; > =C2=A0}; > =C2=A0 > =C2=A0/** > @@ -87,6 +89,7 @@ struct ad_sigma_delta { > =C2=A0 unsigned int active_slots; > =C2=A0 unsigned int current_slot; > =C2=A0 unsigned int num_slots; > + int irq_line; > =C2=A0 bool status_appended; > =C2=A0 /* map slots to channels in order to know what to expect from devi= ces > */ > =C2=A0 unsigned int *slots;