Re: [PATCH V2 4/5] [media] cxd2841er: Sony CXD2841ER DVB-S/S2/T/T2/C demodulator driver

2015-06-30 Thread Kozlov Sergey

Hi Mauro,

Thanks for your review.
I started work on V3 patch series, and found no information about 
roll-off handling in the CDX2841 demodulator chip documentation. It 
seemks that roll-off is handled automatically.


Best regards,
Sergey

14.05.2015 17:15, Mauro Carvalho Chehab пишет:

Em Wed, 15 Apr 2015 13:07:49 +0300
se...@netup.ru escreveu:

+
+static int cxd2841er_set_frontend_s(struct dvb_frontend *fe)
+{
+   int ret = 0, i, timeout, carr_offset;
+   fe_status_t status;
+   struct cxd2841er_priv *priv = fe-demodulator_priv;
+   struct dtv_frontend_properties *p = fe-dtv_property_cache;
+   u32 symbol_rate = p-symbol_rate/1000;
+
+   dev_dbg(priv-i2c-dev, %s(): %s frequency=%d symbol_rate=%d\n,
+   __func__,
+   (p-delivery_system == SYS_DVBS ? DVB-S : DVB-S2),
+p-frequency, symbol_rate);


I was unable to identify how ROLLOFF is handled for DVB-S2 in this code.



--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] [media] netup_unidvb: NetUP Universal DVB-S/S2/T/T2/C PCI-E card driver

2015-02-03 Thread Kozlov Sergey

NetUP Dual Universal CI PCIe board driver.
The board has
- two CI slots
- two I2C adapters
- SPI master bus for accessing flash memory containing
  FPGA firmware

Signed-off-by: Kozlov Sergey se...@netup.ru
---
 MAINTAINERS |9 +
 drivers/media/pci/Kconfig   |1 +
 drivers/media/pci/Makefile  |3 +-
 drivers/media/pci/netup/Kconfig |   12 +
 drivers/media/pci/netup/Makefile|9 +
 drivers/media/pci/netup/netup_unidvb.h  |  232 +++
 drivers/media/pci/netup/netup_unidvb_ci.c   |  248 
 drivers/media/pci/netup/netup_unidvb_core.c |  919 +++
 drivers/media/pci/netup/netup_unidvb_i2c.c  |  350 ++
 drivers/media/pci/netup/netup_unidvb_spi.c  |  272 
 10 files changed, 2054 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/pci/netup/Kconfig
 create mode 100644 drivers/media/pci/netup/Makefile
 create mode 100644 drivers/media/pci/netup/netup_unidvb.h
 create mode 100644 drivers/media/pci/netup/netup_unidvb_ci.c
 create mode 100644 drivers/media/pci/netup/netup_unidvb_core.c
 create mode 100644 drivers/media/pci/netup/netup_unidvb_i2c.c
 create mode 100644 drivers/media/pci/netup/netup_unidvb_spi.c

diff --git a/MAINTAINERS b/MAINTAINERS
index a52001c..e2febd3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6572,6 +6572,15 @@ F:   include/net/netrom.h
 F: include/uapi/linux/netrom.h
 F: net/netrom/
 
