Lines Matching refs:ec

134 	struct cros_ec_dev *ec = kzalloc(sizeof(*ec), GFP_KERNEL);  in ec_device_probe()  local
137 if (!ec) in ec_device_probe()
140 dev_set_drvdata(dev, ec); in ec_device_probe()
141 ec->ec_dev = dev_get_drvdata(dev->parent); in ec_device_probe()
142 ec->dev = dev; in ec_device_probe()
143 ec->cmd_offset = ec_platform->cmd_offset; in ec_device_probe()
144 ec->features[0] = -1U; /* Not cached yet */ in ec_device_probe()
145 ec->features[1] = -1U; /* Not cached yet */ in ec_device_probe()
146 device_initialize(&ec->class_dev); in ec_device_probe()
153 if (cros_ec_check_features(ec, cros_mcu_devices[i].id)) { in ec_device_probe()
168 ec->class_dev.class = &cros_class; in ec_device_probe()
169 ec->class_dev.parent = dev; in ec_device_probe()
170 ec->class_dev.release = cros_ec_class_release; in ec_device_probe()
172 retval = dev_set_name(&ec->class_dev, "%s", ec_platform->ec_name); in ec_device_probe()
178 retval = device_add(&ec->class_dev); in ec_device_probe()
183 if (cros_ec_get_sensor_count(ec) > 0) { in ec_device_probe()
184 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
188 dev_err(ec->dev, "failed to add %s subdevice: %d\n", in ec_device_probe()
197 if (cros_ec_check_features(ec, cros_subdevices[i].id)) { in ec_device_probe()
198 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
202 dev_err(ec->dev, in ec_device_probe()
214 if (IS_ENABLED(CONFIG_OF) && ec->ec_dev->dev->of_node) { in ec_device_probe()
215 if (cros_ec_check_features(ec, EC_FEATURE_USB_PD)) { in ec_device_probe()
216 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
220 dev_err(ec->dev, in ec_device_probe()
230 retval = mfd_add_hotplug_devices(ec->dev, cros_ec_platform_cells, in ec_device_probe()
233 dev_warn(ec->dev, in ec_device_probe()
238 node = ec->ec_dev->dev->of_node; in ec_device_probe()
240 retval = mfd_add_hotplug_devices(ec->dev, cros_ec_vbc_cells, in ec_device_probe()
243 dev_warn(ec->dev, "failed to add VBC devices: %d\n", in ec_device_probe()
250 put_device(&ec->class_dev); in ec_device_probe()
256 struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev); in ec_device_remove() local
258 mfd_remove_devices(ec->dev); in ec_device_remove()
259 device_unregister(&ec->class_dev); in ec_device_remove()