[PATCH] New driver for the radio FM module on Miro PCM20 sound card

2009-11-27 Thread Krzysztof Helt
From: Krzysztof Helt krzysztof...@wp.pl

This is recreated driver for the FM module found on Miro
PCM20 sound cards. This driver was removed around the 2.6.2x
kernels because it relied on the removed OSS module. Now, it
uses a current ALSA module (snd-miro) and is adapted to v4l2
layer.

It provides only basic functionality: frequency changing and
FM module muting.

Signed-off-by: Krzysztof Helt krzysztof...@wp.pl
Reviewed-by: Hans Verkuil hverk...@xs4all.nl
---
This is the third version of the patch with fixed issues pointed
by Takashi Iwai.

 drivers/media/radio/Kconfig   |   18 +++
 drivers/media/radio/Makefile  |1 +
 drivers/media/radio/radio-miropcm20.c |  270 +
 3 files changed, 289 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/radio/radio-miropcm20.c

diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index a87a477..b134553 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -195,6 +195,24 @@ config RADIO_MAESTRO
  To compile this driver as a module, choose M here: the
  module will be called radio-maestro.
 
+config RADIO_MIROPCM20
+   tristate miroSOUND PCM20 radio
+   depends on ISA  VIDEO_V4L2
+   select SND_MIRO
+   ---help---
+ Choose Y here if you have this FM radio card. You also need to enable
+ the ALSA sound system. This choice automatically selects the ALSA
+ sound card driver Miro miroSOUND PCM1pro/PCM12/PCM20radio as this
+ is required for the radio-miropcm20.
+
+ In order to control your radio card, you will need to use programs
+ that are compatible with the Video For Linux API.  Information on
+ this API and pointers to v4l programs may be found at
+ file:Documentation/video4linux/API.html.
+
+ To compile this driver as a module, choose M here: the
+ module will be called radio-miropcm20.
+
 config RADIO_SF16FMI
tristate SF16FMI Radio
depends on ISA  VIDEO_V4L2
diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile
index 2a1be3b..8a63d54 100644
--- a/drivers/media/radio/Makefile
+++ b/drivers/media/radio/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_RADIO_TRUST) += radio-trust.o
 obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o
 obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o
 obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o
+obj-$(CONFIG_RADIO_MIROPCM20) += radio-miropcm20.o
 obj-$(CONFIG_USB_DSBR) += dsbr100.o
 obj-$(CONFIG_RADIO_SI470X) += si470x/
 obj-$(CONFIG_USB_MR800) += radio-mr800.o
