Lines Matching refs:ec

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()
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()
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()
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()