Lines Matching refs:ec
139 struct cros_ec_dev *ec = kzalloc(sizeof(*ec), GFP_KERNEL); in ec_device_probe() local
142 if (!ec) in ec_device_probe()
145 dev_set_drvdata(dev, ec); in ec_device_probe()
146 ec->ec_dev = dev_get_drvdata(dev->parent); in ec_device_probe()
147 ec->dev = dev; in ec_device_probe()
148 ec->cmd_offset = ec_platform->cmd_offset; in ec_device_probe()
149 ec->features.flags[0] = -1U; /* Not cached yet */ in ec_device_probe()
150 ec->features.flags[1] = -1U; /* Not cached yet */ in ec_device_probe()
151 device_initialize(&ec->class_dev); in ec_device_probe()
158 if (cros_ec_check_features(ec, cros_mcu_devices[i].id)) { in ec_device_probe()
173 ec->class_dev.class = &cros_class; in ec_device_probe()
174 ec->class_dev.parent = dev; in ec_device_probe()
175 ec->class_dev.release = cros_ec_class_release; in ec_device_probe()
177 retval = dev_set_name(&ec->class_dev, "%s", ec_platform->ec_name); in ec_device_probe()
183 retval = device_add(&ec->class_dev); in ec_device_probe()
188 if (cros_ec_get_sensor_count(ec) > 0) { in ec_device_probe()
189 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
193 dev_err(ec->dev, "failed to add %s subdevice: %d\n", in ec_device_probe()
202 if (cros_ec_check_features(ec, cros_subdevices[i].id)) { in ec_device_probe()
203 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
207 dev_err(ec->dev, in ec_device_probe()
218 if (cros_ec_check_features(ec, EC_FEATURE_LIGHTBAR) || in ec_device_probe()
220 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
224 dev_warn(ec->dev, "failed to add lightbar: %d\n", in ec_device_probe()
233 if (IS_ENABLED(CONFIG_OF) && ec->ec_dev->dev->of_node) { in ec_device_probe()
234 if (cros_ec_check_features(ec, EC_FEATURE_USB_PD)) { in ec_device_probe()
235 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
239 dev_err(ec->dev, in ec_device_probe()
249 retval = mfd_add_hotplug_devices(ec->dev, cros_ec_platform_cells, in ec_device_probe()
252 dev_warn(ec->dev, in ec_device_probe()
257 node = ec->ec_dev->dev->of_node; in ec_device_probe()
259 retval = mfd_add_hotplug_devices(ec->dev, cros_ec_vbc_cells, in ec_device_probe()
262 dev_warn(ec->dev, "failed to add VBC devices: %d\n", in ec_device_probe()
269 put_device(&ec->class_dev); in ec_device_probe()
275 struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev); in ec_device_remove() local
277 mfd_remove_devices(ec->dev); in ec_device_remove()
278 device_unregister(&ec->class_dev); in ec_device_remove()