Moikka!
Biggest issue is that CIMax2 SP2 driver. Olli put all that stuff to own
I2C driver recently. Could you took SP2 from patchwork and use it instead:
https://patchwork.linuxtv.org/patch/25206/
https://patchwork.linuxtv.org/patch/25210/
It is not yet in mainline, but there should not be any big changes
coming to that driver.
regards
Antti
On 08/06/2014 07:36 AM, nibble.max wrote:
> add dvb-usb-v2 driver for DVBSky dvb-s2 box
>
> Signed-off-by: Nibble Max
> ---
> drivers/media/usb/dvb-usb-v2/Kconfig | 6 +
> drivers/media/usb/dvb-usb-v2/Makefile | 3 +
> drivers/media/usb/dvb-usb-v2/dvbsky.c | 872
> ++
> 3 files changed, 881 insertions(+)
>
> diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig
> b/drivers/media/usb/dvb-usb-v2/Kconfig
> index 66645b0..8107c8d 100644
> --- a/drivers/media/usb/dvb-usb-v2/Kconfig
> +++ b/drivers/media/usb/dvb-usb-v2/Kconfig
> @@ -141,3 +141,9 @@ config DVB_USB_RTL28XXU
> help
> Say Y here to support the Realtek RTL28xxU DVB USB receiver.
>
> +config DVB_USB_DVBSKY
> + tristate "DVBSky USB support"
> + depends on DVB_USB_V2
> + select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT
> + help
> + Say Y here to support the USB receivers from DVBSky.
> diff --git a/drivers/media/usb/dvb-usb-v2/Makefile
> b/drivers/media/usb/dvb-usb-v2/Makefile
> index bc38f03..f10d4df 100644
> --- a/drivers/media/usb/dvb-usb-v2/Makefile
> +++ b/drivers/media/usb/dvb-usb-v2/Makefile
> @@ -37,6 +37,9 @@ obj-$(CONFIG_DVB_USB_MXL111SF) += mxl111sf-tuner.o
> dvb-usb-rtl28xxu-objs := rtl28xxu.o
> obj-$(CONFIG_DVB_USB_RTL28XXU) += dvb-usb-rtl28xxu.o
>
> +dvb-usb-dvbsky-objs := dvbsky.o
> +obj-$(CONFIG_DVB_USB_DVBSKY) += dvb-usb-dvbsky.o
> +
> ccflags-y += -I$(srctree)/drivers/media/dvb-core
> ccflags-y += -I$(srctree)/drivers/media/dvb-frontends
> ccflags-y += -I$(srctree)/drivers/media/tuners
> diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c
> b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> new file mode 100644
> index 000..c86927f
> --- /dev/null
> +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> @@ -0,0 +1,872 @@
> +/*
> + * Driver for DVBSky USB2.0 receiver
> + *
> + * Copyright (C) 2013 Max nibble
> + *
> + * CIMax code is copied and modified from:
> + * CIMax2(R) SP2 driver in conjunction with NetUp Dual DVB-S2 CI card
> + * Copyright (C) 2009 NetUP Inc.
> + * Copyright (C) 2009 Igor M. Liplianin
> + * Copyright (C) 2009 Abylay Ospan
> + *
> + *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., 675 Mass Ave, Cambridge, MA 02139, USA.
> + */
> +
> +#include "dvb_ca_en50221.h"
> +#include "dvb_usb.h"
> +#include "m88ds3103.h"
> +#include "m88ts2022.h"
> +
> +static int dvbsky_debug;
> +module_param(dvbsky_debug, int, 0644);
> +MODULE_PARM_DESC(dvbsky_debug, "Activates dvbsky usb debugging (default:0)");
> +
> +#define DVBSKY_MSG_DELAY 0/*2000*/
> +#define DVBSKY_CI_CTL0x04
> +#define DVBSKY_CI_RD 1
> +
> +#define dprintk(args...) \
> + do { \
> + if (dvbsky_debug) \
> + printk(KERN_INFO "dvbsky_usb: " args); \
> + } while (0)
> +
> +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
> +
> +struct dvbsky_state {
> + struct mutex stream_mutex;
> + u8 has_ci;
> + u8 ci_attached;
> + struct dvb_ca_en50221 ci;
> + unsigned long next_status_checked_time;
> + u8 ci_i2c_addr;
> + u8 current_ci_flag;
> + int ci_status;
> + struct i2c_client *i2c_client_tuner;
> +};
> +
> +static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff)
> +{
> + struct dvbsky_state *state = d_to_priv(d);
> + int ret;
> + u8 obuf_pre[3] = { 0x37, 0, 0 };
> + u8 obuf_post[3] = { 0x36, 3, 0 };
> + dprintk("%s() -off \n", __func__);
> + mutex_lock(&state->stream_mutex);
> + ret = dvb_usbv2_generic_write(d, obuf_pre, 3);
> + if (!ret && onoff) {
> + msleep(10);
> + ret = dvb_usbv2_generic_write(d, obuf_post, 3);
> + dprintk("%s() -on \n", __func__);
> + }
> + mutex_unlock(&state->stream_mutex);
> + return ret;
> +}
> +
> +/* CI opertaions */
> +static int dvbsky_ci_read_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg,
> + u8 *buf, int len)
> +{
> + int