Re: [PATCH 2/2] smipcie: MAC address printout formatting
Reviewed-by: Max NibbleOn 2016-03-10 06:39:27, Olli Salonen wrote: >Modify the printout for MAC address to be more vendor agnostic. >Print also the port number. > >Signed-off-by: Olli Salonen >--- > drivers/media/pci/smipcie/smipcie-main.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/drivers/media/pci/smipcie/smipcie-main.c >b/drivers/media/pci/smipcie/smipcie-main.c >index 993a2d1..4a9275a 100644 >--- a/drivers/media/pci/smipcie/smipcie-main.c >+++ b/drivers/media/pci/smipcie/smipcie-main.c >@@ -716,7 +716,8 @@ static int smi_fe_init(struct smi_port *port) > /* init MAC.*/ > ret = smi_read_eeprom(>i2c_bus[0], 0xc0, mac_ee, 16); > dev_info(>dev->pci_dev->dev, >- "DVBSky SMI PCIe MAC= %pM\n", mac_ee + (port->idx)*8); >+ "%s port %d MAC: %pM\n", dev->info->name, >+ port->idx, mac_ee + (port->idx)*8); > memcpy(adap->proposed_mac, mac_ee + (port->idx)*8, 6); > return ret; > } >-- >1.9.1 > >-- >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 -- 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
Re: [PATCH 1/2] smipcie: add support for TechnoTrend S2-4200 Twin
Reviewed-by: Max NibbleOn 2016-03-10 06:39:26, Olli Salonen wrote: >Add support for TechnoTrend TT-budget S2-4200 Twin DVB-S2 tuner. The >device seems to be rather similar to DVBSky S952 V3. This is a PCIe >card with 2 tuners. SMI PCIe bridge is used and the card has two >Montage M88RS6000 demod/tuners. > >The M88RS6000 demod/tuner package needs firmware. You can download >one here: >http://palosaari.fi/linux/v4l-dvb/firmware/M88RS6000/ > >Signed-off-by: Olli Salonen >--- > drivers/media/pci/smipcie/smipcie-ir.c | 5 - > drivers/media/pci/smipcie/smipcie-main.c | 10 ++ > drivers/media/pci/smipcie/smipcie.h | 1 + > 3 files changed, 15 insertions(+), 1 deletion(-) > >diff --git a/drivers/media/pci/smipcie/smipcie-ir.c >b/drivers/media/pci/smipcie/smipcie-ir.c >index d018673..d737b5e 100644 >--- a/drivers/media/pci/smipcie/smipcie-ir.c >+++ b/drivers/media/pci/smipcie/smipcie-ir.c >@@ -203,7 +203,10 @@ int smi_ir_init(struct smi_dev *dev) > rc_dev->dev.parent = >pci_dev->dev; > > rc_dev->driver_type = RC_DRIVER_SCANCODE; >- rc_dev->map_name = RC_MAP_DVBSKY; >+ if (dev->info->type == SMI_TECHNOTREND_S2_4200) >+ rc_dev->map_name = RC_MAP_TT_1500; >+ else >+ rc_dev->map_name = RC_MAP_DVBSKY; > > ir->rc_dev = rc_dev; > ir->dev = dev; >diff --git a/drivers/media/pci/smipcie/smipcie-main.c >b/drivers/media/pci/smipcie/smipcie-main.c >index b039a22..993a2d1 100644 >--- a/drivers/media/pci/smipcie/smipcie-main.c >+++ b/drivers/media/pci/smipcie/smipcie-main.c >@@ -1086,6 +1086,15 @@ static struct smi_cfg_info dvbsky_t9580_cfg = { > .fe_1 = DVBSKY_FE_M88DS3103, > }; > >+static struct smi_cfg_info technotrend_s2_4200_cfg = { >+ .type = SMI_TECHNOTREND_S2_4200, >+ .name = "TechnoTrend TT-budget S2-4200 Twin", >+ .ts_0 = SMI_TS_DMA_BOTH, >+ .ts_1 = SMI_TS_DMA_BOTH, >+ .fe_0 = DVBSKY_FE_M88RS6000, >+ .fe_1 = DVBSKY_FE_M88RS6000, >+}; >+ > /* PCI IDs */ > #define SMI_ID(_subvend, _subdev, _driverdata) { \ > .vendor = SMI_VID,.device= SMI_PID, \ >@@ -1096,6 +1105,7 @@ static const struct pci_device_id smi_id_table[] = { > SMI_ID(0x4254, 0x0550, dvbsky_s950_cfg), > SMI_ID(0x4254, 0x0552, dvbsky_s952_cfg), > SMI_ID(0x4254, 0x5580, dvbsky_t9580_cfg), >+ SMI_ID(0x13c2, 0x3016, technotrend_s2_4200_cfg), > {0} > }; > MODULE_DEVICE_TABLE(pci, smi_id_table); >diff --git a/drivers/media/pci/smipcie/smipcie.h >b/drivers/media/pci/smipcie/smipcie.h >index 68cdda2..5528e48 100644 >--- a/drivers/media/pci/smipcie/smipcie.h >+++ b/drivers/media/pci/smipcie/smipcie.h >@@ -216,6 +216,7 @@ struct smi_cfg_info { > #define SMI_DVBSKY_S950 1 > #define SMI_DVBSKY_T95802 > #define SMI_DVBSKY_T982 3 >+#define SMI_TECHNOTREND_S2_4200 4 > int type; > char *name; > #define SMI_TS_NULL 0 >-- >1.9.1 > >-- >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 -- 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
Re: DVBSky T980C ci not working with kernel 4.x
Does this card work with the media code from dvbsky.net from kernel 4.x? On 2015-12-06 19:10:41, Timo_Helkiöwrote: > >Hi > > >Common interface in Dvbsky T980C is not working with Ubuntu 15.10 kernel >4.2.0 and vanilla kernel 4.6 and latest dvb-drivers from Linux-media >git. With Ubuntu 15.04 and kernel 3.19 it is working. I have tryid to >find differences in drivers, but my knolege of c it is not possible. >Erros message is "invalid PC-card". > >I have also Tevii S470 with same PCIe bridge Conexant cx23885. > >How to debug this? I can do minor changes to drivers for testing it. > > Timo Helkiö >-- >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 Best Regards, Max N�r��yb�X��ǧv�^�){.n�+{���bj)w*jg����ݢj/���z�ޖ��2�ޙ&�)ߡ�a�����G���h��j:+v���w��٥
[PATCH 1/1] SMI PCIe IR driver for DVBSky cards
ported from the manufacturer's source tree, available from http://dvbsky.net/download/linux/media_build-bst-150211.tar.gz This is the second patch after a public review. Acked-by: Nibble Max nibble@gmail.com Reviewd-by: Nibble Max nibble@gmail.com Signed-off-by: Dirk Nehring dnehr...@gmx.net --- drivers/media/pci/smipcie/Kconfig | 1 + drivers/media/pci/smipcie/Makefile | 3 + drivers/media/pci/smipcie/smipcie-ir.c | 232 + .../pci/smipcie/{smipcie.c = smipcie-main.c} | 14 +- drivers/media/pci/smipcie/smipcie.h| 19 ++ 5 files changed, 268 insertions(+), 1 deletion(-) create mode 100644 drivers/media/pci/smipcie/smipcie-ir.c rename drivers/media/pci/smipcie/{smipcie.c = smipcie-main.c} (99%) diff --git a/drivers/media/pci/smipcie/Kconfig b/drivers/media/pci/smipcie/Kconfig index 21a1583..c11c772 100644 --- a/drivers/media/pci/smipcie/Kconfig +++ b/drivers/media/pci/smipcie/Kconfig @@ -7,6 +7,7 @@ config DVB_SMIPCIE select DVB_TS2020 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_M88RS6000T if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT + depends on RC_CORE help Support for cards with SMI PCIe bridge: - DVBSky S950 V3 diff --git a/drivers/media/pci/smipcie/Makefile b/drivers/media/pci/smipcie/Makefile index be55481..013bc3f 100644 --- a/drivers/media/pci/smipcie/Makefile +++ b/drivers/media/pci/smipcie/Makefile @@ -1,3 +1,6 @@ + +smipcie-objs := smipcie-main.o smipcie-ir.o + obj-$(CONFIG_DVB_SMIPCIE) += smipcie.o ccflags-y += -Idrivers/media/tuners diff --git a/drivers/media/pci/smipcie/smipcie-ir.c b/drivers/media/pci/smipcie/smipcie-ir.c new file mode 100644 index 000..b8ea739 --- /dev/null +++ b/drivers/media/pci/smipcie/smipcie-ir.c @@ -0,0 +1,232 @@ +/* + * SMI PCIe driver for DVBSky cards. + * + * Copyright (C) 2014 Max nibble nibble@gmail.com + * + *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 smipcie.h + +static void smi_ir_enableInterrupt(struct smi_rc *ir) +{ + struct smi_dev *dev = ir-dev; + + smi_write(MSI_INT_ENA_SET, IR_X_INT); +} + +static void smi_ir_disableInterrupt(struct smi_rc *ir) +{ + struct smi_dev *dev = ir-dev; + + smi_write(MSI_INT_ENA_CLR, IR_X_INT); +} + +static void smi_ir_clearInterrupt(struct smi_rc *ir) +{ + struct smi_dev *dev = ir-dev; + + smi_write(MSI_INT_STATUS_CLR, IR_X_INT); +} + +static void smi_ir_stop(struct smi_rc *ir) +{ + struct smi_dev *dev = ir-dev; + + smi_ir_disableInterrupt(ir); + smi_clear(IR_Init_Reg, 0x80); +} + +#define BITS_PER_COMMAND 14 +#define GROUPS_PER_BIT 2 +#define IR_RC5_MIN_BIT 36 +#define IR_RC5_MAX_BIT 52 +static u32 smi_decode_rc5(u8 *pData, u8 size) +{ + u8 index, current_bit, bit_count; + u8 group_array[BITS_PER_COMMAND * GROUPS_PER_BIT + 4]; + u8 group_index = 0; + u32 command = 0x; + + group_array[group_index++] = 1; + + for (index = 0; index size; index++) { + + current_bit = (pData[index] 0x80) ? 1 : 0; + bit_count = pData[index] 0x7f; + + if ((current_bit == 1) (bit_count = 2*IR_RC5_MAX_BIT + 1)) { + goto process_code; + } else if ((bit_count = IR_RC5_MIN_BIT) + (bit_count = IR_RC5_MAX_BIT)) { + group_array[group_index++] = current_bit; + } else if ((bit_count IR_RC5_MAX_BIT) + (bit_count = 2*IR_RC5_MAX_BIT)) { + group_array[group_index++] = current_bit; + group_array[group_index++] = current_bit; + } else { + goto invalid_timing; + } + if (group_index = BITS_PER_COMMAND*GROUPS_PER_BIT) + goto process_code; + +if ((group_index == BITS_PER_COMMAND*GROUPS_PER_BIT - 1) +(group_array[group_index-1] == 0)) { + group_array[group_index++] = 1; + goto process_code; + } + } + +process_code: + if (group_index == (BITS_PER_COMMAND*GROUPS_PER_BIT-1)) + group_array[group_index++] = 1; + + if (group_index == BITS_PER_COMMAND*GROUPS_PER_BIT) { + command = 0; + for (index
Re: Re: [PATCH 1/1] SMI PCIe IR driver for DVBSky cards
Hello Ole, Due to the hardware limitation, it can not support arbitrary IR codes. The current patch supports RC5 only. On 2015-06-29 22:40:04, Ole Ernst olebo...@gmx.com wrote: Hi Max, Am 29.06.2015 um 16:09 schrieb Nibble Max: ported from the manufacturer's source tree, available from http://dvbsky.net/download/linux/media_build-bst-150211.tar.gz This is the second patch after a public review. just for the sake of clarity: I see commented out bits and pieces of RC_DRIVER_IR_RAW in your linked archive. Does this mean S950/S952/T9580 V3 models theoretically support arbitrary IR codes, but with this patch only RC5 is implemented? Or are those models only able to handle RC5? Regards, Ole Best Regards, Max -- 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
Re: Re: [PATCH 1/1] SMI PCIe driver for DVBSky cards
Hello, Just find a minor issue to do smi_ir_exit. Best Regards, Max On 2015-05-15 00:06:33, Mauro Carvalho Chehab mche...@osg.samsung.com wrote: Em Fri, 13 Mar 2015 00:09:23 +0100 Dirk Nehring dnehr...@gmx.net escreveu: ported from the manufacturer's source tree, available from http://dvbsky.net/download/linux/media_build-bst-150211.tar.gz The better would be if the author of the remote controller support to send us the patch or to reply us with his SOB. Max, Could you please take care of it? Thanks! Mauro Signed-off-by: Dirk Nehring dnehr...@gmx.net --- drivers/media/pci/smipcie/Kconfig | 1 + drivers/media/pci/smipcie/Makefile | 3 + drivers/media/pci/smipcie/smipcie-ir.c | 233 + .../pci/smipcie/{smipcie.c = smipcie-main.c} | 14 +- drivers/media/pci/smipcie/smipcie.h| 19 ++ 5 files changed, 269 insertions(+), 1 deletion(-) create mode 100644 drivers/media/pci/smipcie/smipcie-ir.c rename drivers/media/pci/smipcie/{smipcie.c = smipcie-main.c} (99%) diff --git a/drivers/media/pci/smipcie/Kconfig b/drivers/media/pci/smipcie/Kconfig index c8de53f..c24641e 100644 --- a/drivers/media/pci/smipcie/Kconfig +++ b/drivers/media/pci/smipcie/Kconfig @@ -7,6 +7,7 @@ config DVB_SMIPCIE select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_M88RS6000T if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT +depends on RC_CORE help Support for cards with SMI PCIe bridge: - DVBSky S950 V3 diff --git a/drivers/media/pci/smipcie/Makefile b/drivers/media/pci/smipcie/Makefile index be55481..013bc3f 100644 --- a/drivers/media/pci/smipcie/Makefile +++ b/drivers/media/pci/smipcie/Makefile @@ -1,3 +1,6 @@ + +smipcie-objs:= smipcie-main.o smipcie-ir.o + obj-$(CONFIG_DVB_SMIPCIE) += smipcie.o ccflags-y += -Idrivers/media/tuners diff --git a/drivers/media/pci/smipcie/smipcie-ir.c b/drivers/media/pci/smipcie/smipcie-ir.c new file mode 100644 index 000..2a32746 --- /dev/null +++ b/drivers/media/pci/smipcie/smipcie-ir.c @@ -0,0 +1,233 @@ +/* + * SMI PCIe driver for DVBSky cards. + * + * Copyright (C) 2014 Max nibble nibble@gmail.com + * + *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 smipcie.h + +static void smi_ir_enableInterrupt(struct smi_rc *ir) +{ +struct smi_dev *dev = ir-dev; + +smi_write(MSI_INT_ENA_SET, IR_X_INT); +} + +static void smi_ir_disableInterrupt(struct smi_rc *ir) +{ +struct smi_dev *dev = ir-dev; + +smi_write(MSI_INT_ENA_CLR, IR_X_INT); +} + +static void smi_ir_clearInterrupt(struct smi_rc *ir) +{ +struct smi_dev *dev = ir-dev; + +smi_write(MSI_INT_STATUS_CLR, IR_X_INT); +} + +static void smi_ir_stop(struct smi_rc *ir) +{ +struct smi_dev *dev = ir-dev; + +smi_ir_disableInterrupt(ir); +smi_clear(IR_Init_Reg, 0x80); +} + +#define BITS_PER_COMMAND 14 +#define GROUPS_PER_BIT 2 +#define IR_RC5_MIN_BIT 36 +#define IR_RC5_MAX_BIT 52 +static u32 smi_decode_rc5(u8 *pData, u8 size) +{ +u8 index, current_bit, bit_count; +u8 group_array[BITS_PER_COMMAND * GROUPS_PER_BIT + 4]; +u8 group_index = 0; +u32 command = 0x; + +group_array[group_index++] = 1; + +for (index = 0; index size; index++) { + +current_bit = (pData[index] 0x80) ? 1 : 0; +bit_count = pData[index] 0x7f; + +if ((current_bit == 1) (bit_count = 2*IR_RC5_MAX_BIT + 1)) { +goto process_code; +} else if ((bit_count = IR_RC5_MIN_BIT) + (bit_count = IR_RC5_MAX_BIT)) { +group_array[group_index++] = current_bit; +} else if ((bit_count IR_RC5_MAX_BIT) + (bit_count = 2*IR_RC5_MAX_BIT)) { +group_array[group_index++] = current_bit; +group_array[group_index++] = current_bit; +} else { +goto invalid_timing; +} +if (group_index = BITS_PER_COMMAND*GROUPS_PER_BIT) +goto process_code; + + if ((group_index == BITS_PER_COMMAND*GROUPS_PER_BIT - 1) + (group_array[group_index-1] == 0)) { +group_array[group_index++] = 1; +
Re: Re: Mystique SaTiX-S2 Sky V2 USB (DVBSKY S960 clone) - Linux driver.
Hello Steve, Could you try the following methods? 1 Could you try to install the media code from dvbsky.net? http://www.dvbsky.net/download/linux/media_build-bst-150322.tar.gz 2 You can download the driver and software for windows from dvbsky.net and test to confirm the device is working properly or not. driver: http://www.dvbsky.net/download/usb-drv/DVBSky_USB_20150326.zip software: http://www.dvbsky.net/download/software/dvbsky-setup-140715.zip Best Regards, Max On 2015-05-07 00:52:33, Steve sjh_l...@shic.co.uk wrote: Hi, thanks for your help so far... It's taken a few days - but I've now tried a variety of things without arriving at any resolution. Prior to posting, I had not downloaded any firmware. I placed the firmware from http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz into /lib/firmware... I rebooted - the only difference I discovered is that, this time, my keyboard and mouse stopped working when the SaTiX device was plugged in. Investigating syslog (after a reboot) suggested the error messages (previously posted) remained. I downloaded and built the latest v4l-dvb sources. The upshot was that the device returned to failing as in my original post (i.e. without stopping my keyboard/mouse from working.) I tried several USB cables - no improvement. I hooked the SaTiX device up to a modern, Dell, Windows 8.1 laptop. Windows recognised the device as an S960, but was not able to (automatically) determine any drivers for it. (I have no windows software for this device.) I installed Ubuntu onto a VirtualBox instance, and configured it to use the SaTiX. At first, I thought I'd made progress as lsusb worked... however I quickly discovered an error message: dvb_usb_v2: this USB2.0 device cannot be run on a USB1.1 port (it lacks a hardware PID filter) Having installed the extension pack for VirtualBox (to support virtual USB 2.0) the SaTiX device behaved identically to on the original (Ubuntu native) PC - i.e. the same errors in dmesg and lsusb fails to work after the device has been attached. The only new information that I have are the device diagnostics from Windows - the device reports: Bestunar S960-- I was surprised not to see SaTiX here. Vendor ID : 0572 Product ID : 6831 Version : Revision : 20130511 The green light, on the front of the device, only comes on once Linux has recognised the device... Can anyone offer any other advice? Have I been sent a different Sky-S960 clone to the one I ordered? On 03/05/15 08:44, Olli Salonen wrote: Hi Steve, I've got the device in question and can confirm that it works ok. lsusb definitely should work ok - maybe there's indeed something wrong with your device. As suggested by P. van Gaans, maybe you can try your device on another computer or even on Windows and see if it works there. Cheers, -olli On 2 May 2015 at 03:32, P. van Gaansw3ird_n...@gmx.net wrote: On 05/01/2015 04:57 PM, Steve wrote: Hi, I'm trying a direct mail to you as you are associated with this page: http://linuxtv.org/wiki/index.php/DVB-S2_USB_Devices I have bought a Mystique SaTiX-S2 Sky V2 USB (DVBSKY S960 clone) - but it doesn't work with my 3.19 kernel, which I'd assumed it would from the above page. I've tried asking about the problem in various ways - first to AskUbuntu: http://askubuntu.com/questions/613406/absent-frontend0-with-usb-dvbsky-s960-s860-driver-bug ... and, more recently, on the Linux-Media mailing list. Without convincing myself that I've contacted the right person/people to give constructive feedback. By any chance can you offer me some advice about who it is best to approach? (Obviously I'd also be grateful if you can shed any light on this problem.) Steve Hi Steve, The page actually states Support in-kernel is expected in Linux kernel 3.18.. Devil's advocate, but it doesn't say it's actually there or guarantees it ever will. At the time it was written, 3.18 wasn't out yet. Looking at your dmesg output however it seems your kernel is aware of the device. (so the patch made it) As for me, I was offered a bargain for another device so I have no S960. Linux-media mailing list is the right place. (and here we are) A few quick suggestions: Did you really, really, really get the right firmware and are you absolutely positive it's in the right location and has the right filename? Does dmesg mention the firmware being loaded? Get/compile the latest v4l-dvb sources. (http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers) Maybe it's just a bug that has already been fixed. Try another program to access the device. But if even lsusb hangs, this is pretty much moot. Make sure the power supply/device is functioning properly. Try it on another OS to make sure it's not defective. Try another computer, preferably with another chipset.
Re: Re: cx23885: DVBSky S952 dvb_register failed err = -22
Hello Ole, On 2015-03-18 02:32:54, Ole Ernst olebo...@gmx.com wrote: Hi Max, I get a chip_id of 0x81, which returns -ENODEV in the default branch of the subsequent switch. So I guess my S952 is too old? :-( How hard would it be to add support for it? If it is m88ts2020, there is a tuner driver ts2020 in dvb-frontends directory. If fail to load m88ts2022 driver, then try to load ts2020 driver. m88ts2022 driver is an i2c driver, but ts2020 is traditional dvb-attach driver. Please check the other code using ts2020 for reference. Best Regards, Max Thanks, Ole Am 17.03.2015 um 02:53 schrieb Nibble Max: Hello, what is the chip_id debug output from m88ts2022 module? I think you maybe hold the old S952 card. Its satellite tuner is M88TS2020, not M88TS2022. Best Regards, Max On 2015-03-15 19:07:07, Ole Ernst olebo...@gmx.com wrote: Hi Antti, thanks for your quick response! Based on lsmod and modinfo I do have m88ts2022. $ lsmod | grep m88 m88ts2022 16898 0 regmap_i2c 12783 1 m88ts2022 m88ds3103 21452 0 i2c_mux12534 1 m88ds3103 dvb_core 102038 4 cx23885,altera_ci,m88ds3103,videobuf2_dvb i2c_core 50240 13 drm,i2c_i801,cx23885,cx25840,m88ts2022,i2c_mux,regmap_i2c,nvidia,v4l2_common,tveeprom,m88ds3103,tda18271,videodev $ modinfo m88ts2022 filename: /lib/modules/3.19.1-1-ARCH/kernel/drivers/media/tuners/m88ts2022.ko.gz license:GPL author: Antti Palosaari cr...@iki.fi description:Montage M88TS2022 silicon tuner driver alias: i2c:m88ts2022 depends:i2c-core,regmap-i2c intree: Y vermagic: 3.19.1-1-ARCH SMP preempt mod_unload modversions Thanks, Ole Am 15.03.2015 um 11:49 schrieb Antti Palosaari: You don't have m88ts2022 driver installed. Antti On 03/15/2015 12:26 PM, Ole Ernst wrote: Hi, I added some printk in cx23885-dvb.c and the problem is in i2c_new_device: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/media/pci/cx23885/cx23885-dvb.c?id=refs/tags/v3.19.1#n1935 The returned client_tuner is not NULL, but client_tuner-dev.driver is. Hence it will goto frontend_detach, which will then return -EINVAL. Any idea why client_tuner-dev.driver is NULL? Thanks, Ole Am 14.03.2015 um 20:54 schrieb Ole Ernst: Hi, using linux-3.19.1-1 (Archlinux) I get the following output while booting without the media-build-tree provided by DVBSky: cx23885 driver version 0.0.4 loaded cx23885 :04:00.0: enabling device ( - 0002) CORE cx23885[0]: subsystem: 4254:0952, board: DVBSky S952 [card=50,autodetected] cx25840 3-0044: cx23885 A/V decoder found @ 0x88 (cx23885[0]) cx25840 3-0044: loaded v4l-cx23885-avcore-01.fw firmware (16382 bytes) cx23885_dvb_register() allocating 1 frontend(s) cx23885[0]: cx23885 based dvb card i2c i2c-2: m88ds3103_attach: chip_id=70 i2c i2c-2: Added multiplexed i2c bus 4 cx23885_dvb_register() dvb_register failed err = -22 cx23885_dev_setup() Failed to register dvb adapters on VID_B cx23885_dvb_register() allocating 1 frontend(s) cx23885[0]: cx23885 based dvb card i2c i2c-1: m88ds3103_attach: chip_id=70 i2c i2c-1: Added multiplexed i2c bus 4 cx23885_dvb_register() dvb_register failed err = -22 cx23885_dev_setup() Failed to register dvb on VID_C cx23885_dev_checkrevision() Hardware revision = 0xa5 cx23885[0]/0: found at :04:00.0, rev: 4, irq: 17, latency: 0, mmio: 0xf720 Obviously there are no device in /dev/dvb. Using the media-build-tree works just fine though. The following firmware files are installed in /usr/lib/firmware: dvb-demod-m88ds3103.fw dvb-demod-m88rs6000.fw dvb-demod-si2168-a20-01.fw dvb-demod-si2168-a30-01.fw dvb-demod-si2168-b40-01.fw dvb-fe-ds300x.fw dvb-fe-ds3103.fw dvb-fe-rs6000.fw dvb-tuner-si2158-a20-01.fw Output of lspci -vvvnn: https://gist.githubusercontent.com/olebowle/6a4108363a9d1f7dd033/raw/lscpi I also set the module parameters debug, i2c_debug, irq_debug and irq_debug in cx23885. The output is pretty verbose and can be found here: https://gist.githubusercontent.com/olebowle/6a4108363a9d1f7dd033/raw/debug.log Thanks, Ole -- 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 -- 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
Re: Re: cx23885: DVBSky S952 dvb_register failed err = -22
Hello, what is the chip_id debug output from m88ts2022 module? I think you maybe hold the old S952 card. Its satellite tuner is M88TS2020, not M88TS2022. Best Regards, Max On 2015-03-15 19:07:07, Ole Ernst olebo...@gmx.com wrote: Hi Antti, thanks for your quick response! Based on lsmod and modinfo I do have m88ts2022. $ lsmod | grep m88 m88ts2022 16898 0 regmap_i2c 12783 1 m88ts2022 m88ds3103 21452 0 i2c_mux12534 1 m88ds3103 dvb_core 102038 4 cx23885,altera_ci,m88ds3103,videobuf2_dvb i2c_core 50240 13 drm,i2c_i801,cx23885,cx25840,m88ts2022,i2c_mux,regmap_i2c,nvidia,v4l2_common,tveeprom,m88ds3103,tda18271,videodev $ modinfo m88ts2022 filename: /lib/modules/3.19.1-1-ARCH/kernel/drivers/media/tuners/m88ts2022.ko.gz license:GPL author: Antti Palosaari cr...@iki.fi description:Montage M88TS2022 silicon tuner driver alias: i2c:m88ts2022 depends:i2c-core,regmap-i2c intree: Y vermagic: 3.19.1-1-ARCH SMP preempt mod_unload modversions Thanks, Ole Am 15.03.2015 um 11:49 schrieb Antti Palosaari: You don't have m88ts2022 driver installed. Antti On 03/15/2015 12:26 PM, Ole Ernst wrote: Hi, I added some printk in cx23885-dvb.c and the problem is in i2c_new_device: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/media/pci/cx23885/cx23885-dvb.c?id=refs/tags/v3.19.1#n1935 The returned client_tuner is not NULL, but client_tuner-dev.driver is. Hence it will goto frontend_detach, which will then return -EINVAL. Any idea why client_tuner-dev.driver is NULL? Thanks, Ole Am 14.03.2015 um 20:54 schrieb Ole Ernst: Hi, using linux-3.19.1-1 (Archlinux) I get the following output while booting without the media-build-tree provided by DVBSky: cx23885 driver version 0.0.4 loaded cx23885 :04:00.0: enabling device ( - 0002) CORE cx23885[0]: subsystem: 4254:0952, board: DVBSky S952 [card=50,autodetected] cx25840 3-0044: cx23885 A/V decoder found @ 0x88 (cx23885[0]) cx25840 3-0044: loaded v4l-cx23885-avcore-01.fw firmware (16382 bytes) cx23885_dvb_register() allocating 1 frontend(s) cx23885[0]: cx23885 based dvb card i2c i2c-2: m88ds3103_attach: chip_id=70 i2c i2c-2: Added multiplexed i2c bus 4 cx23885_dvb_register() dvb_register failed err = -22 cx23885_dev_setup() Failed to register dvb adapters on VID_B cx23885_dvb_register() allocating 1 frontend(s) cx23885[0]: cx23885 based dvb card i2c i2c-1: m88ds3103_attach: chip_id=70 i2c i2c-1: Added multiplexed i2c bus 4 cx23885_dvb_register() dvb_register failed err = -22 cx23885_dev_setup() Failed to register dvb on VID_C cx23885_dev_checkrevision() Hardware revision = 0xa5 cx23885[0]/0: found at :04:00.0, rev: 4, irq: 17, latency: 0, mmio: 0xf720 Obviously there are no device in /dev/dvb. Using the media-build-tree works just fine though. The following firmware files are installed in /usr/lib/firmware: dvb-demod-m88ds3103.fw dvb-demod-m88rs6000.fw dvb-demod-si2168-a20-01.fw dvb-demod-si2168-a30-01.fw dvb-demod-si2168-b40-01.fw dvb-fe-ds300x.fw dvb-fe-ds3103.fw dvb-fe-rs6000.fw dvb-tuner-si2158-a20-01.fw Output of lspci -vvvnn: https://gist.githubusercontent.com/olebowle/6a4108363a9d1f7dd033/raw/lscpi I also set the module parameters debug, i2c_debug, irq_debug and irq_debug in cx23885. The output is pretty verbose and can be found here: https://gist.githubusercontent.com/olebowle/6a4108363a9d1f7dd033/raw/debug.log Thanks, Ole -- 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 -- 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
Re: [PATCH 1/1] Fix DVBsky rc-keymap
Hello, Mapping VOLUME and CHANNEL keys to the general ones will break some tv softwares remote control functions. Best Regards, Max On 2015-03-10 06:05:02, Dirk Nehring dnehr...@gmx.net wrote: Signed-off-by: Dirk Nehring dnehr...@gmx.net --- drivers/media/rc/keymaps/rc-dvbsky.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/rc/keymaps/rc-dvbsky.c b/drivers/media/rc/keymaps/rc-dvbsky.c index c5115a1..b942b16 100644 --- a/drivers/media/rc/keymaps/rc-dvbsky.c +++ b/drivers/media/rc/keymaps/rc-dvbsky.c @@ -33,16 +33,16 @@ static struct rc_map_table rc5_dvbsky[] = { { 0x000b, KEY_STOP }, { 0x000c, KEY_EXIT }, { 0x000e, KEY_CAMERA }, /*Snap shot*/ - { 0x000f, KEY_SUBTITLE }, /*PIP*/ - { 0x0010, KEY_VOLUMEUP }, - { 0x0011, KEY_VOLUMEDOWN }, + { 0x000f, KEY_TV2 }, /*PIP*/ + { 0x0010, KEY_RIGHT }, + { 0x0011, KEY_LEFT }, { 0x0012, KEY_FAVORITES }, - { 0x0013, KEY_LIST }, /*Info*/ + { 0x0013, KEY_INFO }, { 0x0016, KEY_PAUSE }, { 0x0017, KEY_PLAY }, { 0x001f, KEY_RECORD }, - { 0x0020, KEY_CHANNELDOWN }, - { 0x0021, KEY_CHANNELUP }, + { 0x0020, KEY_UP }, + { 0x0021, KEY_DOWN }, { 0x0025, KEY_POWER2 }, { 0x0026, KEY_REWIND }, { 0x0027, KEY_FASTFORWARD }, -- 2.1.0 -- 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 1/1] smipcie: return more proper value in interrupt handler.
Although IRQ_HANDLED is safe value to return, it is better to let the kernel know whether the driver handle the interrupt or not. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/smipcie/smipcie.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/media/pci/smipcie/smipcie.c b/drivers/media/pci/smipcie/smipcie.c index f773350..36c8ed7 100644 --- a/drivers/media/pci/smipcie/smipcie.c +++ b/drivers/media/pci/smipcie/smipcie.c @@ -448,16 +448,19 @@ static void smi_port_exit(struct smi_port *port) port-enable = 0; } -static void smi_port_irq(struct smi_port *port, u32 int_status) +static int smi_port_irq(struct smi_port *port, u32 int_status) { u32 port_req_irq = port-_dmaInterruptCH0 | port-_dmaInterruptCH1; + int handled = 0; if (int_status port_req_irq) { smi_port_disableInterrupt(port); port-_int_status = int_status; smi_port_clearInterrupt(port); tasklet_schedule(port-tasklet); + handled = 1; } + return handled; } static irqreturn_t smi_irq_handler(int irq, void *dev_id) @@ -465,18 +468,19 @@ static irqreturn_t smi_irq_handler(int irq, void *dev_id) struct smi_dev *dev = dev_id; struct smi_port *port0 = dev-ts_port[0]; struct smi_port *port1 = dev-ts_port[1]; + int handled = 0; u32 intr_status = smi_read(MSI_INT_STATUS); /* ts0 interrupt.*/ if (dev-info-ts_0) - smi_port_irq(port0, intr_status); + handled += smi_port_irq(port0, intr_status); /* ts1 interrupt.*/ if (dev-info-ts_1) - smi_port_irq(port1, intr_status); + handled += smi_port_irq(port1, intr_status); - return IRQ_HANDLED; + return IRQ_RETVAL(handled); } static struct i2c_client *smi_add_i2c_client(struct i2c_adapter *adapter, -- 1.9.1 -- 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 1/3] dvb-usb-dvbsky: add T330 dvb-t2/t/c usb stick support
DVBSky T330 dvb-t2/t/c usb stick: 1dvb frontend: SI2157A30(tuner), SI2168B40(demod) 2usb controller: CY7C68013A Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/usb/dvb-usb-v2/dvbsky.c | 88 +++ 1 file changed, 88 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c index b6326c6..86db800 100644 --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -604,6 +604,65 @@ fail_demod_device: return ret; } +static int dvbsky_t330_attach(struct dvb_usb_adapter *adap) +{ + struct dvbsky_state *state = adap_to_priv(adap); + struct dvb_usb_device *d = adap_to_d(adap); + int ret = 0; + struct i2c_adapter *i2c_adapter; + struct i2c_client *client_demod, *client_tuner; + struct i2c_board_info info; + struct si2168_config si2168_config; + struct si2157_config si2157_config; + + /* attach demod */ + memset(si2168_config, 0, sizeof(si2168_config)); + si2168_config.i2c_adapter = i2c_adapter; + si2168_config.fe = adap-fe[0]; + si2168_config.ts_mode = SI2168_TS_PARALLEL | 0x40; + memset(info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, si2168, I2C_NAME_SIZE); + info.addr = 0x64; + info.platform_data = si2168_config; + + request_module(info.type); + client_demod = i2c_new_device(d-i2c_adap, info); + if (client_demod == NULL || + client_demod-dev.driver == NULL) + goto fail_demod_device; + if (!try_module_get(client_demod-dev.driver-owner)) + goto fail_demod_module; + + /* attach tuner */ + memset(si2157_config, 0, sizeof(si2157_config)); + si2157_config.fe = adap-fe[0]; + memset(info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, si2157, I2C_NAME_SIZE); + info.addr = 0x60; + info.platform_data = si2157_config; + + request_module(info.type); + client_tuner = i2c_new_device(i2c_adapter, info); + if (client_tuner == NULL || + client_tuner-dev.driver == NULL) + goto fail_tuner_device; + if (!try_module_get(client_tuner-dev.driver-owner)) + goto fail_tuner_module; + + state-i2c_client_demod = client_demod; + state-i2c_client_tuner = client_tuner; + return ret; +fail_tuner_module: + i2c_unregister_device(client_tuner); +fail_tuner_device: + module_put(client_demod-dev.driver-owner); +fail_demod_module: + i2c_unregister_device(client_demod); +fail_demod_device: + ret = -ENODEV; + return ret; +} + static int dvbsky_identify_state(struct dvb_usb_device *d, const char **name) { dvbsky_gpio_ctrl(d, 0x04, 1); @@ -742,6 +801,33 @@ static struct dvb_usb_device_properties dvbsky_t680c_props = { } }; +static struct dvb_usb_device_properties dvbsky_t330_props = { + .driver_name = KBUILD_MODNAME, + .owner = THIS_MODULE, + .adapter_nr = adapter_nr, + .size_of_priv = sizeof(struct dvbsky_state), + + .generic_bulk_ctrl_endpoint = 0x01, + .generic_bulk_ctrl_endpoint_response = 0x81, + .generic_bulk_ctrl_delay = DVBSKY_MSG_DELAY, + + .i2c_algo = dvbsky_i2c_algo, + .frontend_attach = dvbsky_t330_attach, + .init = dvbsky_init, + .get_rc_config= dvbsky_get_rc_config, + .streaming_ctrl = dvbsky_streaming_ctrl, + .identify_state = dvbsky_identify_state, + .exit = dvbsky_exit, + .read_mac_address = dvbsky_read_mac_addr, + + .num_adapters = 1, + .adapter = { + { + .stream = DVB_USB_STREAM_BULK(0x82, 8, 4096), + } + } +}; + static const struct usb_device_id dvbsky_id_table[] = { { DVB_USB_DEVICE(0x0572, 0x6831, dvbsky_s960_props, DVBSky S960/S860, RC_MAP_DVBSKY) }, @@ -749,6 +835,8 @@ static const struct usb_device_id dvbsky_id_table[] = { dvbsky_s960c_props, DVBSky S960CI, RC_MAP_DVBSKY) }, { DVB_USB_DEVICE(0x0572, 0x680c, dvbsky_t680c_props, DVBSky T680CI, RC_MAP_DVBSKY) }, + { DVB_USB_DEVICE(0x0572, 0x0320, + dvbsky_t330_props, DVBSky T330, RC_MAP_DVBSKY) }, { } }; MODULE_DEVICE_TABLE(usb, dvbsky_id_table); -- 1.9.1 -- 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 2/3] cxusb: remove TechnoTrend CT2-4400 and CT2-4650 devices
Remove TechnoTrend CT2-4400 and CT2-4650 devices from cxusb. They are supported by dvb-usb-dvbsky driver in PATCH 3/3. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/usb/dvb-usb/Kconfig | 1 - drivers/media/usb/dvb-usb/cxusb.c | 298 -- drivers/media/usb/dvb-usb/cxusb.h | 4 - 3 files changed, 303 deletions(-) diff --git a/drivers/media/usb/dvb-usb/Kconfig b/drivers/media/usb/dvb-usb/Kconfig index 41d3eb9..3364200 100644 --- a/drivers/media/usb/dvb-usb/Kconfig +++ b/drivers/media/usb/dvb-usb/Kconfig @@ -130,7 +130,6 @@ config DVB_USB_CXUSB Medion MD95700 hybrid USB2.0 device. DViCO FusionHDTV (Bluebird) USB2.0 devices - TechnoTrend TVStick CT2-4400 and CT2-4650 CI devices config DVB_USB_M920X tristate Uli m920x DVB-T USB2.0 support diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c index 643d88f..0f345b1 100644 --- a/drivers/media/usb/dvb-usb/cxusb.c +++ b/drivers/media/usb/dvb-usb/cxusb.c @@ -44,7 +44,6 @@ #include atbm8830.h #include si2168.h #include si2157.h -#include sp2.h /* Max transfer size done by I2C transfer functions */ #define MAX_XFER_SIZE 80 @@ -147,22 +146,6 @@ static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device *d, } } -static int cxusb_tt_ct2_4400_gpio_tuner(struct dvb_usb_device *d, int onoff) -{ - u8 o[2], i; - int rc; - - o[0] = 0x83; - o[1] = onoff; - rc = cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, i, 1); - - if (rc) { - deb_info(gpio_write failed.\n); - return -EIO; - } - return 0; -} - /* I2C */ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) @@ -524,30 +507,6 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, return 0; } -static int cxusb_tt_ct2_4400_rc_query(struct dvb_usb_device *d) -{ - u8 i[2]; - int ret; - u32 cmd, keycode; - u8 rc5_cmd, rc5_addr, rc5_toggle; - - ret = cxusb_ctrl_msg(d, 0x10, NULL, 0, i, 2); - if (ret) - return ret; - - cmd = (i[0] 8) | i[1]; - - if (cmd != 0x) { - rc5_cmd = cmd 0x3F; /* bits 1-6 for command */ - rc5_addr = (cmd 0x07C0) 6; /* bits 7-11 for address */ - rc5_toggle = (cmd 0x0800) 11; /* bit 12 for toggle */ - keycode = (rc5_addr 8) | rc5_cmd; - rc_keydown(d-rc_dev, RC_BIT_RC5, keycode, rc5_toggle); - } - - return 0; -} - static struct rc_map_table rc_map_dvico_mce_table[] = { { 0xfe02, KEY_TV }, { 0xfe0e, KEY_MP3 }, @@ -673,70 +632,6 @@ static struct rc_map_table rc_map_d680_dmb_table[] = { { 0x0025, KEY_POWER }, }; -static int cxusb_tt_ct2_4400_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) -{ - u8 wbuf[2]; - u8 rbuf[6]; - int ret; - struct i2c_msg msg[] = { - { - .addr = 0x51, - .flags = 0, - .buf = wbuf, - .len = 2, - }, { - .addr = 0x51, - .flags = I2C_M_RD, - .buf = rbuf, - .len = 6, - } - }; - - wbuf[0] = 0x1e; - wbuf[1] = 0x00; - ret = cxusb_i2c_xfer(d-i2c_adap, msg, 2); - - if (ret == 2) { - memcpy(mac, rbuf, 6); - return 0; - } else { - if (ret 0) - return ret; - return -EIO; - } -} - -static int cxusb_tt_ct2_4650_ci_ctrl(void *priv, u8 read, int addr, - u8 data, int *mem) -{ - struct dvb_usb_device *d = priv; - u8 wbuf[3]; - u8 rbuf[2]; - int ret; - - wbuf[0] = (addr 8) 0xff; - wbuf[1] = addr 0xff; - - if (read) { - ret = cxusb_ctrl_msg(d, CMD_SP2_CI_READ, wbuf, 2, rbuf, 2); - } else { - wbuf[2] = data; - ret = cxusb_ctrl_msg(d, CMD_SP2_CI_WRITE, wbuf, 3, rbuf, 1); - } - - if (ret) - goto err; - - if (read) - *mem = rbuf[1]; - - return 0; -err: - deb_info(%s: ci usb write returned %d\n, __func__, ret); - return ret; - -} - static int cxusb_dee1601_demod_init(struct dvb_frontend* fe) { static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 }; @@ -1478,127 +1373,6 @@ static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap) return 0; } -static int cxusb_tt_ct2_4400_attach(struct dvb_usb_adapter *adap) -{ - struct dvb_usb_device *d = adap-dev; - struct cxusb_state *st = d-priv; - struct i2c_adapter *adapter; - struct i2c_client *client_demod; - struct i2c_client *client_tuner; - struct i2c_client
[PATCH 3/3] dvb-usb-dvbsky: add TechnoTrend CT2-4400 and CT2-4650 devices support
Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/usb/dvb-usb-v2/dvbsky.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c index 86db800..9b5add4 100644 --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -837,6 +837,14 @@ static const struct usb_device_id dvbsky_id_table[] = { dvbsky_t680c_props, DVBSky T680CI, RC_MAP_DVBSKY) }, { DVB_USB_DEVICE(0x0572, 0x0320, dvbsky_t330_props, DVBSky T330, RC_MAP_DVBSKY) }, + { DVB_USB_DEVICE(USB_VID_TECHNOTREND, + USB_PID_TECHNOTREND_TVSTICK_CT2_4400, + dvbsky_t330_props, TechnoTrend TVStick CT2-4400, + RC_MAP_TT_1500) }, + { DVB_USB_DEVICE(USB_VID_TECHNOTREND, + USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI, + dvbsky_t680c_props, TechnoTrend TT-connect CT2-4650 CI, + RC_MAP_TT_1500) }, { } }; MODULE_DEVICE_TABLE(usb, dvbsky_id_table); -- 1.9.1 -- 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
Re: Re: Fwd: Re: Re: Problems with Linux drivers (Debian Jessie kernel3.16.0-4)
Hello Chris, Do all of your transponders have such issue or only some special transponders? Could you list the parameters for them? for example, dvb-s or dvb-s2 type, frequency, symbol rate. The dvbsky.net firmware dvb-fe-ds3103.fw is version 3.7. Annti uses the firmware dvb-demod-m88ds3103.fw, which is version 3.B. But we test both firmwares work well. You can change one to the other's file name for check. Best Regards, Max On 2014-11-20 20:56:07, Christopher Scheuring ch...@anke-und-chris.de wrote: Hello, I yust checked the SNR Level the DVBSky-Card providing with the drivers from dvbsky.net (media_build-bst-14-141106): # ./femon -a 0 using '/dev/dvb/adapter0/frontend0' FE: Montage DS3103/TS2022 (SAT) status 1f | signal 7323 | snr b064 | ber | unc | FE_HAS_LOCK # ./femon -a 1 using '/dev/dvb/adapter1/frontend0' FE: Montage DS3103/TS2022 (SAT) status 1f | signal 7a71 | snr 2a17 | ber | unc | FE_HAS_LOCK Looks better than with driver from linuxtv.org via git. And I don't have any sync problems or video / audio drops. I currently determined following: * Using the drivers from dvbsky.net the card is Montage DS3103/TS2022 = Loading FW dvb-fe-ds3103.fw * With the drivers from linuxtv.org the card is Montage M88DS3103 = Loading FW dvb-demod-m88ds3103.fw I'm a bit confused... perhaps if I use the linuxtv.org drivers, the card is recognized wrong and that's the problem? Regards, Chris On Thu, 20 Nov 2014 09:01:23 +0200, Antti Palosaari cr...@iki.fi wrote: Moikka According to logs, everything seems to be fine. You could not compare statistics numbers between two drivers. SNR 0096 is 150DEC, which means 15dB, IIRC it was max chip could return for DVB-S. No idea about sync etc. problems, are you sure about those? I am pretty sure it works rather well as I haven't got bug reports from PCTV 461e users which has that same demod + tuner. regards Antti On 11/19/2014 09:28 PM, Christopher Scheuring wrote: Hello Antti, the guys from t...@dvbsky.net told me to contact you because of my problems with the drivers for my DVBSKY S952. I attached the whole conversation. Currently the main problem is if i use the current drivers via git(http://git.linuxtv.org/cgit.cgi/media_build.git/about/) my single TT-Budget card works fine. But the signal from the DVDBSky S952 is very worse: Sync problems, bad SNR, drops on video and audio... If I use the driver dvbsky.net provides (media_build-bst-14-141106), the signal on booth tuners is fine - but then my TT-Budget doesn't works anymore (see end of this mail aka starting the conversation with t...@dvbsky.net). Do you have any ideas, how I could fix this problem? Before I updated my system (from Debian Wheezy with Kernel 3.2.0-4-amd64 everything was fine with both cards. If you need more detailed information, please let me know, so I could provide them as soon as possible, Thanks a lot and best wishes Chris Weitergeleitete Nachricht Betreff:Re: Re: Problems with Linux drivers (Debian Jessie kernel 3.16.0-4) Datum: Wed, 19 Nov 2014 10:28:06 +0800 Von:tech t...@dvbsky.net An: Christopher Scheuring ch...@anke-und-chris.de Hello, Could you report this problem to Antti Palosaari cr...@iki.fi mailto:cr...@iki.fi and cc to linux-media@vger.kernel.org ? Antti is the author/maintainer of M88DS3103 driver.Montage M88DS3103 (SAT)* Please list the compare result of the driver from DVBSky site and Linuxtv.org. Max from DVBSky also register linux-media mail list. He will get your report and co-work with Antti to fix this issue of M88DS3103 driver from Linuxtv.org. BR, tech *From:* Christopher Scheuringch...@anke-und-chris.de mailto:ch...@anke-und-chris.de *Date:* 2014-11-19 04:42:10 *To:* techt...@dvbsky.net mailto:t...@dvbsky.net *Cc:* *Subject:* Re: Problems with Linux drivers (Debian Jessie kernel 3.16.0-4) Hello, with the drivers from linuxtv.org and the firmware provided by your site, both cards work. But the DVBSky card (Montage M88DS3103) do now have a really bad SNR!TT-Budget C-1501 works as expected. See the output of femon - the signal of the DVBSky card was excellent with the drivers from you site... Any idea, what could cause the problem? TV signal provided by the DVBSky sometimes drops :-( xxx@xxx:~/VDR/linuxtv-dvb-apps-1.1.1/util/szap$ ./femon -a1 *using '/dev/dvb/adapter1/frontend0'** **FE: Montage M88DS3103 (SAT)* status 1f | signal 585e | *snr 0096* | ber | unc | FE_HAS_LOCK status 1f | signal 585e | *snr 0096* | ber | unc | FE_HAS_LOCK xxx@xxx:~/VDR/linuxtv-dvb-apps-1.1.1/util/szap$ ./femon -a2 *using '/dev/dvb/adapter2/frontend0'** **FE: Montage M88DS3103 (SAT)* status 1f | signal 6c07 | *snr 0096* | ber | unc | FE_HAS_LOCK status 1f | signal 6c07 | *snr
[PATCH 1/1] dvb-usb-dvbsky: add T680CI dvb-t2/t/c usb ci box support
DVBSky T680CI dvb-t2/t/c usb ci box: 1dvb frontend: SI2158A20(tuner), SI2168A30(demod) 2usb controller: CY7C86013A 3ci controller: CIMAX SP2 or its clone. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/usb/dvb-usb-v2/Kconfig | 2 + drivers/media/usb/dvb-usb-v2/dvbsky.c | 122 ++ 2 files changed, 124 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig index 7423033..0982e73 100644 --- a/drivers/media/usb/dvb-usb-v2/Kconfig +++ b/drivers/media/usb/dvb-usb-v2/Kconfig @@ -145,7 +145,9 @@ config DVB_USB_DVBSKY tristate DVBSky USB support depends on DVB_USB_V2 select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT + select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT select DVB_SP2 if MEDIA_SUBDRV_AUTOSELECT help Say Y here to support the USB receivers from DVBSky. diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c index 8be8447..b6326c6 100644 --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -22,6 +22,8 @@ #include m88ds3103.h #include m88ts2022.h #include sp2.h +#include si2168.h +#include si2157.h #define DVBSKY_MSG_DELAY 0/*2000*/ #define DVBSKY_BUF_LEN 64 @@ -37,6 +39,7 @@ struct dvbsky_state { u8 ibuf[DVBSKY_BUF_LEN]; u8 obuf[DVBSKY_BUF_LEN]; u8 last_lock; + struct i2c_client *i2c_client_demod; struct i2c_client *i2c_client_tuner; struct i2c_client *i2c_client_ci; @@ -517,6 +520,90 @@ fail_attach: return ret; } +static int dvbsky_t680c_attach(struct dvb_usb_adapter *adap) +{ + struct dvbsky_state *state = adap_to_priv(adap); + struct dvb_usb_device *d = adap_to_d(adap); + int ret = 0; + struct i2c_adapter *i2c_adapter; + struct i2c_client *client_demod, *client_tuner, *client_ci; + struct i2c_board_info info; + struct si2168_config si2168_config; + struct si2157_config si2157_config; + struct sp2_config sp2_config; + + /* attach demod */ + memset(si2168_config, 0, sizeof(si2168_config)); + si2168_config.i2c_adapter = i2c_adapter; + si2168_config.fe = adap-fe[0]; + si2168_config.ts_mode = SI2168_TS_PARALLEL; + memset(info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, si2168, I2C_NAME_SIZE); + info.addr = 0x64; + info.platform_data = si2168_config; + + request_module(info.type); + client_demod = i2c_new_device(d-i2c_adap, info); + if (client_demod == NULL || + client_demod-dev.driver == NULL) + goto fail_demod_device; + if (!try_module_get(client_demod-dev.driver-owner)) + goto fail_demod_module; + + /* attach tuner */ + memset(si2157_config, 0, sizeof(si2157_config)); + si2157_config.fe = adap-fe[0]; + memset(info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, si2157, I2C_NAME_SIZE); + info.addr = 0x60; + info.platform_data = si2157_config; + + request_module(info.type); + client_tuner = i2c_new_device(i2c_adapter, info); + if (client_tuner == NULL || + client_tuner-dev.driver == NULL) + goto fail_tuner_device; + if (!try_module_get(client_tuner-dev.driver-owner)) + goto fail_tuner_module; + + /* attach ci controller */ + memset(sp2_config, 0, sizeof(sp2_config)); + sp2_config.dvb_adap = adap-dvb_adap; + sp2_config.priv = d; + sp2_config.ci_control = dvbsky_ci_ctrl; + memset(info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, sp2, I2C_NAME_SIZE); + info.addr = 0x40; + info.platform_data = sp2_config; + + request_module(info.type); + client_ci = i2c_new_device(d-i2c_adap, info); + + if (client_ci == NULL || client_ci-dev.driver == NULL) + goto fail_ci_device; + + if (!try_module_get(client_ci-dev.driver-owner)) + goto fail_ci_module; + + state-i2c_client_demod = client_demod; + state-i2c_client_tuner = client_tuner; + state-i2c_client_ci = client_ci; + return ret; +fail_ci_module: + i2c_unregister_device(client_ci); +fail_ci_device: + module_put(client_tuner-dev.driver-owner); +fail_tuner_module: + i2c_unregister_device(client_tuner); +fail_tuner_device: + module_put(client_demod-dev.driver-owner); +fail_demod_module: + i2c_unregister_device(client_demod); +fail_demod_device: + ret = -ENODEV; + return ret; +} + static int dvbsky_identify_state(struct dvb_usb_device *d, const char **name) { dvbsky_gpio_ctrl(d, 0x04, 1); @@ -559,6 +646,12 @@ static void dvbsky_exit(struct dvb_usb_device
Re: Re: [PATCH 1/1] dvb-usb-dvbsky: add T680CI dvb-t2/t/c usb ci boxsupport
Hello Olli, dvb-usb-dvbsky driver did not exist when you wrote the driver for TechnoTrend CT2-4650. It is the good choise to add the new device in cxusb driver for that time. But cxusb is a real big driver, which depends on many frontend modules. Some users make complaints in their embedded system. And the current media tree requires the new dvb usb driver to be dvb-usb-v2 type. So I think it is better to add T680CI device in dvb-usb-dvbsky driver. When this patch is accepted, I think it is easy to move CT2-4650 and CT2-4400 to dvb-usb-dvbsky driver. Best Regards, Max On 2014-11-13 19:01:19, Olli Salonen olli.salo...@iki.fi wrote: Hi Max, My understanding is that T680CI is the same device as TechnoTrend CT2-4650 CI that is already supported by the cxusb driver. I think we should not duplicate this over two drivers. In my opinion, two options exist: - you add T680CI in the dvbsky driver and move CT2-4650 also to dvbsky - you add T680CI into cxusb driver What do you think? Cheers, -olli On Thu, 13 Nov 2014, Nibble Max wrote: DVBSky T680CI dvb-t2/t/c usb ci box: 1dvb frontend: SI2158A20(tuner), SI2168A30(demod) 2usb controller: CY7C86013A 3ci controller: CIMAX SP2 or its clone. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/usb/dvb-usb-v2/Kconfig | 2 + drivers/media/usb/dvb-usb-v2/dvbsky.c | 122 ++ 2 files changed, 124 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig index 7423033..0982e73 100644 --- a/drivers/media/usb/dvb-usb-v2/Kconfig +++ b/drivers/media/usb/dvb-usb-v2/Kconfig @@ -145,7 +145,9 @@ config DVB_USB_DVBSKY tristate DVBSky USB support depends on DVB_USB_V2 select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT +select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT +select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT select DVB_SP2 if MEDIA_SUBDRV_AUTOSELECT help Say Y here to support the USB receivers from DVBSky. diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c index 8be8447..b6326c6 100644 --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -22,6 +22,8 @@ #include m88ds3103.h #include m88ts2022.h #include sp2.h +#include si2168.h +#include si2157.h #define DVBSKY_MSG_DELAY 0/*2000*/ #define DVBSKY_BUF_LEN 64 @@ -37,6 +39,7 @@ struct dvbsky_state { u8 ibuf[DVBSKY_BUF_LEN]; u8 obuf[DVBSKY_BUF_LEN]; u8 last_lock; +struct i2c_client *i2c_client_demod; struct i2c_client *i2c_client_tuner; struct i2c_client *i2c_client_ci; @@ -517,6 +520,90 @@ fail_attach: return ret; } +static int dvbsky_t680c_attach(struct dvb_usb_adapter *adap) +{ +struct dvbsky_state *state = adap_to_priv(adap); +struct dvb_usb_device *d = adap_to_d(adap); +int ret = 0; +struct i2c_adapter *i2c_adapter; +struct i2c_client *client_demod, *client_tuner, *client_ci; +struct i2c_board_info info; +struct si2168_config si2168_config; +struct si2157_config si2157_config; +struct sp2_config sp2_config; + +/* attach demod */ +memset(si2168_config, 0, sizeof(si2168_config)); +si2168_config.i2c_adapter = i2c_adapter; +si2168_config.fe = adap-fe[0]; +si2168_config.ts_mode = SI2168_TS_PARALLEL; +memset(info, 0, sizeof(struct i2c_board_info)); +strlcpy(info.type, si2168, I2C_NAME_SIZE); +info.addr = 0x64; +info.platform_data = si2168_config; + +request_module(info.type); +client_demod = i2c_new_device(d-i2c_adap, info); +if (client_demod == NULL || +client_demod-dev.driver == NULL) +goto fail_demod_device; +if (!try_module_get(client_demod-dev.driver-owner)) +goto fail_demod_module; + +/* attach tuner */ +memset(si2157_config, 0, sizeof(si2157_config)); +si2157_config.fe = adap-fe[0]; +memset(info, 0, sizeof(struct i2c_board_info)); +strlcpy(info.type, si2157, I2C_NAME_SIZE); +info.addr = 0x60; +info.platform_data = si2157_config; + +request_module(info.type); +client_tuner = i2c_new_device(i2c_adapter, info); +if (client_tuner == NULL || +client_tuner-dev.driver == NULL) +goto fail_tuner_device; +if (!try_module_get(client_tuner-dev.driver-owner)) +goto fail_tuner_module; + +/* attach ci controller */ +memset(sp2_config, 0, sizeof(sp2_config)); +sp2_config.dvb_adap = adap-dvb_adap; +sp2_config.priv = d; +sp2_config.ci_control = dvbsky_ci_ctrl; +memset(info, 0, sizeof(struct i2c_board_info)); +strlcpy(info.type, sp2, I2C_NAME_SIZE); +info.addr = 0x40; +info.platform_data = sp2_config; + +request_module(info.type); +client_ci = i2c_new_device
[PATCH 1/1] cx23885: add DVBSky T982(Dual DVB-T2/T/C) support
DVBSky T982 DVB-T2/T/C dual PCIe card: 1dvb frontend: SI2158A20(tuner),SI2168A30(demod) 2PCIe bridge: CX23885(port b: parallel mode, port c: serial mode) 3rc: cx23885 integrated. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/cx23885/cx23885-cards.c | 15 drivers/media/pci/cx23885/cx23885-dvb.c | 60 ++- drivers/media/pci/cx23885/cx23885-input.c | 3 ++ drivers/media/pci/cx23885/cx23885.h | 1 + 4 files changed, 78 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 4bad27d..db99ca2 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -701,6 +701,11 @@ struct cx23885_board cx23885_boards[] = { .portb = CX23885_MPEG_DVB, .portc = CX23885_MPEG_DVB, }, + [CX23885_BOARD_DVBSKY_T982] = { + .name = DVBSky T982, + .portb = CX23885_MPEG_DVB, + .portc = CX23885_MPEG_DVB, + }, }; const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); @@ -980,6 +985,10 @@ struct cx23885_subid cx23885_subids[] = { .subvendor = 0x4254, .subdevice = 0x0952, .card = CX23885_BOARD_DVBSKY_S952, + }, { + .subvendor = 0x4254, + .subdevice = 0x0982, + .card = CX23885_BOARD_DVBSKY_T982, }, }; const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); @@ -1576,6 +1585,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) break; case CX23885_BOARD_DVBSKY_T9580: case CX23885_BOARD_DVBSKY_S952: + case CX23885_BOARD_DVBSKY_T982: /* enable GPIO3-18 pins */ cx_write(MC417_CTL, 0x0037); cx23885_gpio_enable(dev, GPIO_2 | GPIO_11, 1); @@ -1708,6 +1718,7 @@ int cx23885_ir_init(struct cx23885_dev *dev) case CX23885_BOARD_TT_CT2_4500_CI: case CX23885_BOARD_DVBSKY_S950: case CX23885_BOARD_DVBSKY_S952: + case CX23885_BOARD_DVBSKY_T982: if (!enable_885_ir) break; dev-sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); @@ -1760,6 +1771,7 @@ void cx23885_ir_fini(struct cx23885_dev *dev) case CX23885_BOARD_TT_CT2_4500_CI: case CX23885_BOARD_DVBSKY_S950: case CX23885_BOARD_DVBSKY_S952: + case CX23885_BOARD_DVBSKY_T982: cx23885_irq_remove(dev, PCI_MSK_AV_CORE); /* sd_ir is a duplicate pointer to the AV Core, just clear it */ dev-sd_ir = NULL; @@ -1813,6 +1825,7 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) case CX23885_BOARD_TT_CT2_4500_CI: case CX23885_BOARD_DVBSKY_S950: case CX23885_BOARD_DVBSKY_S952: + case CX23885_BOARD_DVBSKY_T982: if (dev-sd_ir) cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE); break; @@ -1968,6 +1981,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) ts2-src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; break; case CX23885_BOARD_DVBSKY_T9580: + case CX23885_BOARD_DVBSKY_T982: ts1-gen_ctrl_val = 0x5; /* Parallel */ ts1-ts_clk_en_val = 0x1; /* Enable TS_CLK */ ts1-src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; @@ -2051,6 +2065,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_TT_CT2_4500_CI: case CX23885_BOARD_DVBSKY_S950: case CX23885_BOARD_DVBSKY_S952: + case CX23885_BOARD_DVBSKY_T982: dev-sd_cx25840 = v4l2_i2c_new_subdev(dev-v4l2_dev, dev-i2c_bus[2].i2c_adap, cx25840, 0x88 1, NULL); diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 2457b64..1ed92ee 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -1945,6 +1945,63 @@ static int dvb_register(struct cx23885_tsport *port) port-i2c_client_tuner = client_tuner; break; + case CX23885_BOARD_DVBSKY_T982: + memset(si2168_config, 0, sizeof(si2168_config)); + switch (port-nr) { + /* port b */ + case 1: + i2c_bus = dev-i2c_bus[1]; + si2168_config.ts_mode = SI2168_TS_PARALLEL; + break; + /* port c */ + case 2: + i2c_bus = dev-i2c_bus[0]; + si2168_config.ts_mode = SI2168_TS_SERIAL; + break; + } + + /* attach frontend */ + si2168_config.i2c_adapter = adapter
Re: Re: [PATCH v2 2/2] smipcie: add DVBSky T9580 V3 support
Hello Antti, On 2014-11-10 06:13:07, Antti Palosaari wrote: On 11/08/2014 01:35 PM, Nibble Max wrote: v2: - Update Kconfig file. DVBSky T9580 V3 card is the dual tuner card, which supports S/S2 and T2/T/C. 1DVB-S/S2 frontend: M88DS3103/M88TS2022 2DVB-T2/T/C frontend: SI2168B40/SI2157A30 2PCIe bridge: SMI PCIe Signed-off-by: Nibble Max nibble@gmail.com Reviewed-by: Antti Palosaari cr...@iki.fi I reviewed the patch v1 also :] Antti Thanks for your review! Best Regards, Max --- drivers/media/pci/smipcie/Kconfig | 3 ++ drivers/media/pci/smipcie/smipcie.c | 67 + 2 files changed, 70 insertions(+) diff --git a/drivers/media/pci/smipcie/Kconfig b/drivers/media/pci/smipcie/Kconfig index 75a2992..35ace80 100644 --- a/drivers/media/pci/smipcie/Kconfig +++ b/drivers/media/pci/smipcie/Kconfig @@ -2,12 +2,15 @@ config DVB_SMIPCIE tristate SMI PCIe DVBSky cards depends on DVB_CORE PCI I2C select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT +select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_M88RS6000T if MEDIA_SUBDRV_AUTOSELECT +select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT help Support for cards with SMI PCIe bridge: - DVBSky S950 V3 - DVBSky S952 V3 + - DVBSky T9580 V3 Say Y or M if you own such a device and want to use it. If unsure say N. diff --git a/drivers/media/pci/smipcie/smipcie.c b/drivers/media/pci/smipcie/smipcie.c index c27e45b..5d1932b 100644 --- a/drivers/media/pci/smipcie/smipcie.c +++ b/drivers/media/pci/smipcie/smipcie.c @@ -18,6 +18,8 @@ #include m88ds3103.h #include m88ts2022.h #include m88rs6000t.h +#include si2168.h +#include si2157.h DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); @@ -618,6 +620,58 @@ err_tuner_i2c_device: return ret; } +static int smi_dvbsky_sit2_fe_attach(struct smi_port *port) +{ +int ret = 0; +struct smi_dev *dev = port-dev; +struct i2c_adapter *i2c; +struct i2c_adapter *tuner_i2c_adapter; +struct i2c_client *client_tuner, *client_demod; +struct i2c_board_info client_info; +struct si2168_config si2168_config; +struct si2157_config si2157_config; + +/* select i2c bus */ +i2c = (port-idx == 0) ? dev-i2c_bus[0] : dev-i2c_bus[1]; + +/* attach demod */ +memset(si2168_config, 0, sizeof(si2168_config)); +si2168_config.i2c_adapter = tuner_i2c_adapter; +si2168_config.fe = port-fe; +si2168_config.ts_mode = SI2168_TS_PARALLEL; + +memset(client_info, 0, sizeof(struct i2c_board_info)); +strlcpy(client_info.type, si2168, I2C_NAME_SIZE); +client_info.addr = 0x64; +client_info.platform_data = si2168_config; + +client_demod = smi_add_i2c_client(i2c, client_info); +if (!client_demod) { +ret = -ENODEV; +return ret; +} +port-i2c_client_demod = client_demod; + +/* attach tuner */ +memset(si2157_config, 0, sizeof(si2157_config)); +si2157_config.fe = port-fe; + +memset(client_info, 0, sizeof(struct i2c_board_info)); +strlcpy(client_info.type, si2157, I2C_NAME_SIZE); +client_info.addr = 0x60; +client_info.platform_data = si2157_config; + +client_tuner = smi_add_i2c_client(tuner_i2c_adapter, client_info); +if (!client_tuner) { +smi_del_i2c_client(port-i2c_client_demod); +port-i2c_client_demod = NULL; +ret = -ENODEV; +return ret; +} +port-i2c_client_tuner = client_tuner; +return ret; +} + static int smi_fe_init(struct smi_port *port) { int ret = 0; @@ -635,6 +689,9 @@ static int smi_fe_init(struct smi_port *port) case DVBSKY_FE_M88RS6000: ret = smi_dvbsky_m88rs6000_fe_attach(port); break; +case DVBSKY_FE_SIT2: +ret = smi_dvbsky_sit2_fe_attach(port); +break; } if (ret 0) return ret; @@ -1005,6 +1062,15 @@ static struct smi_cfg_info dvbsky_s952_cfg = { .fe_1 = DVBSKY_FE_M88RS6000, }; +static struct smi_cfg_info dvbsky_t9580_cfg = { +.type = SMI_DVBSKY_T9580, +.name = DVBSky T9580 V3, +.ts_0 = SMI_TS_DMA_BOTH, +.ts_1 = SMI_TS_DMA_BOTH, +.fe_0 = DVBSKY_FE_SIT2, +.fe_1 = DVBSKY_FE_M88DS3103, +}; + /* PCI IDs */ #define SMI_ID(_subvend, _subdev, _driverdata) { \ .vendor = SMI_VID,.device= SMI_PID, \ @@ -1014,6 +1080,7 @@ static struct smi_cfg_info dvbsky_s952_cfg = { static const struct pci_device_id smi_id_table[] = { SMI_ID(0x4254, 0x0550, dvbsky_s950_cfg), SMI_ID(0x4254, 0x0552, dvbsky_s952_cfg), +SMI_ID(0x4254, 0x5580, dvbsky_t9580_cfg), {0} }; MODULE_DEVICE_TABLE(pci, smi_id_table); -- http://palosaari.fi/ -- To unsubscribe from this list: send the line
[PATCH 1/1] dvb-usb-dvbsky: fix i2c adapter for sp2 device
It is wrong that sp2 device uses the i2c adapter from m88ds3103 return. sp2 device sits on the same i2c bus with m88ds3103, not behind m88ds3103. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/usb/dvb-usb-v2/dvbsky.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c index c67a118..8be8447 100644 --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -479,7 +479,7 @@ static int dvbsky_s960c_attach(struct dvb_usb_adapter *adap) info.addr = 0x40; info.platform_data = sp2_config; request_module(sp2); - client_ci = i2c_new_device(i2c_adapter, info); + client_ci = i2c_new_device(d-i2c_adap, info); if (client_ci == NULL || client_ci-dev.driver == NULL) { ret = -ENODEV; goto fail_ci_device; -- 1.9.1 -- 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 1/2] smipcie: use add_i2c_client and del_i2c_client functions.
add_i2c_client and del_i2c_client functions make code shorter and easy to maintain. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/smipcie/smipcie.c | 69 + 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/drivers/media/pci/smipcie/smipcie.c b/drivers/media/pci/smipcie/smipcie.c index d1c1463..c27e45b 100644 --- a/drivers/media/pci/smipcie/smipcie.c +++ b/drivers/media/pci/smipcie/smipcie.c @@ -477,6 +477,33 @@ static irqreturn_t smi_irq_handler(int irq, void *dev_id) return IRQ_HANDLED; } +static struct i2c_client *smi_add_i2c_client(struct i2c_adapter *adapter, + struct i2c_board_info *info) +{ + struct i2c_client *client; + + request_module(info-type); + client = i2c_new_device(adapter, info); + if (client == NULL || client-dev.driver == NULL) + goto err_add_i2c_client; + + if (!try_module_get(client-dev.driver-owner)) { + i2c_unregister_device(client); + goto err_add_i2c_client; + } + return client; + +err_add_i2c_client: + client = NULL; + return client; +} + +static void smi_del_i2c_client(struct i2c_client *client) +{ + module_put(client-dev.driver-owner); + i2c_unregister_device(client); +} + static const struct m88ds3103_config smi_dvbsky_m88ds3103_cfg = { .i2c_addr = 0x68, .clock = 2700, @@ -517,18 +544,12 @@ static int smi_dvbsky_m88ds3103_fe_attach(struct smi_port *port) strlcpy(tuner_info.type, m88ts2022, I2C_NAME_SIZE); tuner_info.addr = 0x60; tuner_info.platform_data = m88ts2022_config; - request_module(m88ts2022); - tuner_client = i2c_new_device(tuner_i2c_adapter, tuner_info); - if (tuner_client == NULL || tuner_client-dev.driver == NULL) { + tuner_client = smi_add_i2c_client(tuner_i2c_adapter, tuner_info); + if (!tuner_client) { ret = -ENODEV; goto err_tuner_i2c_device; } - if (!try_module_get(tuner_client-dev.driver-owner)) { - ret = -ENODEV; - goto err_tuner_i2c_module; - } - /* delegate signal strength measurement to tuner */ port-fe-ops.read_signal_strength = port-fe-ops.tuner_ops.get_rf_strength; @@ -536,8 +557,6 @@ static int smi_dvbsky_m88ds3103_fe_attach(struct smi_port *port) port-i2c_client_tuner = tuner_client; return ret; -err_tuner_i2c_module: - i2c_unregister_device(tuner_client); err_tuner_i2c_device: dvb_frontend_detach(port-fe); return ret; @@ -581,18 +600,12 @@ static int smi_dvbsky_m88rs6000_fe_attach(struct smi_port *port) strlcpy(tuner_info.type, m88rs6000t, I2C_NAME_SIZE); tuner_info.addr = 0x21; tuner_info.platform_data = m88rs6000t_config; - request_module(m88rs6000t); - tuner_client = i2c_new_device(tuner_i2c_adapter, tuner_info); - if (tuner_client == NULL || tuner_client-dev.driver == NULL) { + tuner_client = smi_add_i2c_client(tuner_i2c_adapter, tuner_info); + if (!tuner_client) { ret = -ENODEV; goto err_tuner_i2c_device; } - if (!try_module_get(tuner_client-dev.driver-owner)) { - ret = -ENODEV; - goto err_tuner_i2c_module; - } - /* delegate signal strength measurement to tuner */ port-fe-ops.read_signal_strength = port-fe-ops.tuner_ops.get_rf_strength; @@ -600,8 +613,6 @@ static int smi_dvbsky_m88rs6000_fe_attach(struct smi_port *port) port-i2c_client_tuner = tuner_client; return ret; -err_tuner_i2c_module: - i2c_unregister_device(tuner_client); err_tuner_i2c_device: dvb_frontend_detach(port-fe); return ret; @@ -631,7 +642,10 @@ static int smi_fe_init(struct smi_port *port) /* register dvb frontend */ ret = dvb_register_frontend(adap, port-fe); if (ret 0) { - i2c_unregister_device(port-i2c_client_tuner); + if (port-i2c_client_tuner) + smi_del_i2c_client(port-i2c_client_tuner); + if (port-i2c_client_demod) + smi_del_i2c_client(port-i2c_client_demod); dvb_frontend_detach(port-fe); return ret; } @@ -645,15 +659,12 @@ static int smi_fe_init(struct smi_port *port) static void smi_fe_exit(struct smi_port *port) { - struct i2c_client *tuner_client; - dvb_unregister_frontend(port-fe); - /* remove I2C tuner */ - tuner_client = port-i2c_client_tuner; - if (tuner_client) { - module_put(tuner_client-dev.driver-owner); - i2c_unregister_device(tuner_client); - } + /* remove I2C demod and tuner */ + if (port-i2c_client_tuner) + smi_del_i2c_client(port-i2c_client_tuner
[PATCH 2/2] smipcie: add DVBSky T9580 V3 support
DVBSky T9580 V3 card is the dual tuner card, which supports S/S2 and T2/T/C. 1DVB-S/S2 frontend: M88DS3103/M88TS2022 2DVB-T2/T/C frontend: SI2168B40/SI2157A30 2PCIe bridge: SMI PCIe Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/smipcie/smipcie.c | 67 + 1 file changed, 67 insertions(+) diff --git a/drivers/media/pci/smipcie/smipcie.c b/drivers/media/pci/smipcie/smipcie.c index c27e45b..a5707ea 100644 --- a/drivers/media/pci/smipcie/smipcie.c +++ b/drivers/media/pci/smipcie/smipcie.c @@ -18,6 +18,8 @@ #include m88ds3103.h #include m88ts2022.h #include m88rs6000t.h +#include si2168.h +#include si2157.h DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); @@ -618,6 +620,58 @@ err_tuner_i2c_device: return ret; } +static int smi_dvbsky_sit2_fe_attach(struct smi_port *port) +{ + int ret = 0; + struct smi_dev *dev = port-dev; + struct i2c_adapter *i2c; + struct i2c_adapter *tuner_i2c_adapter; + struct i2c_client *client_tuner, *client_demod; + struct i2c_board_info client_info; + struct si2168_config si2168_config; + struct si2157_config si2157_config; + + /* select i2c bus */ + i2c = (port-idx == 0) ? dev-i2c_bus[0] : dev-i2c_bus[1]; + + /* attach demod */ + memset(si2168_config, 0, sizeof(si2168_config)); + si2168_config.i2c_adapter = tuner_i2c_adapter; + si2168_config.fe = port-fe; + si2168_config.ts_mode = SI2168_TS_PARALLEL; + + memset(client_info, 0, sizeof(struct i2c_board_info)); + strlcpy(client_info.type, si2168, I2C_NAME_SIZE); + client_info.addr = 0x64; + client_info.platform_data = si2168_config; + + client_demod = smi_add_i2c_client(i2c, client_info); + if (!client_demod) { + ret = -ENODEV; + return ret; + } + port-i2c_client_demod = client_demod; + + /* attach tuner */ + memset(si2157_config, 0, sizeof(si2157_config)); + si2157_config.fe = port-fe; + + memset(client_info, 0, sizeof(struct i2c_board_info)); + strlcpy(client_info.type, si2157, I2C_NAME_SIZE); + client_info.addr = 0x60; + client_info.platform_data = si2157_config; + + client_tuner = smi_add_i2c_client(tuner_i2c_adapter, client_info); + if (!client_tuner) { + smi_del_i2c_client(port-i2c_client_demod); + port-i2c_client_demod = NULL; + ret = -ENODEV; + return ret; + } + port-i2c_client_tuner = client_tuner; + return ret; +} + static int smi_fe_init(struct smi_port *port) { int ret = 0; @@ -635,6 +689,9 @@ static int smi_fe_init(struct smi_port *port) case DVBSKY_FE_M88RS6000: ret = smi_dvbsky_m88rs6000_fe_attach(port); break; + case DVBSKY_FE_SIT2: + ret = smi_dvbsky_sit2_fe_attach(port); + break; } if (ret 0) return ret; @@ -1005,6 +1062,15 @@ static struct smi_cfg_info dvbsky_s952_cfg = { .fe_1 = DVBSKY_FE_M88RS6000, }; +static struct smi_cfg_info dvbsky_t9580_cfg = { + .type = SMI_DVBSKY_S952, + .name = DVBSky T9580 V3, + .ts_0 = SMI_TS_DMA_BOTH, + .ts_1 = SMI_TS_DMA_BOTH, + .fe_0 = DVBSKY_FE_SIT2, + .fe_1 = DVBSKY_FE_M88DS3103, +}; + /* PCI IDs */ #define SMI_ID(_subvend, _subdev, _driverdata) { \ .vendor = SMI_VID,.device= SMI_PID, \ @@ -1014,6 +1080,7 @@ static struct smi_cfg_info dvbsky_s952_cfg = { static const struct pci_device_id smi_id_table[] = { SMI_ID(0x4254, 0x0550, dvbsky_s950_cfg), SMI_ID(0x4254, 0x0552, dvbsky_s952_cfg), + SMI_ID(0x4254, 0x5580, dvbsky_t9580_cfg), {0} }; MODULE_DEVICE_TABLE(pci, smi_id_table); -- 1.9.1 -- 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 v2 2/2] smipcie: add DVBSky T9580 V3 support
v2: - Update Kconfig file. DVBSky T9580 V3 card is the dual tuner card, which supports S/S2 and T2/T/C. 1DVB-S/S2 frontend: M88DS3103/M88TS2022 2DVB-T2/T/C frontend: SI2168B40/SI2157A30 2PCIe bridge: SMI PCIe Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/smipcie/Kconfig | 3 ++ drivers/media/pci/smipcie/smipcie.c | 67 + 2 files changed, 70 insertions(+) diff --git a/drivers/media/pci/smipcie/Kconfig b/drivers/media/pci/smipcie/Kconfig index 75a2992..35ace80 100644 --- a/drivers/media/pci/smipcie/Kconfig +++ b/drivers/media/pci/smipcie/Kconfig @@ -2,12 +2,15 @@ config DVB_SMIPCIE tristate SMI PCIe DVBSky cards depends on DVB_CORE PCI I2C select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT + select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_M88RS6000T if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT help Support for cards with SMI PCIe bridge: - DVBSky S950 V3 - DVBSky S952 V3 + - DVBSky T9580 V3 Say Y or M if you own such a device and want to use it. If unsure say N. diff --git a/drivers/media/pci/smipcie/smipcie.c b/drivers/media/pci/smipcie/smipcie.c index c27e45b..5d1932b 100644 --- a/drivers/media/pci/smipcie/smipcie.c +++ b/drivers/media/pci/smipcie/smipcie.c @@ -18,6 +18,8 @@ #include m88ds3103.h #include m88ts2022.h #include m88rs6000t.h +#include si2168.h +#include si2157.h DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); @@ -618,6 +620,58 @@ err_tuner_i2c_device: return ret; } +static int smi_dvbsky_sit2_fe_attach(struct smi_port *port) +{ + int ret = 0; + struct smi_dev *dev = port-dev; + struct i2c_adapter *i2c; + struct i2c_adapter *tuner_i2c_adapter; + struct i2c_client *client_tuner, *client_demod; + struct i2c_board_info client_info; + struct si2168_config si2168_config; + struct si2157_config si2157_config; + + /* select i2c bus */ + i2c = (port-idx == 0) ? dev-i2c_bus[0] : dev-i2c_bus[1]; + + /* attach demod */ + memset(si2168_config, 0, sizeof(si2168_config)); + si2168_config.i2c_adapter = tuner_i2c_adapter; + si2168_config.fe = port-fe; + si2168_config.ts_mode = SI2168_TS_PARALLEL; + + memset(client_info, 0, sizeof(struct i2c_board_info)); + strlcpy(client_info.type, si2168, I2C_NAME_SIZE); + client_info.addr = 0x64; + client_info.platform_data = si2168_config; + + client_demod = smi_add_i2c_client(i2c, client_info); + if (!client_demod) { + ret = -ENODEV; + return ret; + } + port-i2c_client_demod = client_demod; + + /* attach tuner */ + memset(si2157_config, 0, sizeof(si2157_config)); + si2157_config.fe = port-fe; + + memset(client_info, 0, sizeof(struct i2c_board_info)); + strlcpy(client_info.type, si2157, I2C_NAME_SIZE); + client_info.addr = 0x60; + client_info.platform_data = si2157_config; + + client_tuner = smi_add_i2c_client(tuner_i2c_adapter, client_info); + if (!client_tuner) { + smi_del_i2c_client(port-i2c_client_demod); + port-i2c_client_demod = NULL; + ret = -ENODEV; + return ret; + } + port-i2c_client_tuner = client_tuner; + return ret; +} + static int smi_fe_init(struct smi_port *port) { int ret = 0; @@ -635,6 +689,9 @@ static int smi_fe_init(struct smi_port *port) case DVBSKY_FE_M88RS6000: ret = smi_dvbsky_m88rs6000_fe_attach(port); break; + case DVBSKY_FE_SIT2: + ret = smi_dvbsky_sit2_fe_attach(port); + break; } if (ret 0) return ret; @@ -1005,6 +1062,15 @@ static struct smi_cfg_info dvbsky_s952_cfg = { .fe_1 = DVBSKY_FE_M88RS6000, }; +static struct smi_cfg_info dvbsky_t9580_cfg = { + .type = SMI_DVBSKY_T9580, + .name = DVBSky T9580 V3, + .ts_0 = SMI_TS_DMA_BOTH, + .ts_1 = SMI_TS_DMA_BOTH, + .fe_0 = DVBSKY_FE_SIT2, + .fe_1 = DVBSKY_FE_M88DS3103, +}; + /* PCI IDs */ #define SMI_ID(_subvend, _subdev, _driverdata) { \ .vendor = SMI_VID,.device= SMI_PID, \ @@ -1014,6 +1080,7 @@ static struct smi_cfg_info dvbsky_s952_cfg = { static const struct pci_device_id smi_id_table[] = { SMI_ID(0x4254, 0x0550, dvbsky_s950_cfg), SMI_ID(0x4254, 0x0552, dvbsky_s952_cfg), + SMI_ID(0x4254, 0x5580, dvbsky_t9580_cfg), {0} }; MODULE_DEVICE_TABLE(pci, smi_id_table); -- 1.9.1 -- 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 v2 1/2] smipcie: use add_i2c_client and del_i2c_client functions.
v2: -no change, just resend with other patches. add_i2c_client and del_i2c_client functions make code shorter and easy to maintain. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/smipcie/smipcie.c | 69 + 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/drivers/media/pci/smipcie/smipcie.c b/drivers/media/pci/smipcie/smipcie.c index d1c1463..c27e45b 100644 --- a/drivers/media/pci/smipcie/smipcie.c +++ b/drivers/media/pci/smipcie/smipcie.c @@ -477,6 +477,33 @@ static irqreturn_t smi_irq_handler(int irq, void *dev_id) return IRQ_HANDLED; } +static struct i2c_client *smi_add_i2c_client(struct i2c_adapter *adapter, + struct i2c_board_info *info) +{ + struct i2c_client *client; + + request_module(info-type); + client = i2c_new_device(adapter, info); + if (client == NULL || client-dev.driver == NULL) + goto err_add_i2c_client; + + if (!try_module_get(client-dev.driver-owner)) { + i2c_unregister_device(client); + goto err_add_i2c_client; + } + return client; + +err_add_i2c_client: + client = NULL; + return client; +} + +static void smi_del_i2c_client(struct i2c_client *client) +{ + module_put(client-dev.driver-owner); + i2c_unregister_device(client); +} + static const struct m88ds3103_config smi_dvbsky_m88ds3103_cfg = { .i2c_addr = 0x68, .clock = 2700, @@ -517,18 +544,12 @@ static int smi_dvbsky_m88ds3103_fe_attach(struct smi_port *port) strlcpy(tuner_info.type, m88ts2022, I2C_NAME_SIZE); tuner_info.addr = 0x60; tuner_info.platform_data = m88ts2022_config; - request_module(m88ts2022); - tuner_client = i2c_new_device(tuner_i2c_adapter, tuner_info); - if (tuner_client == NULL || tuner_client-dev.driver == NULL) { + tuner_client = smi_add_i2c_client(tuner_i2c_adapter, tuner_info); + if (!tuner_client) { ret = -ENODEV; goto err_tuner_i2c_device; } - if (!try_module_get(tuner_client-dev.driver-owner)) { - ret = -ENODEV; - goto err_tuner_i2c_module; - } - /* delegate signal strength measurement to tuner */ port-fe-ops.read_signal_strength = port-fe-ops.tuner_ops.get_rf_strength; @@ -536,8 +557,6 @@ static int smi_dvbsky_m88ds3103_fe_attach(struct smi_port *port) port-i2c_client_tuner = tuner_client; return ret; -err_tuner_i2c_module: - i2c_unregister_device(tuner_client); err_tuner_i2c_device: dvb_frontend_detach(port-fe); return ret; @@ -581,18 +600,12 @@ static int smi_dvbsky_m88rs6000_fe_attach(struct smi_port *port) strlcpy(tuner_info.type, m88rs6000t, I2C_NAME_SIZE); tuner_info.addr = 0x21; tuner_info.platform_data = m88rs6000t_config; - request_module(m88rs6000t); - tuner_client = i2c_new_device(tuner_i2c_adapter, tuner_info); - if (tuner_client == NULL || tuner_client-dev.driver == NULL) { + tuner_client = smi_add_i2c_client(tuner_i2c_adapter, tuner_info); + if (!tuner_client) { ret = -ENODEV; goto err_tuner_i2c_device; } - if (!try_module_get(tuner_client-dev.driver-owner)) { - ret = -ENODEV; - goto err_tuner_i2c_module; - } - /* delegate signal strength measurement to tuner */ port-fe-ops.read_signal_strength = port-fe-ops.tuner_ops.get_rf_strength; @@ -600,8 +613,6 @@ static int smi_dvbsky_m88rs6000_fe_attach(struct smi_port *port) port-i2c_client_tuner = tuner_client; return ret; -err_tuner_i2c_module: - i2c_unregister_device(tuner_client); err_tuner_i2c_device: dvb_frontend_detach(port-fe); return ret; @@ -631,7 +642,10 @@ static int smi_fe_init(struct smi_port *port) /* register dvb frontend */ ret = dvb_register_frontend(adap, port-fe); if (ret 0) { - i2c_unregister_device(port-i2c_client_tuner); + if (port-i2c_client_tuner) + smi_del_i2c_client(port-i2c_client_tuner); + if (port-i2c_client_demod) + smi_del_i2c_client(port-i2c_client_demod); dvb_frontend_detach(port-fe); return ret; } @@ -645,15 +659,12 @@ static int smi_fe_init(struct smi_port *port) static void smi_fe_exit(struct smi_port *port) { - struct i2c_client *tuner_client; - dvb_unregister_frontend(port-fe); - /* remove I2C tuner */ - tuner_client = port-i2c_client_tuner; - if (tuner_client) { - module_put(tuner_client-dev.driver-owner); - i2c_unregister_device(tuner_client); - } + /* remove I2C demod and tuner */ + if (port-i2c_client_tuner
Re: Re: [PATCH 2/3] cx23885: add DVBSky S952 support
On 2014-11-07 04:31:01, Olli Salonen wrote: Looks good to me. Only missing T982 support now? Reviewed-by: Olli Salonen olli.salo...@iki.fi -olli Thanks for review. Yes, it is only missing T982 for cx23885 bridge driver. BR, Max On Wed, 5 Nov 2014, Nibble Max wrote: DVBSky S952 dvb-s/s2 dual PCIe card: 1dvb frontend: M88TS2022(tuner),M88DS3103(demod) 2PCIe bridge: CX23885(port b: parallel mode, port c: serial mode) 3rc: cx23885 integrated. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/cx23885/cx23885-cards.c | 22 +++ drivers/media/pci/cx23885/cx23885-dvb.c | 99 ++- drivers/media/pci/cx23885/cx23885-input.c | 3 + drivers/media/pci/cx23885/cx23885.h | 1 + 4 files changed, 124 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 4b9cb07..4bad27d 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -696,6 +696,11 @@ struct cx23885_board cx23885_boards[] = { .name = DVBSky S950, .portb = CX23885_MPEG_DVB, }, +[CX23885_BOARD_DVBSKY_S952] = { +.name = DVBSky S952, +.portb = CX23885_MPEG_DVB, +.portc = CX23885_MPEG_DVB, +}, }; const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); @@ -971,6 +976,10 @@ struct cx23885_subid cx23885_subids[] = { .subvendor = 0x4254, .subdevice = 0x0950, .card = CX23885_BOARD_DVBSKY_S950, +}, { +.subvendor = 0x4254, +.subdevice = 0x0952, +.card = CX23885_BOARD_DVBSKY_S952, }, }; const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); @@ -1566,6 +1575,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) mdelay(60); break; case CX23885_BOARD_DVBSKY_T9580: +case CX23885_BOARD_DVBSKY_S952: /* enable GPIO3-18 pins */ cx_write(MC417_CTL, 0x0037); cx23885_gpio_enable(dev, GPIO_2 | GPIO_11, 1); @@ -1697,6 +1707,7 @@ int cx23885_ir_init(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: case CX23885_BOARD_DVBSKY_S950: +case CX23885_BOARD_DVBSKY_S952: if (!enable_885_ir) break; dev-sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); @@ -1748,6 +1759,7 @@ void cx23885_ir_fini(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: case CX23885_BOARD_DVBSKY_S950: +case CX23885_BOARD_DVBSKY_S952: cx23885_irq_remove(dev, PCI_MSK_AV_CORE); /* sd_ir is a duplicate pointer to the AV Core, just clear it */ dev-sd_ir = NULL; @@ -1800,6 +1812,7 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: case CX23885_BOARD_DVBSKY_S950: +case CX23885_BOARD_DVBSKY_S952: if (dev-sd_ir) cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE); break; @@ -1962,6 +1975,14 @@ void cx23885_card_setup(struct cx23885_dev *dev) ts2-ts_clk_en_val = 0x1; /* Enable TS_CLK */ ts2-src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; break; +case CX23885_BOARD_DVBSKY_S952: +ts1-gen_ctrl_val = 0x5; /* Parallel */ +ts1-ts_clk_en_val = 0x1; /* Enable TS_CLK */ +ts1-src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; +ts2-gen_ctrl_val = 0xe; /* Serial bus */ +ts2-ts_clk_en_val = 0x1; /* Enable TS_CLK */ +ts2-src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; +break; case CX23885_BOARD_HAUPPAUGE_HVR1250: case CX23885_BOARD_HAUPPAUGE_HVR1500: case CX23885_BOARD_HAUPPAUGE_HVR1500Q: @@ -2029,6 +2050,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: case CX23885_BOARD_DVBSKY_S950: +case CX23885_BOARD_DVBSKY_S952: dev-sd_cx25840 = v4l2_i2c_new_subdev(dev-v4l2_dev, dev-i2c_bus[2].i2c_adap, cx25840, 0x88 1, NULL); diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 3410ab8..2457b64 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -617,6 +617,32 @@ static int dvbsky_t9580_set_voltage(struct dvb_frontend *fe, return 0; } +static int dvbsky_s952_portc_set_voltage(struct dvb_frontend *fe, +fe_sec_voltage_t voltage) +{ +struct cx23885_tsport *port = fe
[PATCH 3/3] m88ds3103: change ts clock config for serial mode
1 When m88ds3103 works in serial ts mode, its serial ts clock is equal to ts master clock and the clock divider is bypassed. 2 The serial ts clock is configed by the bridge driver just like parallel ts clock. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/dvb-frontends/m88ds3103.c | 55 +++-- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c index 621d20f..0cd445c 100644 --- a/drivers/media/dvb-frontends/m88ds3103.c +++ b/drivers/media/dvb-frontends/m88ds3103.c @@ -245,9 +245,9 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) struct dtv_frontend_properties *c = fe-dtv_property_cache; int ret, len; const struct m88ds3103_reg_val *init; - u8 u8tmp, u8tmp1, u8tmp2; + u8 u8tmp, u8tmp1 = 0, u8tmp2 = 0; /* silence compiler warning */ u8 buf[3]; - u16 u16tmp, divide_ratio; + u16 u16tmp, divide_ratio = 0; u32 tuner_frequency, target_mclk; s32 s32tmp; @@ -319,32 +319,29 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) /* set M88DS3103 mclk and ts mclk. */ priv-mclk_khz = 96000; - if (c-delivery_system == SYS_DVBS) - target_mclk = 96000; - else { - switch (priv-cfg-ts_mode) { - case M88DS3103_TS_SERIAL: - case M88DS3103_TS_SERIAL_D7: - if (c-symbol_rate 1800) - target_mclk = 96000; - else - target_mclk = 144000; - break; - case M88DS3103_TS_PARALLEL: - case M88DS3103_TS_CI: + switch (priv-cfg-ts_mode) { + case M88DS3103_TS_SERIAL: + case M88DS3103_TS_SERIAL_D7: + target_mclk = priv-cfg-ts_clk; + break; + case M88DS3103_TS_PARALLEL: + case M88DS3103_TS_CI: + if (c-delivery_system == SYS_DVBS) + target_mclk = 96000; + else { if (c-symbol_rate 1800) target_mclk = 96000; else if (c-symbol_rate 2800) target_mclk = 144000; else target_mclk = 192000; - break; - default: - dev_dbg(priv-i2c-dev, %s: invalid ts_mode\n, - __func__); - ret = -EINVAL; - goto err; } + break; + default: + dev_dbg(priv-i2c-dev, %s: invalid ts_mode\n, + __func__); + ret = -EINVAL; + goto err; } switch (target_mclk) { @@ -434,7 +431,6 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) goto err; } - u8tmp1 = 0; /* silence compiler warning */ switch (priv-cfg-ts_mode) { case M88DS3103_TS_SERIAL: u8tmp1 = 0x00; @@ -470,16 +466,15 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) ret = m88ds3103_wr_reg_mask(priv, 0x29, u8tmp1, 0x20); if (ret) goto err; - } - - if (priv-cfg-ts_clk) { - divide_ratio = DIV_ROUND_UP(target_mclk, priv-cfg-ts_clk); - u8tmp1 = divide_ratio / 2; - u8tmp2 = DIV_ROUND_UP(divide_ratio, 2); - } else { - divide_ratio = 0; u8tmp1 = 0; u8tmp2 = 0; + break; + default: + if (priv-cfg-ts_clk) { + divide_ratio = DIV_ROUND_UP(target_mclk, priv-cfg-ts_clk); + u8tmp1 = divide_ratio / 2; + u8tmp2 = DIV_ROUND_UP(divide_ratio, 2); + } } dev_dbg(priv-i2c-dev, -- 1.9.1 -- 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 1/3] cx23885: add DVBSky S950 support
DVBSky S950 dvb-s/s2 PCIe card: 1dvb frontend: M88TS2022(tuner),M88DS3103(demod) 2PCIe bridge: cx23885 3rc: cx23885 integrated. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/cx23885/cx23885-cards.c | 20 drivers/media/pci/cx23885/cx23885-dvb.c | 9 ++--- drivers/media/pci/cx23885/cx23885-input.c | 3 +++ drivers/media/pci/cx23885/cx23885.h | 1 + 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 9c7e8ac..4b9cb07 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -692,6 +692,10 @@ struct cx23885_board cx23885_boards[] = { .name = Technotrend TT-budget CT2-4500 CI, .portb = CX23885_MPEG_DVB, }, + [CX23885_BOARD_DVBSKY_S950] = { + .name = DVBSky S950, + .portb = CX23885_MPEG_DVB, + }, }; const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); @@ -963,6 +967,10 @@ struct cx23885_subid cx23885_subids[] = { .subvendor = 0x13c2, .subdevice = 0x3013, .card = CX23885_BOARD_TT_CT2_4500_CI, + }, { + .subvendor = 0x4254, + .subdevice = 0x0950, + .card = CX23885_BOARD_DVBSKY_S950, }, }; const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); @@ -1597,6 +1605,13 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) /* enable irq */ cx_write(GPIO_ISM, 0x); /* INTERRUPTS active low */ + break; + case CX23885_BOARD_DVBSKY_S950: + cx23885_gpio_enable(dev, GPIO_2, 1); + cx23885_gpio_clear(dev, GPIO_2); + msleep(100); + cx23885_gpio_set(dev, GPIO_2); + break; } } @@ -1681,6 +1696,7 @@ int cx23885_ir_init(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_T980C: case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: + case CX23885_BOARD_DVBSKY_S950: if (!enable_885_ir) break; dev-sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); @@ -1731,6 +1747,7 @@ void cx23885_ir_fini(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_T980C: case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: + case CX23885_BOARD_DVBSKY_S950: cx23885_irq_remove(dev, PCI_MSK_AV_CORE); /* sd_ir is a duplicate pointer to the AV Core, just clear it */ dev-sd_ir = NULL; @@ -1782,6 +1799,7 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_T980C: case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: + case CX23885_BOARD_DVBSKY_S950: if (dev-sd_ir) cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE); break; @@ -1888,6 +1906,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_T980C: case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: + case CX23885_BOARD_DVBSKY_S950: ts1-gen_ctrl_val = 0x5; /* Parallel */ ts1-ts_clk_en_val = 0x1; /* Enable TS_CLK */ ts1-src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; @@ -2009,6 +2028,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_T980C: case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: + case CX23885_BOARD_DVBSKY_S950: dev-sd_cx25840 = v4l2_i2c_new_subdev(dev-v4l2_dev, dev-i2c_bus[2].i2c_adap, cx25840, 0x88 1, NULL); diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 9da5cf3..3410ab8 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -1672,6 +1672,7 @@ static int dvb_register(struct cx23885_tsport *port) } break; case CX23885_BOARD_DVBSKY_T9580: + case CX23885_BOARD_DVBSKY_S950: i2c_bus = dev-i2c_bus[0]; i2c_bus2 = dev-i2c_bus[1]; switch (port-nr) { @@ -1922,7 +1923,8 @@ static int dvb_register(struct cx23885_tsport *port) memcpy(port-frontends.adapter.proposed_mac, eeprom + 0xa0, 6); break; } - case CX23885_BOARD_DVBSKY_T9580: { + case CX23885_BOARD_DVBSKY_T9580: + case CX23885_BOARD_DVBSKY_S950: { u8 eeprom[256]; /* 24C02 i2c eeprom */ if (port-nr 2) @@ -1932,8 +1934,9 @@ static int dvb_register(struct cx23885_tsport *port
[PATCH 2/3] cx23885: add DVBSky S952 support
DVBSky S952 dvb-s/s2 dual PCIe card: 1dvb frontend: M88TS2022(tuner),M88DS3103(demod) 2PCIe bridge: CX23885(port b: parallel mode, port c: serial mode) 3rc: cx23885 integrated. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/cx23885/cx23885-cards.c | 22 +++ drivers/media/pci/cx23885/cx23885-dvb.c | 99 ++- drivers/media/pci/cx23885/cx23885-input.c | 3 + drivers/media/pci/cx23885/cx23885.h | 1 + 4 files changed, 124 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 4b9cb07..4bad27d 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -696,6 +696,11 @@ struct cx23885_board cx23885_boards[] = { .name = DVBSky S950, .portb = CX23885_MPEG_DVB, }, + [CX23885_BOARD_DVBSKY_S952] = { + .name = DVBSky S952, + .portb = CX23885_MPEG_DVB, + .portc = CX23885_MPEG_DVB, + }, }; const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); @@ -971,6 +976,10 @@ struct cx23885_subid cx23885_subids[] = { .subvendor = 0x4254, .subdevice = 0x0950, .card = CX23885_BOARD_DVBSKY_S950, + }, { + .subvendor = 0x4254, + .subdevice = 0x0952, + .card = CX23885_BOARD_DVBSKY_S952, }, }; const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); @@ -1566,6 +1575,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) mdelay(60); break; case CX23885_BOARD_DVBSKY_T9580: + case CX23885_BOARD_DVBSKY_S952: /* enable GPIO3-18 pins */ cx_write(MC417_CTL, 0x0037); cx23885_gpio_enable(dev, GPIO_2 | GPIO_11, 1); @@ -1697,6 +1707,7 @@ int cx23885_ir_init(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: case CX23885_BOARD_DVBSKY_S950: + case CX23885_BOARD_DVBSKY_S952: if (!enable_885_ir) break; dev-sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); @@ -1748,6 +1759,7 @@ void cx23885_ir_fini(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: case CX23885_BOARD_DVBSKY_S950: + case CX23885_BOARD_DVBSKY_S952: cx23885_irq_remove(dev, PCI_MSK_AV_CORE); /* sd_ir is a duplicate pointer to the AV Core, just clear it */ dev-sd_ir = NULL; @@ -1800,6 +1812,7 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: case CX23885_BOARD_DVBSKY_S950: + case CX23885_BOARD_DVBSKY_S952: if (dev-sd_ir) cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE); break; @@ -1962,6 +1975,14 @@ void cx23885_card_setup(struct cx23885_dev *dev) ts2-ts_clk_en_val = 0x1; /* Enable TS_CLK */ ts2-src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; break; + case CX23885_BOARD_DVBSKY_S952: + ts1-gen_ctrl_val = 0x5; /* Parallel */ + ts1-ts_clk_en_val = 0x1; /* Enable TS_CLK */ + ts1-src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; + ts2-gen_ctrl_val = 0xe; /* Serial bus */ + ts2-ts_clk_en_val = 0x1; /* Enable TS_CLK */ + ts2-src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; + break; case CX23885_BOARD_HAUPPAUGE_HVR1250: case CX23885_BOARD_HAUPPAUGE_HVR1500: case CX23885_BOARD_HAUPPAUGE_HVR1500Q: @@ -2029,6 +2050,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_S950C: case CX23885_BOARD_TT_CT2_4500_CI: case CX23885_BOARD_DVBSKY_S950: + case CX23885_BOARD_DVBSKY_S952: dev-sd_cx25840 = v4l2_i2c_new_subdev(dev-v4l2_dev, dev-i2c_bus[2].i2c_adap, cx25840, 0x88 1, NULL); diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 3410ab8..2457b64 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -617,6 +617,32 @@ static int dvbsky_t9580_set_voltage(struct dvb_frontend *fe, return 0; } +static int dvbsky_s952_portc_set_voltage(struct dvb_frontend *fe, + fe_sec_voltage_t voltage) +{ + struct cx23885_tsport *port = fe-dvb-priv; + struct cx23885_dev *dev = port-dev; + + cx23885_gpio_enable(dev, GPIO_12 | GPIO_13, 1); + + switch (voltage) { + case
[PATCH 1/1] smipcie: add DVBSky S952 V3 support
DVBSky S952 V3 card has a dual channels of dvb-s/s2. 1Frontend: Integrated tuner and demod: M88RS6000 2PCIe bridge: SMI PCIe Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/smipcie/Kconfig | 2 + drivers/media/pci/smipcie/smipcie.c | 78 + 2 files changed, 80 insertions(+) diff --git a/drivers/media/pci/smipcie/Kconfig b/drivers/media/pci/smipcie/Kconfig index 78b76ca..75a2992 100644 --- a/drivers/media/pci/smipcie/Kconfig +++ b/drivers/media/pci/smipcie/Kconfig @@ -3,9 +3,11 @@ config DVB_SMIPCIE depends on DVB_CORE PCI I2C select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_M88RS6000T if MEDIA_SUBDRV_AUTOSELECT help Support for cards with SMI PCIe bridge: - DVBSky S950 V3 + - DVBSky S952 V3 Say Y or M if you own such a device and want to use it. If unsure say N. diff --git a/drivers/media/pci/smipcie/smipcie.c b/drivers/media/pci/smipcie/smipcie.c index 6ad6cc5..d1c1463 100644 --- a/drivers/media/pci/smipcie/smipcie.c +++ b/drivers/media/pci/smipcie/smipcie.c @@ -17,6 +17,7 @@ #include smipcie.h #include m88ds3103.h #include m88ts2022.h +#include m88rs6000t.h DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); @@ -542,6 +543,70 @@ err_tuner_i2c_device: return ret; } +static const struct m88ds3103_config smi_dvbsky_m88rs6000_cfg = { + .i2c_addr = 0x69, + .clock = 2700, + .i2c_wr_max = 33, + .ts_mode = M88DS3103_TS_PARALLEL, + .ts_clk = 16000, + .ts_clk_pol = 1, + .agc = 0x99, + .lnb_hv_pol = 0, + .lnb_en_pol = 1, +}; + +static int smi_dvbsky_m88rs6000_fe_attach(struct smi_port *port) +{ + int ret = 0; + struct smi_dev *dev = port-dev; + struct i2c_adapter *i2c; + /* tuner I2C module */ + struct i2c_adapter *tuner_i2c_adapter; + struct i2c_client *tuner_client; + struct i2c_board_info tuner_info; + struct m88rs6000t_config m88rs6000t_config; + + memset(tuner_info, 0, sizeof(struct i2c_board_info)); + i2c = (port-idx == 0) ? dev-i2c_bus[0] : dev-i2c_bus[1]; + + /* attach demod */ + port-fe = dvb_attach(m88ds3103_attach, + smi_dvbsky_m88rs6000_cfg, i2c, tuner_i2c_adapter); + if (!port-fe) { + ret = -ENODEV; + return ret; + } + /* attach tuner */ + m88rs6000t_config.fe = port-fe; + strlcpy(tuner_info.type, m88rs6000t, I2C_NAME_SIZE); + tuner_info.addr = 0x21; + tuner_info.platform_data = m88rs6000t_config; + request_module(m88rs6000t); + tuner_client = i2c_new_device(tuner_i2c_adapter, tuner_info); + if (tuner_client == NULL || tuner_client-dev.driver == NULL) { + ret = -ENODEV; + goto err_tuner_i2c_device; + } + + if (!try_module_get(tuner_client-dev.driver-owner)) { + ret = -ENODEV; + goto err_tuner_i2c_module; + } + + /* delegate signal strength measurement to tuner */ + port-fe-ops.read_signal_strength = + port-fe-ops.tuner_ops.get_rf_strength; + + port-i2c_client_tuner = tuner_client; + return ret; + +err_tuner_i2c_module: + i2c_unregister_device(tuner_client); +err_tuner_i2c_device: + dvb_frontend_detach(port-fe); + return ret; +} + static int smi_fe_init(struct smi_port *port) { int ret = 0; @@ -556,6 +621,9 @@ static int smi_fe_init(struct smi_port *port) case DVBSKY_FE_M88DS3103: ret = smi_dvbsky_m88ds3103_fe_attach(port); break; + case DVBSKY_FE_M88RS6000: + ret = smi_dvbsky_m88rs6000_fe_attach(port); + break; } if (ret 0) return ret; @@ -917,6 +985,15 @@ static struct smi_cfg_info dvbsky_s950_cfg = { .fe_1 = DVBSKY_FE_M88DS3103, }; +static struct smi_cfg_info dvbsky_s952_cfg = { + .type = SMI_DVBSKY_S952, + .name = DVBSky S952 V3, + .ts_0 = SMI_TS_DMA_BOTH, + .ts_1 = SMI_TS_DMA_BOTH, + .fe_0 = DVBSKY_FE_M88RS6000, + .fe_1 = DVBSKY_FE_M88RS6000, +}; + /* PCI IDs */ #define SMI_ID(_subvend, _subdev, _driverdata) { \ .vendor = SMI_VID,.device= SMI_PID, \ @@ -925,6 +1002,7 @@ static struct smi_cfg_info dvbsky_s950_cfg = { static const struct pci_device_id smi_id_table[] = { SMI_ID(0x4254, 0x0550, dvbsky_s950_cfg), + SMI_ID(0x4254, 0x0552, dvbsky_s952_cfg), {0} }; MODULE_DEVICE_TABLE(pci, smi_id_table); -- 1.9.1 -- 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
Re: [PATCH 1/1] smipcie: add DVBSky S952 V3 support
Hello Mauro, I check media_tree.git on linuxtv.org that the media tree does not include S952 V3 code. S952 V3 card has M88RS6000 dvb frontend. S950 V3 card has M88TS2022/M88DS3103 dvb frontend. There are 2 reasons: 1 I submit two patchs for smipcie bridge driver. first one for S950 V3: http://patchwork.linuxtv.org/patch/26364/ later one for S950 V3 and S952 V3: http://patchwork.linuxtv.org/patch/26436 2 I do not resend the patch for smipcie bridge driver together with the updated patchs for m88rs6000t and m88ds3103. Sorry for my wrong actions. It makes you to pick up the first one which has no S952 V3 code. So I submit S952 V3 patch for the current media_tree.git code again. BR, Max On 2014-11-04 22:46:01, Nibble Max wrote: DVBSky S952 V3 card has a dual channels of dvb-s/s2. 1Frontend: Integrated tuner and demod: M88RS6000 2PCIe bridge: SMI PCIe Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/smipcie/Kconfig | 2 + drivers/media/pci/smipcie/smipcie.c | 78 + 2 files changed, 80 insertions(+) diff --git a/drivers/media/pci/smipcie/Kconfig b/drivers/media/pci/smipcie/Kconfig index 78b76ca..75a2992 100644 --- a/drivers/media/pci/smipcie/Kconfig +++ b/drivers/media/pci/smipcie/Kconfig @@ -3,9 +3,11 @@ config DVB_SMIPCIE depends on DVB_CORE PCI I2C select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_M88RS6000T if MEDIA_SUBDRV_AUTOSELECT help Support for cards with SMI PCIe bridge: - DVBSky S950 V3 +- DVBSky S952 V3 Say Y or M if you own such a device and want to use it. If unsure say N. diff --git a/drivers/media/pci/smipcie/smipcie.c b/drivers/media/pci/smipcie/smipcie.c index 6ad6cc5..d1c1463 100644 --- a/drivers/media/pci/smipcie/smipcie.c +++ b/drivers/media/pci/smipcie/smipcie.c @@ -17,6 +17,7 @@ #include smipcie.h #include m88ds3103.h #include m88ts2022.h +#include m88rs6000t.h DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); @@ -542,6 +543,70 @@ err_tuner_i2c_device: return ret; } +static const struct m88ds3103_config smi_dvbsky_m88rs6000_cfg = { + .i2c_addr = 0x69, + .clock = 2700, + .i2c_wr_max = 33, + .ts_mode = M88DS3103_TS_PARALLEL, + .ts_clk = 16000, + .ts_clk_pol = 1, + .agc = 0x99, + .lnb_hv_pol = 0, + .lnb_en_pol = 1, +}; + +static int smi_dvbsky_m88rs6000_fe_attach(struct smi_port *port) +{ + int ret = 0; + struct smi_dev *dev = port-dev; + struct i2c_adapter *i2c; + /* tuner I2C module */ + struct i2c_adapter *tuner_i2c_adapter; + struct i2c_client *tuner_client; + struct i2c_board_info tuner_info; + struct m88rs6000t_config m88rs6000t_config; + + memset(tuner_info, 0, sizeof(struct i2c_board_info)); + i2c = (port-idx == 0) ? dev-i2c_bus[0] : dev-i2c_bus[1]; + + /* attach demod */ + port-fe = dvb_attach(m88ds3103_attach, + smi_dvbsky_m88rs6000_cfg, i2c, tuner_i2c_adapter); + if (!port-fe) { + ret = -ENODEV; + return ret; + } + /* attach tuner */ + m88rs6000t_config.fe = port-fe; + strlcpy(tuner_info.type, m88rs6000t, I2C_NAME_SIZE); + tuner_info.addr = 0x21; + tuner_info.platform_data = m88rs6000t_config; + request_module(m88rs6000t); + tuner_client = i2c_new_device(tuner_i2c_adapter, tuner_info); + if (tuner_client == NULL || tuner_client-dev.driver == NULL) { + ret = -ENODEV; + goto err_tuner_i2c_device; + } + + if (!try_module_get(tuner_client-dev.driver-owner)) { + ret = -ENODEV; + goto err_tuner_i2c_module; + } + + /* delegate signal strength measurement to tuner */ + port-fe-ops.read_signal_strength = + port-fe-ops.tuner_ops.get_rf_strength; + + port-i2c_client_tuner = tuner_client; + return ret; + +err_tuner_i2c_module: + i2c_unregister_device(tuner_client); +err_tuner_i2c_device: + dvb_frontend_detach(port-fe); + return ret; +} + static int smi_fe_init(struct smi_port *port) { int ret = 0; @@ -556,6 +621,9 @@ static int smi_fe_init(struct smi_port *port) case DVBSKY_FE_M88DS3103: ret = smi_dvbsky_m88ds3103_fe_attach(port); break; + case DVBSKY_FE_M88RS6000: + ret = smi_dvbsky_m88rs6000_fe_attach(port); + break; } if (ret 0) return ret; @@ -917,6 +985,15 @@ static struct smi_cfg_info dvbsky_s950_cfg = { .fe_1 = DVBSKY_FE_M88DS3103, }; +static struct smi_cfg_info dvbsky_s952_cfg = { + .type = SMI_DVBSKY_S952, + .name = DVBSky S952 V3, + .ts_0 = SMI_TS_DMA_BOTH, + .ts_1 = SMI_TS_DMA_BOTH, + .fe_0 = DVBSKY_FE_M88RS6000, + .fe_1 = DVBSKY_FE_M88RS6000, +}; + /* PCI IDs */ #define
Re: Re: [PATCH v3 2/3] DVBSky V3 PCIe card: add new dvb-s/s2 tuner forintegrated chip M88RS6000
Hello Mauro, On 2014-11-03 22:43:18, Mauro Carvalho Chehab wrote: Em Thu, 30 Oct 2014 16:01:51 +0800 Nibble Max nibble@gmail.com escreveu: v3: -config demod mclk in set_params call back. -remove set_config. Where's patch 1/3 v3? patch 1/3 is the smipcie bridge driver. https://patchwork.linuxtv.org/patch/26436/ It has no review feed back, so it has no v3 version. Regards, Mauro BR, Max v2: -make demod mclk selection logic simple. -merge demod mclk and ts mclk into one call back. -make code clean. M88RS6000 is the integrated chip, which includes tuner and demod. Here splite its tuner as a standalone driver. .set_config is used to config its demod clock, which sits inside tuner die. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/tuners/Kconfig | 8 + drivers/media/tuners/Makefile | 1 + drivers/media/tuners/m88rs6000t.c | 744 ++ drivers/media/tuners/m88rs6000t.h | 29 ++ 4 files changed, 782 insertions(+) diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig index f039dc2..42e5a01 100644 --- a/drivers/media/tuners/Kconfig +++ b/drivers/media/tuners/Kconfig @@ -232,6 +232,14 @@ config MEDIA_TUNER_M88TS2022 help Montage M88TS2022 silicon tuner driver. +config MEDIA_TUNER_M88RS6000T +tristate Montage M88RS6000 internal tuner +depends on MEDIA_SUPPORT I2C +select REGMAP_I2C +default m if !MEDIA_SUBDRV_AUTOSELECT +help + Montage M88RS6000 internal tuner. + config MEDIA_TUNER_TUA9001 tristate Infineon TUA 9001 silicon tuner depends on MEDIA_SUPPORT I2C diff --git a/drivers/media/tuners/Makefile b/drivers/media/tuners/Makefile index 49fcf80..da4fe6e 100644 --- a/drivers/media/tuners/Makefile +++ b/drivers/media/tuners/Makefile @@ -41,6 +41,7 @@ obj-$(CONFIG_MEDIA_TUNER_IT913X) += it913x.o obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o +obj-$(CONFIG_MEDIA_TUNER_M88RS6000T) += m88rs6000t.o ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends diff --git a/drivers/media/tuners/m88rs6000t.c b/drivers/media/tuners/m88rs6000t.c new file mode 100644 index 000..d4c13fe --- /dev/null +++ b/drivers/media/tuners/m88rs6000t.c @@ -0,0 +1,744 @@ +/* + * Driver for the internal tuner of Montage M88RS6000 + * + * Copyright (C) 2014 Max nibble nibble@gmail.com + * + *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 m88rs6000t.h +#include linux/regmap.h + +struct m88rs6000t_dev { +struct m88rs6000t_config cfg; +struct i2c_client *client; +struct regmap *regmap; +u32 frequency_khz; +}; + +struct m88rs6000t_reg_val { +u8 reg; +u8 val; +}; + +/* set demod main mclk and ts mclk */ +static int m88rs6000t_set_demod_mclk(struct dvb_frontend *fe) +{ +struct m88rs6000t_dev *dev = fe-tuner_priv; +struct dtv_frontend_properties *c = fe-dtv_property_cache; +u8 reg11, reg15, reg16, reg1D, reg1E, reg1F; +u8 N, f0 = 0, f1 = 0, f2 = 0, f3 = 0; +u16 pll_div_fb; +u32 div, ts_mclk; +unsigned int utmp; +int ret; + +/* select demod main mclk */ +ret = regmap_read(dev-regmap, 0x15, utmp); +if (ret) +goto err; +reg15 = utmp; +if (c-symbol_rate 4501) { +reg11 = 0x0E; +reg15 |= 0x02; +reg16 = 115; /* mclk = 110.25MHz */ +} else { +reg11 = 0x0A; +reg15 = ~0x02; +reg16 = 96; /* mclk = 96MHz */ +} + +/* set ts mclk */ +if (c-delivery_system == SYS_DVBS) +ts_mclk = 96000; +else +ts_mclk = 144000; + +pll_div_fb = (reg15 0x01) 8; +pll_div_fb += reg16; +pll_div_fb += 32; + +div = 36000 * pll_div_fb; +div /= ts_mclk; + +if (div = 32) { +N = 2; +f0 = 0; +f1 = div / 2; +f2 = div - f1; +f3 = 0; +} else if (div = 48) { +N = 3; +f0 = div / 3; +f1 = (div - f0) / 2; +f2 = div - f0 - f1; +f3 = 0; +} else if (div = 64) { +N = 4; +f0 = div / 4; +f1 = (div - f0) / 3; +f2 = (div - f0 - f1) / 2; +f3 = div - f0
Re: Re: [PATCH v3 2/3] DVBSky V3 PCIe card: add new dvb-s/s2 tunerforintegrated chip M88RS6000
Hello Mauro, On 2014-11-03 22:56:13, Mauro Carvalho Chehab wrote: Em Mon, 03 Nov 2014 22:51:31 +0800 Nibble Max nibble@gmail.com escreveu: Hello Mauro, On 2014-11-03 22:43:18, Mauro Carvalho Chehab wrote: Em Thu, 30 Oct 2014 16:01:51 +0800 Nibble Max nibble@gmail.com escreveu: v3: -config demod mclk in set_params call back. -remove set_config. Where's patch 1/3 v3? patch 1/3 is the smipcie bridge driver. https://patchwork.linuxtv.org/patch/26436/ It has no review feed back, so it has no v3 version. Ok, re-tagging it as new. Next time, it is better to submit the entire series again (you may add a note that the patch didn't change), as it makes easier to discover what's happening. understand. Thanks, Max Thanks, Mauro Regards, Mauro BR, Max v2: -make demod mclk selection logic simple. -merge demod mclk and ts mclk into one call back. -make code clean. M88RS6000 is the integrated chip, which includes tuner and demod. Here splite its tuner as a standalone driver. .set_config is used to config its demod clock, which sits inside tuner die. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/tuners/Kconfig | 8 + drivers/media/tuners/Makefile | 1 + drivers/media/tuners/m88rs6000t.c | 744 ++ drivers/media/tuners/m88rs6000t.h | 29 ++ 4 files changed, 782 insertions(+) diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig index f039dc2..42e5a01 100644 --- a/drivers/media/tuners/Kconfig +++ b/drivers/media/tuners/Kconfig @@ -232,6 +232,14 @@ config MEDIA_TUNER_M88TS2022 help Montage M88TS2022 silicon tuner driver. +config MEDIA_TUNER_M88RS6000T + tristate Montage M88RS6000 internal tuner + depends on MEDIA_SUPPORT I2C + select REGMAP_I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + Montage M88RS6000 internal tuner. + config MEDIA_TUNER_TUA9001 tristate Infineon TUA 9001 silicon tuner depends on MEDIA_SUPPORT I2C diff --git a/drivers/media/tuners/Makefile b/drivers/media/tuners/Makefile index 49fcf80..da4fe6e 100644 --- a/drivers/media/tuners/Makefile +++ b/drivers/media/tuners/Makefile @@ -41,6 +41,7 @@ obj-$(CONFIG_MEDIA_TUNER_IT913X) += it913x.o obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o +obj-$(CONFIG_MEDIA_TUNER_M88RS6000T) += m88rs6000t.o ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends diff --git a/drivers/media/tuners/m88rs6000t.c b/drivers/media/tuners/m88rs6000t.c new file mode 100644 index 000..d4c13fe --- /dev/null +++ b/drivers/media/tuners/m88rs6000t.c @@ -0,0 +1,744 @@ +/* + * Driver for the internal tuner of Montage M88RS6000 + * + * Copyright (C) 2014 Max nibble nibble@gmail.com + * + *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 m88rs6000t.h +#include linux/regmap.h + +struct m88rs6000t_dev { + struct m88rs6000t_config cfg; + struct i2c_client *client; + struct regmap *regmap; + u32 frequency_khz; +}; + +struct m88rs6000t_reg_val { + u8 reg; + u8 val; +}; + +/* set demod main mclk and ts mclk */ +static int m88rs6000t_set_demod_mclk(struct dvb_frontend *fe) +{ + struct m88rs6000t_dev *dev = fe-tuner_priv; + struct dtv_frontend_properties *c = fe-dtv_property_cache; + u8 reg11, reg15, reg16, reg1D, reg1E, reg1F; + u8 N, f0 = 0, f1 = 0, f2 = 0, f3 = 0; + u16 pll_div_fb; + u32 div, ts_mclk; + unsigned int utmp; + int ret; + + /* select demod main mclk */ + ret = regmap_read(dev-regmap, 0x15, utmp); + if (ret) + goto err; + reg15 = utmp; + if (c-symbol_rate 4501) { + reg11 = 0x0E; + reg15 |= 0x02; + reg16 = 115; /* mclk = 110.25MHz */ + } else { + reg11 = 0x0A; + reg15 = ~0x02; + reg16 = 96; /* mclk = 96MHz */ + } + + /* set ts mclk */ + if (c-delivery_system == SYS_DVBS) + ts_mclk = 96000; + else + ts_mclk = 144000; + + pll_div_fb = (reg15 0x01) 8; + pll_div_fb += reg16; + pll_div_fb += 32; + + div = 36000 * pll_div_fb; + div /= ts_mclk; + + if (div = 32) { + N = 2; + f0 = 0; + f1 = div / 2; + f2 = div - f1
[PATCH v3 3/3] DVBSky V3 PCIe card: add some changes to M88DS3103 for supporting the demod of M88RS6000
v3: -reconstruct the codes in set_frontend to keep the same logic for M88RS6000 and M88DS3103. -remove calling set_config of tuner to set demod mclk. -demod mclk will be set in set_params of tuner call back. v2: -make demod mclk selection logic simple. -merge demod mclk and ts mclk into one call back. M88RS6000 is the integrated chip, which includes tuner and demod. Its internal demod is similar with M88DS3103 except some registers definition. The main different part of this internal demod from others is its clock/pll generation IP block sitting inside the tuner die. So clock/pll functions should be configed through its tuner i2c bus, NOT its demod i2c bus. The demod of M88RS6000 need the firmware: dvb-demod-m88rs6000.fw firmware download link: http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/dvb-frontends/m88ds3103.c | 242 ++- drivers/media/dvb-frontends/m88ds3103_priv.h | 181 2 files changed, 345 insertions(+), 78 deletions(-) diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c index 81657e9..621d20f 100644 --- a/drivers/media/dvb-frontends/m88ds3103.c +++ b/drivers/media/dvb-frontends/m88ds3103.c @@ -1,5 +1,5 @@ /* - * Montage M88DS3103 demodulator driver + * Montage M88DS3103/M88RS6000 demodulator driver * * Copyright (C) 2013 Antti Palosaari cr...@iki.fi * @@ -162,7 +162,7 @@ static int m88ds3103_wr_reg_val_tab(struct m88ds3103_priv *priv, dev_dbg(priv-i2c-dev, %s: tab_len=%d\n, __func__, tab_len); - if (tab_len 83) { + if (tab_len 86) { ret = -EINVAL; goto err; } @@ -246,7 +246,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) int ret, len; const struct m88ds3103_reg_val *init; u8 u8tmp, u8tmp1, u8tmp2; - u8 buf[2]; + u8 buf[3]; u16 u16tmp, divide_ratio; u32 tuner_frequency, target_mclk; s32 s32tmp; @@ -262,6 +262,22 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) goto err; } + /* reset */ + ret = m88ds3103_wr_reg(priv, 0x07, 0x80); + if (ret) + goto err; + + ret = m88ds3103_wr_reg(priv, 0x07, 0x00); + if (ret) + goto err; + + /* Disable demod clock path */ + if (priv-chip_id == M88RS6000_CHIP_ID) { + ret = m88ds3103_wr_reg(priv, 0x06, 0xe0); + if (ret) + goto err; + } + /* program tuner */ if (fe-ops.tuner_ops.set_params) { ret = fe-ops.tuner_ops.set_params(fe); @@ -282,14 +298,76 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) tuner_frequency = c-frequency; } - /* reset */ - ret = m88ds3103_wr_reg(priv, 0x07, 0x80); - if (ret) - goto err; + /* select M88RS6000 demod main mclk and ts mclk from tuner die. */ + if (priv-chip_id == M88RS6000_CHIP_ID) { + if (c-symbol_rate 4501) + priv-mclk_khz = 110250; + else + priv-mclk_khz = 96000; - ret = m88ds3103_wr_reg(priv, 0x07, 0x00); - if (ret) - goto err; + if (c-delivery_system == SYS_DVBS) + target_mclk = 96000; + else + target_mclk = 144000; + + /* Enable demod clock path */ + ret = m88ds3103_wr_reg(priv, 0x06, 0x00); + if (ret) + goto err; + usleep_range(1, 2); + } else { + /* set M88DS3103 mclk and ts mclk. */ + priv-mclk_khz = 96000; + + if (c-delivery_system == SYS_DVBS) + target_mclk = 96000; + else { + switch (priv-cfg-ts_mode) { + case M88DS3103_TS_SERIAL: + case M88DS3103_TS_SERIAL_D7: + if (c-symbol_rate 1800) + target_mclk = 96000; + else + target_mclk = 144000; + break; + case M88DS3103_TS_PARALLEL: + case M88DS3103_TS_CI: + if (c-symbol_rate 1800) + target_mclk = 96000; + else if (c-symbol_rate 2800) + target_mclk = 144000; + else + target_mclk = 192000; + break; + default: + dev_dbg(priv-i2c-dev, %s: invalid ts_mode\n
[PATCH v3 2/3] DVBSky V3 PCIe card: add new dvb-s/s2 tuner for integrated chip M88RS6000
v3: -config demod mclk in set_params call back. -remove set_config. v2: -make demod mclk selection logic simple. -merge demod mclk and ts mclk into one call back. -make code clean. M88RS6000 is the integrated chip, which includes tuner and demod. Here splite its tuner as a standalone driver. .set_config is used to config its demod clock, which sits inside tuner die. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/tuners/Kconfig | 8 + drivers/media/tuners/Makefile | 1 + drivers/media/tuners/m88rs6000t.c | 744 ++ drivers/media/tuners/m88rs6000t.h | 29 ++ 4 files changed, 782 insertions(+) diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig index f039dc2..42e5a01 100644 --- a/drivers/media/tuners/Kconfig +++ b/drivers/media/tuners/Kconfig @@ -232,6 +232,14 @@ config MEDIA_TUNER_M88TS2022 help Montage M88TS2022 silicon tuner driver. +config MEDIA_TUNER_M88RS6000T + tristate Montage M88RS6000 internal tuner + depends on MEDIA_SUPPORT I2C + select REGMAP_I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + Montage M88RS6000 internal tuner. + config MEDIA_TUNER_TUA9001 tristate Infineon TUA 9001 silicon tuner depends on MEDIA_SUPPORT I2C diff --git a/drivers/media/tuners/Makefile b/drivers/media/tuners/Makefile index 49fcf80..da4fe6e 100644 --- a/drivers/media/tuners/Makefile +++ b/drivers/media/tuners/Makefile @@ -41,6 +41,7 @@ obj-$(CONFIG_MEDIA_TUNER_IT913X) += it913x.o obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o +obj-$(CONFIG_MEDIA_TUNER_M88RS6000T) += m88rs6000t.o ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends diff --git a/drivers/media/tuners/m88rs6000t.c b/drivers/media/tuners/m88rs6000t.c new file mode 100644 index 000..d4c13fe --- /dev/null +++ b/drivers/media/tuners/m88rs6000t.c @@ -0,0 +1,744 @@ +/* + * Driver for the internal tuner of Montage M88RS6000 + * + * Copyright (C) 2014 Max nibble nibble@gmail.com + * + *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 m88rs6000t.h +#include linux/regmap.h + +struct m88rs6000t_dev { + struct m88rs6000t_config cfg; + struct i2c_client *client; + struct regmap *regmap; + u32 frequency_khz; +}; + +struct m88rs6000t_reg_val { + u8 reg; + u8 val; +}; + +/* set demod main mclk and ts mclk */ +static int m88rs6000t_set_demod_mclk(struct dvb_frontend *fe) +{ + struct m88rs6000t_dev *dev = fe-tuner_priv; + struct dtv_frontend_properties *c = fe-dtv_property_cache; + u8 reg11, reg15, reg16, reg1D, reg1E, reg1F; + u8 N, f0 = 0, f1 = 0, f2 = 0, f3 = 0; + u16 pll_div_fb; + u32 div, ts_mclk; + unsigned int utmp; + int ret; + + /* select demod main mclk */ + ret = regmap_read(dev-regmap, 0x15, utmp); + if (ret) + goto err; + reg15 = utmp; + if (c-symbol_rate 4501) { + reg11 = 0x0E; + reg15 |= 0x02; + reg16 = 115; /* mclk = 110.25MHz */ + } else { + reg11 = 0x0A; + reg15 = ~0x02; + reg16 = 96; /* mclk = 96MHz */ + } + + /* set ts mclk */ + if (c-delivery_system == SYS_DVBS) + ts_mclk = 96000; + else + ts_mclk = 144000; + + pll_div_fb = (reg15 0x01) 8; + pll_div_fb += reg16; + pll_div_fb += 32; + + div = 36000 * pll_div_fb; + div /= ts_mclk; + + if (div = 32) { + N = 2; + f0 = 0; + f1 = div / 2; + f2 = div - f1; + f3 = 0; + } else if (div = 48) { + N = 3; + f0 = div / 3; + f1 = (div - f0) / 2; + f2 = div - f0 - f1; + f3 = 0; + } else if (div = 64) { + N = 4; + f0 = div / 4; + f1 = (div - f0) / 3; + f2 = (div - f0 - f1) / 2; + f3 = div - f0 - f1 - f2; + } else { + N = 4; + f0 = 16; + f1 = 16; + f2 = 16; + f3 = 16; + } + + if (f0 == 16) + f0 = 0; + if (f1 == 16) + f1 = 0; + if (f2 == 16
Re: Re: [PATCH v2 3/3] DVBSky V3 PCIe card: add some changes to M88DS3103forsupporting the demod of M88RS6000
Hello Antti, On 2014-10-31 01:36:14, Antti Palosaari wrote: On 10/30/2014 06:38 AM, Nibble Max wrote: - if (tab_len 83) { + if (tab_len 86) { That is not nice, but I could try find better solution and fix it later. What is the reason to check this parameter? How about remove this check? It is just to check you will not overwrite buffer accidentally. Buffer is 83 bytes long, which should be also increased... The correct solution is somehow calculate max possible tab size on compile time. It should be possible as init tabs are static const tables. Use some macro to calculate max value and use it - not plain numbers. Something like that #define BUF_SIZE MAX(m88ds3103_tab_dvbs, m88ds3103_tab_dvbs2, m88rs6000_tab_dvbs, m88rs6000_tab_dvbs2) Clock selection. What this does: * select mclk_khz * select target_mclk * calls set_config() in order to pass target_mclk to tuner driver * + some strange looking sleep, which is not likely needed The clock of M88RS6000's demod comes from tuner dies. So the first thing is turning on the demod main clock from tuner die after the demod reset. Without this clock, the following register's content will fail to update. Before changing the demod main clock, it should close clock path. After changing the demod main clock, it open clock path and wait the clock to stable. One thing what I don't like this is that you have implemented M88RS6000 things here and M88DS3103 elsewhere. Generally speaking, code must have some logic where same things are done in same place. So I expect to see both M88DS3103 and M88RS6000 target_mclk and mclk_khz selection implemented here or these moved to place where M88DS3103 implementation is. I will move M88DS3103 implementation to here. Also, even set_config() is somehow logically correctly used here, I prefer to duplicate that 4 line long target_mclk selection to tuner driver and get rid of whole set_config(). Even better solution could be to register M88RS6000 as a clock provider using clock framework, but imho it is not worth that simple case. Do you suggest to set demod main clock and ts clock in tuner's set_params call back? Yes, and you did it already on that latest patch, thanks. It is not logically correct, but a bit hackish solution, but I think it is best in that special case in order to keep things simple here. One thing with that new patch I would like to check is this 10us delay after clock path is enabled. You enable clock just before mcu is stopped and demod is configured during mcu is on freeze. 10us is almost nothing and it sounds like having no need in a situation you stop even mcu. It is about one I2C command which will took longer than 10us. Hard to see why you need wait 10us to settle clock in such case. What happens if you don't wait? I assume nothing, it works just as it should as stable clocks are needed a long after that, when mcu is take out of reset. usleep_range(1, 2); This delay time at least is 10ms, not 10us. regards Antti -- http://palosaari.fi/ BR, Max -- 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
Re: Re: [PATCH v2 3/3] DVBSky V3 PCIe card: add some changes to M88DS3103forsupportingthe demod of M88RS6000
Hello Antti, On 2014-10-31 11:13:59, Antti Palosaari wrote: On 10/31/2014 04:55 AM, Antti Palosaari wrote: On 10/31/2014 04:34 AM, Nibble Max wrote: Hello Antti, On 2014-10-31 01:36:14, Antti Palosaari wrote: On 10/30/2014 06:38 AM, Nibble Max wrote: -if (tab_len 83) { +if (tab_len 86) { That is not nice, but I could try find better solution and fix it later. What is the reason to check this parameter? How about remove this check? It is just to check you will not overwrite buffer accidentally. Buffer is 83 bytes long, which should be also increased... The correct solution is somehow calculate max possible tab size on compile time. It should be possible as init tabs are static const tables. Use some macro to calculate max value and use it - not plain numbers. Something like that #define BUF_SIZE MAX(m88ds3103_tab_dvbs, m88ds3103_tab_dvbs2, m88rs6000_tab_dvbs, m88rs6000_tab_dvbs2) Clock selection. What this does: * select mclk_khz * select target_mclk * calls set_config() in order to pass target_mclk to tuner driver * + some strange looking sleep, which is not likely needed The clock of M88RS6000's demod comes from tuner dies. So the first thing is turning on the demod main clock from tuner die after the demod reset. Without this clock, the following register's content will fail to update. Before changing the demod main clock, it should close clock path. After changing the demod main clock, it open clock path and wait the clock to stable. One thing what I don't like this is that you have implemented M88RS6000 things here and M88DS3103 elsewhere. Generally speaking, code must have some logic where same things are done in same place. So I expect to see both M88DS3103 and M88RS6000 target_mclk and mclk_khz selection implemented here or these moved to place where M88DS3103 implementation is. I will move M88DS3103 implementation to here. Also, even set_config() is somehow logically correctly used here, I prefer to duplicate that 4 line long target_mclk selection to tuner driver and get rid of whole set_config(). Even better solution could be to register M88RS6000 as a clock provider using clock framework, but imho it is not worth that simple case. Do you suggest to set demod main clock and ts clock in tuner's set_params call back? Yes, and you did it already on that latest patch, thanks. It is not logically correct, but a bit hackish solution, but I think it is best in that special case in order to keep things simple here. One thing with that new patch I would like to check is this 10us delay after clock path is enabled. You enable clock just before mcu is stopped and demod is configured during mcu is on freeze. 10us is almost nothing and it sounds like having no need in a situation you stop even mcu. It is about one I2C command which will took longer than 10us. Hard to see why you need wait 10us to settle clock in such case. What happens if you don't wait? I assume nothing, it works just as it should as stable clocks are needed a long after that, when mcu is take out of reset. usleep_range(1, 2); This delay time at least is 10ms, not 10us. ah, yes, you were correct. 10ms is indeed a much larger, it is about century on a digital logic signal path where frequency is around 100MHz. 100MHz clock means clock cycle is 10ns, 10ms is 1000ns = 1,000,000 - one million clock cycles. Whilst I don't know how chip designed in a logic level, I have still done some digital logic designing myself and this sounds long. If you don't enable clock path, what is next command which will fail? Probably it will not even fail, but never lock to signal as demod core is not clocked at all. But if you want keep that delay then keep it. For my eyes it sounds weird to wait that long after clock path is enabled. I have feeling it is clock which is needed much later, but I may be wrong and I cannot even make any tests without hardware. It is also possible that master clock is needed in order to perform all the next commands. If don't enable clock path, the next I2C commands looks ok, no error message. But the demod can not lock to the signal any more. I am not the chip designer so I do not know the exact detail information of this internal logic. regards Antti -- http://palosaari.fi/ BR, Max -- 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
Re: Re: [PATCH v2 3/3] DVBSky V3 PCIe card: add some changes to M88DS3103for supporting the demod of M88RS6000
Hello, Thanks for review. On 2014-10-30 11:26:12, Antti Palosaari wrote: Moikka! This is full review for that driver. Quite a many small changes requested which are easy to fix. One bigger thing I still want do differently is that target_mclk from tuner. I think you could duplicate TS MCLK calculation in a tuner driver as it is only 4 lines - select mclk per delivery system. regards Antti On 10/27/2014 09:29 AM, Nibble Max wrote: v2: -make demod mclk selection logic simple. -merge demod mclk and ts mclk into one call back. M88RS6000 is the integrated chip, which includes tuner and demod. Its internal demod is similar with M88DS3103 except some registers definition. The main different part of this internal demod from others is its clock/pll generation IP block sitting inside the tuner die. So clock/pll functions should be configed through its tuner i2c bus, NOT its demod i2c bus. The demod of M88RS6000 need the firmware: dvb-demod-m88rs6000.fw firmware download link: http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/dvb-frontends/m88ds3103.c | 229 +++ drivers/media/dvb-frontends/m88ds3103_priv.h | 181 + 2 files changed, 340 insertions(+), 70 deletions(-) diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c index 81657e9..a4cfef4 100644 --- a/drivers/media/dvb-frontends/m88ds3103.c +++ b/drivers/media/dvb-frontends/m88ds3103.c @@ -1,5 +1,5 @@ /* - * Montage M88DS3103 demodulator driver + * Montage M88DS3103/M88RS6000 demodulator driver * * Copyright (C) 2013 Antti Palosaari cr...@iki.fi * @@ -162,7 +162,7 @@ static int m88ds3103_wr_reg_val_tab(struct m88ds3103_priv *priv, dev_dbg(priv-i2c-dev, %s: tab_len=%d\n, __func__, tab_len); -if (tab_len 83) { +if (tab_len 86) { That is not nice, but I could try find better solution and fix it later. What is the reason to check this parameter? How about remove this check? ret = -EINVAL; goto err; } @@ -291,6 +291,30 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) if (ret) goto err; +/* select M88RS6000 demod main mclk and ts mclk from tuner die. */ +if (priv-chip_id == M88RS6000_CHIP_ID) { +if (c-symbol_rate 4501) +priv-mclk_khz = 110250; +else +priv-mclk_khz = 96000; +if (c-delivery_system == SYS_DVBS) +target_mclk = 96000; +else +target_mclk = 144000; +ret = m88ds3103_wr_reg(priv, 0x06, 0xe0); +if (ret) +goto err; +if (fe-ops.tuner_ops.set_config) { +ret = fe-ops.tuner_ops.set_config(fe, target_mclk); +if (ret) +goto err; +} +ret = m88ds3103_wr_reg(priv, 0x06, 0x00); +if (ret) +goto err; +usleep_range(1, 2); +} + Clock selection. What this does: * select mclk_khz * select target_mclk * calls set_config() in order to pass target_mclk to tuner driver * + some strange looking sleep, which is not likely needed The clock of M88RS6000's demod comes from tuner dies. So the first thing is turning on the demod main clock from tuner die after the demod reset. Without this clock, the following register's content will fail to update. Before changing the demod main clock, it should close clock path. After changing the demod main clock, it open clock path and wait the clock to stable. One thing what I don't like this is that you have implemented M88RS6000 things here and M88DS3103 elsewhere. Generally speaking, code must have some logic where same things are done in same place. So I expect to see both M88DS3103 and M88RS6000 target_mclk and mclk_khz selection implemented here or these moved to place where M88DS3103 implementation is. I will move M88DS3103 implementation to here. Also, even set_config() is somehow logically correctly used here, I prefer to duplicate that 4 line long target_mclk selection to tuner driver and get rid of whole set_config(). Even better solution could be to register M88RS6000 as a clock provider using clock framework, but imho it is not worth that simple case. Do you suggest to set demod main clock and ts clock in tuner's set_params call back? ret = m88ds3103_wr_reg(priv, 0xb2, 0x01); if (ret) goto err; @@ -301,36 +325,46 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) switch (c-delivery_system) { case SYS_DVBS: -len = ARRAY_SIZE(m88ds3103_dvbs_init_reg_vals); -init = m88ds3103_dvbs_init_reg_vals; -target_mclk = 96000; +if (priv-chip_id
[PATCH v2 3/3] DVBSky V3 PCIe card: add some changes to M88DS3103 for supporting the demod of M88RS6000
v2: -make demod mclk selection logic simple. -merge demod mclk and ts mclk into one call back. M88RS6000 is the integrated chip, which includes tuner and demod. Its internal demod is similar with M88DS3103 except some registers definition. The main different part of this internal demod from others is its clock/pll generation IP block sitting inside the tuner die. So clock/pll functions should be configed through its tuner i2c bus, NOT its demod i2c bus. The demod of M88RS6000 need the firmware: dvb-demod-m88rs6000.fw firmware download link: http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/dvb-frontends/m88ds3103.c | 229 +++ drivers/media/dvb-frontends/m88ds3103_priv.h | 181 + 2 files changed, 340 insertions(+), 70 deletions(-) diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c index 81657e9..a4cfef4 100644 --- a/drivers/media/dvb-frontends/m88ds3103.c +++ b/drivers/media/dvb-frontends/m88ds3103.c @@ -1,5 +1,5 @@ /* - * Montage M88DS3103 demodulator driver + * Montage M88DS3103/M88RS6000 demodulator driver * * Copyright (C) 2013 Antti Palosaari cr...@iki.fi * @@ -162,7 +162,7 @@ static int m88ds3103_wr_reg_val_tab(struct m88ds3103_priv *priv, dev_dbg(priv-i2c-dev, %s: tab_len=%d\n, __func__, tab_len); - if (tab_len 83) { + if (tab_len 86) { ret = -EINVAL; goto err; } @@ -291,6 +291,30 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) if (ret) goto err; + /* select M88RS6000 demod main mclk and ts mclk from tuner die. */ + if (priv-chip_id == M88RS6000_CHIP_ID) { + if (c-symbol_rate 4501) + priv-mclk_khz = 110250; + else + priv-mclk_khz = 96000; + if (c-delivery_system == SYS_DVBS) + target_mclk = 96000; + else + target_mclk = 144000; + ret = m88ds3103_wr_reg(priv, 0x06, 0xe0); + if (ret) + goto err; + if (fe-ops.tuner_ops.set_config) { + ret = fe-ops.tuner_ops.set_config(fe, target_mclk); + if (ret) + goto err; + } + ret = m88ds3103_wr_reg(priv, 0x06, 0x00); + if (ret) + goto err; + usleep_range(1, 2); + } + ret = m88ds3103_wr_reg(priv, 0xb2, 0x01); if (ret) goto err; @@ -301,36 +325,46 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) switch (c-delivery_system) { case SYS_DVBS: - len = ARRAY_SIZE(m88ds3103_dvbs_init_reg_vals); - init = m88ds3103_dvbs_init_reg_vals; - target_mclk = 96000; + if (priv-chip_id == M88RS6000_CHIP_ID) { + len = ARRAY_SIZE(m88rs6000_dvbs_init_reg_vals); + init = m88rs6000_dvbs_init_reg_vals; + } else { + len = ARRAY_SIZE(m88ds3103_dvbs_init_reg_vals); + init = m88ds3103_dvbs_init_reg_vals; + target_mclk = 96000; + } break; case SYS_DVBS2: - len = ARRAY_SIZE(m88ds3103_dvbs2_init_reg_vals); - init = m88ds3103_dvbs2_init_reg_vals; - - switch (priv-cfg-ts_mode) { - case M88DS3103_TS_SERIAL: - case M88DS3103_TS_SERIAL_D7: - if (c-symbol_rate 1800) - target_mclk = 96000; - else - target_mclk = 144000; - break; - case M88DS3103_TS_PARALLEL: - case M88DS3103_TS_CI: - if (c-symbol_rate 1800) - target_mclk = 96000; - else if (c-symbol_rate 2800) - target_mclk = 144000; - else - target_mclk = 192000; - break; - default: - dev_dbg(priv-i2c-dev, %s: invalid ts_mode\n, - __func__); - ret = -EINVAL; - goto err; + if (priv-chip_id == M88RS6000_CHIP_ID) { + len = ARRAY_SIZE(m88rs6000_dvbs2_init_reg_vals); + init = m88rs6000_dvbs2_init_reg_vals; + } else { + len = ARRAY_SIZE(m88ds3103_dvbs2_init_reg_vals); + init = m88ds3103_dvbs2_init_reg_vals; + + switch (priv-cfg-ts_mode
[PATCH v2 2/3] DVBSky V3 PCIe card: add new dvb-s/s2 tuner for integrated chip M88RS6000
v2: -make demod mclk selection logic simple. -merge demod mclk and ts mclk into one call back. -make code clean. M88RS6000 is the integrated chip, which includes tuner and demod. Here splite its tuner as a standalone driver. .set_config is used to config its demod clock, which sits inside tuner die. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/tuners/Kconfig | 8 + drivers/media/tuners/Makefile | 1 + drivers/media/tuners/m88rs6000t.c | 742 ++ drivers/media/tuners/m88rs6000t.h | 29 ++ 4 files changed, 780 insertions(+) diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig index f039dc2..42e5a01 100644 --- a/drivers/media/tuners/Kconfig +++ b/drivers/media/tuners/Kconfig @@ -232,6 +232,14 @@ config MEDIA_TUNER_M88TS2022 help Montage M88TS2022 silicon tuner driver. +config MEDIA_TUNER_M88RS6000T + tristate Montage M88RS6000 internal tuner + depends on MEDIA_SUPPORT I2C + select REGMAP_I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + Montage M88RS6000 internal tuner. + config MEDIA_TUNER_TUA9001 tristate Infineon TUA 9001 silicon tuner depends on MEDIA_SUPPORT I2C diff --git a/drivers/media/tuners/Makefile b/drivers/media/tuners/Makefile index 49fcf80..da4fe6e 100644 --- a/drivers/media/tuners/Makefile +++ b/drivers/media/tuners/Makefile @@ -41,6 +41,7 @@ obj-$(CONFIG_MEDIA_TUNER_IT913X) += it913x.o obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o +obj-$(CONFIG_MEDIA_TUNER_M88RS6000T) += m88rs6000t.o ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends diff --git a/drivers/media/tuners/m88rs6000t.c b/drivers/media/tuners/m88rs6000t.c new file mode 100644 index 000..2066e88 --- /dev/null +++ b/drivers/media/tuners/m88rs6000t.c @@ -0,0 +1,742 @@ +/* + * Driver for the internal tuner of Montage M88RS6000 + * + * Copyright (C) 2014 Max nibble nibble@gmail.com + * + *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 m88rs6000t.h +#include linux/regmap.h + +struct m88rs6000t_dev { + struct m88rs6000t_config cfg; + struct i2c_client *client; + struct regmap *regmap; + u32 frequency_khz; +}; + +struct m88rs6000t_reg_val { + u8 reg; + u8 val; +}; + +/* set demod main mclk and ts mclk */ +static int m88rs6000t_set_config(struct dvb_frontend *fe, void *priv_cfg) +{ + struct m88rs6000t_dev *dev = fe-tuner_priv; + struct dtv_frontend_properties *c = fe-dtv_property_cache; + u32 *ts_mclk_cfg = (u32 *) priv_cfg; /* KHz */ + u8 reg11, reg15, reg16, reg1D, reg1E, reg1F; + u8 N, f0 = 0, f1 = 0, f2 = 0, f3 = 0; + u16 pll_div_fb; + u32 div; + unsigned int utmp; + int ret; + + /* select demod main mclk */ + ret = regmap_read(dev-regmap, 0x15, utmp); + if (ret) + goto err; + reg15 = utmp; + if (c-symbol_rate 4501) { + reg11 = 0x0E; + reg15 |= 0x02; + reg16 = 115; /* mclk = 110.25MHz */ + } else { + reg11 = 0x0A; + reg15 = ~0x02; + reg16 = 96; /* mclk = 96MHz */ + } + + /* set ts mclk */ + pll_div_fb = (reg15 0x01) 8; + pll_div_fb += reg16; + pll_div_fb += 32; + + div = 36000 * pll_div_fb; + div /= *ts_mclk_cfg; + + if (div = 32) { + N = 2; + f0 = 0; + f1 = div / 2; + f2 = div - f1; + f3 = 0; + } else if (div = 48) { + N = 3; + f0 = div / 3; + f1 = (div - f0) / 2; + f2 = div - f0 - f1; + f3 = 0; + } else if (div = 64) { + N = 4; + f0 = div / 4; + f1 = (div - f0) / 3; + f2 = (div - f0 - f1) / 2; + f3 = div - f0 - f1 - f2; + } else { + N = 4; + f0 = 16; + f1 = 16; + f2 = 16; + f3 = 16; + } + + if (f0 == 16) + f0 = 0; + if (f1 == 16) + f1 = 0; + if (f2 == 16) + f2 = 0; + if (f3 == 16) + f3 = 0; + + ret = regmap_read(dev-regmap, 0x1D, utmp); + if (ret
[PATCH 1/2] cx23885: add DVBSky S950C dvb-s/s2 ci PCIe card support(no RC)
DVBSky s950ci dvb-s/s2 ci PCIe card: 1dvb frontend: M88TS2022(tuner),M88DS3103(demod) 2ci controller: CIMAX SP2 or its clone. 3PCIe bridge: CX23885 The patchs are based on the following patchs. Olli Salonen submit: https://patchwork.linuxtv.org/patch/26180/ https://patchwork.linuxtv.org/patch/26183/ https://patchwork.linuxtv.org/patch/26324/ Nibble Max submit: https://patchwork.linuxtv.org/patch/26207/ Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/cx23885/cx23885-cards.c | 11 + drivers/media/pci/cx23885/cx23885-dvb.c | 79 ++- drivers/media/pci/cx23885/cx23885.h | 1 + 3 files changed, 80 insertions(+), 11 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index c4a69e4..ac34c27 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -684,6 +684,10 @@ struct cx23885_board cx23885_boards[] = { .name = DVBSky T980C, .portb = CX23885_MPEG_DVB, }, + [CX23885_BOARD_DVBSKY_S950C] = { + .name = DVBSky S950C, + .portb = CX23885_MPEG_DVB, + }, }; const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); @@ -947,6 +951,10 @@ struct cx23885_subid cx23885_subids[] = { .subvendor = 0x4254, .subdevice = 0x980c, .card = CX23885_BOARD_DVBSKY_T980C, + }, { + .subvendor = 0x4254, + .subdevice = 0x950c, + .card = CX23885_BOARD_DVBSKY_S950C, }, }; const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); @@ -1550,6 +1558,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) cx23885_gpio_set(dev, GPIO_2 | GPIO_11); break; case CX23885_BOARD_DVBSKY_T980C: + case CX23885_BOARD_DVBSKY_S950C: /* * GPIO-0 INTA from CiMax, input * GPIO-1 reset CiMax, output, high active @@ -1859,6 +1868,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_DVBWORLD_2005: case CX23885_BOARD_PROF_8000: case CX23885_BOARD_DVBSKY_T980C: + case CX23885_BOARD_DVBSKY_S950C: ts1-gen_ctrl_val = 0x5; /* Parallel */ ts1-ts_clk_en_val = 0x1; /* Enable TS_CLK */ ts1-src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; @@ -1978,6 +1988,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_TBS_6981: case CX23885_BOARD_DVBSKY_T9580: case CX23885_BOARD_DVBSKY_T980C: + case CX23885_BOARD_DVBSKY_S950C: dev-sd_cx25840 = v4l2_i2c_new_subdev(dev-v4l2_dev, dev-i2c_bus[2].i2c_adap, cx25840, 0x88 1, NULL); diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index efa05ee..f86b7c79 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -635,7 +635,7 @@ static int cx23885_sp2_ci_ctrl(void *priv, u8 read, int addr, struct cx23885_tsport *port = priv; struct cx23885_dev *dev = port-dev; int ret; - int tmp; + int tmp = 0; unsigned long timeout; mutex_lock(dev-gpio_lock); @@ -865,6 +865,19 @@ static const struct m88ds3103_config dvbsky_t9580_m88ds3103_config = { .agc = 0x99, }; +static const struct m88ds3103_config dvbsky_s950c_m88ds3103_config = { + .i2c_addr = 0x68, + .clock = 2700, + .i2c_wr_max = 33, + .clock_out = 0, + .ts_mode = M88DS3103_TS_CI, + .ts_clk = 1, + .ts_clk_pol = 1, + .lnb_en_pol = 1, + .lnb_hv_pol = 0, + .agc = 0x99, +}; + static int netup_altera_fpga_rw(void *device, int flag, int data, int read) { struct cx23885_dev *dev = (struct cx23885_dev *)device; @@ -1020,7 +1033,7 @@ static int dvb_register(struct cx23885_tsport *port) struct m88ts2022_config m88ts2022_config; struct i2c_board_info info; struct i2c_adapter *adapter; - struct i2c_client *client_demod, *client_tuner, *client_ci; + struct i2c_client *client_demod = NULL, *client_tuner = NULL, *client_ci = NULL; int mfe_shared = 0; /* bus not shared by default */ int ret; @@ -1796,6 +1809,41 @@ static int dvb_register(struct cx23885_tsport *port) } port-i2c_client_tuner = client_tuner; break; + case CX23885_BOARD_DVBSKY_S950C: + i2c_bus = dev-i2c_bus[1]; + i2c_bus2 = dev-i2c_bus[0]; + + /* attach frontend */ + fe0-dvb.frontend = dvb_attach(m88ds3103_attach, + dvbsky_s950c_m88ds3103_config, + i2c_bus-i2c_adap
[PATCH 2/2] cx23885: add DVBSky S950C and T980C RC support
DVBSky s950ci dvb-s/s2 ci PCIe card: 1dvb frontend: M88TS2022(tuner),M88DS3103(demod) 2ci controller: CIMAX SP2 or its clone. 3PCIe bridge: CX23885 The patchs are based on the following patchs. Olli Salonen submit: https://patchwork.linuxtv.org/patch/26180/ https://patchwork.linuxtv.org/patch/26183/ https://patchwork.linuxtv.org/patch/26324/ Nibble Max submit: https://patchwork.linuxtv.org/patch/26207/ Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/cx23885/cx23885-cards.c | 6 ++ drivers/media/pci/cx23885/cx23885-input.c | 6 ++ 2 files changed, 12 insertions(+) diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index ac34c27..d9ba48c 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -1669,6 +1669,8 @@ int cx23885_ir_init(struct cx23885_dev *dev) case CX23885_BOARD_TBS_6980: case CX23885_BOARD_TBS_6981: case CX23885_BOARD_DVBSKY_T9580: + case CX23885_BOARD_DVBSKY_T980C: + case CX23885_BOARD_DVBSKY_S950C: if (!enable_885_ir) break; dev-sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); @@ -1716,6 +1718,8 @@ void cx23885_ir_fini(struct cx23885_dev *dev) case CX23885_BOARD_TBS_6980: case CX23885_BOARD_TBS_6981: case CX23885_BOARD_DVBSKY_T9580: + case CX23885_BOARD_DVBSKY_T980C: + case CX23885_BOARD_DVBSKY_S950C: cx23885_irq_remove(dev, PCI_MSK_AV_CORE); /* sd_ir is a duplicate pointer to the AV Core, just clear it */ dev-sd_ir = NULL; @@ -1764,6 +1768,8 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) case CX23885_BOARD_TBS_6980: case CX23885_BOARD_TBS_6981: case CX23885_BOARD_DVBSKY_T9580: + case CX23885_BOARD_DVBSKY_T980C: + case CX23885_BOARD_DVBSKY_S950C: if (dev-sd_ir) cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE); break; diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c index f81c2f9..0bf6839 100644 --- a/drivers/media/pci/cx23885/cx23885-input.c +++ b/drivers/media/pci/cx23885/cx23885-input.c @@ -88,6 +88,8 @@ void cx23885_input_rx_work_handler(struct cx23885_dev *dev, u32 events) case CX23885_BOARD_TBS_6980: case CX23885_BOARD_TBS_6981: case CX23885_BOARD_DVBSKY_T9580: + case CX23885_BOARD_DVBSKY_T980C: + case CX23885_BOARD_DVBSKY_S950C: /* * The only boards we handle right now. However other boards * using the CX2388x integrated IR controller should be similar @@ -141,6 +143,8 @@ static int cx23885_input_ir_start(struct cx23885_dev *dev) case CX23885_BOARD_HAUPPAUGE_HVR1250: case CX23885_BOARD_MYGICA_X8507: case CX23885_BOARD_DVBSKY_T9580: + case CX23885_BOARD_DVBSKY_T980C: + case CX23885_BOARD_DVBSKY_S950C: /* * The IR controller on this board only returns pulse widths. * Any other mode setting will fail to set up the device. @@ -308,6 +312,8 @@ int cx23885_input_init(struct cx23885_dev *dev) rc_map = RC_MAP_TBS_NEC; break; case CX23885_BOARD_DVBSKY_T9580: + case CX23885_BOARD_DVBSKY_T980C: + case CX23885_BOARD_DVBSKY_S950C: /* Integrated CX23885 IR controller */ driver_type = RC_DRIVER_IR_RAW; allowed_protos = RC_BIT_ALL; -- 1.9.1 -- 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 1/1] m88ts2022: return the err code in its probe function when error occurs.
if chip_id is wrong or dev-cfg.clock_out is invalid, the i2c model is still loaded. It will cause kernel NULL pointer dereference oops when the i2c model remove. returning the err code will prevent the i2c model load. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/tuners/m88ts2022.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/tuners/m88ts2022.c b/drivers/media/tuners/m88ts2022.c index caa5423..066e543 100644 --- a/drivers/media/tuners/m88ts2022.c +++ b/drivers/media/tuners/m88ts2022.c @@ -488,6 +488,7 @@ static int m88ts2022_probe(struct i2c_client *client, case 0x83: break; default: + ret = -ENODEV; goto err; } @@ -505,6 +506,7 @@ static int m88ts2022_probe(struct i2c_client *client, u8tmp = 0x6c; break; default: + ret = -EINVAL; goto err; } -- 1.9.1 -- 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
Re: Re: [PATCH 3/3] DVBSky V3 PCIe card: add some changes to M88DS3103for supporting the demod of M88RS6000
On 2014-10-22 05:24:02, Antti Palosaari wrote: On 10/13/2014 09:44 AM, Nibble Max wrote: M88RS6000 is the integrated chip, which includes tuner and demod. Its internal demod is similar with M88DS3103 except some registers definition. The main different part of this internal demod from others is its clock/pll generation IP block sitting inside the tuner die. So clock/pll functions should be configed through its tuner i2c bus, NOT its demod i2c bus. The demod of M88RS6000 need the firmware: dvb-demod-m88rs6000.fw firmware download link: http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz @@ -250,6 +251,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) u16 u16tmp, divide_ratio; u32 tuner_frequency, target_mclk; s32 s32tmp; +struct m88rs6000_mclk_config mclk_cfg; dev_dbg(priv-i2c-dev, %s: delivery_system=%d modulation=%d frequency=%d symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n, @@ -291,6 +293,26 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) if (ret) goto err; +if (priv-chip_id == M88RS6000_CHIP_ID) { +ret = m88ds3103_wr_reg(priv, 0x06, 0xe0); +if (ret) +goto err; +if (fe-ops.tuner_ops.set_config) { +/* select main mclk */ +mclk_cfg.config_op = 0; +mclk_cfg.TunerfreqMHz = c-frequency / 1000; +mclk_cfg.SymRateKSs = c-symbol_rate / 1000; +ret = fe-ops.tuner_ops.set_config(fe, mclk_cfg); +if (ret) +goto err; +priv-mclk_khz = mclk_cfg.MclkKHz; +} +ret = m88ds3103_wr_reg(priv, 0x06, 0x00); +if (ret) +goto err; +usleep_range(1, 2); +} That looks odd and also ugly. You pass some values from demod to tuner using set_config callback. Tuner driver can get symbol_rate and frequency just similarly from property cache than demod. Why you do it like that? Clock is provided by tuner as you mention. I see you use that to pass used clock frequency from tuner to demod. This does not look nice and I would like to see clock framework instead. Or calculate clock on both drivers. Does the demod clock even needs to be changed? I think it is only TS stream size which defines used clock frequency - smaller the TS bitstream, the smaller the clock frequency needed = optimizes power consumption a little. But TS clock is calculated on tuner driver in any case? Yes, M88RS6000 looks odd. This integrated chip has two part die, tuner die and demod die. Its demod's clock(PLL) block is sitting insided the tuner die. The demod has no PLL ip block that makes demod die smaller. The demod's clock can be adjusted according to the transponder's frequency and symbol rate. So that the demod's clock and its harmonic frequency will not overlap with the transponder's frequency range. It will improve its tuner's sensitivity. However the tuner driver can get the values from property cache. Tuner driver does not know when need adjust this demod pll and return the current demod pll value to the demod driver. in struct dvb_tuner_ops, there is no call back to do this directly. So I select the general set_config call back. TS main clock of demdod also need to be controlled in the tuner die. These demod's PLL registers have no relationship with tuner at all. Logically, These demod's PLL registers should go with demod die as usual. But in this case they goes with the tuner die physically and controlled through tuner i2c bus. The current dvb-frontend driver requires the tuner and demod to split into the seperate drivers. The demod driver will not access tuner i2c bus directly. But this integrate chip has more tighter relationship of its tuner and demod die. That is reason why these odd call backs happen. BR, Max regards Antti -- http://palosaari.fi/ -- 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
Re: Re: [PATCH 3/3] DVBSky V3 PCIe card: add some changes to M88DS3103for supporting the demod of M88RS6000
On 10/13/2014 09:44 AM, Nibble Max wrote: M88RS6000 is the integrated chip, which includes tuner and demod. Its internal demod is similar with M88DS3103 except some registers definition. The main different part of this internal demod from others is its clock/pll generation IP block sitting inside the tuner die. So clock/pll functions should be configed through its tuner i2c bus, NOT its demod i2c bus. The demod of M88RS6000 need the firmware: dvb-demod-m88rs6000.fw firmware download link: http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz @@ -250,6 +251,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) u16 u16tmp, divide_ratio; u32 tuner_frequency, target_mclk; s32 s32tmp; +struct m88rs6000_mclk_config mclk_cfg; dev_dbg(priv-i2c-dev, %s: delivery_system=%d modulation=%d frequency=%d symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n, @@ -291,6 +293,26 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) if (ret) goto err; +if (priv-chip_id == M88RS6000_CHIP_ID) { +ret = m88ds3103_wr_reg(priv, 0x06, 0xe0); +if (ret) +goto err; +if (fe-ops.tuner_ops.set_config) { +/* select main mclk */ +mclk_cfg.config_op = 0; +mclk_cfg.TunerfreqMHz = c-frequency / 1000; +mclk_cfg.SymRateKSs = c-symbol_rate / 1000; +ret = fe-ops.tuner_ops.set_config(fe, mclk_cfg); +if (ret) +goto err; +priv-mclk_khz = mclk_cfg.MclkKHz; +} +ret = m88ds3103_wr_reg(priv, 0x06, 0x00); +if (ret) +goto err; +usleep_range(1, 2); +} That looks odd and also ugly. You pass some values from demod to tuner using set_config callback. Tuner driver can get symbol_rate and frequency just similarly from property cache than demod. Why you do it like that? Clock is provided by tuner as you mention. I see you use that to pass used clock frequency from tuner to demod. This does not look nice and I would like to see clock framework instead. Or calculate clock on both drivers. Does the demod clock even needs to be changed? I think it is only TS stream size which defines used clock frequency - smaller the TS bitstream, the smaller the clock frequency needed = optimizes power consumption a little. But TS clock is calculated on tuner driver in any case? Yes, M88RS6000 looks odd. This integrated chip has two part die, tuner die and demod die. Its demod's clock(PLL) block is sitting insided the tuner die. The demod has no PLL ip block that makes demod die smaller. The demod's clock can be adjusted according to the transponder's frequency and symbol rate. So that the demod's clock and its harmonic frequency will not overlap with the transponder's frequency range. It will improve its tuner's sensitivity. However the tuner driver can get the values from property cache. Tuner driver does not know when need adjust this demod pll and return the current demod pll value to the demod driver. in struct dvb_tuner_ops, there is no call back to do this directly. So I select the general set_config call back. TS main clock of demdod also need to be controlled in the tuner die. These demod's PLL registers have no relationship with tuner at all. Logically, These demod's PLL registers should go with demod die as usual. But in this case they goes with the tuner die physically and controlled through tuner i2c bus. The current dvb-frontend driver requires the tuner and demod to split into the seperate drivers. The demod driver will not access tuner i2c bus directly. But this integrate chip has more tighter relationship of its tuner and demod die. That is reason why these odd call backs happen. regards Antti -- http://palosaari.fi/ -- 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 1/1] dvb-usb-dvbsky: add s960ci dvb-s/s2 usb ci box support
DVBSky s960ci dvb-s/s2 usb ci box: 1dvb frontend: M88TS2022(tuner),M88DS3103(demod) 2usb controller: CY7C86013A 3ci controller: CIMAX SP2 or its clone. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/usb/dvb-usb-v2/Kconfig | 1 + drivers/media/usb/dvb-usb-v2/dvbsky.c | 188 ++ 2 files changed, 189 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig index 5b34323..7423033 100644 --- a/drivers/media/usb/dvb-usb-v2/Kconfig +++ b/drivers/media/usb/dvb-usb-v2/Kconfig @@ -146,5 +146,6 @@ config DVB_USB_DVBSKY depends on DVB_USB_V2 select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT + select DVB_SP2 if MEDIA_SUBDRV_AUTOSELECT help Say Y here to support the USB receivers from DVBSky. diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c index 34688c8..e3439f6 100644 --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -21,6 +21,7 @@ #include dvb_usb.h #include m88ds3103.h #include m88ts2022.h +#include sp2.h #define DVBSKY_MSG_DELAY 0/*2000*/ #define DVBSKY_BUF_LEN 64 @@ -33,6 +34,7 @@ struct dvbsky_state { u8 obuf[DVBSKY_BUF_LEN]; u8 last_lock; struct i2c_client *i2c_client_tuner; + struct i2c_client *i2c_client_ci; /* fe hook functions*/ int (*fe_set_voltage)(struct dvb_frontend *fe, @@ -362,6 +364,157 @@ fail_attach: return ret; } +static int dvbsky_usb_ci_set_voltage(struct dvb_frontend *fe, + fe_sec_voltage_t voltage) +{ + struct dvb_usb_device *d = fe_to_d(fe); + struct dvbsky_state *state = d_to_priv(d); + u8 value; + + if (voltage == SEC_VOLTAGE_OFF) + value = 0; + else + value = 1; + dvbsky_gpio_ctrl(d, 0x00, value); + + return state-fe_set_voltage(fe, voltage); +} + +static int dvbsky_ci_ctrl(void *priv, u8 read, int addr, + u8 data, int *mem) +{ + struct dvb_usb_device *d = priv; + int ret = 0; + u8 command[4], respond[2], command_size, respond_size; + + command[1] = (u8)((addr 8) 0xff); /*high part of address*/ + command[2] = (u8)(addr 0xff); /*low part of address*/ + if (read) { + command[0] = 0x71; + command_size = 3; + respond_size = 2; + } else { + command[0] = 0x70; + command[3] = data; + command_size = 4; + respond_size = 1; + } + ret = dvbsky_usb_generic_rw(d, command, command_size, + respond, respond_size); + if (ret) + goto err; + if (read) + *mem = respond[1]; + return ret; +err: + dev_err(d-udev-dev, ci control failed=%d\n, ret); + return ret; +} + +static const struct m88ds3103_config dvbsky_s960c_m88ds3103_config = { + .i2c_addr = 0x68, + .clock = 2700, + .i2c_wr_max = 33, + .clock_out = 0, + .ts_mode = M88DS3103_TS_CI, + .ts_clk = 1, + .ts_clk_pol = 1, + .agc = 0x99, + .lnb_hv_pol = 0, + .lnb_en_pol = 1, +}; + +static int dvbsky_s960c_attach(struct dvb_usb_adapter *adap) +{ + struct dvbsky_state *state = adap_to_priv(adap); + struct dvb_usb_device *d = adap_to_d(adap); + int ret = 0; + /* demod I2C adapter */ + struct i2c_adapter *i2c_adapter; + struct i2c_client *client_tuner, *client_ci; + struct i2c_board_info info; + struct sp2_config sp2_config; + struct m88ts2022_config m88ts2022_config = { + .clock = 2700, + }; + memset(info, 0, sizeof(struct i2c_board_info)); + + /* attach demod */ + adap-fe[0] = dvb_attach(m88ds3103_attach, + dvbsky_s960c_m88ds3103_config, + d-i2c_adap, + i2c_adapter); + if (!adap-fe[0]) { + dev_err(d-udev-dev, dvbsky_s960ci_attach fail.\n); + ret = -ENODEV; + goto fail_attach; + } + + /* attach tuner */ + m88ts2022_config.fe = adap-fe[0]; + strlcpy(info.type, m88ts2022, I2C_NAME_SIZE); + info.addr = 0x60; + info.platform_data = m88ts2022_config; + request_module(m88ts2022); + client_tuner = i2c_new_device(i2c_adapter, info); + if (client_tuner == NULL || client_tuner-dev.driver == NULL) { + ret = -ENODEV; + goto fail_tuner_device; + } + + if (!try_module_get(client_tuner-dev.driver-owner)) { + ret = -ENODEV; + goto fail_tuner_module; + } + + /* attach ci controller */ + memset(sp2_config, 0, sizeof(sp2_config)); + sp2_config.dvb_adap
[PATCH 1/3] DVBSky V3 PCIe card: add new SMI PCIe bridge driver
There is a new PCIe bridge chip(from SMI) used in DVBSky V3 seris cards, include S950 V3 and S952 V3 cards. SMI pcie bridge chip is PCIe 1.1 compliant, supports MSI feature. Main interface blocks: 1Two DVB transport stream input ports(ts0,ts1). 2Two I2C master bus(i2c0, i2c1). 3IR controller. 4reset pins and other GPIOs. DVBSky S950 V3 card has a single channel of dvb-s/s2. 1Frontend: tuner: M88TS2022, demod: M88DS3103 2PCIe bridge: SMI PCIe DVBSky S952 V3 card has a dual channels of dvb-s/s2. 1Frontend: Integrated tuner and demod: M88RS6000 2PCIe bridge: SMI PCIe *The current driver does not support SMI IR function. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/Kconfig |1 + drivers/media/pci/Makefile |3 +- drivers/media/pci/smipcie/Kconfig | 13 + drivers/media/pci/smipcie/Makefile |3 + drivers/media/pci/smipcie/smipcie.c | 1021 +++ drivers/media/pci/smipcie/smipcie.h | 298 ++ 6 files changed, 1338 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/Kconfig b/drivers/media/pci/Kconfig index f8cec8e..218144a 100644 --- a/drivers/media/pci/Kconfig +++ b/drivers/media/pci/Kconfig @@ -46,6 +46,7 @@ source drivers/media/pci/pt3/Kconfig source drivers/media/pci/mantis/Kconfig source drivers/media/pci/ngene/Kconfig source drivers/media/pci/ddbridge/Kconfig +source drivers/media/pci/smipcie/Kconfig endif endif #MEDIA_PCI_SUPPORT diff --git a/drivers/media/pci/Makefile b/drivers/media/pci/Makefile index a12926e..0baf0d2 100644 --- a/drivers/media/pci/Makefile +++ b/drivers/media/pci/Makefile @@ -11,7 +11,8 @@ obj-y+= ttpci/ \ mantis/ \ ngene/ \ ddbridge/ \ - saa7146/ + saa7146/\ + smipcie/ obj-$(CONFIG_VIDEO_IVTV) += ivtv/ obj-$(CONFIG_VIDEO_ZORAN) += zoran/ diff --git a/drivers/media/pci/smipcie/Kconfig b/drivers/media/pci/smipcie/Kconfig new file mode 100644 index 000..75a2992 --- /dev/null +++ b/drivers/media/pci/smipcie/Kconfig @@ -0,0 +1,13 @@ +config DVB_SMIPCIE + tristate SMI PCIe DVBSky cards + depends on DVB_CORE PCI I2C + select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_M88RS6000T if MEDIA_SUBDRV_AUTOSELECT + help + Support for cards with SMI PCIe bridge: + - DVBSky S950 V3 + - DVBSky S952 V3 + + Say Y or M if you own such a device and want to use it. + If unsure say N. diff --git a/drivers/media/pci/smipcie/Makefile b/drivers/media/pci/smipcie/Makefile new file mode 100644 index 000..20af47a --- /dev/null +++ b/drivers/media/pci/smipcie/Makefile @@ -0,0 +1,3 @@ +obj-$(CONFIG_DVB_SMIPCIE) += smipcie.o + +ccflags-y += -Idrivers/media/dvb-core/ -Idrivers/media/dvb-frontends diff --git a/drivers/media/pci/smipcie/smipcie.c b/drivers/media/pci/smipcie/smipcie.c new file mode 100644 index 000..77ded52 --- /dev/null +++ b/drivers/media/pci/smipcie/smipcie.c @@ -0,0 +1,1021 @@ +/* + * SMI PCIe driver for DVBSky cards. + * + * Copyright (C) 2014 Max nibble nibble@gmail.com + * + *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 smipcie.h +#include m88ds3103.h +#include m88ts2022.h +#include m88rs6000t.h + +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); + +static int smi_hw_init(struct smi_dev *dev) +{ + u32 port_mux, port_ctrl, int_stat; + + /* set port mux.*/ + port_mux = smi_read(MUX_MODE_CTRL); + port_mux = ~(rbPaMSMask); + port_mux |= rbPaMSDtvNoGpio; + port_mux = ~(rbPbMSMask); + port_mux |= rbPbMSDtvNoGpio; + port_mux = ~(0x0f); + port_mux |= 0x5; + smi_write(MUX_MODE_CTRL, port_mux); + + /* set DTV register.*/ + /* Port A */ + port_ctrl = smi_read(VIDEO_CTRL_STATUS_A); + port_ctrl = ~0x01; + smi_write(VIDEO_CTRL_STATUS_A, port_ctrl); + port_ctrl = smi_read(MPEG2_CTRL_A); + port_ctrl = ~0x40; + port_ctrl |= 0x80; + smi_write(MPEG2_CTRL_A, port_ctrl); + /* Port B */ + port_ctrl = smi_read(VIDEO_CTRL_STATUS_B); + port_ctrl = ~0x01; + smi_write(VIDEO_CTRL_STATUS_B, port_ctrl); + port_ctrl = smi_read(MPEG2_CTRL_B); + port_ctrl = ~0x40; + port_ctrl |= 0x80; + smi_write(MPEG2_CTRL_B, port_ctrl); + + /* disable
[PATCH 2/3] DVBSky V3 PCIe card: add new dvb-s/s2 tuner for integrated chip M88RS6000
M88RS6000 is the integrated chip, which includes tuner and demod. Here splite its tuner as a standalone driver. .set_config is used to config its demod clock, which sits inside tuner die. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/tuners/Kconfig | 8 + drivers/media/tuners/Makefile | 1 + drivers/media/tuners/m88rs6000t.c | 928 ++ drivers/media/tuners/m88rs6000t.h | 41 ++ 4 files changed, 978 insertions(+) diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig index f039dc2..42e5a01 100644 --- a/drivers/media/tuners/Kconfig +++ b/drivers/media/tuners/Kconfig @@ -232,6 +232,14 @@ config MEDIA_TUNER_M88TS2022 help Montage M88TS2022 silicon tuner driver. +config MEDIA_TUNER_M88RS6000T + tristate Montage M88RS6000 internal tuner + depends on MEDIA_SUPPORT I2C + select REGMAP_I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + Montage M88RS6000 internal tuner. + config MEDIA_TUNER_TUA9001 tristate Infineon TUA 9001 silicon tuner depends on MEDIA_SUPPORT I2C diff --git a/drivers/media/tuners/Makefile b/drivers/media/tuners/Makefile index 49fcf80..da4fe6e 100644 --- a/drivers/media/tuners/Makefile +++ b/drivers/media/tuners/Makefile @@ -41,6 +41,7 @@ obj-$(CONFIG_MEDIA_TUNER_IT913X) += it913x.o obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o +obj-$(CONFIG_MEDIA_TUNER_M88RS6000T) += m88rs6000t.o ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends diff --git a/drivers/media/tuners/m88rs6000t.c b/drivers/media/tuners/m88rs6000t.c new file mode 100644 index 000..fc9e406 --- /dev/null +++ b/drivers/media/tuners/m88rs6000t.c @@ -0,0 +1,928 @@ +/* + * Driver for the internal tuner of Montage M88RS6000 + * + * Copyright (C) 2014 Max nibble nibble@gmail.com + * + *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 m88rs6000t.h +#include linux/regmap.h + +struct m88rs6000t_dev { + struct m88rs6000t_config cfg; + struct i2c_client *client; + struct regmap *regmap; + u32 frequency_khz; +}; + +struct m88rs6000t_reg_val { + u8 reg; + u8 val; +}; + +static int m88rs6000t_select_mclk(struct m88rs6000t_dev *dev, + u32 tuner_freq_MHz, u32 iSymRateKSs, u32 *iMclkKHz) +{ + u32 adc_Freq_MHz[3] = {96, 93, 99}; + u8 reg16_list[3] = {96, 92, 100}, reg16, reg15; + u32 offset_MHz[3]; + u32 max_offset = 0; + int ret, i; + unsigned int utmp; + + if (iSymRateKSs 45010) { + reg16 = 115; + *iMclkKHz = 110250; + } else { + adc_Freq_MHz[0] = 96; + adc_Freq_MHz[1] = 93; + adc_Freq_MHz[2] = 99; + reg16_list[0] = 96; + reg16_list[1] = 92; + reg16_list[2] = 100; + reg16 = 96; + for (i = 0; i 3; i++) { + offset_MHz[i] = tuner_freq_MHz % adc_Freq_MHz[i]; + + if (offset_MHz[i] (adc_Freq_MHz[i] / 2)) + offset_MHz[i] = adc_Freq_MHz[i] - offset_MHz[i]; + + if (offset_MHz[i] max_offset) { + max_offset = offset_MHz[i]; + reg16 = reg16_list[i]; + *iMclkKHz = adc_Freq_MHz[i] * 1000; + + if (iSymRateKSs 45010) + *iMclkKHz /= 2; + } + } + } + ret = regmap_read(dev-regmap, 0x15, utmp); + if (ret) + goto err; + reg15 = utmp; + ret = regmap_write(dev-regmap, 0x05, 0x40); + if (ret) + goto err; + ret = regmap_write(dev-regmap, 0x11, 0x08); + if (ret) + goto err; + if (iSymRateKSs 45010) + reg15 |= 0x02; + else + reg15 = ~0x02; + ret = regmap_write(dev-regmap, 0x15, reg15); + if (ret) + goto err; + ret = regmap_write(dev-regmap, 0x16, reg16); + if (ret) + goto err; + usleep_range(5000, 5); + ret = regmap_write(dev-regmap, 0x05, 0x00); + if (ret) + goto err; + ret = regmap_write(dev-regmap, + 0x11
[PATCH 3/3] DVBSky V3 PCIe card: add some changes to M88DS3103 for supporting the demod of M88RS6000
M88RS6000 is the integrated chip, which includes tuner and demod. Its internal demod is similar with M88DS3103 except some registers definition. The main different part of this internal demod from others is its clock/pll generation IP block sitting inside the tuner die. So clock/pll functions should be configed through its tuner i2c bus, NOT its demod i2c bus. The demod of M88RS6000 need the firmware: dvb-demod-m88rs6000.fw firmware download link: http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/dvb-frontends/m88ds3103.c | 253 --- drivers/media/dvb-frontends/m88ds3103_priv.h | 188 2 files changed, 374 insertions(+), 67 deletions(-) diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c index 81657e9..7fbbf67 100644 --- a/drivers/media/dvb-frontends/m88ds3103.c +++ b/drivers/media/dvb-frontends/m88ds3103.c @@ -1,5 +1,5 @@ /* - * Montage M88DS3103 demodulator driver + * Montage M88DS3103/M88RS6000 demodulator driver * * Copyright (C) 2013 Antti Palosaari cr...@iki.fi * @@ -162,7 +162,7 @@ static int m88ds3103_wr_reg_val_tab(struct m88ds3103_priv *priv, dev_dbg(priv-i2c-dev, %s: tab_len=%d\n, __func__, tab_len); - if (tab_len 83) { + if (tab_len 86) { ret = -EINVAL; goto err; } @@ -172,7 +172,8 @@ static int m88ds3103_wr_reg_val_tab(struct m88ds3103_priv *priv, if (i == tab_len - 1 || tab[i].reg != tab[i + 1].reg - 1 || !((j + 1) % (priv-cfg-i2c_wr_max - 1))) { - ret = m88ds3103_wr_regs(priv, tab[i].reg - j, buf, j + 1); + ret = m88ds3103_wr_regs(priv, + tab[i].reg - j, buf, j + 1); if (ret) goto err; @@ -250,6 +251,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) u16 u16tmp, divide_ratio; u32 tuner_frequency, target_mclk; s32 s32tmp; + struct m88rs6000_mclk_config mclk_cfg; dev_dbg(priv-i2c-dev, %s: delivery_system=%d modulation=%d frequency=%d symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n, @@ -291,6 +293,26 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) if (ret) goto err; + if (priv-chip_id == M88RS6000_CHIP_ID) { + ret = m88ds3103_wr_reg(priv, 0x06, 0xe0); + if (ret) + goto err; + if (fe-ops.tuner_ops.set_config) { + /* select main mclk */ + mclk_cfg.config_op = 0; + mclk_cfg.TunerfreqMHz = c-frequency / 1000; + mclk_cfg.SymRateKSs = c-symbol_rate / 1000; + ret = fe-ops.tuner_ops.set_config(fe, mclk_cfg); + if (ret) + goto err; + priv-mclk_khz = mclk_cfg.MclkKHz; + } + ret = m88ds3103_wr_reg(priv, 0x06, 0x00); + if (ret) + goto err; + usleep_range(1, 2); + } + ret = m88ds3103_wr_reg(priv, 0xb2, 0x01); if (ret) goto err; @@ -301,36 +323,62 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) switch (c-delivery_system) { case SYS_DVBS: - len = ARRAY_SIZE(m88ds3103_dvbs_init_reg_vals); - init = m88ds3103_dvbs_init_reg_vals; + if (priv-chip_id == M88RS6000_CHIP_ID) { + len = ARRAY_SIZE(m88rs6000_dvbs_init_reg_vals); + init = m88rs6000_dvbs_init_reg_vals; + } else { + len = ARRAY_SIZE(m88ds3103_dvbs_init_reg_vals); + init = m88ds3103_dvbs_init_reg_vals; + } target_mclk = 96000; break; case SYS_DVBS2: - len = ARRAY_SIZE(m88ds3103_dvbs2_init_reg_vals); - init = m88ds3103_dvbs2_init_reg_vals; + if (priv-chip_id == M88RS6000_CHIP_ID) { + len = ARRAY_SIZE(m88rs6000_dvbs2_init_reg_vals); + init = m88rs6000_dvbs2_init_reg_vals; - switch (priv-cfg-ts_mode) { - case M88DS3103_TS_SERIAL: - case M88DS3103_TS_SERIAL_D7: - if (c-symbol_rate 1800) + switch (priv-cfg-ts_mode) { + case M88DS3103_TS_SERIAL: + case M88DS3103_TS_SERIAL_D7: target_mclk = 96000; - else + break; + case M88DS3103_TS_PARALLEL: + case M88DS3103_TS_CI
[PATCH 1/1] smipcie: SMI pcie bridge driver for DVBSky S950 V3 dvb-s/s2 cards
There is a new PCIe bridge chip(from SMI) used in DVBSky V3 seris cards, include S950 V3 and S952 V3 cards. SMI pcie bridge chip is PCIe 1.1 compliant, supports MSI feature. Main interface blocks: 1Two DVB transport stream input ports(ts0,ts1). 2Two I2C master bus(i2c0, i2c1). 3IR controller. 4reset pins and other GPIOs. DVBSky S950 V3 card has a single channel of dvb-s/s2. 1Frontend: tuner: M88TS2022, demod: M88DS3103 2PCIe bridge: SMI PCIe The current driver does not support SMI IR function. Signed-off-by: Max nibble nibble@gmail.com --- drivers/media/pci/Kconfig | 1 + drivers/media/pci/Makefile | 3 +- drivers/media/pci/smipcie/Kconfig | 11 + drivers/media/pci/smipcie/Makefile | 3 + drivers/media/pci/smipcie/smipcie.c | 943 drivers/media/pci/smipcie/smipcie.h | 299 6 files changed, 1259 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/Kconfig b/drivers/media/pci/Kconfig index f8cec8e..218144a 100644 --- a/drivers/media/pci/Kconfig +++ b/drivers/media/pci/Kconfig @@ -46,6 +46,7 @@ source drivers/media/pci/pt3/Kconfig source drivers/media/pci/mantis/Kconfig source drivers/media/pci/ngene/Kconfig source drivers/media/pci/ddbridge/Kconfig +source drivers/media/pci/smipcie/Kconfig endif endif #MEDIA_PCI_SUPPORT diff --git a/drivers/media/pci/Makefile b/drivers/media/pci/Makefile index a12926e..0baf0d2 100644 --- a/drivers/media/pci/Makefile +++ b/drivers/media/pci/Makefile @@ -11,7 +11,8 @@ obj-y+= ttpci/ \ mantis/ \ ngene/ \ ddbridge/ \ - saa7146/ + saa7146/\ + smipcie/ obj-$(CONFIG_VIDEO_IVTV) += ivtv/ obj-$(CONFIG_VIDEO_ZORAN) += zoran/ diff --git a/drivers/media/pci/smipcie/Kconfig b/drivers/media/pci/smipcie/Kconfig new file mode 100644 index 000..78b76ca --- /dev/null +++ b/drivers/media/pci/smipcie/Kconfig @@ -0,0 +1,11 @@ +config DVB_SMIPCIE + tristate SMI PCIe DVBSky cards + depends on DVB_CORE PCI I2C + select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT + help + Support for cards with SMI PCIe bridge: + - DVBSky S950 V3 + + Say Y or M if you own such a device and want to use it. + If unsure say N. diff --git a/drivers/media/pci/smipcie/Makefile b/drivers/media/pci/smipcie/Makefile new file mode 100644 index 000..20af47a --- /dev/null +++ b/drivers/media/pci/smipcie/Makefile @@ -0,0 +1,3 @@ +obj-$(CONFIG_DVB_SMIPCIE) += smipcie.o + +ccflags-y += -Idrivers/media/dvb-core/ -Idrivers/media/dvb-frontends diff --git a/drivers/media/pci/smipcie/smipcie.c b/drivers/media/pci/smipcie/smipcie.c new file mode 100644 index 000..3522da4 --- /dev/null +++ b/drivers/media/pci/smipcie/smipcie.c @@ -0,0 +1,943 @@ +/* + * SMI PCIe driver for DVBSky cards. + * + * Copyright (C) 2014 Max nibble nibble@gmail.com + * + *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 smipcie.h +#include m88ds3103.h +#include m88ts2022.h + +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); + +static int smi_hw_init(struct smi_dev *dev) +{ + u32 port_mux, port_ctrl, int_stat; + + /* set port mux.*/ + port_mux = smi_read(MUX_MODE_CTRL); + port_mux = ~(rbPaMSMask); + port_mux |= rbPaMSDtvNoGpio; + port_mux = ~(rbPbMSMask); + port_mux |= rbPbMSDtvNoGpio; + port_mux = ~(0x0f); + port_mux |= 0x5; + smi_write(MUX_MODE_CTRL, port_mux); + + /* set DTV register.*/ + /* Port A */ + port_ctrl = smi_read(VIDEO_CTRL_STATUS_A); + port_ctrl = ~0x01; + smi_write(VIDEO_CTRL_STATUS_A, port_ctrl); + port_ctrl = smi_read(MPEG2_CTRL_A); + port_ctrl = ~0x40; + port_ctrl |= 0x80; + smi_write(MPEG2_CTRL_A, port_ctrl); + /* Port B */ + port_ctrl = smi_read(VIDEO_CTRL_STATUS_B); + port_ctrl = ~0x01; + smi_write(VIDEO_CTRL_STATUS_B, port_ctrl); + port_ctrl = smi_read(MPEG2_CTRL_B); + port_ctrl = ~0x40; + port_ctrl |= 0x80; + smi_write(MPEG2_CTRL_B, port_ctrl); + + /* disable and clear interrupt.*/ + smi_write(MSI_INT_ENA_CLR, ALL_INT); + int_stat = smi_read(MSI_INT_STATUS); + smi_write(MSI_INT_STATUS_CLR, int_stat); + + /* reset demod.*/ + smi_clear(PERIPHERAL_CTRL, 0x0303); +
Re: [PATCH 5/5] cx23855: add CI support for DVBSky T980C
Hello, In hardware design, the CI host controller is wired with GPIO_0 of CX23885. The GPIO_0 can be configed as the interrupt source. Interrupt mode in PCIe driver is more faster than poll mode to detect CAM insert/remove operations etc. Add CI support for DVBSky T980C. I used the new host device independent CIMaX SP2 I2C driver to implement it. cx23885_sp2_ci_ctrl function is borrowed entirely from cimax2.c. Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/pci/cx23885/cx23885-dvb.c | 105 +++- 1 file changed, 103 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index cc88997..70dbcd6 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -71,6 +71,7 @@ #include si2165.h #include si2168.h #include si2157.h +#include sp2.h #include m88ds3103.h #include m88ts2022.h @@ -616,6 +617,76 @@ static int dvbsky_t9580_set_voltage(struct dvb_frontend *fe, return 0; } +static int cx23885_sp2_ci_ctrl(void *priv, u8 read, int addr, + u8 data, int *mem) +{ + + /* MC417 */ + #define SP2_DATA 0x00ff + #define SP2_WR0x8000 + #define SP2_RD0x4000 + #define SP2_ACK 0x1000 + #define SP2_ADHI 0x0800 + #define SP2_ADLO 0x0400 + #define SP2_CS1 0x0200 + #define SP2_CS0 0x0100 + #define SP2_EN_ALL0x1000 + #define SP2_CTRL_OFF (SP2_CS1 | SP2_CS0 | SP2_WR | SP2_RD) + + struct cx23885_tsport *port = priv; + struct cx23885_dev *dev = port-dev; + int ret; + int tmp; + unsigned long timeout; + + mutex_lock(dev-gpio_lock); + + /* write addr */ + cx_write(MC417_OEN, SP2_EN_ALL); + cx_write(MC417_RWD, SP2_CTRL_OFF | + SP2_ADLO | (0xff addr)); + cx_clear(MC417_RWD, SP2_ADLO); + cx_write(MC417_RWD, SP2_CTRL_OFF | + SP2_ADHI | (0xff (addr 8))); + cx_clear(MC417_RWD, SP2_ADHI); + + if (read) { /* data in */ + cx_write(MC417_OEN, SP2_EN_ALL | SP2_DATA); + } else /* data out */ + cx_write(MC417_RWD, SP2_CTRL_OFF | data); + + /* chip select 0 */ + cx_clear(MC417_RWD, SP2_CS0); + + /* read/write */ + cx_clear(MC417_RWD, (read) ? SP2_RD : SP2_WR); + + timeout = jiffies + msecs_to_jiffies(1); + for (;;) { + tmp = cx_read(MC417_RWD); + if ((tmp SP2_ACK) == 0) + break; + if (time_after(jiffies, timeout)) + break; + udelay(1); + } + + cx_set(MC417_RWD, SP2_CTRL_OFF); + *mem = tmp 0xff; + + mutex_unlock(dev-gpio_lock); + + if (!read) + if (*mem 0) { + ret = -EREMOTEIO; + goto err; + } + + return 0; +err: + return ret; +} + static int cx23885_dvb_set_frontend(struct dvb_frontend *fe) { struct dtv_frontend_properties *p = fe-dtv_property_cache; @@ -944,11 +1015,11 @@ static int dvb_register(struct cx23885_tsport *port) struct vb2_dvb_frontend *fe0, *fe1 = NULL; struct si2168_config si2168_config; struct si2157_config si2157_config; + struct sp2_config sp2_config; struct m88ts2022_config m88ts2022_config; struct i2c_board_info info; struct i2c_adapter *adapter; - struct i2c_client *client_demod; - struct i2c_client *client_tuner; + struct i2c_client *client_demod, *client_tuner, *client_ci; int mfe_shared = 0; /* bus not shared by default */ int ret; @@ -1683,6 +1754,7 @@ static int dvb_register(struct cx23885_tsport *port) break; case CX23885_BOARD_DVBSKY_T980C: i2c_bus = dev-i2c_bus[1]; + i2c_bus2 = dev-i2c_bus[0]; /* attach frontend */ memset(si2168_config, 0, sizeof(si2168_config)); @@ -1820,6 +1892,35 @@ static int dvb_register(struct cx23885_tsport *port) case CX23885_BOARD_DVBSKY_T980C: { u8 eeprom[256]; /* 24C02 i2c eeprom */ + /* attach CI */ + memset(sp2_config, 0, sizeof(sp2_config)); + sp2_config.dvb_adap = port-frontends.adapter; + sp2_config.priv = port; + sp2_config.ci_control = cx23885_sp2_ci_ctrl; + memset(info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, sp2, I2C_NAME_SIZE); + info.addr = 0x40; + info.platform_data = sp2_config; + request_module(info.type); + client_ci = i2c_new_device(i2c_bus2-i2c_adap, info); + if (client_ci == NULL || +
[PATCH] Add IR support for DVBSky T9580 Dual DVB-S2/T2/C PCIe card
DVBSky T9580 uses Integrated CX23885 IR controller to decode IR signal. The IR type of DVBSky remote control is RC5. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/pci/cx23885/cx23885-cards.c | 3 +++ drivers/media/pci/cx23885/cx23885-input.c | 8 2 files changed, 11 insertions(+) diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 88c257d..d07f025 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -1621,6 +1621,7 @@ int cx23885_ir_init(struct cx23885_dev *dev) case CX23885_BOARD_MYGICA_X8507: case CX23885_BOARD_TBS_6980: case CX23885_BOARD_TBS_6981: + case CX23885_BOARD_DVBSKY_T9580: if (!enable_885_ir) break; dev-sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); @@ -1667,6 +1668,7 @@ void cx23885_ir_fini(struct cx23885_dev *dev) case CX23885_BOARD_MYGICA_X8507: case CX23885_BOARD_TBS_6980: case CX23885_BOARD_TBS_6981: + case CX23885_BOARD_DVBSKY_T9580: cx23885_irq_remove(dev, PCI_MSK_AV_CORE); /* sd_ir is a duplicate pointer to the AV Core, just clear it */ dev-sd_ir = NULL; @@ -1714,6 +1716,7 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) case CX23885_BOARD_MYGICA_X8507: case CX23885_BOARD_TBS_6980: case CX23885_BOARD_TBS_6981: + case CX23885_BOARD_DVBSKY_T9580: if (dev-sd_ir) cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE); break; diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c index 9d37fe6..f81c2f9 100644 --- a/drivers/media/pci/cx23885/cx23885-input.c +++ b/drivers/media/pci/cx23885/cx23885-input.c @@ -87,6 +87,7 @@ void cx23885_input_rx_work_handler(struct cx23885_dev *dev, u32 events) case CX23885_BOARD_MYGICA_X8507: case CX23885_BOARD_TBS_6980: case CX23885_BOARD_TBS_6981: + case CX23885_BOARD_DVBSKY_T9580: /* * The only boards we handle right now. However other boards * using the CX2388x integrated IR controller should be similar @@ -139,6 +140,7 @@ static int cx23885_input_ir_start(struct cx23885_dev *dev) case CX23885_BOARD_HAUPPAUGE_HVR1290: case CX23885_BOARD_HAUPPAUGE_HVR1250: case CX23885_BOARD_MYGICA_X8507: + case CX23885_BOARD_DVBSKY_T9580: /* * The IR controller on this board only returns pulse widths. * Any other mode setting will fail to set up the device. @@ -305,6 +307,12 @@ int cx23885_input_init(struct cx23885_dev *dev) /* A guess at the remote */ rc_map = RC_MAP_TBS_NEC; break; + case CX23885_BOARD_DVBSKY_T9580: + /* Integrated CX23885 IR controller */ + driver_type = RC_DRIVER_IR_RAW; + allowed_protos = RC_BIT_ALL; + rc_map = RC_MAP_DVBSKY; + break; default: return -ENODEV; } -- 1.9.1 -- 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
Re: [PATCHv2 1/4] sp2: Add I2C driver for CIMaX SP2 common interface module
Hello, static int sp2_remove(struct i2c_client *client) { struct si2157 *s = i2c_get_clientdata(client); .. wrong struct si2157, it should be struct sp2. Could you check it? BR, Max Driver for the CIMaX SP2 common interface chip. It is very much based on the existing cimax2 driver for cx23885, but should be more reusable. The product has been sold with name Atmel T90FJR as well and the data sheets for that chip seem to be publicly available. It seems that the USB device that I have and the cx23885 based devices will need to interact differently with the chip for the CAM operations. Thus there is one callback function that is passed on to the sp2 driver (see function sp2_ci_op_cam for that one). IRQ functionality is not included currently (not needed by USB devices and I don't have a PCIe device for development). This is the second version of the patch series after review by Antti Palosaari. Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/dvb-frontends/Kconfig| 7 + drivers/media/dvb-frontends/Makefile | 1 + drivers/media/dvb-frontends/sp2.c | 441 + drivers/media/dvb-frontends/sp2.h | 53 drivers/media/dvb-frontends/sp2_priv.h | 50 5 files changed, 552 insertions(+) create mode 100644 drivers/media/dvb-frontends/sp2.c create mode 100644 drivers/media/dvb-frontends/sp2.h create mode 100644 drivers/media/dvb-frontends/sp2_priv.h diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig index fe0ddcc..c38c936 100644 --- a/drivers/media/dvb-frontends/Kconfig +++ b/drivers/media/dvb-frontends/Kconfig @@ -720,6 +720,13 @@ config DVB_A8293 depends on DVB_CORE I2C default m if !MEDIA_SUBDRV_AUTOSELECT +config DVB_SP2 + tristate CIMaX SP2 + depends on DVB_CORE I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help +CIMaX SP2/SP2HF Common Interface module. + config DVB_LGS8GL5 tristate Silicon Legend LGS-8GL5 demodulator (OFDM) depends on DVB_CORE I2C diff --git a/drivers/media/dvb-frontends/Makefile b/drivers/media/dvb-frontends/Makefile index edf103d..3498b95 100644 --- a/drivers/media/dvb-frontends/Makefile +++ b/drivers/media/dvb-frontends/Makefile @@ -107,6 +107,7 @@ obj-$(CONFIG_DVB_DRXK) += drxk.o obj-$(CONFIG_DVB_TDA18271C2DD) += tda18271c2dd.o obj-$(CONFIG_DVB_SI2165) += si2165.o obj-$(CONFIG_DVB_A8293) += a8293.o +obj-$(CONFIG_DVB_SP2) += sp2.o obj-$(CONFIG_DVB_TDA10071) += tda10071.o obj-$(CONFIG_DVB_RTL2830) += rtl2830.o obj-$(CONFIG_DVB_RTL2832) += rtl2832.o diff --git a/drivers/media/dvb-frontends/sp2.c b/drivers/media/dvb-frontends/sp2.c new file mode 100644 index 000..9b684d5 --- /dev/null +++ b/drivers/media/dvb-frontends/sp2.c @@ -0,0 +1,441 @@ +/* + * CIMaX SP2/SP2HF (Atmel T90FJR) CI driver + * + * Copyright (C) 2014 Olli Salonen olli.salo...@iki.fi + * + * Heavily based on CIMax2(R) SP2 driver in conjunction with NetUp Dual + * DVB-S2 CI card (cimax2) with following copyrights: + * + * Copyright (C) 2009 NetUP Inc. + * Copyright (C) 2009 Igor M. Liplianin liplia...@netup.ru + * Copyright (C) 2009 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 sp2_priv.h + +static int sp2_read_i2c(struct sp2 *s, u8 reg, u8 *buf, int len) +{ + int ret; + struct i2c_client *client = s-client; + struct i2c_adapter *adap = client-adapter; + struct i2c_msg msg[] = { + { + .addr = client-addr, + .flags = 0, + .buf = reg, + .len = 1 + }, { + .addr = client-addr, + .flags = I2C_M_RD, + .buf = buf, + .len = len + } + }; + + ret = i2c_transfer(adap, msg, 2); + + if (ret != 2) { + dev_err(client-dev, i2c read error, reg = 0x%02x, status = %d\n, + reg, ret); + if (ret 0) + return ret; + else + return -EIO; + } + + dev_dbg(s-client-dev, addr=0x%04x, reg = 0x%02x, data = %02x\n, + client-addr, reg, buf[0]); + + return 0; +} + +static int sp2_write_i2c(struct sp2 *s, u8 reg, u8 *buf, int len) +{ + int ret; + u8 buffer[35]; + struct i2c_client *client = s-client; + struct
Re: [PATCHv2 1/4] sp2: Add I2C driver for CIMaX SP2 common interface module
Driver for the CIMaX SP2 common interface chip. It is very much based on the existing cimax2 driver for cx23885, but should be more reusable. The product has been sold with name Atmel T90FJR as well and the data sheets for that chip seem to be publicly available. It seems that the USB device that I have and the cx23885 based devices will need to interact differently with the chip for the CAM operations. Thus there is one callback function that is passed on to the sp2 driver (see function sp2_ci_op_cam for that one). IRQ functionality is not included currently (not needed by USB devices and I don't have a PCIe device for development). This is the second version of the patch series after review by Antti Palosaari. Signed-off-by: Olli Salonen olli.salo...@iki.fi --- drivers/media/dvb-frontends/Kconfig| 7 + drivers/media/dvb-frontends/Makefile | 1 + drivers/media/dvb-frontends/sp2.c | 441 + drivers/media/dvb-frontends/sp2.h | 53 drivers/media/dvb-frontends/sp2_priv.h | 50 5 files changed, 552 insertions(+) create mode 100644 drivers/media/dvb-frontends/sp2.c create mode 100644 drivers/media/dvb-frontends/sp2.h create mode 100644 drivers/media/dvb-frontends/sp2_priv.h diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig index fe0ddcc..c38c936 100644 --- a/drivers/media/dvb-frontends/Kconfig +++ b/drivers/media/dvb-frontends/Kconfig @@ -720,6 +720,13 @@ config DVB_A8293 depends on DVB_CORE I2C default m if !MEDIA_SUBDRV_AUTOSELECT +config DVB_SP2 + tristate CIMaX SP2 + depends on DVB_CORE I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help +CIMaX SP2/SP2HF Common Interface module. + config DVB_LGS8GL5 tristate Silicon Legend LGS-8GL5 demodulator (OFDM) depends on DVB_CORE I2C diff --git a/drivers/media/dvb-frontends/Makefile b/drivers/media/dvb-frontends/Makefile index edf103d..3498b95 100644 --- a/drivers/media/dvb-frontends/Makefile +++ b/drivers/media/dvb-frontends/Makefile @@ -107,6 +107,7 @@ obj-$(CONFIG_DVB_DRXK) += drxk.o obj-$(CONFIG_DVB_TDA18271C2DD) += tda18271c2dd.o obj-$(CONFIG_DVB_SI2165) += si2165.o obj-$(CONFIG_DVB_A8293) += a8293.o +obj-$(CONFIG_DVB_SP2) += sp2.o obj-$(CONFIG_DVB_TDA10071) += tda10071.o obj-$(CONFIG_DVB_RTL2830) += rtl2830.o obj-$(CONFIG_DVB_RTL2832) += rtl2832.o diff --git a/drivers/media/dvb-frontends/sp2.c b/drivers/media/dvb-frontends/sp2.c new file mode 100644 index 000..9b684d5 --- /dev/null +++ b/drivers/media/dvb-frontends/sp2.c @@ -0,0 +1,441 @@ +/* + * CIMaX SP2/SP2HF (Atmel T90FJR) CI driver + * + * Copyright (C) 2014 Olli Salonen olli.salo...@iki.fi + * + * Heavily based on CIMax2(R) SP2 driver in conjunction with NetUp Dual + * DVB-S2 CI card (cimax2) with following copyrights: + * + * Copyright (C) 2009 NetUP Inc. + * Copyright (C) 2009 Igor M. Liplianin liplia...@netup.ru + * Copyright (C) 2009 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 sp2_priv.h + +static int sp2_read_i2c(struct sp2 *s, u8 reg, u8 *buf, int len) +{ + int ret; + struct i2c_client *client = s-client; + struct i2c_adapter *adap = client-adapter; + struct i2c_msg msg[] = { + { + .addr = client-addr, + .flags = 0, + .buf = reg, + .len = 1 + }, { + .addr = client-addr, + .flags = I2C_M_RD, + .buf = buf, + .len = len + } + }; + + ret = i2c_transfer(adap, msg, 2); + + if (ret != 2) { + dev_err(client-dev, i2c read error, reg = 0x%02x, status = %d\n, + reg, ret); + if (ret 0) + return ret; + else + return -EIO; + } + + dev_dbg(s-client-dev, addr=0x%04x, reg = 0x%02x, data = %02x\n, + client-addr, reg, buf[0]); + + return 0; +} + +static int sp2_write_i2c(struct sp2 *s, u8 reg, u8 *buf, int len) +{ + int ret; + u8 buffer[35]; + struct i2c_client *client = s-client; + struct i2c_adapter *adap = client-adapter; + struct i2c_msg msg = { + .addr = client-addr, + .flags = 0, + .buf = buffer[0], + .len = len + 1 + }; + +
Re: Re: [PATCH 3/4 v4] support for DVBSky dvb-s2 usb: add dvb-usb-v2driver for DVBSky dvb-s2 box, no ci support.
Hello Antti, Could you collect the following patches? It will make to support DVBSky DVB-S2 usb device. https://patchwork.linuxtv.org/patch/25313/ https://patchwork.linuxtv.org/patch/25202/ https://patchwork.linuxtv.org/patch/25201/ BR, Max Looks OK Reviewed-by: Antti Palosaari cr...@iki.fi regards Antti On 08/11/2014 07:45 AM, nibble.max wrote: remove ci support part in v1 patch. hook demod read status and set voltage operations. add m88ts2022 select in Kconfig. move usb buffer into state for usb ctrl. make checkpatch.pl happy. Signed-off-by: Nibble Max nibble@gmail.com --- drivers/media/usb/dvb-usb-v2/Kconfig | 7 + drivers/media/usb/dvb-usb-v2/Makefile | 3 + drivers/media/usb/dvb-usb-v2/dvbsky.c | 460 ++ 3 files changed, 470 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig index 66645b0..5b34323 100644 --- a/drivers/media/usb/dvb-usb-v2/Kconfig +++ b/drivers/media/usb/dvb-usb-v2/Kconfig @@ -141,3 +141,10 @@ 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 +select MEDIA_TUNER_M88TS2022 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..34688c8 --- /dev/null +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -0,0 +1,460 @@ +/* + * Driver for DVBSky USB2.0 receiver + * + * Copyright (C) 2013 Max nibble nibble@gmail.com + * + *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_usb.h +#include m88ds3103.h +#include m88ts2022.h + +#define DVBSKY_MSG_DELAY0/*2000*/ +#define DVBSKY_BUF_LEN 64 + +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); + +struct dvbsky_state { +struct mutex stream_mutex; +u8 ibuf[DVBSKY_BUF_LEN]; +u8 obuf[DVBSKY_BUF_LEN]; +u8 last_lock; +struct i2c_client *i2c_client_tuner; + +/* fe hook functions*/ +int (*fe_set_voltage)(struct dvb_frontend *fe, +fe_sec_voltage_t voltage); +int (*fe_read_status)(struct dvb_frontend *fe, +fe_status_t *status); +}; + +static int dvbsky_usb_generic_rw(struct dvb_usb_device *d, +u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) +{ +int ret; +struct dvbsky_state *state = d_to_priv(d); + +mutex_lock(d-usb_mutex); +if (wlen != 0) +memcpy(state-obuf, wbuf, wlen); + +ret = dvb_usbv2_generic_rw_locked(d, state-obuf, wlen, +state-ibuf, rlen); + +if (!ret (rlen != 0)) +memcpy(rbuf, state-ibuf, rlen); + +mutex_unlock(d-usb_mutex); +return ret; +} + +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 }; + +mutex_lock(state-stream_mutex); +ret = dvbsky_usb_generic_rw(d, obuf_pre, 3, NULL, 0); +if (!ret onoff) { +msleep(20); +ret = dvbsky_usb_generic_rw(d, obuf_post, 3, NULL, 0); +} +mutex_unlock(state-stream_mutex); +return ret; +} + +static int dvbsky_streaming_ctrl(struct dvb_frontend *fe, int onoff) +{ +struct dvb_usb_device *d = fe_to_d(fe); + +return dvbsky_stream_ctrl(d, (onoff == 0) ? 0 : 1); +} + +/* GPIO
Re: [PATCH] m88ts2022: fix 32bit overflow on filter calc
It works with the high symbol rate transponders. Tested-by: Nibble Max nibble@gmail.com Maximum satellite symbol rate used is 4500Sps which overflows when multiplied by 135. As final calculation result is fraction, we could use mult_frac macro in order to keep calculation inside 32 bit number limits and prevent overflow. Original bug and fix was provided by Nibble Max. I decided to implement it differently as it is now. Reported-by: Nibble Max nibble@gmail.com Cc: sta...@kernel.org Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/media/tuners/m88ts2022.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/tuners/m88ts2022.c b/drivers/media/tuners/m88ts2022.c index 40c42de..7a62097 100644 --- a/drivers/media/tuners/m88ts2022.c +++ b/drivers/media/tuners/m88ts2022.c @@ -314,7 +314,7 @@ static int m88ts2022_set_params(struct dvb_frontend *fe) div_min = gdiv28 * 78 / 100; div_max = clamp_val(div_max, 0U, 63U); - f_3db_hz = c-symbol_rate * 135UL / 200UL; + f_3db_hz = mult_frac(c-symbol_rate, 135, 200); f_3db_hz += 200U + (frequency_offset_khz * 1000U); f_3db_hz = clamp(f_3db_hz, 700U, 4000U); -- http://palosaari.fi/ attachment: nibble.max(1).vcf
Re: [PATCH 6/6] m88ds3103: change .set_voltage() implementation
It is easier to understand for using voltage_dis to keep the same logic for voltage selection and off/on. Add some error checking and implement functionality a little bit differently. Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/media/dvb-frontends/m88ds3103.c | 50 ++--- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c index 238b04e..d8fbdfd 100644 --- a/drivers/media/dvb-frontends/m88ds3103.c +++ b/drivers/media/dvb-frontends/m88ds3103.c @@ -1038,36 +1038,54 @@ err: } static int m88ds3103_set_voltage(struct dvb_frontend *fe, - fe_sec_voltage_t voltage) + fe_sec_voltage_t fe_sec_voltage) { struct m88ds3103_priv *priv = fe-demodulator_priv; - u8 data; + int ret; + u8 u8tmp; + bool voltage_sel, voltage_en; bool voltage_sel, voltage_dis; - m88ds3103_rd_reg(priv, 0xa2, data); + dev_dbg(priv-i2c-dev, %s: fe_sec_voltage=%d\n, __func__, + fe_sec_voltage); - data = ~0x03; /* bit0 V/H, bit1 off/on */ - if (priv-cfg-lnb_en_pol) - data |= 0x02; + if (!priv-warm) { + ret = -EAGAIN; + goto err; + } - switch (voltage) { + switch (fe_sec_voltage) { case SEC_VOLTAGE_18: - if (priv-cfg-lnb_hv_pol == 0) - data |= 0x01; + voltage_sel = 1; + voltage_en = 1; voltage_dis = 0; break; case SEC_VOLTAGE_13: - if (priv-cfg-lnb_hv_pol) - data |= 0x01; + voltage_sel = 0; + voltage_en = 1; voltage_dis = 0; break; case SEC_VOLTAGE_OFF: - if (priv-cfg-lnb_en_pol) - data = ~0x02; - else - data |= 0x02; + voltage_sel = 0; + voltage_en = 0; voltage_dis = 1; break; + default: + dev_dbg(priv-i2c-dev, %s: invalid fe_sec_voltage\n, + __func__); + ret = -EINVAL; + goto err; } - m88ds3103_wr_reg(priv, 0xa2, data); + + /* output pin polarity */ + voltage_sel ^= priv-cfg-lnb_hv_pol; + voltage_en ^= !priv-cfg-lnb_en_pol; voltage_dis ^= priv-cfg-lnb_en_pol; + + u8tmp = voltage_en 1 | voltage_sel 0; u8tmp = voltage_dis 1 | voltage_sel 0; + ret = m88ds3103_wr_reg_mask(priv, 0xa2, u8tmp, 0x03); + if (ret) + goto err; return 0; +err: + dev_dbg(priv-i2c-dev, %s: failed=%d\n, __func__, ret); + return ret; } static int m88ds3103_diseqc_send_master_cmd(struct dvb_frontend *fe, -- http://palosaari.fi/ -- 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 -- 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