2 * tdhd1.h - ALPS TDHD1-204A tuner support
4 * Copyright (C) 2008 Oliver Endriss <o.endriss@gmx.de>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
23 * The project's page is at http://www.linuxtv.org
31 static int alps_tdhd1_204_request_firmware(struct dvb_frontend
*fe
, const struct firmware
**fw
, char *name
);
33 static struct tda1004x_config alps_tdhd1_204a_config
= {
37 .xtal_freq
= TDA10046_XTAL_4M
,
38 .agc_config
= TDA10046_AGC_DEFAULT
,
39 .if_freq
= TDA10046_FREQ_3617
,
40 .request_firmware
= alps_tdhd1_204_request_firmware
43 static int alps_tdhd1_204a_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
45 struct i2c_adapter
*i2c
= fe
->tuner_priv
;
47 struct i2c_msg msg
= { .addr
= 0x61, .flags
= 0, .buf
= data
, .len
= sizeof(data
) };
50 div
= (params
->frequency
+ 36166666) / 166666;
52 data
[0] = (div
>> 8) & 0x7f;
56 if (params
->frequency
>= 174000000 && params
->frequency
<= 230000000)
58 else if (params
->frequency
>= 470000000 && params
->frequency
<= 823000000)
60 else if (params
->frequency
> 823000000 && params
->frequency
<= 862000000)
65 if (fe
->ops
.i2c_gate_ctrl
)
66 fe
->ops
.i2c_gate_ctrl(fe
, 1);
67 if (i2c_transfer(i2c
, &msg
, 1) != 1)