Re: [PATCH v2] iio: humidity: am2315: add am2320 to i2c_device_id table

Nicolás Antinori <[email protected]>
Newsgroups dev.linux.lists.linux-kernel-mentees,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed Aug 12, 2026 at 1:43 AM -03, Jonathan Cameron wrote:
> On Tue, 11 Aug 2026 13:06:50 -0500
> David Lechner <[email protected]> wrote:
>
>> On 8/11/26 12:58 PM, Nicolás Antinori wrote:
>> > On Tue Aug 11, 2026 at 12:49 PM -03, David Lechner wrote:  
>> >> On 8/11/26 10:12 AM, Nicolás Antinori wrote:  
>> >>> On Mon Aug 10, 2026 at 4:28 PM -03, David Lechner wrote:  
>> >>>> On 8/10/26 1:32 PM, Nicolás Antinori wrote:  
>> >>>>> The AM2320 is fully compatible with the AM2315 sensor in terms of I2C
>> >>>>> communication protocol and measurement conversions.
>> >>>>>
>> >>>>> Add the "am2320" entry to the i2c_device_id table.  
>> >>>>
>> >>>> Interesting. No devicetree bindings for this one? What kind of
>> >>>> system is it on?
>> >>>>  
>> >>>
>> >>> I am testing this on a Raspberry Pi 3b mounted on a protoboard.  
>> >>
>> >> How do you tell the RPi to bind the driver?
>> >>
>> >> Since Raspberry Pi is ARM-based, usually we would use devicetree
>> >> overlay to do this, which would mean that we should write a
>> >> dt-bindings .yaml file for these chips.  
>> > 
>> > I do it manually.
>> > 
>> > I use that RPi for development, at the moment the kernel I am using is 
>> > 7.2.0-rc6-v8+ with CONFIG_AM2315=m. When I need to use the AM2320 I
>> > modprobe it with:
>> > 
>> > $ sudo modprobe am2315
>> > 
>> > And then 
>> > 
>> > $ sudo bash -c "echo am2315 0x5c > /sys/bus/i2c/devices/i2c-1/new_device"
>> > 
>> > (With the modifications I made ... echo am2320 ... works as well)
>> > The pins for i2c I am using are GPIO 2 (SDA) and GPIO 3 (SCL).
>> > 
>> > If a dt-binding yaml is needed I can send another patch with it!
>> > 
>> >   
>> 
>> Yes please. It will make it easier for others to use as well.
>
> I think (from a quick bit of googling) that these two parts are
> at least 'kind of' the same thing with different packaging.
> The name is a nice to have and given the packaging may I guess
> affect the signal and how it is used it probably makes sense
> to add it.
>
> They only have 4 pins. Power, ground, SCL and SDA.  So it
> is a rare device simple enough that I think an entry in trivial-devices.yaml
> is probably sufficient.
>
> Ideally add an of_device_id table, even though this will work fine
> by the fallback path that uses the i2c_device_id table
>
> Jonathan
>
>> 

Thank you all for the feedback. I've added of_device_id table, chip_data
struct (and assign the name from there), and added "aosong,am2315" and
"aosong,am2320" to trivial-devices.yml.

I'll wait a few days to send v3 in case something else comes up.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.