From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (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 1DD5823BCF3 for ; Wed, 4 Feb 2026 01:07:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770167261; cv=none; b=EX8NC+E24K2GXObarvpi2atZCWw/Lvi8+vu2zWUPR5uMsDpYN1FiQt3dhe4z8RoFZv++n/8y8ztg2QVlRYnxAu6ODm+SQFT01/vsPmuwFtMa5tFGoQ/sQ0HyDhwikNeTGt7WQgWayShaCxzP0VQGxwWeGlLYZHMexTAhIhJM+X0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770167261; c=relaxed/simple; bh=xxI7mec5UdoUZoAC5zkWDSuIBrjfjO5eDLJux1jswbU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QiEYrNIiDcqNTNbbHD+Y/PYwvDnXesRDo2hGnv0BV3Bq6HrLjPv7RlRbo8aLwRZoRPyQPQ51eDNL3tt6zY6kC/dw6bHPRBy+2Zkotg2xBKx+GmFpwwUsTQAyDLu4Usup5PMLlFFCvjAcPukVtxLZHDkPfnhKMusx75/oWoLk3rg= 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.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=BK9hABpL; arc=none smtp.client-ip=209.85.210.48 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.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="BK9hABpL" Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-7cfdf0c8908so174920a34.0 for ; Tue, 03 Feb 2026 17:07:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1770167257; x=1770772057; darn=vger.kernel.org; h=content-transfer-encoding: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; bh=OuTrkpMdL03xgpmcCJA+pWmGpQI6ZJtw88w/yKt/MXE=; b=BK9hABpL0c36B50QSeP0GXmDvbU/4GXTopIzK0na4zc8CwlaRATr/F2wn3q3qfQjay 72ZvenxCI+/hwSrd/7O05Th4USH8ONpW3yum6Gz6b0bkHrXzMT0Jkw3EmPjvyw+vq+ZK GvSPCESO/O4HLifm3JT6L74VzRoGtwRxbG6ypjNI9BTO1cRPbeJR6bMHMVatyjBfNfmM +fX6Q7aCuISrJyV3AKPforvCXeX8dNkd+jG023s3F8NXdyy5ed5pxHSb60wgrUVHpW91 EJE00qfPi3hE9DgsRqW8NUzxE7DAWpU1RtMDVZJmSLtkWkewdO4escvIwrwo81DECu13 Slfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770167257; x=1770772057; h=content-transfer-encoding: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; bh=OuTrkpMdL03xgpmcCJA+pWmGpQI6ZJtw88w/yKt/MXE=; b=Jv7BtNUC4XGRLf7Wra+DpNDUO760DB4RjH2Ksbm1eCx9Yln5UMLILxMTQ+7XT7IY7A 4G4QSKHrLl1gs2pxngIJy91iNWMkntQ3nUBOy3yx+JWjIqReXkY0m9te/TrTv21b1BIC +YoEWyey5ZEtJajxwyYoKA0wpRxrPUgoI2vR2S3RgUm4iZemcZNXNDvTbHRclf7ZUGBS mzUozxz/XyIIbHgHcCt6CfljadzQ81VrTvGI3DlTgo7NievaX7B8t0ILfrATy1duAeJY fKK/SYEtArl1VWs55oNDt13g0Ry0cad5JetglIMUol7z/bD8KguPZnvzVT2Vb0+7GYP9 jIeQ== X-Forwarded-Encrypted: i=1; AJvYcCW3oMKmislI6lygHgtdHGegCrnmsL+dMRpI46WehJV4bmgVp32sOoZcA+155zbYvwU3yjKI+BWCrH0Xle4=@vger.kernel.org X-Gm-Message-State: AOJu0YxwqQqxYHNVQGdna600tMZOPif5H1tf2gRCYX9J5BlZqHj0gG8i QShzRbnY5JGeYRc1f44QdxNM+Tnz9qHUm1KBp2piEYaG82IDRxxd03py4afk+ve9dEo= X-Gm-Gg: AZuq6aLxGoLzv63Zikij45Tf45ZMpTGl4c0hqYz1em4kLpZZ+GZslKoHVl7rGsPMz/9 HXJgE2iHD5HqcZFo1o2VuV3NI/a7+R0ohiPf3J2+QFUDGdNwtp33t42b9sCdTW5yqmSqA1dmT0M WvoNS9BItzdrxZGI6afklDeO24qQ06vnA6yOKCZHmbZ+tMmMuMTSSXwloyt/RwhqfB5MJbY1SB5 rlj0X2MIr/ipdejX5fRXG8jrcSipJRVttrZjxXfuk+NhMuEjGVq1ra7zNrRRR0VVJ2XtHulXXbM UtubUmfW3t5H/NS47vye1uh3jl+22Hn4h8QliMVFzvcap8iOB79Y+gdJRqJ8rw64SsKqC6HIFtQ kPnYJMPq1q0LFG9N5iQuTTakth2I4hgADup4cviKN6+i8dyADeQ/RCZFXySiXsdEhgnQcbcsWm1 q62yYmwYfXthi2FicBXkY93QQmCT+7wfEonmExJpcR5qFLFnrJVHMPnfo= X-Received: by 2002:a05:6830:369b:b0:7c7:6558:277a with SMTP id 46e09a7af769-7d4489af503mr905338a34.15.1770167257360; Tue, 03 Feb 2026 17:07:37 -0800 (PST) Received: from ?IPV6:2600:8803:e7e4:500:8e13:880:992:e796? ([2600:8803:e7e4:500:8e13:880:992:e796]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7d449113d34sm806042a34.9.2026.02.03.17.07.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Feb 2026 17:07:36 -0800 (PST) Message-ID: Date: Tue, 3 Feb 2026 19:07:35 -0600 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 v5 1/4] iio: industrialio-backend: support backend capabilities To: Tomas Melin , =?UTF-8?Q?Nuno_S=C3=A1?= , Michael Hennerich , Nuno Sa , Lars-Peter Clausen , Jonathan Cameron , Andy Shevchenko , Olivier Moysan Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260130-b4-ad9467-optional-backend-v5-0-7da803ba7326@vaisala.com> <20260130-b4-ad9467-optional-backend-v5-1-7da803ba7326@vaisala.com> <688cbfb1-0944-492a-929d-91ebb9ab22fb@baylibre.com> <812a8c408c2e3a87ebe1ddc983acdc2cebe3b36b.camel@gmail.com> <30cf63eb-50ba-445d-a78b-d6532aacdc8e@vaisala.com> <177d62446d9c2098bbfe8b0f7fd9418d5afb60fc.camel@gmail.com> <215cabfd-497b-4f22-ace2-ff8f6145d79f@baylibre.com> Content-Language: en-US From: David Lechner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 2/3/26 3:50 AM, Tomas Melin wrote: > Hi, > > On 02/02/2026 17:50, David Lechner wrote: >> On 2/2/26 7:04 AM, Tomas Melin wrote: >>> Hi, >>> >>> On 02/02/2026 14:40, Nuno Sá wrote: >>>> On Mon, 2026-02-02 at 13:08 +0200, Tomas Melin wrote: >>>>> Hi, >>>>> >>>>> On 02/02/2026 12:28, Nuno Sá wrote: >>>>>> On Sat, 2026-01-31 at 14:30 -0600, David Lechner wrote: >>>>> >>>>>>> >>>>>>> Do we actually need this one? Alternative could be, for example: >>>>>>> >>>>>>> int iio_backend_enable(struct iio_backend *back) >>>>>>> { >>>>>>> int ret; >>>>>>> >>>>>>> ret = iio_backend_op_call(back, enable); >>>>>>> >>>>>>> return ret == -EOPNOTSUPP ? 0 : ret; >>>>>>> } >>>>>> >>>>>> I would prefer not to assume we can ignore the backend not supporting >>>>>> the call. It opens up the question for other operations. >>>>>> >>>>>> My preferred way for this kind of fundamental operation (enabling/disabling) >>>>>> would be to check with DT maintainers if we could have some kind of fixed-backend >>>>>> (fixed in the sense the HW is present but not controlled by Linux) dummy device that >>>>>> with implement a no-OP enable/disable(). >>>>> >>>>> There is also use cases for the always_on cap with a configurable >>>>> non-dummy backend. Some applications are such that the driver should >>>>> leave the enabling/disabling up to the user space consuming the data. >>>>> For this case it's great to have the frontend leave the backend enable >>>>> alone using this capability. >>>>> >>>> >>>> I would argue the above would be something to take care at the frontend level. The way >>>> I see it, the always_on cap is pretty much saying that we can't really control the on/off state >>>> of the backing device and we just assume it's on.  >>>> >>>> If we can control it but we need it always on (for some specific usecase), I would say that should >>>> be handled at the frontend and just enable the backend once. Also note that as of now, I think all >>>> of the users (or most at least) we have just enable the backend during probe and leave it on until >>>> we unbind the device. >>> >>> Yes, this is debatable. It's not necessarily always on, but should not >>> be enabled/touched by the frontend during probe. >>> But anyways, having a capability that says if the enable/disable feature >>> is available, is in any case useful and what I was planning on >>> leveraging in my use case. >>> Fundamentally, with the capabilites as now proposed, it is possible to >>> select what features of the ad9467 are available, in addition to the >>> basic requirements. >>> >>> The ALWAYS_ON capability could be inverted, like CAP_HAS_ENABLE_DISABLE, >>> but to me, the ALWAYS_ON naming still seems the better option. >>> >> >> Ah, this is what Jonathan mentioned before about this really being a >> restriction rather than a capability. >> >> Perhaps we should have a separate restrictions/quirks flag? If the flag >> means "do not enable during probe" then a better name would be >> *_DO_NOT_ENABLE_AT_PROBE. >> >> And I agree with Nuno that if the backend can be enabled/disabled later >> (after probe), it should still be managed through the frontend driver. >> There should be no usespace access directly to the backend without going >> through the frontend. > > Thanks for the input, that use case is slightly different from normal > usage, let's keep it in mind if actually required. For now, the option > to just leave the enable/disable alone is what would help to solve > smooth integration with this device for me. > > ALWAYS_ON does not seem to get much votes here, but how about calling it > something like IIO_BACKEND_CAP_AUTO_ENABLE or > IIO_BACKEND_CAP_HAS_ENABLE_DISABLE? > IIO_BACKEND_CAP_HAS_ENABLE_DISABLE seems the most sensible given the way it is used in the ad9467 patch. Although IIO_BACKEND_CAP_ENABLE_DISABLE would be more consistent with the other flags being added since they don't say _HAS_. Probably IIO_BACKEND_CAP_ENABLE is enough to imply both if we want to keep it shorter.