From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7979CC49EA1 for ; Sat, 3 Aug 2024 15:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1cgVozKAVD3KFCCxFAxYodKafWs2uoyrvvYSdNxZZvY=; b=14HmoB9vQ7sQy9fYVy8o1h3db0 3OVfoK4oy++FCv6RXhj6WLUW/qYNZfhYZil6Jlcbzm/Nf4MJQiizaMrYKNqMJiyhfrA1TPEWYnrtC JXzD+4nZrTN5Mw18RDgbSA3Z8/XUA1rl5sXWPf53Q9VOdW2cgmjNHD4V67+lgBeyCAcI7EX8dnUpo pXqpPIZcwAv7+aCcFOCAfF0rZL5VEb9SWmS4k3rdqJqoVyUDmlzoedUp4KxIrzSc4cLCiQ3sQcwdv IZcQRcjkLZNLVXtK1FnMrC4uqfrny3B+XGmjZQySkq+swbjXPFlsED0WP7FMgBnIArg9KHLsg/brT WqNbvhsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1saGRL-0000000Bbmx-2Hgw; Sat, 03 Aug 2024 15:13:03 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1saGQq-0000000Bbgo-2A7d for linux-arm-kernel@lists.infradead.org; Sat, 03 Aug 2024 15:12:33 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D909060ACA; Sat, 3 Aug 2024 15:12:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11728C4AF0A; Sat, 3 Aug 2024 15:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722697951; bh=hKygohsOdeB7ONXdsjrCJbuO58oXWXkp2aNHcwRceSk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EqDYIEQKd2oRqXFxDim9V5p/bk/1AbaQ2C6SahaSHkP20Wdo5/vGP8pcKmO1efEJq lcj05rDMqnWZfjqDbGV0/bh7fqY2NjLt+19SzkhS/TnG2eAsMm1jlQ1e86lBNkoVqZ ZPvhxZQtdvdHdd7Ot9pTONdyHi/akA0FpdzHgsqgU9E2S8HzRVhPlnGk98sRdGULlN etTE5A0McSsz/cFmOekb43mb1W7k5QS8qFUpSlmzTaYjHyZghjWQMS6ck0rlbZkyET 22SI5AFHPAuOknTKNTnaMZDfWuJ/rO7ogPcL6K+xZPYt82n49nmVwkiV8PDx2GO9j0 2eddEsOC8m/bA== Date: Sat, 3 Aug 2024 16:12:22 +0100 From: Jonathan Cameron To: Olivier Moysan Cc: , Lars-Peter Clausen , Maxime Coquelin , Alexandre Torgue , , , , Subject: Re: [PATCH v6 7/9] iio: adc: stm32-dfsdm: adopt generic channels bindings Message-ID: <20240803161222.1f320fcc@jic23-huawei> In-Reply-To: <20240730084640.1307938-8-olivier.moysan@foss.st.com> References: <20240730084640.1307938-1-olivier.moysan@foss.st.com> <20240730084640.1307938-8-olivier.moysan@foss.st.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240803_081232_677980_4C1B0ACD X-CRM114-Status: GOOD ( 18.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 30 Jul 2024 10:46:37 +0200 Olivier Moysan wrote: > Move to generic channels binding to ease new backend framework adoption > and prepare the convergence with MDF IP support on STM32MP2 SoC family. > > Legacy binding: > DFSDM is an IIO channel consumer. > SD modulator is an IIO channels provider. > The channel phandles are provided in DT through io-channels property > and channel indexes through st,adc-channels property. > > New binding: > DFSDM is an IIO channel provider. > The channel indexes are given by reg property in channel child node. > > This new binding is intended to be used with SD modulator IIO backends. > It does not support SD modulator legacy IIO devices. > The st,adc-channels property presence is used to discriminate > between legacy and backend bindings. > > The support of the DFSDM legacy channels and SD modulator IIO devices > is kept for backward compatibility. > > Signed-off-by: Olivier Moysan One trivial thing noted inline. If you spin a v7 for other reasons tidy it up, if not I 'might' (if I remember and can be bothered) tweak it whilst applying, but probably not. Jonathan > > +static int stm32_dfsdm_chan_init(struct iio_dev *indio_dev, struct iio_chan_spec *channels) > +{ > + int num_ch = indio_dev->num_channels; > + int chan_idx = 0; > + int ret; > + > + for (chan_idx = 0; chan_idx < num_ch; chan_idx++) { > + channels[chan_idx].scan_index = chan_idx; > + ret = stm32_dfsdm_adc_chan_init_one(indio_dev, &channels[chan_idx], NULL); > + if (ret < 0) > + return dev_err_probe(&indio_dev->dev, ret, "Channels init failed\n"); > + } > + > + return 0; > +} > + > +static int stm32_dfsdm_generic_chan_init(struct iio_dev *indio_dev, struct iio_chan_spec *channels) > +{ > + int chan_idx = 0, ret; As in the above function, I'd have slightly preferred these on separate lines. If that's all that comes up, I might tweak it whilst applying. > + > + device_for_each_child_node_scoped(&indio_dev->dev, child) { > + /* Skip DAI node in DFSDM audio nodes */ > + if (fwnode_property_present(child, "compatible")) > + continue; > + > + channels[chan_idx].scan_index = chan_idx; > + ret = stm32_dfsdm_adc_chan_init_one(indio_dev, &channels[chan_idx], child); > + if (ret < 0) > + return dev_err_probe(&indio_dev->dev, ret, "Channels init failed\n"); > + > + chan_idx++; > + } > + > + return chan_idx; > +} > +