Lines Matching full:ec
20 #define DRV_NAME "cros-ec-dev"
74 { .name = "cros-ec-cec", },
78 { .name = "cros-ec-gpio", },
82 { .name = "cros-ec-rtc", },
86 { .name = "cros-ec-sensorhub", },
100 { .name = "cros-ec-wdt", }
104 { .name = "cros-ec-led", },
150 { .name = "cros-ec-chardev", },
151 { .name = "cros-ec-debugfs", },
152 { .name = "cros-ec-hwmon", },
153 { .name = "cros-ec-sysfs", },
157 { .name = "cros-ec-pchg", },
161 { .name = "cros-ec-lightbar", }
165 { .name = "cros-ec-vbc", }
179 struct cros_ec_dev *ec = kzalloc(sizeof(*ec), GFP_KERNEL); in ec_device_probe() local
183 if (!ec) in ec_device_probe()
186 dev_set_drvdata(dev, ec); in ec_device_probe()
187 ec->ec_dev = dev_get_drvdata(dev->parent); in ec_device_probe()
188 ec->dev = dev; in ec_device_probe()
189 ec->cmd_offset = ec_platform->cmd_offset; in ec_device_probe()
190 ec->features.flags[0] = -1U; /* Not cached yet */ in ec_device_probe()
191 ec->features.flags[1] = -1U; /* Not cached yet */ in ec_device_probe()
192 device_initialize(&ec->class_dev); in ec_device_probe()
197 * than an standard EC. in ec_device_probe()
199 if (cros_ec_check_features(ec, cros_mcu_devices[i].id)) { in ec_device_probe()
214 ec->class_dev.class = &cros_class; in ec_device_probe()
215 ec->class_dev.parent = dev; in ec_device_probe()
216 ec->class_dev.release = cros_ec_class_release; in ec_device_probe()
218 retval = dev_set_name(&ec->class_dev, "%s", ec_platform->ec_name); in ec_device_probe()
224 retval = device_add(&ec->class_dev); in ec_device_probe()
228 /* check whether this EC is a sensor hub. */ in ec_device_probe()
229 if (cros_ec_get_sensor_count(ec) > 0) { in ec_device_probe()
230 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
234 dev_err(ec->dev, "failed to add %s subdevice: %d\n", in ec_device_probe()
243 if (cros_ec_check_features(ec, cros_subdevices[i].id)) { in ec_device_probe()
244 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
248 dev_err(ec->dev, in ec_device_probe()
259 if (cros_ec_check_features(ec, EC_FEATURE_LIGHTBAR) || in ec_device_probe()
261 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
265 dev_warn(ec->dev, "failed to add lightbar: %d\n", in ec_device_probe()
274 if (IS_ENABLED(CONFIG_OF) && ec->ec_dev->dev->of_node) { in ec_device_probe()
275 if (cros_ec_check_features(ec, EC_FEATURE_USB_PD)) { in ec_device_probe()
276 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
280 dev_err(ec->dev, in ec_device_probe()
290 retval = cros_ec_cmd(ec->ec_dev, 0, EC_CMD_PCHG_COUNT, NULL, 0, in ec_device_probe()
293 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
297 dev_warn(ec->dev, "failed to add pchg: %d\n", in ec_device_probe()
305 retval = mfd_add_hotplug_devices(ec->dev, cros_ec_platform_cells, in ec_device_probe()
308 dev_warn(ec->dev, in ec_device_probe()
309 "failed to add cros-ec platform devices: %d\n", in ec_device_probe()
312 /* Check whether this EC instance has a VBC NVRAM */ in ec_device_probe()
313 node = ec->ec_dev->dev->of_node; in ec_device_probe()
315 retval = mfd_add_hotplug_devices(ec->dev, cros_ec_vbc_cells, in ec_device_probe()
318 dev_warn(ec->dev, "failed to add VBC devices: %d\n", in ec_device_probe()
325 put_device(&ec->class_dev); in ec_device_probe()
331 struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev); in ec_device_remove() local
333 mfd_remove_devices(ec->dev); in ec_device_remove()
334 device_unregister(&ec->class_dev); in ec_device_remove()