drivers/platform/x86/meegopad_anx7428.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/meegopad_anx7428.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/meegopad_anx7428.c- Extension
.c- Size
- 4787 bytes
- Lines
- 151
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/bits.hlinux/delay.hlinux/dev_printk.hlinux/dmi.hlinux/err.hlinux/gpio/consumer.hlinux/i2c.hlinux/iopoll.hlinux/module.hlinux/types.h
Detected Declarations
function anx7428_probe
Annotated Snippet
// 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>
*/
#include <linux/acpi.h>
#include <linux/bits.h>
#include <linux/delay.h>
#include <linux/dev_printk.h>
#include <linux/dmi.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/types.h>
/* Register addresses and fields */
#define VENDOR_ID 0x00
#define DEVICE_ID 0x02
#define TX_STATUS 0x16
#define STATUS_SUCCESS BIT(0)
#define STATUS_ERROR BIT(1)
#define OCM_STARTUP BIT(7)
static bool force;
module_param(force, bool, 0444);
MODULE_PARM_DESC(force, "Force the driver to probe on unknown boards");
static const struct acpi_gpio_params enable_gpio = { 0, 0, false };
static const struct acpi_gpio_params reset_gpio = { 1, 0, true };
static const struct acpi_gpio_mapping meegopad_anx7428_gpios[] = {
{ "enable-gpios", &enable_gpio, 1 },
{ "reset-gpios", &reset_gpio, 1 },
{ }
};
static const struct dmi_system_id meegopad_anx7428_ids[] = {
{
/* Meegopad T08 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Default string"),
DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"),
DMI_MATCH(DMI_BOARD_VERSION, "V1.1"),
},
},
{ }
};
static int anx7428_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct gpio_desc *gpio;
int ret, val;
if (!dmi_check_system(meegopad_anx7428_ids) && !force) {
dev_warn(dev, "Not probing unknown board, pass meegopad_anx7428.force=1 to probe");
return -ENODEV;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/bits.h`, `linux/delay.h`, `linux/dev_printk.h`, `linux/dmi.h`, `linux/err.h`, `linux/gpio/consumer.h`, `linux/i2c.h`.
- Detected declarations: `function anx7428_probe`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.