Lines Matching +full:embedded +full:- +full:controller

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * cros_ec_dev - expose the Chrome OS Embedded Controller to user-space
20 #define DRV_NAME "cros-ec-dev"
28 * struct cros_feature_to_name - CrOS feature id to name/short description.
40 * struct cros_feature_to_cells - CrOS feature id to mfd cells association.
80 { .name = "cros-ec-cec", },
84 { .name = "cros-ec-rtc", },
88 { .name = "cros-ec-sensorhub", },
92 { .name = "cros-usbpd-charger", },
93 { .name = "cros-usbpd-logger", },
97 { .name = "cros-usbpd-notify", },
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", }
143 int retval = -ENOMEM; in ec_device_probe()
145 struct device *dev = &pdev->dev; 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()
174 ec_platform->ec_name = cros_mcu_devices[i].name; 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()
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()
203 cros_ec_sensorhub_cells->name, retval); in ec_device_probe()
208 * EC_FEATURE_GET_CMD Embedded Controller device. 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()
218 cros_subdevices[i].mfd_cells->name, 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()
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()
271 * EC_FEATURE_GET_CMD to the Embedded Controller device. 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()
281 node = ec->ec_dev->dev->of_node; in ec_device_probe()
282 if (of_property_read_bool(node, "google,has-vbc-nvram")) { 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()
301 mfd_remove_devices(ec->dev); in ec_device_remove()
302 device_unregister(&ec->class_dev); in ec_device_remove()
354 MODULE_DESCRIPTION("Userspace interface to the Chrome OS Embedded Controller");