drivers/media/pci/ddbridge/ddbridge-sx8.c

Source file repositories/reference/linux-study-clean/drivers/media/pci/ddbridge/ddbridge-sx8.c

File Facts

System
Linux kernel
Corpus path
drivers/media/pci/ddbridge/ddbridge-sx8.c
Extension
.c
Size
11807 bytes
Lines
478
Domain
Driver Families
Bucket
drivers/media
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 sx8_base {
	struct mci_base      mci_base;

	u8                   tuner_use_count[SX8_TUNER_NUM];
	u32                  gain_mode[SX8_TUNER_NUM];

	u32                  used_ldpc_bitrate[SX8_DEMOD_NUM];
	u8                   demod_in_use[SX8_DEMOD_NUM];
	u32                  iq_mode;
	u32                  burst_size;
	u32                  direct_mode;
};

struct sx8 {
	struct mci           mci;

	int                  first_time_lock;
	int                  started;
	struct mci_result    signal_info;

	u32                  bb_mode;
	u32                  local_frequency;
};

static void release(struct dvb_frontend *fe)
{
	struct sx8 *state = fe->demodulator_priv;
	struct mci_base *mci_base = state->mci.base;

	mci_base->count--;
	if (mci_base->count == 0) {
		list_del(&mci_base->mci_list);
		kfree(mci_base);
	}
	kfree(state);
}

static int get_info(struct dvb_frontend *fe)
{
	int stat;
	struct sx8 *state = fe->demodulator_priv;
	struct mci_command cmd;

	memset(&cmd, 0, sizeof(cmd));
	cmd.command = MCI_CMD_GETSIGNALINFO;
	cmd.demod = state->mci.demod;
	stat = ddb_mci_cmd(&state->mci, &cmd, &state->signal_info);
	return stat;
}

static int get_snr(struct dvb_frontend *fe)
{
	struct sx8 *state = fe->demodulator_priv;
	struct dtv_frontend_properties *p = &fe->dtv_property_cache;

	p->cnr.len = 1;
	p->cnr.stat[0].scale = FE_SCALE_DECIBEL;
	p->cnr.stat[0].svalue =
		(s64)state->signal_info.dvbs2_signal_info.signal_to_noise
		     * 10;
	return 0;
}

static int get_strength(struct dvb_frontend *fe)
{
	struct sx8 *state = fe->demodulator_priv;
	struct dtv_frontend_properties *p = &fe->dtv_property_cache;
	s32 str;

	str = 100000 -
	      (state->signal_info.dvbs2_signal_info.channel_power
	       * 10 + 108750);
	p->strength.len = 1;
	p->strength.stat[0].scale = FE_SCALE_DECIBEL;
	p->strength.stat[0].svalue = str;
	return 0;
}

static int read_status(struct dvb_frontend *fe, enum fe_status *status)
{
	int stat;
	struct sx8 *state = fe->demodulator_priv;
	struct mci_command cmd;
	struct mci_result res;

	cmd.command = MCI_CMD_GETSTATUS;
	cmd.demod = state->mci.demod;
	stat = ddb_mci_cmd(&state->mci, &cmd, &res);
	if (stat)
		return stat;

Annotation

Implementation Notes