Lines Matching +full:data +full:- +full:role

1 // SPDX-License-Identifier: GPL-2.0
12 * 3. FUSB302 USB Type-C Controller
16 * instantiate I²C clients for chips 2 - 4, so that standard I²C drivers
38 * Grrr, I severely dislike buggy BIOS-es. At least one BIOS enumerates
45 static int cht_int33fe_check_for_max17047(struct device *dev, void *data) in cht_int33fe_check_for_max17047() argument
47 struct i2c_client **max17047 = data; in cht_int33fe_check_for_max17047()
62 static const char * const max17047_suppliers[] = { "bq24190-charger" };
65 PROPERTY_ENTRY_STRING_ARRAY("supplied-from", max17047_suppliers),
84 PROPERTY_ENTRY_STRING("linux,extcon-name", "cht_wcove_pwrsrc"),
85 PROPERTY_ENTRY_REF_ARRAY("usb-role-switch", fusb302_mux_refs),
115 PROPERTY_ENTRY_STRING("data-role", "dual"),
116 PROPERTY_ENTRY_STRING("power-role", "dual"),
117 PROPERTY_ENTRY_STRING("try-power-role", "sink"),
118 PROPERTY_ENTRY_U32_ARRAY("source-pdos", src_pdo),
119 PROPERTY_ENTRY_U32_ARRAY("sink-pdos", snk_pdo),
120 PROPERTY_ENTRY_U32("op-sink-microwatt", 2500000),
121 PROPERTY_ENTRY_REF("orientation-switch", &pi3usb30532_node),
122 PROPERTY_ENTRY_REF("mode-switch", &pi3usb30532_node),
145 .name = "displayport-altmode",
161 static int cht_int33fe_setup_dp(struct cht_int33fe_data *data) in cht_int33fe_setup_dp() argument
168 return -ENODEV; in cht_int33fe_setup_dp()
172 if (!pdev || pdev->vendor != PCI_VENDOR_ID_INTEL) { in cht_int33fe_setup_dp()
174 return -ENODEV; in cht_int33fe_setup_dp()
177 /* Then the DP-2 child device node */ in cht_int33fe_setup_dp()
178 data->dp = device_get_named_child_node(&pdev->dev, "DD04"); in cht_int33fe_setup_dp()
180 if (!data->dp) in cht_int33fe_setup_dp()
181 return -ENODEV; in cht_int33fe_setup_dp()
183 fwnode->secondary = ERR_PTR(-ENODEV); in cht_int33fe_setup_dp()
184 data->dp->secondary = fwnode; in cht_int33fe_setup_dp()
189 static void cht_int33fe_remove_nodes(struct cht_int33fe_data *data) in cht_int33fe_remove_nodes() argument
193 if (data->dp) { in cht_int33fe_remove_nodes()
194 data->dp->secondary = NULL; in cht_int33fe_remove_nodes()
195 fwnode_handle_put(data->dp); in cht_int33fe_remove_nodes()
196 data->dp = NULL; in cht_int33fe_remove_nodes()
200 static void cht_int33fe_put_swnode(void *data) in cht_int33fe_put_swnode() argument
202 struct fwnode_handle *fwnode = data; in cht_int33fe_put_swnode()
208 static int cht_int33fe_add_nodes(struct device *dev, struct cht_int33fe_data *data) in cht_int33fe_add_nodes() argument
214 * There is no ACPI device node for the USB role mux, so we need to wait in cht_int33fe_add_nodes()
217 * -EPROBE_DEFER until the mux device is registered. in cht_int33fe_add_nodes()
219 * FIXME: the relevant software node exists in intel-xhci-usb-role-switch in cht_int33fe_add_nodes()
220 * and - if exported - could be used to set up a static reference. in cht_int33fe_add_nodes()
222 mux_ref_node = software_node_find_by_name(NULL, "intel-xhci-usb-sw"); in cht_int33fe_add_nodes()
224 return -EPROBE_DEFER; in cht_int33fe_add_nodes()
232 * Update node used in "usb-role-switch" property. Note that we in cht_int33fe_add_nodes()
248 ret = cht_int33fe_setup_dp(data); in cht_int33fe_add_nodes()
255 cht_int33fe_remove_nodes(data); in cht_int33fe_add_nodes()
261 cht_int33fe_register_max17047(struct device *dev, struct cht_int33fe_data *data) in cht_int33fe_register_max17047() argument
270 return -ENODEV; in cht_int33fe_register_max17047()
274 /* Pre-existing I²C client for the max17047, add device properties */ in cht_int33fe_register_max17047()
275 set_secondary_fwnode(&max17047->dev, fwnode); in cht_int33fe_register_max17047()
276 /* And re-probe to get the new device properties applied */ in cht_int33fe_register_max17047()
277 ret = device_reprobe(&max17047->dev); in cht_int33fe_register_max17047()
287 data->battery_fg = i2c_acpi_new_device(dev, 1, &board_info); in cht_int33fe_register_max17047()
289 return PTR_ERR_OR_ZERO(data->battery_fg); in cht_int33fe_register_max17047()
298 * DMI decode dumps from linux-hardware.org only 116 have
316 struct device *dev = &pdev->dev; in cht_int33fe_typec_probe()
317 struct cht_int33fe_data *data; in cht_int33fe_typec_probe() local
324 return -ENODEV; in cht_int33fe_typec_probe()
326 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); in cht_int33fe_typec_probe()
327 if (!data) in cht_int33fe_typec_probe()
328 return -ENOMEM; in cht_int33fe_typec_probe()
331 * We expect the WC PMIC to be paired with a TI bq24292i charger-IC. in cht_int33fe_typec_probe()
334 * max-snk voltage to 12V with another charger-IC is not good. in cht_int33fe_typec_probe()
336 * regulator-map, which is part of the bq24292i regulator_init_data, in cht_int33fe_typec_probe()
338 * it will end up with a dummy-regulator. in cht_int33fe_typec_probe()
340 * which is defined in i2c-cht-wc.c from where the bq24292i I²C client in cht_int33fe_typec_probe()
342 * don't end up getting a dummy-regulator ourselves. in cht_int33fe_typec_probe()
347 return (ret == -ENODEV) ? -EPROBE_DEFER : ret; in cht_int33fe_typec_probe()
354 if (fusb302_irq != -EPROBE_DEFER) in cht_int33fe_typec_probe()
359 ret = cht_int33fe_add_nodes(dev, data); in cht_int33fe_typec_probe()
364 ret = cht_int33fe_register_max17047(dev, data); in cht_int33fe_typec_probe()
370 ret = -ENODEV; in cht_int33fe_typec_probe()
380 data->fusb302 = i2c_acpi_new_device(dev, 2, &board_info); in cht_int33fe_typec_probe()
381 if (IS_ERR(data->fusb302)) { in cht_int33fe_typec_probe()
382 ret = PTR_ERR(data->fusb302); in cht_int33fe_typec_probe()
388 ret = -ENODEV; in cht_int33fe_typec_probe()
397 data->pi3usb30532 = i2c_acpi_new_device(dev, 3, &board_info); in cht_int33fe_typec_probe()
398 if (IS_ERR(data->pi3usb30532)) { in cht_int33fe_typec_probe()
399 ret = PTR_ERR(data->pi3usb30532); in cht_int33fe_typec_probe()
403 platform_set_drvdata(pdev, data); in cht_int33fe_typec_probe()
408 i2c_unregister_device(data->fusb302); in cht_int33fe_typec_probe()
411 i2c_unregister_device(data->battery_fg); in cht_int33fe_typec_probe()
414 cht_int33fe_remove_nodes(data); in cht_int33fe_typec_probe()
421 struct cht_int33fe_data *data = platform_get_drvdata(pdev); in cht_int33fe_typec_remove() local
423 i2c_unregister_device(data->pi3usb30532); in cht_int33fe_typec_remove()
424 i2c_unregister_device(data->fusb302); in cht_int33fe_typec_remove()
425 i2c_unregister_device(data->battery_fg); in cht_int33fe_typec_remove()
427 cht_int33fe_remove_nodes(data); in cht_int33fe_typec_remove()
437 .name = "Intel Cherry Trail ACPI INT33FE Type-C driver",
446 MODULE_DESCRIPTION("Intel Cherry Trail ACPI INT33FE Type-C pseudo device driver");