Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <enric.balletbo@collabora.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Enric Balletbo i Serra and committed by
Lee Jones
3144dce7 06635894

+16
+16
drivers/mfd/cros_ec_dev.c
··· 381 381 { .name = "cros-ec-rtc" } 382 382 }; 383 383 384 + static const struct mfd_cell cros_usbpd_charger_cells[] = { 385 + { .name = "cros-usbpd-charger" } 386 + }; 387 + 384 388 static int ec_device_probe(struct platform_device *pdev) 385 389 { 386 390 int retval = -ENOMEM; ··· 432 428 if (retval) 433 429 dev_err(ec->dev, 434 430 "failed to add cros-ec-rtc device: %d\n", 431 + retval); 432 + } 433 + 434 + /* Check whether this EC instance has the PD charge manager */ 435 + if (cros_ec_check_features(ec, EC_FEATURE_USB_PD)) { 436 + retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO, 437 + cros_usbpd_charger_cells, 438 + ARRAY_SIZE(cros_usbpd_charger_cells), 439 + NULL, 0, NULL); 440 + if (retval) 441 + dev_err(ec->dev, 442 + "failed to add cros-usbpd-charger device: %d\n", 435 443 retval); 436 444 } 437 445