All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] radio-sf16fmi: Fix remaining v4l2-compliance problems
@ 2013-06-14 21:01 Ondrej Zary
  2013-06-14 21:01 ` [PATCH 1/2] radio-sf16fmi: Add module name to bus_info Ondrej Zary
  2013-06-14 21:01 ` [PATCH 2/2] radio-sf16fmi: Set frequency during init Ondrej Zary
  0 siblings, 2 replies; 3+ messages in thread
From: Ondrej Zary @ 2013-06-14 21:01 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil


These patches fix two remaining v4l2-compliance problems of radio-sf16fmi driver after
control framework conversion:
http://www.mail-archive.com/linux-media%40vger.kernel.org/msg62772.html

Tested with SF16-FMI card.

-- 
Ondrej Zary

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] radio-sf16fmi: Add module name to bus_info
  2013-06-14 21:01 [PATCH 0/2] radio-sf16fmi: Fix remaining v4l2-compliance problems Ondrej Zary
@ 2013-06-14 21:01 ` Ondrej Zary
  2013-06-14 21:01 ` [PATCH 2/2] radio-sf16fmi: Set frequency during init Ondrej Zary
  1 sibling, 0 replies; 3+ messages in thread
From: Ondrej Zary @ 2013-06-14 21:01 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

Fix v4l2-compliance in VIDIOC_QUERYCAP by changing "ISA" to "ISA:radio-sf16fmi".

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
 drivers/media/radio/radio-sf16fmi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c
index 9e712c8..ed7299d 100644
--- a/drivers/media/radio/radio-sf16fmi.c
+++ b/drivers/media/radio/radio-sf16fmi.c
@@ -123,7 +123,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
 {
 	strlcpy(v->driver, "radio-sf16fmi", sizeof(v->driver));
 	strlcpy(v->card, "SF16-FMI/FMP/FMD radio", sizeof(v->card));
-	strlcpy(v->bus_info, "ISA", sizeof(v->bus_info));
+	strlcpy(v->bus_info, "ISA:radio-sf16fmi", sizeof(v->bus_info));
 	v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
 	v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
-- 
Ondrej Zary


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] radio-sf16fmi: Set frequency during init
  2013-06-14 21:01 [PATCH 0/2] radio-sf16fmi: Fix remaining v4l2-compliance problems Ondrej Zary
  2013-06-14 21:01 ` [PATCH 1/2] radio-sf16fmi: Add module name to bus_info Ondrej Zary
@ 2013-06-14 21:01 ` Ondrej Zary
  1 sibling, 0 replies; 3+ messages in thread
From: Ondrej Zary @ 2013-06-14 21:01 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

Set freqency during initialization to fix v4l2-compliance error.
This also fixes VIDIOC_G_FREQUENCY always returning zero (broken by me during LM7000 conversion).

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
 drivers/media/radio/radio-sf16fmi.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c
index ed7299d..6f4318f 100644
--- a/drivers/media/radio/radio-sf16fmi.c
+++ b/drivers/media/radio/radio-sf16fmi.c
@@ -50,7 +50,7 @@ struct fmi
 	struct video_device vdev;
 	int io;
 	bool mute;
-	unsigned long curfreq; /* freq in kHz */
+	u32 curfreq; /* freq in kHz */
 	struct mutex lock;
 };
 
@@ -118,6 +118,14 @@ static inline int fmi_getsigstr(struct fmi *fmi)
 	return (res & 2) ? 0 : 0xFFFF;
 }
 
+static void fmi_set_freq(struct fmi *fmi)
+{
+	fmi->curfreq = clamp(fmi->curfreq, RSF16_MINFREQ, RSF16_MAXFREQ);
+	/* rounding in steps of 800 to match the freq
+	   that will be used */
+	lm7000_set_freq((fmi->curfreq / 800) * 800, fmi, fmi_set_pins);
+}
+
 static int vidioc_querycap(struct file *file, void  *priv,
 					struct v4l2_capability *v)
 {
@@ -158,14 +166,13 @@ static int vidioc_s_frequency(struct file *file, void *priv,
 					const struct v4l2_frequency *f)
 {
 	struct fmi *fmi = video_drvdata(file);
-	unsigned freq = f->frequency;
 
 	if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
 		return -EINVAL;
-	clamp(freq, RSF16_MINFREQ, RSF16_MAXFREQ);
-	/* rounding in steps of 800 to match the freq
-	   that will be used */
-	lm7000_set_freq((freq / 800) * 800, fmi, fmi_set_pins);
+
+	fmi->curfreq = f->frequency;
+	fmi_set_freq(fmi);
+
 	return 0;
 }
 
@@ -342,8 +349,10 @@ static int __init fmi_init(void)
 
 	mutex_init(&fmi->lock);
 
-	/* mute card - prevents noisy bootups */
-	fmi_mute(fmi);
+	/* mute card and set default frequency */
+	fmi->mute = 1;
+	fmi->curfreq = RSF16_MINFREQ;
+	fmi_set_freq(fmi);
 
 	if (video_register_device(&fmi->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
 		v4l2_ctrl_handler_free(hdl);
-- 
Ondrej Zary


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-14 21:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-14 21:01 [PATCH 0/2] radio-sf16fmi: Fix remaining v4l2-compliance problems Ondrej Zary
2013-06-14 21:01 ` [PATCH 1/2] radio-sf16fmi: Add module name to bus_info Ondrej Zary
2013-06-14 21:01 ` [PATCH 2/2] radio-sf16fmi: Set frequency during init Ondrej Zary

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.