include/linux/mfd/si476x-core.h

Source file repositories/reference/linux-study-clean/include/linux/mfd/si476x-core.h

File Facts

System
Linux kernel
Corpus path
include/linux/mfd/si476x-core.h
Extension
.h
Size
15533 bytes
Lines
532
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct si476x_core {
	struct i2c_client *client;
	struct regmap *regmap;
	int chip_id;
	struct mfd_cell cells[SI476X_MFD_CELLS];

	struct mutex cmd_lock; /* for serializing fm radio operations */
	atomic_t users;

	wait_queue_head_t  rds_read_queue;
	struct kfifo       rds_fifo;
	struct work_struct rds_fifo_drainer;
	bool               rds_drainer_is_working;
	struct mutex       rds_drainer_status_lock;

	wait_queue_head_t command;
	atomic_t          cts;

	wait_queue_head_t tuning;
	atomic_t          stc;

	struct si476x_power_up_args power_up_parameters;

	enum si476x_power_state power_state;

	struct regulator_bulk_data supplies[4];

	int gpio_reset;

	struct si476x_pinmux pinmux;
	enum si476x_phase_diversity_mode diversity_mode;

	atomic_t is_alive;

	struct delayed_work status_monitor;
#define SI476X_WORK_TO_CORE(w) container_of(to_delayed_work(w),	\
					    struct si476x_core,	\
					    status_monitor)

	int revision;

	int rds_fifo_depth;
};

static inline struct si476x_core *i2c_mfd_cell_to_core(struct device *dev)
{
	struct i2c_client *client = to_i2c_client(dev->parent);
	return i2c_get_clientdata(client);
}


/**
 * si476x_core_lock() - lock the core device to get an exclusive access
 * to it.
 * @core: Core device structure
 */
static inline void si476x_core_lock(struct si476x_core *core)
{
	mutex_lock(&core->cmd_lock);
}

/**
 * si476x_core_unlock() - unlock the core device to relinquish an
 * exclusive access to it.
 * @core: Core device structure
 */
static inline void si476x_core_unlock(struct si476x_core *core)
{
	mutex_unlock(&core->cmd_lock);
}

/* *_TUNE_FREQ family of commands accept frequency in multiples of
    10kHz */
static inline u16 hz_to_si476x(struct si476x_core *core, int freq)
{
	u16 result;

	switch (core->power_up_parameters.func) {
	default:
	case SI476X_FUNC_FM_RECEIVER:
		result = freq / 10000;
		break;
	case SI476X_FUNC_AM_RECEIVER:
		result = freq / 1000;
		break;
	}

	return result;
}

Annotation

Implementation Notes