X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=control.c;h=b8fdeaba797b36561dace3518e877a659ef35556;hb=89f2b9b7744f165a604e88fb9d7c805abb5924d5;hp=018ebf21e9b6df15cbee37be589b5589e4a11b19;hpb=eb4520a1ecbd1a14b83ba942e92d08e32c9c449e;p=android-x86%2Fhardware-intel-libsensors.git diff --git a/control.c b/control.c index 018ebf2..b8fdeab 100644 --- a/control.c +++ b/control.c @@ -22,15 +22,6 @@ #include "description.h" #include "filtering.h" -/* Couple of temporary defines until we get a suitable linux/iio/events.h include */ - -struct iio_event_data { - __u64 id; - __s64 timestamp; -}; - -#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int) - /* Currently active sensors count, per device */ static int poll_sensors_per_dev[MAX_DEVICES]; /* poll-mode sensors */ static int trig_sensors_per_dev[MAX_DEVICES]; /* trigger, event based */ @@ -843,13 +834,17 @@ static int sensor_set_rate (int s, float requested_rate) arb_sampling_rate = sensor[s].max_supported_rate; } + /* Record the rate that was agreed upon with the sensor taken in isolation ; this avoid uncontrolled ripple effects between colocated sensor rates */ + sensor[s].semi_arbitrated_rate = arb_sampling_rate; + /* Coordinate with others active sensors on the same device, if any */ if (per_device_sampling_rate) for (n=0; n arb_sampling_rate) { + if (n != s && sensor[n].dev_num == dev_num && sensor[n].num_channels && is_enabled(n) && + sensor[n].semi_arbitrated_rate > arb_sampling_rate) { ALOGV("Sampling rate shared between %s and %s, using %g instead of %g\n", sensor[s].friendly_name, sensor[n].friendly_name, - sensor[n].sampling_rate, arb_sampling_rate); - arb_sampling_rate = sensor[n].sampling_rate; + sensor[n].semi_arbitrated_rate, arb_sampling_rate); + arb_sampling_rate = sensor[n].semi_arbitrated_rate; } sensor[s].sampling_rate = arb_sampling_rate;