diff --git a/drivers/media/radio/radio-miropcm20.c 
b/drivers/media/radio/radio-miropcm20.c
new file mode 100644
index 000..4ff8854
--- /dev/null
+++ b/drivers/media/radio/radio-miropcm20.c
@@ -0,0 +1,270 @@
+/* Miro PCM20 radio driver for Linux radio support
+ * (c) 1998 Ruurd Reitsma r.a.reit...@wbmt.tudelft.nl
+ * Thanks to Norberto Pellici for the ACI device interface specification
+ * The API part is based on the radiotrack driver by M. Kirkwood
+ * This driver relies on the aci mixer provided by the snd-miro
+ * ALSA driver.
+ * Look there for further info...
+ */
+
+/* What ever you think about the ACI, version 0x07 is not very well!
+ * I can't get frequency, 'tuner status', 'tuner flags' or mute/mono
+ * conditions...Robert
+ */
+
+#include linux/module.h
+#include linux/init.h
+#include linux/videodev2.h
+#include media/v4l2-device.h
+#include media/v4l2-ioctl.h
+#include sound/aci.h
+
+static int radio_nr = -1;
+module_param(radio_nr, int, 0);
+MODULE_PARM_DESC(radio_nr, Set radio device number (/dev/radioX).  Default: 
-1 (autodetect));
+
+static int mono;
+module_param(mono, bool, 0);
+MODULE_PARM_DESC(mono, Force tuner into mono mode.);
+
+struct pcm20 {
+   struct v4l2_device v4l2_dev;
+   struct video_device vdev;
+   unsigned long freq;
+   int muted;
+   struct snd_miro_aci *aci;
+};
+
+static struct pcm20 pcm20_card = {
+   .freq   = 87*16000,
+   .muted  = 1,
+};
+
+static int pcm20_mute(struct pcm20 *dev, unsigned char mute)
+{
+   dev-muted = mute;
+   return snd_aci_cmd(dev-aci, ACI_SET_TUNERMUTE, mute, -1);
+}
+
+static int pcm20_stereo(struct pcm20 *dev, unsigned char stereo)
+{
+   return snd_aci_cmd(dev-aci, ACI_SET_TUNERMONO, !stereo, -1);
+}
+
+static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq)
+{
+   unsigned char freql;
+   unsigned char freqh;
+   struct snd_miro_aci *aci = dev-aci;
+
+   dev-freq = freq;
+
+   freq /= 160;
+   if (!(aci-aci_version == 0x07 || aci-aci_version = 0xb0))
+   freq /= 10;  /* I don't know exactly which version
+ * needs this hack */
+   freql = freq  0xff;
+   freqh = freq  8;
+
+   pcm20_stereo(dev, !mono);
+   return snd_aci_cmd(aci, ACI_WRITE_TUNE, freql, freqh);
+}
+
+static const struct v4l2_file_operations pcm20_fops = {
+   .owner  

Re: [PATCH] New driver for the radio FM module on Miro PCM20 sound card

2009-11-27 Thread Takashi Iwai
At Fri, 27 Nov 2009 11:24:13 +0100,
Krzysztof Helt wrote:
 
 From: Krzysztof Helt krzysztof...@wp.pl
 
 This is recreated driver for the FM module found on Miro
 PCM20 sound cards. This driver was removed around the 2.6.2x
 kernels because it relied on the removed OSS module. Now, it
 uses a current ALSA module (snd-miro) and is adapted to v4l2
 layer.
 
 It provides only basic functionality: frequency changing and
 FM module muting.
 
 Signed-off-by: Krzysztof Helt krzysztof...@wp.pl
 Reviewed-by: Hans Verkuil hverk...@xs4all.nl
 ---
 This is the third version of the patch with fixed issues pointed
 by Takashi Iwai.

Thanks, I merged now this to sound tree exceptionally since it's purely
depends on snd-miro driver.  Will appear in the next linux-next.


Takashi

 
  drivers/media/radio/Kconfig   |   18 +++
  drivers/media/radio/Makefile  |1 +
  drivers/media/radio/radio-miropcm20.c |  270 
 +
  3 files changed, 289 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/radio/radio-miropcm20.c
 
 diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
 index a87a477..b134553 100644
 --- a/drivers/media/radio/Kconfig
 +++ b/drivers/media/radio/Kconfig
 @@ -195,6 +195,24 @@ config RADIO_MAESTRO
 To compile this driver as a module, choose M here: the
 module will be called radio-maestro.
  
 +config RADIO_MIROPCM20
 + tristate miroSOUND PCM20 radio
 + depends on ISA  VIDEO_V4L2
 + select SND_MIRO
 + ---help---
 +   Choose Y here if you have this FM radio card. You also need to enable
 +   the ALSA sound system. This choice automatically selects the ALSA
 +   sound card driver Miro miroSOUND PCM1pro/PCM12/PCM20radio as this
 +   is required for the radio-miropcm20.
 +
 +   In order to control your radio card, you will need to use programs
 +   that are compatible with the Video For Linux API.  Information on
 +   this API and pointers to v4l programs may be found at
 +   file:Documentation/video4linux/API.html.
 +
 +   To compile this driver as a module, choose M here: the
 +   module will be called radio-miropcm20.
 +
  config RADIO_SF16FMI
   tristate SF16FMI Radio
   depends on ISA  VIDEO_V4L2
 diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile
 index 2a1be3b..8a63d54 100644
 --- a/drivers/media/radio/Makefile
 +++ b/drivers/media/radio/Makefile
 @@ -18,6 +18,7 @@ obj-$(CONFIG_RADIO_TRUST) += radio-trust.o
  obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o
  obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o
  obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o
 +obj-$(CONFIG_RADIO_MIROPCM20) += radio-miropcm20.o
  obj-$(CONFIG_USB_DSBR) += dsbr100.o
  obj-$(CONFIG_RADIO_SI470X) += si470x/
  obj-$(CONFIG_USB_MR800) += radio-mr800.o
 diff --git a/drivers/media/radio/radio-miropcm20.c 
 b/drivers/media/radio/radio-miropcm20.c
 new file mode 100644
 index 000..4ff8854
 --- /dev/null
 +++ b/drivers/media/radio/radio-miropcm20.c
 @@ -0,0 +1,270 @@
 +/* Miro PCM20 radio driver for Linux radio support
 + * (c) 1998 Ruurd Reitsma r.a.reit...@wbmt.tudelft.nl
 + * Thanks to Norberto Pellici for the ACI device interface specification
 + * The API part is based on the radiotrack driver by M. Kirkwood
 + * This driver relies on the aci mixer provided by the snd-miro
 + * ALSA driver.
 + * Look there for further info...
 + */
 +
 +/* What ever you think about the ACI, version 0x07 is not very well!
 + * I can't get frequency, 'tuner status', 'tuner flags' or mute/mono
 + * conditions...Robert
 + */
 +
 +#include linux/module.h
 +#include linux/init.h
 +#include linux/videodev2.h
 +#include media/v4l2-device.h
 +#include media/v4l2-ioctl.h
 +#include sound/aci.h
 +
 +static int radio_nr = -1;
 +module_param(radio_nr, int, 0);
 +MODULE_PARM_DESC(radio_nr, Set radio device number (/dev/radioX).  Default: 
 -1 (autodetect));
 +
 +static int mono;
 +module_param(mono, bool, 0);
 +MODULE_PARM_DESC(mono, Force tuner into mono mode.);
 +
 +struct pcm20 {
 + struct v4l2_device v4l2_dev;
 + struct video_device vdev;
 + unsigned long freq;
 + int muted;
 + struct snd_miro_aci *aci;
 +};
 +
 +static struct pcm20 pcm20_card = {
 + .freq   = 87*16000,
 + .muted  = 1,
 +};
 +
 +static int pcm20_mute(struct pcm20 *dev, unsigned char mute)
 +{
 + dev-muted = mute;
 + return snd_aci_cmd(dev-aci, ACI_SET_TUNERMUTE, mute, -1);
 +}
 +
 +static int pcm20_stereo(struct pcm20 *dev, unsigned char stereo)
 +{
 + return snd_aci_cmd(dev-aci, ACI_SET_TUNERMONO, !stereo, -1);
 +}
 +
 +static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq)
 +{
 + unsigned char freql;
 + unsigned char freqh;
 + struct snd_miro_aci *aci = dev-aci;
 +
 + dev-freq = freq;
 +
 + freq /= 160;
 + if (!(aci-aci_version == 0x07 || aci-aci_version = 0xb0))
 + freq /= 10;  /* I don't know exactly which version
 +  

Re: [PATCH] New driver for the radio FM module on Miro PCM20 sound card

2009-11-27 Thread Mauro Carvalho Chehab
Krzysztof Helt wrote:
 From: Krzysztof Helt krzysztof...@wp.pl
 
 This is recreated driver for the FM module found on Miro
 PCM20 sound cards. This driver was removed around the 2.6.2x
 kernels because it relied on the removed OSS module. Now, it
 uses a current ALSA module (snd-miro) and is adapted to v4l2
 layer.
 
 It provides only basic functionality: frequency changing and
 FM module muting.
 
 Signed-off-by: Krzysztof Helt krzysztof...@wp.pl
 Reviewed-by: Hans Verkuil hverk...@xs4all.nl

Acked-by: Mauro Carvalho Chehab mche...@redhat.com

Cheers,
Mauro.
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] New driver for the radio FM module on Miro PCM20 sound card

2009-11-26 Thread Krzysztof Helt
From: Krzysztof Helt krzysztof...@wp.pl

This is recreated driver for the FM module found on Miro
PCM20 sound cards. This driver was removed around the 2.6.2x
kernels because it relied on the removed OSS module. Now, it
uses a current ALSA module (snd-miro) and is adapted to v4l2
layer.

It provides only basic functionality: frequency changing and
FM module muting.

Signed-off-by: Krzysztof Helt krzysztof...@wp.pl
Reviewed-by: Hans Verkuil hverk...@xs4all.nl
---
This is the second version of the patch with changes suggested by Hans Verkuil.


 drivers/media/radio/Kconfig   |   17 ++
 drivers/media/radio/Makefile  |1 +
 drivers/media/radio/radio-miropcm20.c |  269 +
 3 files changed, 287 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/radio/radio-miropcm20.c

diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index a87a477..b1df9f2 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -195,6 +195,23 @@ config RADIO_MAESTRO
  To compile this driver as a module, choose M here: the
  module will be called radio-maestro.
 
+config RADIO_MIROPCM20
+   tristate miroSOUND PCM20 radio
+   depends on ISA  VIDEO_V4L2
+   select SND_MIRO
+   ---help---
+ Choose Y here if you have this FM radio card. You also need to select
+ the Miro miroSOUND PCM1pro/PCM12/PCM20radio driver ALSA sound card
+ driver for this to work.
+
+ In order to control your radio card, you will need to use programs
+ that are compatible with the Video For Linux API.  Information on
+ this API and pointers to v4l programs may be found at
+ file:Documentation/video4linux/API.html.
+
+ To compile this driver as a module, choose M here: the
+ module will be called radio-miropcm20.
+
 config RADIO_SF16FMI
tristate SF16FMI Radio
depends on ISA  VIDEO_V4L2
diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile
index 2a1be3b..8a63d54 100644
--- a/drivers/media/radio/Makefile
+++ b/drivers/media/radio/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_RADIO_TRUST) += radio-trust.o
 obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o
 obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o
 obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o
+obj-$(CONFIG_RADIO_MIROPCM20) += radio-miropcm20.o
 obj-$(CONFIG_USB_DSBR) += dsbr100.o
 obj-$(CONFIG_RADIO_SI470X) += si470x/
 obj-$(CONFIG_USB_MR800) += radio-mr800.o
diff --git a/drivers/media/radio/radio-miropcm20.c 
b/drivers/media/radio/radio-miropcm20.c
new file mode 100644
index 000..6fd71f3
--- /dev/null
+++ b/drivers/media/radio/radio-miropcm20.c
@@ -0,0 +1,269 @@
+/* Miro PCM20 radio driver for Linux radio support
+ * (c) 1998 Ruurd Reitsma r.a.reit...@wbmt.tudelft.nl
+ * Thanks to Norberto Pellici for the ACI device interface specification
+ * The API part is based on the radiotrack driver by M. Kirkwood
+ * This driver relies on the aci mixer provided by the snd-miro
+ * ALSA driver.
+ * Look there for further info...
+ */
+
+/* What ever you think about the ACI, version 0x07 is not very well!
+ * I can't get frequency, 'tuner status', 'tuner flags' or mute/mono
+ * conditions...Robert
+ */
+
+#include linux/module.h
+#include linux/init.h
+#include linux/videodev2.h
+#include media/v4l2-device.h
+#include media/v4l2-ioctl.h
+#include sound/aci.h
+
+static int radio_nr = -1;
+module_param(radio_nr, int, 0);
+
+static int mono;
+module_param(mono, bool, 0);
+MODULE_PARM_DESC(mono, Force tuner into mono mode.);
+
+struct pcm20 {
+   struct v4l2_device v4l2_dev;
+   struct video_device vdev;
+   unsigned long freq;
+   int muted;
+   struct snd_miro_aci *aci;
+};
+
+static struct pcm20 pcm20_card = {
+   .freq   = 87*16000,
+   .muted  = 1,
+};
+
+static int pcm20_mute(struct pcm20 *dev, unsigned char mute)
+{
+   dev-muted = mute;
+   return snd_aci_cmd(dev-aci, ACI_SET_TUNERMUTE, mute, -1);
+}
+
+static int pcm20_stereo(struct pcm20 *dev, unsigned char stereo)
+{
+   return snd_aci_cmd(dev-aci, ACI_SET_TUNERMONO, !stereo, -1);
+}
+
+static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq)
+{
+   unsigned char freql;
+   unsigned char freqh;
+   struct snd_miro_aci *aci = dev-aci;
+
+   dev-freq = freq;
+
+   freq /= 160;
+   if (!(aci-aci_version == 0x07 || aci-aci_version = 0xb0))
+   freq /= 10;  /* I don't know exactly which version
+ * needs this hack */
+   freql = freq  0xff;
+   freqh = freq  8;
+
+   pcm20_stereo(dev, !mono);
+   return snd_aci_cmd(aci, ACI_WRITE_TUNE, freql, freqh);
+}
+
+static const struct v4l2_file_operations pcm20_fops = {
+   .owner  = THIS_MODULE,
+   .ioctl  = video_ioctl2,
+};
+
+static int vidioc_querycap(struct file *file, void *priv,
+   struct v4l2_capability *v)

