drivers/pinctrl/mediatek/pinctrl-mt76x8.c

Source file repositories/reference/linux-study-clean/drivers/pinctrl/mediatek/pinctrl-mt76x8.c

File Facts

System
Linux kernel
Corpus path
drivers/pinctrl/mediatek/pinctrl-mt76x8.c
Extension
.c
Size
7264 bytes
Lines
250
Domain
Driver Families
Bucket
drivers/pinctrl
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.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only

#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include "pinctrl-mtmips.h"

#define MT76X8_GPIO_MODE_MASK		0x3

#define MT76X8_GPIO_MODE_P4LED_KN	58
#define MT76X8_GPIO_MODE_P3LED_KN	56
#define MT76X8_GPIO_MODE_P2LED_KN	54
#define MT76X8_GPIO_MODE_P1LED_KN	52
#define MT76X8_GPIO_MODE_P0LED_KN	50
#define MT76X8_GPIO_MODE_WLED_KN	48
#define MT76X8_GPIO_MODE_P4LED_AN	42
#define MT76X8_GPIO_MODE_P3LED_AN	40
#define MT76X8_GPIO_MODE_P2LED_AN	38
#define MT76X8_GPIO_MODE_P1LED_AN	36
#define MT76X8_GPIO_MODE_P0LED_AN	34
#define MT76X8_GPIO_MODE_WLED_AN	32
#define MT76X8_GPIO_MODE_PWM1		30
#define MT76X8_GPIO_MODE_PWM0		28
#define MT76X8_GPIO_MODE_UART2		26
#define MT76X8_GPIO_MODE_UART1		24
#define MT76X8_GPIO_MODE_I2C		20
#define MT76X8_GPIO_MODE_REFCLK		18
#define MT76X8_GPIO_MODE_PERST		16
#define MT76X8_GPIO_MODE_WDT		14
#define MT76X8_GPIO_MODE_SPI		12
#define MT76X8_GPIO_MODE_SDMODE		10
#define MT76X8_GPIO_MODE_UART0		8
#define MT76X8_GPIO_MODE_I2S		6
#define MT76X8_GPIO_MODE_CS1		4
#define MT76X8_GPIO_MODE_SPIS		2
#define MT76X8_GPIO_MODE_GPIO		0

static struct mtmips_pmx_func pwm1_grp[] = {
	FUNC("sdxc d6", 3, 19, 1),
	FUNC("pwm1 utif", 2, 19, 1),
	FUNC("pwm1", 0, 19, 1),
};

static struct mtmips_pmx_func pwm0_grp[] = {
	FUNC("sdxc d7", 3, 18, 1),
	FUNC("pwm0 utif", 2, 18, 1),
	FUNC("pwm0", 0, 18, 1),
};

static struct mtmips_pmx_func uart2_grp[] = {
	FUNC("sdxc d5 d4", 3, 20, 2),
	FUNC("uart2 pwm", 2, 20, 2),
	FUNC("uart2", 0, 20, 2),
};

static struct mtmips_pmx_func uart1_grp[] = {
	FUNC("sw_r", 3, 45, 2),
	FUNC("uart1 pwm", 2, 45, 2),
	FUNC("uart1", 0, 45, 2),
};

static struct mtmips_pmx_func i2c_grp[] = {
	FUNC("debug", 2, 4, 2),
	FUNC("i2c", 0, 4, 2),
};

static struct mtmips_pmx_func refclk_grp[] = { FUNC("refclk", 0, 37, 1) };
static struct mtmips_pmx_func perst_grp[] = { FUNC("perst", 0, 36, 1) };
static struct mtmips_pmx_func wdt_grp[] = { FUNC("wdt", 0, 38, 1) };
static struct mtmips_pmx_func spi_grp[] = { FUNC("spi", 0, 7, 4) };

static struct mtmips_pmx_func sd_mode_grp[] = {
	FUNC("sdxc jtag", 3, 22, 8),
	FUNC("sdxc utif", 2, 22, 8),
	FUNC("sdxc", 0, 22, 8),
};

static struct mtmips_pmx_func uart0_grp[] = {
	FUNC("uart0", 0, 12, 2),
};

static struct mtmips_pmx_func i2s_grp[] = {
	FUNC("antenna", 3, 0, 4),
	FUNC("pcm", 2, 0, 4),
	FUNC("i2s", 0, 0, 4),
};

static struct mtmips_pmx_func spi_cs1_grp[] = {
	FUNC("spi refclk", 2, 6, 1),
	FUNC("spi cs1", 0, 6, 1),

Annotation

Implementation Notes