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

Commit 18c73af6 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[media] cx25821: remove unused fields, ioctls



Do some spring cleaning:
- there are no board defines with tuners, so remove bogus tuner support.
- tv standard handling has nothing to do with tuners, so keep that.
- replace the deprecated current_norm by g_std.
- querystd isn't implemented, so remove the ioctl.
- remove a bunch of unused fields in cx25821.h

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ffd3c233
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -30,7 +30,6 @@
#include <media/cx25840.h>
#include <media/cx25840.h>


#include "cx25821.h"
#include "cx25821.h"
#include "tuner-xc2028.h"


/* board config info */
/* board config info */


+10 −120
Original line number Original line Diff line number Diff line
@@ -138,7 +138,6 @@ void cx25821_video_wakeup(struct cx25821_dev *dev, struct cx25821_dmaqueue *q,
		pr_err("%s: %d buffers handled (should be 1)\n", __func__, bc);
		pr_err("%s: %d buffers handled (should be 1)\n", __func__, bc);
}
}


#ifdef TUNER_FLAG
int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm)
int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm)
{
{
	dprintk(1, "%s(norm = 0x%08x) name: [%s]\n",
	dprintk(1, "%s(norm = 0x%08x) name: [%s]\n",
@@ -151,7 +150,6 @@ int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm)


	return 0;
	return 0;
}
}
#endif


struct video_device *cx25821_vdev_init(struct cx25821_dev *dev,
struct video_device *cx25821_vdev_init(struct cx25821_dev *dev,
				       struct pci_dev *pci,
				       struct pci_dev *pci,
@@ -1036,8 +1034,6 @@ int cx25821_vidioc_querycap(struct file *file, void *priv,
	cap->version = CX25821_VERSION_CODE;
	cap->version = CX25821_VERSION_CODE;
	cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
	cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
		V4L2_CAP_STREAMING;
		V4L2_CAP_STREAMING;
	if (UNSET != dev->tuner_type)
		cap->capabilities |= V4L2_CAP_TUNER;
	return 0;
	return 0;
}
}


@@ -1093,7 +1089,14 @@ int cx25821_vidioc_s_priority(struct file *file, void *f,
			prio);
			prio);
}
}


#ifdef TUNER_FLAG
int cx25821_vidioc_g_std(struct file *file, void *priv, v4l2_std_id *tvnorms)
{
	struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;

	*tvnorms = dev->tvnorm;
	return 0;
}

int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
{
{
	struct cx25821_fh *fh = priv;
	struct cx25821_fh *fh = priv;
@@ -1120,7 +1123,6 @@ int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)


	return 0;
	return 0;
}
}
#endif


int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i)
int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i)
{
{
@@ -1189,57 +1191,6 @@ int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i)
	return 0;
	return 0;
}
}


#ifdef TUNER_FLAG
int cx25821_vidioc_g_frequency(struct file *file, void *priv,
			       struct v4l2_frequency *f)
{
	struct cx25821_fh *fh = priv;
	struct cx25821_dev *dev = fh->dev;

	f->frequency = dev->freq;

	cx25821_call_all(dev, tuner, g_frequency, f);

	return 0;
}

int cx25821_set_freq(struct cx25821_dev *dev, const struct v4l2_frequency *f)
{
	mutex_lock(&dev->lock);
	dev->freq = f->frequency;

	cx25821_call_all(dev, tuner, s_frequency, f);

	/* When changing channels it is required to reset TVAUDIO */
	msleep(10);

	mutex_unlock(&dev->lock);

	return 0;
}

int cx25821_vidioc_s_frequency(struct file *file, void *priv,
			       const struct v4l2_frequency *f)
{
	struct cx25821_fh *fh = priv;
	struct cx25821_dev *dev;
	int err;

	if (fh) {
		dev = fh->dev;
		err = v4l2_prio_check(&dev->channels[fh->channel_id].prio,
				      fh->prio);
		if (0 != err)
			return err;
	} else {
		pr_err("Invalid fh pointer!\n");
		return -EINVAL;
	}

	return cx25821_set_freq(dev, f);
}
#endif

#ifdef CONFIG_VIDEO_ADV_DEBUG
#ifdef CONFIG_VIDEO_ADV_DEBUG
int cx25821_vidioc_g_register(struct file *file, void *fh,
int cx25821_vidioc_g_register(struct file *file, void *fh,
		      struct v4l2_dbg_register *reg)
		      struct v4l2_dbg_register *reg)
