void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2)
{
	msp_write_dem(client, 0x0093, cdo1 & 0xfff);
	msp_write_dem(client, 0x009b, cdo1 >> 12);
	msp_write_dem(client, 0x00a3, cdo2 & 0xfff);
	msp_write_dem(client, 0x00ab, cdo2 >> 12);
	msp_write_dem(client, 0x0056, 0); /* LOAD_REG_1/2 */
}
void msp3400c_set_mode(struct i2c_client *client, int mode)
{
	struct msp_state *state = i2c_get_clientdata(client);
	struct msp3400c_init_data_dem *data = &msp3400c_init_data[mode];
	int tuner = (state->routing.input >> 3) & 1;
	int i;

	v4l_dbg(1, msp_debug, client, "set_mode: %d\n", mode);
	state->mode = mode;
	state->rxsubchans = V4L2_TUNER_SUB_MONO;

	msp_write_dem(client, 0x00bb, data->ad_cv | (tuner ? 0x100 : 0));

	for (i = 5; i >= 0; i--)               /* fir 1 */
		msp_write_dem(client, 0x0001, data->fir1[i]);

	msp_write_dem(client, 0x0005, 0x0004); /* fir 2 */
	msp_write_dem(client, 0x0005, 0x0040);
	msp_write_dem(client, 0x0005, 0x0000);
	for (i = 5; i >= 0; i--)
		msp_write_dem(client, 0x0005, data->fir2[i]);

	msp_write_dem(client, 0x0083, data->mode_reg);

	msp3400c_set_carrier(client, data->cdo1, data->cdo2);

	msp_set_source(client, data->dsp_src);
	/* set prescales */

	/* volume prescale for SCART (AM mono input) */
	msp_write_dsp(client, 0x000d, 0x1900);
	msp_write_dsp(client, 0x000e, data->dsp_matrix);
	if (state->has_nicam) /* nicam prescale */
		msp_write_dsp(client, 0x0010, 0x5a00);
}
Esempio n. 3
0
void msp3400c_setmode(struct i2c_client *client, int type)
{
	struct msp_state *state = i2c_get_clientdata(client);
	int i;

	v4l_dbg(1, msp_debug, client, "setmode: %d\n", type);
	state->mode       = type;
	state->audmode    = V4L2_TUNER_MODE_MONO;
	state->rxsubchans = V4L2_TUNER_SUB_MONO;

	msp_write_dem(client, 0x00bb, msp3400c_init_data[type].ad_cv);

	for (i = 5; i >= 0; i--)               /* fir 1 */
		msp_write_dem(client, 0x0001, msp3400c_init_data[type].fir1[i]);

	msp_write_dem(client, 0x0005, 0x0004); /* fir 2 */
	msp_write_dem(client, 0x0005, 0x0040);
	msp_write_dem(client, 0x0005, 0x0000);
	for (i = 5; i >= 0; i--)
		msp_write_dem(client, 0x0005, msp3400c_init_data[type].fir2[i]);

	msp_write_dem(client, 0x0083, msp3400c_init_data[type].mode_reg);

	msp3400c_setcarrier(client, msp3400c_init_data[type].cdo1,
			    msp3400c_init_data[type].cdo2);

	msp_write_dem(client, 0x0056, 0); /*LOAD_REG_1/2*/

	if (msp_dolby) {
		msp_write_dsp(client, 0x0008, 0x0520); /* I2S1 */
		msp_write_dsp(client, 0x0009, 0x0620); /* I2S2 */
		msp_write_dsp(client, 0x000b, msp3400c_init_data[type].dsp_src);
	} else {
		msp_write_dsp(client, 0x0008, msp3400c_init_data[type].dsp_src);
		msp_write_dsp(client, 0x0009, msp3400c_init_data[type].dsp_src);
		msp_write_dsp(client, 0x000b, msp3400c_init_data[type].dsp_src);
	}
	msp_write_dsp(client, 0x000a, msp3400c_init_data[type].dsp_src);
	msp_write_dsp(client, 0x000e, msp3400c_init_data[type].dsp_matrix);

	if (state->has_nicam) {
		/* nicam prescale */
		msp_write_dsp(client, 0x0010, 0x5a00); /* was: 0x3000 */
	}
}