+NETUP VIDEO4LINUX DRIVER
+M: Sergey Kozlov se...@netup.ru
+L: linux-media@vger.kernel.org
+W: http://linuxtv.org/
+W: http://netup.tv/
+T: git git://linuxtv.org/media_tree.git
+S: Supported
+F: drivers/media/pci/netup/*
+
 NETWORK BLOCK DEVICE (NBD)
 M: Paul Clements paul.cleme...@steeleye.com
 S: Maintained
diff --git a/drivers/media/pci/Kconfig b/drivers/media/pci/Kconfig
index 218144a..f1ec01e 100644
--- a/drivers/media/pci/Kconfig
+++ b/drivers/media/pci/Kconfig
@@ -47,6 +47,7 @@ source drivers/media/pci/mantis/Kconfig
 source drivers/media/pci/ngene/Kconfig
 source drivers/media/pci/ddbridge/Kconfig
 source drivers/media/pci/smipcie/Kconfig
+source drivers/media/pci/netup/Kconfig
 endif
 
 endif #MEDIA_PCI_SUPPORT
diff --git a/drivers/media/pci/Makefile b/drivers/media/pci/Makefile
index 0baf0d2..92be70e 100644
--- a/drivers/media/pci/Makefile
+++ b/drivers/media/pci/Makefile
@@ -12,7 +12,8 @@ obj-y+=   ttpci/  \
ngene/  \
ddbridge/   \
saa7146/\
-   smipcie/
+   smipcie/\
+   netup/
 
 obj-$(CONFIG_VIDEO_IVTV) += ivtv/
 obj-$(CONFIG_VIDEO_ZORAN) += zoran/
diff --git a/drivers/media/pci/netup/Kconfig b/drivers/media/pci/netup/Kconfig
new file mode 100644
index 000..3ad3cc3
--- /dev/null
+++ b/drivers/media/pci/netup/Kconfig
@@ -0,0 +1,12 @@
+config DVB_NETUP_UNIDVB
+   tristate NetUP Universal DVB card support
+   depends on DVB_CORE  VIDEO_DEV  PCI  I2C  SPI_MASTER
+select VIDEOBUF_DVB
+select VIDEOBUF_VMALLOC
+   select DVB_HORUS3A if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_ASCOT2E if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_LNBH25 if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_CXD2841ER if MEDIA_SUBDRV_AUTOSELECT
+   ---help---
+ Support for NetUP PCI express Universal DVB card.
+
diff --git a/drivers/media/pci/netup/Makefile b/drivers/media/pci/netup/Makefile
new file mode 100644
index 000..ee6ae05
--- /dev/null
+++ b/drivers/media/pci/netup/Makefile
@@ -0,0 +1,9 @@
+netup-unidvb-objs += netup_unidvb_core.o
+netup-unidvb-objs += netup_unidvb_i2c.o
+netup-unidvb-objs += netup_unidvb_ci.o
+netup-unidvb-objs += netup_unidvb_spi.o
+
+obj-$(CONFIG_DVB_NETUP_UNIDVB) += netup-unidvb.o
+
+ccflags-y += -Idrivers/media/dvb-core
+ccflags-y += -Idrivers/media/dvb-frontends
diff --git a/drivers/media/pci/netup/netup_unidvb.h 
b/drivers/media/pci/netup/netup_unidvb.h
new file mode 100644
index 000..4d0e1eb
--- /dev/null
+++ b/drivers/media/pci/netup/netup_unidvb.h
@@ -0,0 +1,232 @@
+/*
+ * netup_unidvb.h
+ *
+ * Data type definitions for NetUP Universal Dual DVB-CI
+ *
+ * Copyright (C) 2014 NetUP Inc.
+ * Copyright (C) 2014 Sergey Kozlov se...@netup.ru
+ * Copyright (C) 2014 Abylay Ospan aos...@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.
+ */
+
+#include linux/pci.h
+#include linux/i2c.h
+#include linux/workqueue.h
+#include media/v4l2-common.h

[PATCH 4/5] [media] cxd2841er: Sony CXD2841ER DVB-S/S2/T/T2/C demodulator driver

2015-02-03 Thread Kozlov Sergey

DVB-C/T/T2/S/S2 demodulator frontend driver Sony CXD2841ER chip.

Signed-off-by: Kozlov Sergey se...@netup.ru
---
 MAINTAINERS  |9 +
 drivers/media/dvb-frontends/Kconfig  |7 +
 drivers/media/dvb-frontends/Makefile |1 +
 drivers/media/dvb-frontends/cxd2841er.c  | 2778 ++
 drivers/media/dvb-frontends/cxd2841er.h  |   64 +
 drivers/media/dvb-frontends/cxd2841er_priv.h |   44 +
 6 files changed, 2903 insertions(+)
 create mode 100644 drivers/media/dvb-frontends/cxd2841er.c
 create mode 100644 drivers/media/dvb-frontends/cxd2841er.h
 create mode 100644 drivers/media/dvb-frontends/cxd2841er_priv.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 8a687dc..a52001c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2841,6 +2841,15 @@ T:   git git://linuxtv.org/anttip/media_tree.git
 S: Maintained
 F: drivers/media/dvb-frontends/cxd2820r*
 
+CXD2841ER MEDIA DRIVER
+M: Sergey Kozlov se...@netup.ru
+L: linux-media@vger.kernel.org
+W: http://linuxtv.org/
+W: http://netup.tv/
+T: git git://linuxtv.org/media_tree.git
+S: Supported
+F: drivers/media/dvb-frontends/cxd2841er*
+
 CXGB3 ETHERNET DRIVER (CXGB3)
 M: Santosh Raspatur sant...@chelsio.com
 L: net...@vger.kernel.org