Re: [PATCH] New driver for the radio FM module on Miro PCM20 sound card

2009-11-26 Thread Takashi Iwai
At Thu, 26 Nov 2009 13:50:17 +0100,
Krzysztof Helt wrote:
 
 From: Krzysztof Helt krzysztof...@wp.pl
 
 This is recreated driver for the FM module found on Miro
 PCM20 sound cards. This driver was removed around the 2.6.2x
 kernels because it relied on the removed OSS module. Now, it
 uses a current ALSA module (snd-miro) and is adapted to v4l2
 layer.
 
 It provides only basic functionality: frequency changing and
 FM module muting.
 
 Signed-off-by: Krzysztof Helt krzysztof...@wp.pl
 Reviewed-by: Hans Verkuil hverk...@xs4all.nl
 ---
 This is the second version of the patch with changes suggested by Hans 
 Verkuil.

Thanks.  But you didn't check my review comment in my previous mail...?


Takashi
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] New driver for the radio FM module on Miro PCM20 sound card

2009-11-26 Thread Takashi Iwai
At Thu, 26 Nov 2009 18:38:27 +0100,
Krzysztof Helt wrote:
 
 On Thu, 26 Nov 2009 16:43:15 +0100
 Takashi Iwai ti...@suse.de wrote:
 
  At Thu, 26 Nov 2009 13:50:17 +0100,
  Krzysztof Helt wrote:
   
   From: Krzysztof Helt krzysztof...@wp.pl
   
   This is recreated driver for the FM module found on Miro
   PCM20 sound cards. This driver was removed around the 2.6.2x
   kernels because it relied on the removed OSS module. Now, it
   uses a current ALSA module (snd-miro) and is adapted to v4l2
   layer.
   
   It provides only basic functionality: frequency changing and
   FM module muting.
   
   Signed-off-by: Krzysztof Helt krzysztof...@wp.pl
   Reviewed-by: Hans Verkuil hverk...@xs4all.nl
   ---
   This is the second version of the patch with changes suggested by Hans 
   Verkuil.
  
  Thanks.  But you didn't check my review comment in my previous mail...?
  
 
 I have missed it. I will redo the patch.

