*/
#define CROS_EC_FIFO_SIZE (2048 * 2 / 3)
-static char *cros_ec_loc[] = {
- [MOTIONSENSE_LOC_BASE] = "base",
- [MOTIONSENSE_LOC_LID] = "lid",
- [MOTIONSENSE_LOC_MAX] = "unknown",
-};
-
static int cros_ec_get_host_cmd_version_mask(struct cros_ec_device *ec_dev,
u16 cmd_offset, u16 cmd, u32 *mask)
{
indio_dev->name = pdev->name;
if (physical_device) {
+ enum motionsensor_location loc;
+
state->param.cmd = MOTIONSENSE_CMD_INFO;
state->param.info.sensor_num = sensor_platform->sensor_num;
ret = cros_ec_motion_send_host_cmd(state, 0);
return ret;
}
state->type = state->resp->info.type;
- state->loc = state->resp->info.location;
+ loc = state->resp->info.location;
+ if (loc == MOTIONSENSE_LOC_BASE)
+ indio_dev->label = "accel-base";
+ else if (loc == MOTIONSENSE_LOC_LID)
+ indio_dev->label = "accel-display";
+ else if (loc == MOTIONSENSE_LOC_CAMERA)
+ indio_dev->label = "accel-camera";
/* Set sign vector, only used for backward compatibility. */
memset(state->sign, 1, CROS_EC_SENSOR_MAX_AXIS);
return snprintf(buf, PAGE_SIZE, "%d\n", st->param.info.sensor_num);
}
-static ssize_t cros_ec_sensors_loc(struct iio_dev *indio_dev,
- uintptr_t private, const struct iio_chan_spec *chan,
- char *buf)
-{
- struct cros_ec_sensors_core_state *st = iio_priv(indio_dev);
-
- return snprintf(buf, PAGE_SIZE, "%s\n", cros_ec_loc[st->loc]);
-}
-
const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[] = {
{
.name = "calibrate",
.shared = IIO_SHARED_BY_ALL,
.read = cros_ec_sensors_id
},
- {
- .name = "location",
- .shared = IIO_SHARED_BY_ALL,
- .read = cros_ec_sensors_loc
- },
{ },
};
EXPORT_SYMBOL_GPL(cros_ec_sensors_ext_info);
* @param: motion sensor parameters structure
* @resp: motion sensor response structure
* @type: type of motion sensor
- * @loc: location where the motion sensor is placed
* @range_updated: True if the range of the sensor has been
* updated.
* @curr_range: If updated, the current range value.
struct ec_response_motion_sense *resp;
enum motionsensor_type type;
- enum motionsensor_location loc;
bool range_updated;
int curr_range;