From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.169 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796227300; b=gLOmrA+hzKAypVwwnoo8rnt8UuBfhzHLNejtxBvVEIMhG748A6MIFi+2/ThOWJCV0TSB J3/vwyhUKN++OEAGGSxPcw5yZOgvboC/TNp0g+dodWFJN4dechKEz6dp9QNRQonGx8/GF /97P9BA6hkGdvMiId4z9B2lz9GRrOnRUql0pDFLcEAWHqVYC15xbx4HmPv0Ky7dOsKa8L BoPto/pkzDCshOHmg1xpOWSRRHYZ1EAuqmA2PxP97usvdbfPjKKhQHHmzrAagKpyWkKxI G7KI6OKNP3+dlTojMLIfMdwxxyeA/bzzrK6uHYbzpbLaFNZL6R3KZs9gsL2Iekfs2AA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796227300; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=RSXAZCGO7OyHJuGMZFGCklZHvMn8Jm6nkBFRR3WTaz4=; b=YSXzAl43n42fPCZ0ygMSLiC8piiTm8jrgkCSCFf1FY06XAv372571Q9Ko+ZOztSSe9s0 tHZSO0dcURLjJ2StkR1k+iqlVx1aH6Kmqg1FZap3JhkMgAujVdYOqidTjwTDCF3Wemi+2 vMrJQsgqKruOe9KpcQz4aYtH1gAzhXNrT87dV6ZUKwxX9ZS7vIEGz/Gx9a07KwximA5dE eQ7tc6b7YL55ifl54wdmroqWrGu39PESuItnVYxCBuZKtuCn8zEeJ5FLFd+AgJT26JbLR XiZKFkzdbn1Hh+vMvCv2y1invX94DRCIRDa5/+REdfy60G6y3ofZc2g5ym8kK4PtxHA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=UM328Npk; arc=none smtp.remote-ip=209.85.208.169 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F20CE606A31A for ; Wed, 2 Dec 2026 16:01:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F20CE606A31A 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=UM328Npk Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-3ae6a0ffb55so130570841fa.2 for ; Wed, 02 Dec 2026 08:01:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796227298; x=1796832098; 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=RSXAZCGO7OyHJuGMZFGCklZHvMn8Jm6nkBFRR3WTaz4=; b=UM328Npk20QYSC/AKymQLVlqx22pBxdFsu7Fp+L9RltIgtAK/jDulXihDzDZxbQ6zZ X4LxKL2FzTlVqEpMEAhiPUi/a4yUNjKSvKqXbeYsiDbfCMrQp1dLMp72rX0Jf+PBnS3t 4Ap5j/dAfzm2AB37o01x4OehOc3Y6xiT8bjqa/jl4ZhA9pzpW3wTBGqu0rt6H5nWKNe2 CcAsAD3bKejklLuieyiJ8rthzbgc9S5sbdrKyOTy5Cz80wsExJ+p5IV7xt1jOU07DoWj 2P7zUhd2ax+ZLJYctqeJA5IoZcvi2No6YU48FLIVZW1wnUtSW4hvXk5bYNNf+d/aMBpb zpWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796227298; x=1796832098; 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=RSXAZCGO7OyHJuGMZFGCklZHvMn8Jm6nkBFRR3WTaz4=; b=u7/i65YgUOT07P/xcsB4kzCUsaPbQb2O61jL+6OKnc4JOti4zGpL5duChWQcDuStat pwpJRLJ7jE3hqsStqisnJyUSrnF+m3ag0IrLbfyFEO1DnQNeBlOat8SJ/1zws5UKieYv 0M/nqKphOO3LtdNVgx8ijOvgexjedQGV3ubbb+xnyPBblBO8g4DpD4266SooIXC5Cz7G w6/Jw1+1shR/khpKb3OwEDLc9CxteJOSZ5cf2Bbj3QNCSo1oZyfvFjS4sUQEFNYFrCgG gFyLfSBHTZINZnv9nT1vbgnmGvADTxG1fw0Kze6sVPuqOuwMOA+x1x6KsHxcldEfvhA4 87RA== X-Forwarded-Encrypted: i=1; AL+hErE2dha2zoHLbFS7+EkKkr/0ANCRTvW/EWmmy7wxIGbjIlybFZs2DTRiu/pC8HtY96AXpbW3KvceaV4=@vger.kernel.org X-Gm-Message-State: APuU4Z9ozp7AzRUrB5M5hQlaNcb4OE6w1FEqlYotHMvIilTDNLVEXfvV ROd6E7uRcZT2jIOJzaK/OPBGw+IsIxYKp+DeYADyWKG5Gb4Y+Gf8FPFlmtHDV8NI X-Gm-Gg: AZFdTZfB+Pnb9BkFuYV/JFQfDQl5FrRFGdZZaie0ZbdSyJyex4omZ4IHD9Pm2j+H7NV 4TmcPVnsn7gr3Wr3W25GXkFzIEm09tSxGuTvMCIAJ6+iNqsa7JbZNJ5tuOF5vnwgbwHILbunQla LaaJOQ3Ln2MEOVSAY6axmXA1JDLtb/IP3xP/uC+/VoZafUbFg6oRPsln3Z0zwuNwU9EQKWYyoFY 4x3cbx9stZ/vsWKWW8OezuIcu6KWlXdHrPZFBA9akAaiqMaRPSUz1JMpTzXxP5Kpj3+6gPxjMdi iMQSAuq6Ft6N0PGwc7cu7qJAga750wRnNqwzU98RutBQ6lhKVTP4Qx5D44lf4cCN5DZSm+40hSQ rGdvqlzskpTYEyByzWXCYLExlP0ZWs/80OHw1iim4GYHeOWYfhxuWvMYCLo+hR7/Y5T3R5p5KWE hjp+Qm0g9tbE0MlsB3jLr9X9ipIljt1vTYjfIOKC6nKn4bAe4qRTLh/ygtxyIuttQY9jrjJWSq/ 78Ty0emFiUymRZ3tgvb2GCSUXB7TstKUPcMh04a/aa5QxUBpaPDHL2d0+0PE8wxYcm+q8IGkLF5 W/29/5W2LtMPc7ymkFfFLmvAXaY3xfNIDml+DhPCHyka5rEhAUaGDq6j9SwKu9i2F48gHQFWM0S yQsFu12Fx X-Received: by 2002:a2e:be25:0:b0:3ac:45df:83e0 with SMTP id 38308e7fff4ca-3ae7f9f6478mr122389791fa.17.1796227297795; Wed, 02 Dec 2026 08:01:37 -0800 (PST) Received: from ?IPV6:2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703? ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3ae8055a9c9sm97119941fa.35.2026.12.02.08.01.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2026 08:01:37 -0800 (PST) Message-ID: Date: Wed, 2 Dec 2026 18:01:35 +0200 X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 16/25] iio: pressure: rohm-bm1390: only return IRQ_NONE if data ready is not set To: Jonathan Cameron Cc: David Lechner , =?UTF-8?Q?Nuno_S=C3=A1?= , Andy Shevchenko , Tomislav Denis , Matt Ranostay , Abhash Jha , Petre Rodan , =?UTF-8?Q?M=C3=A5rten_Lindahl?= , Dan Murphy , Sean Nyekjaer , Tomas Melin , Michael Hennerich , Lars-Peter Clausen , Leonard Crestez , Peter Meerwald-Stadler , Neil Armstrong , Dixit Parmar , Stepan Ionichev , Srinivas Pandruvada , Joachim Eastwood , Tiberiu Breana , Maxwell Doose , Tomasz Duszynski , Alison Schofield , Christian Eggers , Andreas Klinger , linux-iio@vger.kernel.org, linux@analog.com, Jonathan Cameron References: <20261129-messing-fixes3323-v1-0-f01aa73aa628@oss.qualcomm.com> <20261129-messing-fixes3323-v1-16-f01aa73aa628@oss.qualcomm.com> <6d2e75b8-2711-4144-911b-82a10751a08e@gmail.com> <20261130234510.35cb704c@jic23-hlaptop> Content-Language: en-US, en-AU, en-GB, en-BW From: Matti Vaittinen In-Reply-To: <20261130234510.35cb704c@jic23-hlaptop> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 01/12/2026 01:45, Jonathan Cameron wrote: > On Mon, 30 Nov 2026 13:03:23 +0200 > Matti Vaittinen wrote: > >> On 29/11/2026 23:06, Jonathan Cameron wrote: >>> From: Jonathan Cameron >>> >>> bm1390_handle_trigger() returns false both when the status register >>> shows that data ready is not set and when reading the status or the >>> pressure fails. bm1390_trigger_handler() then always calls >>> iio_trigger_notify_done() but returns IRQ_RETVAL() of that result, so a >>> read error is reported as IRQ_NONE even though the trigger was handled >>> and notified. >>> >>> Only return false from bm1390_handle_trigger() when data ready is not >>> set, treating read errors as handled, >> >> I don't like this because, if we have a permanent error on >> bus/controller preventing the read, then the IRQ is not acked from the >> sensor. This is specifically why the code returned IRQ_NONE if read failed. >> >> With the IRQ_NONE, the "IRQ storm" resulting from un-acked IRQs will >> trigger the 'safety mechanism' disabling the IRQ from the host side. On >> single processor systems (which are admittably getting rare), this can >> be the difference between completely unresponsive, not debuggable >> device, and a device which hangs for a while, and then spits the >> "disabling IRQx nobody cared" print which is a strong hint regarding >> what's going on. > > I fully agree with the argument for a general interrupt, but these > aren't real interrupts - those are on the trigger side of the > trigger /pollfunc divide. Ah, right! I only now see this! (Dangnabbit, after I already wrote all the other replies in this post - need to go edit them) Maybe we can move the status-reading in bm1390_irq_thread_handler(), inside the if (data->trigger_enabled)? Perhaps we should also store the status in the driver data before calling the iio_trigger_poll_nested(). So, the trigger handler could then read the status if it was not read by the trigger. This part should not be deciding if we have > an interrupt but should be acting on that interrupt. The trigger > side should figure out if there is one to handle. Blocking that > real interrupt is the ideal outcome of the spurious IRQ detection > code. > > I understand that divide gets tricky in some devices where the act > of reading the status register is required prior to a read because > otherwise we don't get fresh data. > > I'm not sure if that change is possible here or not. Not sure either :) I did dig out my old questions I sent to the HQ, and answers I received. Judging these, the status register reading will ACK the data-ready interrupt (which is a level IRQ, so acking is required). It was not explicitly said if new sample(s) are accepted while data-ready IRQ stays active. The data-sheet however says that the data-ready should be used as an indication, that there is new temperature and pressure data available. Furthermore, reading the status register does NOT clear the FIFO_FULL or WATERMARK IRQs. Those are cleared when samples are read and actual fifo state changes. > The self triggered case looks simple as it's either side of a function > call. This is probably the only case I thought of when writing the driver. I have no idea if/how people are using this driver though. Anyways, I need to admit I am not familiar with how things look when one is using some other trigger. Never worked with such setup, so it's a bit hard for me to picture. As a hindsight, I should probably have restricted this to own trigger as it was the only trigger I ever really tested. > For the case where we are using a different trigger I'm not sure > why we have the status check. Is it required to get valid data, or My understanding is that the data, after it has been sampled, can be read without reading the status-register first. The data-sheet is not explicit on this though. Anyways, if we don't read the status, we don't actually know if the sampling had been done and if we had valid data in registers. So yes, it is kind of required. > is it to try and ensure fresh data (which we don't guarantee at all > if using a random trigger). I don't know if new data is sampled if data-ready is not acked. There is no explicit information in data-sheet. It says that the data should be read using burst-read to ensure it does not get partially overwritten - but I don't know if this assumes the status has been read before data. >>> as was already the case for a >>> failed temperature read. >> >> I believe that reading the temperature does not have similar "acking" >> functionality. >> >>> In bm1390_trigger_handler() return IRQ_NONE >>> without notifying the trigger in that case, and otherwise notify it and >>> return IRQ_HANDLED. >> >> I have a feeling that notifying was needed, so that the IIO handler >> propagates the next IRQ to the driver's handler - which can then (in >> case of a failing to ACK again due to a read error), return another >> IRQ_NONE. This is paramount for the above mentioned "safety IRQ >> disabling" to take a place. > > This is the tricky corner that I mention in reply to the cover letter. > I'm not sure if we should just always call iio_trigger_notify_done() > for this style of driver (one where it is expected to be called in > the interrupt handler). We can't do that in general because > there are a few drivers where that action be delayed to an entirely > different place in the code. A few series in my tree after this one > comes a patch that flags those less common cases and that allows us > to drop the need for explicit iio_trigger_notify_done() in vast majority > of drivers (with big knock on effects on code simplicity). > > To me it does feel wrong to say we are done with a trigger when we haven't > done anything, but we do potentially end up wedged otherwise. Maybe > we can figure out a recovery path from that wedging but it is going > to be nasty code to handle an unlikely event. If the bus to device is failing, then the only workaround I can think of is disabling the host-side IRQ. This would be duplicating the IRQ_NONE 'safety logic' in IRQ core. Furthermore, if someone used shared IRQs, then individual driver doing the disabling would really be stepping on someone elses toes :) I'd rather kept this kind of decisions in the IRQ core level. But yes - you're right that in this driver, the IRQ_NONE should be returned from the bm1390_irq_thread_handler() ! >> >> It is entirely possible I don't see something, the trigger stuff is not >> simple (to me). :) If so, please bear with me and explain. >> > > Entirely valid questions! This was the bit of this series I least > liked. Ultimately we can separate IRQ_NONE from whether we call > iio_trigger_notify_done() To me this sounds like it could be the right thing to do. Not sure how that should be done though. :) > but we do need consistency to enable > wider cleanup. This is something you have far better understanding :) I have some (very simple and limited) automated test set which is testing the driver on a bm1390 attached to beaglebone, when new Linux release (or tag from next) is done. Right now I can't offer much time for bm1390 development - but I can at least run some basic test set on patched kernel if needed. Not sure how beneficial it ends up being though. The test set does not have anything to catch error scenarios like an IRQ storm, but is mostly limited to measuring pressure/temperature (in very constant environment) and checking the values look somehow sane... I will, however, add this to my (endless) TODO-list. Just please, don't hold your breath waiting - we need you as the IIO maintainer (amongst other things), so some level of oxygen should be guaranteed XD Yours, -- Matti -- Matti Vaittinen Linux kernel developer at ROHM Semiconductor Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~