OK, thanks ;)


Takashi
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] New driver for the radio FM module on Miro PCM20 sound card

2009-11-25 Thread Takashi Iwai
At Tue, 24 Nov 2009 22:12:36 +0100,
Krzysztof Helt wrote:
 
 From: Krzysztof Helt krzysztof...@wp.pl
 
 This is recreated driver for the FM module found on Miro
 PCM20 sound cards. This driver was removed around the 2.6.2x
 kernels because it relied on the removed OSS module. Now, it
 uses a current ALSA module (snd-miro) and is adapted to v4l2
 layer.
 
 It provides only basic functionality: frequency changing and
 FM module muting.
 
 Signed-off-by: Krzysztof Helt krzysztof...@wp.pl
 ---
 This driver depends on changes to the snd-miro driver. These changes
 are already accepted to the ALSA tree, but these changes 
 won't be pushed into the 2.6.33 kernel.

Well, if we get ACK from V4L guys for this patch, I can merge it
together with snd-miro changes for 2.6.33.  But, it should be done
ASAP (preferably in this week).


  drivers/media/radio/Kconfig   |   17 ++
  drivers/media/radio/Makefile  |1 +
  drivers/media/radio/radio-miropcm20.c |  271 
 +
  3 files changed, 289 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/radio/radio-miropcm20.c
 
 diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
 index a87a477..1c12f99 100644
 --- a/drivers/media/radio/Kconfig
 +++ b/drivers/media/radio/Kconfig
 @@ -195,6 +195,23 @@ config RADIO_MAESTRO
 To compile this driver as a module, choose M here: the
 module will be called radio-maestro.
  
 +config RADIO_MIROPCM20
 + tristate miroSOUND PCM20 radio
 + depends on ISA  VIDEO_V4L2
 + select SND_MIRO
 + ---help---
 +   Choose Y here if you have this FM radio card. You also need to select
 +   the Miro miroSOUND PCM1pro/PCM12/PCM20radio driver ALSA sound card
 +   driver for this to work.

