driver.dvb: initial crazycat package

This commit is contained in:
cvh
2017-12-14 12:12:49 +01:00
parent bc4d9bb9b5
commit 87e1f557b5
10 changed files with 1828 additions and 367 deletions

View File

@@ -0,0 +1,2 @@
100
- Initial add-on

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

View File

@@ -0,0 +1,63 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2016-present Team LibreELEC
#
# LibreELEC 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.
#
# LibreELEC 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 LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="crazycat"
PKG_VERSION="2017-11-13"
PKG_SHA256="14d951eb8d40cee40d601d7c737bca07171d8b4f201d63d5e70a24c4841f9d73"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="https://github.com/crazycat69/linux_media"
PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz"
PKG_DEPENDS_TARGET="toolchain linux"
PKG_BUILD_DEPENDS_TARGET="toolchain linux"
PKG_NEED_UNPACK="$LINUX_DEPENDS"
PKG_SECTION="driver.dvb"
PKG_LONGDESC="DVB driver for TBS cards with CrazyCats additions."
PKG_IS_ADDON="yes"
PKG_ADDON_IS_STANDALONE="yes"
PKG_ADDON_NAME="DVB drivers for TBS (CrazyCat)"
PKG_ADDON_TYPE="xbmc.service"
PKG_ADDON_VERSION="${ADDON_VERSION}.${PKG_REV}"
pre_make_target() {
export KERNEL_VER=$(get_module_dir)
export LDFLAGS=""
}
make_target() {
make untar
# copy config file
if [ "$PROJECT" = Generic ]; then
if [ -f $PKG_DIR/config/generic.config ]; then
cp $PKG_DIR/config/generic.config v4l/.config
fi
else
if [ -f $PKG_DIR/config/usb.config ]; then
cp $PKG_DIR/config/usb.config v4l/.config
fi
fi
# add menuconfig to edit .config
make VER=$KERNEL_VER SRCDIR=$(kernel_path)
}
makeinstall_target() {
install_driver_addon_files "$PKG_BUILD/v4l/"
}

View File

