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

Commit 4839c58f authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

media: v4l2-dev: convert VFL_TYPE_* into an enum



Using enums makes easier to document, as it can use kernel-doc
markups. It also allows cross-referencing, with increases the
kAPI readability.

Please notice that now cx88_querycap() has to have a default for
the VFL type, as there are more types than supported by the driver.

Acked-By: default avatarMike Isely <isely@pobox.com>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 2120961f
Loading
Loading
Loading
Loading
+12 −5
Original line number Original line Diff line number Diff line
@@ -196,11 +196,18 @@ device.
Which device is registered depends on the type argument. The following
Which device is registered depends on the type argument. The following
types exist:
types exist:


- ``VFL_TYPE_GRABBER``: ``/dev/videoX`` for video input/output devices
========================== ====================	 ==============================
- ``VFL_TYPE_VBI``: ``/dev/vbiX`` for vertical blank data (i.e. closed captions, teletext)
:c:type:`vfl_devnode_type` Device name		 Usage
- ``VFL_TYPE_RADIO``: ``/dev/radioX`` for radio tuners
========================== ====================	 ==============================
- ``VFL_TYPE_SDR``: ``/dev/swradioX`` for Software Defined Radio tuners
``VFL_TYPE_GRABBER``       ``/dev/videoX``       for video input/output devices
- ``VFL_TYPE_TOUCH``: ``/dev/v4l-touchX`` for touch sensors
``VFL_TYPE_VBI``           ``/dev/vbiX``         for vertical blank data (i.e.
						 closed captions, teletext)
``VFL_TYPE_RADIO``         ``/dev/radioX``       for radio tuners
``VFL_TYPE_SUBDEV``        ``/dev/v4l-subdevX``  for V4L2 subdevices
``VFL_TYPE_SDR``           ``/dev/swradioX``     for Software Defined Radio
						 (SDR) tuners
``VFL_TYPE_TOUCH``         ``/dev/v4l-touchX``   for touch sensors
========================== ====================	 ==============================


The last argument gives you a certain amount of control over the device
The last argument gives you a certain amount of control over the device
device node number used (i.e. the X in ``videoX``). Normally you will pass -1
device node number used (i.e. the X in ``videoX``). Normally you will pass -1
+1 −2
Original line number Original line Diff line number Diff line
@@ -805,8 +805,7 @@ static int vidioc_querycap(struct file *file, void *priv,


	strcpy(cap->driver, "cx88_blackbird");
	strcpy(cap->driver, "cx88_blackbird");
	sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
	sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
	cx88_querycap(file, core, cap);
	return cx88_querycap(file, core, cap);
	return 0;
}
}


static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
+6 −4
Original line number Original line Diff line number Diff line
@@ -806,7 +806,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
	return 0;
	return 0;
}
}


void cx88_querycap(struct file *file, struct cx88_core *core,
int cx88_querycap(struct file *file, struct cx88_core *core,
		  struct v4l2_capability *cap)
		  struct v4l2_capability *cap)
{
{
	struct video_device *vdev = video_devdata(file);
	struct video_device *vdev = video_devdata(file);
@@ -825,11 +825,14 @@ void cx88_querycap(struct file *file, struct cx88_core *core,
	case VFL_TYPE_VBI:
	case VFL_TYPE_VBI:
		cap->device_caps |= V4L2_CAP_VBI_CAPTURE;
		cap->device_caps |= V4L2_CAP_VBI_CAPTURE;
		break;
		break;
	default:
		return -EINVAL;
	}
	}
	cap->capabilities = cap->device_caps | V4L2_CAP_VIDEO_CAPTURE |
	cap->capabilities = cap->device_caps | V4L2_CAP_VIDEO_CAPTURE |
		V4L2_CAP_VBI_CAPTURE | V4L2_CAP_DEVICE_CAPS;
		V4L2_CAP_VBI_CAPTURE | V4L2_CAP_DEVICE_CAPS;
	if (core->board.radio.type == CX88_RADIO)
	if (core->board.radio.type == CX88_RADIO)
		cap->capabilities |= V4L2_CAP_RADIO;
		cap->capabilities |= V4L2_CAP_RADIO;
	return 0;
}
}
EXPORT_SYMBOL(cx88_querycap);
EXPORT_SYMBOL(cx88_querycap);


@@ -841,8 +844,7 @@ static int vidioc_querycap(struct file *file, void *priv,


	strcpy(cap->driver, "cx8800");
	strcpy(cap->driver, "cx8800");
	sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
	sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
	cx88_querycap(file, core, cap);
	return cx88_querycap(file, core, cap);
	return 0;
}
}


static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
+2 −2
Original line number Original line Diff line number Diff line
@@ -734,7 +734,7 @@ int cx8802_start_dma(struct cx8802_dev *dev,
int cx88_enum_input(struct cx88_core *core, struct v4l2_input *i);
int cx88_enum_input(struct cx88_core *core, struct v4l2_input *i);
int cx88_set_freq(struct cx88_core  *core, const struct v4l2_frequency *f);
int cx88_set_freq(struct cx88_core  *core, const struct v4l2_frequency *f);
int cx88_video_mux(struct cx88_core *core, unsigned int input);
int cx88_video_mux(struct cx88_core *core, unsigned int input);
void cx88_querycap(struct file *file, struct cx88_core *core,
int cx88_querycap(struct file *file, struct cx88_core *core,
		  struct v4l2_capability *cap);
		  struct v4l2_capability *cap);


#endif
#endif
+2 −0
Original line number Original line Diff line number Diff line
@@ -1531,6 +1531,8 @@ int saa7134_querycap(struct file *file, void *priv,
	case VFL_TYPE_VBI:
	case VFL_TYPE_VBI:
		cap->device_caps |= vbi_caps;
		cap->device_caps |= vbi_caps;
		break;
		break;
	default:
		return -EINVAL;
	}
	}
	cap->capabilities = radio_caps | video_caps | vbi_caps |
	cap->capabilities = radio_caps | video_caps | vbi_caps |
		cap->device_caps | V4L2_CAP_DEVICE_CAPS;
		cap->device_caps | V4L2_CAP_DEVICE_CAPS;
Loading