Better to rephrase This driver will select ?  You cannot select it
in practice but it's forcibly set.

 --- /dev/null
 +++ b/drivers/media/radio/radio-miropcm20.c
(snip)
 +
 +static int radio_nr = -1;
 +module_param(radio_nr, int, 0);

Missing MODULE_PARM_DESC().


thanks,

Takashi
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] New driver for the radio FM module on Miro PCM20 sound card

2009-11-25 Thread Takashi Iwai
At Wed, 25 Nov 2009 10:13:53 +0100,
I wrote:
 
 At Tue, 24 Nov 2009 22:12:36 +0100,
 Krzysztof Helt wrote:
  
  From: Krzysztof Helt krzysztof...@wp.pl
  
  This is recreated driver for the FM module found on Miro
  PCM20 sound cards. This driver was removed around the 2.6.2x
  kernels because it relied on the removed OSS module. Now, it
  uses a current ALSA module (snd-miro) and is adapted to v4l2
  layer.
  
  It provides only basic functionality: frequency changing and
  FM module muting.
  
  Signed-off-by: Krzysztof Helt krzysztof...@wp.pl
  ---
  This driver depends on changes to the snd-miro driver. These changes
  are already accepted to the ALSA tree, but these changes 
  won't be pushed into the 2.6.33 kernel.
 
 Well, if we get ACK from V4L guys for this patch, I can merge it
 together with snd-miro changes for 2.6.33.  But, it should be done
 ASAP (preferably in this week).

