drivers/nfc/s3fwrn5/phy_common.c
Source file repositories/reference/linux-study-clean/drivers/nfc/s3fwrn5/phy_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/nfc/s3fwrn5/phy_common.c- Extension
.c- Size
- 1576 bytes
- Lines
- 76
- Domain
- Driver Families
- Bucket
- drivers/nfc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/module.hphy_common.h
Detected Declarations
function Copyrightfunction s3fwrn5_phy_power_ctrlfunction s3fwrn5_phy_set_modefunction s3fwrn5_phy_get_modeexport s3fwrn5_phy_set_wakeexport s3fwrn5_phy_power_ctrlexport s3fwrn5_phy_set_modeexport s3fwrn5_phy_get_mode
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Link Layer for Samsung S3FWRN5 NCI based Driver
*
* Copyright (C) 2015 Samsung Electronics
* Robert Baldyga <r.baldyga@samsung.com>
* Copyright (C) 2020 Samsung Electronics
* Bongsu Jeon <bongsu.jeon@samsung.com>
*/
#include <linux/delay.h>
#include <linux/module.h>
#include "phy_common.h"
void s3fwrn5_phy_set_wake(void *phy_id, bool wake)
{
struct phy_common *phy = phy_id;
mutex_lock(&phy->mutex);
gpiod_set_value(phy->gpio_fw_wake, wake);
if (wake)
msleep(S3FWRN5_EN_WAIT_TIME);
mutex_unlock(&phy->mutex);
}
EXPORT_SYMBOL(s3fwrn5_phy_set_wake);
bool s3fwrn5_phy_power_ctrl(struct phy_common *phy, enum s3fwrn5_mode mode)
{
if (phy->mode == mode)
return false;
phy->mode = mode;
gpiod_set_value(phy->gpio_en, 1);
gpiod_set_value(phy->gpio_fw_wake, 0);
if (mode == S3FWRN5_MODE_FW)
gpiod_set_value(phy->gpio_fw_wake, 1);
if (mode != S3FWRN5_MODE_COLD) {
msleep(S3FWRN5_EN_WAIT_TIME);
gpiod_set_value(phy->gpio_en, 0);
msleep(S3FWRN5_EN_WAIT_TIME);
}
return true;
}
EXPORT_SYMBOL(s3fwrn5_phy_power_ctrl);
void s3fwrn5_phy_set_mode(void *phy_id, enum s3fwrn5_mode mode)
{
struct phy_common *phy = phy_id;
mutex_lock(&phy->mutex);
s3fwrn5_phy_power_ctrl(phy, mode);
mutex_unlock(&phy->mutex);
}
EXPORT_SYMBOL(s3fwrn5_phy_set_mode);
enum s3fwrn5_mode s3fwrn5_phy_get_mode(void *phy_id)
{
struct phy_common *phy = phy_id;
enum s3fwrn5_mode mode;
mutex_lock(&phy->mutex);
mode = phy->mode;
mutex_unlock(&phy->mutex);
return mode;
}
EXPORT_SYMBOL(s3fwrn5_phy_get_mode);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/module.h`, `phy_common.h`.
- Detected declarations: `function Copyright`, `function s3fwrn5_phy_power_ctrl`, `function s3fwrn5_phy_set_mode`, `function s3fwrn5_phy_get_mode`, `export s3fwrn5_phy_set_wake`, `export s3fwrn5_phy_power_ctrl`, `export s3fwrn5_phy_set_mode`, `export s3fwrn5_phy_get_mode`.
- Atlas domain: Driver Families / drivers/nfc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.