Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29f8a0a5 authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (13086): cx23885: Add skeleton v4l2_subdev for the CX23888 integrated IR controller



This change adds a skeletal implementation of a v4l2_subdevice to provide
encapsulation and abstraction of the CX23888's integrated consumer infrared
controller.  This change also instantiates the cx23888_ir subdev for the
HVR-1850 which has IR hardware physically wired up to a CX23888.

The cx23888_ir subdev code is being written with long-term objectives to:
1. port it to the cx25840 module for the CX2584x, CX2583x, CX23885, & CX231xx
   IR controllers
2. possibly port it to the cx18 module for the CX23418 IR controller
3. have the IR subdevice accessed abstractly in the cx23885 module, so the
   driver can ignore the difference between the CX23885 and CX23888.

Signed-off-by: default avatarAndy Walls <awalls@radix.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 74618244
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
cx23885-objs	:= cx23885-cards.o cx23885-video.o cx23885-vbi.o \
		    cx23885-core.o cx23885-i2c.o cx23885-dvb.o cx23885-417.o \
		    cx23885-ioctl.o \
		    cx23885-ioctl.o cx23888-ir.o \
		    netup-init.o cimax2.o netup-eeprom.o

obj-$(CONFIG_VIDEO_CX23885) += cx23885.o
+9 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include "cx23885.h"
#include "tuner-xc2028.h"
#include "netup-init.h"
#include "cx23888-ir.h"

/* ------------------------------------------------------------------ */
/* board config info                                                  */
@@ -801,6 +802,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)

int cx23885_ir_init(struct cx23885_dev *dev)
{
	int ret = 0;
	switch (dev->board) {
	case CX23885_BOARD_HAUPPAUGE_HVR1250:
	case CX23885_BOARD_HAUPPAUGE_HVR1500:
@@ -812,15 +814,20 @@ int cx23885_ir_init(struct cx23885_dev *dev)
	case CX23885_BOARD_HAUPPAUGE_HVR1275:
	case CX23885_BOARD_HAUPPAUGE_HVR1255:
	case CX23885_BOARD_HAUPPAUGE_HVR1210:
	case CX23885_BOARD_HAUPPAUGE_HVR1850:
		/* FIXME: Implement me */
		break;
	case CX23885_BOARD_HAUPPAUGE_HVR1850:
		ret = cx23888_ir_probe(dev);
		if (ret)
			break;
		dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR);
		break;
	case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
		request_module("ir-kbd-i2c");
		break;
	}

	return 0;
	return ret;
}

void cx23885_card_setup(struct cx23885_dev *dev)
+20 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@

#include "cx23885.h"
#include "cimax2.h"
#include "cx23888-ir.h"

MODULE_DESCRIPTION("Driver for cx23885 based TV cards");
MODULE_AUTHOR("Steven Toth <stoth@linuxtv.org>");
@@ -753,6 +754,23 @@ static void cx23885_dev_checkrevision(struct cx23885_dev *dev)
			__func__, dev->hwrevision);
}

/* Find the first v4l2_subdev member of the group id in hw */
struct v4l2_subdev *cx23885_find_hw(struct cx23885_dev *dev, u32 hw)
{
	struct v4l2_subdev *result = NULL;
	struct v4l2_subdev *sd;

	spin_lock(&dev->v4l2_dev.lock);
	v4l2_device_for_each_subdev(sd, &dev->v4l2_dev) {
		if (sd->grp_id == hw) {
			result = sd;
			break;
		}
	}
	spin_unlock(&dev->v4l2_dev.lock);
	return result;
}

static int cx23885_dev_setup(struct cx23885_dev *dev)
{
	int i;
@@ -1914,6 +1932,8 @@ static void __devexit cx23885_finidev(struct pci_dev *pci_dev)

	cx23885_shutdown(dev);

	cx23888_ir_remove(dev);

	pci_disable_device(pci_dev);

	/* unregister stuff */
+11 −0
Original line number Diff line number Diff line
@@ -65,6 +65,17 @@ int cx23885_g_chip_ident(struct file *file, void *fh,
				chip->revision = 0;
			}
			break;
		case 2:
			/*
			 * The integrated IR controller on the CX23888 is
			 * host chip 2.  It may not be used/initialized or sd_ir
			 * may be pointing at the cx25840 subdevice for the
			 * IR controller on the CX23885.  Thus we find it
			 * without using the dev->sd_ir pointer.
			 */
			call_hw(dev, CX23885_HW_888_IR, core, g_chip_ident,
				chip);
			break;
		default:
			err = -EINVAL; /* per V4L2 spec */
			break;
+8 −0
Original line number Diff line number Diff line
@@ -355,6 +355,7 @@ struct cx23885_dev {
	unsigned char              radio_addr;
	unsigned int               has_radio;
	struct v4l2_subdev 	   *sd_cx25840;
	struct v4l2_subdev 	   *sd_ir;

	/* V4l */
	u32                        freq;
@@ -383,6 +384,13 @@ static inline struct cx23885_dev *to_cx23885(struct v4l2_device *v4l2_dev)
#define call_all(dev, o, f, args...) \
	v4l2_device_call_all(&dev->v4l2_dev, 0, o, f, ##args)

#define CX23885_HW_888_IR (1 << 0)

#define call_hw(dev, grpid, o, f, args...) \
	v4l2_device_call_all(&dev->v4l2_dev, grpid, o, f, ##args)

extern struct v4l2_subdev *cx23885_find_hw(struct cx23885_dev *dev, u32 hw);

extern struct list_head cx23885_devlist;

#define SRAM_CH01  0 /* Video A */
Loading