1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * tdhd1.h - ALPS TDHD1-204A tuner support
5 * Copyright (C) 2008 Oliver Endriss <o.endriss@gmx.de>
7 * The project's page is at https://linuxtv.org
15 static int alps_tdhd1_204_request_firmware(struct dvb_frontend
*fe
, const struct firmware
**fw
, char *name
);
17 static struct tda1004x_config alps_tdhd1_204a_config
= {
21 .xtal_freq
= TDA10046_XTAL_4M
,
22 .agc_config
= TDA10046_AGC_DEFAULT
,
23 .if_freq
= TDA10046_FREQ_3617
,
24 .request_firmware
= alps_tdhd1_204_request_firmware
27 static int alps_tdhd1_204a_tuner_set_params(struct dvb_frontend
*fe
)
29 struct dtv_frontend_properties
*p
= &fe
->dtv_property_cache
;
30 struct i2c_adapter
*i2c
= fe
->tuner_priv
;
32 struct i2c_msg msg
= { .addr
= 0x61, .flags
= 0, .buf
= data
, .len
= sizeof(data
) };
35 div
= (p
->frequency
+ 36166666) / 166666;
37 data
[0] = (div
>> 8) & 0x7f;
41 if (p
->frequency
>= 174000000 && p
->frequency
<= 230000000)
43 else if (p
->frequency
>= 470000000 && p
->frequency
<= 823000000)
45 else if (p
->frequency
> 823000000 && p
->frequency
<= 862000000)
50 if (fe
->ops
.i2c_gate_ctrl
)
51 fe
->ops
.i2c_gate_ctrl(fe
, 1);
52 if (i2c_transfer(i2c
, &msg
, 1) != 1)