BTW, the patches for snd-miro driver can be found in sound GIT tree
next/isa or master branches
  git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git next/isa


Takashi
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Re: [PATCH] New driver for the radio FM module on Miro PCM20 sound card

2009-11-25 Thread krzysztof . h1
Takashi Iwai ti...@suse.de pisze:
 At Tue, 24 Nov 2009 22:12:36 +0100,
 Krzysztof Helt wrote:
  
  From: Krzysztof Helt krzysztof...@wp.pl
  
  This is recreated driver for the FM module found on Miro
  PCM20 sound cards. This driver was removed around the 2.6.2x
  kernels because it relied on the removed OSS module. Now, it
  uses a current ALSA module (snd-miro) and is adapted to v4l2
  layer.
  
  It provides only basic functionality: frequency changing and
  FM module muting.
  
  Signed-off-by: Krzysztof Helt krzysztof...@wp.pl
  ---
  This driver depends on changes to the snd-miro driver. These changes
  are already accepted to the ALSA tree, but these changes 
  won't be pushed into the 2.6.33 kernel.
 
 Well, if we get ACK from V4L guys for this patch, I can merge it
 together with snd-miro changes for 2.6.33.  But, it should be done
 ASAP (preferably in this week).

This would be a good solution because the Miro card is borrowed and I have to
return it in 2-3 weeks. Any problems detected in these period can be patched 
and tested. Later, the test will be almost impossible (depends on will of the
guy who borrowed the card).

Regards,
Krzysztof

--
Audi kilka tysiecy zlotych taniej? Przebieraj wsrod tysiecy ogloszen!
Kliknij  http://link.interia.pl/f2424

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] New driver for the radio FM module on Miro PCM20 sound card

2009-11-25 Thread Hans Verkuil
Hi Krzysztof,

I did a quick review and found just two small things. If you fix those,
then you can add a

Reviewed-by: Hans Verkuil hverk...@xs4all.nl

line to your patch.

Thanks,

Hans

