staticint mpl115_read_temp(struct mpl115_data *data)
{ int ret;
mutex_lock(&data->lock);
ret = mpl115_request(data); if (ret < 0) goto done;
ret = data->ops->read(data->dev, MPL115_TADC);
done:
mutex_unlock(&data->lock); return ret;
}
staticint mpl115_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask)
{ struct mpl115_data *data = iio_priv(indio_dev); int ret;
switch (mask) { case IIO_CHAN_INFO_PROCESSED:
pm_runtime_get_sync(data->dev);
ret = mpl115_comp_pressure(data, val, val2); if (ret < 0) return ret;
pm_runtime_mark_last_busy(data->dev);
pm_runtime_put_autosuspend(data->dev);
return IIO_VAL_INT_PLUS_MICRO; case IIO_CHAN_INFO_RAW:
pm_runtime_get_sync(data->dev); /* temperature -5.35 C / LSB, 472 LSB is 25 C */
ret = mpl115_read_temp(data); if (ret < 0) return ret;
pm_runtime_mark_last_busy(data->dev);
pm_runtime_put_autosuspend(data->dev);
*val = ret >> 6;
/* * As the device takes 3 ms to come up with a fresh * reading after power-on and 5 ms to actually power-on, * do not shut it down unnecessarily. Set autosuspend to * 2000 ms.
*/
pm_runtime_set_autosuspend_delay(dev, 2000);
pm_runtime_use_autosuspend(dev);
pm_runtime_put(dev);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.