drivers/pinctrl/mediatek/pinctrl-mt6893.c

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

File Facts

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

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2019 MediaTek Inc.
 * Copyright (C) 2024 Collabora Ltd.
 *                    AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
 */

#include <linux/module.h>
#include "pinctrl-mtk-mt6893.h"
#include "pinctrl-paris.h"

#define PIN_FIELD_BASE(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits)  \
	PIN_FIELD_CALC(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits, \
		32, 0)

#define PINS_FIELD_BASE(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits) \
	PIN_FIELD_CALC(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits, \
		32, 1)

static const struct mtk_pin_field_calc mt6893_pin_mode_range[] = {
	PIN_FIELD(0, 219, 0x0300, 0x10, 0, 4),
};

static const struct mtk_pin_field_calc mt6893_pin_dir_range[] = {
	PIN_FIELD(0, 219, 0x0000, 0x10, 0, 1),
};

static const struct mtk_pin_field_calc mt6893_pin_di_range[] = {
	PIN_FIELD(0, 219, 0x0200, 0x10, 0, 1),
};

static const struct mtk_pin_field_calc mt6893_pin_do_range[] = {
	PIN_FIELD(0, 219, 0x0100, 0x10, 0, 1),
};

static const struct mtk_pin_field_calc mt6893_pin_smt_range[] = {
	PINS_FIELD_BASE(0, 9, 2, 0x00f0, 0x10, 7, 1),
	PINS_FIELD_BASE(10, 15, 1, 0x0090, 0x10, 4, 1),
	PIN_FIELD_BASE(16, 17, 5, 0x00c0, 0x10, 8, 1),
	PINS_FIELD_BASE(18, 25, 7, 0x00f0, 0x10, 1, 1),
	PINS_FIELD_BASE(26, 30, 6, 0x00e0, 0x10, 6, 1),
	PINS_FIELD_BASE(31, 35, 6, 0x00e0, 0x10, 2, 1),
	PIN_FIELD_BASE(36, 36, 6, 0x00e0, 0x10, 16, 1),
	PINS_FIELD_BASE(37, 39, 6, 0x00e0, 0x10, 15, 1),
	PIN_FIELD_BASE(40, 41, 6, 0x00e0, 0x10, 0, 1),
	PIN_FIELD_BASE(42, 42, 6, 0x00e0, 0x10, 5, 1),
	PIN_FIELD_BASE(43, 44, 6, 0x00e0, 0x10, 3, 1),
	PIN_FIELD_BASE(45, 45, 6, 0x00e0, 0x10, 12, 1),
	PIN_FIELD_BASE(46, 46, 6, 0x00e0, 0x10, 14, 1),
	PIN_FIELD_BASE(47, 47, 6, 0x00e0, 0x10, 13, 1),
	PIN_FIELD_BASE(48, 49, 6, 0x00e0, 0x10, 10, 1),
	PIN_FIELD_BASE(50, 50, 6, 0x00e0, 0x10, 9, 1),
	PIN_FIELD_BASE(51, 52, 3, 0x0090, 0x10, 6, 1),
	PINS_FIELD_BASE(53, 56, 3, 0x0090, 0x10, 8, 1),
	PIN_FIELD_BASE(57, 60, 3, 0x0090, 0x10, 2, 1),
	PIN_FIELD_BASE(61, 61, 3, 0x0090, 0x10, 1, 1),
	PIN_FIELD_BASE(62, 62, 4, 0x0050, 0x10, 1, 1),
	PINS_FIELD_BASE(63, 73, 3, 0x0090, 0x10, 0, 1),
	PINS_FIELD_BASE(74, 84, 4, 0x0050, 0x10, 0, 1),
	PIN_FIELD_BASE(85, 86, 4, 0x0050, 0x10, 4, 1),
	PIN_FIELD_BASE(87, 88, 4, 0x0050, 0x10, 2, 1),
	PIN_FIELD_BASE(89, 90, 2, 0x00f0, 0x10, 26, 1),
	PIN_FIELD_BASE(91, 91, 2, 0x00f0, 0x10, 0, 1),
	PINS_FIELD_BASE(92, 95, 2, 0x0100, 0x10, 0, 1),
	PIN_FIELD_BASE(96, 96, 2, 0x00f0, 0x10, 30, 1),
	PIN_FIELD_BASE(97, 97, 2, 0x00f0, 0x10, 28, 1),
	PIN_FIELD_BASE(98, 98, 2, 0x00f0, 0x10, 31, 1),
	PINS_FIELD_BASE(99, 102, 2, 0x00f0, 0x10, 29, 1),
	PINS_FIELD_BASE(103, 105, 2, 0x00f0, 0x10, 24, 1),
	PIN_FIELD_BASE(106, 106, 2, 0x00f0, 0x10, 25, 1),
	PIN_FIELD_BASE(107, 108, 2, 0x00f0, 0x10, 5, 1),
	PINS_FIELD_BASE(109, 113, 2, 0x00f0, 0x10, 8, 1),
	PINS_FIELD_BASE(114, 116, 2, 0x00f0, 0x10, 16, 1),
	PIN_FIELD_BASE(117, 117, 2, 0x00f0, 0x10, 17, 1),
	PIN_FIELD_BASE(118, 118, 2, 0x00f0, 0x10, 10, 1),
	PIN_FIELD_BASE(119, 119, 2, 0x00f0, 0x10, 18, 1),
	PIN_FIELD_BASE(120, 120, 2, 0x00f0, 0x10, 15, 1),
	PIN_FIELD_BASE(121, 121, 2, 0x00f0, 0x10, 23, 1),
	PIN_FIELD_BASE(122, 122, 2, 0x00f0, 0x10, 14, 1),
	PIN_FIELD_BASE(123, 123, 2, 0x00f0, 0x10, 22, 1),
	PIN_FIELD_BASE(124, 124, 2, 0x00f0, 0x10, 13, 1),
	PIN_FIELD_BASE(125, 125, 2, 0x00f0, 0x10, 21, 1),
	PINS_FIELD_BASE(126, 129, 2, 0x00f0, 0x10, 9, 1),
	PINS_FIELD_BASE(130, 135, 2, 0x00f0, 0x10, 4, 1),
	PIN_FIELD_BASE(136, 138, 2, 0x00f0, 0x10, 1, 1),
	PIN_FIELD_BASE(139, 139, 2, 0x00f0, 0x10, 12, 1),
	PIN_FIELD_BASE(140, 140, 2, 0x00f0, 0x10, 20, 1),
	PIN_FIELD_BASE(141, 141, 2, 0x00f0, 0x10, 11, 1),
	PIN_FIELD_BASE(142, 142, 2, 0x00f0, 0x10, 19, 1),
	PINS_FIELD_BASE(143, 148, 1, 0x0090, 0x10, 3, 1),

Annotation

Implementation Notes