Skip to contentSkip to conversation

SMI PCIe IR driver for DVBSky cards

PATCH In review Nibble Max 2 participants 3 messages Jun 29, 2015 – Jun 30, 2015 Media (V4L/DVB)

lore
Share & tools
lore

Nibble Max

author
#0 lore raw

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.

---
 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%)
drivers/media/pci/smipcie/Kconfig +1 -0
index 21a1583..c11c772 100644
@@ -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
drivers/media/pci/smipcie/Makefile +3 -0
index be55481..013bc3f 100644
@@ -1,3 +1,6 @@
+
+smipcie-objs	:= smipcie-main.o smipcie-ir.o
+
 obj-$(CONFIG_DVB_SMIPCIE) += smipcie.o
 
 ccflags-y += -Idrivers/media/tuners
drivers/media/pci/smipcie/smipcie-ir.c new file +232 -0

232 lines not on this page · raw message

drivers/media/pci/smipcie/smipcie-main.c renamed from drivers/media/pci/smipcie/smipcie.c +13 -1
similarity index 99%
rename from drivers/media/pci/smipcie/smipcie.c
rename to drivers/media/pci/smipcie/smipcie-main.c
index 143fd78..b039a22 100644
@@ -468,6 +468,7 @@ 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];
+	struct smi_rc *ir = &dev->ir;
 	int handled = 0;
 
 	u32 intr_status = smi_read(MSI_INT_STATUS);
@@ -480,6 +481,9 @@ static irqreturn_t smi_irq_handler(int irq, void *dev_id)
 	if (dev->info->ts_1)
 		handled += smi_port_irq(port1, intr_status);
 
+	/* ir interrupt.*/
+	handled += smi_ir_irq(ir, intr_status);
+
 	return IRQ_RETVAL(handled);
 }
 
@@ -993,6 +997,10 @@ static int smi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 			goto err_del_port0_attach;
 	}
 
+	ret = smi_ir_init(dev);
+	if (ret < 0)
+		goto err_del_port1_attach;
+
 #ifdef CONFIG_PCI_MSI /* to do msi interrupt.???*/
 	if (pci_msi_enabled())
 		ret = pci_enable_msi(dev->pci_dev);
@@ -1003,10 +1011,13 @@ static int smi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	ret = request_irq(dev->pci_dev->irq, smi_irq_handler,
 			   IRQF_SHARED, "SMI_PCIE", dev);
 	if (ret < 0)
-		goto err_del_port1_attach;
+		goto err_del_ir;
 
+	smi_ir_start(&dev->ir);
 	return 0;
 
+err_del_ir:
+	smi_ir_exit(dev);
 err_del_port1_attach:
 	if (dev->info->ts_1)
 		smi_port_detach(&dev->ts_port[1]);
@@ -1039,6 +1050,7 @@ static void smi_remove(struct pci_dev *pdev)
 	if (dev->info->ts_0)
 		smi_port_detach(&dev->ts_port[0]);
 
+	smi_ir_exit(dev);
 	smi_i2c_exit(dev);
 	iounmap(dev->lmmio);
 	pci_set_drvdata(pdev, NULL);
drivers/media/pci/smipcie/smipcie.h +19 -0
index 10cdf20..68cdda2 100644
@@ -234,6 +234,17 @@ struct smi_cfg_info {
 	int fe_1;
 };
 
+struct smi_rc {
+	struct smi_dev *dev;
+	struct rc_dev *rc_dev;
+	char input_phys[64];
+	char input_name[64];
+	struct work_struct work;
+	u8 irData[256];
+
+	int users;
+};
+
 struct smi_port {
 	struct smi_dev *dev;
 	int idx;
@@ -284,6 +295,9 @@ struct smi_dev {
 	/* i2c */
 	struct i2c_adapter i2c_bus[2];
 	struct i2c_algo_bit_data i2c_bit[2];
+
+	/* ir */
+	struct smi_rc ir;
 };
 
 #define smi_read(reg)             readl(dev->lmmio + ((reg)>>2))
@@ -296,4 +310,9 @@ struct smi_dev {
 #define smi_set(reg, bit)          smi_andor((reg), (bit), (bit))
 #define smi_clear(reg, bit)        smi_andor((reg), (bit), 0)
 
+int smi_ir_irq(struct smi_rc *ir, u32 int_status);
+void smi_ir_start(struct smi_rc *ir);
+void smi_ir_exit(struct smi_dev *dev);
+int smi_ir_init(struct smi_dev *dev);
+
 #endif /* #ifndef _SMI_PCIE_H_ */
Signature · 1 line
1.8.3.1
#1 lore raw

Hi Max,

Am 29.06.2015 um 16:09 schrieb Nibble Max:

Quoted 4 lines

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

author
#2 lore raw
In reply to Nibble Max

Hello Ole,

Due to the hardware limitation, it can not support arbitrary IR codes. The current patch supports RC5 only.

Quoted 8 lines · Ole Ernst

Hi Max,

Am 29.06.2015 um 16:09 schrieb Nibble Max:

Quoted 4 lines

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.

Quoted 7 lines

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