Lines Matching refs:ec

183 	struct cros_ec_dev *ec = kzalloc(sizeof(*ec), GFP_KERNEL);  in ec_device_probe()  local
187 if (!ec) in ec_device_probe()
190 dev_set_drvdata(dev, ec); in ec_device_probe()
191 ec->ec_dev = dev_get_drvdata(dev->parent); in ec_device_probe()
192 ec->dev = dev; in ec_device_probe()
193 ec->cmd_offset = ec_platform->cmd_offset; in ec_device_probe()
194 ec->features.flags[0] = -1U; /* Not cached yet */ in ec_device_probe()
195 ec->features.flags[1] = -1U; /* Not cached yet */ in ec_device_probe()
196 device_initialize(&ec->class_dev); in ec_device_probe()
203 if (cros_ec_check_features(ec, cros_mcu_devices[i].id)) { in ec_device_probe()
218 ec->class_dev.class = &cros_class; in ec_device_probe()
219 ec->class_dev.parent = dev; in ec_device_probe()
220 ec->class_dev.release = cros_ec_class_release; in ec_device_probe()
222 retval = dev_set_name(&ec->class_dev, "%s", ec_platform->ec_name); in ec_device_probe()
228 retval = device_add(&ec->class_dev); in ec_device_probe()
233 if (cros_ec_get_sensor_count(ec) > 0) { in ec_device_probe()
234 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
238 dev_err(ec->dev, "failed to add %s subdevice: %d\n", in ec_device_probe()
247 if (cros_ec_check_features(ec, cros_subdevices[i].id)) { in ec_device_probe()
248 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
252 dev_err(ec->dev, in ec_device_probe()
263 if (cros_ec_check_features(ec, EC_FEATURE_USB_PD) && in ec_device_probe()
264 !cros_ec_check_features(ec, EC_FEATURE_UCSI_PPM)) { in ec_device_probe()
265 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
270 dev_warn(ec->dev, "failed to add usbpd-charger: %d\n", in ec_device_probe()
278 if (cros_ec_check_features(ec, EC_FEATURE_LIGHTBAR) || in ec_device_probe()
280 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
284 dev_warn(ec->dev, "failed to add lightbar: %d\n", in ec_device_probe()
293 if (IS_ENABLED(CONFIG_OF) && ec->ec_dev->dev->of_node) { in ec_device_probe()
294 if (cros_ec_check_features(ec, EC_FEATURE_USB_PD)) { in ec_device_probe()
295 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
299 dev_err(ec->dev, in ec_device_probe()
309 retval = cros_ec_cmd(ec->ec_dev, 0, EC_CMD_PCHG_COUNT, NULL, 0, in ec_device_probe()
312 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
316 dev_warn(ec->dev, "failed to add pchg: %d\n", in ec_device_probe()
324 retval = mfd_add_hotplug_devices(ec->dev, cros_ec_platform_cells, in ec_device_probe()
327 dev_warn(ec->dev, in ec_device_probe()
332 node = ec->ec_dev->dev->of_node; in ec_device_probe()
334 retval = mfd_add_hotplug_devices(ec->dev, cros_ec_vbc_cells, in ec_device_probe()
337 dev_warn(ec->dev, "failed to add VBC devices: %d\n", in ec_device_probe()
344 put_device(&ec->class_dev); in ec_device_probe()
350 struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev); in ec_device_remove() local
352 mfd_remove_devices(ec->dev); in ec_device_remove()
353 device_unregister(&ec->class_dev); in ec_device_remove()