drivers/phy/motorola/phy-mapphone-mdm6600.c
Source file repositories/reference/linux-study-clean/drivers/phy/motorola/phy-mapphone-mdm6600.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/motorola/phy-mapphone-mdm6600.c- Extension
.c- Size
- 18475 bytes
- Lines
- 670
- Domain
- Driver Families
- Bucket
- drivers/phy
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/err.hlinux/io.hlinux/interrupt.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/slab.hlinux/gpio/consumer.hlinux/of_platform.hlinux/phy/phy.hlinux/pinctrl/consumer.h
Detected Declarations
struct phy_mdm6600struct phy_mdm6600_mapenum phy_mdm6600_ctrl_linesenum phy_mdm6600_bootmode_linesenum phy_mdm6600_cmd_linesenum phy_mdm6600_status_linesenum phy_mdm6600_cmdenum phy_mdm6600_statusfunction phy_mdm6600_initfunction phy_mdm6600_power_onfunction phy_mdm6600_power_offfunction phy_mdm6600_cmdfunction phy_mdm6600_statusfunction phy_mdm6600_irq_threadfunction phy_mdm6600_wakeirq_threadfunction phy_mdm6600_init_irqfunction phy_mdm6600_init_linesfunction phy_mdm6600_device_power_onfunction msecs_to_jiffiesfunction phy_mdm6600_device_power_offfunction msecs_to_jiffiesfunction phy_mdm6600_deferred_power_onfunction phy_mdm6600_wake_modemfunction phy_mdm6600_modem_wakefunction phy_mdm6600_runtime_suspendfunction phy_mdm6600_runtime_resumefunction phy_mdm6600_probefunction phy_mdm6600_remove
Annotated Snippet
struct phy_mdm6600 {
struct device *dev;
struct phy *generic_phy;
struct phy_provider *phy_provider;
struct gpio_desc *ctrl_gpios[PHY_MDM6600_NR_CTRL_LINES];
struct gpio_descs *mode_gpios;
struct gpio_descs *status_gpios;
struct gpio_descs *cmd_gpios;
struct delayed_work bootup_work;
struct delayed_work status_work;
struct delayed_work modem_wake_work;
struct completion ack;
bool enabled; /* mdm6600 phy enabled */
bool running; /* mdm6600 boot done */
bool awake; /* mdm6600 respnds on n_gsm */
int status;
};
static int phy_mdm6600_init(struct phy *x)
{
struct phy_mdm6600 *ddata = phy_get_drvdata(x);
struct gpio_desc *enable_gpio = ddata->ctrl_gpios[PHY_MDM6600_ENABLE];
if (!ddata->enabled)
return -EPROBE_DEFER;
gpiod_set_value_cansleep(enable_gpio, 0);
return 0;
}
static int phy_mdm6600_power_on(struct phy *x)
{
struct phy_mdm6600 *ddata = phy_get_drvdata(x);
struct gpio_desc *enable_gpio = ddata->ctrl_gpios[PHY_MDM6600_ENABLE];
if (!ddata->enabled)
return -ENODEV;
gpiod_set_value_cansleep(enable_gpio, 1);
/* Allow aggressive PM for USB, it's only needed for n_gsm port */
if (pm_runtime_enabled(&x->dev))
phy_pm_runtime_put(x);
return 0;
}
static int phy_mdm6600_power_off(struct phy *x)
{
struct phy_mdm6600 *ddata = phy_get_drvdata(x);
struct gpio_desc *enable_gpio = ddata->ctrl_gpios[PHY_MDM6600_ENABLE];
int error;
if (!ddata->enabled)
return -ENODEV;
/* Paired with phy_pm_runtime_put() in phy_mdm6600_power_on() */
if (pm_runtime_enabled(&x->dev)) {
error = phy_pm_runtime_get(x);
if (error < 0 && error != -EINPROGRESS)
dev_warn(ddata->dev, "%s: phy_pm_runtime_get: %i\n",
__func__, error);
}
gpiod_set_value_cansleep(enable_gpio, 0);
return 0;
}
static const struct phy_ops gpio_usb_ops = {
.init = phy_mdm6600_init,
.power_on = phy_mdm6600_power_on,
.power_off = phy_mdm6600_power_off,
.owner = THIS_MODULE,
};
/**
* phy_mdm6600_cmd() - send a command request to mdm6600
* @ddata: device driver data
* @val: value of cmd to be set
*
* Configures the three command request GPIOs to the specified value.
*/
static void phy_mdm6600_cmd(struct phy_mdm6600 *ddata, int val)
{
DECLARE_BITMAP(values, PHY_MDM6600_NR_CMD_LINES);
values[0] = val;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/err.h`, `linux/io.h`, `linux/interrupt.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/slab.h`.
- Detected declarations: `struct phy_mdm6600`, `struct phy_mdm6600_map`, `enum phy_mdm6600_ctrl_lines`, `enum phy_mdm6600_bootmode_lines`, `enum phy_mdm6600_cmd_lines`, `enum phy_mdm6600_status_lines`, `enum phy_mdm6600_cmd`, `enum phy_mdm6600_status`, `function phy_mdm6600_init`, `function phy_mdm6600_power_on`.
- Atlas domain: Driver Families / drivers/phy.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.