On Tuesday 24 November 2009 22:12:36 Krzysztof Helt wrote:
 From: Krzysztof Helt krzysztof...@wp.pl
 
 This is recreated driver for the FM module found on Miro
 PCM20 sound cards. This driver was removed around the 2.6.2x
 kernels because it relied on the removed OSS module. Now, it
 uses a current ALSA module (snd-miro) and is adapted to v4l2
 layer.
 
 It provides only basic functionality: frequency changing and
 FM module muting.
 
 Signed-off-by: Krzysztof Helt krzysztof...@wp.pl
 ---
 This driver depends on changes to the snd-miro driver. These changes
 are already accepted to the ALSA tree, but these changes 
 won't be pushed into the 2.6.33 kernel.
 
  drivers/media/radio/Kconfig   |   17 ++
  drivers/media/radio/Makefile  |1 +
  drivers/media/radio/radio-miropcm20.c |  271 
 +
  3 files changed, 289 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/radio/radio-miropcm20.c
 
 diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
 index a87a477..1c12f99 100644
 --- a/drivers/media/radio/Kconfig
 +++ b/drivers/media/radio/Kconfig
 @@ -195,6 +195,23 @@ config RADIO_MAESTRO
 To compile this driver as a module, choose M here: the
 module will be called radio-maestro.
  
 +config RADIO_MIROPCM20
 + tristate miroSOUND PCM20 radio
 + depends on ISA  VIDEO_V4L2
 + select SND_MIRO
 + ---help---
 +   Choose Y here if you have this FM radio card. You also need to select
 +   the Miro miroSOUND PCM1pro/PCM12/PCM20radio driver ALSA sound card
 +   driver for this to work.
 +
 +   In order to control your radio card, you will need to use programs
 +   that are compatible with the Video For Linux API.  Information on
 +   this API and pointers to v4l programs may be found at
 +   file:Documentation/video4linux/API.html.
 +
 +   To compile this driver as a module, choose M here: the
 +   module will be called radio-miropcm20.
 +
  config RADIO_SF16FMI
   tristate SF16FMI Radio
   depends on ISA  VIDEO_V4L2
 diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile
 index 2a1be3b..8a63d54 100644
 --- a/drivers/media/radio/Makefile
 +++ b/drivers/media/radio/Makefile
 @@ -18,6 +18,7 @@ obj-$(CONFIG_RADIO_TRUST) += radio-trust.o
  obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o
  obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o
  obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o
 +obj-$(CONFIG_RADIO_MIROPCM20) += radio-miropcm20.o
  obj-$(CONFIG_USB_DSBR) += dsbr100.o
  obj-$(CONFIG_RADIO_SI470X) += si470x/
  obj-$(CONFIG_USB_MR800) += radio-mr800.o
 diff --git a/drivers/media/radio/radio-miropcm20.c 
 b/drivers/media/radio/radio-miropcm20.c
 new file mode 100644
 index 000..0b6940c
 --- /dev/null
 +++ b/drivers/media/radio/radio-miropcm20.c
 @@ -0,0 +1,271 @@
 +/* Miro PCM20 radio driver for Linux radio support
 + * (c) 1998 Ruurd Reitsma r.a.reit...@wbmt.tudelft.nl
 + * Thanks to Norberto Pellici for the ACI device interface specification
 + * The API part is based on the radiotrack driver by M. Kirkwood
 + * This driver relies on the aci mixer provided by the snd-miro
 + * ALSA driver.
 + * Look there for further info...
 + */
 +
 +/* Revision history:
 + *
 + *   1998Ruurd Reitsma r.a.reit...@wbmt.tudelft.nl
 + *   2000-09-05  Robert Siemer robert.sie...@gmx.de
 + *removed unfinished volume control (maybe adding it later again)
 + *use OSS-mixer; added stereo control
 + */
 +
 +/* What ever you think about the ACI, version 0x07 is not very well!
 + * I can't get frequency, 'tuner status', 'tuner flags' or mute/mono
 + * conditions...Robert
 + */
 +
 +#include linux/module.h
 +#include linux/init.h
 +#include linux/videodev2.h
 +#include media/v4l2-device.h
 +#include media/v4l2-ioctl.h
 +#include sound/aci.h
 +
 +static int radio_nr = -1;
 +module_param(radio_nr, int, 0);
 +
 +static int mono;
 +module_param(mono, bool, 0);
 +MODULE_PARM_DESC(mono, Force tuner into mono mode.);
 +
 +struct pcm20 {
 + struct v4l2_device v4l2_dev;
 + struct video_device vdev;
 + unsigned long freq;
 + int muted;
 + struct snd_miro_aci *aci;
 +};
 +
 +static struct pcm20 pcm20_card = {
 + .freq   = 87*16000,
 + .muted  = 1,
 +};
 +
 +static int pcm20_mute(struct pcm20 *dev, unsigned char mute)
 +{
 + dev-muted = mute;
 + return snd_aci_cmd(dev-aci, ACI_SET_TUNERMUTE, mute, -1);
 +}
 +
 +static int pcm20_stereo(struct pcm20 *dev, unsigned char stereo)
 +{
 + return snd_aci_cmd(dev-aci, ACI_SET_TUNERMONO, !stereo, -1);
 +}
 +
 +static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq)
 +{
 + unsigned char freql;
 + unsigned char freqh;
 + struct snd_miro_aci *aci = dev-aci;
 +
 + 

[PATCH] New driver for the radio FM module on Miro PCM20 sound card

2009-11-24 Thread Krzysztof Helt
From: Krzysztof Helt krzysztof...@wp.pl

This is recreated driver for the FM module found on Miro
PCM20 sound cards. This driver was removed around the 2.6.2x
kernels because it relied on the removed OSS module. Now, it
uses a current ALSA module (snd-miro) and is adapted to v4l2
layer.

It provides only basic functionality: frequency changing and
FM module muting.

Signed-off-by: Krzysztof Helt krzysztof...@wp.pl
---
This driver depends on changes to the snd-miro driver. These changes
are already accepted to the ALSA tree, but these changes 
won't be pushed into the 2.6.33 kernel.

 drivers/media/radio/Kconfig   |   17 ++
 drivers/media/radio/Makefile  |1 +
 drivers/media/radio/radio-miropcm20.c |  271 +
 3 files changed, 289 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/radio/radio-miropcm20.c

diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index a87a477..1c12f99 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -195,6 +195,23 @@ config RADIO_MAESTRO
  To compile this driver as a module, choose M here: the
  module will be called radio-maestro.
 
+config RADIO_MIROPCM20
+   tristate miroSOUND PCM20 radio
+   depends on ISA  VIDEO_V4L2
+   select SND_MIRO
+   ---help---
+ Choose Y here if you have this FM radio card. You also need to select
+ the Miro miroSOUND PCM1pro/PCM12/PCM20radio driver ALSA sound card
+ driver for this to work.
+
+ In order to control your radio card, you will need to use programs
+ that are compatible with the Video For Linux API.  Information on
+ this API and pointers to v4l programs may be found at
+ file:Documentation/video4linux/API.html.
+
+ To compile this driver as a module, choose M here: the
+ module will be called radio-miropcm20.
+
 config RADIO_SF16FMI
tristate SF16FMI Radio
depends on ISA  VIDEO_V4L2
diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile
index 2a1be3b..8a63d54 100644
--- a/drivers/media/radio/Makefile
+++ b/drivers/media/radio/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_RADIO_TRUST) += radio-trust.o
 obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o
 obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o
 obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o
