Skip to content

Commit 3144dce

Browse files
Enric Balletbo i SerraLee Jones
authored andcommitted
mfd: cros_ec_dev: Register cros_usbpd-charger driver as a subdevice.
Check whether this EC instance has USBPD host command support and instatiate the cros_usbpd-charger driver as a subdevice in such case. Signed-off-by: Enric Balletbo i Serra <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent 0663589 commit 3144dce

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

drivers/mfd/cros_ec_dev.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,10 @@ static const struct mfd_cell cros_ec_rtc_cells[] = {
381381
{ .name = "cros-ec-rtc" }
382382
};
383383

384+
static const struct mfd_cell cros_usbpd_charger_cells[] = {
385+
{ .name = "cros-usbpd-charger" }
386+
};
387+
384388
static int ec_device_probe(struct platform_device *pdev)
385389
{
386390
int retval = -ENOMEM;
@@ -431,6 +435,18 @@ static int ec_device_probe(struct platform_device *pdev)
431435
retval);
432436
}
433437

438+
/* Check whether this EC instance has the PD charge manager */
439+
if (cros_ec_check_features(ec, EC_FEATURE_USB_PD)) {
440+
retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
441+
cros_usbpd_charger_cells,
442+
ARRAY_SIZE(cros_usbpd_charger_cells),
443+
NULL, 0, NULL);
444+
if (retval)
445+
dev_err(ec->dev,
446+
"failed to add cros-usbpd-charger device: %d\n",
447+
retval);
448+
}
449+
434450
/* Take control of the lightbar from the EC. */
435451
lb_manual_suspend_ctrl(ec, 1);
436452

0 commit comments

Comments
 (0)