sound/soc/codecs/ad1980.c

Source file repositories/reference/linux-study-clean/sound/soc/codecs/ad1980.c

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/ad1980.c
Extension
.c
Size
8866 bytes
Lines
326
Domain
Driver Families
Bucket
sound/soc
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-or-later
/*
 * ad1980.c  --  ALSA Soc AD1980 codec support
 *
 * Copyright:	Analog Devices Inc.
 * Author:	Roy Huang <roy.huang@analog.com>
 * 		Cliff Cai <cliff.cai@analog.com>
 */

/*
 * WARNING:
 *
 * Because Analog Devices Inc. discontinued the ad1980 sound chip since
 * Sep. 2009, this ad1980 driver is not maintained, tested and supported
 * by ADI now.
 */

#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/regmap.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/ac97_codec.h>
#include <sound/initval.h>
#include <sound/soc.h>

static const struct reg_default ad1980_reg_defaults[] = {
	{ 0x02, 0x8000 },
	{ 0x04, 0x8000 },
	{ 0x06, 0x8000 },
	{ 0x0c, 0x8008 },
	{ 0x0e, 0x8008 },
	{ 0x10, 0x8808 },
	{ 0x12, 0x8808 },
	{ 0x16, 0x8808 },
	{ 0x18, 0x8808 },
	{ 0x1a, 0x0000 },
	{ 0x1c, 0x8000 },
	{ 0x20, 0x0000 },
	{ 0x28, 0x03c7 },
	{ 0x2c, 0xbb80 },
	{ 0x2e, 0xbb80 },
	{ 0x30, 0xbb80 },
	{ 0x32, 0xbb80 },
	{ 0x36, 0x8080 },
	{ 0x38, 0x8080 },
	{ 0x3a, 0x2000 },
	{ 0x60, 0x0000 },
	{ 0x62, 0x0000 },
	{ 0x72, 0x0000 },
	{ 0x74, 0x1001 },
	{ 0x76, 0x0000 },
};

static bool ad1980_readable_reg(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case AC97_RESET ... AC97_MASTER_MONO:
	case AC97_PHONE ... AC97_CD:
	case AC97_AUX ... AC97_GENERAL_PURPOSE:
	case AC97_POWERDOWN ... AC97_PCM_LR_ADC_RATE:
	case AC97_SPDIF:
	case AC97_CODEC_CLASS_REV:
	case AC97_PCI_SVID:
	case AC97_AD_CODEC_CFG:
	case AC97_AD_JACK_SPDIF:
	case AC97_AD_SERIAL_CFG:
	case AC97_VENDOR_ID1:
	case AC97_VENDOR_ID2:
		return true;
	default:
		return false;
	}
}

static bool ad1980_writeable_reg(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case AC97_VENDOR_ID1:
	case AC97_VENDOR_ID2:
		return false;
	default:
		return ad1980_readable_reg(dev, reg);
	}
}

static const struct regmap_config ad1980_regmap_config = {

Annotation

Implementation Notes