+obj-$(CONFIG_RADIO_MIROPCM20) += radio-miropcm20.o
 obj-$(CONFIG_USB_DSBR) += dsbr100.o
 obj-$(CONFIG_RADIO_SI470X) += si470x/
 obj-$(CONFIG_USB_MR800) += radio-mr800.o
diff --git a/drivers/media/radio/radio-miropcm20.c 
b/drivers/media/radio/radio-miropcm20.c
new file mode 100644
index 000..0b6940c
--- /dev/null
+++ b/drivers/media/radio/radio-miropcm20.c
@@ -0,0 +1,271 @@
+/* Miro PCM20 radio driver for Linux radio support
+ * (c) 1998 Ruurd Reitsma r.a.reit...@wbmt.tudelft.nl
+ * Thanks to Norberto Pellici for the ACI device interface specification
+ * The API part is based on the radiotrack driver by M. Kirkwood
+ * This driver relies on the aci mixer provided by the snd-miro
+ * ALSA driver.
+ * Look there for further info...
+ */
+
+/* Revision history:
+ *
+ *   1998Ruurd Reitsma r.a.reit...@wbmt.tudelft.nl
+ *   2000-09-05  Robert Siemer robert.sie...@gmx.de
+ *removed unfinished volume control (maybe adding it later again)
+ *use OSS-mixer; added stereo control
+ */
+
+/* What ever you think about the ACI, version 0x07 is not very well!
+ * I can't get frequency, 'tuner status', 'tuner flags' or mute/mono
+ * conditions...Robert
+ */
+
+#include linux/module.h
+#include linux/init.h
+#include linux/videodev2.h
+#include media/v4l2-device.h
+#include media/v4l2-ioctl.h
+#include sound/aci.h
+
+static int radio_nr = -1;
+module_param(radio_nr, int, 0);
+
+static int mono;
+module_param(mono, bool, 0);
+MODULE_PARM_DESC(mono, Force tuner into mono mode.);
+
+struct pcm20 {
+   struct v4l2_device v4l2_dev;
+   struct video_device vdev;
+   unsigned long freq;
+   int muted;
+   struct snd_miro_aci *aci;
+};
+
+static struct pcm20 pcm20_card = {
+   .freq   = 87*16000,
+   .muted  = 1,
+};
+
+static int pcm20_mute(struct pcm20 *dev, unsigned char mute)
+{
+   dev-muted = mute;
+   return snd_aci_cmd(dev-aci, ACI_SET_TUNERMUTE, mute, -1);
+}
+
+static int pcm20_stereo(struct pcm20 *dev, unsigned char stereo)
+{
+   return snd_aci_cmd(dev-aci, ACI_SET_TUNERMONO, !stereo, -1);
+}
+
+static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq)
+{
+   unsigned char freql;
+   unsigned char freqh;
+   struct snd_miro_aci *aci = dev-aci;
+
+   dev-freq = freq;
+
+   freq /= 160;
+   if (!(aci-aci_version == 0x07 || aci-aci_version = 0xb0))
+   freq /= 10;  /* I don't know exactly which version
+ * needs this hack */
+   freql = freq  0xff;
+   freqh = freq  8;
+
+   pcm20_stereo(dev, !mono);
+   return