linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tanislav, Cosmin" <Cosmin.Tanislav@analog.com>
To: "Rasmus Villemoes" <rasmus.villemoes@prevas.dk>,
	"Nuno Sá" <noname.nuno@gmail.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: RE: [POC] iio: ad74413: allow channel configuration to be given via module parameters
Date: Fri, 9 Dec 2022 08:46:40 +0000	[thread overview]
Message-ID: <57e440708c1946c9a309346cc7636fe0@analog.com> (raw)
In-Reply-To: <20221208133354.2980343-1-rasmus.villemoes@prevas.dk>



> -----Original Message-----
> From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> Sent: Thursday, December 8, 2022 3:34 PM
> To: Nuno Sá <noname.nuno@gmail.com>; linux-iio@vger.kernel.org
> Cc: Jonathan Cameron <jic23@kernel.org>; Tanislav, Cosmin
> <Cosmin.Tanislav@analog.com>; Hennerich, Michael
> <Michael.Hennerich@analog.com>; Lars-Peter Clausen <lars@metafoo.de>;
> Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> Subject: [POC] iio: ad74413: allow channel configuration to be given via
> module parameters
> 
> [External]
> 
> Just to see how it would look, I tried doing the below. Since a board
> may have more than one ad74412/ad74413, one needs to be able to
> differentiate between them. So for now each module parameter channelX
> (X=0,1,2,3) accepts a space-separated list of <label>:<function>,
> where label is matched against the label property in device tree, but
> also allowing * to match any, which is more convenient when one knows
> there is only one device.
> 
> Aside from the missing documentation (MODULE_PARM_DESC), there are of
> course various details to hash out. E.g., should the function be
> specified with a raw integer as here, or should we take a text string
> "voltage-output", "current-input-ext-power" etc. and translate those?
> Should we use space or comma or semicolon as separator? And so on.
> 
> I also considered whether instead of the label one should instead
> match on the OF_FULLNAME,
> e.g. /soc@0/bus@30800000/spi@30840000/ad74412r@0, but that's a lot
> more complicated, and I assume that anybody that has more than one of
> these chips would anyway assign a label so that they can distinguish
> their /sys/bus/iio/... directories.
> 
> I should also note that it is not unprecedented for modules to take
> parameters that do some sort of (ad hoc) parsing to apply settings
> per-device. For example:
> 
> - ignore_wake in drivers/gpio/gpiolib-acpi.c
> - mtdparts in drivers/mtd/parsers/cmdlinepart.c
> - pci_devs_to_hide in drivers/xen/xen-pciback/pci_stub.c
> - quirks in drivers/hid/usbhid/hid-core.c
> 
> So the question is, is there any chance that anything like this could
> be accepted? If so, I'll of course spin this into a real patch with
> proper MODULE_PARM_DESC and commit log etc.
> 
> This has been tested doing
> 
>   insmod ad74413r.ko 'channel0=*:1' 'channel1=*:3' 'channel2=*:2'
> 'channel3=*:4'
> 
> and seeing that the channels did indeed come up as expected, where the
> device tree specified CH_FUNC_HIGH_IMPEDANCE for all of them.
> 

Nuno previously mentioned dynamically loading device tree overlays,
which seems like a much cleaner solution to me. Have you looked into
that?


  reply	other threads:[~2022-12-09  8:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02 11:16 run-time change of configuration of ad74412 Rasmus Villemoes
2022-12-02 14:39 ` Nuno Sá
2022-12-08 13:33   ` [POC] iio: ad74413: allow channel configuration to be given via module parameters Rasmus Villemoes
2022-12-09  8:46     ` Tanislav, Cosmin [this message]
2022-12-11 12:00       ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57e440708c1946c9a309346cc7636fe0@analog.com \
    --to=cosmin.tanislav@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=noname.nuno@gmail.com \
    --cc=rasmus.villemoes@prevas.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).