blob: df817aec29e2ae133fcdadb847b4e927738b49e4 [file] [log] [blame]
Michael Krufkye26f2ae2012-01-29 15:46:46 -03001/*
2 * Support for LG2160 - ATSC/MH
3 *
4 * Copyright (C) 2010 Michael Krufky <mkrufky@linuxtv.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
Michael Krufkye26f2ae2012-01-29 15:46:46 -030016 */
17
18#ifndef _LG2160_H_
19#define _LG2160_H_
20
21#include <linux/i2c.h>
Mauro Carvalho Chehabfada1932017-12-28 13:03:51 -050022#include <media/dvb_frontend.h>
Michael Krufkye26f2ae2012-01-29 15:46:46 -030023
24enum lg_chip_type {
25 LG2160 = 0,
26 LG2161 = 1,
27};
28
29#define LG2161_1019 LG2161
30#define LG2161_1040 LG2161
31
32enum lg2160_spi_clock {
33 LG2160_SPI_3_125_MHZ = 0,
34 LG2160_SPI_6_25_MHZ = 1,
35 LG2160_SPI_12_5_MHZ = 2,
36};
37
38#if 0
39enum lg2161_oif {
40 LG2161_OIF_EBI2_SLA = 1,
41 LG2161_OIF_SDIO_SLA = 2,
42 LG2161_OIF_SPI_SLA = 3,
43 LG2161_OIF_SPI_MAS = 4,
44 LG2161_OIF_SERIAL_TS = 7,
45};
46#endif
47
48struct lg2160_config {
49 u8 i2c_addr;
50
51 /* user defined IF frequency in KHz */
52 u16 if_khz;
53
54 /* disable i2c repeater - 0:repeater enabled 1:repeater disabled */
Dan Carpenter71867972013-04-17 08:18:30 -030055 unsigned int deny_i2c_rptr:1;
Michael Krufkye26f2ae2012-01-29 15:46:46 -030056
57 /* spectral inversion - 0:disabled 1:enabled */
Dan Carpenter71867972013-04-17 08:18:30 -030058 unsigned int spectral_inversion:1;
Michael Krufkye26f2ae2012-01-29 15:46:46 -030059
60 unsigned int output_if;
61 enum lg2160_spi_clock spi_clock;
62 enum lg_chip_type lg_chip;
63};
64
Arnd Bergmann9b174522015-02-18 14:12:42 -030065#if IS_REACHABLE(CONFIG_DVB_LG2160)
Michael Krufkye26f2ae2012-01-29 15:46:46 -030066extern
67struct dvb_frontend *lg2160_attach(const struct lg2160_config *config,
68 struct i2c_adapter *i2c_adap);
69#else
70static inline
71struct dvb_frontend *lg2160_attach(const struct lg2160_config *config,
72 struct i2c_adapter *i2c_adap)
73{
74 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
75 return NULL;
76}
77#endif /* CONFIG_DVB_LG2160 */
78
79#endif /* _LG2160_H_ */