diff --git a/drivers/media/dvb-frontends/Kconfig 
b/drivers/media/dvb-frontends/Kconfig
index b3b216d..52ac698 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -441,6 +441,13 @@ config DVB_CXD2820R
help
  Say Y when you want to support this frontend.
 
+config DVB_CXD2841ER
+   tristate Sony CXD2841ER
+   depends on DVB_CORE  I2C
+   default m if !MEDIA_SUBDRV_AUTOSELECT
+   help
+ Say Y when you want to support this frontend.
+
 config DVB_RTL2830
tristate Realtek RTL2830 DVB-T
depends on DVB_CORE  I2C
diff --git a/drivers/media/dvb-frontends/Makefile 
b/drivers/media/dvb-frontends/Makefile
index 06a0d21..f67cb8c 100644
--- a/drivers/media/dvb-frontends/Makefile
+++ b/drivers/media/dvb-frontends/Makefile
@@ -104,6 +104,7 @@ obj-$(CONFIG_DVB_MB86A20S) += mb86a20s.o
 obj-$(CONFIG_DVB_IX2505V) += ix2505v.o
 obj-$(CONFIG_DVB_STV0367) += stv0367.o
 obj-$(CONFIG_DVB_CXD2820R) += cxd2820r.o
+obj-$(CONFIG_DVB_CXD2841ER) += cxd2841er.o
 obj-$(CONFIG_DVB_DRXK) += drxk.o
 obj-$(CONFIG_DVB_TDA18271C2DD) += tda18271c2dd.o
 obj-$(CONFIG_DVB_SI2165) += si2165.o
