From: Krzysztof Kozlowski <krzk@kernel.org>
To: Emil Gedenryd <emil.gedenryd@axis.com>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Andreas Dannenberg <dannenberg@ti.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, kernel@axis.com
Subject: Re: [PATCH 2/3] iio: light: opt3001: add support for TI's opt3002 light sensor
Date: Thu, 5 Sep 2024 12:37:34 +0200 [thread overview]
Message-ID: <cf9d3887-f76e-48d8-a1a5-de6c6e6db96b@kernel.org> (raw)
In-Reply-To: <20240905-add_opt3002-v1-2-a5ae21b924fb@axis.com>
On 05/09/2024 12:20, Emil Gedenryd wrote:
> TI's opt3002 light sensor shares most properties with the opt3001
> model, with the exception of supporting a wider spectrum range.
>
> Add support for TI's opt3002 by extending the TI opt3001 driver.
>
> See https://www.ti.com/product/OPT3002 for more information.
>
...
>
> mutex_init(&opt->lock);
> init_waitqueue_head(&opt->result_ready_queue);
> @@ -769,10 +892,18 @@ static int opt3001_probe(struct i2c_client *client)
> return ret;
>
> iio->name = client->name;
> - iio->channels = opt3001_channels;
> - iio->num_channels = ARRAY_SIZE(opt3001_channels);
> iio->modes = INDIO_DIRECT_MODE;
> iio->info = &opt3001_info;
> + switch (opt->chip_info->model) {
> + case OPT3001:
> + iio->channels = opt3001_channels;
> + iio->num_channels = ARRAY_SIZE(opt3001_channels);
> + break;
> + case OPT3002:
> + iio->channels = opt3002_channels;
> + iio->num_channels = ARRAY_SIZE(opt3002_channels);
> + break;
> + }
>
> ret = devm_iio_device_register(dev, iio);
> if (ret) {
> @@ -826,13 +957,15 @@ static void opt3001_remove(struct i2c_client *client)
> }
>
> static const struct i2c_device_id opt3001_id[] = {
> - { "opt3001" },
> + { "opt3001", 0 },
> + { "opt3002", 1 },
Use the same match data for all ID tables. Otherwise you run into
problems for different match methods.
> { } /* Terminating Entry */
> };
> MODULE_DEVICE_TABLE(i2c, opt3001_id);
>
> static const struct of_device_id opt3001_of_match[] = {
> - { .compatible = "ti,opt3001" },
> + { .compatible = "ti,opt3001", .data = &opt3001_chip_info },
> + { .compatible = "ti,opt3002", .data = &opt3002_chip_info },
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-09-05 10:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 10:20 [PATCH 0/3] " Emil Gedenryd
2024-09-05 10:20 ` [PATCH 1/3] iio: light: opt3001: add missing full-scale range value Emil Gedenryd
2024-09-07 17:28 ` Jonathan Cameron
2024-09-09 7:15 ` Emil Gedenryd
2024-09-05 10:20 ` [PATCH 2/3] iio: light: opt3001: add support for TI's opt3002 light sensor Emil Gedenryd
2024-09-05 10:37 ` Krzysztof Kozlowski [this message]
2024-09-06 21:32 ` kernel test robot
2024-09-07 17:35 ` Jonathan Cameron
2024-09-09 7:54 ` Emil Gedenryd
2024-09-09 19:13 ` Jonathan Cameron
2024-09-13 7:18 ` Emil Gedenryd
2024-09-05 10:20 ` [PATCH 3/3] dt-bindings: iio: light: opt3001: add compatible for opt3002 Emil Gedenryd
2024-09-05 10:38 ` Krzysztof Kozlowski
2024-09-05 11:11 ` Rob Herring (Arm)
2024-09-05 10:38 ` [PATCH 0/3] iio: light: opt3001: add support for TI's opt3002 light sensor Krzysztof Kozlowski
2024-09-05 10:55 ` Emil Gedenryd
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=cf9d3887-f76e-48d8-a1a5-de6c6e6db96b@kernel.org \
--to=krzk@kernel.org \
--cc=conor+dt@kernel.org \
--cc=dannenberg@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=emil.gedenryd@axis.com \
--cc=jic23@kernel.org \
--cc=kernel@axis.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
/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
all inboxes | Powered by JetHome®