[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fd4db31d-4e55-4f0e-a96d-d193c28fd784@kernel.org>
Date: Wed, 6 Nov 2024 14:41:45 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Eason Yang <j2anfernee@...il.com>, 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, dlechner@...libre.com, javier.carrasco.cruz@...il.com,
andy@...nel.org, marcelo.schmitt@...log.com, olivier.moysan@...s.st.com,
mitrutzceclan@...il.com, matteomartelli3@...il.com, alisadariana@...il.com,
joao.goncalves@...adex.com, marius.cristea@...rochip.com,
mike.looijmans@...ic.nl, chanh@...amperecomputing.com, KWLIU@...oton.com,
yhyang2@...oton.com
Cc: openbmc@...ts.ozlabs.org, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/2] iio: adc: add Nuvoton NCT720x ADC driver
On 06/11/2024 03:39, 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.
>
> Signed-off-by: Eason Yang <j2anfernee@...il.com>
...
> +
> +static int nct720x_probe(struct i2c_client *client)
> +{
> + const struct i2c_device_id *id = i2c_client_get_device_id(client);
> + struct nct720x_chip_info *chip;
> + struct iio_dev *indio_dev;
> + int ret;
> + u32 tmp;
> +
> + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
> + if (!indio_dev)
> + return -ENOMEM;
> + chip = iio_priv(indio_dev);
> +
> + if (client->dev.of_node)
> + chip->type = (enum nct720x_chips)device_get_match_data(&client->dev);
> + else
> + chip->type = i2c_match_id(nct720x_id, client)->driver_data;
I believe there is a I2C wrapper for above.
> +
> + chip->vin_max = (chip->type == nct7201) ? NCT7201_VIN_MAX : NCT7202_VIN_MAX;
> +
> + ret = of_property_read_u32(client->dev.of_node, "read-vin-data-size", &tmp);
> + if (ret < 0) {
> + pr_err("read-vin-data-size property not found\n");
Please use dev_xxx in your driver code.
Best regards,
Krzysztof
Powered by blists - more mailing lists