Lines Matching full:ec
20 #define DRV_NAME "cros-ec-dev"
80 { .name = "cros-ec-cec", },
84 { .name = "cros-ec-rtc", },
88 { .name = "cros-ec-sensorhub", },
119 { .name = "cros-ec-chardev", },
120 { .name = "cros-ec-debugfs", },
121 { .name = "cros-ec-sysfs", },
125 { .name = "cros-ec-pchg", },
129 { .name = "cros-ec-lightbar", }
133 { .name = "cros-ec-vbc", }
147 struct cros_ec_dev *ec = kzalloc(sizeof(*ec), GFP_KERNEL); in ec_device_probe() local
151 if (!ec) in ec_device_probe()
154 dev_set_drvdata(dev, ec); in ec_device_probe()
155 ec->ec_dev = dev_get_drvdata(dev->parent); in ec_device_probe()
156 ec->dev = dev; in ec_device_probe()
157 ec->cmd_offset = ec_platform->cmd_offset; in ec_device_probe()
158 ec->features.flags[0] = -1U; /* Not cached yet */ in ec_device_probe()
159 ec->features.flags[1] = -1U; /* Not cached yet */ in ec_device_probe()
160 device_initialize(&ec->class_dev); in ec_device_probe()
165 * than an standard EC. in ec_device_probe()
167 if (cros_ec_check_features(ec, cros_mcu_devices[i].id)) { in ec_device_probe()
182 ec->class_dev.class = &cros_class; in ec_device_probe()
183 ec->class_dev.parent = dev; in ec_device_probe()
184 ec->class_dev.release = cros_ec_class_release; in ec_device_probe()
186 retval = dev_set_name(&ec->class_dev, "%s", ec_platform->ec_name); in ec_device_probe()
192 retval = device_add(&ec->class_dev); in ec_device_probe()
196 /* check whether this EC is a sensor hub. */ in ec_device_probe()
197 if (cros_ec_get_sensor_count(ec) > 0) { in ec_device_probe()
198 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
202 dev_err(ec->dev, "failed to add %s subdevice: %d\n", in ec_device_probe()
211 if (cros_ec_check_features(ec, cros_subdevices[i].id)) { in ec_device_probe()
212 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
216 dev_err(ec->dev, in ec_device_probe()
227 if (cros_ec_check_features(ec, EC_FEATURE_LIGHTBAR) || in ec_device_probe()
229 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
233 dev_warn(ec->dev, "failed to add lightbar: %d\n", in ec_device_probe()
242 if (IS_ENABLED(CONFIG_OF) && ec->ec_dev->dev->of_node) { in ec_device_probe()
243 if (cros_ec_check_features(ec, EC_FEATURE_USB_PD)) { 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()
258 retval = cros_ec_cmd(ec->ec_dev, 0, EC_CMD_PCHG_COUNT, NULL, 0, in ec_device_probe()
261 retval = mfd_add_hotplug_devices(ec->dev, in ec_device_probe()
265 dev_warn(ec->dev, "failed to add pchg: %d\n", in ec_device_probe()
273 retval = mfd_add_hotplug_devices(ec->dev, cros_ec_platform_cells, in ec_device_probe()
276 dev_warn(ec->dev, in ec_device_probe()
277 "failed to add cros-ec platform devices: %d\n", in ec_device_probe()
280 /* Check whether this EC instance has a VBC NVRAM */ in ec_device_probe()
281 node = ec->ec_dev->dev->of_node; in ec_device_probe()
283 retval = mfd_add_hotplug_devices(ec->dev, cros_ec_vbc_cells, in ec_device_probe()
286 dev_warn(ec->dev, "failed to add VBC devices: %d\n", in ec_device_probe()
293 put_device(&ec->class_dev); in ec_device_probe()
299 struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev); in ec_device_remove() local
301 mfd_remove_devices(ec->dev); in ec_device_remove()
302 device_unregister(&ec->class_dev); in ec_device_remove()