diff --git a/drivers/media/dvb-frontends/cxd2841er.c 
b/drivers/media/dvb-frontends/cxd2841er.c
new file mode 100644
index 000..6ade289
--- /dev/null
+++ b/drivers/media/dvb-frontends/cxd2841er.c
@@ -0,0 +1,2778 @@
+/*
+ * cxd2841er.c
+ *
+ * Sony CXD2441ER digital demodulator driver
+ *
+ * Copyright 2012 Sony Corporation
+ * Copyright (C) 2014 NetUP Inc.
+ * Copyright (C) 2014 Sergey Kozlov se...@netup.ru
+ * Copyright (C) 2014 Abylay Ospan aos...@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.
+  */
+
+#include linux/module.h
+#include linux/init.h
+#include linux/string.h
+#include linux/slab.h
+
+#include dvb_frontend.h
+#include cxd2841er.h
+#include cxd2841er_priv.h
+
+static int debug;
+
+#define dprintk(args...) \
+do { \
+   if (debug) \
+   dev_dbg(priv-i2c-dev, args); \
+} while (0)
+
+enum cxd2841er_state {
+   STATE_SHUTDOWN = 0,
+   STATE_SLEEP_S,
+   STATE_ACTIVE_S,
+   STATE_SLEEP_TC,
+   STATE_ACTIVE_TC
+};
+
+struct cxd2841er_priv {
+   struct dvb_frontend frontend;
+   struct i2c_adapter  *i2c;
+   u8  i2c_addr_slvx;
+   u8  i2c_addr_slvt;
+   const struct cxd2841er_config   *config;
+   enum cxd2841er_statestate;
+   u8  system;
+};
+
+static const struct cxd2841er_cnr_data s_cn_data[] = {
+   { 0x033e, 0 }, { 0x0339, 100 }, { 0x0333, 200 },
+   { 0x032e, 300 }, { 0x0329, 400 }, { 0x0324, 500 },
+   { 0x031e, 600 }, { 0x0319, 700 }, { 0x0314, 800 },
+   { 0x030f, 900 }, { 0x030a, 1000 }, { 0x02ff, 1100 },
+   { 0x02f4, 1200 }, { 0x02e9, 1300 }, { 0x02de, 1400 },
+   { 0x02d4, 1500 }, { 0x02c9, 1600 }, { 0x02bf, 1700 },
+   { 0x02b5, 1800 }, { 0x02ab, 1900 }, { 0x02a1, 2000 },
+   { 0x029b, 2100 }, { 0x0295, 2200 }, { 0x0290, 2300 },
+   { 0x028a, 2400 }, { 0x0284, 2500 }, { 0x027f, 2600 },
+   { 0x0279, 2700 }, { 0x0274, 2800 }, { 0x026e, 2900 },
+   { 0x0269, 3000

[PATCH 1/5] [media] horus3a: Sony Horus3A DVB-S/S2 tuner driver

2015-02-02 Thread Kozlov Sergey

DVB-S/S2 frontend driver for Sony Horus3A (CXD2832AER) chip

Signed-off-by: Kozlov Sergey se...@netup.ru
---
 MAINTAINERS   |9 +
 drivers/media/dvb-frontends/Kconfig   |7 +
 drivers/media/dvb-frontends/Makefile  |1 +
 drivers/media/dvb-frontends/horus3a.c |  429 +
 drivers/media/dvb-frontends/horus3a.h |   53 
 5 files changed, 499 insertions(+)
 create mode 100644 drivers/media/dvb-frontends/horus3a.c
 create mode 100644 drivers/media/dvb-frontends/horus3a.h

diff --git a/MAINTAINERS b/MAINTAINERS
index ddb9ac8..a3a1767 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4365,6 +4365,15 @@ W:   http://linuxtv.org
 S: Odd Fixes
 F: drivers/media/usb/hdpvr/
 
+HORUS3A MEDIA DRIVER
+M: Sergey Kozlov se...@netup.ru
+L: linux-media@vger.kernel.org
+W: http://linuxtv.org/
+W: http://netup.tv/
+T: git git://linuxtv.org/media_tree.git
+S: Supported
+F: drivers/media/dvb-frontends/horus3a*
+
 HWPOISON MEMORY FAILURE HANDLING
 M: Naoya Horiguchi n-horigu...@ah.jp.nec.com
 L: linux...@kvack.org
diff --git a/drivers/media/dvb-frontends/Kconfig 
b/drivers/media/dvb-frontends/Kconfig
index 6c75418..c2c157b 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -796,6 +796,13 @@ config DVB_AF9033
depends on DVB_CORE  I2C
default m if !MEDIA_SUBDRV_AUTOSELECT
 
+config DVB_HORUS3A
+   tristate Sony Horus3A tuner
+   depends on DVB_CORE  I2C
+   default m if !MEDIA_SUBDRV_AUTOSELECT
+   help
+ Say Y when you want to support this frontend.
+
 comment Tools to develop new frontends
 
 config DVB_DUMMY_FE
diff --git a/drivers/media/dvb-frontends/Makefile 
b/drivers/media/dvb-frontends/Makefile
index ba59df6..3aa05f3 100644
--- a/drivers/media/dvb-frontends/Makefile
+++ b/drivers/media/dvb-frontends/Makefile
@@ -116,3 +116,4 @@ obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o
 obj-$(CONFIG_DVB_AF9033) += af9033.o
 obj-$(CONFIG_DVB_AS102_FE) += as102_fe.o
 obj-$(CONFIG_DVB_TC90522) += tc90522.o
+obj-$(CONFIG_DVB_HORUS3A) += horus3a.o
diff --git a/drivers/media/dvb-frontends/horus3a.c 
b/drivers/media/dvb-frontends/horus3a.c
new file mode 100644
index 000..aaf61d5ef
--- /dev/null
+++ b/drivers/media/dvb-frontends/horus3a.c
@@ -0,0 +1,429 @@
+/*
+ * horus3a.h
+ *
+ * Sony Horus3A DVB-S/S2 tuner driver
+ *
+ * Copyright 2012 Sony Corporation
+ * Copyright (C) 2014 NetUP Inc.
+ * Copyright (C) 2014 Sergey Kozlov se...@netup.ru
+ * Copyright (C) 2014 Abylay Ospan aos...@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.
+  */
+
+#include linux/slab.h
+#include linux/module.h
+#include linux/dvb/frontend.h
+#include linux/types.h
+#include horus3a.h
+#include dvb_frontend.h
+
+static int debug;
+module_param(debug, int, 0644);
+
+#define dprintk(args...) \
+   do { \
+   if (debug) \
+   dev_dbg(priv-i2c-dev, args); \
+   } while (0)
+
+enum horus3a_state {
+   STATE_UNKNOWN,
+   STATE_SLEEP,
+   STATE_ACTIVE
+};
+
+struct horus3a_priv {
+   u32 frequency;
+   u8  i2c_address;
+   struct i2c_adapter  *i2c;
+   enum horus3a_state  state;
+   void*set_tuner_data;
+   int (*set_tuner)(void *, int);
+};
+
+static void horus3a_i2c_debug(struct horus3a_priv *priv,
+   u8 reg, u8 write, const u8 *data, u32 len)
+{
+   u32 i;
+   u8 buf[128];
+   int offst = 0;
+
+   for (i = 0; i  len; i++) {
+   offst += snprintf(buf + offst, sizeof(buf) - offst,  %02x,
+   data[i]);
+   if (offst = sizeof(buf) - 1)
+   break;
+   }
+   dprintk(horus3a: I2C %s 0x%02x [%s ]\n,
+   (write == 0 ? read : write), reg, buf);
+}
+
+static int horus3a_write_regs(struct horus3a_priv *priv,
+   u8 reg, const u8 *data, u32 len)
+{
+   int ret;
+   u8 buf[len+1];
+   struct i2c_msg msg[1] = {
+   {
+   .addr = priv-i2c_address,
+   .flags = 0,
+   .len = sizeof(buf),
+   .buf = buf,
+   }
+   };
+
+   horus3a_i2c_debug(priv, reg, 1, data, len);
+   buf[0] = reg;
+   memcpy(buf[1], data, len);
+
+   ret = i2c_transfer(priv-i2c, msg, 1);
+   if (ret == 1) {
+   ret = 0;
+   } else

[PATCH 3/5] [media] lnbh25: LNBH25 SEC controller driver

2015-02-02 Thread Kozlov Sergey

DVB SEC frontend driver for STM LNBH25PQR chip.

Signed-off-by: Kozlov Sergey se...@netup.ru
---
 MAINTAINERS  |9 ++
 drivers/media/dvb-frontends/Kconfig  |8 ++
 drivers/media/dvb-frontends/Makefile |1 +
 drivers/media/dvb-frontends/lnbh25.c |  182 ++
 drivers/media/dvb-frontends/lnbh25.h |   56 +++
 5 files changed, 256 insertions(+)
 create mode 100644 drivers/media/dvb-frontends/lnbh25.c
 create mode 100644 drivers/media/dvb-frontends/lnbh25.h

diff --git a/MAINTAINERS b/MAINTAINERS
index a022d6d..8a687dc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5853,6 +5853,15 @@ Q:   
http://patchwork.linuxtv.org/project/linux-media/list/
 S: Maintained
 F: drivers/media/usb/dvb-usb-v2/lmedm04*
 
+LNBH25 MEDIA DRIVER
+M: Sergey Kozlov se...@netup.ru
+L: linux-media@vger.kernel.org
+W: http://linuxtv.org/
+W: http://netup.tv/
+T: git git://linuxtv.org/media_tree.git
+S: Supported
+F: drivers/media/dvb-frontends/lnbh25*
+
 LOCKDEP AND LOCKSTAT
 M: Peter Zijlstra pet...@infradead.org
 M: Ingo Molnar mi...@redhat.com
diff --git a/drivers/media/dvb-frontends/Kconfig 
b/drivers/media/dvb-frontends/Kconfig
index c94bb7b..b3b216d 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -693,6 +693,14 @@ comment SEC control devices for DVB-S
 
 source drivers/media/dvb-frontends/drx39xyj/Kconfig
 
+config DVB_LNBH25
+   tristate LNBH25 SEC controller
+   depends on DVB_CORE  I2C
+   default m if !MEDIA_SUBDRV_AUTOSELECT
+   help
+ An SEC control chip.
+ Say Y when you want to support this chip.
+
 config DVB_LNBP21
tristate LNBP21/LNBH24 SEC controllers
depends on DVB_CORE  I2C
diff --git a/drivers/media/dvb-frontends/Makefile 
b/drivers/media/dvb-frontends/Makefile
index 0b19c10..06a0d21 100644
--- a/drivers/media/dvb-frontends/Makefile
+++ b/drivers/media/dvb-frontends/Makefile
@@ -56,6 +56,7 @@ obj-$(CONFIG_DVB_LGDT330X) += lgdt330x.o
 obj-$(CONFIG_DVB_LGDT3305) += lgdt3305.o
 obj-$(CONFIG_DVB_LG2160) += lg2160.o
 obj-$(CONFIG_DVB_CX24123) += cx24123.o
+obj-$(CONFIG_DVB_LNBH25) += lnbh25.o
 obj-$(CONFIG_DVB_LNBP21) += lnbp21.o
 obj-$(CONFIG_DVB_LNBP22) += lnbp22.o
 obj-$(CONFIG_DVB_ISL6405) += isl6405.o
diff --git a/drivers/media/dvb-frontends/lnbh25.c 
b/drivers/media/dvb-frontends/lnbh25.c
new file mode 100644
index 000..fcefc66
--- /dev/null
+++ b/drivers/media/dvb-frontends/lnbh25.c
@@ -0,0 +1,182 @@
+/*
+ * lnbh25.c
+ *
+ * Driver for LNB supply and control IC LNBH25
+ *
+ * Copyright (C) 2014 NetUP Inc.
+ * Copyright (C) 2014 Sergey Kozlov se...@netup.ru
+ * Copyright (C) 2014 Abylay Ospan aos...@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.
+ */
+
+#include linux/module.h
+#include linux/init.h
+#include linux/string.h
+#include linux/slab.h
+
+#include dvb_frontend.h
+#include lnbh25.h
+
+static int debug;
+
+#define dprintk(args...) \
+   do { \
+   if (debug) \
+   dev_dbg(priv-i2c-dev, args); \
+   } while (0)
+
+struct lnbh25_priv {
+   struct i2c_adapter  *i2c;
+   u8  i2c_address;
+   /*
+* LNBH25 configuration:
+* offset 0: first LNBH25 register address: always 0x02 (DATA1)
+* offset 1: DATA1 register value
+* offset 2: DATA2 register value
+*/
+   u8  config[3];
+};
+
+#define LNBH25_STATUS_OFL  0x1
+#define LNBH25_STATUS_VMON 0x4
+#define LNBH25_VSEL_13 0x03
+#define LNBH25_VSEL_18 0x0a
+
+static void lnbh25_read_vmon(struct lnbh25_priv *priv)
+{
+   int i;
+   u8 addr = 0x00;
+   u8 status[6];
+   struct i2c_msg msg[2] = {
+   {
+   .addr = priv-i2c_address,
+   .flags = 0,
+   .len = 1,
+   .buf = addr
+   }, {
+   .addr = priv-i2c_address,
+   .flags = I2C_M_RD,
+   .len = sizeof(status),
+   .buf = status
+   }
+   };
+
+   msleep(100);
+   for (i = 0; i  2; i++) {
+   if (i2c_transfer(priv-i2c, msg[i], 1) != 1) {
+   dprintk(%s(): I2C transfer %d failed\n,
+   __func__, i);
+   return;
+   }
+   }
+   for (i = 0; i  sizeof(status); i

[PATCH 2/5] [media] ascot2e: Sony Ascot2e DVB-C/T/T2 tuner driver

2015-02-02 Thread Kozlov Sergey

DVB-T/T2/C frontend driver for Sony Ascot2e (CXD2861ER) chip.

Signed-off-by: Kozlov Sergey se...@netup.ru
---
 MAINTAINERS   |9 +
 drivers/media/dvb-frontends/Kconfig   |7 +
 drivers/media/dvb-frontends/Makefile  |1 +
 drivers/media/dvb-frontends/ascot2e.c |  551 +
 drivers/media/dvb-frontends/ascot2e.h |   53 
 5 files changed, 621 insertions(+)
 create mode 100644 drivers/media/dvb-frontends/ascot2e.c
 create mode 100644 drivers/media/dvb-frontends/ascot2e.h

diff --git a/MAINTAINERS b/MAINTAINERS
index a3a1767..a022d6d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1613,6 +1613,15 @@ S:   Maintained
 F: Documentation/hwmon/asc7621
 F: drivers/hwmon/asc7621.c
 
+ASCOT2E MEDIA DRIVER
+M: Sergey Kozlov se...@netup.ru
+L: linux-media@vger.kernel.org
+W: http://linuxtv.org
+W: http://netup.tv/
+T: git git://linuxtv.org/media_tree.git
+S: Supported
+F: drivers/media/dvb-frontends/ascot2e*
+
 ASUS NOTEBOOKS AND EEEPC ACPI/WMI EXTRAS DRIVERS
 M: Corentin Chary corentin.ch...@gmail.com
 L: acpi4asus-u...@lists.sourceforge.net
diff --git a/drivers/media/dvb-frontends/Kconfig 
b/drivers/media/dvb-frontends/Kconfig
index c2c157b..c94bb7b 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -803,6 +803,13 @@ config DVB_HORUS3A
help
  Say Y when you want to support this frontend.
 
+config DVB_ASCOT2E
+   tristate Sony Ascot2E tuner
+   depends on DVB_CORE  I2C
+   default m if !MEDIA_SUBDRV_AUTOSELECT
+   help
+ Say Y when you want to support this frontend.
+
 comment Tools to develop new frontends
 
 config DVB_DUMMY_FE
diff --git a/drivers/media/dvb-frontends/Makefile 
b/drivers/media/dvb-frontends/Makefile
index 3aa05f3..0b19c10 100644
--- a/drivers/media/dvb-frontends/Makefile
+++ b/drivers/media/dvb-frontends/Makefile
@@ -117,3 +117,4 @@ obj-$(CONFIG_DVB_AF9033) += af9033.o
 obj-$(CONFIG_DVB_AS102_FE) += as102_fe.o
 obj-$(CONFIG_DVB_TC90522) += tc90522.o
 obj-$(CONFIG_DVB_HORUS3A) += horus3a.o
+obj-$(CONFIG_DVB_ASCOT2E) += ascot2e.o
diff --git a/drivers/media/dvb-frontends/ascot2e.c 
b/drivers/media/dvb-frontends/ascot2e.c
new file mode 100644
index 000..d0bde8ea
--- /dev/null
+++ b/drivers/media/dvb-frontends/ascot2e.c
@@ -0,0 +1,551 @@
+/*
+ * ascot2e.c
+ *
+ * Sony Ascot3E DVB-T/T2/C/C2 tuner driver
+ *
+ * Copyright 2012 Sony Corporation
+ * Copyright (C) 2014 NetUP Inc.
+ * Copyright (C) 2014 Sergey Kozlov se...@netup.ru
+ * Copyright (C) 2014 Abylay Ospan aos...@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.
+  */
+
+#include linux/slab.h
+#include linux/module.h
+#include linux/dvb/frontend.h
+#include linux/types.h
+#include ascot2e.h
+#include dvb_frontend.h
+
+static int debug;
+module_param(debug, int, 0644);
+
+#define dprintk(args...) \
+   do { \
+   if (debug) \
+   printk(args); \
+   } while (0)
+
+enum ascot2e_state {
+   STATE_UNKNOWN,
+   STATE_SLEEP,
+   STATE_ACTIVE
+};
+
+struct ascot2e_priv {
+   u32 frequency;
+   u8  i2c_address;
+   struct i2c_adapter  *i2c;
+   enum ascot2e_state  state;
+   void*set_tuner_data;
+   int (*set_tuner)(void *, int);
+};
+
+enum ascot2e_tv_system_t {
+   ASCOT2E_DTV_DVBT_5,
+   ASCOT2E_DTV_DVBT_6,
+   ASCOT2E_DTV_DVBT_7,
+   ASCOT2E_DTV_DVBT_8,
+   ASCOT2E_DTV_DVBT2_1_7,
+   ASCOT2E_DTV_DVBT2_5,
+   ASCOT2E_DTV_DVBT2_6,
+   ASCOT2E_DTV_DVBT2_7,
+   ASCOT2E_DTV_DVBT2_8,
+   ASCOT2E_DTV_DVBC_6,
+   ASCOT2E_DTV_DVBC_8,
+   ASCOT2E_DTV_DVBC2_6,
+   ASCOT2E_DTV_DVBC2_8,
+   ASCOT2E_DTV_UNKNOWN
+};
+
+struct ascot2e_band_sett {
+   u8  if_out_sel;
+   u8  agc_sel;
+   u8  mix_oll;
+   u8  rf_gain;
+   u8  if_bpf_gc;
+   u8  fif_offset;
+   u8  bw_offset;
+   u8  bw;
+   u8  rf_oldet;
+   u8  if_bpf_f0;
+};
+
+#define ASCOT2E_AUTO   0xff
+#define ASCOT2E_OFFSET(ofs)((u8)(ofs)  0x1F)
+#define ASCOT2E_BW_6   0x00
+#define ASCOT2E_BW_7   0x01
+#define ASCOT2E_BW_8   0x02
+#define ASCOT2E_BW_1_7 0x03
+
+static struct ascot2e_band_sett ascot2e_sett[] = {
+   { ASCOT2E_AUTO, ASCOT2E_AUTO, 0x03, ASCOT2E_AUTO, 0x06,
+ ASCOT2E_OFFSET(-8

[PATCH 0/5] [media] NetUP Universal DVB PCIe card support

2015-02-02 Thread Kozlov Sergey

This patch adds support for NetUP Universal Dual DVB-CI PCIe board.
The board has:

- two CI slots

- Altera FPGA-based PCIe bridge

- two independent multistandard DTV demodulators based on
  Sony CXD2841ER chip

- two Sony Horus3a DVB-S/S2 tuner chips

- two Sony Ascot2e DVB-T/T2/C/C2 tuner chips

- two LNBH25 SEC controller chips

DVB-C2 is supported by hardware but not yet implemented in the driver.
Product webpages are
http://www.netup.tv/en-EN/netup-universal-dual-dvb-ci (official)
http://linuxtv.org/wiki/index.php/NetUP_Dual_Universal_CI (LinuxTV WIKI)

Also we have a copy of http://git.linuxtv.org/cgit.cgi/linux.git/
repository with our patches at http://git.netup.tv/linux-netup-unidvb.git


Kozlov Sergey (5):
  [media] horus3a: Sony Horus3A DVB-S/S2 tuner driver
  [media] ascot2e: Sony Ascot2e DVB-C/T/T2 tuner driver
  [media] lnbh25: LNBH25 SEC controller driver
  [media] cxd2841er: Sony CXD2841ER DVB-S/S2/T/T2/C demodulator driver
  [media] netup_unidvb: NetUP Universal DVB-S/S2/T/T2/C PCI-E card
driver

 MAINTAINERS  |   45 +
 drivers/media/dvb-frontends/Kconfig  |   29 +
 drivers/media/dvb-frontends/Makefile |4 +
 drivers/media/dvb-frontends/ascot2e.c|  551 +
 drivers/media/dvb-frontends/ascot2e.h|   53 +
 drivers/media/dvb-frontends/cxd2841er.c  | 2778 ++
 drivers/media/dvb-frontends/cxd2841er.h  |   64 +
 drivers/media/dvb-frontends/cxd2841er_priv.h |   44 +
 drivers/media/dvb-frontends/horus3a.c|  429 
 drivers/media/dvb-frontends/horus3a.h|   53 +
 drivers/media/dvb-frontends/lnbh25.c |  182 ++
 drivers/media/dvb-frontends/lnbh25.h |   56 +
 drivers/media/pci/Kconfig|1 +
 drivers/media/pci/Makefile   |3 +-
 drivers/media/pci/netup/Kconfig  |   12 +
 drivers/media/pci/netup/Makefile |9 +
 drivers/media/pci/netup/netup_unidvb.h   |  232 +++
 drivers/media/pci/netup/netup_unidvb_ci.c|  248 +++
 drivers/media/pci/netup/netup_unidvb_core.c  |  919 +
 drivers/media/pci/netup/netup_unidvb_i2c.c   |  350 
 drivers/media/pci/netup/netup_unidvb_spi.c   |  272 +++
 21 files changed, 6333 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/dvb-frontends/ascot2e.c
 create mode 100644 drivers/media/dvb-frontends/ascot2e.h
 create mode 100644 drivers/media/dvb-frontends/cxd2841er.c
 create mode 100644 drivers/media/dvb-frontends/cxd2841er.h
 create mode 100644 drivers/media/dvb-frontends/cxd2841er_priv.h
 create mode 100644 drivers/media/dvb-frontends/horus3a.c
 create mode 100644 drivers/media/dvb-frontends/horus3a.h
 create mode 100644 drivers/media/dvb-frontends/lnbh25.c
 create mode 100644 drivers/media/dvb-frontends/lnbh25.h
 create mode 100644 drivers/media/pci/netup/Kconfig
 create mode 100644 drivers/media/pci/netup/Makefile
 create mode 100644 drivers/media/pci/netup/netup_unidvb.h
 create mode 100644 drivers/media/pci/netup/netup_unidvb_ci.c
 create mode 100644 drivers/media/pci/netup/netup_unidvb_core.c
 create mode 100644 drivers/media/pci/netup/netup_unidvb_i2c.c
 create mode 100644 drivers/media/pci/netup/netup_unidvb_spi.c

-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html