linux-stable/drivers/media/dvb-frontends/stv0367.h

75 lines
2 KiB
C
Raw Normal View History

/*
* stv0367.h
*
* Driver for ST STV0367 DVB-T & DVB-C demodulator IC.
*
* Copyright (C) ST Microelectronics.
* Copyright (C) 2010,2011 NetUP Inc.
* Copyright (C) 2010,2011 Igor M. Liplianin <liplianin@netup.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
* GNU General Public License for more details.
*/
#ifndef STV0367_H
#define STV0367_H
#include <linux/dvb/frontend.h>
#include <media/dvb_frontend.h>
#define STV0367_ICSPEED_53125 53125000
#define STV0367_ICSPEED_58000 58000000
struct stv0367_config {
u8 demod_address;
u32 xtal;
u32 if_khz;/*4500*/
int if_iq_mode;
int ts_mode;
int clk_pol;
};
[media] Add and use IS_REACHABLE macro In the media drivers, the v4l2 core knows about all submodules and calls into them from a common function. However this cannot work if the modules that get called are loadable and the core is built-in. In that case we get drivers/built-in.o: In function `set_type': drivers/media/v4l2-core/tuner-core.c:301: undefined reference to `tea5767_attach' drivers/media/v4l2-core/tuner-core.c:307: undefined reference to `tea5761_attach' drivers/media/v4l2-core/tuner-core.c:349: undefined reference to `tda9887_attach' drivers/media/v4l2-core/tuner-core.c:405: undefined reference to `xc4000_attach' This was working previously, until the IS_ENABLED() macro was used to replace the construct like #if defined(CONFIG_DVB_CX24110) || (defined(CONFIG_DVB_CX24110_MODULE) && defined(MODULE)) with the difference that the new code no longer checks whether it is being built as a loadable module itself. To fix this, this new patch adds an 'IS_REACHABLE' macro, which evaluates true in exactly the condition that was used previously. The downside of this is that this trades an obvious link error for a more subtle runtime failure, but it is clear that the change that introduced the link error was unintentional and it seems better to revert it for now. Also, a similar change was originally created by Trent Piepho and then reverted by teh change to the IS_ENABLED macro. Ideally Kconfig would be used to avoid the case of a broken dependency, or the code restructured in a way to turn around the dependency, but either way would require much larger changes here. Fixes: 7b34be71db53 ("[media] use IS_ENABLED() macro") See-also: c5dec9fb248e ("V4L/DVB (4751): Fix DBV_FE_CUSTOMISE for card drivers compiled into kernel") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-18 17:12:42 +00:00
#if IS_REACHABLE(CONFIG_DVB_STV0367)
extern struct
dvb_frontend *stv0367ter_attach(const struct stv0367_config *config,
struct i2c_adapter *i2c);
extern struct
dvb_frontend *stv0367cab_attach(const struct stv0367_config *config,
struct i2c_adapter *i2c);
[media] dvb-frontends/stv0367: add Digital Devices compatibility This - in conjunction with the previous changes - makes it possible to use the STV0367 DVB-C/T demodulator driver with Digital Devices hardware having this demodulator soldered on them (namely CineCTv6 bridges and some earlier DuoFlex CT addon modules). The changes do the following: - add a third *_attach function which will make use of a third frontend_ops struct which announces both -C and -T support (the same as with DD's own driver stv0367dd). This is necessary to support both delivery systems on one FE without having to do large conversions to VB2 or the need to select either -C or -T mode via modparams and the like. Additionally, the frontend_ops point to new "glue" functions which will then call into the existing functionality depending on the active delivery system/demod state (all used functionality works almost OOTB). - Demod initialisation has been ported from stv0367dd. DD's driver always does a full init of both OFDM and QAM cores, with some additional things. The active delivery system is remembered and upon switch, the Demod will be reconfigured to work in OFDM or QAM mode (that's what the ddb_setup_XX functions are used for). Note that in QAM mode, the DD demods work with an IC speed of 58Mhz. It's not very good to perform full reinits upon Demod mode changes since in very rare occasions this can lead to the I2C interface or the whole Demod to crash, requiring a powercycle, thus the flag to perform full reinit is set to disabled. - A little enum is added for named identifiers of the current Demod state. Initialisation code/register writes originate from stv0367dd. Permission to reuse was formally granted by Ralph Metzler <rjkm@metzlerbros.de>. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-03-29 16:43:11 +00:00
extern struct
dvb_frontend *stv0367ddb_attach(const struct stv0367_config *config,
struct i2c_adapter *i2c);
#else
static inline struct
dvb_frontend *stv0367ter_attach(const struct stv0367_config *config,
struct i2c_adapter *i2c)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL;
}
static inline struct
dvb_frontend *stv0367cab_attach(const struct stv0367_config *config,
struct i2c_adapter *i2c)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL;
}
[media] dvb-frontends/stv0367: add Digital Devices compatibility This - in conjunction with the previous changes - makes it possible to use the STV0367 DVB-C/T demodulator driver with Digital Devices hardware having this demodulator soldered on them (namely CineCTv6 bridges and some earlier DuoFlex CT addon modules). The changes do the following: - add a third *_attach function which will make use of a third frontend_ops struct which announces both -C and -T support (the same as with DD's own driver stv0367dd). This is necessary to support both delivery systems on one FE without having to do large conversions to VB2 or the need to select either -C or -T mode via modparams and the like. Additionally, the frontend_ops point to new "glue" functions which will then call into the existing functionality depending on the active delivery system/demod state (all used functionality works almost OOTB). - Demod initialisation has been ported from stv0367dd. DD's driver always does a full init of both OFDM and QAM cores, with some additional things. The active delivery system is remembered and upon switch, the Demod will be reconfigured to work in OFDM or QAM mode (that's what the ddb_setup_XX functions are used for). Note that in QAM mode, the DD demods work with an IC speed of 58Mhz. It's not very good to perform full reinits upon Demod mode changes since in very rare occasions this can lead to the I2C interface or the whole Demod to crash, requiring a powercycle, thus the flag to perform full reinit is set to disabled. - A little enum is added for named identifiers of the current Demod state. Initialisation code/register writes originate from stv0367dd. Permission to reuse was formally granted by Ralph Metzler <rjkm@metzlerbros.de>. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-03-29 16:43:11 +00:00
static inline struct
dvb_frontend *stv0367ddb_attach(const struct stv0367_config *config,
struct i2c_adapter *i2c)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL;
}
#endif
#endif