Lines Matching +full:cros +full:- +full:ec

1 // SPDX-License-Identifier: GPL-2.0
20 #define DRV_NAME "cros-ec-sensorhub"
54 struct cros_ec_command *msg = sensorhub->msg; in cros_ec_sensorhub_register()
55 struct cros_ec_dev *ec = sensorhub->ec; in cros_ec_sensorhub_register() local
60 msg->version = 1; in cros_ec_sensorhub_register()
61 msg->insize = sizeof(struct ec_response_motion_sense); in cros_ec_sensorhub_register()
62 msg->outsize = sizeof(struct ec_params_motion_sense); in cros_ec_sensorhub_register()
64 for (i = 0; i < sensorhub->sensor_num; i++) { in cros_ec_sensorhub_register()
65 sensorhub->params->cmd = MOTIONSENSE_CMD_INFO; in cros_ec_sensorhub_register()
66 sensorhub->params->info.sensor_num = i; in cros_ec_sensorhub_register()
68 ret = cros_ec_cmd_xfer_status(ec->ec_dev, msg); in cros_ec_sensorhub_register()
70 dev_warn(dev, "no info for EC sensor %d : %d/%d\n", in cros_ec_sensorhub_register()
71 i, ret, msg->result); in cros_ec_sensorhub_register()
75 switch (sensorhub->resp->info.type) { in cros_ec_sensorhub_register()
77 name = "cros-ec-accel"; in cros_ec_sensorhub_register()
80 name = "cros-ec-baro"; in cros_ec_sensorhub_register()
83 name = "cros-ec-gyro"; in cros_ec_sensorhub_register()
86 name = "cros-ec-mag"; in cros_ec_sensorhub_register()
89 name = "cros-ec-prox"; in cros_ec_sensorhub_register()
92 name = "cros-ec-light"; in cros_ec_sensorhub_register()
95 name = "cros-ec-activity"; in cros_ec_sensorhub_register()
99 sensorhub->resp->info.type); in cros_ec_sensorhub_register()
107 sensor_type[sensorhub->resp->info.type]++; in cros_ec_sensorhub_register()
111 ec->has_kb_wake_angle = true; in cros_ec_sensorhub_register()
113 if (cros_ec_check_features(ec, in cros_ec_sensorhub_register()
116 "cros-ec-lid-angle", in cros_ec_sensorhub_register()
127 struct device *dev = &pdev->dev; in cros_ec_sensorhub_probe()
128 struct cros_ec_dev *ec = dev_get_drvdata(dev->parent); in cros_ec_sensorhub_probe() local
135 ec->ec_dev->max_response), GFP_KERNEL); in cros_ec_sensorhub_probe()
137 return -ENOMEM; in cros_ec_sensorhub_probe()
139 msg->command = EC_CMD_MOTION_SENSE_CMD + ec->cmd_offset; in cros_ec_sensorhub_probe()
143 return -ENOMEM; in cros_ec_sensorhub_probe()
145 mutex_init(&data->cmd_lock); in cros_ec_sensorhub_probe()
147 data->dev = dev; in cros_ec_sensorhub_probe()
148 data->ec = ec; in cros_ec_sensorhub_probe()
149 data->msg = msg; in cros_ec_sensorhub_probe()
150 data->params = (struct ec_params_motion_sense *)msg->data; in cros_ec_sensorhub_probe()
151 data->resp = (struct ec_response_motion_sense *)msg->data; in cros_ec_sensorhub_probe()
155 /* Check whether this EC is a sensor hub. */ in cros_ec_sensorhub_probe()
156 if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE)) { in cros_ec_sensorhub_probe()
157 sensor_num = cros_ec_get_sensor_count(ec); in cros_ec_sensorhub_probe()
166 return -EINVAL; in cros_ec_sensorhub_probe()
168 data->sensor_num = sensor_num; in cros_ec_sensorhub_probe()
174 if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) { in cros_ec_sensorhub_probe()
186 * When the EC does not have a FIFO, the sensors will query in cros_ec_sensorhub_probe()
189 if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) { in cros_ec_sensorhub_probe()
207 data->sensor_num = 2; in cros_ec_sensorhub_probe()
208 for (i = 0; i < data->sensor_num; i++) { in cros_ec_sensorhub_probe()
210 "cros-ec-accel-legacy", i); in cros_ec_sensorhub_probe()
222 * When the EC is suspending, we must stop sending interrupt,
224 * Tell the EC to stop sending non-interrupt event on the iio ring.
229 struct cros_ec_dev *ec = sensorhub->ec; in cros_ec_sensorhub_suspend() local
231 if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) in cros_ec_sensorhub_suspend()
239 struct cros_ec_dev *ec = sensorhub->ec; in cros_ec_sensorhub_resume() local
241 if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) in cros_ec_sensorhub_resume()
269 MODULE_DESCRIPTION("ChromeOS EC MEMS Sensor Hub Driver");