[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2a4f0a3d-3288-4f59-8c18-c53ab4b596e5@baylibre.com>
Date: Mon, 6 Jan 2025 08:50:18 -0600
From: David Lechner <dlechner@...libre.com>
To: Yu-Hsian Yang <j2anfernee@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: avifishman70@...il.com, tmaimon77@...il.com, tali.perry1@...il.com,
venture@...gle.com, yuenn@...gle.com, benjaminfair@...gle.com,
jic23@...nel.org, lars@...afoo.de, robh@...nel.org, krzk+dt@...nel.org,
conor+dt@...nel.org, nuno.sa@...log.com, javier.carrasco.cruz@...il.com,
marcelo.schmitt@...log.com, olivier.moysan@...s.st.com,
mitrutzceclan@...il.com, tgamblin@...libre.com, matteomartelli3@...il.com,
alisadariana@...il.com, gstols@...libre.com, thomas.bonnefille@...tlin.com,
herve.codina@...tlin.com, chanh@...amperecomputing.com, KWLIU@...oton.com,
yhyang2@...oton.com, openbmc@...ts.ozlabs.org, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] iio: adc: add Nuvoton NCT7201 ADC driver
On 1/6/25 2:33 AM, Yu-Hsian Yang wrote:
> Dear Andy,
>
> Thanks for your comments.
>
> Andy Shevchenko <andriy.shevchenko@...ux.intel.com> 於 2024年12月27日 週五 下午8:14寫道:
>>
>> On Thu, Dec 26, 2024 at 01:53:13PM +0800, Eason Yang wrote:
>>> Add Nuvoton NCT7201/NCT7202 system voltage monitor 12-bit ADC driver
>>>
>>> NCT7201/NCT7202 supports up to 12 analog voltage monitor inputs and up to
>>> 4 SMBus addresses by ADDR pin. Meanwhile, ALERT# hardware event pins for
>>> independent alarm signals, and the all threshold values could be set for
>>> system protection without any timing delay. It also supports reset input
>>> RSTIN# to recover system from a fault condition.
>>>
>>> Currently, only single-edge mode conversion and threshold events support.
>>
...
>>
>>> +static const struct regmap_config nct7201_regmap8_config = {
>>> + .name = "vin-data-read-byte",
>>> + .reg_bits = 8,
>>> + .val_bits = 8,
>>> + .max_register = 0xff,
>>> +};
>>> +
>>> +static const struct regmap_config nct7201_regmap16_config = {
>>> + .name = "vin-data-read-word",
>>> + .reg_bits = 8,
>>> + .val_bits = 16,
>>> + .max_register = 0xff,
>>> +};
>>
>> I don't see how these configurations will prevent, e.g., debugfs to access
>> 16-bit registers via 8-bit IO and vice versa.
>>
>
> Read VIN info can use word read or byte read, and other registers
> should use byte read.
>
> The design is that VIN info registers are used 16-bit debugfs to access and
> other registers are used 8-bit debugfs to access.
>
> We need to probe 8-bit regmap and 16-bit regmap,
> but I have no idea how to prevent 8-bit IO to access 16-bit registers
> and vice versa.
You can do this with struct regmap_access_table via wr_table and rd_table
in the struct regmap_config.
Powered by blists - more mailing lists