Re: [PATCH v4 3/3] iio: magnetometer: add ti tmag5273 driver

From: Gerald Loacker
Date: Wed Nov 30 2022 - 04:04:57 EST




Am 29.11.2022 um 17:37 schrieb Andy Shevchenko:
> On Tue, Nov 29, 2022 at 07:45:40AM +0100, Gerald Loacker wrote:
>> Add support for TI TMAG5273 Low-Power Linear 3D Hall-Effect Sensor.
>> Additionally to temperature and magnetic X, Y and Z-axes the angle and
>> magnitude are reported.
>> The sensor is operating in continuous measurement mode and changes to sleep
>> mode if not used for 5 seconds.
>
> ...
>
>> + snprintf(data->name, sizeof(data->name), "tmag5273x%1u", data->version);
>
> Thinking more about this format, perhaps
>
> snprintf(data->name, sizeof(data->name), "tmag5273x-v%1u", data->version);
>
> ?

I'd prefer to keep this as it's related to the orderable part number,
e.g. TMAG5273A1 / TMAG5273A2.

>
> ...
>
>> +static int tmag5273_runtime_resume(struct device *dev)
>> +{
>> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
>> + struct tmag5273_data *data = iio_priv(indio_dev);
>> + int ret;
>
>> + /*
>> + * Time to go to stand-by mode from sleep mode is 50us
>> + * typically. During this time no I2C access is possible.
>> + */
>
> Shouldn't be this comment closer to usleep_range()?
>

Ok, I'll clarify this and also introduce a wake-up function, as this is
used two times in a similar way.

>> + tmag5273_set_operating_mode(data, TMAG5273_OP_MODE_CONT);
>> + usleep_range(80, 200);
>> + ret = tmag5273_set_operating_mode(data, TMAG5273_OP_MODE_CONT);
>> + if (ret)
>> + dev_err(dev, "failed to power on device (%pe)\n", ERR_PTR(ret));
>> +
>> + return ret;
>> +}

Regards,
Gerald