@@ -1269,48 +1220,6 @@ int cx25821_vidioc_s_register(struct file *file, void *fh,


#endif
#endif


#ifdef TUNER_FLAG
int cx25821_vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
{
	struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;

	if (unlikely(UNSET == dev->tuner_type))
		return -EINVAL;
	if (0 != t->index)
		return -EINVAL;

	strcpy(t->name, "Television");
	t->type = V4L2_TUNER_ANALOG_TV;
	t->capability = V4L2_TUNER_CAP_NORM;
	t->rangehigh = 0xffffffffUL;

	t->signal = 0xffff;	/* LOCKED */
	return 0;
}

int cx25821_vidioc_s_tuner(struct file *file, void *priv, const struct v4l2_tuner *t)
{
	struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
	struct cx25821_fh *fh = priv;
	int err;

	if (fh) {
		err = v4l2_prio_check(&dev->channels[fh->channel_id].prio,
				      fh->prio);
		if (0 != err)
			return err;
	}

	dprintk(1, "%s()\n", __func__);
	if (UNSET == dev->tuner_type)
		return -EINVAL;
	if (0 != t->index)
		return -EINVAL;

	return 0;
}

#endif
/*****************************************************************************/
/*****************************************************************************/
static const struct v4l2_queryctrl no_ctl = {
static const struct v4l2_queryctrl no_ctl = {
	.name = "42",
	.name = "42",
@@ -1523,14 +1432,6 @@ int cx25821_vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop)
	return -EINVAL;
	return -EINVAL;
}
}


int cx25821_vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm)
{
	/* medusa does not support video standard sensing of current input */
	*norm = CX25821_NORMS;

	return 0;
}

int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm)
int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm)
{
{
	if (tvnorm == V4L2_STD_PAL_BG) {
	if (tvnorm == V4L2_STD_PAL_BG) {
@@ -1842,10 +1743,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
	.vidioc_querybuf = cx25821_vidioc_querybuf,
	.vidioc_querybuf = cx25821_vidioc_querybuf,
	.vidioc_qbuf = cx25821_vidioc_qbuf,
	.vidioc_qbuf = cx25821_vidioc_qbuf,
	.vidioc_dqbuf = vidioc_dqbuf,
	.vidioc_dqbuf = vidioc_dqbuf,
#ifdef TUNER_FLAG
	.vidioc_g_std = cx25821_vidioc_g_std,
	.vidioc_s_std = cx25821_vidioc_s_std,
	.vidioc_s_std = cx25821_vidioc_s_std,
	.vidioc_querystd = cx25821_vidioc_querystd,
#endif
	.vidioc_cropcap = cx25821_vidioc_cropcap,
	.vidioc_cropcap = cx25821_vidioc_cropcap,
	.vidioc_s_crop = cx25821_vidioc_s_crop,
	.vidioc_s_crop = cx25821_vidioc_s_crop,
	.vidioc_g_crop = cx25821_vidioc_g_crop,
	.vidioc_g_crop = cx25821_vidioc_g_crop,
@@ -1860,12 +1759,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
	.vidioc_log_status = vidioc_log_status,
	.vidioc_log_status = vidioc_log_status,
	.vidioc_g_priority = cx25821_vidioc_g_priority,
	.vidioc_g_priority = cx25821_vidioc_g_priority,
	.vidioc_s_priority = cx25821_vidioc_s_priority,
	.vidioc_s_priority = cx25821_vidioc_s_priority,
#ifdef TUNER_FLAG
	.vidioc_g_tuner = cx25821_vidioc_g_tuner,
	.vidioc_s_tuner = cx25821_vidioc_s_tuner,
	.vidioc_g_frequency = cx25821_vidioc_g_frequency,
	.vidioc_s_frequency = cx25821_vidioc_s_frequency,
#endif
#ifdef CONFIG_VIDEO_ADV_DEBUG
#ifdef CONFIG_VIDEO_ADV_DEBUG
	.vidioc_g_register = cx25821_vidioc_g_register,
	.vidioc_g_register = cx25821_vidioc_g_register,
	.vidioc_s_register = cx25821_vidioc_s_register,
	.vidioc_s_register = cx25821_vidioc_s_register,
@@ -1878,7 +1771,6 @@ static const struct video_device cx25821_video_device = {
	.minor = -1,
	.minor = -1,
	.ioctl_ops = &video_ioctl_ops,
	.ioctl_ops = &video_ioctl_ops,
	.tvnorms = CX25821_NORMS,
	.tvnorms = CX25821_NORMS,
	.current_norm = V4L2_STD_NTSC_M,
};
};


void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
@@ -1953,10 +1845,8 @@ int cx25821_video_register(struct cx25821_dev *dev)


	/* initial device configuration */
	/* initial device configuration */
	mutex_lock(&dev->lock);
	mutex_lock(&dev->lock);
#ifdef TUNER_FLAG
	dev->tvnorm = V4L2_STD_NTSC_M,
	dev->tvnorm = cx25821_video_device.current_norm;
	cx25821_set_tvnorm(dev, dev->tvnorm);
	cx25821_set_tvnorm(dev, dev->tvnorm);
#endif
	mutex_unlock(&dev->lock);
	mutex_unlock(&dev->lock);


	return 0;
	return 0;
+0 −13
Original line number Original line Diff line number Diff line
@@ -40,8 +40,6 @@
#include <media/v4l2-common.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-ioctl.h>


#define TUNER_FLAG

#define VIDEO_DEBUG 0
#define VIDEO_DEBUG 0


#define dprintk(level, fmt, arg...)					\
#define dprintk(level, fmt, arg...)					\
@@ -88,9 +86,7 @@ extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM];
extern void cx25821_video_wakeup(struct cx25821_dev *dev,
extern void cx25821_video_wakeup(struct cx25821_dev *dev,
				 struct cx25821_dmaqueue *q, u32 count);
				 struct cx25821_dmaqueue *q, u32 count);


#ifdef TUNER_FLAG
extern int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm);
extern int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm);
#endif