@@ -0,0 +1,13 @@
[Patch] without this patch you need to install libproc-processtable-perl at host system
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -51,7 +51,7 @@
@echo Kernel build directory is $(OUTDIR)
$(MAKE) -C ../linux apply_patches
$(MAKE) -C $(OUTDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules
- ./scripts/rmmod.pl check
+# ./scripts/rmmod.pl check
# $(MAKE) checkpatch
mismatch:: prepare firmware

View File

@@ -0,0 +1,11 @@
--- a/backports/backports.txt
+++ b/backports/backports.txt
@@ -25,6 +25,8 @@ add api_version.patch
add pr_fmt.patch
add debug.patch
add drx39xxj.patch
+add linux-202-lnbp22_patch_for_more_power_if_rotor.patch
+add linux-220-Xbox-One-DVB-T2-stick-support.patch
[4.12.255]
add v4.12_revert_solo6x10_copykerneluser.patch

View File

@@ -0,0 +1,17 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2017-present Team LibreELEC
#
# LibreELEC 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.
#
# LibreELEC 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 LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################

View File

@@ -0,0 +1,165 @@
This patch is from the original driver author and allows minimal power on time,
so that capacitors of secondary equipment like dish motors can be properly loaded and equipment properly initialized
see https://www.spinics.net/lists/linux-media/msg38226.html
and https://github.com/LibreELEC/LibreELEC.tv/pull/1118
tested with TT S2-3650CI and a HH90 rotor
--- a/drivers/media/dvb-frontends/lnbp22.c
+++ b/drivers/media/dvb-frontends/lnbp22.c
@@ -48,47 +48,95 @@ struct lnbp22 {
struct i2c_adapter *i2c;
};
+static int lnbp22_read_config(struct dvb_frontend *fe, u8 *config) {
+ struct lnbp22 *lnbp22 = (struct lnbp22 *) fe->sec_priv;
+ struct i2c_msg msg = { .addr = 0x08, .flags = I2C_M_RD,
+ .buf = (char*)config,
+ .len = sizeof(lnbp22->config) };
+
+ if (i2c_transfer(lnbp22->i2c, &msg, 1) == 1) {
+ dprintk(2, "%s: %02X %02X %02X %02X\n", __FUNCTION__,
+ config[0], config[1], config[2], config[3]);
+ return 0;
+ }
+ return -EIO;
+}
+
+static int lnbp22_write_config(struct dvb_frontend *fe, u8 *config) {
+ struct lnbp22 *lnbp22 = (struct lnbp22 *) fe->sec_priv;
+ struct i2c_msg msg = { .addr = 0x08, .flags = 0,
+ .buf = (char*)config,
+ .len = sizeof(lnbp22->config) };
+
+ if (i2c_transfer(lnbp22->i2c, &msg, 1) == 1) {
+ dprintk(2, "%s: %02X %02X %02X %02X\n", __FUNCTION__,
+ config[0], config[1], config[2], config[3]);
+ return 0;
+ }
+ return -EIO;
+}
+
static int lnbp22_set_voltage(struct dvb_frontend *fe,
enum fe_sec_voltage voltage)
{
struct lnbp22 *lnbp22 = (struct lnbp22 *)fe->sec_priv;
- struct i2c_msg msg = {
- .addr = 0x08,
- .flags = 0,
- .buf = (char *)&lnbp22->config,
- .len = sizeof(lnbp22->config),
- };
+ int status;
dprintk(1, "%s: %d (18V=%d 13V=%d)\n", __func__, voltage,
SEC_VOLTAGE_18, SEC_VOLTAGE_13);
- lnbp22->config[3] = 0x60; /* Power down */
switch (voltage) {
- case SEC_VOLTAGE_OFF:
- break;
- case SEC_VOLTAGE_13:
- lnbp22->config[3] |= LNBP22_EN;
- break;
- case SEC_VOLTAGE_18:
- lnbp22->config[3] |= (LNBP22_EN | LNBP22_VSEL);
- break;
- default:
- return -EINVAL;
+ case SEC_VOLTAGE_OFF:
+ lnbp22->config[3] &= ~LNBP22_EN;
+ return lnbp22_write_config(fe, lnbp22->config);
+ case SEC_VOLTAGE_13:
+ lnbp22->config[3] |= LNBP22_EN;
+ lnbp22->config[3] &= ~LNBP22_VSEL;
+ break;
+ case SEC_VOLTAGE_18:
+ lnbp22->config[3] |= LNBP22_EN|LNBP22_VSEL;
+ break;
+ default:
+ return -EINVAL; }
+
+ status = lnbp22_write_config(fe, lnbp22->config);
+ if( status == 0 ) {
+ u8 config[4];
+ int retries = 20;
+
+ /* byte 0: status
+ bit 3: open loop
+ bit 2: in progress/not ready
+ bit 1: over current limit
+ bit 0: over voltage limit */
+
+ /* wait up to 2 seconds for voltage to stablize.
+ It is important to wait that long, especially if there is a
+ rotor to power on, as DC/DC converter capacitors can take a
+ while to charge up and could cause a temporary overload */
+ do
+ {
+ msleep(50);
+ status = lnbp22_read_config(fe, config);
+ if( status < 0 )
+ return status;
+ }
+ while( (config[0] & (1<<2)) && retries-- );
+
+ dprintk(1, "%s status=0x%02X\n", __FUNCTION__, config[0]);
+
+ if( retries < 0 )
+ return -EAGAIN; /* temporary overload ? */
+
+ if( config[0] & (1<<3) )
+ return -ENOLINK; /* open loop */
}
-
- dprintk(1, "%s: 0x%02x)\n", __func__, lnbp22->config[3]);
- return (i2c_transfer(lnbp22->i2c, &msg, 1) == 1) ? 0 : -EIO;
+ return status;
}
static int lnbp22_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
{
struct lnbp22 *lnbp22 = (struct lnbp22 *) fe->sec_priv;
- struct i2c_msg msg = {
- .addr = 0x08,
- .flags = 0,
- .buf = (char *)&lnbp22->config,
- .len = sizeof(lnbp22->config),
- };
dprintk(1, "%s: %d\n", __func__, (int)arg);
if (arg)
@@ -96,7 +144,7 @@ static int lnbp22_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
else
lnbp22->config[3] &= ~LNBP22_LLC;
- return (i2c_transfer(lnbp22->i2c, &msg, 1) == 1) ? 0 : -EIO;
+ return lnbp22_write_config(fe, lnbp22->config);
}
static void lnbp22_release(struct dvb_frontend *fe)
@@ -118,20 +166,14 @@ struct dvb_frontend *lnbp22_attach(struct dvb_frontend *fe,
return NULL;
/* default configuration */
- lnbp22->config[0] = 0x00; /* ? */
+ lnbp22->config[0] = 0x00; /* status */
lnbp22->config[1] = 0x28; /* ? */
- lnbp22->config[2] = 0x48; /* ? */
+ lnbp22->config[2] = 0x49; /* ? */
lnbp22->config[3] = 0x60; /* Power down */
lnbp22->i2c = i2c;
fe->sec_priv = lnbp22;
- /* detect if it is present or not */
- if (lnbp22_set_voltage(fe, SEC_VOLTAGE_OFF)) {
- dprintk(0, "%s LNBP22 not found\n", __func__);
- kfree(lnbp22);
- fe->sec_priv = NULL;
- return NULL;
- }
+ lnbp22_set_voltage(fe, SEC_VOLTAGE_OFF);
/* install release callback */
fe->ops.release_sec = lnbp22_release;