From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (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 A999E3093D3 for ; Sun, 2 Aug 2026 19:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785697569; cv=none; b=UA/iHnAg0LYkXMHdjrzahs0KePOFOBbq6C3RNnK0rSa6Srnby0QamT8xE5/QAyFIrYV9LuhNAexFHGZcG2fvLGtk9R0W/h6BFtf9iL6MyHo9M0vyzBv2JQCIJaikFarX92CM0IfguPUhWQxpq32L58p+wjJVKoWR6QiYpah6w14= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785697569; c=relaxed/simple; bh=yRaoIX+Gxw5W4NOc1GOUXDnqw2CxdICPvpu3Ivq2vUQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rX9SiaeEi01ilny9I8nxopMOLFdCRCpICaFd9xCicEVPGaOIitiZaSTiyFyKpRWT00XrfpLnVQYsd63/cJT1trinayhO87BY3Cm+blGN6iLPLqNvLPXkSeprxVI7cO84lvxmD6DZSk7BMIntNVN1rtj8V6XLeYi/ZU6raM3C2jo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=VZTMs2Gt; arc=none smtp.client-ip=209.85.167.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="VZTMs2Gt" Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-4a4c6081f9fso537813b6e.3 for ; Sun, 02 Aug 2026 12:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1785697566; x=1786302366; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Kw69Z0wzWemMAZPaY5Skc4txf5IJBcX28PQN2HOehxQ=; b=VZTMs2GtgQxE97qYAWNWMTDvcpNyDO2L7PMItPpuGoElRmvzU8GHR6PV8Gt6Ombexj WvcestclW5zBU7VpnziDnjfrQKb8/wher78uqmvXAVaDGzB83tNy59SRpa+dRO1eEgip YeoxIV/6ftk4FhEcU9TRc1eJ/Rmr8wdxyJOzy815acDytInouEj4LMmwMk+oi1r4vl/b CHYxeC3iuY737XoemWqYKWrOT8nSoNFHgZXIvEJ9e5ljARSvrdY9t9t3udtmWMp/guj1 t+hXAkQMmtrAoMtI6N6HMOMLXFawYxR5MCVuxawcxd89lk4vozdtywD1WJE082ASuMRD r0fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785697566; x=1786302366; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Kw69Z0wzWemMAZPaY5Skc4txf5IJBcX28PQN2HOehxQ=; b=NVniMEgQBUf1cpgjcU+pLF1B+bV0AzOacPHmvVr6uyhCR1049We1voIcQya64Gxevd JOVorX0QlfdvsNuT7WOXyydQz663IJsY1Sc6p+wkWhCX+LCpYNbfl0FO9PbudOhTy9T3 wcEuXkGFsbqxPz2kdE4nJ6AKc9PwIB8yRV3zstZ9L52VkpqaX/9ei9qdrKd/DRRJXBCp JXSUs/aNXIBdGBI/LzrmAGPZ/N93m436pe7I1tz2o+7qyNqyLd2J5OWWmbqD+nf79cHf ToD0KJBPFbVjREJhc9n9T9X+4xNsDLfPxBL5PPmnaF6O7NTxpldbEQCiapKjX5dJffZ7 0eLg== X-Forwarded-Encrypted: i=1; AHgh+RoMD722Kzx8+3xthGOWcmZayiN5b4IrZRrsgYZ9Ro6eEzfb5naugBzi/5AZRFusDryMUAxiEJz/rj5lsFg=@vger.kernel.org X-Gm-Message-State: AOJu0Yzbt16umo229ZIWGkzlDzGKT57p6YsW2UO4JtD6o6Knwx7JnUhC DmQ1TmzZQOKp0O1JZ6Cu1ypTdfhDH5jdH+WWu/iICLrUni8eMgFGSbw0bMcuu01Ge3E= X-Gm-Gg: AR+sD100LStbikoEZ0EekC5gbfsTsYDlw2ogMY1SNCV349NgqdBxuW/YKoM2yqf7M4N EBS9bfbtYE6F0iccNhgBtK8/9Rj4Xe5tiURlYcy5AOtA2WnSYzqdEgsJEGNirlS+6zsb1zNbiLm +9M8kY1LS40Yt9F2PmfFe6VazPoSQcLfDRxIqtdr0m3r7Po+rVgMNdmuSjG1NJqC1neemTxZ2cz HsshD7ulhTfCg8x3euEtHctnEt7E5Maf0OX0b3cwLhW0wmo/vFJOwvRGxgdA7BUEiG2LV8EH+T3 2dyHerVt0JViMRhRwKAzVnH/eqNi0lIjXHnuQlcBonG2ZQ3oh/5Co3NoKitPP4NCyzCWcKuNwwe aMhtMfZIifDG0h8fX3AfARmyDRxNk5ajM8JlPo103JSNJPi8kWDZ45LNpd8jG4Xsu+E32ERo6pL PTQ0xW4+52rQEL9AfaB/0HBuCHKo2xEFn3YMGKRWdsG89je0sOECIJ4QPtM6YdGZnH3cWXPp2YA ndKDB9JcLVB2/7ilYIJ4pZ3gT3sD/1+UsG+Pwc= X-Received: by 2002:a05:6808:2384:b0:4a4:da68:9434 with SMTP id 5614622812f47-4af5e329152mr11191023b6e.14.1785697561734; Sun, 02 Aug 2026 12:06:01 -0700 (PDT) Received: from ?IPV6:2600:8803:e7e4:500:5487:2b6e:1057:d3d3? ([2600:8803:e7e4:500:5487:2b6e:1057:d3d3]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4af58d13152sm5530140b6e.6.2026.08.02.12.05.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Aug 2026 12:06:00 -0700 (PDT) Message-ID: <3562a294-d74f-4a03-839d-c861df604914@baylibre.com> Date: Sun, 2 Aug 2026 14:05:58 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/3] iio: adc: ti-ads112c14: add continuous mode support To: Jonathan Cameron Cc: =?UTF-8?Q?Nuno_S=C3=A1?= , Andy Shevchenko , Chris Hall , Patrick Edwards , Kurt Borja , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260731-iio-adc-ti-ads112c14-continuous-mode-v2-0-eb13da38e8fc@baylibre.com> <20260731-iio-adc-ti-ads112c14-continuous-mode-v2-3-eb13da38e8fc@baylibre.com> <20260802191753.2c98d7bb@jic23-huawei> Content-Language: en-US From: David Lechner In-Reply-To: <20260802191753.2c98d7bb@jic23-huawei> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 8/2/26 1:17 PM, Jonathan Cameron wrote: > On Fri, 31 Jul 2026 18:48:12 -0500 > "David Lechner (TI)" wrote: > >> Add support for continuous mode in the TI ADS112C14 ADC driver. In this >> mode the ADC itself is starting each conversion, so we add a trigger >> based on the DRDY interrupt to read each sample. This mode is also >> limited in that only one channel can be enabled at a time since the >> chip does not have a sequencer or simultaneous sampling capability. >> Continuous mode will only be used when this new trigger is the current >> trigger. >> >> Signed-off-by: David Lechner (TI) > There is some follow on stuff in here from the earlier suggestion to > check the status register even when datardy involved > >> --- >> drivers/iio/adc/ti-ads112c14.c | 146 ++++++++++++++++++++++++++++++++++++++++- >> 1 file changed, 144 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/iio/adc/ti-ads112c14.c b/drivers/iio/adc/ti-ads112c14.c >> index c6d83298c312..5147d10785fb 100644 >> --- a/drivers/iio/adc/ti-ads112c14.c >> +++ b/drivers/iio/adc/ti-ads112c14.c >> @@ -9,6 +9,7 @@ >> */ >> >> #include >> +#include >> #include >> #include >> #include >> @@ -18,6 +19,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -257,6 +259,7 @@ struct ads112c14_measurement { >> struct ads112c14_data { >> const struct ads112c14_chip_info *chip_info; >> struct regmap *regmap; >> + struct iio_trigger *drdy_trig; >> /* Synchronizes access to register value fields. */ >> struct mutex lock; >> int drdy_irq; >> @@ -280,11 +283,32 @@ static irqreturn_t ads112c14_drdy_irq_handler(int irq, void *private) >> struct iio_dev *indio_dev = private; >> struct ads112c14_data *data = iio_priv(indio_dev); >> >> - complete(&data->drdy_completion); >> + if (indio_dev->trig && iio_trigger_using_own(indio_dev)) >> + iio_trigger_poll(data->drdy_trig); > > Even for this path we should be checking it wasn't a spurious interrupt. > If that's happening in a threaded interrupt we'll then call iio_trigger_poll_nested() > and the handler will happen in the interrupt thread. So the overhead > of that check should just be the check. > For now, I think we'll not bother with checking for spurious interrupts. The only reason it should happen is electrical noise (or disconnecting wires on a live system). And we can add it in a follow up patch if we decide we need it. The overhead of an extra read for each sample might be a bit much at the higher sample rates. So we'll want to implement the higher sample rates first anyway. We can read the status along with the data in a single transfer, so that might be a more efficient way to do it too.