sound/soc/codecs/aw88261.c

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

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/aw88261.c
Extension
.c
Size
35411 bytes
Lines
1362
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

if (ret) {
			dev_dbg(aw_dev->dev, "mode1 iis signal check error");
			usleep_range(AW88261_2000_US, AW88261_2000_US + 10);
		} else {
			return ret;
		}
	}

	return -EPERM;
}

static int aw88261_dev_configure_syspll(struct aw88261 *aw88261)
{
	struct aw_device *aw_dev = aw88261->aw_pa;
	int ret;

	/* Configure TDM slots (I2S is represented as no slots) */
	ret = regmap_update_bits(aw_dev->regmap, AW88261_I2SCTRL2_REG,
			~AW88261_SLOT_NUM_MASK, aw88261->slot_num_value);
	if (ret)
		return ret;

	ret = regmap_update_bits(aw_dev->regmap, AW88261_I2SCTRL2_REG,
			~AW88261_I2S_TX_SLOTVLD_MASK,
			aw88261->tx_slotvld_mask);
	if (ret)
		return ret;

	ret = regmap_update_bits(aw_dev->regmap, AW88261_I2SCTRL2_REG,
			~AW88261_I2S_RXL_SLOTVLD_MASK,
			aw88261->rxl_slotvld_mask);
	if (ret)
		return ret;

	ret = regmap_update_bits(aw_dev->regmap, AW88261_I2SCTRL2_REG,
			~AW88261_I2S_RXR_SLOTVLD_MASK,
			aw88261->rxr_slotvld_mask);
	if (ret)
		return ret;

	/* PLL divider must be used for 8/16/32 kHz modes */
	ret = regmap_update_bits(aw_dev->regmap, AW88261_PLLCTRL1_REG,
			~AW88261_CCO_MUX_MASK, aw88261->cco_mux_value);
	if (ret)
		return ret;

	/* The word clock (WCK) defines the beginning of a frame */
	ret = regmap_update_bits(aw_dev->regmap, AW88261_I2SCTRL1_REG,
			~AW88261_I2SSR_MASK, aw88261->sr_value);
	if (ret)
		return ret;

	/* The bit clock (BCK) defines the length of a frame */
	ret = regmap_update_bits(aw_dev->regmap, AW88261_I2SCTRL1_REG,
			~AW88261_I2SBCK_MASK,
			(aw88261->tdm_bck_value != AW88261_TDM_BCK_UNSET)
			? aw88261->tdm_bck_value : aw88261->bck_value);
	if (ret)
		return ret;

	/* The logical frame size is the width of data for 1 slot */
	ret = regmap_update_bits(aw_dev->regmap, AW88261_I2SCTRL1_REG,
			~AW88261_I2SFS_MASK, aw88261->fs_value);
	if (ret)
		return ret;

	/* The I2S interface mode (Philips standard, LSB/MSB justified) */
	ret = regmap_update_bits(aw_dev->regmap, AW88261_I2SCTRL1_REG,
			~AW88261_I2SMD_MASK, aw88261->md_value);
	if (ret)
		return ret;

	/* The polarity of the bit clock (BCK) */
	ret = regmap_update_bits(aw_dev->regmap, AW88261_SYSCTRL_REG,
			~AW88261_BCKINV_MASK, aw88261->bck_inv_value);
	if (ret)
		return ret;

	return aw88261_dev_check_pll(aw_dev);
}

static int aw88261_dev_check_sysst(struct aw_device *aw_dev)
{
	unsigned int check_val;
	unsigned int reg_val;
	int ret, i;

	for (i = 0; i < AW88261_DEV_SYSST_CHECK_MAX; i++) {
		ret = regmap_read(aw_dev->regmap, AW88261_SYSST_REG, &reg_val);
		if (ret)

Annotation

Implementation Notes