⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wm8782.h

📁 根据芯片WM8782在LINUX环境下实现的音频驱动
💻 H
字号:

/* wm8782.h  --  WM8782 Soc Audio driver
 *
 * Copyright 2005 Openedhand Ltd.
 *
 * Author: Richard Purdie <richard@openedhand.com>
 *
 * Based on wm8753.h
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef _WM8782_H
#define _WM8782_H

struct wm8782_platform_data 
{
	unsigned short i2c_address;
	unsigned short  * reg_cache;
	unsigned short reg_cache_size;
	void * private_data;
	unsigned int (* read) (unsigned int reg);
	int (* write)( unsigned int reg,unsigned int value);
	struct i2c_client * i2c;	
};


struct _coeff_div {
	u32 mclk;
	u32 rate;
	u16 fs;
	u8 sr:4;
	u8 bosr:1;
	u8 usb:1;
};

/* codec mclk clock divider coefficients */
static const struct _coeff_div coeff_div[] = {
	/* 8k */
	{12000000, 8000, 250, 0x3, 0x0, 0x1},
	
	/* 32k */
	{12000000, 32000, 250, 0x6, 0x0, 0x1},
	
	/* 44.1k */

	{12000000, 44100, 272, 0x8, 0x1, 0x1},
	
	/* 48k */
	{12000000, 48000, 250, 0x0, 0x0, 0x1},
	
	/* 88.2k */
	{12000000, 88200, 272, 0xf, 0x1, 0x1},
	
	/* 96k */
	{12000000, 96000, 250, 0x7, 0x0, 0x1},

};

int get_coeff(int mclk, int rate)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(coeff_div); i++) {
		if (coeff_div[i].rate == rate && coeff_div[i].mclk == mclk)
			return i;
	}
	return 0;
}

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -