sound/soc/codecs/fs210x.c

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

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/fs210x.c
Extension
.c
Size
37769 bytes
Lines
1587
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

struct fs210x_platform_data {
	const char *fwm_name;
};

struct fs210x_priv {
	struct i2c_client *i2c;
	struct device *dev;
	struct regmap *regmap;
	struct fs210x_platform_data pdata;
	struct regulator_bulk_data supplies[FS210X_NUM_SUPPLIES];
	struct gpio_desc *gpio_sdz;
	struct delayed_work start_work;
	struct delayed_work fault_check_work;
	struct fs_amp_lib amp_lib;
	const struct fs_amp_scene *cur_scene;
	struct clk *clk_bclk;
	/*
	 * @lock: Mutex ensuring exclusive access for critical device operations
	 *
	 * This lock serializes access between the following actions:
	 *  - Device initialization procedures(probe)
	 *  - Enable/disable device(DAPM event)
	 *  - Suspend/resume device(PM)
	 *  - Runtime scene switching(control)
	 *  - Scheduling/execution of delayed works items(delayed works)
	 */
	struct mutex lock;
	unsigned int check_interval_ms;
	unsigned int bclk;
	unsigned int srate;
	int scene_id;
	u16 devid;
	bool is_inited;
	bool is_suspended;
	bool is_bclk_on;
	bool is_playing;
};

static const unsigned int fs2105s_rates[] = {
	32000, 44100, 48000, 88200, 96000
};

static const struct snd_pcm_hw_constraint_list fs2105s_constraints = {
	.count = ARRAY_SIZE(fs2105s_rates),
	.list  = fs2105s_rates,
};

static const unsigned int fs210x_rates[] = {
	16000, 32000, 44100, 48000, 88200, 96000
};

static const struct snd_pcm_hw_constraint_list fs210x_constraints = {
	.count = ARRAY_SIZE(fs210x_rates),
	.list  = fs210x_rates,
};

static const struct fs_pll_div fs210x_pll_div[] = {
	/*    bclk,   pll1,   pll2,   pll3 */
	{   512000, 0x006C, 0x0120, 0x0001 },
	{   768000, 0x016C, 0x00C0, 0x0001 },
	{  1024000, 0x016C, 0x0090, 0x0001 },
	{  1536000, 0x016C, 0x0060, 0x0001 },
	{  2048000, 0x016C, 0x0090, 0x0002 },
	{  2304000, 0x016C, 0x0080, 0x0002 },
	{  3072000, 0x016C, 0x0090, 0x0003 },
	{  4096000, 0x016C, 0x0090, 0x0004 },
	{  4608000, 0x016C, 0x0080, 0x0004 },
	{  6144000, 0x016C, 0x0090, 0x0006 },
	{  8192000, 0x016C, 0x0090, 0x0008 },
	{  9216000, 0x016C, 0x0090, 0x0009 },
	{ 12288000, 0x016C, 0x0090, 0x000C },
	{ 16384000, 0x016C, 0x0090, 0x0010 },
	{ 18432000, 0x016C, 0x0090, 0x0012 },
	{ 24576000, 0x016C, 0x0090, 0x0018 },
	{  1411200, 0x016C, 0x0060, 0x0001 },
	{  2116800, 0x016C, 0x0080, 0x0002 },
	{  2822400, 0x016C, 0x0090, 0x0003 },
	{  4233600, 0x016C, 0x0080, 0x0004 },
	{  5644800, 0x016C, 0x0090, 0x0006 },
	{  8467200, 0x016C, 0x0090, 0x0009 },
	{ 11289600, 0x016C, 0x0090, 0x000C },
	{ 16934400, 0x016C, 0x0090, 0x0012 },
	{ 22579200, 0x016C, 0x0090, 0x0018 },
	{  2000000, 0x017C, 0x0093, 0x0002 },
};

static int fs210x_bclk_set(struct fs210x_priv *fs210x, bool on)
{
	int ret = 0;

Annotation

Implementation Notes