mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 15:00:53 +07:00
V4L/DVB (7224): Initial DVB-S support for MD8800 /CTX948
Support is not complete yet and untested. Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
parent
26ec394e7c
commit
4b1431ca1c
164
drivers/media/dvb/frontends/isl6405.c
Normal file
164
drivers/media/dvb/frontends/isl6405.c
Normal file
@ -0,0 +1,164 @@
|
||||
/*
|
||||
* isl6405.c - driver for dual lnb supply and control ic ISL6405
|
||||
*
|
||||
* Copyright (C) 2008 Hartmut Hackmann
|
||||
* Copyright (C) 2006 Oliver Endriss
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*
|
||||
* the project's page is at http://www.linuxtv.org
|
||||
*/
|
||||
#include <linux/delay.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "dvb_frontend.h"
|
||||
#include "isl6405.h"
|
||||
|
||||
struct isl6405 {
|
||||
u8 config;
|
||||
u8 override_or;
|
||||
u8 override_and;
|
||||
struct i2c_adapter *i2c;
|
||||
u8 i2c_addr;
|
||||
};
|
||||
|
||||
static int isl6405_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
|
||||
{
|
||||
struct isl6405 *isl6405 = (struct isl6405 *) fe->sec_priv;
|
||||
struct i2c_msg msg = { .addr = isl6405->i2c_addr, .flags = 0,
|
||||
.buf = &isl6405->config,
|
||||
.len = sizeof(isl6405->config) };
|
||||
|
||||
if (isl6405->override_or & 0x80) {
|
||||
isl6405->config &= ~(ISL6405_VSEL2 | ISL6405_EN2);
|
||||
switch (voltage) {
|
||||
case SEC_VOLTAGE_OFF:
|
||||
break;
|
||||
case SEC_VOLTAGE_13:
|
||||
isl6405->config |= ISL6405_EN2;
|
||||
break;
|
||||
case SEC_VOLTAGE_18:
|
||||
isl6405->config |= (ISL6405_EN2 | ISL6405_VSEL2);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
isl6405->config &= ~(ISL6405_VSEL1 | ISL6405_EN1);
|
||||
switch (voltage) {
|
||||
case SEC_VOLTAGE_OFF:
|
||||
break;
|
||||
case SEC_VOLTAGE_13:
|
||||
isl6405->config |= ISL6405_EN1;
|
||||
break;
|
||||
case SEC_VOLTAGE_18:
|
||||
isl6405->config |= (ISL6405_EN1 | ISL6405_VSEL1);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
};
|
||||
}
|
||||
isl6405->config |= isl6405->override_or;
|
||||
isl6405->config &= isl6405->override_and;
|
||||
|
||||
return (i2c_transfer(isl6405->i2c, &msg, 1) == 1) ? 0 : -EIO;
|
||||
}
|
||||
|
||||
static int isl6405_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
|
||||
{
|
||||
struct isl6405 *isl6405 = (struct isl6405 *) fe->sec_priv;
|
||||
struct i2c_msg msg = { .addr = isl6405->i2c_addr, .flags = 0,
|
||||
.buf = &isl6405->config,
|
||||
.len = sizeof(isl6405->config) };
|
||||
|
||||
if (isl6405->override_or & 0x80) {
|
||||
if (arg)
|
||||
isl6405->config |= ISL6405_LLC2;
|
||||
else
|
||||
isl6405->config &= ~ISL6405_LLC2;
|
||||
} else {
|
||||
if (arg)
|
||||
isl6405->config |= ISL6405_LLC1;
|
||||
else
|
||||
isl6405->config &= ~ISL6405_LLC1;
|
||||
}
|
||||
isl6405->config |= isl6405->override_or;
|
||||
isl6405->config &= isl6405->override_and;
|
||||
|
||||
return (i2c_transfer(isl6405->i2c, &msg, 1) == 1) ? 0 : -EIO;
|
||||
}
|
||||
|
||||
static void isl6405_release(struct dvb_frontend *fe)
|
||||
{
|
||||
/* power off */
|
||||
isl6405_set_voltage(fe, SEC_VOLTAGE_OFF);
|
||||
|
||||
/* free */
|
||||
kfree(fe->sec_priv);
|
||||
fe->sec_priv = NULL;
|
||||
}
|
||||
|
||||
struct dvb_frontend *isl6405_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c,
|
||||
u8 i2c_addr, u8 override_set, u8 override_clear)
|
||||
{
|
||||
struct isl6405 *isl6405 = kmalloc(sizeof(struct isl6405), GFP_KERNEL);
|
||||
if (!isl6405)
|
||||
return NULL;
|
||||
|
||||
/* default configuration */
|
||||
if (override_set & 0x80)
|
||||
isl6405->config = ISL6405_ISEL2;
|
||||
else
|
||||
isl6405->config = ISL6405_ISEL1;
|
||||
isl6405->i2c = i2c;
|
||||
isl6405->i2c_addr = i2c_addr;
|
||||
fe->sec_priv = isl6405;
|
||||
|
||||
/* bits which should be forced to '1' */
|
||||
isl6405->override_or = override_set;
|
||||
|
||||
/* bits which should be forced to '0' */
|
||||
isl6405->override_and = ~override_clear;
|
||||
|
||||
/* detect if it is present or not */
|
||||
if (isl6405_set_voltage(fe, SEC_VOLTAGE_OFF)) {
|
||||
kfree(isl6405);
|
||||
fe->sec_priv = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* install release callback */
|
||||
fe->ops.release_sec = isl6405_release;
|
||||
|
||||
/* override frontend ops */
|
||||
fe->ops.set_voltage = isl6405_set_voltage;
|
||||
fe->ops.enable_high_lnb_voltage = isl6405_enable_high_lnb_voltage;
|
||||
|
||||
return fe;
|
||||
}
|
||||
EXPORT_SYMBOL(isl6405_attach);
|
||||
|
||||
MODULE_DESCRIPTION("Driver for lnb supply and control ic isl6405");
|
||||
MODULE_AUTHOR("Hartmut Hackmann & Oliver Endriss");
|
||||
MODULE_LICENSE("GPL");
|
74
drivers/media/dvb/frontends/isl6405.h
Normal file
74
drivers/media/dvb/frontends/isl6405.h
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* isl6405.h - driver for dual lnb supply and control ic ISL6405
|
||||
*
|
||||
* Copyright (C) 2008 Hartmut Hackmann
|
||||
* Copyright (C) 2006 Oliver Endriss
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*
|
||||
* the project's page is at http://www.linuxtv.org
|
||||
*/
|
||||
|
||||
#ifndef _ISL6405_H
|
||||
#define _ISL6405_H
|
||||
|
||||
#include <linux/dvb/frontend.h>
|
||||
|
||||
/* system register bits */
|
||||
|
||||
/* this bit selects register (control) 1 or 2
|
||||
note that the bit maps are different */
|
||||
|
||||
#define ISL6405_SR 0x80
|
||||
|
||||
/* SR = 0 */
|
||||
#define ISL6405_OLF1 0x01
|
||||
#define ISL6405_EN1 0x02
|
||||
#define ISL6405_VSEL1 0x04
|
||||
#define ISL6405_LLC1 0x08
|
||||
#define ISL6405_ENT1 0x10
|
||||
#define ISL6405_ISEL1 0x20
|
||||
#define ISL6405_DCL 0x40
|
||||
|
||||
/* SR = 1 */
|
||||
#define ISL6405_OLF2 0x01
|
||||
#define ISL6405_OTF 0x02
|
||||
#define ISL6405_EN2 0x04
|
||||
#define ISL6405_VSEL2 0x08
|
||||
#define ISL6405_LLC2 0x10
|
||||
#define ISL6405_ENT2 0x20
|
||||
#define ISL6405_ISEL2 0x40
|
||||
|
||||
#if defined(CONFIG_DVB_ISL6405) || (defined(CONFIG_DVB_ISL6405_MODULE) && defined(MODULE))
|
||||
/* override_set and override_clear control which system register bits (above)
|
||||
* to always set & clear
|
||||
*/
|
||||
extern struct dvb_frontend *isl6405_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c,
|
||||
u8 i2c_addr, u8 override_set, u8 override_clear);
|
||||
#else
|
||||
static inline struct dvb_frontend *isl6405_attach(struct dvb_frontend *fe,
|
||||
struct i2c_adapter *i2c, u8 i2c_addr,
|
||||
u8 override_set, u8 override_clear)
|
||||
{
|
||||
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_DVB_ISL6405 */
|
||||
|
||||
#endif
|
@ -43,6 +43,7 @@
|
||||
#include "tda826x.h"
|
||||
#include "tda827x.h"
|
||||
#include "isl6421.h"
|
||||
#include "isl6405.h"
|
||||
|
||||
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
|
||||
MODULE_LICENSE("GPL");
|
||||
@ -990,7 +991,22 @@ static int dvb_init(struct saa7134_dev *dev)
|
||||
configure_tda827x_fe(dev, &tevion_dvbt220rf_config);
|
||||
break;
|
||||
case SAA7134_BOARD_MEDION_MD8800_QUADRO:
|
||||
configure_tda827x_fe(dev, &md8800_dvbt_config);
|
||||
if (!use_frontend) { /* terrestrial */
|
||||
configure_tda827x_fe(dev, &md8800_dvbt_config);
|
||||
} else { /* satellite */
|
||||
dev->dvb.frontend = dvb_attach(tda10086_attach,
|
||||
&flydvbs, &dev->i2c_adap);
|
||||
if (dev->dvb.frontend) {
|
||||
if (dvb_attach(tda826x_attach, dev->dvb.frontend,
|
||||
0x60, &dev->i2c_adap, 0) == NULL)
|
||||
wprintk("%s: Medion Quadro, no tda826x "
|
||||
"found !\n", __FUNCTION__);
|
||||
if (dvb_attach(isl6405_attach, dev->dvb.frontend,
|
||||
&dev->i2c_adap, 0x08, 0, 0) == NULL)
|
||||
wprintk("%s: Medion Quadro, no ISL6405 "
|
||||
"found !\n", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:
|
||||
dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180,
|
||||
|
Loading…
Reference in New Issue
Block a user