extern int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh,
extern int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh,
			   unsigned int bit);
			   unsigned int bit);
@@ -146,19 +142,10 @@ extern int cx25821_vidioc_g_ctrl(struct file *file, void *priv,
				 struct v4l2_control *ctl);
				 struct v4l2_control *ctl);
extern int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv,
extern int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv,
					struct v4l2_format *f);
					struct v4l2_format *f);
extern int cx25821_vidioc_g_frequency(struct file *file, void *priv,
				      struct v4l2_frequency *f);
extern int cx25821_set_freq(struct cx25821_dev *dev, const struct v4l2_frequency *f);
extern int cx25821_vidioc_s_frequency(struct file *file, void *priv,
				      const struct v4l2_frequency *f);
extern int cx25821_vidioc_g_register(struct file *file, void *fh,
extern int cx25821_vidioc_g_register(struct file *file, void *fh,
				     struct v4l2_dbg_register *reg);
				     struct v4l2_dbg_register *reg);
extern int cx25821_vidioc_s_register(struct file *file, void *fh,
extern int cx25821_vidioc_s_register(struct file *file, void *fh,
				     const struct v4l2_dbg_register *reg);
				     const struct v4l2_dbg_register *reg);
extern int cx25821_vidioc_g_tuner(struct file *file, void *priv,
				  struct v4l2_tuner *t);
extern int cx25821_vidioc_s_tuner(struct file *file, void *priv,
				  const struct v4l2_tuner *t);


extern int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm);
extern int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm);
extern int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm);
extern int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm);
+0 −18
Original line number Original line Diff line number Diff line
@@ -33,7 +33,6 @@


#include <media/v4l2-common.h>
#include <media/v4l2-common.h>
#include <media/v4l2-device.h>
#include <media/v4l2-device.h>
#include <media/tuner.h>
#include <media/tveeprom.h>
#include <media/tveeprom.h>
#include <media/videobuf-dma-sg.h>
#include <media/videobuf-dma-sg.h>
#include <media/videobuf-dvb.h>
#include <media/videobuf-dvb.h>
@@ -43,7 +42,6 @@
#include "cx25821-medusa-reg.h"
#include "cx25821-medusa-reg.h"
#include "cx25821-sram.h"
#include "cx25821-sram.h"
#include "cx25821-audio.h"
#include "cx25821-audio.h"
#include "media/cx2341x.h"


#include <linux/version.h>
#include <linux/version.h>
#include <linux/mutex.h>
#include <linux/mutex.h>
@@ -184,8 +182,6 @@ struct cx25821_board {
	enum port porta;
	enum port porta;
	enum port portb;
	enum port portb;
	enum port portc;
	enum port portc;
	unsigned int tuner_type;
	unsigned char tuner_addr;


	u32 clk_freq;
	u32 clk_freq;
	struct cx25821_input input[CX25821_NR_INPUT];
	struct cx25821_input input[CX25821_NR_INPUT];
@@ -283,12 +279,7 @@ struct cx25821_dev {
	/* Analog video */
	/* Analog video */
	u32 resources;
	u32 resources;
	unsigned int input;
	unsigned int input;
	u32 tvaudio;
	v4l2_std_id tvnorm;
	v4l2_std_id tvnorm;
	unsigned int tuner_type;
	unsigned char tuner_addr;
	unsigned int videc_type;
	unsigned char videc_addr;
	unsigned short _max_num_decoders;
	unsigned short _max_num_decoders;


	/* Analog Audio Upstream */
	/* Analog Audio Upstream */
@@ -314,8 +305,6 @@ struct cx25821_dev {
	char *_audiofilename;
	char *_audiofilename;


	/* V4l */
	/* V4l */
	u32 freq;

	spinlock_t slock;
	spinlock_t slock;


	/* Video Upstream */
	/* Video Upstream */
@@ -363,13 +352,6 @@ struct cx25821_dev {
	char *_filename_ch2;
	char *_filename_ch2;
	char *_defaultname_ch2;
	char *_defaultname_ch2;


	/* MPEG Encoder ONLY settings */
	u32 cx23417_mailbox;
	struct cx2341x_mpeg_params mpeg_params;
	struct video_device *v4l_device;
	atomic_t v4l_reader_count;
	struct cx25821_tvnorm encodernorm;

	u32 upstream_riscbuf_size;
	u32 upstream_riscbuf_size;
	u32 upstream_databuf_size;
	u32 upstream_databuf_size;
	u32 upstream_riscbuf_size_ch2;
	u32 upstream_riscbuf_size_ch2;