[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7a681440-a9bf-d63f-f090-efc96a7b3efe@gmail.com>
Date: Fri, 13 May 2022 02:41:23 +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_probe(struct i2c_client *client)
> +{
> + struct ltrf216a_data *data;
> + struct iio_dev *indio_dev;
> + int ret;
> +
> + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + data = iio_priv(indio_dev);
> + i2c_set_clientdata(client, indio_dev);
> + data->client = client;
> +
> + mutex_init(&data->mutex);
> +
> + indio_dev->info = <rf216a_info;
> + indio_dev->name = LTRF216A_DRV_NAME;
> + indio_dev->channels = ltrf216a_channels;
> + indio_dev->num_channels = ARRAY_SIZE(ltrf216a_channels);
> + indio_dev->modes = INDIO_DIRECT_MODE;
> +
> + ret = ltrf216a_init(indio_dev);
> + if (ret < 0)
> + return dev_err_probe(&client->dev, ret,
> + "ltrf216a chip init failed\n");
Is it possible to enable sensor only when measurement is made for more
power savings? Light sensor shouldn't consume much power, but nevertheless.
You'll need to add msleep(power_on_delay + resolution_rate_delay) after
enabling sensor and before reading the measurement to wait until
measurement is made by h/w.
Powered by blists - more mailing lists