[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a5929558-d09a-cb67-cba9-1dcfb5e43525@gmail.com>
Date: Fri, 13 May 2022 02:54:08 +0300
From: Dmitry Osipenko <digetx@...il.com>
To: Shreeya Patel <shreeya.patel@...labora.com>, jic23@...nel.org,
lars@...afoo.de, robh+dt@...nel.org, Zhigang.Shi@...eon.com,
krisman@...labora.com
Cc: linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel@...labora.com,
alvaro.soliverez@...labora.com
Subject: Re: [PATCH v4 3/3] iio: light: Add support for ltrf216a sensor
11.05.2022 12:40, Shreeya Patel пишет:
> +static int ltrf216a_init(struct iio_dev *indio_dev)
> +{
> + int ret;
> + struct ltrf216a_data *data = iio_priv(indio_dev);
> +
> + ret = i2c_smbus_read_byte_data(data->client, LTRF216A_MAIN_CTRL);
> + if (ret < 0) {
> + dev_err(&data->client->dev, "Error reading LTRF216A_MAIN_CTRL\n");
> + return ret;
> + }
> +
> + /* enable sensor */
> + ret |= FIELD_PREP(LTRF216A_ALS_ENABLE_MASK, 1);
> + ret = i2c_smbus_write_byte_data(data->client, LTRF216A_MAIN_CTRL, ret);
> + if (ret < 0) {
> + dev_err(&data->client->dev, "Error writing LTRF216A_MAIN_CTRL\n");
> + return ret;
> + }
Couldn't you write "1" directly without reading?
What about doing SW reset?
Powered by blists - more mailing lists