drivers/net/wireless/ath/ath10k/leds.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath10k/leds.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath10k/leds.c- Extension
.c- Size
- 1916 bytes
- Lines
- 84
- Domain
- Driver Families
- Bucket
- drivers/net
- 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.
- 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/leds.hcore.hwmi.hwmi-ops.hleds.h
Detected Declarations
function Copyrightfunction ath10k_leds_startfunction ath10k_leds_registerfunction ath10k_leds_unregister
Annotated Snippet
// SPDX-License-Identifier: ISC
/*
* Copyright (c) 2005-2011 Atheros Communications Inc.
* Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
* Copyright (c) 2018 Sebastian Gottschall <s.gottschall@dd-wrt.com>
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*/
#include <linux/leds.h>
#include "core.h"
#include "wmi.h"
#include "wmi-ops.h"
#include "leds.h"
static int ath10k_leds_set_brightness_blocking(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
struct ath10k *ar = container_of(led_cdev, struct ath10k,
leds.cdev);
mutex_lock(&ar->conf_mutex);
if (ar->state != ATH10K_STATE_ON)
goto out;
ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, brightness == LED_OFF);
out:
mutex_unlock(&ar->conf_mutex);
return 0;
}
int ath10k_leds_start(struct ath10k *ar)
{
if (ar->hw_params.led_pin == 0)
/* leds not supported */
return 0;
/* under some circumstances, the gpio pin gets reconfigured
* to default state by the firmware, so we need to
* reconfigure it this behaviour has only ben seen on
* QCA9984 and QCA99XX devices so far
*/
ath10k_wmi_gpio_config(ar, ar->hw_params.led_pin, 0,
WMI_GPIO_PULL_NONE, WMI_GPIO_INTTYPE_DISABLE);
ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, 1);
return 0;
}
int ath10k_leds_register(struct ath10k *ar)
{
int ret;
if (ar->hw_params.led_pin == 0)
/* leds not supported */
return 0;
snprintf(ar->leds.label, sizeof(ar->leds.label), "ath10k-%s",
wiphy_name(ar->hw->wiphy));
ar->leds.cdev.name = ar->leds.label;
ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking;
ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev);
if (ret)
return ret;
return 0;
}
void ath10k_leds_unregister(struct ath10k *ar)
{
if (ar->hw_params.led_pin == 0)
/* leds not supported */
return;
led_classdev_unregister(&ar->leds.cdev);
}
Annotation
- Immediate include surface: `linux/leds.h`, `core.h`, `wmi.h`, `wmi-ops.h`, `leds.h`.
- Detected declarations: `function Copyright`, `function ath10k_leds_start`, `function ath10k_leds_register`, `function ath10k_leds_unregister`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.