// SPDX-License-Identifier: GPL-2.0-or-later /* * Driver to power on the Analogix ANX7428 USB Type-C crosspoint switch * on MeeGoPad top-set boxes. * * The MeeGoPad T8 and T9 are Cherry Trail top-set boxes which * use an ANX7428 to provide a Type-C port with USB3.1 Gen 1 and * DisplayPort over Type-C alternate mode support. * * The ANX7428 has a microcontroller which takes care of the PD * negotiation and automatically sets the builtin Crosspoint Switch * to send the right signal to the 4 highspeed pairs of the Type-C * connector. It also takes care of HPD and AUX channel routing for * DP alternate mode. * * IOW the ANX7428 operates fully autonomous and to the x5-Z8350 SoC * things look like there simply is a USB-3 Type-A connector and a * separate DisplayPort connector. Except that the BIOS does not * power on the ANX7428 at boot. This driver takes care of powering * on the ANX7428. * * It should be possible to tell the micro-controller which data- and/or * power-role to negotiate and to swap the role(s) after negotiation * but the MeeGoPad top-set boxes always draw their power from a separate * power-connector and they only support USB host-mode. So this functionality * is unnecessary and due to lack of documentation this is tricky to support. * * For a more complete ANX7428 driver see drivers/usb/misc/anx7418/ of * the LineageOS kernel for the LG G5 (International) aka the LG H850: * https://github.com/LineageOS/android_kernel_lge_msm8996/ * * (C) Copyright 2024 Hans de Goede <hansg@kernel.org>
*/
if (!dmi_check_system(meegopad_anx7428_ids) && !force) {
dev_warn(dev, "Not probing unknown board, pass meegopad_anx7428.force=1 to probe"); return -ENODEV;
}
ret = devm_acpi_dev_add_driver_gpios(dev, meegopad_anx7428_gpios); if (ret) return ret;
/* * Set GPIOs to desired values while getting them, they are not needed * afterwards. Ordering and delays come from android_kernel_lge_msm8996.
*/
gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH); if (IS_ERR(gpio)) return dev_err_probe(dev, PTR_ERR(gpio), "getting enable GPIO\n");
/* Wait for the OCM (On Chip Microcontroller) to start */
ret = read_poll_timeout(i2c_smbus_read_byte_data, val,
val >= 0 && (val & OCM_STARTUP),
5000, 50000, true, client, TX_STATUS); if (ret) return dev_err_probe(dev, ret, "On Chip Microcontroller did not start, status: 0x%02x\n",
val);
ret = i2c_smbus_read_word_data(client, VENDOR_ID); if (ret < 0) return dev_err_probe(dev, ret, "reading vendor-id register\n");
val = ret;
ret = i2c_smbus_read_word_data(client, DEVICE_ID); if (ret < 0) return dev_err_probe(dev, ret, "reading device-id register\n");
dev_dbg(dev, "Powered on ANX7428 id %04x:%04x\n", val, ret); return 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.