From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 2A67726FD84 for ; Tue, 14 Oct 2025 15:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760456748; cv=none; b=vA/LEWaHcaX4TyuFEQvmKdDCWliLuvkRV7obVn/Ic+fIarEBfEKAlb3cMcjVIpar+jI09oiJkA42PST9+aR9quL5k1mnY234PjEEmaccgiD6sb9VZSrFlRkS2SV1tlTXCQ1RNyZWb3TvYH9AeXoIgGdKMJQoDYboL+wS3UQKn+0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760456748; c=relaxed/simple; bh=OPz3JuKsyfEcF7SC28N8BYvQpMOG9+ol+aHvjOGIupM=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=bbzSNFMdyNAOx050BQCUeOL0vmiQ8GL6wLuyV/7Yp815Ljyu6jUkCp+hrWdNo1n7W74VVwEKtXdO9lgFJil9iR4d/I/PRJKCunwg5T/GUCDquiiT3l+Dveu9l4mGZYPId3mToN3kS56Gr6nUaX80iU+7bLRYYWp+zjHbSa+MLbM= 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=e4KQI2kf; arc=none smtp.client-ip=209.85.221.53 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.b="e4KQI2kf" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3ee15505cdeso20648f8f.0 for ; Tue, 14 Oct 2025 08:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760456744; x=1761061544; 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=EuF1h8YvamKDXiEUG/ydx08kAUyXwsN7QyehT348oZQ=; b=e4KQI2kfRTFKK2gbKkqkfd2oV/6shil0yLFLNenJOMxMOupKifG9x8qDOYSVEDgs16 COdLDfVzvXugntASKg1lambfzpmb9GL7KtdHpa7bIinzBFuO1Xb1NwV5gfyYHXS0C+0G Bd+h3mqQJRv69JwJcalxQNgRtYlxo06QeiySLvShb2nQ6uSfjGd++oZCiAqWv2c6YH9j J6FUP5mfxa1i86WKwUtnQ5wZu/80P1/Ydo+petAAT0WGagwAi/crhGkfYekuZeQdXAK4 BDzUJkX4kwOkue4iEwuTNvKcKsayp+P4169VprDBVNya2PyMzz6jo5uvG45nVu2ftw7i NeNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760456744; x=1761061544; 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=EuF1h8YvamKDXiEUG/ydx08kAUyXwsN7QyehT348oZQ=; b=IayF2TustX91j3B4a6vvAZ+rmhu/RkvlnCy7gPU5+EXevbqsE9qSGFpDCVkdQSFNA+ dJmLqVOaOeBEk4S8QlqBaJe9iKM4wXBajXSFF4uoze8JUUgdI7gxGCk7fEuZSqEa+vF8 tZQEUQemIieDogiQ6Bpf5LwKmwjdYKWmjv6iGw4zHO2gGvCuAkTEDo8KD1LtG0B/4wJA 29EFR2cTbjMvzF0pU82nPg6MMIScYQbFwmxYRbBbGCWjKDlW7y5lHjdPRSZ7rkSyCYaP OzKZZMFUZqqcQO+D0FGB9JpdrHGbqAZFmNWBAxPelcu6B7oUo477796XAJDCUEz4Boep 1r6Q== X-Forwarded-Encrypted: i=1; AJvYcCXZxFE31tBkJY2t2/utLCpCypLj8z22OOZDz63wXy/dP0unnDuaIgDOkYbwInKHqZK+40iX1/CIHKMkH+o=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8ESxG623jDRjl2vWvKW/6ANoHN1SAMgHzDc9h/9m5RXHhbQlX ytvkPhzJpxAja96efnsirjUEve6/2CWr9ZeutmbUUWKynh8q4OANLs0w X-Gm-Gg: ASbGncv7H/56i97tdJhvuyT8LhvR3UwXdQp6O8DanPh83N7SrnYXkM+O9YXZVKYe4Xx O9/c2Pc8He9mOp+6E4mx3jk1BuRWyYi2QfFj3oibOG+j/4iM8yLiJhPrb4QScqfdxvTHLjvW/3S EB73ts7VBpez7973jXiQXBtCHg6c0G/OeBryKR19Mfk4oerTkHIlSBJJrdKi8V+JmJ6W2QZQoaE sjFDQasaJeuECgLGq9DQUDqVjg4GSdk3t6Gtj5o76XLelKvtSL4+m1UeB0SQh83/5X4KePo3MmP PlawsxecT3gYMCGPqEgO+loB9N3fRlGv5ExXVTkvnK5LtMiHK9d7t0QacaSjIAeqpfC986C9nFI tgrEER2r5IGeX7vQV9C1sprzbEUiZrYAJlCpqHKIYHsMGkJ6pO0z89IMqedw3 X-Google-Smtp-Source: AGHT+IGge3yzZz+zKCw2B+VbIVIqsMB8NMcC/S2UhLzXj3IfB0k9KNiL94NqaGNP36Y5hV6zVPOKPA== X-Received: by 2002:a05:6000:4028:b0:414:c2e8:a739 with SMTP id ffacd0b85a97d-4266e7d64a6mr18739753f8f.31.1760456744191; Tue, 14 Oct 2025 08:45:44 -0700 (PDT) Received: from [192.168.1.187] ([161.230.67.253]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce57d3desm24341014f8f.7.2025.10.14.08.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 08:45:43 -0700 (PDT) Message-ID: <51dab5dee00b95018c8bc6b7ef56b9b722d618f3.camel@gmail.com> Subject: Re: [PATCH] pwm: Declare waveform stubs for when PWM is not reachable From: Nuno =?ISO-8859-1?Q?S=E1?= To: Marcelo Schmitt Cc: Uwe =?ISO-8859-1?Q?Kleine-K=F6nig?= , Marcelo Schmitt , linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, jic23@kernel.org, kernel test robot , Trevor Gamblin , Axel Haslam , dlechner@baylibre.com Date: Tue, 14 Oct 2025 16:46:16 +0100 In-Reply-To: References: <1ac0fc529e02744aacfcb9140ed597ff60886f39.1759873890.git.marcelo.schmitt@analog.com> <6v4hny7hxjsdf6zvinhpagtbhluxbd6psq7wpx5ls6zdbnjtym@lnygnkav4ewk> <2e82eaf275b5c8df768c8b842167c3562991e50c.camel@gmail.com> <04eb5b1ccc0268ff7e9b88835203771886c5ee25.camel@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2025-10-10 at 17:37 -0300, Marcelo Schmitt wrote: > ... > > > >=20 > > > > I did not tested but I also wonder if 'imply SPI_OFFLOAD_TRIGGER_PW= M' is > > > > not > > > > similar to the above. > > >=20 > > > It works, and I'll update the IIO patch to have > > > select SPI_OFFLOAD > > > imply PWM > > > imply SPI_OFFLOAD_TRIGGER_PWM > > > in Kconfig. The PWM imply is because I think SPI offload support meet= s the > > > "highly desirable feature" criterion mentioned by kbuild doc [1]. > >=20 > > With imply we then need to take care either using stubs (which seems no= t to > > be an > > option) or with preprocessor conditions in your driver. As discussed in= the > > other > > thread I would just select SPI_OFFLOAD. Basically I would: > >=20 > > select SPI_OFFLOAD > > select SPI_OFFLOAD_TRIGGER_PWM > > depends on PWM >=20 > Yeah, depending on PWM is what I was trying to avoid because the ADC can = be > used > without PWM. Doing the above is the easiest solution - depend on everythi= ng, > select everything. Though, I guess I'm technically not keeping backwards > compatibility if I add a new dependency to the driver. >=20 > IIO_BUFFER_DMA and IIO_BUFFER_DMAENGINE are part of IIO subsystem so okay= to > select them? Otherwise, yeah, they should be optional too (would either i= mply > them or select if SPI_OFFLOAD). >=20 > I'm currently leaning towards > =C2=A0 imply PWM > =C2=A0 imply SPI_OFFLOAD_TRIGGER_PWM //(SPI_OFFLOAD_TRIGGER_PWM depends o= n > SPI_OFFLOAD) > but not really sure. >=20 > It's sort of a feature bundle we want to enable to provide SPI offloading= . >=20 > if SPI_OFFLOAD && PWM > select SPI_OFFLOAD_TRIGGER_PWM > select IIO_BUFFER_DMA > select IIO_BUFFER_DMAENGINE >=20 > we can have > imply IIO_BUFFER_DMA > imply IIO_BUFFER_DMAENGINE > =C2=A0 imply PWM > =C2=A0 imply SPI_OFFLOAD_TRIGGER_PWM >=20 > but we could then have IIO_BUFFER_DMA=3Dy and PWM=3Dn and still be unable= to SPI > offload? >=20 > Maybe > imply IIO_BUFFER_DMA if (SPI_OFFLOAD && PWM) > imply IIO_BUFFER_DMAENGINE if (SPI_OFFLOAD && PWM) > =C2=A0 imply PWM > =C2=A0 imply SPI_OFFLOAD_TRIGGER_PWM if (SPI_OFFLOAD && PWM) > ? >=20 With imply I don't think you need those if (...). However, the key point is= that with it, I believe you'll need the stubs (so you need some convincing) beca= use those configs can be disabled which means your driver should not compile. W= hile I feel sympathetic with that "depend on optional code", the above does not = look pretty :). For the IIO_BUFFER* stuff I would likely not care about it and f= or PWM and SPI_OFFLOAD either depend on we need the stubs. But if you really feel strong about this, one possible solution would be to= try and factor out all of the spi_offload related code into an extra source fil= e like ad4030-offload.c (that would have it's own kconfig knob) and that woul= d need to depend on PWM and then you would also be "free" to have the ad4030-= * stubs in your header file so that it does not fail to compile in case PWM= =3Dn. - Nuno S=C3=A1 > Forgot to add David to CC list on previous reply so doing it now. >=20 > >=20 > > - Nuno S=C3=A1 > > =09 > > >=20 > > > [1]: > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tr= ee/Documentation/kbuild/kconfig-language.rst?h=3Dv6.17#n197 > > >=20 > > > One alternative to this patch is to have `#if IS_REACHABLE(CONFIG_PWM= )` in > > > the > > > ADC driver as David suggested in the other thread. I'll probably do t= hat > > > and > > > drop the changes to PWM. > > >=20 > > > I first thought of using `#ifdef CONFIG_PWM`, but couldn't convince m= yself > > > about > > > that from the relatively small number of ifdef use-cases in IIO. > > >=20 > > > Thanks, > > > Marcelo > > >=20 > > > >=20 > > > > - Nuno S=C3=A1 > > > >=20 > > > > > Best regards > > > > > Uwe