lkml.org 
[lkml]   [2022]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v6 2/2] iio: light: Add support for ltrf216a sensor
From

On 07/07/22 02:39, Dmitry Osipenko wrote:
> On 6/15/22 16:51, Shreeya Patel wrote:
>> +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->lock);
>> +
>> + indio_dev->info = &ltrf216a_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;
>> +
>> + /* reset sensor, chip fails to respond to this, so ignore any errors */
>> + ltrf216a_reset(indio_dev);
> Shouldn't SW resetting be done after enabling sensor? Perhaps that's why
> it fails to respond?


We tried to reset the device through i2c-tool to see if that works :-

(root@steamdeck ~)# i2cset -f 0 0x53 0x00 0x10
warning! This program can confuse your i2c bus, cause data loss and worse!
Dangerous! Writing to a serial eeprom on a memory dimm
may render your memory useless and make your system unbootable!
I will write to device file /dev/i2c-0, chip address 0x53,
data address 0x00, data 0x10, mode byte.
Continue? [y/n] y
error: write failed
(1)(b+)(root@steamdeck ~)#

But the problem here is that the light sensor resets itself
instantaneously while the i2c transaction is still in progress.
So it never replies with the proper stop bit that is expected at the end
of a transaction. Hence, we decided to ignore
the error.


Thanks,
Shreeya Patel
>

\
 
 \ /
  Last update: 2022-07-07 00:49    [W:0.730 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site