mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <Victor.Duicu@microchip.com>
To: <Jonathan.Cameron@huawei.com>
Cc: <dlechner@baylibre.com>, <nuno.sa@analog.com>,
	<linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<robh@kernel.org>, <jic23@kernel.org>, <andy@kernel.org>,
	<krzk+dt@kernel.org>, <linux-kernel@vger.kernel.org>,
	<Marius.Cristea@microchip.com>, <conor+dt@kernel.org>
Subject: Re: [PATCH v2 2/2] iio: temperature: add support for MCP998X
Date: Mon, 2 Jun 2025 14:49:29 +0000	[thread overview]
Message-ID: <e5756eaf53fb5a702274cc707fcdf6196773fc65.camel@microchip.com> (raw)
In-Reply-To: <20250530175351.000039cb@huawei.com>

On Fri, 2025-05-30 at 17:53 +0100, Jonathan Cameron wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> On Thu, 29 May 2025 12:36:28 +0300
> victor.duicu@microchip.com wrote:
> 
> > From: Victor Duicu <victor.duicu@microchip.com>
> > 
> > This is the driver for Microchip MCP998X/33 and MCP998XD/33D
> > Multichannel Automotive Temperature Monitor Family.
> > 
> > Signed-off-by: Victor Duicu <victor.duicu@microchip.com>
> Hi Victor,
> 
Hi Jonathan,

...

> 
> > +
> > +What:                /sys/bus/iio/devices/iio:deviceX/in_beta1
> > +KernelVersion:       6.17
> > +Contact:     linux-iio@vger.kernel.org
> > +Description:
> > +             This attribute controls the value of beta correction
> > +             for channel 1.
> 
> Is this something that we'd normally expect to manually update? What
> is
> it a characteristic of?  If it is expected to the be related to the
> diodes attached, that's a problem for firmware/dt, not sysfs
> interfaces.
> 

Beta is a characteristic of the diode/transistor placed on the setup.
Different diodes require different betas.
So yes, beta value should be in devicetree.

...
> > 
> > +
> > +             priv->iio_chan[iio_idx++] = (struct
> > iio_chan_spec)MCP9982_CHAN(reg_nr, reg_nr,
> > +                                                     
> > MCP9982_INT_VALUE_ADDR(reg_nr));
> 
> Seems very likely that the (struct iio_chan_spec) should be in the
> macro definition.
> 

In version 1 the macro used to define the channels was:

> 
#define MCP9982_CHAN(index, si, __address) ({ \
	struct iio_chan_spec __chan = { \
		.type = IIO_TEMP, \
		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
		.info_mask_shared_by_all_available =
BIT(IIO_CHAN_INFO_SAMP_FREQ), \
		.info_mask_shared_by_all =
BIT(IIO_CHAN_INFO_SAMP_FREQ), \
		.channel = index, \
		.address = __address, \
		.scan_index = si, \
		.scan_type = { \
			.sign = 'u', \
			.realbits = 8, \
			.storagebits = 8, \
			.endianness = IIO_CPU \
		}, \
		.indexed = 1, \
	}; \
	__chan; \
})

which contains struct iio_chan_spec inside.
Andy suggested to use compound literal, so I switched to version 2.
I still use a macro because most of the parameters are common among the
channels.

With Kind Regards,
Victor Duicu

  reply	other threads:[~2025-06-02 14:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-29  9:36 [PATCH v2 0/2] " victor.duicu
2025-05-29  9:36 ` [PATCH v2 1/2] dt-bindings: iio: temperature: " victor.duicu
2025-05-29 18:13   ` David Lechner
2025-05-30 15:55     ` Conor Dooley
2025-06-02 14:48       ` Victor.Duicu
2025-06-06 15:15         ` Conor Dooley
2025-06-10 13:29           ` Victor.Duicu
2025-06-10 15:17             ` Conor Dooley
2025-05-29  9:36 ` [PATCH v2 2/2] " victor.duicu
2025-05-29 18:36   ` Andy Shevchenko
2025-05-30  4:39   ` kernel test robot
2025-05-30 16:53   ` Jonathan Cameron
2025-06-02 14:49     ` Victor.Duicu [this message]
2025-06-07 17:28       ` 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=e5756eaf53fb5a702274cc707fcdf6196773fc65.camel@microchip.com \
    --to=victor.duicu@microchip.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Marius.Cristea@microchip.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --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®