Re: [PATCH v2] [media] Delete unnecessary variable initialisations in seven functions

2018-02-22 Thread Alexey Klimov
On Thu, Feb 22, 2018 at 9:22 PM, SF Markus Elfring
 wrote:
> From: Markus Elfring 
> Date: Thu, 22 Feb 2018 21:45:47 +0100
>
> Some local variables will be set to an appropriate value before usage.
> Thus omit explicit initialisations at the beginning of these functions.
>
> Signed-off-by: Markus Elfring 
> ---
>
> v2:
> Hans Verkuil insisted on patch squashing. Thus some changes
> were recombined based on source files from Linux next-20180216.
>
>  drivers/media/radio/radio-mr800.c     | 2 +-

For radio-mr800:

Acked-by: Alexey Klimov 

>  drivers/media/radio/radio-wl1273.c| 2 +-
>  drivers/media/radio/si470x/radio-si470x-usb.c | 2 +-
>  drivers/media/usb/cx231xx/cx231xx-cards.c | 2 +-
>  drivers/media/usb/cx231xx/cx231xx-dvb.c   | 2 +-
>  drivers/media/usb/go7007/snd-go7007.c | 2 +-
>  drivers/media/usb/tm6000/tm6000-cards.c   | 2 +-
>  7 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/media/radio/radio-mr800.c 
> b/drivers/media/radio/radio-mr800.c
> index dc6c4f985911..0f292c6ba338 100644
> --- a/drivers/media/radio/radio-mr800.c
> +++ b/drivers/media/radio/radio-mr800.c
> @@ -511,5 +511,5 @@ static int usb_amradio_probe(struct usb_interface *intf,
> const struct usb_device_id *id)
>  {
> struct amradio_device *radio;
> -   int retval = 0;
> +   int retval;
>
> diff --git a/drivers/media/radio/radio-wl1273.c 
> b/drivers/media/radio/radio-wl1273.c

[..]

Thanks!
Alexey


Re: [PATCH 3/3] [media] radio: constify usb_device_id

2017-08-21 Thread Alexey Klimov
Hi Arvind,

thanks for the patch!

On Sun, Aug 13, 2017 at 9:54 AM, Arvind Yadav  wrote:
> usb_device_id are not supposed to change at runtime. All functions
> working with usb_device_id provided by  work with
> const usb_device_id. So mark the non-const structs as const.
>
> Signed-off-by: Arvind Yadav 

For dsbr100, radio-mr800 and radio-ma901 please feel free to use:

Acked-by: Alexey Klimov 


> ---
>  drivers/media/radio/dsbr100.c | 2 +-
>  drivers/media/radio/radio-keene.c | 2 +-
>  drivers/media/radio/radio-ma901.c | 2 +-
>  drivers/media/radio/radio-mr800.c | 2 +-
>  drivers/media/radio/radio-raremono.c  | 2 +-
>  drivers/media/radio/radio-shark.c | 2 +-
>  drivers/media/radio/radio-shark2.c| 2 +-
>  drivers/media/radio/si470x/radio-si470x-usb.c | 2 +-
>  drivers/media/radio/si4713/radio-usb-si4713.c | 2 +-
>  9 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c
> index 53bc8c0..8521bb2 100644


[...]

Best regards,
Alexey


Re: [PATCH v9 2/8] media: Add registration helpers for V4L2 flash sub-devices

2015-06-18 Thread Alexey Klimov
andler;
> +   }
> +
> +   v4l2_ctrl_handler_setup(&v4l2_flash->hdl);
> +
> +   v4l2_flash->sd.ctrl_handler = &v4l2_flash->hdl;
> +
> +   return 0;
> +
> +error_free_handler:
> +   v4l2_ctrl_handler_free(&v4l2_flash->hdl);
> +   return ret;
> +}
> +
> +static int __sync_device_with_v4l2_controls(struct v4l2_flash *v4l2_flash)
> +{
> +   struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev;
> +   struct v4l2_ctrl **ctrls = v4l2_flash->ctrls;
> +   int ret = 0;
> +
> +   v4l2_flash_set_led_brightness(v4l2_flash, ctrls[TORCH_INTENSITY]);
> +
> +   if (ctrls[INDICATOR_INTENSITY])
> +   v4l2_flash_set_led_brightness(v4l2_flash,
> +   ctrls[INDICATOR_INTENSITY]);
> +
> +   if (ctrls[FLASH_TIMEOUT]) {
> +   ret = led_set_flash_timeout(fled_cdev,
> +   ctrls[FLASH_TIMEOUT]->val);
> +   if (ret < 0)
> +   return ret;
> +   }
> +
> +   if (ctrls[FLASH_INTENSITY]) {
> +   ret = led_set_flash_brightness(fled_cdev,
> +   ctrls[FLASH_INTENSITY]->val);
> +   if (ret < 0)
> +   return ret;
> +   }
> +
> +   /*
> +* For some hardware arrangements setting strobe source may affect
> +* torch mode. Synchronize strobe source setting only if not in torch
> +* mode. For torch mode case it will get synchronized upon switching
> +* to flash mode.
> +*/
> +   if (ctrls[STROBE_SOURCE] &&
> +   ctrls[LED_MODE]->val != V4L2_FLASH_LED_MODE_TORCH)
> +   ret = call_flash_op(v4l2_flash, external_strobe_set,
> +   ctrls[STROBE_SOURCE]->val);
> +
> +   return ret;
> +}
> +
> +/*
> + * V4L2 subdev internal operations
> + */
> +
> +static int v4l2_flash_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
> +{
> +   struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd);
> +   struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev;
> +   struct led_classdev *led_cdev = &fled_cdev->led_cdev;
> +   int ret = 0;
> +
> +   mutex_lock(&led_cdev->led_access);
> +
> +   if (!v4l2_fh_is_singular(&fh->vfh))
> +   goto unlock;
> +
> +   led_sysfs_disable(led_cdev);
> +   led_trigger_remove(led_cdev);
> +
> +   ret = __sync_device_with_v4l2_controls(v4l2_flash);
> +
> +unlock:
> +   mutex_unlock(&led_cdev->led_access);
> +   return ret;
> +}
> +
> +static int v4l2_flash_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh 
> *fh)
> +{
> +   struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd);
> +   struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev;
> +   struct led_classdev *led_cdev = &fled_cdev->led_cdev;
> +   int ret = 0;
> +
> +   mutex_lock(&led_cdev->led_access);
> +
> +   if (v4l2_fh_is_singular(&fh->vfh)) {
> +   if (v4l2_flash->ctrls[STROBE_SOURCE])
> +   ret = 
> v4l2_ctrl_s_ctrl(v4l2_flash->ctrls[STROBE_SOURCE],
> +   V4L2_FLASH_STROBE_SOURCE_SOFTWARE);
> +   led_sysfs_enable(led_cdev);
> +   }
> +
> +   mutex_unlock(&led_cdev->led_access);
> +
> +   return ret;
> +}
> +
> +static const struct v4l2_subdev_internal_ops v4l2_flash_subdev_internal_ops 
> = {
> +   .open = v4l2_flash_open,
> +   .close = v4l2_flash_close,
> +};
> +
> +static const struct v4l2_subdev_core_ops v4l2_flash_core_ops = {
> +   .queryctrl = v4l2_subdev_queryctrl,
> +   .querymenu = v4l2_subdev_querymenu,
> +};
> +
> +static const struct v4l2_subdev_ops v4l2_flash_subdev_ops = {
> +   .core = &v4l2_flash_core_ops,
> +};
> +
> +struct v4l2_flash *v4l2_flash_init(
> +   struct device *dev, struct device_node *of_node,
> +   struct led_classdev_flash *fled_cdev,
> +   struct led_classdev_flash *iled_cdev,
> +   const struct v4l2_flash_ops *ops,
> +   struct v4l2_flash_config *config)
> +{
> +   struct v4l2_flash *v4l2_flash;

> +   struct led_classdev *led_cdev = &fled_cdev->led_cdev;
> +   struct v4l2_subdev *sd;
> +   int ret;
> +
> +   if (!fled_cdev || !ops || !config)
> +   return ERR_PTR(-EINVAL);

Could you please if it is correct? You're checking fled_cdev but four
lines above you're using fled_cdev and taking led_cdev pointer from
there. Maybe it's better to move calculation of led_cdev down and
place after if-check?

Best regards,
Alexey Klimov



-- 
Best regards, Klimov Alexey
--
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 5/6] update reference, kerneltrap.org no longer works

2014-06-09 Thread Alexey Klimov
On Mon, Jun 9, 2014 at 7:55 PM, Pranith Kumar  wrote:
> kerneltrap.org no longer works, update to a working reference
>
> Signed-off-by: Pranith Kumar 


Acked-by: Alexey Klimov 


Thanks!

-- 
Best regards, Klimov Alexey
--
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: [REVIEW PATCH 0/4] add radio-raremono driver

2014-01-08 Thread Alexey Klimov
On Fri, Dec 13, 2013 at 4:26 PM, Hans Verkuil  wrote:
> This patch series adds the new radio-raremono driver for the USB
> 'Thanko's Raremono' AM/FM/SW receiver.
>
> Since it (ab)uses the same USB IDs as the si470x SiLabs Reference
> Design I had to add additional checks to si470x to tell the two apart.
>
> While editing si470x I noticed that it passes USB buffers from the stack
> instead of using kmalloc, so I fixed that as well.
>
> I have tested the si470x checks, and the FM and AM receiver of the
> Raremono device have been tested as well. I don't have a SW transmitter,
> nor are there any SW transmitters here in Norway, so I couldn't test it.
>
> All I can say is that it is definitely tuning since the white noise
> changes when I change frequency. I'll try this nexy week in the Netherlands,
> as I think there are still a few SW transmissions there I might receive.
>
> The initial reverse engineering for this driver was done by Dinesh Ram
> as part of his Cisco internship, so many thanks to Dinesh for doing that
> work.

Hi Hans,

this is very nice radio and driver. But where did you buy/get this device?
Could you please share a link?

Year ago i tried to find place on internet to buy this device but failed.

-- 
Best regards, Klimov Alexey
--
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: Fw: [patch 02/03 v2] usb hid quirks for Masterkit MA901 usb radio

2013-03-27 Thread Alexey Klimov
On Wed, Mar 27, 2013 at 2:18 PM, Jiri Kosina  wrote:
> On Tue, 19 Mar 2013, Alexey Klimov wrote:
>
>> Yes, i just checked how hid_ignore() works and prepared dirty fix to
>> test in almost the same way like it's done for Keene usb driver. I
>> will send correct fix in next few days.
>
> Any news on this, please?

Hi Jiri,

I'm very very sorry (was busy because of life). I just sent two
patches to you, Mauro and two mail lists:
[patch 1/2] hid: fix Masterkit MA901 hid quirks
[patch 2/2] media: radio-ma901: return ENODEV in probe if usb_device
doesn't match

Please check. First one for hid layer, so maybe you can take it
directly through your tree. I hope it's not too late.
I think Mauro will take second patch.

I spend some time testing them trying to figure out right scenarios
and i hope i did correct checks.
It will be nice if someone can test patches because i don't have any
devices with same USB IDs as radio-ma901.

Thanks and best regards,
Alexey.
--
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 2/2] media: radio-ma901: return ENODEV in probe if usb_device doesn't match

2013-03-27 Thread Alexey Klimov
Masterkit MA901 usb radio device shares USB ID with Atmel V-USB devices.
This patch adds additional checks in usb_ma901radio_probe() and if
product or manufacturer doesn't match we return -ENODEV and don't
continue. This allows hid drivers to handle not MA901 device.

Signed-off-by: Alexey Klimov 

diff --git a/drivers/media/radio/radio-ma901.c 
b/drivers/media/radio/radio-ma901.c
index c61f590..348dafc 100644
--- a/drivers/media/radio/radio-ma901.c
+++ b/drivers/media/radio/radio-ma901.c
@@ -347,9 +347,20 @@ static void usb_ma901radio_release(struct v4l2_device 
*v4l2_dev)
 static int usb_ma901radio_probe(struct usb_interface *intf,
const struct usb_device_id *id)
 {
+   struct usb_device *dev = interface_to_usbdev(intf);
struct ma901radio_device *radio;
int retval = 0;
 
+   /* Masterkit MA901 usb radio has the same USB ID as many others
+* Atmel V-USB devices. Let's make additional checks to be sure
+* that this is our device.
+*/
+
+   if (dev->product && dev->manufacturer &&
+   (strncmp(dev->product, "MA901", 5) != 0
+   || strncmp(dev->manufacturer, "www.masterkit.ru", 16) != 0))
+   return -ENODEV;
+
radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL);
if (!radio) {
dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n");


--
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 1/2] hid: fix Masterkit MA901 hid quirks

2013-03-27 Thread Alexey Klimov
This patch reverts commit 0322bd3980b3ebf7dde8474e22614cb443d6479a and
adds checks in hid_ignore() for Masterkit MA901 usb radio device. This
usb radio device shares USB ID with many Atmel V-USB (and probably
other) devices so patch sorts things out by checking name, vendor,
product of hid device.

Signed-off-by: Alexey Klimov 

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 512b01c..aa341d1 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2077,7 +2077,6 @@ static const struct hid_device_id hid_ignore_list[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) 
},
-   { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, 
USB_DEVICE_ID_MASTERKIT_MA901RADIO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
@@ -2244,6 +2243,18 @@ bool hid_ignore(struct hid_device *hdev)
 hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST))
return true;
break;
+   case USB_VENDOR_ID_ATMEL_V_USB:
+   /* Masterkit MA901 usb radio based on Atmel tiny85 chip and
+* it has the same USB ID as many Atmel V-USB devices. This
+* usb radio is handled by radio-ma901.c driver so we want
+* ignore the hid. Check the name, bus, product and ignore
+* if we have MA901 usb radio.
+*/
+   if (hdev->product == USB_DEVICE_ID_ATMEL_V_USB &&
+   hdev->bus == BUS_USB &&
+   strncmp(hdev->name, "www.masterkit.ru MA901", 22) == 0)
+   return true;
+   break;
}
 
if (hdev->type == HID_TYPE_USBMOUSE &&
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 92e47e5..57d9f3a 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -158,6 +158,8 @@
 #define USB_VENDOR_ID_ATMEL0x03eb
 #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c
 #define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER  0x2118
+#define USB_VENDOR_ID_ATMEL_V_USB  0x16c0
+#define USB_DEVICE_ID_ATMEL_V_USB  0x05df
 
 #define USB_VENDOR_ID_AUREAL   0x0755
 #define USB_DEVICE_ID_AUREAL_W01RN 0x2626
@@ -557,9 +559,6 @@
 #define USB_VENDOR_ID_MADCATZ  0x0738
 #define USB_DEVICE_ID_MADCATZ_BEATPAD  0x4540
 
-#define USB_VENDOR_ID_MASTERKIT0x16c0
-#define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df
-
 #define USB_VENDOR_ID_MCC  0x09db
 #define USB_DEVICE_ID_MCC_PMD1024LS0x0076
 #define USB_DEVICE_ID_MCC_PMD1208LS0x007a


--
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: Fw: [patch 02/03 v2] usb hid quirks for Masterkit MA901 usb radio

2013-03-18 Thread Alexey Klimov
On Mon, Mar 18, 2013 at 5:51 PM, Jiri Kosina  wrote:
> On Fri, 15 Mar 2013, Alexey Klimov wrote:
>
>> > indeed your patch breaks Atmega applications which using V-USB
>> > (http://www.obdev.at/products/vusb/index.html), because 0x16c0, 0x05df are
>> > the default Ids of V-USB.
>> >
>> > Have a look at this FAQ
>> >
>> > https://github.com/obdev/v-usb/blob/master/usbdrv/USB-ID-FAQ.txt
>> >
>> > It seems that the Masterkit M901 also uses V-USB.
>> >
>> > I'm using an IR remote control receiver based on Atmega8 with V-USB. Since
>> > Kernel 3.8.2 there is no more hidraw device for my receiver, so I had to
>> > change the Device-ID to 0x27d9. I think there are a lot of other V-USB
>> > applications with similar problems.
>> >
>> > Dirk
>>
>> Exactly. That's why i tried to point it out. Thanks for explaining
>> this in simplier words.
>>
>> It's difficult to answer on top posting emails.
>>
>> I don't understand one thing about your letter. Did you put
>> linux-media kernel list in bcc (hide copy)? Is there any reason for
>> this? http://www.mail-archive.com/linux-media@vger.kernel.org/msg59714.html
>>
>> Mauro, Jiri,
>> can we revert this patch? If you need any ack or sign from me i'm
>> ready to send it.
>>
>> I can contact people who cares about stable trees and ask them to
>> revert this patch from stable trees.
>>
>> During 3.9-rcX cycle i can try to figure out some fix or additional
>> checks for radio-ma901.c driver.
>
> I can revert 0322bd3980 and push it out to Linus for 3.9 still, Ccing
> stable.
>
> Or Mauro, as the original patch went in through your tree, are you
> handling that?

I think we really need to revert it before final release. It's already -rc3.

> Also additional work will be needed later to properly detect the
> underlying device ... the best thing to do here is to put an entry into
> hid_ignore(), similar to what we do for example for Keene FM vs. Logitech
> AudioHub.

Yes, i just checked how hid_ignore() works and prepared dirty fix to
test in almost the same way like it's done for Keene usb driver. I
will send correct fix in next few days.

Thanks.
Best regards, Klimov Alexey
--
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: [REVIEW PATCH 2/5] v4l2: add const to argument of write-only s_tuner ioctl.

2013-03-16 Thread Alexey Klimov
Hi Hans,

On Fri, Mar 15, 2013 at 2:27 PM, Hans Verkuil  wrote:
> From: Hans Verkuil 
>
> This ioctl is defined as IOW, so pass the argument as const.
>
> Signed-off-by: Hans Verkuil 

[snip]

>  drivers/media/radio/dsbr100.c|2 +-

>  drivers/media/radio/radio-ma901.c|2 +-

>  drivers/media/radio/radio-mr800.c    |    2 +-

Acked-by: Alexey Klimov 

for this three radio drivers.
Thanks.

-- 
Best regards, Klimov Alexey
--
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


[review patch] radio-mr800: move clamp_t check inside amradio_set_freq()

2013-03-14 Thread Alexey Klimov
Hi Hans, all,

If i run verbose v4l2-compliance with my radio-mr800 device few times
then i get warning about frequency out of range:

root@machine:~# v4l2-compliance -r /dev/radio0 -v 2
is radio
Driver Info:
Driver name   : radio-mr800
Card type : AverMedia MR 800 USB FM Radio
Bus info  : usb-:00:1a.0-1.2
Driver version: 3.9.0
Capabilities  : 0x80050400
Tuner
Radio
Device Capabilities
Device Caps   : 0x00050400
Tuner
Radio

Compliance test for device /dev/radio0 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second radio open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
test VIDIOC_DBG_G_CHIP_IDENT: OK (Not Supported)
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK

Input ioctls:
test VIDIOC_G/S_TUNER: OK
warn: v4l2-test-input-output.cpp(234): returned tuner 0 
frequency out
of range (6550200 not in [140...1728000])
test VIDIOC_G/S_FREQUENCY: OK
test VIDIOC_S_HW_FREQ_SEEK: OK
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 1

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Control ioctls:
info: checking v4l2_queryctrl of control 'User Controls' 
(0x00980001)
info: checking v4l2_queryctrl of control 'Mute' (0x00980909)
info: checking v4l2_queryctrl of control 'Mute' (0x00980909)
test VIDIOC_QUERYCTRL/MENU: OK
info: checking control 'User Controls' (0x00980001)
info: checking control 'Mute' (0x00980909)
test VIDIOC_G/S_CTRL: OK
info: checking extended control 'User Controls' (0x00980001)
info: checking extended control 'Mute' (0x00980909)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
info: checking control event 'User Controls' (0x00980001)
info: checking control event 'Mute' (0x00980909)
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 2 Private Controls: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_PRESETS: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported)
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK (Not Supported)
test VIDIOC_TRY_FMT: OK (Not Supported)
test VIDIOC_S_FMT: OK (Not Supported)
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported)

Total: 38, Succeeded: 38, Failed: 0, Warnings: 1

Some printk() debugging showed that vidioc_s_hw_freq_seek() setups
radio->curfreq to out of range value (lines 395-396) and calls
amradio_set_freq() to set this frequency on device without any
out-of-range checks.

I suggest to move clamp_t check inside amradio_set_freq() function. It
will protect from setting up frequency to incorrect values in different
places. It also makes compliance test happy.

If this fix is right may be it necessary to push this patch in 3.9
current development tree.




radio-mr800: move clamp_t check inside amradio_set_freq()

Patch protects from setting up frequency on device to incorrect value
moving clamp_t check inside amradio_set_freq. With this patch we can
call amradio_set_freq() with out of range frequency from any place.
Also put comment that sometimes radio->curfreq is set to out of range
value in vidioc_s_hw_freq_seek().

Signed-off-by: Alexey Klimov 


diff --git a/drivers/media/radio/radio-mr800.c 
b/drivers/media/radio/radio-mr800.c
index 9c5a267..1cbdbfd 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -203,10 +203,14 @@ static int amradio_set_mute(struct amradio_dev

Re: Fw: [patch 02/03 v2] usb hid quirks for Masterkit MA901 usb radio

2013-03-14 Thread Alexey Klimov
On Thu, Mar 14, 2013 at 2:20 PM, Dirk E. Wagner
 wrote:
> Hi Alexey,

Hi Dirk, Mauro, Jiri

> indeed your patch breaks Atmega applications which using V-USB
> (http://www.obdev.at/products/vusb/index.html), because 0x16c0, 0x05df are
> the default Ids of V-USB.
>
> Have a look at this FAQ
>
> https://github.com/obdev/v-usb/blob/master/usbdrv/USB-ID-FAQ.txt
>
> It seems that the Masterkit M901 also uses V-USB.
>
> I'm using an IR remote control receiver based on Atmega8 with V-USB. Since
> Kernel 3.8.2 there is no more hidraw device for my receiver, so I had to
> change the Device-ID to 0x27d9. I think there are a lot of other V-USB
> applications with similar problems.
>
> Dirk

Exactly. That's why i tried to point it out. Thanks for explaining
this in simplier words.

It's difficult to answer on top posting emails.

I don't understand one thing about your letter. Did you put
linux-media kernel list in bcc (hide copy)? Is there any reason for
this? http://www.mail-archive.com/linux-media@vger.kernel.org/msg59714.html

Mauro, Jiri,
can we revert this patch? If you need any ack or sign from me i'm
ready to send it.

I can contact people who cares about stable trees and ask them to
revert this patch from stable trees.

During 3.9-rcX cycle i can try to figure out some fix or additional
checks for radio-ma901.c driver.
-- 
Thanks & best regards, Klimov Alexey
--
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: Fw: [patch 02/03 v2] usb hid quirks for Masterkit MA901 usb radio

2013-03-11 Thread Alexey Klimov
Hi Jiri and Mauro, all,

On Fri, Dec 28, 2012 at 4:29 PM, Mauro Carvalho Chehab
 wrote:
> Hi Jiri,
>
> There's another radio device that it is incorrectly detected as an HID driver.
> As I'll be applying the driver's patch via the media tree, do you mind if I 
> also
> apply this hid patch there?
>
> Thanks!
> Mauro
>
> Forwarded message:
>
> Date: Mon, 12 Nov 2012 07:57:03 +0100
> From: Alexey Klimov 
> To: linux-media@vger.kernel.org
> Subject: [patch 02/03 v2] usb hid quirks for Masterkit MA901 usb radio
>
>
> Don't let Masterkit MA901 USB radio be handled by usb hid drivers.
>
> This device will be handled by radio-ma901.c driver.
>
> Signed-off-by: Alexey Klimov 
>
>
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 5de3bb3..8e06569 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -2025,6 +2025,7 @@ static const struct hid_device_id hid_ignore_list[] = {
> { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) },
> { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) },
> { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, 
> USB_DEVICE_ID_MADCATZ_BEATPAD) },
> +   { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, 
> USB_DEVICE_ID_MASTERKIT_MA901RADIO) },
> { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) },
> { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) },
> { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index 1dcb76f..17aa4f6 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -533,6 +533,9 @@
>  #define USB_VENDOR_ID_MADCATZ  0x0738
>  #define USB_DEVICE_ID_MADCATZ_BEATPAD  0x4540
>
> +#define USB_VENDOR_ID_MASTERKIT0x16c0
> +#define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df
> +
>  #define USB_VENDOR_ID_MCC  0x09db
>  #define USB_DEVICE_ID_MCC_PMD1024LS0x0076
>  #define USB_DEVICE_ID_MCC_PMD1208LS0x007a

Well, since patch also was pushed to stable trees like 3.5, 3.8, 3.2
and this fact made me look a little closer to usb ids. Actually, i
googled these usb ids: 16c0 05df, link:
http://www.google.com/search?q=16c0+05df
and here comes some doubts.

For my eyes it looks like this usb radio consists of two chips: atmel
tiny85 + actually fm tuner KT0830EG. It looks like tiny85 is used in
many devices with the same usb ids like in our patch and people works
with tiny85 using some software under linux. I don't know if linux
software using hiddev/hidraw devices but this patch doesn't allow
appearing of /dev/hiddev or /dev/hidraw files for any usb device with
ids 0x16c0 0x05df, right? Is there any chance that using such patch we
can break some linux software that uses /dev/hid* files and related
functionality to communicate with tiny85?

Please note that i'm not expert in tiny85 chip and i don't have any
deep knowledges on how usb ids are allocated for every device in the
world.
Masterkit company changed (or was able to change?) only Manufacturer,
Product, Serial fields in ma901 usb radio. I attached lsusb output in
the end of letter. Bad thing here is that Masterkit has other usb not
radio devices with the same usb ids based on tiny85 on the market.


Sorry if i'm over-alarmed, i just really dont want to break any
userspace programs by this patch.

If everything above is correct then i can use some dev->product,
dev->manufacturer, dev->serial checks in probe() function in
radio-ma901.c driver in the way like it's done in radio-keene.c driver
in probe function. If for example probe will discover that product
doesn't match then i can return -ENODEV. It's just an idea. But i
don't know if it is possible to do something with hid quirks: revert
and put comments somewhere or workaround and additional checks?
Well, any comments are welcome.

-- 
Best regards, Klimov Alexey



lsusb output:

Bus 003 Device 002: ID 16c0:05df VOTI
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   1.10
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize0 8
  idVendor   0x16c0 VOTI
  idProduct  0x05df
  bcdDevice1.00
  iManufacturer   1 www.masterkit.ru
  iProduct2 MA901
  iSerial 3 SHS
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   34
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0
bmAttributes 0x80
  (Bus Powered)
MaxPower  250mA
Int

[PATCH] [media] radio-si470x doc: add info about v4l2-ctl and sox+alsa

2013-02-11 Thread Alexey Klimov
Patch adds information about using v4l2-ctl utility to tune the si470x
radio and example how to use sox+alsa to redirect sound from radio sound
device to another sound device.

Signed-off-by: Alexey Klimov 


diff --git a/Documentation/video4linux/si470x.txt 
b/Documentation/video4linux/si470x.txt
index 3a7823e..98c3292 100644
--- a/Documentation/video4linux/si470x.txt
+++ b/Documentation/video4linux/si470x.txt
@@ -53,6 +53,9 @@ Testing is usually done with most application under 
Debian/testing:
 - kradio - Comfortable Radio Application for KDE
 - radio - ncurses-based radio application
 - mplayer - The Ultimate Movie Player For Linux
+- v4l2-ctl - Collection of command line video4linux utilities
+For example, you can use:
+v4l2-ctl -d /dev/radio0 --set-ctrl=volume=10,mute=0 --set-freq=95.21 --all
 
 There is also a library libv4l, which can be used. It's going to have a 
function
 for frequency seeking, either by using hardware functionality as in 
radio-si470x
@@ -75,8 +78,10 @@ commands. Please adjust the audio devices to your needs 
(/dev/dsp* and hw:x,x).
 If you just want to test audio (very poor quality):
 cat /dev/dsp1 > /dev/dsp
 
-If you use OSS try:
+If you use sox + OSS try:
 sox -2 --endian little -r 96000 -t oss /dev/dsp1 -t oss /dev/dsp
+or using sox + alsa:
+sox --endian little -c 2 -S -r 96000 -t alsa hw:1 -t alsa -r 96000 hw:0
 
 If you use arts try:
 arecord -D hw:1,0 -r96000 -c2 -f S16_LE | artsdsp aplay -B -


--
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 v3 0/6] Driver for Si476x series of chips

2013-02-11 Thread Alexey Klimov
Hello Andrey, Mauro, Hans,

On Tue, Oct 23, 2012 at 6:44 PM, Andrey Smirnov
 wrote:
> This is a third version of the patchset originaly posted here:
> https://lkml.org/lkml/2012/9/13/590
>
> Second version of the patch was posted here:
> https://lkml.org/lkml/2012/10/5/598
>
> To save everyone's time I'll repost the original description of it:
>
> This patchset contains a driver for a Silicon Laboratories 476x series
> of radio tuners. The driver itself is implemented as an MFD devices
> comprised of three parts:
>  1. Core device that provides all the other devices with basic
> functionality and locking scheme.
>  2. Radio device that translates between V4L2 subsystem requests into
> Core device commands.
>  3. Codec device that does similar to the earlier described task, but
> for ALSA SoC subsystem.
>
> v3 of this driver has following changes:
>  - All custom ioctls were moved to be V4L2 controls or debugfs files
>  - Chip properties handling was moved to regmap API, so this should
>allow for cleaner code, and hopefully more consistent behaviour of
>the driver during switch between AM/FM(wich involevs power-cycling
>of the chip)
>
> I was hoping to not touch the code of the codec driver, since Mark has
> already appplied the previous version, but because of the last item I
> had to.
>
> Unfotunately, since my ARM setup runs only 3.1 kernel, I was only able
> to test this driver on a standalone USB-connected board that has a
> dedicated Cortex M3 working as a transparent USB to I2C bridge which
> was connected to a off-the-shelf x86-64 laptop running Ubuntu with
> custom kernel compile form git.linuxtv.org/media_tree.git. Which means
> that I was unable to test the change in the codec code, except for the
> fact the it compiles.
>
>
> Here is v4l2-compliance output for one of the tuners(as per Hans'
> request):
[]

> Andrey Smirnov (6):
>   Add header files and Kbuild plumbing for SI476x MFD core
>   Add the main bulk of core driver for SI476x code
>   Add commands abstraction layer for SI476X MFD
>   Add chip properties handling code for SI476X MFD
>   Add a V4L2 driver for SI476X MFD
>   Add a codec driver for SI476X MFD

What is the final destiny of this patch series?
I found that only "codec driver for SI476X MFD" is pushed in kernel
3.8 by Mark Brown and that's all, is it? I can't find this patch
series on patchwork.linuxtv.org or in media git trees, for example,
scheduled for 3.9.

I also see that comments for this patches aren't answered and looks
like v4 is necessary.
Andrey, do you plan to make v4 series? May be it was already emailed
but i can't find it. Maybe review or comments from alsa and mfd
communities are missed?

So, without v4 it will not find its way into kernel, right?

-- 
Best regards, Klimov Alexey
--
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


[radio-si470x questions] Re: HI. problem with playing radio using fmtools, radio

2013-02-10 Thread Alexey Klimov
Hi Igor,

First of all, i change subject of email to something more relevant
here. I think that a lot of people was spammed with subject "Hi" of
your email.

Second. Please do not drop media maillist and contacts from c/c.
And third, sorry for long delay.

On Mon, Jan 28, 2013 at 4:21 PM, Igor Stamatovski  wrote:
> Hi Alexey, seems like things have changed from the last time i was playing
> with the radio cards.
>
> This ADS Tech InstantFM card i have, even though i bought couple of them
> now, i see that the company is not active and the reference design for this
> card is not supported.
> On the site i found some information about first boot of the usb. There is
> windows software that sets up the card with initial parameters like spacing
> band etc...
>
> With the driver you can set all those parameters in  /etc/modules
> I used the source to see what those settings mean, and applied to the
> /etc/modules
>
> radio-usb-si470x de=1 band=0 space=1  //this all means europe bands and
> spacing
> snd_usb_audio
> usbhid
>
> Im using 12.10 ubuntu 32bit with latest upgades, with fmtools package and
> radio application both installed from ubuntu repo.
>
> the thing is that i must route audio from the FM card to the audio card to
> hear audio.
> I can do this with arecord -c2 -q -r96000 -f S16_LE
> i can pipe this to aplay so it looks like this:
>
> arecord -c2 -q -r96000 -f S16_LE | aplay -q
>
> i can also make initial scan with the radio application
>
> radio -S
>
> which scans whole band and recognizes local stations, then creates the
> config file in the directory where the radio app is started.
>
> Up to here everything works as expected...
>
> next thing is to use fmtools to set the card to a specific freq...
>
> you do this with
> fm on //unmute the card
> fm 95.5 100 //should set the card to 95.5Mhz and set the volume to 100%
> after this the command exits and mutes the radio automatically or maybe
> resets the band...
>
> same thing happens with radio application. radio has switch -q which tells
> the application to exit interactive mode in order to be used from command
> line.
> so
> radio -f 95.5 -q
> should set the freq to 95.5 and exit the application but the radio should
> continue operating with this settings. What happens is the radio gets muted
> or changes band.

Well, last time i checked fmtools/radio programs i thought that they
used V4L version 1. I don't know if it will work well nowadays.

I experimented with my Kworld usb radio that uses the same driver
(radio-si470x). I use sox to redirect sound from radio:
sox --endian little -c 2 -S  -r 96000 -t alsa hw:1 -t alsa -r 96000 hw:0

(i have problem with "alsa: under-run" because of sound card and radio
are connected to the usb ports, not enough bandwidth)

To set up frequency and volume i used v4l2-ctrl utility. (Package name
in Debian is v4l-utils, should be available in Ubuntu.) Something like
this:
v4l2-ctl -d /dev/radio0 --set-ctrl=volume=10,mute=0 --set-freq=95.21

I can run sox in one terminal and i can run v4l2-ctl in another
terminal and radio still plays. I can change frequency without
stopping radio.

Could you please try v4l2-ctl? If it will not work for you it can be
problem with drivers, firmware..

> Now i have bought another TV tuner PCI 250 cinergy card which has FM tuner
> onboard and uses different driver for the radio
> Both applications radio and fmtools behave the same with the two different
> cards.
>
> So the question is how do i keep radio running while issuing a command
> trough fmtools or radio app.
> Is there any other app that keeps radio open while receiving control
> commands.
>
> Thanks

I believe that feature you describe was called "Mute on exit?" in
gnomeradio program.

> On Mon, Jan 28, 2013 at 3:27 PM, Alexey Klimov 
> wrote:
>>
>> Hello Igor,
>>
>> On Mon, Jan 28, 2013 at 3:14 AM, Igor Stamatovski 
>> wrote:
>> > Im trying to use ADS tech instantFM music USB card.
>> >
>> > dmesg reports this after machine reset (USB stays on machine)
>> >
>> > [6.387624] USB radio driver for Si470x FM Radio Receivers, Version
>> > 1.0.10
>> > [6.930228] radio-si470x 1-1.2:1.2: DeviceID=0x ChipID=0x
>> > [7.172429] radio-si470x 1-1.2:1.2: software version 0, hardware
>> > version 7
>> > [7.355485] radio-si470x 1-1.2:1.2: This driver is known to work
>> > with software version 7,
>> > [7.532554] radio-si470x 1-1.2:1.2: but the device has software
>> > version 0.
>> > [7.644091] radio-si470x 1-1.2:1.2: If you have some trouble using
>> > this driver,
>> > [ 

Re: HI

2013-01-28 Thread Alexey Klimov
Hello Igor,

On Mon, Jan 28, 2013 at 3:14 AM, Igor Stamatovski  wrote:
> Im trying to use ADS tech instantFM music USB card.
>
> dmesg reports this after machine reset (USB stays on machine)
>
> [6.387624] USB radio driver for Si470x FM Radio Receivers, Version 1.0.10
> [6.930228] radio-si470x 1-1.2:1.2: DeviceID=0x ChipID=0x
> [7.172429] radio-si470x 1-1.2:1.2: software version 0, hardware version 7
> [7.355485] radio-si470x 1-1.2:1.2: This driver is known to work
> with software version 7,
> [7.532554] radio-si470x 1-1.2:1.2: but the device has software version 0.
> [7.644091] radio-si470x 1-1.2:1.2: If you have some trouble using
> this driver,
> [7.728735] radio-si470x 1-1.2:1.2: please report to V4L ML at
> linux-media@vger.kernel.org
> [7.840415] usbcore: registered new interface driver radio-si470x
> [8.465398] usbcore: registered new interface driver snd-usb-audio
>
> i can note the deviceID and ChipID are not recognised but still some
> modules load for the card...
>
> after reinsert same USB card reports this
>
> [  102.460158] usb 1-1.2: USB disconnect, device number 4
> [  102.464721] radio-si470x 1-1.2:1.2: si470x_set_report:
> usb_control_msg returned -19
> [  106.535669] usb 1-1.2: new full-speed USB device number 6 using dwc_otg
> [  106.638514] usb 1-1.2: New USB device found, idVendor=06e1, idProduct=a155
> [  106.638545] usb 1-1.2: New USB device strings: Mfr=1, Product=2,
> SerialNumber=0
> [  106.638562] usb 1-1.2: Product: ADS InstantFM Music
> [  106.638576] usb 1-1.2: Manufacturer: ADS TECH
> [  106.644537] radio-si470x 1-1.2:1.2: DeviceID=0x1242 ChipID=0x0a0f
> [  106.645257] radio-si470x 1-1.2:1.2: software version 0, hardware version 7
> [  106.645288] radio-si470x 1-1.2:1.2: This driver is known to work
> with software version 7,
> [  106.645306] radio-si470x 1-1.2:1.2: but the device has software version 0.
> [  106.645321] radio-si470x 1-1.2:1.2: If you have some trouble using
> this driver,
> [  106.645337] radio-si470x 1-1.2:1.2: please report to V4L ML at
> linux-media@vger.kernel.org
>
> the radio can scan local radios and create config file with the radio
> application.
> using arecord piped to aplay does nothing.

Could you please give more details here? How do you scan local radios
and create config file? May i miss some information and this driver
can create config file by itself.

Could you please try other ways to catch sound using
Documentation/video4linux/si470x.txt file ?
There are also few possible ways described in this file:

[quote]
Audio Listing
=
USB Audio is provided by the ALSA snd_usb_audio module. It is recommended to
also select SND_USB_AUDIO, as this is required to get sound from the radio. For
listing you have to redirect the sound, for example using one of the following
commands. Please adjust the audio devices to your needs (/dev/dsp* and hw:x,x).

If you just want to test audio (very poor quality):
cat /dev/dsp1 > /dev/dsp

If you use OSS try:
sox -2 --endian little -r 96000 -t oss /dev/dsp1 -t oss /dev/dsp

If you use arts try:
arecord -D hw:1,0 -r96000 -c2 -f S16_LE | artsdsp aplay -B -

If you use mplayer try:
mplayer -radio adevice=hw=1.0:arate=96000 \
-rawaudio rate=96000 \
radio:///capture

[/quote]

> i wanted to know how do i update software version 0 to software
> version 7 and try this driver?

I don't know much about such update. May be doc file can be checked
for this also and i added Tobias (author) in c/c.

-- 
Best regards, Klimov Alexey
--
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: iMon Knob driver issue

2012-12-29 Thread Alexey Klimov
Hello Alexandre,

On Sat, Dec 29, 2012 at 4:08 PM, Alexandre LISSY  wrote:
> Hello,
>
> Please find attached a small patch for the iMon Knob driver. I've been

Could you please also add your Signed-off-by to the patch? It looks
like it's missed.

-- 
Best regards, Klimov Alexey
--
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 00/03 v2] driver for Masterkit MA901 usb radio

2012-12-28 Thread Alexey Klimov
Hi Hans,

On Fri, Dec 28, 2012 at 2:24 PM, Hans Verkuil  wrote:
> On Mon November 12 2012 07:56:06 Alexey Klimov wrote:
>> Hi all,
>>
>> This is second version of small patch series for ma901 usb radio driver.
>> Initial letter about this usb radio was sent on October 29 and can be
>> found here: http://www.spinics.net/lists/linux-media/msg55779.html
>>
>> Changes:
>> - removed f->type check and set in vidioc_g_frequency()
>> - added maintainers entry patch
>
> For the whole patch series:
>
> Acked-by: Hans Verkuil 
>
> PS: Sorry for the late reply. The 'Date:' line of these emails was November 
> 12, but
> they were sent on November 27! So my email client sorted them way down in the 
> list,
> out of sight. You might want to check the date in the future...

Sorry!..
It looks like i sent them from odroid-x arm board that i use to play
with and test usb radio devices that i have.
This arm board doesn't have battery to save RTC time and gentoo in
current configuration doesn't use NTP to update time from internet.

BTW, thanks!

-- 
Best regards, Klimov Alexey
--
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] [media] v4l: Add mt9v034 sensor driver

2012-11-30 Thread Alexey Klimov
Hi Enric,

May i ask about mt9v034_probe() and mt9v034_remove()?

On Fri, Oct 5, 2012 at 2:34 PM, Enric Balletbo i Serra
 wrote:
> From: Enric Balletbo i Serra 
>
> The MT9V034 is a parallel wide VGA sensor from Aptina (formerly Micron)
> controlled through I2C.
>
> The driver creates a V4L2 subdevice. It currently supports binning and
> cropping, and the gain, auto gain, exposure, auto exposure and test
> pattern controls.
>
> The following patch is based on the MT9V032 driver from Laurent Pinchart
> and was tested on IGEP tech based boards with custom expansion board with
> MT9V034 sensor.
>
> Signed-off-by: Enric Balletbo i Serra 
> ---
>  drivers/media/i2c/Kconfig   |   10 +
>  drivers/media/i2c/Makefile  |1 +
>  drivers/media/i2c/mt9v034.c |  834 
> +++
>  include/media/mt9v034.h |   15 +
>  4 files changed, 860 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/media/i2c/mt9v034.c
>  create mode 100644 include/media/mt9v034.h
>
> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
> index 0e0793a..c35efda 100644
> --- a/drivers/media/i2c/Kconfig
> +++ b/drivers/media/i2c/Kconfig
> @@ -475,6 +475,16 @@ config VIDEO_MT9V032
>   This is a Video4Linux2 sensor-level driver for the Micron
>   MT9V032 752x480 CMOS sensor.
>
> +config VIDEO_MT9V034
> +   tristate "Micron MT9V034 sensor support"
> +   depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
> +   depends on MEDIA_CAMERA_SUPPORT
> +   ---help---
> + This is a Video4Linux2 sensor-level driver for the Micron
> + MT9V034 752x480 CMOS sensor. The MT9V034 is a 1/3-inch
> + wide-VGA format CMOS active-pixel digital image sensor with
> + TrueSNAP gobal shutter and high dynamic range (HDR) operation.
> +
>  config VIDEO_TCM825X
> tristate "TCM825x camera sensor support"
> depends on I2C && VIDEO_V4L2
> diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
> index 4a270f7..9d4c417 100644
> --- a/drivers/media/i2c/Makefile
> +++ b/drivers/media/i2c/Makefile
> @@ -54,6 +54,7 @@ obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o
>  obj-$(CONFIG_VIDEO_MT9T001) += mt9t001.o
>  obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o
>  obj-$(CONFIG_VIDEO_MT9V032) += mt9v032.o
> +obj-$(CONFIG_VIDEO_MT9V034) += mt9v034.o
>  obj-$(CONFIG_VIDEO_SR030PC30)  += sr030pc30.o
>  obj-$(CONFIG_VIDEO_NOON010PC30)+= noon010pc30.o
>  obj-$(CONFIG_VIDEO_S5K6AA) += s5k6aa.o
> diff --git a/drivers/media/i2c/mt9v034.c b/drivers/media/i2c/mt9v034.c
> new file mode 100644
> index 000..7bbfeb6
> --- /dev/null
> +++ b/drivers/media/i2c/mt9v034.c
> @@ -0,0 +1,834 @@
> +/*
> + * Driver for MT9V034 CMOS Image Sensor from Micron
> + *
> + * Copyright (C) 2012, Enric Balletbo 
> + *
> + * Based on the MT9V032 driver,
> + *
> + * Copyright (C) 2010, Laurent Pinchart 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define MT9V034_PIXEL_ARRAY_HEIGHT 499
> +#define MT9V034_PIXEL_ARRAY_WIDTH  809
> +
> +#define MT9V034_SYSCLK_FREQ_DEF2660
> +
> +#define MT9V034_CHIP_VERSION   0x00
> +#defineMT9V034_CHIP_ID_REV10x1324
> +#define MT9V034_COLUMN_START   0x01
> +#defineMT9V034_COLUMN_START_MIN1
> +#defineMT9V034_COLUMN_START_DEF1
> +#defineMT9V034_COLUMN_START_MAX752
> +#define MT9V034_ROW_START  0x02
> +#defineMT9V034_ROW_START_MIN   4
> +#defineMT9V034_ROW_START_DEF   4
> +#defineMT9V034_ROW_START_MAX   482
> +#define MT9V034_WINDOW_HEIGHT  0x03
> +#defineMT9V034_WINDOW_HEIGHT_MIN   1
> +#defineMT9V034_WINDOW_HEIGHT_DEF   480
> +#defineMT9V034_WINDOW_HEIGHT_MAX   480
> +#define MT9V034_WINDOW_WIDTH   0x04
> +#defineMT9V034_WINDOW_WIDTH_MIN1
> +#defineMT9V034_WINDOW_WIDTH_DEF752
> +#defineMT9V034_WINDOW_WIDTH_MAX752
> +#define MT9V034_HORIZONTAL_BLANKING0x05
> +#defineMT9V034_HORIZONTAL_BLANKING_MIN 61
> +#defineMT9V034_HORIZONTAL_BLANKING_DEF 94
> +#defineMT9V034_HORIZONTAL_BLANKING_MAX 1023
> +#define MT9V034_VERTICAL_BLANKIN

[patch] MAINTAINERS: add entry for dsbr100 usb radio driver

2012-11-28 Thread Alexey Klimov
This patch adds MAINTAINERS entry for dsbr100 usb radio driver.

Signed-off-by: Alexey Klimov 


diff --git a/MAINTAINERS b/MAINTAINERS
index a36b29c..38da55f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2528,6 +2528,13 @@ S:   Supported
 F: drivers/gpu/drm/exynos
 F: include/drm/exynos*
 
+DSBR100 USB FM RADIO DRIVER
+M: Alexey Klimov 
+L: linux-media@vger.kernel.org
+T: git git://linuxtv.org/media_tree.git
+S: Maintained
+F: drivers/media/radio/dsbr100.c
+
 DSCC4 DRIVER
 M: Francois Romieu 
 L: net...@vger.kernel.org



--
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 03/03 v2] MAINTAINERS: add entry for radio-ma901 driver

2012-11-27 Thread Alexey Klimov
This patch adds MAINTAINERS entry for radio-ma901 usb radio driver.

Signed-off-by: Alexey Klimov 


diff --git a/MAINTAINERS b/MAINTAINERS
index b623679..a36b29c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4723,6 +4723,13 @@ Q:   
http://patchwork.linuxtv.org/project/linux-media/list/
 S: Maintained
 F: drivers/media/dvb-frontends/m88rs2000*
 
+MA901 MASTERKIT USB FM RADIO DRIVER
+M:  Alexey Klimov 
+L:  linux-media@vger.kernel.org
+T:  git git://linuxtv.org/media_tree.git
+S:  Maintained
+F:  drivers/media/radio/radio-ma901.c
+
 MAC80211
 M: Johannes Berg 
 L: linux-wirel...@vger.kernel.org


--
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 02/03 v2] usb hid quirks for Masterkit MA901 usb radio

2012-11-27 Thread Alexey Klimov
Don't let Masterkit MA901 USB radio be handled by usb hid drivers.

This device will be handled by radio-ma901.c driver.

Signed-off-by: Alexey Klimov 


diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 5de3bb3..8e06569 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2025,6 +2025,7 @@ static const struct hid_device_id hid_ignore_list[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) 
},
+   { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, 
USB_DEVICE_ID_MASTERKIT_MA901RADIO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 1dcb76f..17aa4f6 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -533,6 +533,9 @@
 #define USB_VENDOR_ID_MADCATZ  0x0738
 #define USB_DEVICE_ID_MADCATZ_BEATPAD  0x4540
 
+#define USB_VENDOR_ID_MASTERKIT0x16c0
+#define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df
+
 #define USB_VENDOR_ID_MCC  0x09db
 #define USB_DEVICE_ID_MCC_PMD1024LS0x0076
 #define USB_DEVICE_ID_MCC_PMD1208LS0x007a


--
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 01/03 v2] media: add driver for Masterkit MA901 usb radio

2012-11-27 Thread Alexey Klimov
This patch creates a new usb-radio driver, radio-ma901.c, that supports
Masterkit MA 901 USB FM radio devices. This device plugs into both the
USB and an analog audio input or headphones, so this thing only deals
with initialization and frequency setting.

Signed-off-by: Alexey Klimov 


diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index 8090b87..ead9928 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -124,6 +124,18 @@ config USB_KEENE
  To compile this driver as a module, choose M here: the
  module will be called radio-keene.
 
+config USB_MA901
+   tristate "Masterkit MA901 USB FM radio support"
+   depends on USB && VIDEO_V4L2
+   ---help---
+ Say Y here if you want to connect this type of radio to your
+ computer's USB port. Note that the audio is not digital, and
+ you must connect the line out connector to a sound card or a
+ set of speakers or headphones.
+
+ To compile this driver as a module, choose M here: the
+ module will be called radio-ma901.
+
 config RADIO_TEA5764
tristate "TEA5764 I2C FM radio support"
depends on I2C && VIDEO_V4L2
diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile
index c03ce4f..303eaeb 100644
--- a/drivers/media/radio/Makefile
+++ b/drivers/media/radio/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_USB_DSBR) += dsbr100.o
 obj-$(CONFIG_RADIO_SI470X) += si470x/
 obj-$(CONFIG_USB_MR800) += radio-mr800.o
 obj-$(CONFIG_USB_KEENE) += radio-keene.o
+obj-$(CONFIG_USB_MA901) += radio-ma901.o
 obj-$(CONFIG_RADIO_TEA5764) += radio-tea5764.o
 obj-$(CONFIG_RADIO_SAA7706H) += saa7706h.o
 obj-$(CONFIG_RADIO_TEF6862) += tef6862.o
diff --git a/drivers/media/radio/radio-ma901.c 
b/drivers/media/radio/radio-ma901.c
new file mode 100644
index 000..20e2880
--- /dev/null
+++ b/drivers/media/radio/radio-ma901.c
@@ -0,0 +1,460 @@
+/*
+ * Driver for the MasterKit MA901 USB FM radio. This device plugs
+ * into the USB port and an analog audio input or headphones, so this thing
+ * only deals with initialization, frequency setting, volume.
+ *
+ * Copyright (c) 2012 Alexey Klimov 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_AUTHOR "Alexey Klimov "
+#define DRIVER_DESC "Masterkit MA901 USB FM radio driver"
+#define DRIVER_VERSION "0.0.1"
+
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
+MODULE_VERSION(DRIVER_VERSION);
+
+#define USB_MA901_VENDOR  0x16c0
+#define USB_MA901_PRODUCT 0x05df
+
+/* dev_warn macro with driver name */
+#define MA901_DRIVER_NAME "radio-ma901"
+#define ma901radio_dev_warn(dev, fmt, arg...)  \
+   dev_warn(dev, MA901_DRIVER_NAME " - " fmt, ##arg)
+
+#define ma901radio_dev_err(dev, fmt, arg...) \
+   dev_err(dev, MA901_DRIVER_NAME " - " fmt, ##arg)
+
+/* Probably USB_TIMEOUT should be modified in module parameter */
+#define BUFFER_LENGTH 8
+#define USB_TIMEOUT 500
+
+#define FREQ_MIN  87.5
+#define FREQ_MAX 108.0
+#define FREQ_MUL 16000
+
+#define MA901_VOLUME_MAX 16
+#define MA901_VOLUME_MIN 0
+
+/* Commands that device should understand
+ * List isn't full and will be updated with implementation of new functions
+ */
+#define MA901_RADIO_SET_FREQ   0x03
+#define MA901_RADIO_SET_VOLUME 0x04
+#define MA901_RADIO_SET_MONO_STEREO0x05
+
+/* Comfortable defines for ma901radio_set_stereo */
+#define MA901_WANT_STEREO  0x50
+#define MA901_WANT_MONO0xd0
+
+/* module parameter */
+static int radio_nr = -1;
+module_param(radio_nr, int, 0);
+MODULE_PARM_DESC(radio_nr, "Radio file number");
+
+/* Data for one (physical) device */
+struct ma901radio_device {
+   /* reference to USB and video device */
+   struct usb_device *usbdev;
+   struct usb_interface *intf;
+   struct video_device vdev;
+   struct v4l2_device v4l2_dev;
+   struct v4l2_ctrl_handler hdl;
+
+   u8 *buffer;
+   struct mutex lock;  

[patch 00/03 v2] driver for Masterkit MA901 usb radio

2012-11-27 Thread Alexey Klimov
Hi all,

This is second version of small patch series for ma901 usb radio driver.
Initial letter about this usb radio was sent on October 29 and can be
found here: http://www.spinics.net/lists/linux-media/msg55779.html

Changes:
- removed f->type check and set in vidioc_g_frequency()
- added maintainers entry patch

Best regards,
Alexey Klimov

--
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: drivers without explicit MAINTAINERS entry - was: Re: [media-workshop] Tentative Agenda for the November workshop

2012-11-26 Thread Alexey Klimov
Hi Hans,

On Mon, Nov 26, 2012 at 6:15 PM, Hans Verkuil  wrote:
> On Mon 26 November 2012 00:18:30 Alexey Klimov wrote:
>> Hi Hans,
>>
>> On Fri, Nov 23, 2012 at 2:31 PM, Hans Verkuil  wrote:
>> > Hi Alexey,
>> >
>> > On Mon November 12 2012 19:41:57 Alexey Klimov wrote:
>> >> Hi Mauro, Hans, all,
>> >>
>> >> On Fri, Nov 2, 2012 at 6:34 PM, Mauro Carvalho Chehab
>> >>  wrote:
>> >> > Em Fri, 2 Nov 2012 14:47:49 +0100
>> >> > Hans Verkuil  escreveu:
>> >> >
>> >> >> On Fri November 2 2012 14:13:10 Mauro Carvalho Chehab wrote:
>> >> >> > Em Thu, 1 Nov 2012 14:12:44 -0200
>> >> >> > Mauro Carvalho Chehab  escreveu:
>> >> >> >
>> >> >> > > Em Thu, 1 Nov 2012 16:44:50 +0100
>> >> >> > > Hans Verkuil  escreveu:
>> >> >> > >
>> >> >> > > > On Thu October 25 2012 19:27:01 Mauro Carvalho Chehab wrote:
>> >> >> > > > > Hi Hans,
>> >> >> > > > >
>> >> >> > > > > Em Mon, 22 Oct 2012 10:35:56 +0200
>> >> >> > > > > Hans Verkuil  escreveu:
>> >> >> > > > >
>> >> >> > > > > > Hi all,
>> >> >> > > > > >
>> >> >> > > > > > This is the tentative agenda for the media workshop on 
>> >> >> > > > > > November 8, 2012.
>> >> >> > > > > > If you have additional things that you want to discuss, or 
>> >> >> > > > > > something is wrong
>> >> >> > > > > > or incomplete in this list, please let me know so I can 
>> >> >> > > > > > update the list.
>> >> >> > > > >
>> >> >> > > > > Thank you for taking care of it.
>> >> >> > > > >
>> >> >> > > > > > - Explain current merging process (Mauro)
>> >> >> > > > > > - Open floor for discussions on how to improve it (Mauro)
>> >> >> > > > > > - Write down minimum requirements for new V4L2 (and DVB?) 
>> >> >> > > > > > drivers, both for
>> >> >> > > > > >   staging and mainline acceptance: which frameworks to use, 
>> >> >> > > > > > v4l2-compliance,
>> >> >> > > > > >   etc. (Hans Verkuil)
>> >> >> > > > > > - V4L2 ambiguities (Hans Verkuil)
>> >> >> > > > > > - TSMux device (a mux rather than a demux): Alain Volmat
>> >> >> > > > > > - dmabuf status, esp. with regards to being able to test 
>> >> >> > > > > > (Mauro/Samsung)
>> >> >> > > > > > - Device tree support (Guennadi, not known yet whether this 
>> >> >> > > > > > topic is needed)
>> >> >> > > > > > - Creating/selecting contexts for hardware that supports 
>> >> >> > > > > > this (Samsung, only
>> >> >> > > > > >   if time is available)
>> >> >> > > > >
>> >> >> > > > > I have an extra theme for discussions there: what should we do 
>> >> >> > > > > with the drivers
>> >> >> > > > > that don't have any MAINTAINERS entry.
>> >> >> > > >
>> >> >> > > > I've added this topic to the list.
>> >> >> > >
>> >> >> > > Thanks!
>> >> >> > >
>> >> >> > > > > It probably makes sense to mark them as "Orphan" (or, at 
>> >> >> > > > > least, have some
>> >> >> > > > > criteria to mark them as such). Perhaps before doing that, we 
>> >> >> > > > > could try
>> >> >> > > > > to see if are there any developer at the community with time 
>> >> >> > > > > and patience
>> >> >> > > > > to handle them.
>> >> >> > > > >
>> >> >> > > > > This could of course be handled as part of the discussions 

Re: [patch review 01/02] add driver for Masterkit MA901 usb radio

2012-11-26 Thread Alexey Klimov
Hi Hans,

On Fri, Nov 23, 2012 at 3:42 PM, Hans Verkuil  wrote:
> Hi Alexey,
>
> Some (small) comments below...
>
> On Mon October 29 2012 02:41:10 Alexey Klimov wrote:
>> This patch creates a new usb-radio driver, radio-ma901.c, that supports
>> Masterkit MA 901 USB FM radio devices. This device plugs into both the
>> USB and an analog audio input or headphones, so this thing only deals
>> with initialization and frequency setting.
>>
>> Signed-off-by: Alexey Klimov 
>>
>>
>> diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
>> index 8090b87..ead9928 100644
>> --- a/drivers/media/radio/Kconfig
>> +++ b/drivers/media/radio/Kconfig
>> @@ -124,6 +124,18 @@ config USB_KEENE
>> To compile this driver as a module, choose M here: the
>> module will be called radio-keene.
>>
>> +config USB_MA901
>> + tristate "Masterkit MA901 USB FM radio support"
>> + depends on USB && VIDEO_V4L2
>> + ---help---
>> +   Say Y here if you want to connect this type of radio to your
>> +   computer's USB port. Note that the audio is not digital, and
>> +   you must connect the line out connector to a sound card or a
>> +   set of speakers or headphones.
>> +
>> +   To compile this driver as a module, choose M here: the
>> +   module will be called radio-ma901.
>> +
>>  config RADIO_TEA5764
>>   tristate "TEA5764 I2C FM radio support"
>>   depends on I2C && VIDEO_V4L2
>> diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile
>> index c03ce4f..303eaeb 100644
>> --- a/drivers/media/radio/Makefile
>> +++ b/drivers/media/radio/Makefile
>> @@ -24,6 +24,7 @@ obj-$(CONFIG_USB_DSBR) += dsbr100.o
>>  obj-$(CONFIG_RADIO_SI470X) += si470x/
>>  obj-$(CONFIG_USB_MR800) += radio-mr800.o
>>  obj-$(CONFIG_USB_KEENE) += radio-keene.o
>> +obj-$(CONFIG_USB_MA901) += radio-ma901.o
>>  obj-$(CONFIG_RADIO_TEA5764) += radio-tea5764.o
>>  obj-$(CONFIG_RADIO_SAA7706H) += saa7706h.o
>>  obj-$(CONFIG_RADIO_TEF6862) += tef6862.o
>> diff --git a/drivers/media/radio/radio-ma901.c 
>> b/drivers/media/radio/radio-ma901.c
>> new file mode 100644
>> index 000..987e4db
>> --- /dev/null
>> +++ b/drivers/media/radio/radio-ma901.c
>> @@ -0,0 +1,461 @@
>> +/*
>> + * Driver for the MasterKit MA901 USB FM radio. This device plugs
>> + * into the USB port and an analog audio input or headphones, so this thing
>> + * only deals with initialization, frequency setting, volume.
>> + *
>> + * Copyright (c) 2012 Alexey Klimov 
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; either version 2 of the License, or
>> + * (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program; if not, write to the Free Software
>> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#define DRIVER_AUTHOR "Alexey Klimov "
>> +#define DRIVER_DESC "Masterkit MA901 USB FM radio driver"
>> +#define DRIVER_VERSION "0.0.1"
>> +
>> +MODULE_AUTHOR(DRIVER_AUTHOR);
>> +MODULE_DESCRIPTION(DRIVER_DESC);
>> +MODULE_LICENSE("GPL");
>> +MODULE_VERSION(DRIVER_VERSION);
>> +
>> +#define USB_MA901_VENDOR  0x16c0
>> +#define USB_MA901_PRODUCT 0x05df
>> +
>> +/* dev_warn macro with driver name */
>> +#define MA901_DRIVER_NAME "radio-ma901"
>> +#define ma901radio_dev_warn(dev, fmt, arg...)   
>>  \
>> + dev_warn(dev, MA901_DRIVER_NAME " - " fmt, ##arg)
>> +
>> +#define ma901radio_dev_err(dev, fmt, arg...) \
>> + dev_err(dev, MA901_DRIVER_NAME " - " fmt, ##arg)
>> +
>> +/* Probably USB_TIMEOUT should be modifie

Re: [PATCH RFC v3 1/3] V4L: Add driver for S3C244X/S3C64XX SoC series camera interface

2012-11-25 Thread Alexey Klimov
Hi Sylwester,

On Sat, Nov 17, 2012 at 2:39 AM, Sylwester Nawrocki
 wrote:
> Hi Alexey,
>
>
> On 11/16/2012 03:10 PM, Alexey Klimov wrote:
>>>>
>>>> +static int s3c_camif_hw_init(struct camif_dev *camif, struct camif_vp
>>>> *vp)
>>>> +{
>>>> +   unsigned int ip_rev = camif->variant->ip_revision;
>>>> +   unsigned long flags;
>>>> +
>>>> +   if (camif->sensor.sd == NULL || vp->out_fmt == NULL)
>>>> +   return -EINVAL;
>>>> +
>>>> +   spin_lock_irqsave(&camif->slock, flags);
>>>> +
>>>> +   if (ip_rev == S3C244X_CAMIF_IP_REV)
>>>> +   camif_hw_clear_fifo_overflow(vp);
>>>> +   camif_hw_set_camera_bus(camif);
>>>> +   camif_hw_set_source_format(camif);
>>>> +   camif_hw_set_camera_crop(camif);
>>>> +   camif_hw_set_test_pattern(camif, camif->test_pattern->val);
>>>> +   if (ip_rev == S3C6410_CAMIF_IP_REV)
>>>> +   camif_hw_set_input_path(vp);
>>>> +   camif_cfg_video_path(vp);
>>>> +   vp->state&= ~ST_VP_CONFIG;
>>>>
>>>> +
>>>> +   spin_unlock_irqrestore(&camif->slock, flags);
>>>> +   return 0;
>>>> +}
>>>> +
>>>> +/*
>>>> + * Initialize the video path, only up from the scaler stage. The camera
>>>> + * input interface set up is skipped. This is useful to enable one of
>>>> the
>>>> + * video paths when the other is already running.
>>>> + */
>>>> +static int s3c_camif_hw_vp_init(struct camif_dev *camif, struct
>>>> camif_vp
>>>> *vp)
>>>> +{
>>>> +   unsigned int ip_rev = camif->variant->ip_revision;
>>>> +   unsigned long flags;
>>>> +
>>>> +   if (vp->out_fmt == NULL)
>>>> +   return -EINVAL;
>>>> +
>>>> +   spin_lock_irqsave(&camif->slock, flags);
>>>> +   camif_prepare_dma_offset(vp);
>>>> +   if (ip_rev == S3C244X_CAMIF_IP_REV)
>>>> +   camif_hw_clear_fifo_overflow(vp);
>>>> +   camif_cfg_video_path(vp);
>>>> +   if (ip_rev == S3C6410_CAMIF_IP_REV)
>>>> +   camif_hw_set_effect(vp, false);
>>>> +   vp->state&= ~ST_VP_CONFIG;
>>>>
>>>> +
>>>> +   spin_unlock_irqrestore(&camif->slock, flags);
>>>> +   return 0;
>>>> +}
>
> ...
>>>>
>>>> +/*
>>>> + * Reinitialize the driver so it is ready to start streaming again.
>>>> + * Return any buffers to vb2, perform CAMIF software reset and
>>>> + * turn off streaming at the data pipeline (sensor) if required.
>>>> + */
>>>> +static int camif_reinitialize(struct camif_vp *vp)
>>>> +{
>>>> +   struct camif_dev *camif = vp->camif;
>>>> +   struct camif_buffer *buf;
>>>> +   unsigned long flags;
>>>> +   bool streaming;
>>>> +
>>>> +   spin_lock_irqsave(&camif->slock, flags);
>>>> +   streaming = vp->state&  ST_VP_SENSOR_STREAMING;
>>>> +
>>>> +   vp->state&= ~(ST_VP_PENDING | ST_VP_RUNNING | ST_VP_OFF |
>>>>
>>>> +  ST_VP_ABORTING | ST_VP_STREAMING |
>>>> +  ST_VP_SENSOR_STREAMING | ST_VP_LASTIRQ);
>>>> +
>>>> +   /* Release unused buffers */
>>>> +   while (!list_empty(&vp->pending_buf_q)) {
>>>> +   buf = camif_pending_queue_pop(vp);
>>>> +   vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
>>>> +   }
>>>> +
>>>> +   while (!list_empty(&vp->active_buf_q)) {
>>>> +   buf = camif_active_queue_pop(vp);
>>>> +   vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
>>>> +   }
>>>> +
>>>> +   spin_unlock_irqrestore(&camif->slock, flags);
>>>> +
>>>> +   if (!streaming)
>>>> +   return 0;
>>>> +
>>>> +   return sensor_set_streaming(camif, 0);
>>>> +}
>
> ...
>
>>>> +static int start_streaming(struct vb2_queue *vq, unsigned int count)
>>>> +{

Re: drivers without explicit MAINTAINERS entry - was: Re: [media-workshop] Tentative Agenda for the November workshop

2012-11-25 Thread Alexey Klimov
Hi Hans,

On Fri, Nov 23, 2012 at 2:31 PM, Hans Verkuil  wrote:
> Hi Alexey,
>
> On Mon November 12 2012 19:41:57 Alexey Klimov wrote:
>> Hi Mauro, Hans, all,
>>
>> On Fri, Nov 2, 2012 at 6:34 PM, Mauro Carvalho Chehab
>>  wrote:
>> > Em Fri, 2 Nov 2012 14:47:49 +0100
>> > Hans Verkuil  escreveu:
>> >
>> >> On Fri November 2 2012 14:13:10 Mauro Carvalho Chehab wrote:
>> >> > Em Thu, 1 Nov 2012 14:12:44 -0200
>> >> > Mauro Carvalho Chehab  escreveu:
>> >> >
>> >> > > Em Thu, 1 Nov 2012 16:44:50 +0100
>> >> > > Hans Verkuil  escreveu:
>> >> > >
>> >> > > > On Thu October 25 2012 19:27:01 Mauro Carvalho Chehab wrote:
>> >> > > > > Hi Hans,
>> >> > > > >
>> >> > > > > Em Mon, 22 Oct 2012 10:35:56 +0200
>> >> > > > > Hans Verkuil  escreveu:
>> >> > > > >
>> >> > > > > > Hi all,
>> >> > > > > >
>> >> > > > > > This is the tentative agenda for the media workshop on November 
>> >> > > > > > 8, 2012.
>> >> > > > > > If you have additional things that you want to discuss, or 
>> >> > > > > > something is wrong
>> >> > > > > > or incomplete in this list, please let me know so I can update 
>> >> > > > > > the list.
>> >> > > > >
>> >> > > > > Thank you for taking care of it.
>> >> > > > >
>> >> > > > > > - Explain current merging process (Mauro)
>> >> > > > > > - Open floor for discussions on how to improve it (Mauro)
>> >> > > > > > - Write down minimum requirements for new V4L2 (and DVB?) 
>> >> > > > > > drivers, both for
>> >> > > > > >   staging and mainline acceptance: which frameworks to use, 
>> >> > > > > > v4l2-compliance,
>> >> > > > > >   etc. (Hans Verkuil)
>> >> > > > > > - V4L2 ambiguities (Hans Verkuil)
>> >> > > > > > - TSMux device (a mux rather than a demux): Alain Volmat
>> >> > > > > > - dmabuf status, esp. with regards to being able to test 
>> >> > > > > > (Mauro/Samsung)
>> >> > > > > > - Device tree support (Guennadi, not known yet whether this 
>> >> > > > > > topic is needed)
>> >> > > > > > - Creating/selecting contexts for hardware that supports this 
>> >> > > > > > (Samsung, only
>> >> > > > > >   if time is available)
>> >> > > > >
>> >> > > > > I have an extra theme for discussions there: what should we do 
>> >> > > > > with the drivers
>> >> > > > > that don't have any MAINTAINERS entry.
>> >> > > >
>> >> > > > I've added this topic to the list.
>> >> > >
>> >> > > Thanks!
>> >> > >
>> >> > > > > It probably makes sense to mark them as "Orphan" (or, at least, 
>> >> > > > > have some
>> >> > > > > criteria to mark them as such). Perhaps before doing that, we 
>> >> > > > > could try
>> >> > > > > to see if are there any developer at the community with time and 
>> >> > > > > patience
>> >> > > > > to handle them.
>> >> > > > >
>> >> > > > > This could of course be handled as part of the discussions about 
>> >> > > > > how to improve
>> >> > > > > the merge process, but I suspect that this could generate enough 
>> >> > > > > discussions
>> >> > > > > to be handled as a separate theme.
>> >> > > >
>> >> > > > Do we have a 'Maintainer-Light' category? I have a lot of hardware 
>> >> > > > that I can
>> >> > > > test. So while I wouldn't like to be marked as 'The Maintainer of 
>> >> > > > driver X'
>> >> > > > (since I simply don't have the time for that), I wouldn't mind 
>> >> &g

Re: [PATCH v3 5/6] Add a V4L2 driver for SI476X MFD

2012-11-16 Thread Alexey Klimov
Hello Andrey,

On Tue, Oct 23, 2012 at 10:44 PM, Andrey Smirnov
 wrote:
> This commit adds a driver that exposes all the radio related
> functionality of the Si476x series of chips via the V4L2 subsystem.
>
> Signed-off-by: Andrey Smirnov 
> ---
>  drivers/media/radio/Kconfig|   17 +
>  drivers/media/radio/Makefile   |1 +
>  drivers/media/radio/radio-si476x.c | 1549 
> 
>  3 files changed, 1567 insertions(+)
>  create mode 100644 drivers/media/radio/radio-si476x.c
>
> diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
> index 8090b87..3c79d09 100644
> --- a/drivers/media/radio/Kconfig
> +++ b/drivers/media/radio/Kconfig
> @@ -16,6 +16,23 @@ config RADIO_SI470X
> bool "Silicon Labs Si470x FM Radio Receiver support"
> depends on VIDEO_V4L2
>
> +config RADIO_SI476X
> +   tristate "Silicon Laboratories Si476x I2C FM Radio"
> +   depends on I2C && VIDEO_V4L2
> +   select MFD_CORE
> +   select MFD_SI476X_CORE
> +   select SND_SOC_SI476X
> +   ---help---
> + Choose Y here if you have this FM radio chip.
> +
> + In order to control your radio card, you will need to use programs
> + that are compatible with the Video For Linux 2 API.  Information on
> + this API and pointers to "v4l2" programs may be found at
> + .
> +
> + To compile this driver as a module, choose M here: the
> + module will be called radio-si476x.
> +
>  source "drivers/media/radio/si470x/Kconfig"
>
>  config USB_MR800
> diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile
> index c03ce4f..c4618e0 100644
> --- a/drivers/media/radio/Makefile
> +++ b/drivers/media/radio/Makefile
> @@ -19,6 +19,7 @@ obj-$(CONFIG_RADIO_GEMTEK) += radio-gemtek.o
>  obj-$(CONFIG_RADIO_TRUST) += radio-trust.o
>  obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o
>  obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o
> +obj-$(CONFIG_RADIO_SI476X) += radio-si476x.o
>  obj-$(CONFIG_RADIO_MIROPCM20) += radio-miropcm20.o
>  obj-$(CONFIG_USB_DSBR) += dsbr100.o
>  obj-$(CONFIG_RADIO_SI470X) += si470x/
> diff --git a/drivers/media/radio/radio-si476x.c 
> b/drivers/media/radio/radio-si476x.c
> new file mode 100644
> index 000..c8fa90f
> --- /dev/null
> +++ b/drivers/media/radio/radio-si476x.c
> @@ -0,0 +1,1549 @@
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +
> +#include 
> +
> +#define FM_FREQ_RANGE_LOW   6400
> +#define FM_FREQ_RANGE_HIGH 10800
> +
> +#define AM_FREQ_RANGE_LOW52
> +#define AM_FREQ_RANGE_HIGH 3000
> +
> +#define PWRLINEFLTR (1 << 8)
> +
> +#define FREQ_MUL (1000 / 625)
> +
> +#define SI476X_PHDIV_STATUS_LINK_LOCKED(status) (0b1000 & (status))
> +
> +#define DRIVER_NAME "si476x-radio"
> +#define DRIVER_CARD "SI476x AM/FM Receiver"
> +
> +enum si476x_freq_bands {
> +   SI476X_BAND_FM,
> +   SI476X_BAND_AM,
> +};
> +
> +static const struct v4l2_frequency_band si476x_bands[] = {
> +   [SI476X_BAND_FM] = {
> +   .type   = V4L2_TUNER_RADIO,
> +   .index  = SI476X_BAND_FM,
> +   .capability = V4L2_TUNER_CAP_LOW
> +   | V4L2_TUNER_CAP_STEREO
> +   | V4L2_TUNER_CAP_RDS
> +   | V4L2_TUNER_CAP_RDS_BLOCK_IO
> +   | V4L2_TUNER_CAP_FREQ_BANDS,
> +   .rangelow   =  64 * FREQ_MUL,
> +   .rangehigh  = 108 * FREQ_MUL,
> +   .modulation = V4L2_BAND_MODULATION_FM,
> +   },
> +   [SI476X_BAND_AM] = {
> +   .type   = V4L2_TUNER_RADIO,
> +   .index  = SI476X_BAND_AM,
> +   .capability = V4L2_TUNER_CAP_LOW | 
> V4L2_TUNER_CAP_FREQ_BANDS,
> +   .rangelow   = 0.52 * FREQ_MUL,
> +   .rangehigh  = 30 * FREQ_MUL,
> +   .modulation = V4L2_BAND_MODULATION_AM,
> +   },
> +};
> +
> +static inline bool si476x_radio_freq_is_inside_of_the_band(u32 freq, int 
> band)
> +{
> +   return freq >= si476x_bands[band].rangelow &&
> +   freq <= si476x_bands[band].rangehigh;
> +}
> +
> +static inline bool si476x_radio_range_is_inside_of_the_band(u32 low, u32 
> high, int band)
> +{
> +   return low  >= si476x_bands[band].rangelow &&
> +   high <= si476x_bands[band].rangehigh;
> +}
> +
> +#define PRIVATE_CTL_IDX(x) (x - V4L2_CID_PRIVATE_BASE)
> +
> +static int si476x_radio_s_ctrl(struct v4l2_ctrl *ctrl);
> +static int si476x_radio_g_volatile_ctrl(struct v4l2_ctrl *ctrl);
> +
> +static const char * const deemphasis[] = {
> +   "75 us",
> +   "50 us",
> +};
> +
> +enum phase_diversity_modes_idx {
> +   SI476X_IDX_PHDIV_DISABLED,
> +   SI476X_IDX_PHDIV_PRIMARY_COMBINING,
> +   SI476X_IDX_PHDIV_PRIMARY_ANTENNA,
> +   SI476X_IDX_PHDIV_SECONDARY_ANTENNA,
> 

[patch] MAINTAINERS: add an entry for radio-mr800 driver

2012-11-16 Thread Alexey Klimov
This patch adds MAINTAINERS entry for radio-mr800 usb radio driver.

Signed-off-by: Alexey Klimov 

diff --git a/MAINTAINERS b/MAINTAINERS
index f4b3aa8..e1d9e38 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4909,6 +4909,13 @@ S:   Maintained
 F: Documentation/serial/moxa-smartio
 F: drivers/tty/mxser.*
 
+MR800 AVERMEDIA USB FM RADIO DRIVER
+M: Alexey Klimov 
+L: linux-media@vger.kernel.org
+T: git git://linuxtv.org/media_tree.git
+S: Maintained
+F: drivers/media/radio/radio-mr800.c
+
 MSI LAPTOP SUPPORT
 M: "Lee, Chun-Yi" 
 L: platform-driver-...@vger.kernel.org


--
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 RFC v3 1/3] V4L: Add driver for S3C244X/S3C64XX SoC series camera interface

2012-11-16 Thread Alexey Klimov
Hi Sylwester,

> On Fri, Nov 16, 2012 at 2:05 AM, Sylwester Nawrocki
>  wrote:
>>
>> This patch adds V4L2 driver for Samsung S3C244X/S3C64XX SoC series
>> camera interface. The driver exposes a subdev device node for CAMIF
>> pixel resolution and crop control and two video capture nodes - for
>> the "codec" and "preview" data paths. It has been tested on Mini2440
>> (s3c2440) and Mini6410 (s3c6410) board with gstreamer and mplayer.
>>
>> Signed-off-by: Sylwester Nawrocki 
>> Signed-off-by: Tomasz Figa 
>> ---
>>  drivers/media/platform/Kconfig   |   12 +
>>  drivers/media/platform/Makefile  |1 +
>>  drivers/media/platform/s3c-camif/Makefile|5 +
>>  drivers/media/platform/s3c-camif/camif-capture.c | 1636
>> ++
>>  drivers/media/platform/s3c-camif/camif-core.c|  661 +
>>  drivers/media/platform/s3c-camif/camif-core.h|  382 +
>>  drivers/media/platform/s3c-camif/camif-regs.c|  579 
>>  drivers/media/platform/s3c-camif/camif-regs.h|  267 
>>  include/media/s3c_camif.h|   45 +
>>  9 files changed, 3588 insertions(+), 0 deletions(-)
>>  create mode 100644 drivers/media/platform/s3c-camif/Makefile
>>  create mode 100644 drivers/media/platform/s3c-camif/camif-capture.c
>>  create mode 100644 drivers/media/platform/s3c-camif/camif-core.c
>>  create mode 100644 drivers/media/platform/s3c-camif/camif-core.h
>>  create mode 100644 drivers/media/platform/s3c-camif/camif-regs.c
>>  create mode 100644 drivers/media/platform/s3c-camif/camif-regs.h
>>  create mode 100644 include/media/s3c_camif.h
>>
>> diff --git a/drivers/media/platform/Kconfig
>> b/drivers/media/platform/Kconfig
>> index 181c768..3dcfea6 100644
>> --- a/drivers/media/platform/Kconfig
>> +++ b/drivers/media/platform/Kconfig
>> @@ -109,6 +109,18 @@ config VIDEO_OMAP3_DEBUG
>> ---help---
>>   Enable debug messages on OMAP 3 camera controller driver.
>>
>> +config VIDEO_S3C_CAMIF
>> +   tristate "Samsung S3C24XX/S3C64XX SoC Camera Interface driver"
>> +   depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
>> +   depends on (PLAT_S3C64XX || PLAT_S3C24XX) && PM_RUNTIME
>> +   select VIDEOBUF2_DMA_CONTIG
>> +   ---help---
>> + This is a v4l2 driver for s3c24xx and s3c64xx SoC series camera
>> + host interface (CAMIF).
>> +
>> + To compile this driver as a module, choose M here: the module
>> + will be called s3c-camif.
>> +
>>  source "drivers/media/platform/soc_camera/Kconfig"
>>  source "drivers/media/platform/s5p-fimc/Kconfig"
>>  source "drivers/media/platform/s5p-tv/Kconfig"
>> diff --git a/drivers/media/platform/Makefile
>> b/drivers/media/platform/Makefile
>> index baaa550..4817d28 100644
>> --- a/drivers/media/platform/Makefile
>> +++ b/drivers/media/platform/Makefile
>> @@ -27,6 +27,7 @@ obj-$(CONFIG_VIDEO_CODA)  += coda.o
>>
>>  obj-$(CONFIG_VIDEO_MEM2MEM_DEINTERLACE)+= m2m-deinterlace.o
>>
>> +obj-$(CONFIG_VIDEO_S3C_CAMIF)  += s3c-camif/
>>  obj-$(CONFIG_VIDEO_SAMSUNG_S5P_FIMC)   += s5p-fimc/
>>  obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG)   += s5p-jpeg/
>>  obj-$(CONFIG_VIDEO_SAMSUNG_S5P_MFC)+= s5p-mfc/
>> diff --git a/drivers/media/platform/s3c-camif/Makefile
>> b/drivers/media/platform/s3c-camif/Makefile
>> new file mode 100644
>> index 000..50bf8c5
>> --- /dev/null
>> +++ b/drivers/media/platform/s3c-camif/Makefile
>> @@ -0,0 +1,5 @@
>> +# Makefile for s3c244x/s3c64xx CAMIF driver
>> +
>> +s3c-camif-objs := camif-core.o camif-capture.o camif-regs.o
>> +
>> +obj-$(CONFIG_VIDEO_S3C_CAMIF) += s3c-camif.o
>> diff --git a/drivers/media/platform/s3c-camif/camif-capture.c
>> b/drivers/media/platform/s3c-camif/camif-capture.c
>> new file mode 100644
>> index 000..8daf684
>> --- /dev/null
>> +++ b/drivers/media/platform/s3c-camif/camif-capture.c
>> @@ -0,0 +1,1636 @@
>> +/*
>> + * s3c24xx/s3c64xx SoC series Camera Interface (CAMIF) driver
>> + *
>> + * Copyright (C) 2012 Sylwester Nawrocki 
>> + * Copyright (C) 2012 Tomasz Figa 
>> + *
>> + * Based on drivers/media/platform/s5p-fimc,
>> + * Copyright (C) 2010 - 2012 Samsung Electronics Co., Ltd.
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> +*/
>> +#define pr_fmt(fmt) "%s:%d " fmt, __func__, __LINE__
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include "camif-core.h"
>> +#include "camif-regs.h"
>> +
>> +static int debug;
>> +module_param(debug, int, 0644);
>> +
>> +/* Locking: called with vp->camif->slock held */
>> +static void camif_c

Re: [PATCH v8 2/6] video: add of helper for videomode

2012-11-12 Thread Alexey Klimov
Hello Steffen,

On Mon, Nov 12, 2012 at 7:37 PM, Steffen Trumtrar
 wrote:
> This adds support for reading display timings from DT or/and convert one of 
> those
> timings to a videomode.
> The of_display_timing implementation supports multiple children where each
> property can have up to 3 values. All children are read into an array, that
> can be queried.
> of_get_videomode converts exactly one of that timings to a struct videomode.
>
> Signed-off-by: Steffen Trumtrar 
> Signed-off-by: Philipp Zabel 
> ---
>  .../devicetree/bindings/video/display-timings.txt  |  107 +++
>  drivers/video/Kconfig  |   13 ++
>  drivers/video/Makefile |2 +
>  drivers/video/of_display_timing.c  |  186 
> 
>  drivers/video/of_videomode.c   |   47 +
>  include/linux/of_display_timings.h |   19 ++
>  include/linux/of_videomode.h   |   15 ++
>  7 files changed, 389 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/video/display-timings.txt
>  create mode 100644 drivers/video/of_display_timing.c
>  create mode 100644 drivers/video/of_videomode.c
>  create mode 100644 include/linux/of_display_timings.h
>  create mode 100644 include/linux/of_videomode.h
>
> diff --git a/Documentation/devicetree/bindings/video/display-timings.txt 
> b/Documentation/devicetree/bindings/video/display-timings.txt
> new file mode 100644
> index 000..e22e2fd
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/display-timings.txt
> @@ -0,0 +1,107 @@
> +display-timings bindings
> +
> +
> +display-timings-node
> +
> +
> +required properties:
> + - none
> +
> +optional properties:
> + - native-mode: the native mode for the display, in case multiple modes are
> +   provided. When omitted, assume the first node is the native.
> +
> +timings-subnode
> +---
> +
> +required properties:
> + - hactive, vactive: Display resolution
> + - hfront-porch, hback-porch, hsync-len: Horizontal Display timing parameters
> +   in pixels
> +   vfront-porch, vback-porch, vsync-len: Vertical display timing parameters 
> in
> +   lines
> + - clock-frequency: displayclock in Hz
> +
> +optional properties:
> + - hsync-active : Hsync pulse is active low/high/ignored
> + - vsync-active : Vsync pulse is active low/high/ignored
> + - de-active : Data-Enable pulse is active low/high/ignored
> + - pixelclk-inverted : pixelclock is inverted/non-inverted/ignored
> + - interlaced (bool)
> + - doublescan (bool)
> +
> +All the optional properties that are not bool follow the following logic:
> +<1> : high active
> +<0> : low active
> +omitted : not used on hardware
> +
> +There are different ways of describing the capabilities of a display. The 
> devicetree
> +representation corresponds to the one commonly found in datasheets for 
> displays.
> +If a display supports multiple signal timings, the native-mode can be 
> specified.
> +
> +The parameters are defined as
> +
> +struct display_timing
> +=
> +
> +  
> +--+-+--+---+
> +  |  |↑|  |  
>  |
> +  |  ||vback_porch |  |  
>  |
> +  |  |↓|  |  
>  |
> +  
> +--###--+---+
> +  |  #↑#  |  
>  |
> +  |  #|#  |  
>  |
> +  |  hback   #|#  hfront  | 
> hsync |
> +  |   porch  #|   hactive  #  porch   |  len 
>  |
> +  
> |<>#<---+--->#<>|<->|
> +  |  #|#  |  
>  |
> +  |  #|vactive #  |  
>  |
> +  |  #|#  |  
>  |
> +  |  #↓#  |  
>  |
> +  
> +--###--+---+
> +  |  |↑|  |  
>  |
> +  |  ||vfront_porch|  |  
>  |
> +  |  |↓|  |  
>  |
> +  
> +--+-+--+---+
> +  |  |↑|  |  
>  |
> +  |  ||vsync_len   |  |  
>  |
> +  |  |   

Re: drivers without explicit MAINTAINERS entry - was: Re: [media-workshop] Tentative Agenda for the November workshop

2012-11-12 Thread Alexey Klimov
ild.pl --path drivers/media/ --show_files_per_module 
>> > >/tmp/all_drivers
>> > grep drivers/media/ MAINTAINERS | perl -ne 
>> > 's/F:\s+//;s,drivers/media/,,; print $_ if (!/^\n/)' >maintained
>> > grep -v -f maintained /tmp/all_drivers |grep -v -e keymaps -e 
>> > v4l2-core/ -e dvb-core/ -e media.ko -e rc-core.ko -e ^#| sort 
>> > >without_maint
>> >
>> > I excluded the core files from the list, as they don't need any specific 
>> > entry. RC
>> > keymaps is also a special case, as I don't think any maintainer is needed 
>> > for them.
>> >
>> > Basically, analyze_build.pl says that there are 613 drivers under 
>> > drivers/media.
>> > The above script shows 348 drivers without an explicit maintainer. So, 
>> > only 43%
>> > of the drivers have a formal maintainer.
>> >
>> > Yet, on the list below, I think several of them can be easily tagged as
>> > "Odd fixes", like cx88 and saa7134.
>> >
>> > I think I'll send today a few RFC MAINTAINERS patches for some stuff below 
>> > that
>> > I can myself be added as "Odd fixes". Yet, I would very much prefer if 
>> > someone
>> > with more time than me could be taking over the "Odd fixes" patches I'll 
>> > propose.
>> >
>> > Regards,
>> > Mauro
>>
>> These two are 'Supported' by me:
>>
>> i2c/ad9389b.ko = i2c/ad9389b.c
>> i2c/adv7604.ko = i2c/adv7604.c
>>
>> These are 'Maintained' by me:
>>
>> i2c/cx2341x.ko = i2c/cx2341x.c
>> parport/bw-qcam.ko = parport/bw-qcam.c
>> parport/c-qcam.ko  = parport/c-qcam.c
>> radio/dsbr100.ko   = radio/dsbr100.c
>> radio/radio-cadet.ko   = radio/radio-cadet.c
>> radio/radio-isa.ko = radio/radio-isa.c
>> radio/radio-keene.ko   = radio/radio-keene.c
>
> OK. Could you please send patches for those? I think that the better is
> to write one patch by each MAINTAINERS entry (except, of course, if there
> are consecutive entries), as I suspect that MAINTAINERS is likely one
> of top-rated merge-conflicts file.
>
>>
>> There are more radio drivers that can have that status, but I would need
>> to check that when I'm back in Oslo.
>>
>> I can do 'Odd fixes' for the following:
>>
>> i2c/cx25840/cx25840.ko = i2c/cx25840/cx25840-core.c 
>> i2c/cx25840/cx25840-audio.c i2c/cx25840/cx25840-firmware.c 
>> i2c/cx25840/cx25840-vbi.c i2c/cx25840/cx25840-ir.c
>> i2c/m52790.ko  = i2c/m52790.c
>> i2c/msp3400.ko = i2c/msp3400-driver.c i2c/msp3400-kthreads.c
>> i2c/saa6588.ko = i2c/saa6588.c
>> i2c/saa7110.ko = i2c/saa7110.c
>> i2c/saa7115.ko = i2c/saa7115.c
>> i2c/saa7127.ko = i2c/saa7127.c
>> i2c/saa717x.ko = i2c/saa717x.c
>> i2c/tda7432.ko = i2c/tda7432.c
>> i2c/tda9840.ko = i2c/tda9840.c
>> i2c/tea6415c.ko= i2c/tea6415c.c
>> i2c/tea6420.ko = i2c/tea6420.c
>> i2c/tvaudio.ko = i2c/tvaudio.c
>> i2c/tveeprom.ko= i2c/tveeprom.c
>
>> i2c/tvp5150.ko = i2c/tvp5150.c
> While I don't mind if you want to do odd fixes for this device,
> I think I can maintain this one, as the "default" device I use for
> random tests has this chipset (HVR-950), and I wrote this driver.
>
>> i2c/wm8739.ko  = i2c/wm8739.c
>> i2c/wm8775.ko  = i2c/wm8775.c
>> parport/pms.ko = parport/pms.c
>> platform/vivi.ko   = platform/vivi.c
>> radio/radio-aimslab.ko = radio/radio-aimslab.c
>> radio/radio-gemtek.ko  = radio/radio-gemtek.c
>> radio/radio-maxiradio.ko   = radio/radio-maxiradio.c
>> radio/radio-miropcm20.ko   = radio/radio-miropcm20.c
>> radio/radio-mr800.ko   = radio/radio-mr800.c
>> radio/radio-rtrack2.ko = radio/radio-rtrack2.c
>> radio/radio-si4713.ko  = radio/radio-si4713.c
>
>> usb/cx231xx/cx231xx-alsa.ko= usb/cx231xx/cx231xx-audio.c
>> usb/cx231xx/cx231xx-dvb.ko = usb/cx231xx/cx231xx-dvb.c
>> usb/cx231xx/cx231xx-input.ko   = usb/cx231xx/cx231xx-input.c
>> usb/cx231xx/cx231xx.ko = +
> I think we should check if the driver author is not interested on
> taking maintainership for this one, before putting it on Odd fixes status.

I'm very sorry for long silence but i'm ready to take maintainership
for radio-mr800. By the way, i think that only fixes will be present
for this driver in the future.

Is it possible for driver to have two maintainers or for example one
person marked as maintainer and another one marked as "odd fixes" ? I
mean i'm interested to be in c/c regarding all email, news,
interesting patches for radio-mr800, dsbr100 and usb radio part of
si470x but i don't know how to mark it that i want to help with these
drivers. I have only dsbr100, mr800 and kworld fm700 (based on si470x)
usb radios and i'm ready to test any patches and help as much as i
can.
I don't have usb radio for radio-keene.c driver but i probably will
take a look how to buy it here..

And i'm also ready to maintain driver radio-ma901.c. I posted patches
for this device about two weeks ago. Driver is rather small (first
working version) but i hope to add more features there in future.

Best regards and wishes,
Alexey Klimov
--
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 review 02/02] usb hid quirks for Masterkit MA901 usb radio

2012-10-28 Thread Alexey Klimov
Don't let Masterkit MA901 USB radio be handled by usb hid drivers.

This device will be handled by radio-ma901.c driver.

Signed-off-by: Alexey Klimov 

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 5de3bb3..8e06569 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2025,6 +2025,7 @@ static const struct hid_device_id hid_ignore_list[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) 
},
+   { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, 
USB_DEVICE_ID_MASTERKIT_MA901RADIO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 1dcb76f..17aa4f6 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -533,6 +533,9 @@
 #define USB_VENDOR_ID_MADCATZ  0x0738
 #define USB_DEVICE_ID_MADCATZ_BEATPAD  0x4540
 
+#define USB_VENDOR_ID_MASTERKIT0x16c0
+#define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df
+
 #define USB_VENDOR_ID_MCC  0x09db
 #define USB_DEVICE_ID_MCC_PMD1024LS0x0076
 #define USB_DEVICE_ID_MCC_PMD1208LS0x007a



--
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 review 01/02] add driver for Masterkit MA901 usb radio

2012-10-28 Thread Alexey Klimov
This patch creates a new usb-radio driver, radio-ma901.c, that supports
Masterkit MA 901 USB FM radio devices. This device plugs into both the
USB and an analog audio input or headphones, so this thing only deals
with initialization and frequency setting.

Signed-off-by: Alexey Klimov 


diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index 8090b87..ead9928 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -124,6 +124,18 @@ config USB_KEENE
  To compile this driver as a module, choose M here: the
  module will be called radio-keene.
 
+config USB_MA901
+   tristate "Masterkit MA901 USB FM radio support"
+   depends on USB && VIDEO_V4L2
+   ---help---
+ Say Y here if you want to connect this type of radio to your
+ computer's USB port. Note that the audio is not digital, and
+ you must connect the line out connector to a sound card or a
+ set of speakers or headphones.
+
+ To compile this driver as a module, choose M here: the
+ module will be called radio-ma901.
+
 config RADIO_TEA5764
tristate "TEA5764 I2C FM radio support"
depends on I2C && VIDEO_V4L2
diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile
index c03ce4f..303eaeb 100644
--- a/drivers/media/radio/Makefile
+++ b/drivers/media/radio/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_USB_DSBR) += dsbr100.o
 obj-$(CONFIG_RADIO_SI470X) += si470x/
 obj-$(CONFIG_USB_MR800) += radio-mr800.o
 obj-$(CONFIG_USB_KEENE) += radio-keene.o
+obj-$(CONFIG_USB_MA901) += radio-ma901.o
 obj-$(CONFIG_RADIO_TEA5764) += radio-tea5764.o
 obj-$(CONFIG_RADIO_SAA7706H) += saa7706h.o
 obj-$(CONFIG_RADIO_TEF6862) += tef6862.o
diff --git a/drivers/media/radio/radio-ma901.c 
b/drivers/media/radio/radio-ma901.c
new file mode 100644
index 000..987e4db
--- /dev/null
+++ b/drivers/media/radio/radio-ma901.c
@@ -0,0 +1,461 @@
+/*
+ * Driver for the MasterKit MA901 USB FM radio. This device plugs
+ * into the USB port and an analog audio input or headphones, so this thing
+ * only deals with initialization, frequency setting, volume.
+ *
+ * Copyright (c) 2012 Alexey Klimov 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_AUTHOR "Alexey Klimov "
+#define DRIVER_DESC "Masterkit MA901 USB FM radio driver"
+#define DRIVER_VERSION "0.0.1"
+
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
+MODULE_VERSION(DRIVER_VERSION);
+
+#define USB_MA901_VENDOR  0x16c0
+#define USB_MA901_PRODUCT 0x05df
+
+/* dev_warn macro with driver name */
+#define MA901_DRIVER_NAME "radio-ma901"
+#define ma901radio_dev_warn(dev, fmt, arg...)  \
+   dev_warn(dev, MA901_DRIVER_NAME " - " fmt, ##arg)
+
+#define ma901radio_dev_err(dev, fmt, arg...) \
+   dev_err(dev, MA901_DRIVER_NAME " - " fmt, ##arg)
+
+/* Probably USB_TIMEOUT should be modified in module parameter */
+#define BUFFER_LENGTH 8
+#define USB_TIMEOUT 500
+
+#define FREQ_MIN  87.5
+#define FREQ_MAX 108.0
+#define FREQ_MUL 16000
+
+#define MA901_VOLUME_MAX 16
+#define MA901_VOLUME_MIN 0
+
+/* Commands that device should understand
+ * List isn't full and will be updated with implementation of new functions
+ */
+#define MA901_RADIO_SET_FREQ   0x03
+#define MA901_RADIO_SET_VOLUME 0x04
+#define MA901_RADIO_SET_MONO_STEREO0x05
+
+/* Comfortable defines for ma901radio_set_stereo */
+#define MA901_WANT_STEREO  0x50
+#define MA901_WANT_MONO0xd0
+
+/* module parameter */
+static int radio_nr = -1;
+module_param(radio_nr, int, 0);
+MODULE_PARM_DESC(radio_nr, "Radio file number");
+
+/* Data for one (physical) device */
+struct ma901radio_device {
+   /* reference to USB and video device */
+   struct usb_device *usbdev;
+   struct usb_interface *intf;
+   struct video_device vdev;
+   struct v4l2_device v4l2_dev;
+   struct v4l2_ctrl_handler hdl;
+
+   u8 *buffer;
+   struct mutex lock;  

[patch review 00/02] driver for Masterkit MA901 usb radio

2012-10-28 Thread Alexey Klimov
Hello all,

Well, i accidentally bought usb radio device Masterkit MA901 and wrote
driver for it (looks like V4L doesn't have support for this device).

It is selled, for example, on this web site (Russian language, sorry):
http://www.masterkit.ru/main/set.php?code_id=607729

I googled to find if it's possible to buy it in other countries and
looks like it's selled only in Russia and Ukraine. I don't know if they
can make international delivery. It costs 20-30$.
It's strange that manufacturer didn't place it in nice plastic box, but
package with device, instruction, audio cable, remote control is okay.

Usb radio is based on Atmel tiny85 (general controller for usb
communication here i think) and radio itself on KT0830EG (i found pdf
document with description of commands on internet).

Well, this is first version and not so many big things are present in
driver. I implemented only frequency, volume and stereo/mono settings,
enough for first working version. So let me share the code with you.

Many things to do (when i found next few nights to look deeper in
device):
- bass level settings,
- hw freq seeking,
- receiving signal levels,
- receiveing freq, volume levels from device,
- probably mute control emulation,
- check how to deal with simultaneous tuning using remote control and
PC,
- suspend/resume,
- code cleanup.

I used usbmonitor+debugfs+VirtualBox to catch usb messages to device and
tried to understand them. For this moment driver compiles ok with
gcc-4.6 and gcc-4.7. I tested it on kernel 3.5.7 on x86_64 and on linux
kernel 3.6.2 on ARM platform (odroid-x). Looks fine.

Here we have two patches:
[patch review 01/02]  add driver for Masterkit MA901 usb radio
[patch review 02/02]  usb hid quirks for Masterkit MA901 usb radio

I used a lot of code from radio-mr800.c and radio-keene.c. Also may be
the second patch should go through Jiri Kosina tree, i'm not sure how
procedures work for such cases. Previous time Mauro sent patch with
usb-quirks to Jiri.

Best regards,
Alexey Klimov.

--
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 2/2] [ARM] samsung-rotator: Add Samsung S3C/S5P rotator driver

2009-12-23 Thread Alexey Klimov
Hello,

On Wed, Dec 23, 2009 at 1:08 PM, Pawel Osciak  wrote:
> The rotator device present on Samsung S3C and S5P series SoCs allows image
> rotation and flipping. It requires contiguous memory buffers to operate,
> as it does not have scatter-gather support. It is also an example of
> a memory-to-memory device, and so uses the mem-2-mem device V4L2 framework.

[...]

> +
> +static const struct v4l2_file_operations s3c_rotator_fops = {
> +       .owner          = THIS_MODULE,
> +       .open           = s3c_rotator_open,
> +       .release        = s3c_rotator_release,
> +       .poll           = s3c_rotator_poll,
> +       .ioctl          = video_ioctl2,
> +       .mmap           = s3c_rotator_mmap,
> +};
> +
> +static struct video_device m2mtest_videodev = {
> +       .name           = S3C_ROTATOR_NAME,
> +       .fops           = &s3c_rotator_fops,
> +       .ioctl_ops      = &s3c_rotator_ioctl_ops,
> +       .minor          = -1,
> +       .release        = video_device_release,
> +};
> +
> +static struct v4l2_m2m_ops m2m_ops = {
> +       .device_run     = device_run,
> +       .job_abort      = job_abort,
> +};
> +
> +static int s3c_rotator_probe(struct platform_device *pdev)
> +{
> +       struct s3c_rotator_dev *dev;
> +       struct video_device *vfd;
> +       struct resource *res;
> +       int ret = -ENOENT;

Here ^^^ (see below please for comments)

> +
> +       dev = kzalloc(sizeof *dev, GFP_KERNEL);
> +       if (!dev)
> +               return -ENOMEM;
> +
> +       spin_lock_init(&dev->irqlock);
> +       ret = -ENOENT;

It's probably bad pedantic part of me speaking but looks like you set
ret equals to -ENOENT two times. Most likely you don't need
assignment second time.


> +       dev->irq = platform_get_irq(pdev, 0);
> +       if (dev->irq <= 0) {
> +               dev_err(&pdev->dev, "Failed to acquire irq\n");
> +               goto free_dev;
> +       }
> +
> +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       if (!res) {
> +               dev_err(&pdev->dev,
> +                       "Failed to acquire memory region resource\n");
> +               goto free_irq;
> +       }
> +
> +       dev->regs_res = request_mem_region(res->start, resource_size(res),
> +                                          dev_name(&pdev->dev));
> +       if (!dev->regs_res) {
> +               dev_err(&pdev->dev, "Failed to reserve memory region\n");
> +               goto free_irq;
> +       }
> +
> +       dev->regs_base = ioremap(res->start, resource_size(res));
> +       if (!dev->regs_base) {
> +               dev_err(&pdev->dev, "Ioremap failed\n");
> +               ret = -ENXIO;
> +               goto rel_res;
> +       }
> +
> +       ret = request_irq(dev->irq, s3c_rotator_isr, 0,
> +                         S3C_ROTATOR_NAME, dev);
> +       if (ret) {
> +               dev_err(&pdev->dev, "Requesting irq failed\n");
> +               goto regs_unmap;
> +       }
> +
> +       ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
> +       if (ret)
> +               goto regs_unmap;
> +
> +       atomic_set(&dev->num_inst, 0);
> +
> +       vfd = video_device_alloc();
> +       if (!vfd) {
> +               v4l2_err(&dev->v4l2_dev, "Failed to allocate video device\n");
> +               goto unreg_dev;
> +       }
> +
> +       *vfd = m2mtest_videodev;
> +
> +       ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0);
> +       if (ret) {
> +               v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
> +               goto rel_vdev;
> +       }
> +
> +       video_set_drvdata(vfd, dev);
> +       snprintf(vfd->name, sizeof(vfd->name), "%s", m2mtest_videodev.name);
> +       dev->vfd = vfd;
> +       v4l2_info(&dev->v4l2_dev,
> +                       "Device registered as /dev/video%d\n", vfd->num);
> +
> +       platform_set_drvdata(pdev, dev);
> +
> +       dev->m2m_dev = v4l2_m2m_init(&m2m_ops);
> +       if (IS_ERR(dev->m2m_dev)) {
> +               v4l2_err(&dev->v4l2_dev, "Failed to init mem2mem device\n");
> +               ret = PTR_ERR(dev->m2m_dev);
> +               goto err_m2m;
> +       }
> +
> +       return 0;
> +
> +err_m2m:
> +       video_unregister_device(dev->vfd);
> +rel_vdev:
> +       video_device_release(vfd);
> +unreg_dev:
> +       v4l2_device_unregister(&dev->v4l2_dev);
> +regs_unmap:
> +       iounmap(dev->regs_base);
> +rel_res:
> +       release_resource(dev->regs_res);
> +       kfree(dev->regs_res);
> +free_irq:
> +       free_irq(dev->irq, dev);
> +free_dev:
> +       kfree(dev);
> +
> +       return ret;
> +}
> +
> +static int s3c_rotator_remove(struct platform_device *pdev)
> +{
> +       struct s3c_rotator_dev *dev =
> +               (struct s3c_rotator_dev *)platform_get_drvdata(pdev);
> +
> +       v4l2_info(&dev->v4l2_dev, "Removing %s\n", S3C_ROTATOR_NAME);
> +
> +       v4l2_m2m_release(dev->m2m_dev);
> +       video_unregister_device(dev->vfd);
> +       v4l2_device_unregister(&dev->v4l2_dev);
> +       iounmap(

Re: [PATCH 3/4 v13] TVP7002 driver for DM365

2009-12-19 Thread Alexey Klimov
Hello,

On Fri, Dec 18, 2009 at 8:07 PM,   wrote:
> From: Santiago Nunez-Corrales 
>
> This patch provides the implementation of the TVP7002 decoder
> driver for DM365. Implemented using the V4L2 DV presets API.
> Removed shadow register values. Testing shows that the device
> needs not to be powered down and up for correct behaviour.
> Improved readability. Uses helper function for preset information.
>
> Signed-off-by: Santiago Nunez-Corrales 
> ---
>  drivers/media/video/tvp7002.c | 1189 
> +
>  1 files changed, 1189 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/media/video/tvp7002.c
>
> diff --git a/drivers/media/video/tvp7002.c b/drivers/media/video/tvp7002.c
> new file mode 100644
> index 000..058ffda
> --- /dev/null
> +++ b/drivers/media/video/tvp7002.c
> @@ -0,0 +1,1189 @@
> +/* Texas Instruments Triple 8-/10-BIT 165-/110-MSPS Video and Graphics
> + * Digitizer with Horizontal PLL registers
> + *
> + * Copyright (C) 2009 Texas Instruments Inc
> + * Author: Santiago Nunez-Corrales 
> + *
> + * This code is partially based upon the TVP5150 driver
> + * written by Mauro Carvalho Chehab (mche...@infradead.org),
> + * the TVP514x driver written by Vaibhav Hiremath 
> + * and the TVP7002 driver in the TI LSP 2.10.00.14. Revisions by
> + * Muralidharan Karicheri and Snehaprabha Narnakaje (TI).
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "tvp7002_reg.h"
> +
> +MODULE_DESCRIPTION("TI TVP7002 Video and Graphics Digitizer driver");
> +MODULE_AUTHOR("Santiago Nunez-Corrales ");
> +MODULE_LICENSE("GPL");
> +
> +/* Module Name */
> +#define TVP7002_MODULE_NAME    "tvp7002"
> +
> +/* I2C retry attempts */
> +#define I2C_RETRY_COUNT                (5)
> +
> +/* End of registers */
> +#define TVP7002_EOR            0x5c
> +
> +/* Read write definition for registers */
> +#define TVP7002_READ           0
> +#define TVP7002_WRITE          1
> +#define TVP7002_RESERVED       2
> +
> +/* Interlaced vs progressive mask and shift */
> +#define TVP7002_IP_SHIFT       5
> +#define TVP7002_INPR_MASK      (0x01 << TVP7002_IP_SHIFT)
> +
> +/* Shift for CPL and LPF registers */
> +#define TVP7002_CL_SHIFT       8
> +#define TVP7002_CL_MASK                0x0f
> +
> +/* Debug functions */
> +static int debug;
> +module_param(debug, bool, 0644);
> +MODULE_PARM_DESC(debug, "Debug level (0-2)");
> +
> +/* Structure for register values */
> +struct i2c_reg_value {
> +       u8 reg;
> +       u8 value;
> +       u8 type;
> +};
> +
> +/*
> + * Register default values (according to tvp7002 datasheet)
> + * In the case of read-only registers, the value (0xff) is
> + * never written. R/W functionality is controlled by the
> + * writable bit in the register struct definition.
> + */
> +static const struct i2c_reg_value tvp7002_init_default[] = {
> +       { TVP7002_CHIP_REV, 0xff, TVP7002_READ },
> +       { TVP7002_HPLL_FDBK_DIV_MSBS, 0x67, TVP7002_WRITE },
> +       { TVP7002_HPLL_FDBK_DIV_LSBS, 0x20, TVP7002_WRITE },
> +       { TVP7002_HPLL_CRTL, 0xa0, TVP7002_WRITE },
> +       { TVP7002_HPLL_PHASE_SEL, 0x80, TVP7002_WRITE },
> +       { TVP7002_CLAMP_START, 0x32, TVP7002_WRITE },
> +       { TVP7002_CLAMP_W, 0x20, TVP7002_WRITE },
> +       { TVP7002_HSYNC_OUT_W, 0x60, TVP7002_WRITE },
> +       { TVP7002_B_FINE_GAIN, 0x00, TVP7002_WRITE },
> +       { TVP7002_G_FINE_GAIN, 0x00, TVP7002_WRITE },
> +       { TVP7002_R_FINE_GAIN, 0x00, TVP7002_WRITE },
> +       { TVP7002_B_FINE_OFF_MSBS, 0x80, TVP7002_WRITE },
> +       { TVP7002_G_FINE_OFF_MSBS, 0x80, TVP7002_WRITE },
> +       { TVP7002_R_FINE_OFF_MSBS, 0x80, TVP7002_WRITE },
> +       { TVP7002_SYNC_CTL_1, 0x20, TVP7002_WRITE },
> +       { TVP7002_HPLL_AND_CLAMP_CTL, 0x2e, TVP7002_WRITE },
> +       { TVP7002_SYNC_ON_G_THRS, 0x5d, TVP7002_WRITE },
> +       { TVP7002_SYNC_SEPARATOR_THRS, 0x47, TVP7002_WRITE },
> +       { TVP7002_HPLL_PRE_COAST, 0x00, TVP7002_WRITE },
> +       { TVP7002_HPLL_POST_COAST, 0x00, TVP7002_WRITE },
> +       { TVP7002_SYNC_DETECT_STAT, 0xff, TVP7002_READ },
> +       { TVP7002_OUT_FORMATTER, 0x47, TVP7002_WRITE },
> +       { TVP7002_MISC_CTL_1, 0x01, TVP7002_WRITE },
> +       { TVP7002_MISC_CTL_2, 0

Re: [PATCH 3/4 v12] TVP7002 driver for DM365

2009-12-17 Thread Alexey Klimov
Hello,

On Thu, Dec 17, 2009 at 12:32 AM,   wrote:
> From: Santiago Nunez-Corrales 
>
> This patch provides the implementation of the TVP7002 decoder
> driver for DM365. Implemented using the V4L2 DV presets API.
> Removed shadow register values. Testing shows that the device
> needs not to be powered down and up for correct behaviour.
> Improved readability. Uses helper function for preset information.
>
> Signed-off-by: Santiago Nunez-Corrales 
> ---
>  drivers/media/video/tvp7002.c | 1189 
> +
>  1 files changed, 1189 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/media/video/tvp7002.c
>
> diff --git a/drivers/media/video/tvp7002.c b/drivers/media/video/tvp7002.c
> new file mode 100644
> index 000..6ce57b6
> --- /dev/null
> +++ b/drivers/media/video/tvp7002.c
> @@ -0,0 +1,1189 @@
> +/* Texas Instruments Triple 8-/10-BIT 165-/110-MSPS Video and Graphics
> + * Digitizer with Horizontal PLL registers
> + *
> + * Copyright (C) 2009 Texas Instruments Inc
> + * Author: Santiago Nunez-Corrales 
> + *
> + * This code is partially based upon the TVP5150 driver
> + * written by Mauro Carvalho Chehab (mche...@infradead.org),
> + * the TVP514x driver written by Vaibhav Hiremath 
> + * and the TVP7002 driver in the TI LSP 2.10.00.14. Revisions by
> + * Muralidharan Karicheri and Snehaprabha Narnakaje (TI).
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "tvp7002_reg.h"
> +
> +MODULE_DESCRIPTION("TI TVP7002 Video and Graphics Digitizer driver");
> +MODULE_AUTHOR("Santiago Nunez-Corrales ");
> +MODULE_LICENSE("GPL");
> +
> +/* Module Name */
> +#define TVP7002_MODULE_NAME    "tvp7002"
> +
> +/* I2C retry attempts */
> +#define I2C_RETRY_COUNT                (5)
> +
> +/* End of registers */
> +#define TVP7002_EOR            0x5c
> +
> +/* Read write definition for registers */
> +#define TVP7002_READ           0
> +#define TVP7002_WRITE          1
> +#define TVP7002_RESERVED       2
> +
> +/* Interlaced vs progressive mask and shift */
> +#define TVP7002_IP_SHIFT       5
> +#define TVP7002_INPR_MASK      (0x01 << TVP7002_IP_SHIFT)
> +
> +/* Shift for CPL and LPF registers */
> +#define TVP7002_CL_SHIFT       8
> +#define TVP7002_CL_MASK                0x0f
> +
> +/* Debug functions */
> +static int debug;
> +module_param(debug, bool, 0644);
> +MODULE_PARM_DESC(debug, "Debug level (0-2)");
> +
> +/* Structure for register values */
> +struct i2c_reg_value {
> +       u8 reg;
> +       u8 value;
> +       u8 type;
> +};
> +
> +/*
> + * Register default values (according to tvp7002 datasheet)
> + * In the case of read-only registers, the value (0xff) is
> + * never written. R/W functionality is controlled by the
> + * writable bit in the register struct definition.
> + */
> +static const struct i2c_reg_value tvp7002_init_default[] = {
> +       { TVP7002_CHIP_REV, 0xff, TVP7002_READ },
> +       { TVP7002_HPLL_FDBK_DIV_MSBS, 0x67, TVP7002_WRITE },
> +       { TVP7002_HPLL_FDBK_DIV_LSBS, 0x20, TVP7002_WRITE },
> +       { TVP7002_HPLL_CRTL, 0xa0, TVP7002_WRITE },
> +       { TVP7002_HPLL_PHASE_SEL, 0x80, TVP7002_WRITE },
> +       { TVP7002_CLAMP_START, 0x32, TVP7002_WRITE },
> +       { TVP7002_CLAMP_W, 0x20, TVP7002_WRITE },
> +       { TVP7002_HSYNC_OUT_W, 0x60, TVP7002_WRITE },
> +       { TVP7002_B_FINE_GAIN, 0x00, TVP7002_WRITE },
> +       { TVP7002_G_FINE_GAIN, 0x00, TVP7002_WRITE },
> +       { TVP7002_R_FINE_GAIN, 0x00, TVP7002_WRITE },
> +       { TVP7002_B_FINE_OFF_MSBS, 0x80, TVP7002_WRITE },
> +       { TVP7002_G_FINE_OFF_MSBS, 0x80, TVP7002_WRITE },
> +       { TVP7002_R_FINE_OFF_MSBS, 0x80, TVP7002_WRITE },
> +       { TVP7002_SYNC_CTL_1, 0x20, TVP7002_WRITE },
> +       { TVP7002_HPLL_AND_CLAMP_CTL, 0x2e, TVP7002_WRITE },
> +       { TVP7002_SYNC_ON_G_THRS, 0x5d, TVP7002_WRITE },
> +       { TVP7002_SYNC_SEPARATOR_THRS, 0x47, TVP7002_WRITE },
> +       { TVP7002_HPLL_PRE_COAST, 0x00, TVP7002_WRITE },
> +       { TVP7002_HPLL_POST_COAST, 0x00, TVP7002_WRITE },
> +       { TVP7002_SYNC_DETECT_STAT, 0xff, TVP7002_READ },
> +       { TVP7002_OUT_FORMATTER, 0x47, TVP7002_WRITE },
> +       { TVP7002_MISC_CTL_1, 0x01, TVP7002_WRITE },
> +       { TVP7002_MISC_CTL_2, 

Re: Radio application using V4L2 on console?

2009-12-10 Thread Alexey Klimov
On Thu, Dec 10, 2009 at 11:27 AM, Joonyoung Shim
 wrote:
> Hi, all.
>
> I just wonder there is any radio application using the V4L2 on console.
> I found only the Kradio app of KDE, but the KDE is difficult to use the
> embedded system.
>
> I am testing using my simple radio test application on console, but it
> is also difficult to test correctly RDS - parsing problem etc...
>
> Please introduce to me the radio application satisfied above requests if
> it exists.

I use only two console applications: mplayer and fmtools. But i'm not
sure if they use v4l2 and if they have RDS support.

And i hope this link probably can help you:
http://linuxtv.org/wiki/index.php/Radio_Listening_Applications

-- 
Best regards, Klimov Alexey
--
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] radio-mr800 - autosuspend for radio-mr800 driver

2009-11-09 Thread Alexey Klimov

From: Oliver Neukum 

Patch adds autosuspend support for mr800 radio driver.

Priority: normal

Signed-off-by: Oliver Neukum 
Acked-by: Alexey Klimov 

--
diff -r 19c0469c02c3 linux/drivers/media/radio/radio-mr800.c
--- a/linux/drivers/media/radio/radio-mr800.c   Sat Nov 07 15:51:01 2009 -0200
+++ b/linux/drivers/media/radio/radio-mr800.c   Tue Nov 10 00:38:19 2009 +0300
@@ -133,6 +133,7 @@
 struct amradio_device {
/* reference to USB and video device */
struct usb_device *usbdev;
+   struct usb_interface *intf;
struct video_device videodev;
struct v4l2_device v4l2_dev;
 
@@ -166,7 +167,7 @@
.reset_resume   = usb_amradio_resume,
 #endif
.id_table   = usb_amradio_device_table,
-   .supports_autosuspend   = 0,
+   .supports_autosuspend   = 1,
 };
 
 /* switch on/off the radio. Send 8 bytes to device */
@@ -509,9 +510,15 @@
}
 
file->private_data = radio;
+   retval = usb_autopm_get_interface(radio->intf);
+   if (retval)
+   goto unlock;
 
-   if (unlikely(!radio->initialized))
+   if (unlikely(!radio->initialized)) {
retval = usb_amradio_init(radio);
+   if (retval)
+   usb_autopm_put_interface(radio->intf);
+   }
 
 unlock:
mutex_unlock(&radio->lock);
@@ -528,6 +535,8 @@
 
if (!radio->usbdev)
retval = -EIO;
+   else
+   usb_autopm_put_interface(radio->intf);
 
mutex_unlock(&radio->lock);
return retval;
@@ -669,6 +678,7 @@
radio->videodev.release = usb_amradio_video_device_release;
 
radio->usbdev = interface_to_usbdev(intf);
+   radio->intf = intf;
radio->curfreq = 95.16 * FREQ_MUL;
 
    mutex_init(&radio->lock);



-- 
Alexey Klimov
--
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: Gadmei 380 on kernel 2.6.28.4

2009-10-19 Thread Alexey Klimov
Hello Ming-Ching,

On Mon, Oct 19, 2009 at 10:28 AM, Ming-Ching Tiew  wrote:
>
> Message below :-
>
>> From: Ming-Ching Tiew 
>> Subject: Re: Gadmei 380 on kernel 2.6.28.4
>> To: linux-media@vger.kernel.org
>> Date: Monday, October 12, 2009, 8:31 AM
>> I did a dmesg, include please find
>> the output. If you see
>> carefully, towards the end, there is a USB driver error,
>> and my KINGSTON usb thumb drive get disconnected and
>> reconnected again.

Yes, there is error "usb 1-5: failed to restore interface 0 altsetting
0 (error=-71)"
If i understand things correctly this is "Protocol error".
I have small idea that this can be problem with electrical power
system on usb bus.

>> --- On Mon, 10/12/09, mctiew 
>> wrote:
>>
>> > From: mctiew 
>> > Subject: Gadmei 380 on kernel 2.6.28.4
>> > To: linux-media@vger.kernel.org
>> > Date: Monday, October 12, 2009, 3:32 AM
>> >
>> > I am trying to use the gadmei 380 which I bought
>> > yesterday.
>> >
>> > I am using kernel 2.6.28.4, I downloaded the entire
>> > ~dougsland/em28xx
>> > and did a make and install. Everything went on
>> smoothly.
>> > However,
>> > when I plug in the gadmei 380 usb device, it seems
>> the
>> > driver can
>> > get loaded by the usb pnp, but at the same time, one
>> of my
>> > usb
>> > pendrive will get disconnected. Because that's my
>> boot
>> > drive
>> > ( I boot off from the usb drive ), that will cause
>> problem
>> > with
>> > my system.
>> >
>> > Anyone has experienced this before ?
>> >
>> >
>
> No one is working on this ? Is there a similar device which
> I can use as a reference ? I am thinking maybe I need to
> modify the usb storage driver to ignore this device much
> like this thread ?
>
> http://www.mail-archive.com/linux-usb-de...@lists.sourceforge.net/msg54175.html

Well, if there is no answers on this maillist, it's very good if you
can ask linux usb team. Maillist is linux-...@vger.kernel.org. Logs of
em28xx driver contains no v4l-dbv or even usb errors. If usb guys say
that there is em28xx driver problem it will makes things more clear.


-- 
Best regards, Klimov Alexey
--
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: [RFC/RFT 0/14] radio-mr800 patch series

2009-09-22 Thread Alexey Klimov
On Tue, Sep 22, 2009 at 5:06 AM, David Ellingsworth
 wrote:
> On Mon, Sep 21, 2009 at 8:03 PM, Alexey Klimov  wrote:
>> Hello, David
>>
>> On Mon, Sep 14, 2009 at 11:09 PM, Alexey Klimov  
>> wrote:
>>> Hello David,
>>>
>>> On Sun, Sep 13, 2009 at 7:22 AM, David Ellingsworth
>>>  wrote:
>>>> What follow is a series of patches to clean up the radio-mr800 driver. I
>>>> do _not_ have access to this device so these patches need to be tested.
>>>> These patches should apply to Mauro's git tree and against the 2.6.31
>>>> release kernel. The patches in this series are as follows:
>>>>
>>>> 01. radio-mr800: implement proper locking
>>>> 02. radio-mr800: simplify video_device allocation
>>>> 03. radio-mr800: simplify error paths in usb probe callback
>>>> 04. radio-mr800: remove an unnecessary local variable
>>>> 05. radio-mr800: simplify access to amradio_device
>>>> 06. radio-mr800: simplify locking in ioctl callbacks
>>>> 07. radio-mr800: remove device-removed indicator
>>>> 08. radio-mr800: fix potential use after free
>>>> 09. radio-mr800: remove device initialization from open/close
>>>> 10. radio-mr800: ensure the radio is initialized to a consistent state
>>>> 11. radio-mr800: fix behavior of set_radio function
>>>> 12. radio-mr800: preserve radio state during suspend/resume
>>>> 13. radio-mr800: simplify device warnings
>>>> 14. radio-mr800: set radio frequency only upon success
>>>>
>>>> The first 7 in this series are the same as those submitted in my last 
>>>> series
>>>> and will not be resent. The remaining 7 patches in this series will be sent
>>>> separately for review.
>>
>> I applied your patches and tested radio device. Radio works fine, but
>> unfortunately sudden disconnect while playing radio with gnomeradio
>> creates troubles. I see such oops in dmesg:
>>
>> radio_mr800: version 0.11-david AverMedia MR 800 USB FM radio driver
>> usb 2-2: new low speed USB device using ohci_hcd and address 16
>> usb 2-2: New USB device found, idVendor=07ca, idProduct=b800
>> usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>> usb 2-2: Product: AVerMedia USB Radio
>> usb 2-2: Manufacturer: AVerMedia Technologies
>> usb 2-2: configuration #1 chosen from 1 choice
>> radio-mr800 2-2:1.0: Non-NULL drvdata on register
>> usb 2-2: USB disconnect, address 16
>> BUG: unable to handle kernel NULL pointer dereference at 009f
>> IP: [] dev_set_drvdata+0x25/0x30
>> PGD 3c0e1067 PUD 33b1d067 PMD 0
>> Oops: 0002 [#1] SMP
>> last sysfs file: /sys/devices/pci:00/:00:02.0/usb2/2-2/2-2:1.0/uevent
>> CPU 1
>> Modules linked in: radio_mr800 v4l2_common videodev v4l1_compat
>> v4l2_compat_ioctl32 nls_iso8859_1 nls_cp437 vfat fat usb_storage
>> nls_utf8 cifs ext2 ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4
>> nf_conntrack nf_defrag_ipv4 ip_tables x_tables ppp_async crc_ccitt
>> ppp_generic slhc cpufreq_powersave powernow_k8 freq_table
>> snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device
>> snd_pcm_oss snd_mixer_oss reiserfs usbhid hid snd_hda_codec_analog
>> snd_hda_intel ohci_hcd ehci_hcd snd_hda_codec snd_hwdep snd_pcm
>> snd_timer nvidia(P) snd usbcore soundcore snd_page_alloc rtc_cmos sg
>> rtc_core rtc_lib i2c_nforce2 forcedeth e100 nls_base k8temp mii
>> i2c_core hwmon thermal button [last unloaded: v4l2_compat_ioctl32]
>> Pid: 11790, comm: gnomeradio Tainted: P           2.6.31 #12 System Product 
>> Name
>> RIP: 0010:[]  [] 
>> dev_set_drvdata+0x25/0x30
>> RSP: 0018:880031741e28  EFLAGS: 00010206
>> RAX: 0017 RBX: 88003c3a4030 RCX: 8109458a
>> RDX:  RSI:  RDI: 88003c3a4030
>> RBP:  R08:  R09: 
>> R10: 880029391e70 R11: 0246 R12: 81349ec0
>> R13: 880029391e70 R14: 8800173d7000 R15: 88003fac8300
>> FS:  7fa0f88e3750() GS:88000290() knlGS:f7327a10
>> CS:  0010 DS:  ES:  CR0: 80050033
>> CR2: 009f CR3: 3165c000 CR4: 06e0
>> DR0:  DR1:  DR2: 
>> DR3:  DR6: 0ff0 DR7: 0400
>> Process gnomeradio (pid: 11790, threadinfo 88003174, task
>> 88003bcc5820)
>> Stack:
>>  8800173d7

Re: [RFC/RFT 0/14] radio-mr800 patch series

2009-09-21 Thread Alexey Klimov
Hello, David

On Mon, Sep 14, 2009 at 11:09 PM, Alexey Klimov  wrote:
> Hello David,
>
> On Sun, Sep 13, 2009 at 7:22 AM, David Ellingsworth
>  wrote:
>> What follow is a series of patches to clean up the radio-mr800 driver. I
>> do _not_ have access to this device so these patches need to be tested.
>> These patches should apply to Mauro's git tree and against the 2.6.31
>> release kernel. The patches in this series are as follows:
>>
>> 01. radio-mr800: implement proper locking
>> 02. radio-mr800: simplify video_device allocation
>> 03. radio-mr800: simplify error paths in usb probe callback
>> 04. radio-mr800: remove an unnecessary local variable
>> 05. radio-mr800: simplify access to amradio_device
>> 06. radio-mr800: simplify locking in ioctl callbacks
>> 07. radio-mr800: remove device-removed indicator
>> 08. radio-mr800: fix potential use after free
>> 09. radio-mr800: remove device initialization from open/close
>> 10. radio-mr800: ensure the radio is initialized to a consistent state
>> 11. radio-mr800: fix behavior of set_radio function
>> 12. radio-mr800: preserve radio state during suspend/resume
>> 13. radio-mr800: simplify device warnings
>> 14. radio-mr800: set radio frequency only upon success
>>
>> The first 7 in this series are the same as those submitted in my last series
>> and will not be resent. The remaining 7 patches in this series will be sent
>> separately for review.

I applied your patches and tested radio device. Radio works fine, but
unfortunately sudden disconnect while playing radio with gnomeradio
creates troubles. I see such oops in dmesg:

radio_mr800: version 0.11-david AverMedia MR 800 USB FM radio driver
usb 2-2: new low speed USB device using ohci_hcd and address 16
usb 2-2: New USB device found, idVendor=07ca, idProduct=b800
usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-2: Product: AVerMedia USB Radio
usb 2-2: Manufacturer: AVerMedia Technologies
usb 2-2: configuration #1 chosen from 1 choice
radio-mr800 2-2:1.0: Non-NULL drvdata on register
usb 2-2: USB disconnect, address 16
BUG: unable to handle kernel NULL pointer dereference at 009f
IP: [] dev_set_drvdata+0x25/0x30
PGD 3c0e1067 PUD 33b1d067 PMD 0
Oops: 0002 [#1] SMP
last sysfs file: /sys/devices/pci:00/:00:02.0/usb2/2-2/2-2:1.0/uevent
CPU 1
Modules linked in: radio_mr800 v4l2_common videodev v4l1_compat
v4l2_compat_ioctl32 nls_iso8859_1 nls_cp437 vfat fat usb_storage
nls_utf8 cifs ext2 ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4
nf_conntrack nf_defrag_ipv4 ip_tables x_tables ppp_async crc_ccitt
ppp_generic slhc cpufreq_powersave powernow_k8 freq_table
snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device
snd_pcm_oss snd_mixer_oss reiserfs usbhid hid snd_hda_codec_analog
snd_hda_intel ohci_hcd ehci_hcd snd_hda_codec snd_hwdep snd_pcm
snd_timer nvidia(P) snd usbcore soundcore snd_page_alloc rtc_cmos sg
rtc_core rtc_lib i2c_nforce2 forcedeth e100 nls_base k8temp mii
i2c_core hwmon thermal button [last unloaded: v4l2_compat_ioctl32]
Pid: 11790, comm: gnomeradio Tainted: P   2.6.31 #12 System Product Name
RIP: 0010:[]  [] dev_set_drvdata+0x25/0x30
RSP: 0018:880031741e28  EFLAGS: 00010206
RAX: 0017 RBX: 88003c3a4030 RCX: 8109458a
RDX:  RSI:  RDI: 88003c3a4030
RBP:  R08:  R09: 
R10: 880029391e70 R11: 0246 R12: 81349ec0
R13: 880029391e70 R14: 8800173d7000 R15: 88003fac8300
FS:  7fa0f88e3750() GS:88000290() knlGS:f7327a10
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 009f CR3: 3165c000 CR4: 06e0
DR0:  DR1:  DR2: 
DR3:  DR6: 0ff0 DR7: 0400
Process gnomeradio (pid: 11790, threadinfo 88003174, task
88003bcc5820)
Stack:
 8800173d7000 88003c3a5a60 88003c3a5a60 a0c603cb
<0> 88003c3a5800 a0c603e5 88003c3a5800 88003e400890
<0> 81349ec0 a000d5c7 8800331593c0 8118fb37
Call Trace:
 [] ? v4l2_device_disconnect+0x13/0x1c [videodev]
 [] ? v4l2_device_unregister+0x11/0x4b [videodev]
 [] ? usb_amradio_video_device_release+0x11/0x26 [radio_mr800]
 [] ? device_release+0x41/0x6a
 [] ? kobject_release+0x48/0x5e
 [] ? kobject_release+0x0/0x5e
 [] ? kref_put+0x41/0x4a
 [] ? v4l2_release+0x33/0x37 [videodev]
 [] ? __fput+0x100/0x1c9
 [] ? filp_close+0x5f/0x6a
 [] ? sys_close+0x91/0xc4
 [] ? system_call_fastpath+0x16/0x1b
Code: 00 00 c3 31 c0 c3 55 48 89 f5 53 48 89 fb 48 83 ec 08 48 85 ff
74 1b 48 83 7f 08 00 75 09 e8 45 de ff ff 85 c0 75 0b 48 8b 43 08 <48>
89 a8 88 00 00 00 58 5b 5d c3 53 48 8b 87 80 00 00 00 48 89
RIP

Re: [RFC/RFT 0/14] radio-mr800 patch series

2009-09-14 Thread Alexey Klimov
Hello David,

On Sun, Sep 13, 2009 at 7:22 AM, David Ellingsworth
 wrote:
> What follow is a series of patches to clean up the radio-mr800 driver. I
> do _not_ have access to this device so these patches need to be tested.
> These patches should apply to Mauro's git tree and against the 2.6.31
> release kernel. The patches in this series are as follows:
>
> 01. radio-mr800: implement proper locking
> 02. radio-mr800: simplify video_device allocation
> 03. radio-mr800: simplify error paths in usb probe callback
> 04. radio-mr800: remove an unnecessary local variable
> 05. radio-mr800: simplify access to amradio_device
> 06. radio-mr800: simplify locking in ioctl callbacks
> 07. radio-mr800: remove device-removed indicator
> 08. radio-mr800: fix potential use after free
> 09. radio-mr800: remove device initialization from open/close
> 10. radio-mr800: ensure the radio is initialized to a consistent state
> 11. radio-mr800: fix behavior of set_radio function
> 12. radio-mr800: preserve radio state during suspend/resume
> 13. radio-mr800: simplify device warnings
> 14. radio-mr800: set radio frequency only upon success
>
> The first 7 in this series are the same as those submitted in my last series
> and will not be resent. The remaining 7 patches in this series will be sent
> separately for review.
>
> Regards,
>
> David Ellingsworth

Thank you for work at radio-mr800. I'll check and test your patches as
soon as possible, it probably takes 2-3 days.


-- 
Best regards, Klimov Alexey
--
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 review 6/6] radio-mr800: redesign radio->users counter

2009-08-09 Thread Alexey Klimov
On Sun, Aug 9, 2009 at 12:19 PM, Hans Verkuil wrote:
> On Saturday 08 August 2009 22:16:28 wk wrote:
>> Alexey Klimov schrieb:
>> > On Sat, Aug 8, 2009 at 10:01 PM, Trent Piepho wrote:
>> >
>> >> On Sat, 8 Aug 2009, Alexey Klimov wrote:
>> >>
>> >>> Redesign radio->users counter. Don't allow more that 5 users on radio in
>> >>>
>> >> Why?
>> >>
>> >
>> > Well, v4l2 specs says that multiple opens are optional. Honestly, i
>> > think that five userspace applications open /dev/radio is enough. Btw,
>> > if too many userspace applications opened radio that means that
>> > something wrong happened in userspace. And driver can handle such
>> > situation by disallowing new open calls(returning EBUSY). I can't
>> > imagine user that runs more than five mplayers or gnomeradios, or
>> > kradios and so on.
>> >
>> > Am i totally wrong here?
>> >
>> > Thanks.
>> >
>
> Exactly. It's an artificial restriction that serves no purpose. Also
> remember that apps can open a radio device just to do e.g. a QUERYCAP
> or something like that. It does not necessarily has to be an mplayer
> or gnomeradio.
>
> Regards,
>
>        Hans
>
> --
> Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom

Ok, i'll update the patch.
Idea initially came in mind from gspca.c.

-- 
Best regards, Klimov Alexey
--
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 review 6/6] radio-mr800: redesign radio->users counter

2009-08-08 Thread Alexey Klimov
On Sat, Aug 8, 2009 at 10:01 PM, Trent Piepho wrote:
> On Sat, 8 Aug 2009, Alexey Klimov wrote:
>> Redesign radio->users counter. Don't allow more that 5 users on radio in
>
> Why?

Well, v4l2 specs says that multiple opens are optional. Honestly, i
think that five userspace applications open /dev/radio is enough. Btw,
if too many userspace applications opened radio that means that
something wrong happened in userspace. And driver can handle such
situation by disallowing new open calls(returning EBUSY). I can't
imagine user that runs more than five mplayers or gnomeradios, or
kradios and so on.

Am i totally wrong here?

Thanks.
-- 
Best regards, Klimov Alexey
--
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 review 6/6] radio-mr800: redesign radio->users counter

2009-08-08 Thread Alexey Klimov
Redesign radio->users counter. Don't allow more that 5 users on radio in
usb_amradio_open() and don't stop radio device if other userspace
application uses it in usb_amradio_close().

Signed-off-by: Alexey Klimov 

--
diff -r c2dd9da28106 linux/drivers/media/radio/radio-mr800.c
--- a/linux/drivers/media/radio/radio-mr800.c   Sat Aug 08 17:28:18 2009 +0400
+++ b/linux/drivers/media/radio/radio-mr800.c   Sat Aug 08 18:12:01 2009 +0400
@@ -540,7 +540,13 @@
 {
struct amradio_device *radio = video_get_drvdata(video_devdata(file));
 
-   radio->users = 1;
+   /* don't allow more than 5 users on radio */
+   if (radio->users > 4)
+   return -EBUSY;
+
+   mutex_lock(&radio->lock);
+   radio->users++;
+   mutex_unlock(&radio->lock);
 
return 0;
 }
@@ -554,9 +560,20 @@
return -ENODEV;
 
mutex_lock(&radio->lock);
-   radio->users = 0;
+   radio->users--;
mutex_unlock(&radio->lock);
 
+   /* In case several userspace applications opened the radio
+* and one of them closes and stops it,
+* we check if others use it and if they do we start the radio again. */
+   if (radio->users && radio->status == AMRADIO_STOP) {
+   int retval;
+   retval = amradio_set_mute(radio, AMRADIO_START);
+   if (retval < 0)
+   dev_warn(&radio->videodev->dev,
+   "amradio_start failed\n");
+   }
+
return 0;
 }
 


-- 
Best regards, Klimov Alexey

--
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 review 5/6] radio-mr800: update suspend/resume procedure

2009-08-08 Thread Alexey Klimov
Patch fixes suspend/resume procedure.

Signed-off-by: Alexey Klimov 

--
diff -r 05754a500f80 linux/drivers/media/radio/radio-mr800.c
--- a/linux/drivers/media/radio/radio-mr800.c   Sat Aug 08 20:06:36 2009 +0400
+++ b/linux/drivers/media/radio/radio-mr800.c   Sat Aug 08 20:22:05 2009 +0400
@@ -564,11 +564,23 @@
 static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t 
message)
 {
struct amradio_device *radio = usb_get_intfdata(intf);
-   int retval;
 
-   retval = amradio_set_mute(radio, AMRADIO_STOP);
-   if (retval < 0)
-   dev_warn(&intf->dev, "amradio_stop failed\n");
+   if (radio->status == AMRADIO_START) {
+   int retval;
+   retval = amradio_set_mute(radio, AMRADIO_STOP);
+   if (retval < 0)
+   dev_warn(&intf->dev, "amradio_stop failed\n");
+
+   /* After stopping radio status set to AMRADIO_STOP.
+* If we want driver to start radio on resume
+* we set status equal to AMRADIO_START.
+* On resume we will check status and run radio if needed.
+*/
+
+   mutex_lock(&radio->lock);
+   radio->status = AMRADIO_START;
+   mutex_unlock(&radio->lock);
+   }
 
dev_info(&intf->dev, "going into suspend..\n");
 
@@ -579,11 +591,24 @@
 static int usb_amradio_resume(struct usb_interface *intf)
 {
struct amradio_device *radio = usb_get_intfdata(intf);
-   int retval;
 
-   retval = amradio_set_mute(radio, AMRADIO_START);
-   if (retval < 0)
-   dev_warn(&intf->dev, "amradio_start failed\n");
+   if (radio->status == AMRADIO_START) {
+   int retval;
+   retval = amradio_set_mute(radio, AMRADIO_START);
+   if (retval < 0)
+   dev_warn(&intf->dev, "amradio_start failed\n");
+   retval = amradio_setfreq(radio);
+   if (retval < 0)
+   dev_warn(&intf->dev,
+   "set frequency failed\n");
+
+   if (radio->stereo) {
+   retval = amradio_set_stereo(radio, WANT_STEREO);
+   if (retval < 0)
+   dev_warn(&intf->dev, "set stereo failed\n");
+   }
+
+   }
 
dev_info(&intf->dev, "coming out of suspend..\n");
 


-- 
Best regards, Klimov Alexey

--
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 review 4/6] radio-mr800: make radio->status variable

2009-08-08 Thread Alexey Klimov
Remove radio->muted and radio->removed variables from amradio_device
structure. Instead patch creates radio->status variable and updates
code.

Signed-off-by: Alexey Klimov 

--
diff -r a1ccdea5a182 linux/drivers/media/radio/radio-mr800.c
--- a/linux/drivers/media/radio/radio-mr800.c   Wed Jul 29 12:42:06 2009 +0400
+++ b/linux/drivers/media/radio/radio-mr800.c   Sat Aug 08 17:24:05 2009 +0400
@@ -108,6 +108,8 @@
 #define AMRADIO_START  0x00
 #define AMRADIO_STOP   0x01
 
+#define DISCONNECTED   -1
+
 /* Comfortable defines for amradio_set_stereo */
 #define WANT_STEREO0x00
 #define WANT_MONO  0x01
@@ -135,11 +137,10 @@
 
unsigned char *buffer;
struct mutex lock;  /* buffer locking */
+   int status;
int curfreq;
int stereo;
int users;
-   int removed;
-   int muted;
 };
 
 /* USB Device ID List */
@@ -172,7 +173,7 @@
int size;
 
/* safety check */
-   if (radio->removed)
+   if (unlikely(radio->status == DISCONNECTED))
return -EIO;
 
mutex_lock(&radio->lock);
@@ -194,7 +195,7 @@
return retval;
}
 
-   radio->muted = argument;
+   radio->status = argument;
 
mutex_unlock(&radio->lock);
 
@@ -209,7 +210,7 @@
unsigned short freq_send = 0x10 + (radio->curfreq >> 3) / 25;
 
/* safety check */
-   if (radio->removed)
+   if (unlikely(radio->status == DISCONNECTED))
return -EIO;
 
mutex_lock(&radio->lock);
@@ -259,7 +260,7 @@
int size;
 
/* safety check */
-   if (radio->removed)
+   if (unlikely(radio->status == DISCONNECTED))
return -EIO;
 
mutex_lock(&radio->lock);
@@ -299,7 +300,7 @@
struct amradio_device *radio = usb_get_intfdata(intf);
 
mutex_lock(&radio->lock);
-   radio->removed = 1;
+   radio->status = DISCONNECTED;
mutex_unlock(&radio->lock);
 
usb_set_intfdata(intf, NULL);
@@ -329,7 +330,7 @@
int retval;
 
/* safety check */
-   if (radio->removed)
+   if (unlikely(radio->status == DISCONNECTED))
return -EIO;
 
if (v->index > 0)
@@ -371,7 +372,7 @@
int retval;
 
/* safety check */
-   if (radio->removed)
+   if (unlikely(radio->status == DISCONNECTED))
return -EIO;
 
if (v->index > 0)
@@ -406,7 +407,7 @@
int retval;
 
/* safety check */
-   if (radio->removed)
+   if (unlikely(radio->status == DISCONNECTED))
return -EIO;
 
mutex_lock(&radio->lock);
@@ -427,7 +428,7 @@
struct amradio_device *radio = video_get_drvdata(video_devdata(file));
 
/* safety check */
-   if (radio->removed)
+   if (unlikely(radio->status == DISCONNECTED))
return -EIO;
 
f->type = V4L2_TUNER_RADIO;
@@ -454,12 +455,12 @@
struct amradio_device *radio = video_get_drvdata(video_devdata(file));
 
/* safety check */
-   if (radio->removed)
+   if (unlikely(radio->status == DISCONNECTED))
return -EIO;
 
switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE:
-   ctrl->value = radio->muted;
+   ctrl->value = radio->status;
return 0;
}
return -EINVAL;
@@ -473,7 +474,7 @@
int retval;
 
/* safety check */
-   if (radio->removed)
+   if (unlikely(radio->status == DISCONNECTED))
return -EIO;
 
switch (ctrl->id) {
@@ -540,7 +541,6 @@
struct amradio_device *radio = video_get_drvdata(video_devdata(file));
 
radio->users = 1;
-   radio->muted = 1;
 
return 0;
 }
@@ -674,7 +674,7 @@
radio->videodev->ioctl_ops = &usb_amradio_ioctl_ops;
radio->videodev->release = usb_amradio_video_device_release;
 
-   radio->removed = 0;
+   radio->status = AMRADIO_STOP;
radio->users = 0;
radio->usbdev = interface_to_usbdev(intf);
radio->curfreq = 95.16 * FREQ_MUL;


-- 
Best regards, Klimov Alexey

--
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 review 3/6] radio-mr800: no need to pass curfreq value to amradio_setfreq()

2009-08-08 Thread Alexey Klimov
Small cleanup of amradio_setfreq(). No need to pass radio->curfreq value
to this function.

Signed-off-by: Alexey Klimov 

--
diff -r 5f3329bebfe4 linux/drivers/media/radio/radio-mr800.c
--- a/linux/drivers/media/radio/radio-mr800.c   Wed Jul 29 12:36:46 2009 +0400
+++ b/linux/drivers/media/radio/radio-mr800.c   Wed Jul 29 12:41:51 2009 +0400
@@ -202,11 +202,11 @@
 }
 
 /* set a frequency, freq is defined by v4l's TUNER_LOW, i.e. 1/16th kHz */
-static int amradio_setfreq(struct amradio_device *radio, int freq)
+static int amradio_setfreq(struct amradio_device *radio)
 {
int retval;
int size;
-   unsigned short freq_send = 0x10 + (freq >> 3) / 25;
+   unsigned short freq_send = 0x10 + (radio->curfreq >> 3) / 25;
 
/* safety check */
if (radio->removed)
@@ -413,7 +413,7 @@
radio->curfreq = f->frequency;
mutex_unlock(&radio->lock);
 
-   retval = amradio_setfreq(radio, radio->curfreq);
+   retval = amradio_setfreq(radio);
if (retval < 0)
amradio_dev_warn(&radio->videodev->dev,
"set frequency failed\n");



-- 
Best regards, Klimov Alexey

--
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 review 2/6] radio-mr800: cleanup of usb_amradio_open/close

2009-08-08 Thread Alexey Klimov
Patch removes functions that shouldn't be in usb_amradio_open/close:
amradio_set_mute(), amradio_set_stereo(), amradio_setfreq().

Signed-off-by: Alexey Klimov 

--
diff -r 34b4e5c9d5c2 linux/drivers/media/radio/radio-mr800.c
--- a/linux/drivers/media/radio/radio-mr800.c   Wed Jul 29 10:44:51 2009 +0400
+++ b/linux/drivers/media/radio/radio-mr800.c   Wed Jul 29 12:36:37 2009 +0400
@@ -538,29 +538,10 @@
 static int usb_amradio_open(struct file *file)
 {
struct amradio_device *radio = video_get_drvdata(video_devdata(file));
-   int retval;
 
radio->users = 1;
radio->muted = 1;
 
-   retval = amradio_set_mute(radio, AMRADIO_START);
-   if (retval < 0) {
-   amradio_dev_warn(&radio->videodev->dev,
-   "radio did not start up properly\n");
-   radio->users = 0;
-   return -EIO;
-   }
-
-   retval = amradio_set_stereo(radio, WANT_STEREO);
-   if (retval < 0)
-   amradio_dev_warn(&radio->videodev->dev,
-   "set stereo failed\n");
-
-   retval = amradio_setfreq(radio, radio->curfreq);
-   if (retval < 0)
-   amradio_dev_warn(&radio->videodev->dev,
-   "set frequency failed\n");
-
return 0;
 }
 
@@ -568,7 +549,6 @@
 static int usb_amradio_close(struct file *file)
 {
struct amradio_device *radio = video_get_drvdata(video_devdata(file));
-   int retval;
 
if (!radio)
return -ENODEV;
@@ -577,13 +557,6 @@
radio->users = 0;
mutex_unlock(&radio->lock);
 
-   if (!radio->removed) {
-   retval = amradio_set_mute(radio, AMRADIO_STOP);
-   if (retval < 0)
-   amradio_dev_warn(&radio->videodev->dev,
-   "amradio_stop failed\n");
-   }
-
return 0;
 }
 


-- 
Best regards, Klimov Alexey

--
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 review 1/6] radio-mr800: remove redundant lock/unlock_kernel

2009-08-08 Thread Alexey Klimov
Remove redundant lock/unlock_kernel() calls from usb_amradio_open/close
functions.

Signed-off-by: Alexey Klimov 

--
diff -r ee6cf88cb5d3 linux/drivers/media/radio/radio-mr800.c
--- a/linux/drivers/media/radio/radio-mr800.c   Wed Jul 29 01:42:02 2009 -0300
+++ b/linux/drivers/media/radio/radio-mr800.c   Wed Jul 29 10:44:02 2009 +0400
@@ -540,8 +540,6 @@
struct amradio_device *radio = video_get_drvdata(video_devdata(file));
int retval;
 
-   lock_kernel();
-
radio->users = 1;
radio->muted = 1;
 
@@ -550,7 +548,6 @@
amradio_dev_warn(&radio->videodev->dev,
"radio did not start up properly\n");
radio->users = 0;
-   unlock_kernel();
return -EIO;
}
 
@@ -564,7 +561,6 @@
amradio_dev_warn(&radio->videodev->dev,
"set frequency failed\n");
 
-   unlock_kernel();
return 0;
 }
 


-- 
Best regards, Klimov Alexey

--
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 review 0/6] radio-mr800

2009-08-08 Thread Alexey Klimov
Hello all,

Here are some radio-mr800 patches against hg v4l-dvb tree.
Patchset removes lock_kernel calls, fixes suspend/resume, cleanups,
introduces status variable and redesigns users counter in driver.

As usual comments, remarks, ideas are more than welcome :)

[1/6] radio-mr800: remove redundant lock/unlock_kernel
[2/6] radio-mr800: cleanup of usb_amradio_open/close
[3/6] radio-mr800: no need to pass curfreq value to amradio_setfreq()
[4/6] radio-mr800: make radio->status variable
[5/6] radio-mr800: update suspend/resume procedure
[6/6] radio-mr800: redesign radio->users counter


-- 
Best regards, Klimov Alexey

--
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] to add support for certain Jeilin dual-mode cameras.

2009-08-03 Thread Alexey Klimov
On Mon, Aug 3, 2009 at 10:30 AM, Jean-Francois Moine wrote:
> On Sun, 2 Aug 2009 17:25:29 +0400
> Alexey Klimov  wrote:
>
>> > +       buffer = kmalloc(JEILINJ_MAX_TRANSFER, GFP_KERNEL |
>> > GFP_DMA);
>> > +       if (!buffer) {
>> > +               PDEBUG(D_ERR, "Couldn't allocate USB buffer");
>> > +               goto quit_stream;
>> > +       }
>>
>> This clean up on error path looks bad. On quit_stream you have:
>>
>> > +quit_stream:
>> > +       mutex_lock(&gspca_dev->usb_lock);
>> > +       if (gspca_dev->present)
>> > +               jlj_stop(gspca_dev);
>> > +       mutex_unlock(&gspca_dev->usb_lock);
>> > +       kfree(buffer);
>>
>> kfree() tries to free null buffer after kmalloc for buffer failed.
>> Please, check if i'm not wrong.
>
> Hi Alexey,
>
> AFAIK, kfree() checks the pointer.
>
> Cheers.

Yes, you're right. I checked the code in kfree().
Sorry for doubts.

-- 
Best regards, Klimov Alexey
--
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] to add support for certain Jeilin dual-mode cameras.

2009-08-02 Thread Alexey Klimov
Hello, Theodore

On Sun, Aug 2, 2009 at 1:56 AM, Theodore
Kilgore wrote:
> Several cameras are supported here, which all share the same USB
> Vendor:Product number when started up in streaming mode. All of these
> cameras use bulk transport for streaming, and all of them produce frames in
> JPEG format.
>
> Patch follows.
>
> Signed-off-by Theodore Kilgore 
>
> --
> diff -r d189fb4be712 linux/Documentation/video4linux/gspca.txt
> --- a/linux/Documentation/video4linux/gspca.txt Wed Jul 29 10:01:54 2009
> +0200
> +++ b/linux/Documentation/video4linux/gspca.txt Sat Aug 01 15:42:02 2009
> -0500
> @@ -239,6 +239,9 @@
>  pac7311                093a:2629       Genious iSlim 300
>  pac7311                093a:262a       Webcam 300k
>  pac7311                093a:262c       Philips SPC 230 NC
> +jeilinj                0979:0280       Cobra DMC 300
> +jeilinj                0979:0280       FlyCamOne
> +jeilinj                0979:0280       Sakar 57379
>  zc3xx          0ac8:0302       Z-star Vimicro zc0302
>  vc032x         0ac8:0321       Vimicro generic vc0321
>  vc032x         0ac8:0323       Vimicro Vc0323
> diff -r d189fb4be712 linux/drivers/media/video/gspca/Kconfig
> --- a/linux/drivers/media/video/gspca/Kconfig   Wed Jul 29 10:01:54 2009
> +0200
> +++ b/linux/drivers/media/video/gspca/Kconfig   Sat Aug 01 15:42:02 2009
> -0500
> @@ -47,6 +47,15 @@
>          To compile this driver as a module, choose M here: the
>          module will be called gspca_finepix.
>
> +config USB_GSPCA_JEILINJ
> +       tristate "Jeilin JPEG USB V4L2 driver"
> +       depends on VIDEO_V4L2 && USB_GSPCA
> +       help
> +         Say Y here if you want support for cameras based on this Jeilin
> chip.
> +
> +         To compile this driver as a module, choose M here: the
> +         module will be called gspca_jeilinj.
> +
>  config USB_GSPCA_MARS
>        tristate "Mars USB Camera Driver"
>        depends on VIDEO_V4L2 && USB_GSPCA
> diff -r d189fb4be712 linux/drivers/media/video/gspca/Makefile
> --- a/linux/drivers/media/video/gspca/Makefile  Wed Jul 29 10:01:54 2009
> +0200
> +++ b/linux/drivers/media/video/gspca/Makefile  Sat Aug 01 15:42:02 2009
> -0500
> @@ -2,6 +2,7 @@
>  obj-$(CONFIG_USB_GSPCA_CONEX)    += gspca_conex.o
>  obj-$(CONFIG_USB_GSPCA_ETOMS)    += gspca_etoms.o
>  obj-$(CONFIG_USB_GSPCA_FINEPIX)  += gspca_finepix.o
> +obj-$(CONFIG_USB_GSPCA_JEILINJ)  += gspca_jeilinj.o
>  obj-$(CONFIG_USB_GSPCA_MARS)     += gspca_mars.o
>  obj-$(CONFIG_USB_GSPCA_MR97310A) += gspca_mr97310a.o
>  obj-$(CONFIG_USB_GSPCA_OV519)    += gspca_ov519.o
> @@ -30,6 +31,7 @@
>  gspca_conex-objs    := conex.o
>  gspca_etoms-objs    := etoms.o
>  gspca_finepix-objs  := finepix.o
> +gspca_jeilinj-objs  := jeilinj.o
>  gspca_mars-objs     := mars.o
>  gspca_mr97310a-objs := mr97310a.o
>  gspca_ov519-objs    := ov519.o
> diff -r d189fb4be712 linux/drivers/media/video/gspca/jeilinj.c
> --- /dev/null   Thu Jan 01 00:00:00 1970 +
> +++ b/linux/drivers/media/video/gspca/jeilinj.c Sat Aug 01 15:42:02 2009
> -0500
> @@ -0,0 +1,387 @@
> +/*
> + * Jeilinj subdriver
> + *
> + * Supports some Jeilin dual-mode cameras which use bulk transport and
> + * download raw JPEG data.
> + *
> + * Copyright (C) 2009 Theodore Kilgore
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +#define MODULE_NAME "jeilinj"
> +
> +#include 
> +#include "gspca.h"
> +#include "jpeg.h"
> +
> +MODULE_AUTHOR("Theodore Kilgore ");
> +MODULE_DESCRIPTION("GSPCA/JEILINJ USB Camera Driver");
> +MODULE_LICENSE("GPL");
> +
> +/* Default timeouts, in ms */
> +#define JEILINJ_CMD_TIMEOUT 500
> +#define JEILINJ_DATA_TIMEOUT 1000
> +
> +/* Maximum transfer size to use. */
> +#define JEILINJ_MAX_TRANSFER 0x200
> +
> +#define FRAME_HEADER_LEN 0x10
> +
> +/* Structure to hold all of our device specific stuff */
> +struct sd {
> +       struct gspca_dev gspca_dev;     /* !! must be the first item */
> +       const struct v4l2_pix_format *cap_mode;
> +       /* Driver stuff */
> +       struct work_struct work_struct;
> +       struct workqueue_struct *work_thread;
> +       u8 quality;                              /* image quality */
> +       u8 jpegqual;                            /* webcam quality */
> +       u8 *jpeg_hdr;
> +};
> +
> +       struct jlj_command {
> +               unsigned char in

Re: Patch: Kaiser Baas ExpressCard Dual HD Tuner

2009-07-28 Thread Alexey Klimov
Hello, James

On Wed, Jul 29, 2009 at 4:19 AM, James A Webb wrote:
> Hi.
>
> I'm new to the list - please bear with me.
>
> I've spent some time getting a recently purchased Kaiser Baas
> ExpressCard Dual HD Tuner working with MythTV.  I ended up patching some
> of the dib0700 work.  I'd like to submit the patches back to the
> community.

Please always send your "Signed-off-by" label with your patches.
It's good to send one more letter replying to your initial letter with
your sign.

-- 
Best regards, Klimov Alexey
--
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 v2 4/4] radio-si470x: add i2c driver for si470x

2009-07-19 Thread Alexey Klimov
Hello,

On Tue, Jul 14, 2009 at 9:15 AM, Joonyoung Shim wrote:
> This patch supports i2c interface of si470x. The i2c specific part
> exists in radio-si470x-i2c.c file and the common part uses
> radio-si470x-common.c file. The '#if defined' is inserted inevitably
> because of parts used only si470x usb in the common file.
>
> The current driver version doesn't support the RDS.
>
> Signed-off-by: Joonyoung Shim 
> ---
>  linux/drivers/media/radio/si470x/Kconfig           |   13 +
>  linux/drivers/media/radio/si470x/Makefile          |    2 +
>  .../media/radio/si470x/radio-si470x-common.c       |    6 +
>  .../drivers/media/radio/si470x/radio-si470x-i2c.c  |  254 
> 
>  linux/drivers/media/radio/si470x/radio-si470x.h    |    6 +
>  5 files changed, 281 insertions(+), 0 deletions(-)
>  create mode 100644 linux/drivers/media/radio/si470x/radio-si470x-i2c.c
>
> diff --git a/linux/drivers/media/radio/si470x/Kconfig 
> b/linux/drivers/media/radio/si470x/Kconfig
> index 20d05c0..a466654 100644
> --- a/linux/drivers/media/radio/si470x/Kconfig
> +++ b/linux/drivers/media/radio/si470x/Kconfig
> @@ -22,3 +22,16 @@ config USB_SI470X
>
>          To compile this driver as a module, choose M here: the
>          module will be called radio-usb-si470x.
> +
> +config I2C_SI470X
> +       tristate "Silicon Labs Si470x FM Radio Receiver support with I2C"
> +       depends on I2C && RADIO_SI470X && !USB_SI470X
> +       ---help---
> +         This is a driver for I2C devices with the Silicon Labs SI470x
> +         chip.
> +
> +         Say Y here if you want to connect this type of radio to your
> +         computer's I2C port.
> +
> +         To compile this driver as a module, choose M here: the
> +         module will be called radio-i2c-si470x.
> diff --git a/linux/drivers/media/radio/si470x/Makefile 
> b/linux/drivers/media/radio/si470x/Makefile
> index 3cb777f..0696481 100644
> --- a/linux/drivers/media/radio/si470x/Makefile
> +++ b/linux/drivers/media/radio/si470x/Makefile
> @@ -3,5 +3,7 @@
>  #
>
>  radio-usb-si470x-objs  := radio-si470x-usb.o radio-si470x-common.o
> +radio-i2c-si470x-objs  := radio-si470x-i2c.o radio-si470x-common.o
>
>  obj-$(CONFIG_USB_SI470X) += radio-usb-si470x.o
> +obj-$(CONFIG_I2C_SI470X) += radio-i2c-si470x.o
> diff --git a/linux/drivers/media/radio/si470x/radio-si470x-common.c 
> b/linux/drivers/media/radio/si470x/radio-si470x-common.c
> index 84cbea3..0a48159 100644
> --- a/linux/drivers/media/radio/si470x/radio-si470x-common.c
> +++ b/linux/drivers/media/radio/si470x/radio-si470x-common.c
> @@ -581,8 +581,12 @@ static int si470x_vidioc_g_tuner(struct file *file, void 
> *priv,
>        /* driver constants */
>        strcpy(tuner->name, "FM");
>        tuner->type = V4L2_TUNER_RADIO;
> +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE)
>        tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO |
>                            V4L2_TUNER_CAP_RDS;
> +#else
> +       tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
> +#endif
>
>        /* range limits */
>        switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) {
> @@ -608,10 +612,12 @@ static int si470x_vidioc_g_tuner(struct file *file, 
> void *priv,
>                tuner->rxsubchans = V4L2_TUNER_SUB_MONO;
>        else
>                tuner->rxsubchans = V4L2_TUNER_SUB_MONO | 
> V4L2_TUNER_SUB_STEREO;
> +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE)
>        /* If there is a reliable method of detecting an RDS channel,
>           then this code should check for that before setting this
>           RDS subchannel. */
>        tuner->rxsubchans |= V4L2_TUNER_SUB_RDS;
> +#endif
>
>        /* mono/stereo selector */
>        if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 0)
> diff --git a/linux/drivers/media/radio/si470x/radio-si470x-i2c.c 
> b/linux/drivers/media/radio/si470x/radio-si470x-i2c.c
> new file mode 100644
> index 000..2181021
> --- /dev/null
> +++ b/linux/drivers/media/radio/si470x/radio-si470x-i2c.c
> @@ -0,0 +1,254 @@
> +/*
> + * drivers/media/radio/si470x/radio-si470x-i2c.c
> + *
> + * I2C driver for radios with Silicon Labs Si470x FM Radio Receivers
> + *
> + * Copyright (C) 2009 Samsung Electronics Co.Ltd
> + * Author: Joonyoung Shim 
> + *
> + *  This program is free software; you can redistribute  it and/or modify it
> + *  under  the terms of  the GNU General  Public License as published by the
> + *  Free Software Foundation;  either version 2 of the  License, or (at your
> + *  option) any later version.
> + *
> + *
> + * TODO:
> + * - RDS support
> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "radio-si470x.h"
> +
> +#define DRIVER_KERNEL_VERSION  KERNEL_VERSION(1, 0, 0)
> +#define DRIVER_CARD            "Silicon Labs Si470x FM Radio Receiver"
> +#define DRIVER_VERSION         "1.0.0"
> +
> +/* starting with the upper byte of register 0x0a */
> +#define READ_REG_NUM       

Re: [PATCH 2/2] radio-si470x: add i2c driver for si470x

2009-07-13 Thread Alexey Klimov
Hello all

On 7/13/09, Joonyoung Shim  wrote:
> This patch supports i2c interface of si470x. The i2c specific part
> exists in radio-si470x-i2c.c file and the common part uses
> radio-si470x-common.c file. The '#if defined' is inserted inevitably
> because of parts used only si470x usb in the common file.
>
> The current driver version doesn't support the RDS.
>
> Signed-off-by: Joonyoung Shim 
> ---
>  linux/drivers/media/radio/si470x/Kconfig   |   13 +
>  linux/drivers/media/radio/si470x/Makefile  |2 +
>  .../media/radio/si470x/radio-si470x-common.c   |   24 ++
>  .../drivers/media/radio/si470x/radio-si470x-i2c.c  |  250
> 
>  linux/drivers/media/radio/si470x/radio-si470x.h|6 +
>  5 files changed, 295 insertions(+), 0 deletions(-)
>  create mode 100644 linux/drivers/media/radio/si470x/radio-si470x-i2c.c
>
> diff --git a/linux/drivers/media/radio/si470x/Kconfig
> b/linux/drivers/media/radio/si470x/Kconfig
> index 20d05c0..a466654 100644
> --- a/linux/drivers/media/radio/si470x/Kconfig
> +++ b/linux/drivers/media/radio/si470x/Kconfig
> @@ -22,3 +22,16 @@ config USB_SI470X
>
> To compile this driver as a module, choose M here: the
> module will be called radio-usb-si470x.
> +
> +config I2C_SI470X
> + tristate "Silicon Labs Si470x FM Radio Receiver support with I2C"
> + depends on I2C && RADIO_SI470X && !USB_SI470X
> + ---help---
> +   This is a driver for I2C devices with the Silicon Labs SI470x
> +   chip.
> +
> +   Say Y here if you want to connect this type of radio to your
> +   computer's I2C port.
> +
> +   To compile this driver as a module, choose M here: the
> +   module will be called radio-i2c-si470x.
> diff --git a/linux/drivers/media/radio/si470x/Makefile
> b/linux/drivers/media/radio/si470x/Makefile
> index 3cb777f..0696481 100644
> --- a/linux/drivers/media/radio/si470x/Makefile
> +++ b/linux/drivers/media/radio/si470x/Makefile
> @@ -3,5 +3,7 @@
>  #
>
>  radio-usb-si470x-objs:= radio-si470x-usb.o radio-si470x-common.o
> +radio-i2c-si470x-objs:= radio-si470x-i2c.o radio-si470x-common.o
>
>  obj-$(CONFIG_USB_SI470X) += radio-usb-si470x.o
> +obj-$(CONFIG_I2C_SI470X) += radio-i2c-si470x.o
> diff --git a/linux/drivers/media/radio/si470x/radio-si470x-common.c
> b/linux/drivers/media/radio/si470x/radio-si470x-common.c
> index d2dc1ff..77f79e7 100644
> --- a/linux/drivers/media/radio/si470x/radio-si470x-common.c
> +++ b/linux/drivers/media/radio/si470x/radio-si470x-common.c
> @@ -473,11 +473,13 @@ static int si470x_vidioc_g_ctrl(struct file *file,
> void *priv,
>   struct si470x_device *radio = video_drvdata(file);
>   int retval = 0;
>
> +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE)
>   /* safety checks */
>   if (radio->disconnected) {
>   retval = -EIO;
>   goto done;
>   }
> +#endif

I'm sorry for asking but is it possible to turn this into separate macro?
Something like this for example:

/* comment about macro */
#if defined (CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE)
#define safety_check() if() {
... checks ...
}
#elseif
#define safety_check()
#endif

to run away from many #if defined-#endif constructions in source code.
Is it really good to redesign this or am i wrong here?


>   switch (ctrl->id) {
>   case V4L2_CID_AUDIO_VOLUME:
> @@ -492,7 +494,9 @@ static int si470x_vidioc_g_ctrl(struct file *file, void
> *priv,
>   retval = -EINVAL;
>   }
>
> +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE)
>  done:
> +#endif

Probably something can be done with such constructions also if possible.


>   if (retval < 0)
>   printk(KERN_WARNING DRIVER_NAME
>   ": get control failed with %d\n", retval);
> @@ -509,11 +513,13 @@ static int si470x_vidioc_s_ctrl(struct file *file,
> void *priv,
>   struct si470x_device *radio = video_drvdata(file);
>   int retval = 0;
>
> +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE)
>   /* safety checks */
>   if (radio->disconnected) {
>   retval = -EIO;
>   goto done;
>   }
> +#endif
>
>   switch (ctrl->id) {
>   case V4L2_CID_AUDIO_VOLUME:
> @@ -532,7 +538,9 @@ static int si470x_vidioc_s_ctrl(struct file *file, void
> *priv,
>   retval = -EINVAL;
>   }
>
> +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE)
>  done:
> +#endif
>   if (retval < 0)
>   printk(KERN_WARNING DRIVER_NAME
>   ": set control failed with %d\n", retval);
> @@ -566,10 +574,12 @@ static int si470x_vidioc_g_tuner(struct file *file,
> void *priv,
>   int retval = 0;
>
>   /* safety checks */
> +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE)
>   if (radio->disconnected) {
>   retval = -EIO;
>   goto done;
>   }
> +#endif
>  

Re: [PATCH 1/1] gspca: Add sn9c20x subdriver

2009-07-06 Thread Alexey Klimov
Hello Brian,
please see below

On Mon, Jul 6, 2009 at 3:30 PM, Brian Johnson wrote:
> This adds support for webcams using the sn9c201 and sn9c202 bridges.
>
> Signed-off-by: Brian Johnson 
> ---
>  MAINTAINERS                                        |    8 +
>  drivers/media/video/gspca/Kconfig                  |    1 +
>  drivers/media/video/gspca/Makefile                 |    1 +
>  drivers/media/video/gspca/sn9c20x/Kconfig          |   21 +
>  drivers/media/video/gspca/sn9c20x/Makefile         |   14 +
>  drivers/media/video/gspca/sn9c20x/sn9c20x.c        | 2275 
> 
>  drivers/media/video/gspca/sn9c20x/sn9c20x.h        |  104 +
>  .../media/video/gspca/sn9c20x/sn9c20x_debugfs.c    |  320 +++
>  include/linux/videodev2.h                          |    1 +
>  9 files changed, 2745 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/media/video/gspca/sn9c20x/Kconfig
>  create mode 100644 drivers/media/video/gspca/sn9c20x/Makefile
>  create mode 100644 drivers/media/video/gspca/sn9c20x/sn9c20x.c
>  create mode 100644 drivers/media/video/gspca/sn9c20x/sn9c20x.h
>  create mode 100644 drivers/media/video/gspca/sn9c20x/sn9c20x_debugfs.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 381190c..fe9dd34 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2599,6 +2599,14 @@ T:       git 
> git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
>  S:     Maintained
>  F:     drivers/media/video/gspca/pac207.c
>
> +GSPCA SN9C20X SUBDRIVER
> +P:     Brian Johnson
> +M:     brij...@gmail.com
> +L:     linux-media@vger.kernel.org
> +T:     git 
> git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
> +S:     Maintained
> +F:     drivers/media/video/gspca/sn9c20x/
> +
>  GSPCA T613 SUBDRIVER
>  P:     Leandro Costantino
>  M:     lcostant...@gmail.com
> diff --git a/drivers/media/video/gspca/Kconfig 
> b/drivers/media/video/gspca/Kconfig
> index 578dc4f..ea40cc9 100644
> --- a/drivers/media/video/gspca/Kconfig
> +++ b/drivers/media/video/gspca/Kconfig
> @@ -17,6 +17,7 @@ menuconfig USB_GSPCA
>
>  if USB_GSPCA && VIDEO_V4L2
>
> +source "drivers/media/video/gspca/sn9c20x/Kconfig"
>  source "drivers/media/video/gspca/m5602/Kconfig"
>  source "drivers/media/video/gspca/stv06xx/Kconfig"
>
> diff --git a/drivers/media/video/gspca/Makefile 
> b/drivers/media/video/gspca/Makefile
> index 8a6643e..ebdb54a 100644
> --- a/drivers/media/video/gspca/Makefile
> +++ b/drivers/media/video/gspca/Makefile
> @@ -52,5 +52,6 @@ gspca_tv8532-objs   := tv8532.o
>  gspca_vc032x-objs   := vc032x.o
>  gspca_zc3xx-objs    := zc3xx.o
>
> +obj-$(CONFIG_USB_GSPCA_SN9C20X) += sn9c20x/
>  obj-$(CONFIG_USB_M5602)   += m5602/
>  obj-$(CONFIG_USB_STV06XX) += stv06xx/
> diff --git a/drivers/media/video/gspca/sn9c20x/Kconfig 
> b/drivers/media/video/gspca/sn9c20x/Kconfig
> new file mode 100644
> index 000..0027a35
> --- /dev/null
> +++ b/drivers/media/video/gspca/sn9c20x/Kconfig
> @@ -0,0 +1,21 @@
> +config USB_GSPCA_SN9C20X
> +       tristate "SN9C20X USB Camera Driver"
> +       depends on VIDEO_V4L2 && USB_GSPCA
> +       help
> +         Say Y here if you want support for cameras based on the
> +         sn9c20x chips (SN9C201 and SN9C202).
> +
> +         To compile this driver as a module, choose M here: the
> +         module will be called gspca_sn9c20x.
> +
> +config USB_GSPCA_SN9C20X_DEBUGFS
> +       bool "Enable debugfs support"
> +       depends on USB_GSPCA_SN9C20X
> +       ---help---
> +         Say Y here in order to enable debugfs for sn9c20x webcams
> +
> +config USB_GSPCA_SN9C20X_EVDEV
> +       bool "Enable evdev support"
> +       depends on USB_GSPCA_SN9C20X
> +       ---help---
> +         Say Y here in order to enable evdev support for sn9c20x webcam 
> button.
> diff --git a/drivers/media/video/gspca/sn9c20x/Makefile 
> b/drivers/media/video/gspca/sn9c20x/Makefile
> new file mode 100644
> index 000..0578e9d
> --- /dev/null
> +++ b/drivers/media/video/gspca/sn9c20x/Makefile
> @@ -0,0 +1,14 @@
> +obj-$(CONFIG_USB_GSPCA_SN9C20X) += gspca_sn9c20x.o
> +
> +gspca_sn9c20x-objs := sn9c20x.o
> +
> +ifeq ($(CONFIG_USB_GSPCA_SN9C20X_DEBUGFS),y)
> +gspca_sn9c20x-objs += sn9c20x_debugfs.o
> +EXTRA_CFLAGS += -DCONFIG_USB_GSPCA_SN9C20X_DEBUGFS
> +endif
> +
> +ifeq ($(CONFIG_USB_GSPCA_SN9C20X_EVDEV),y)
> +EXTRA_CFLAGS += -DCONFIG_USB_SN9C20X_EVDEV
> +endif
> +
> +EXTRA_CFLAGS += -Idrivers/media/video/gspca
> diff --git a/drivers/media/video/gspca/sn9c20x/sn9c20x.c 
> b/drivers/media/video/gspca/sn9c20x/sn9c20x.c
> new file mode 100644
> index 000..081561e
> --- /dev/null
> +++ b/drivers/media/video/gspca/sn9c20x/sn9c20x.c
> @@ -0,0 +1,2275 @@
> +/*
> + *     Sonix sn9c201 sn9c202 library
> + *     Copyright (C) 2008-2009 microdia project 
> + *     Copyright (C) 2009 Brian Johnson 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either v

Re: [PATCH 4/11 - v3] dm644x ccdc module for vpfe capture driver

2009-06-17 Thread Alexey Klimov
On Thu, Jun 18, 2009 at 12:11 AM,  wrote:
> From: Muralidharan Karicheri 
>
> DM644x CCDC hw module
>
> This is the hw module for DM644x CCDC. This registers with the
> vpfe capture driver and provides a set of hw_ops to configure
> CCDC for a specific decoder device connected to the VPFE
>
> Module description, GPL and owner information MACROs added at the top



> +static int dm644x_ccdc_init(void)
> +{
> +       printk(KERN_NOTICE "dm644x_ccdc_init\n");
> +       if (vpfe_register_ccdc_device(&ccdc_hw_dev) < 0)
> +               return -1;

The same small idea like in "[PATCH 3/11 - v3] dm355 ccdc module for
vpfe capture driver" about this function. What do you think about
introducing ret variable and returning good error code?

> +       printk(KERN_NOTICE "%s is registered with vpfe.\n",
> +               ccdc_hw_dev.name);
> +       return 0;
> +}
> +
> +static void dm644x_ccdc_exit(void)
> +{
> +       vpfe_unregister_ccdc_device(&ccdc_hw_dev);
> +}


-- 
Best regards, Klimov Alexey
--
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 3/11 - v3] dm355 ccdc module for vpfe capture driver

2009-06-17 Thread Alexey Klimov
Hello,
one more small comment

On Thu, Jun 18, 2009 at 12:11 AM,  wrote:
> From: Muralidharan Karicheri 
>
> DM355 CCDC hw module
>
> Adds ccdc hw module for DM355 CCDC. This registers with the bridge
> driver a set of hw_ops for configuring the CCDC for a specific
> decoder device connected to vpfe.
>
> The module description and owner information added





> +static int dm355_ccdc_init(void)
> +{
> +       printk(KERN_NOTICE "dm355_ccdc_init\n");
> +       if (vpfe_register_ccdc_device(&ccdc_hw_dev) < 0)
> +               return -1;

Don't you want to rewrite this to return good error code?
int ret;
printk();
ret = vpfe_register_ccdc_device();
if (ret < 0)
return ret;

I know you have tight/fast track/hard schedule, so you can do this
improvement later, after merging this patch.

> +       printk(KERN_NOTICE "%s is registered with vpfe.\n",
> +               ccdc_hw_dev.name);
> +       return 0;
> +}
> +
> +static void dm355_ccdc_exit(void)
> +{
> +       vpfe_unregister_ccdc_device(&ccdc_hw_dev);
> +}


-- 
Best regards, Klimov Alexey
--
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 1/11 - v3] vpfe capture bridge driver for DM355 and DM6446

2009-06-17 Thread Alexey Klimov
Hello,

very small comments, see below please

On Thu, Jun 18, 2009 at 12:11 AM,  wrote:
> From: Muralidharan Karicheri 



> +static int vpfe_enable_clock(struct vpfe_device *vpfe_dev)
> +{
> +       struct vpfe_config *vpfe_cfg = vpfe_dev->cfg;
> +       int ret = -ENOENT;
> +
> +       vpfe_cfg->vpssclk = clk_get(vpfe_dev->pdev, "vpss_master");
> +       if (NULL == vpfe_cfg->vpssclk) {
> +               v4l2_err(vpfe_dev->pdev->driver, "No clock defined for"
> +                        "vpss_master\n");
> +               return ret;
> +       }
> +
> +       if (clk_enable(vpfe_cfg->vpssclk)) {
> +               v4l2_err(vpfe_dev->pdev->driver,
> +                       "vpfe vpss master clock not enabled");
> +               goto out;
> +       }
> +       v4l2_info(vpfe_dev->pdev->driver,
> +                "vpfe vpss master clock enabled\n");
> +
> +       vpfe_cfg->slaveclk = clk_get(vpfe_dev->pdev, "vpss_slave");
> +       if (NULL == vpfe_cfg->slaveclk) {
> +               v4l2_err(vpfe_dev->pdev->driver,
> +                       "No clock defined for vpss slave\n");
> +               goto out;
> +       }
> +
> +       if (clk_enable(vpfe_cfg->slaveclk)) {
> +               v4l2_err(vpfe_dev->pdev->driver,
> +                        "vpfe vpss slave clock not enabled");
> +               goto out;
> +       }
> +       v4l2_info(vpfe_dev->pdev->driver,
> +                "vpfe vpss slave clock enabled\n");
> +       return 0;
> +out:
> +       if (vpfe_cfg->vpssclk)
> +               clk_put(vpfe_cfg->vpssclk);
> +       if (vpfe_cfg->slaveclk)
> +               clk_put(vpfe_cfg->slaveclk);
> +
> +       return -1;
> +}
> +
> +/*
> + * vpfe_probe : This function creates device entries by register
> + * itself to the V4L2 driver and initializes fields of each
> + * device objects
> + */
> +static __init int vpfe_probe(struct platform_device *pdev)
> +{
> +       struct vpfe_config *vpfe_cfg;
> +       struct resource *res1;
> +       struct vpfe_device *vpfe_dev;
> +       struct i2c_adapter *i2c_adap;
> +       struct i2c_client *client;
> +       struct video_device *vfd;
> +       int ret = -ENOMEM, i, j;
> +       int num_subdevs = 0;
> +
> +       /* Get the pointer to the device object */
> +       vpfe_dev = vpfe_initialize();
> +
> +       if (!vpfe_dev) {
> +               v4l2_err(pdev->dev.driver,
> +                       "Failed to allocate memory for vpfe_dev\n");
> +               return ret;
> +       }
> +
> +       vpfe_dev->pdev = &pdev->dev;
> +
> +       if (NULL == pdev->dev.platform_data) {
> +               v4l2_err(pdev->dev.driver, "Unable to get vpfe config\n");
> +               ret = -ENOENT;
> +               goto probe_free_dev_mem;
> +       }
> +
> +       vpfe_cfg = pdev->dev.platform_data;
> +       vpfe_dev->cfg = vpfe_cfg;
> +       if (NULL == vpfe_cfg->ccdc ||
> +           NULL == vpfe_cfg->card_name ||
> +           NULL == vpfe_cfg->sub_devs) {
> +               v4l2_err(pdev->dev.driver, "null ptr in vpfe_cfg\n");
> +               ret = -ENOENT;
> +               goto probe_free_dev_mem;
> +       }
> +
> +       /* enable vpss clocks */
> +       ret = vpfe_enable_clock(vpfe_dev);
> +       if (ret)
> +               goto probe_free_dev_mem;
> +
> +       mutex_lock(&ccdc_lock);
> +       /* Allocate memory for ccdc configuration */
> +       ccdc_cfg = kmalloc(sizeof(struct ccdc_config), GFP_KERNEL);
> +       if (NULL == ccdc_cfg) {
> +               v4l2_err(pdev->dev.driver, "Memory allocation failed for"
> +                       "ccdc_cfg");
> +               goto probe_disable_clock;
> +       }
> +
> +       strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32);
> +       /* Get VINT0 irq resource */
> +       res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> +       if (!res1) {
> +               v4l2_err(pdev->dev.driver, "Unable to get interrupt for 
> VINT0");

Do you want to add "\n" to the end of this message? If i'm now wrong
it's better to check other messages in this patch for "\n". Please,
check.

> +               ret = -ENOENT;
> +               goto probe_disable_clock;
> +       }
> +       vpfe_dev->ccdc_irq0 = res1->start;
> +
> +       /* Get VINT1 irq resource */
> +       res1 = platform_get_resource(pdev,
> +                               IORESOURCE_IRQ, 1);
> +       if (!res1) {
> +               v4l2_err(pdev->dev.driver, "Unable to get interrupt for 
> VINT1");

"\n" ?

> +               ret = -ENOENT;
> +               goto probe_disable_clock;
> +       }
> +       vpfe_dev->ccdc_irq1 = res1->start;
> +
> +       /* Get address base of CCDC */
> +       res1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       if (!res1) {
> +               v4l2_err(pdev->dev.driver,
> +                       "Unable to get register address map\n");
> +               ret = -ENOENT;
> +               goto probe_disable_clock;
> +       }
> +
> +       ccdc_cfg->ccdc_addr_size = res1->end - res1->start + 1;
> +       if (!request_mem

Re: [PATCH / resubmit] USB interrupt support for radio-si470x FM radio driver

2009-06-16 Thread Alexey Klimov
On Wed, Jun 17, 2009 at 12:05 AM, Edouard Lafargue wrote:
> Hello Alexey,

Hello Edouard

> Many thanks for your comments. I have cleaned up my code/patch along
> your guidelines, removed all the remaining code that was not used
> anymore, checked that all buffers get deallocated properly - I hope.

It looks better, thanks.

> Review by Tobias is certainly necessary, he know his own driver best,
> I might have broken things without knowing... Anyway it works fine on
> the two 32 and 64bit machines where I have tested the dongle, both on
> kernel 2.6.28.

Review and testing are definitely necessary, of course. Let's wait his comments.

> The main and very big improvement is the performance of RDS bitstream
> reception, now Radiotext appears almost right away even on the most
> difficult stations I can receive here in Paris, just like it should.
> Performance is similar to 'real' radios, if you see what I mean. Audio
> remains perfectly clear.

Good to know that. I noticed one more possible thing, please see comment below.

> When it comes to audio, it seems to me the "si470x_get_report" call
> generates some serious clicking in the audio on my Silabs dongle. I
> will investigate further, I wonder if other USB FM tokens have the
> same issue. I fixed this problem on rdsd by adding a configuration
> file option to prevent it constantly polling the dongle for its
> current frequency...
>
> Comments are welcome!
>
> Best regards,
>
> Signed-off-by: Edouard Lafargue 
>
> diff -Nur ../radio-si470x.c radio-si470x.c
> --- ../radio-si470x.c   2008-12-25 00:26:37.0 +0100
> +++ radio-si470x.c      2009-06-16 21:47:58.0 +0200
> @@ -97,9 +97,13 @@
>  *             - add support for KWorld USB FM Radio FM700
>  *             - blacklisted KWorld radio in hid-core.c and hid-ids.h
>  *
> + * 2009-06-16   Edouard Lafargue 
> + *             Version 1.0.9
> + *             - add support for interrupt mode for RDS endpoint, instead of 
> polling.
> + *                Improves RDS reception significantly

Hmmm. Did you make this patch against 2.6.28 kernel sources?

Current version of driver is 1.0.9 already :)
http://linuxtv.org/hg/v4l-dvb/file/45f342431f6e/linux/drivers/media/radio/

So, your change will make 1.1.0, right?
Usually developers applied patches to the latest version of code. If
you want to work/make patch with the latest version of v4l-dvb tree
you can use v4l-dvb mercurial tree. Link that can help:
http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers
Actually, steps in general:
1) install mercurial
2) clone current v4l-dvb tree:
hg clone http://linuxtv.org/hg/v4l-dvb
3) Add your changes in radio-si470x driver.
4) Command "hg diff" will show changes. You can save this changes and
sent it to maillist.
5) Don't forget to run "make checkpatch" and "make whitespaces". It
will check CodingStyle of your changes.
6) You can use commands like: make menuconfig, make, make install to
select, compile and install v4l modules.
This way you can update your patch and test it with latest si470x driver.

Other way - you can wait Tobias comments and don't play with v4l-dvb tree.

> + *
>  * ToDo:
>  * - add firmware download/update support
> - * - RDS support: interrupt mode, instead of polling
>  * - add LED status output (check if that's not already done in firmware)
>  */
>
> @@ -107,10 +111,10 @@
>  /* driver definitions */
>  #define DRIVER_AUTHOR "Tobias Lorenz "
>  #define DRIVER_NAME "radio-si470x"
> -#define DRIVER_KERNEL_VERSION KERNEL_VERSION(1, 0, 8)
> +#define DRIVER_KERNEL_VERSION KERNEL_VERSION(1, 0, 9)
>  #define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver"
>  #define DRIVER_DESC "USB radio driver for Si470x FM Radio Receivers"
> -#define DRIVER_VERSION "1.0.8"
> +#define DRIVER_VERSION "1.0.9"
>
>
>  /* kernel includes */
> @@ -206,16 +210,6 @@
>  module_param(max_rds_errors, ushort, 0644);
>  MODULE_PARM_DESC(max_rds_errors, "RDS maximum block errors: *1*");
>
> -/* RDS poll frequency */
> -static unsigned int rds_poll_time = 40;
> -/* 40 is used by the original USBRadio.exe */
> -/* 50 is used by radio-cadet */
> -/* 75 should be okay */
> -/* 80 is the usual RDS receive interval */
> -module_param(rds_poll_time, uint, 0644);
> -MODULE_PARM_DESC(rds_poll_time, "RDS poll time (ms): *40*");
> -
> -
>
>  /**
>  * Register Definitions
> @@ -440,6 +434,12 @@
>        struct usb_interface *intf;
>        struct video_device *videodev;
>
> +       /* Interrupt endpoint handling */
> +       char *int_in_buffer;
> +       struct usb_endpoint_descriptor *int_in_endpoint;
> +       struct urb *int_in_urb;
> +       int int_in_running;
> +
>        /* driver management */
>        unsigned int users;
>        unsigned char disconnected;
> @@ -449,7 +449,6 @@
>        unsigned short registers[RADIO_REGISTER_NUM];
>
>        /* RDS receive buffer */
> -       struct delayed_work work;
>        

Re: [PATCH] USB interrupt support for radio-si470x FM radio driver

2009-06-16 Thread Alexey Klimov
Hello, Edouard

(add Tobias and Douglas on c/c)

On Tue, Jun 16, 2009 at 5:11 PM, Edouard Lafargue wrote:
> Please find below my attempt at removing 'manual' polling from the
> radio-si470x USB FM radio driver, by moving to URB interrupt callback
> handlers.
>
> This code significantly improves RDS reception - radiotext in
> particular - and improves audio quality on my Silabs FM USB dongle, as
> lots of pops and clicks have now disappeared. Your mileage may vary.
> Issues remain when userspace programs do V4L ioctl calls to the
> dongle: this creates clicks in the audio.
>
> I am by no means a professional driver writer and the code below is
> most probably in need of a proper review by someone more experienced
> than me in writing Linux USB drivers. It does not raise issues on the
> machines where I have tested it, but this is hardly proof it's good.
> Any help will be much appreciated. It is only tested on the dongle I
> own, a Silabs "Reference Design" FM receiver dongle.
>
> Last: there are a few bits left commented out in my patched version,
> those are kept to help code review if someone wants to help, they
> should probably be removed from a final release.
>
> Thanks for your feedback!
>
> Signed-off-by: Edouard Lafargue 
>
> diff -Nur ../radio-si470x.c radio-si470x.c
> --- ../radio-si470x.c   2008-12-25 00:26:37.0 +0100
> +++ radio-si470x.c      2009-06-16 14:20:07.0 +0200
> @@ -97,9 +97,14 @@
>  *             - add support for KWorld USB FM Radio FM700
>  *             - blacklisted KWorld radio in hid-core.c and hid-ids.h
>  *
> + * 2009-06-16   Edouard Lafargue 
> + *             Version 1.0.9
> + *             - add support for interrupt mode for RDS endpoint, instead of 
> polling.
> + *
>  * ToDo:
>  * - add firmware download/update support
> - * - RDS support: interrupt mode, instead of polling
> + * - RDS support: debug interrupt mode and use of URBs further!
> + * - Use URBs for all USB communications

Well, i'm not usb expert, but if such wrappers over URB like
usb_control_msg works fine, why to throw them away? I don't know but
may be there is big reason for that.

>  * - add LED status output (check if that's not already done in firmware)
>  */
>
> @@ -107,10 +112,10 @@
>  /* driver definitions */
>  #define DRIVER_AUTHOR "Tobias Lorenz "
>  #define DRIVER_NAME "radio-si470x"
> -#define DRIVER_KERNEL_VERSION KERNEL_VERSION(1, 0, 8)
> +#define DRIVER_KERNEL_VERSION KERNEL_VERSION(1, 0, 9)
>  #define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver"
>  #define DRIVER_DESC "USB radio driver for Si470x FM Radio Receivers"
> -#define DRIVER_VERSION "1.0.8"
> +#define DRIVER_VERSION "1.0.9"
>
>
>  /* kernel includes */
> @@ -207,13 +212,14 @@
>  MODULE_PARM_DESC(max_rds_errors, "RDS maximum block errors: *1*");
>
>  /* RDS poll frequency */
> -static unsigned int rds_poll_time = 40;
> +/* TODO: remove this since not used anymore as we now use the interrupt URB 
> */
> +/* static unsigned int rds_poll_time = 40; */
>  /* 40 is used by the original USBRadio.exe */
>  /* 50 is used by radio-cadet */
>  /* 75 should be okay */
>  /* 80 is the usual RDS receive interval */
> -module_param(rds_poll_time, uint, 0644);
> -MODULE_PARM_DESC(rds_poll_time, "RDS poll time (ms): *40*");
> +/* module_param(rds_poll_time, uint, 0644); */
> +/* MODULE_PARM_DESC(rds_poll_time, "RDS poll time (ms): *40*"); */
>
>
>
> @@ -440,6 +446,12 @@
>        struct usb_interface *intf;
>        struct video_device *videodev;
>
> +       /* Interrupt endpoint handling */
> +       char                            *int_in_buffer;
> +       struct usb_endpoint_descriptor *int_in_endpoint;
> +       struct urb                      *int_in_urb;
> +       int                             int_in_running;
> +
>        /* driver management */
>        unsigned int users;
>        unsigned char disconnected;
> @@ -578,37 +590,6 @@
>  }
>
>
> -/*
> - * si470x_get_rds_registers - read rds registers
> - */
> -static int si470x_get_rds_registers(struct si470x_device *radio)
> -{
> -       unsigned char buf[RDS_REPORT_SIZE];
> -       int retval;
> -       int size;
> -       unsigned char regnr;
> -
> -       buf[0] = RDS_REPORT;
> -
> -       retval = usb_interrupt_msg(radio->usbdev,
> -               usb_rcvintpipe(radio->usbdev, 1),
> -               (void *) &buf, sizeof(buf), &size, usb_timeout);
> -       if (size != sizeof(buf))
> -               printk(KERN_WARNING DRIVER_NAME ": si470x_get_rds_registers: "
> -                       "return size differs: %d != %zu\n", size, 
> sizeof(buf));
> -       if (retval < 0)
> -               printk(KERN_WARNING DRIVER_NAME ": si470x_get_rds_registers: "
> -                       "usb_interrupt_msg returned %d\n", retval);
> -
> -       if (retval >= 0)
> -               for (regnr = 0; regnr < RDS_REGISTER_NUM; regnr++)
> -                       radio->registers[STATUSRSSI + regnr] =
> -                               get_unaligned_be16(
> -                             

Re: [PATCH 10/10 - v2] common vpss module for video drivers

2009-06-11 Thread Alexey Klimov
Hello,

On Thu, Jun 11, 2009 at 9:00 PM,  wrote:
> From: Muralidharan Karicheri 
>
> common voss module for video drivers
>
> This is a new module added for vpss library functions that are
> used for configuring vpss system module. All video drivers will
> include vpss.h header file and call functions defined in this
> module to configure vpss system module.
>
>
> Reviewed By "Hans Verkuil".
> Reviewed By "Laurent Pinchart".
>
> Signed-off-by: Muralidharan Karicheri 
> ---
>  drivers/media/video/davinci/vpss.c |  290 
> 
>  include/media/davinci/vpss.h       |   69 +
>  2 files changed, 359 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/media/video/davinci/vpss.c
>  create mode 100644 include/media/davinci/vpss.h
>
> diff --git a/drivers/media/video/davinci/vpss.c 
> b/drivers/media/video/davinci/vpss.c
> new file mode 100644
> index 000..def021e
> --- /dev/null
> +++ b/drivers/media/video/davinci/vpss.c
> @@ -0,0 +1,290 @@
> +/*
> + * Copyright (C) 2009 Texas Instruments.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + *
> + * common vpss driver for all video drivers.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* DM644x defines */
> +#define DM644X_SBL_PCR_VPSS            (4)
> +
> +/* vpss BL register offsets */
> +#define DM355_VPSSBL_CCDCMUX           0x1c
> +/* vpss CLK register offsets */
> +#define DM355_VPSSCLK_CLKCTRL          0x04
> +/* masks and shifts */
> +#define VPSS_HSSISEL_SHIFT             4
> +
> +/*
> + * vpss operations. Depends on platform. Not all functions are available
> + * on all platforms. The api, first check if a functio is available before
> + * invoking it. In the probe, the function ptrs are intialized based on
> + * vpss name. vpss name can be "dm355_vpss", "dm644x_vpss" etc.
> + */
> +struct vpss_hw_ops {
> +       /* enable clock */
> +       int (*enable_clock)(enum vpss_clock_sel clock_sel, int en);
> +       /* select input to ccdc */
> +       void (*select_ccdc_source)(enum vpss_ccdc_source_sel src_sel);
> +       /* clear wbl overlflow bit */
> +       int (*clear_wbl_overflow)(enum vpss_wbl_sel wbl_sel);
> +};
> +
> +/* vpss configuration */
> +struct vpss_oper_config {
> +       __iomem void *vpss_bl_regs_base;
> +       __iomem void *vpss_regs_base;
> +       struct resource         *r1;
> +       resource_size_t         len1;
> +       struct resource         *r2;
> +       resource_size_t         len2;
> +       char vpss_name[32];
> +       spinlock_t vpss_lock;
> +       struct vpss_hw_ops hw_ops;
> +};
> +
> +static struct vpss_oper_config oper_cfg;
> +
> +/* register access routines */
> +static inline u32 bl_regr(u32 offset)
> +{
> +       return __raw_readl(oper_cfg.vpss_bl_regs_base + offset);
> +}
> +
> +static inline void bl_regw(u32 val, u32 offset)
> +{
> +       __raw_writel(val, oper_cfg.vpss_bl_regs_base + offset);
> +}
> +
> +static inline u32 vpss_regr(u32 offset)
> +{
> +       return __raw_readl(oper_cfg.vpss_regs_base + offset);
> +}
> +
> +static inline void vpss_regw(u32 val, u32 offset)
> +{
> +       __raw_writel(val, oper_cfg.vpss_regs_base + offset);
> +}
> +
> +static void dm355_select_ccdc_source(enum vpss_ccdc_source_sel src_sel)
> +{
> +       bl_regw(src_sel << VPSS_HSSISEL_SHIFT, DM355_VPSSBL_CCDCMUX);
> +}
> +
> +int vpss_select_ccdc_source(enum vpss_ccdc_source_sel src_sel)
> +{
> +       if (!oper_cfg.hw_ops.select_ccdc_source)
> +               return -1;
> +
> +       dm355_select_ccdc_source(src_sel);
> +       return 0;
> +}
> +EXPORT_SYMBOL(vpss_select_ccdc_source);
> +
> +static int dm644x_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel)
> +{
> +       u32 mask = 1, val;
> +
> +       if (wbl_sel < VPSS_PCR_AEW_WBL_0 ||
> +           wbl_sel > VPSS_PCR_CCDC_WBL_O)
> +               return -1;
> +
> +       /* writing a 0 clear the overflow */
> +       mask = ~(mask << wbl_sel);
> +       val = bl_regr(DM644X_SBL_PCR_VPSS) & mask;
> +       bl_regw(val, DM644X_SBL_PCR_VPSS);
> +       return 0;
> +}
> +
> +int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel)
> +{
> +       if (!oper_cfg.hw_ops.clear_wbl_overflow)
> +               return -1;
> +
> +       return oper_cfg.hw_ops.

Re: [PATCH 1/10 - v2] vpfe capture bridge driver for DM355 and DM6446

2009-06-11 Thread Alexey Klimov
Hello,

Very small suggestion, please see below.

On Thu, Jun 11, 2009 at 9:00 PM,  wrote:
> From: Muralidharan Karicheri 
>
> Re-sending since previous one missed a file (vpfe_types.h)
>
> VPFE Capture bridge driver
>
> This is version, v2 of vpfe capture bridge driver for doing video
> capture on DM355 and DM6446 evms. The ccdc hw modules register with the
> driver and are used for configuring the CCD Controller for a specific
> decoder interface. The driver also registers the sub devices required
> for a specific evm. More than one sub devices can be registered.
> This allows driver to switch dynamically to capture video from
> any sub device that is registered. Currently only one sub device
> (tvp5146) is supported. But in future this driver is expected
> to do capture from sensor devices such as Micron's MT9T001,MT9T031
> and MT9P031 etc. The driver currently supports MMAP based IO.
>
> Following are the updates based on review comments:-
>        1) minor number is allocated dynamically
>        2) updates to QUERYCAP handling
>        3) eliminated intermediate vpfe pixel format
>        4) refactored few functions
>        5) reworked isr routines for reducing indentation
>        6) reworked vpfe_check_format and added a documentation
>           for algorithm
>        7) fixed memory leak in probe()
>
> TODO list :
>        1) load sub device from bridge driver. Hans has enhanced
>        the v4l2-subdevice framework to do this. Will be updated
>        soon to pick this.
>
>
> Reviewed By "Hans Verkuil".
> Reviewed By "Laurent Pinchart".
>
> Signed-off-by: Muralidharan Karicheri 
> ---
> Applies to v4l-dvb repository
>
>  drivers/media/video/davinci/vpfe_capture.c | 2252 
> 
>  include/media/davinci/vpfe_capture.h       |  183 +++
>  include/media/davinci/vpfe_types.h         |   51 +
>  3 files changed, 2486 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/media/video/davinci/vpfe_capture.c
>  create mode 100644 include/media/davinci/vpfe_capture.h
>  create mode 100644 include/media/davinci/vpfe_types.h




> +/* vpfe capture driver file operations */
> +static struct v4l2_file_operations vpfe_fops = {
> +       .owner = THIS_MODULE,
> +       .open = vpfe_open,
> +       .release = vpfe_release,
> +       .ioctl = video_ioctl2,
> +       .mmap = vpfe_mmap,
> +       .poll = vpfe_poll
> +};
> +
> +/*
> + * vpfe_check_format()
> + * This function adjust the input pixel format as per hardware
> + * capabilities and update the same in pixfmt.
> + * Following algorithm used :-
> + *
> + *     If given pixformat is not in the vpfe list of pix formats or not
> + *     supported by the hardware, current value of pixformat in the device
> + *     is used
> + *     If given field is not supported, then current field is used. If field
> + *     is different from current, then it is matched with that from sub 
> device.
> + *     Minimum height is 2 lines for interlaced or tb field and 1 line for
> + *     progressive. Maximum height is clamped to active active lines of scan
> + *     Minimum width is 32 bytes in memory and width is clamped to active
> + *     pixels of scan.
> + *     bytesperline is a multiple of 32.
> + */
> +static const struct vpfe_pixel_format *
> +       vpfe_check_format(struct vpfe_device *vpfe_dev,
> +                         struct v4l2_pix_format *pixfmt)
> +{
> +       u32 min_height = 1, min_width = 32, max_width, max_height;
> +       const struct vpfe_pixel_format *vpfe_pix_fmt;
> +       u32 pix;
> +       int temp, found;
> +
> +       vpfe_pix_fmt = vpfe_lookup_pix_format(pixfmt->pixelformat);
> +       if (NULL == vpfe_pix_fmt) {
> +               /*
> +                * use current pixel format in the vpfe device. We
> +                * will find this pix format in the table
> +                */
> +               pixfmt->pixelformat = vpfe_dev->fmt.fmt.pix.pixelformat;
> +               vpfe_pix_fmt = vpfe_lookup_pix_format(pixfmt->pixelformat);
> +       }
> +
> +       /* check if hw supports it */
> +       temp = 0;
> +       found = 0;
> +       while (ccdc_dev->hw_ops.enum_pix(&pix, temp) >= 0) {
> +               if (vpfe_pix_fmt->fmtdesc.pixelformat == pix) {
> +                       found = 1;
> +                       break;
> +               }
> +               temp++;
> +       }
> +
> +       if (!found) {
> +               /* use current pixel format */
> +               pixfmt->pixelformat = vpfe_dev->fmt.fmt.pix.pixelformat;
> +               /*
> +                * Since this is currently used in the vpfe device, we
> +                * will find this pix format in the table
> +                */
> +               vpfe_pix_fmt = vpfe_lookup_pix_format(pixfmt->pixelformat);
> +       }
> +
> +       /* check what field format is supported */
> +       if (pixfmt->field == V4L2_FIELD_ANY) {
> +               /* if field is any, use current value as default */
> +               pixfmt->field = vpfe_dev->fmt.fmt.

Re: [patch 1/6] radio-mr800.c: missing mutex include

2009-06-10 Thread Alexey Klimov
On Wed, Jun 10, 2009 at 11:44 PM,  wrote:
> From: Alessio Igor Bogani 
>
> radio-mr800.c uses struct mutex, so while  seems to be
> pulled in indirectly by one of the headers it already includes, the right
> thing is to include it directly.

It was already applied to v4l-dvb tree (and probably to v4l git tree).
Thanks,
-- 
regards, Klimov Alexey
--
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 review] gspca - stv06xx: remove needless if check and goto

2009-06-09 Thread Alexey Klimov
Hello, Jean-Francois and Erik André

What do you think about such small change?
Looks like the code doesn't need if-check and goto here in stv06xx_stopN
function. The code after label "out" does this.

--
Patch removes needless if check and goto. 


Signed-off-by: Alexey Klimov 
--
diff -r ed3781a79c73 linux/drivers/media/video/gspca/stv06xx/stv06xx.c
--- a/linux/drivers/media/video/gspca/stv06xx/stv06xx.c Sat Jun 06 16:31:34 
2009 +0400
+++ b/linux/drivers/media/video/gspca/stv06xx/stv06xx.c Tue Jun 09 14:49:04 
2009 +0400
@@ -293,8 +293,6 @@
goto out;
 
err = sd->sensor->stop(sd);
-   if (err < 0)
-   goto out;
 
 out:
if (err < 0)


-- 
Best regards, Klimov Alexey

--
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: Probably strange bug with usb radio-mr800

2009-06-07 Thread Alexey Klimov
Hello,

On Sun, Jun 7, 2009 at 1:07 AM, Oliver Neukum wrote:
> Am Freitag, 5. Juni 2009 00:43:04 schrieb Alexey Klimov:
>> Is there any ideas about different behaviour of device on 32- and
>> 64-bit platforms with the same usb bulk messages?
>> Any input is welcome.
>
> Are you running a 32 bit userland? If so, ioctls could be critical.

Two different machines. The answer is no.

> If not, the driver may not be 64bit clean. Which driver is affected?

media/radio/radio-mr800.c
Please, also take a look in my first letter to usb and v4l mail lists
from May 27.

-- 
Best regards, Klimov Alexey
--
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 5/9] V4L2: Added Timberdale Logiwin driver

2009-06-06 Thread Alexey Klimov
Hello, Richard
i have only two small suggestions.

On Fri, Jun 5, 2009 at 5:40 PM, Richard
Röjfors wrote:
> V4L2 video capture driver for the logiwin IP on the Timberdale FPGA.
>
> The driver uses the Timberdale DMA engine
>
> Signed-off-by: Richard Röjfors 
> ---
> Index: linux-2.6.30-rc7/drivers/media/video/timblogiw.c
> ===
> --- linux-2.6.30-rc7/drivers/media/video/timblogiw.c    (revision 0)
> +++ linux-2.6.30-rc7/drivers/media/video/timblogiw.c    (revision 867)
> @@ -0,0 +1,949 @@
> +/*
> + * timblogiw.c timberdale FPGA LogiWin Video In driver
> + * Copyright (c) 2009 Intel Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + */
> +
> +/* Supports:
> + * Timberdale FPGA LogiWin Video In
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "timblogiw.h"
> +#include 
> +#include 
> +#include 
> +
> +#define TIMBLOGIW_CTRL 0x40
> +
> +#define TIMBLOGIW_H_SCALE 0x20
> +#define TIMBLOGIW_V_SCALE 0x28
> +
> +#define TIMBLOGIW_X_CROP 0x58
> +#define TIMBLOGIW_Y_CROP 0x60
> +
> +#define TIMBLOGIW_W_CROP 0x00
> +#define TIMBLOGIW_H_CROP 0x08
> +
> +#define TIMBLOGIW_VERSION_CODE 0x02
> +
> +#define TIMBLOGIW_BUF  0x04
> +#define TIMBLOGIW_TBI  0x2c
> +#define TIMBLOGIW_BPL  0x30
> +
> +#define dbg(...)
> +
> +#define DMA_BUFFER_SIZE (720 * 576 * 2)
> +
> +const struct timblogiw_tvnorm timblogiw_tvnorms[] = {
> +       {
> +               .std                    = V4L2_STD_PAL,
> +               .name                   = "PAL",
> +               .width                  = 720,
> +               .height                 = 576
> +       },
> +       {
> +               .std                    = V4L2_STD_NTSC_M,
> +               .name                   = "NTSC",
> +               .width                  = 720,
> +               .height                 = 480
> +       }
> +};
> +
> +static int timblogiw_bytes_per_line(const struct timblogiw_tvnorm *norm)
> +{
> +       return norm->width * 2;
> +}
> +
> +
> +static int timblogiw_frame_size(const struct timblogiw_tvnorm *norm)
> +{
> +       return norm->height * timblogiw_bytes_per_line(norm);
> +}
> +
> +static const struct timblogiw_tvnorm *timblogiw_get_norm(const v4l2_std_id 
> std)
> +{
> +       int i;
> +       for (i = 0; i < ARRAY_SIZE(timblogiw_tvnorms); i++)
> +               if (timblogiw_tvnorms[i].std == std)
> +                       return timblogiw_tvnorms + i;
> +
> +       /* default to first element */
> +       return timblogiw_tvnorms;
> +}
> +
> +static void timblogiw_handleframe(unsigned long arg)
> +{
> +       struct timblogiw_frame *f;
> +       struct timblogiw *lw = (struct timblogiw *)arg;
> +
> +       spin_lock_bh(&lw->queue_lock);
> +       if (lw->dma.filled && !list_empty(&lw->inqueue)) {
> +               /* put the entry in the outqueue */
> +               f = list_entry(lw->inqueue.next, struct timblogiw_frame, 
> frame);
> +
> +               /* copy data from the DMA buffer */
> +               memcpy(f->bufmem, lw->dma.filled->buf, f->buf.length);
> +               /* buffer consumed */
> +               lw->dma.filled = NULL;
> +
> +               do_gettimeofday(&f->buf.timestamp);
> +               f->buf.sequence = ++lw->frame_count;
> +               f->buf.field = V4L2_FIELD_NONE;
> +               f->state = F_DONE;
> +               f->buf.bytesused = f->buf.length;
> +               list_move_tail(&f->frame, &lw->outqueue);
> +               /* wake up any waiter */
> +               wake_up(&lw->wait_frame);
> +       } else {
> +               /* No user buffer available, consume buffer anyway
> +                * who wants an old video frame?
> +                */
> +               lw->dma.filled = NULL;
> +       }
> +       spin_unlock_bh(&lw->queue_lock);
> +}
> +
> +static int timblogiw_isr(u32 flag, void *pdev)
> +{
> +       struct timblogiw *lw = (struct timblogiw *)pdev;
> +
> +       if (!lw->dma.filled && (flag & DMA_IRQ_VIDEO_RX)) {
> +               /* Got a frame, store it, and flip to next DMA buffer */
> +               lw->dma.filled = lw->dma.transfer + lw->dma.curr;
> +               lw->dma.curr = !lw->dma.curr;
> +       }
> +
> +       if (lw->stream == STREAM_ON)
> +               timb_start_dma(DMA_IRQ_

Re: Probably strange bug with usb radio-mr800

2009-06-05 Thread Alexey Klimov
On Fri, Jun 5, 2009 at 2:53 AM, Greg KH wrote:
> On Fri, Jun 05, 2009 at 02:43:04AM +0400, Alexey Klimov wrote:
>> Is there any ideas about different behaviour of device on 32- and
>> 64-bit platforms with the same usb bulk messages?
>
> No, there should be no difference.
>
> Have you run usbmon to look at the data on the wire?

Of course, there is my first letter (from May 27) on usb and v4l mail
lists with usbmon output.
Here is the link http://www.spinics.net/lists/linux-media/msg06051.html

-- 
Best regards, Klimov Alexey
--
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: Probably strange bug with usb radio-mr800

2009-06-04 Thread Alexey Klimov
Is there any ideas about different behaviour of device on 32- and
64-bit platforms with the same usb bulk messages?
Any input is welcome.

On Wed, May 27, 2009 at 9:51 PM, Alexey Klimov wrote:

[...]

> So, the same messages to device works fine with radio on 32bit machine
> and nothing on 64bit machine.
> Good thing is if i add one more start message radio works on 64bit machine 
> also.
>
> Is this usb subsystem bug?
> Should i make some workaround to deal with this and add comments about 
> mplayer?


-- 
Best regards, Klimov Alexey
--
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 review 4/4] dsbr100: change radio->muted to radio->status, update suspend/resume

2009-05-28 Thread Alexey Klimov
Patch renames radio->muted to radio->status, add defines for that
variable, and fixes suspend/resume procedure. Radio->status set to
STOPPED in usb_dsbr100_probe because of removing open call.
Also, patch increases driver version.

Signed-off-by: Alexey Klimov 

--
diff -r 8046021e508e linux/drivers/media/radio/dsbr100.c
--- a/linux/drivers/media/radio/dsbr100.c   Tue May 19 15:59:49 2009 +0400
+++ b/linux/drivers/media/radio/dsbr100.c   Tue May 19 17:55:35 2009 +0400
@@ -33,6 +33,10 @@
 
  History:
 
+ Version 0.46:
+   Removed usb_dsbr100_open/close calls and radio->users counter. Also,
+   radio->muted changed to radio->status and suspend/resume calls updated.
+
  Version 0.45:
Converted to v4l2_device.
 
@@ -101,8 +105,8 @@
  */
 #include  /* for KERNEL_VERSION MACRO */
 
-#define DRIVER_VERSION "v0.45"
-#define RADIO_VERSION KERNEL_VERSION(0, 4, 5)
+#define DRIVER_VERSION "v0.46"
+#define RADIO_VERSION KERNEL_VERSION(0, 4, 6)
 
 #define DRIVER_AUTHOR "Markus Demleitner "
 #define DRIVER_DESC "D-Link DSB-R100 USB FM radio driver"
@@ -122,6 +126,10 @@
 #define FREQ_MAX 108.0
 #define FREQ_MUL 16000
 
+/* defines for radio->status */
+#define STARTED0
+#define STOPPED1
+
 #define videodev_to_radio(d) container_of(d, struct dsbr100_device, videodev)
 
 static int usb_dsbr100_probe(struct usb_interface *intf,
@@ -145,7 +153,7 @@
int curfreq;
int stereo;
int removed;
-   int muted;
+   int status;
 };
 
 static struct usb_device_id usb_dsbr100_device_table [] = {
@@ -201,7 +209,7 @@
goto usb_control_msg_failed;
}
 
-   radio->muted = 0;
+   radio->status = STARTED;
mutex_unlock(&radio->lock);
return (radio->transfer_buffer)[0];
 
@@ -244,7 +252,7 @@
goto usb_control_msg_failed;
}
 
-   radio->muted = 1;
+   radio->status = STOPPED;
mutex_unlock(&radio->lock);
return (radio->transfer_buffer)[0];
 
@@ -473,7 +481,7 @@
 
switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE:
-   ctrl->value = radio->muted;
+   ctrl->value = radio->status;
return 0;
}
return -EINVAL;
@@ -549,9 +557,21 @@
struct dsbr100_device *radio = usb_get_intfdata(intf);
int retval;
 
-   retval = dsbr100_stop(radio);
-   if (retval < 0)
-   dev_warn(&intf->dev, "dsbr100_stop failed\n");
+   if (radio->status == STARTED) {
+   retval = dsbr100_stop(radio);
+   if (retval < 0)
+   dev_warn(&intf->dev, "dsbr100_stop failed\n");
+
+   /* After dsbr100_stop() status set to STOPPED.
+* If we want driver to start radio on resume
+* we set status equal to STARTED.
+* On resume we will check status and run radio if needed.
+*/
+
+   mutex_lock(&radio->lock);
+   radio->status = STARTED;
+   mutex_unlock(&radio->lock);
+   }
 
dev_info(&intf->dev, "going into suspend..\n");
 
@@ -564,9 +584,11 @@
struct dsbr100_device *radio = usb_get_intfdata(intf);
int retval;
 
-   retval = dsbr100_start(radio);
-   if (retval < 0)
-   dev_warn(&intf->dev, "dsbr100_start failed\n");
+   if (radio->status == STARTED) {
+   retval = dsbr100_start(radio);
+   if (retval < 0)
+   dev_warn(&intf->dev, "dsbr100_start failed\n");
+   }
 
dev_info(&intf->dev, "coming out of suspend..\n");
 
@@ -645,6 +667,7 @@
radio->removed = 0;
radio->usbdev = interface_to_usbdev(intf);
radio->curfreq = FREQ_MIN * FREQ_MUL;
+   radio->status = STOPPED;
 
video_set_drvdata(&radio->videodev, radio);
 



-- 
Best regards, Klimov Alexey

--
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 review 3/4] dsbr100: no need to pass curfreq value to dsbr100_setfreq()

2009-05-28 Thread Alexey Klimov
Small cleanup of dsbr100_setfreq(). No need to pass radio->curfreq value
to this function.

Signed-off-by: Alexey Klimov 

--
diff -r d7322837a62c linux/drivers/media/radio/dsbr100.c
--- a/linux/drivers/media/radio/dsbr100.c   Tue May 19 15:18:56 2009 +0400
+++ b/linux/drivers/media/radio/dsbr100.c   Tue May 19 15:59:39 2009 +0400
@@ -258,12 +258,12 @@
 }
 
 /* set a frequency, freq is defined by v4l's TUNER_LOW, i.e. 1/16th kHz */
-static int dsbr100_setfreq(struct dsbr100_device *radio, int freq)
+static int dsbr100_setfreq(struct dsbr100_device *radio)
 {
int retval;
int request;
+   int freq = (radio->curfreq / 16 * 80) / 1000 + 856;
 
-   freq = (freq / 16 * 80) / 1000 + 856;
mutex_lock(&radio->lock);
 
retval = usb_control_msg(radio->usbdev,
@@ -431,7 +431,7 @@
radio->curfreq = f->frequency;
mutex_unlock(&radio->lock);
 
-   retval = dsbr100_setfreq(radio, radio->curfreq);
+   retval = dsbr100_setfreq(radio);
if (retval < 0)
dev_warn(&radio->usbdev->dev, "Set frequency failed\n");
return 0;



-- 
Best regards, Klimov Alexey

--
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 review 2/4] dsbr100: remove usb_dsbr100_open/close calls

2009-05-28 Thread Alexey Klimov
Patch removes usb_dsbr100_open and usb_dsbr100_close calls.
1. No need to start, set frequency, adjust parameters in open call.
2. This patch tackles issue with lock/unlock_kernel() in open call.
3. With this patch feature "Mute on exit?" in gnomeradio works.

Signed-off-by: Alexey Klimov 

--
diff -r 5abb9dbc58d1 linux/drivers/media/radio/dsbr100.c
--- a/linux/drivers/media/radio/dsbr100.c   Tue May 19 15:05:21 2009 +0400
+++ b/linux/drivers/media/radio/dsbr100.c   Tue May 19 15:18:49 2009 +0400
@@ -127,8 +127,6 @@
 static int usb_dsbr100_probe(struct usb_interface *intf,
 const struct usb_device_id *id);
 static void usb_dsbr100_disconnect(struct usb_interface *intf);
-static int usb_dsbr100_open(struct file *file);
-static int usb_dsbr100_close(struct file *file);
 static int usb_dsbr100_suspend(struct usb_interface *intf,
pm_message_t message);
 static int usb_dsbr100_resume(struct usb_interface *intf);
@@ -545,50 +543,6 @@
return 0;
 }
 
-static int usb_dsbr100_open(struct file *file)
-{
-   struct dsbr100_device *radio = video_drvdata(file);
-   int retval;
-
-   lock_kernel();
-   radio->muted = 1;
-
-   retval = dsbr100_start(radio);
-   if (retval < 0) {
-   dev_warn(&radio->usbdev->dev,
-"Radio did not start up properly\n");
-   unlock_kernel();
-   return -EIO;
-   }
-
-   retval = dsbr100_setfreq(radio, radio->curfreq);
-   if (retval < 0)
-   dev_warn(&radio->usbdev->dev,
-   "set frequency failed\n");
-
-   unlock_kernel();
-   return 0;
-}
-
-static int usb_dsbr100_close(struct file *file)
-{
-   struct dsbr100_device *radio = video_drvdata(file);
-   int retval;
-
-   if (!radio)
-   return -ENODEV;
-
-   if (!radio->removed) {
-   retval = dsbr100_stop(radio);
-   if (retval < 0) {
-   dev_warn(&radio->usbdev->dev,
-   "dsbr100_stop failed\n");
-   }
-
-   }
-   return 0;
-}
-
 /* Suspend device - stop device. */
 static int usb_dsbr100_suspend(struct usb_interface *intf, pm_message_t 
message)
 {
@@ -632,8 +586,6 @@
 /* File system interface */
 static const struct v4l2_file_operations usb_dsbr100_fops = {
.owner  = THIS_MODULE,
-   .open   = usb_dsbr100_open,
-   .release= usb_dsbr100_close,
.ioctl  = video_ioctl2,
 };
 


-- 
Best regards, Klimov Alexey

--
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 review 1/4] dsbr100: remove radio->users counter

2009-05-28 Thread Alexey Klimov
Patch removes radio->users counter because it is not in use.

Signed-off-by: Alexey Klimov 

--
diff -r 315bc4b65b4f linux/drivers/media/radio/dsbr100.c
--- a/linux/drivers/media/radio/dsbr100.c   Sun May 17 12:28:55 2009 +
+++ b/linux/drivers/media/radio/dsbr100.c   Tue May 19 15:05:02 2009 +0400
@@ -146,7 +146,6 @@
struct mutex lock;  /* buffer locking */
int curfreq;
int stereo;
-   int users;
int removed;
int muted;
 };
@@ -552,14 +551,12 @@
int retval;
 
lock_kernel();
-   radio->users = 1;
radio->muted = 1;
 
retval = dsbr100_start(radio);
if (retval < 0) {
dev_warn(&radio->usbdev->dev,
 "Radio did not start up properly\n");
-   radio->users = 0;
unlock_kernel();
return -EIO;
}
@@ -581,10 +578,6 @@
if (!radio)
return -ENODEV;
 
-   mutex_lock(&radio->lock);
-   radio->users = 0;
-   mutex_unlock(&radio->lock);
-
if (!radio->removed) {
retval = dsbr100_stop(radio);
if (retval < 0) {
@@ -698,7 +691,6 @@
mutex_init(&radio->lock);
 
radio->removed = 0;
-   radio->users = 0;
radio->usbdev = interface_to_usbdev(intf);
radio->curfreq = FREQ_MIN * FREQ_MUL;
 


-- 
Best regards, Klimov Alexey

--
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 0/4] Patches for dsbr100 radio

2009-05-28 Thread Alexey Klimov
There was discussion on maillist about lock/unlock_kernel, about
open/close functions and about radio->users counter. So, there are
patches arised from that discussion.

There is suspend/resume procedure fix in patch 4/4.

Here is description of patches:

[1/4] dsbr100: remove radio->users counter
Patch removes radio->users counter because it is not in use.

[2/4] dsbr100: remove usb_dsbr100_open/close calls
Patch removes usb_dsbr100_open and usb_dsbr100_close calls.
1. No need to start, set frequency, adjust parameters in open call.
2. This patch tackles issue with lock/unlock_kernel() in open call.
3. With this patch feature "Mute on exit?" in gnomeradio works.

[3/4] dsbr100: no need to pass curfreq value to dsbr100_setfreq()
Small cleanup of dsbr100_setfreq(). No need to pass radio->curfreq value
to this function.

[4/4] dsbr100: change radio->muted to radio->status, update
suspend/resume
Patch renames radio->muted to radio->status, add defines for that
variable, and fixes suspend/resume procedure. Radio->status set to
STOPPED in usb_dsbr100_probe because of removing open call.
Also, patch increases driver version.

Tested on i686 and x86_64 machines with gnomeradio, mplayer and kradio
under 2.6.30-rc7 kernel.

-- 
Best regards, Klimov Alexey

--
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


Probably strange bug with usb radio-mr800

2009-05-27 Thread Alexey Klimov
Hello,

Doing some improvements in media/radio/radio-mr800.c i see very
strange situation.
I made simple patch that removed usb_amradio_open function. There is
no need in this function (no need to start/set frequency radio in open
procedure, and also removed lock/unlock_kernel() calls).
Here is this patch:

diff -r a344b328a34b linux/drivers/media/radio/radio-mr800.c
--- a/linux/drivers/media/radio/radio-mr800.c   Wed May 27 21:21:36 2009 +0400
+++ b/linux/drivers/media/radio/radio-mr800.c   Wed May 27 21:25:41 2009 +0400
@@ -119,7 +119,6 @@
 static int usb_amradio_probe(struct usb_interface *intf,
 const struct usb_device_id *id);
 static void usb_amradio_disconnect(struct usb_interface *intf);
-static int usb_amradio_open(struct file *file);
 static int usb_amradio_close(struct file *file);
 static int usb_amradio_suspend(struct usb_interface *intf,
pm_message_t message);
@@ -533,40 +532,6 @@
return 0;
 }

-/* open device - amradio_start() and amradio_setfreq() */
-static int usb_amradio_open(struct file *file)
-{
-   struct amradio_device *radio = video_get_drvdata(video_devdata(file));
-   int retval;
-
-   lock_kernel();
-
-   radio->users = 1;
-   radio->muted = 1;
-
-   retval = amradio_set_mute(radio, AMRADIO_START);
-   if (retval < 0) {
-   amradio_dev_warn(&radio->videodev->dev,
-   "radio did not start up properly\n");
-   radio->users = 0;
-   unlock_kernel();
-   return -EIO;
-   }
-
-   retval = amradio_set_stereo(radio, WANT_STEREO);
-   if (retval < 0)
-   amradio_dev_warn(&radio->videodev->dev,
-   "set stereo failed\n");
-
-   retval = amradio_setfreq(radio, radio->curfreq);
-   if (retval < 0)
-   amradio_dev_warn(&radio->videodev->dev,
-   "set frequency failed\n");
-
-   unlock_kernel();
-   return 0;
-}
-
 /*close device */
 static int usb_amradio_close(struct file *file)
 {
@@ -623,7 +588,6 @@
 /* File system interface */
 static const struct v4l2_file_operations usb_amradio_fops = {
.owner  = THIS_MODULE,
-   .open   = usb_amradio_open,
.release= usb_amradio_close,
.ioctl  = video_ioctl2,
 };

Then i test it. I have two machines: pentium-m and athlon 64 X2 dual
core. Kernel is 2.6.30-rc7 on both machines.
After patch such tools like fmtools, gnomeradio, kradio works fine
with radio. But mplayer didn't.

On 64bit machine mplayer didn't start radio. I ask usbmon to help me
and here is messages from usbmon:

cat /sys/kernel/debug/usbmon/2u
880022e380c0 1662784522 S Io:2:003:2 -115:64 8 = 0055aa00 ab01
(this message stops radio)
880022e380c0 1662799160 C Io:2:003:2 0:64 8 >
880022e380c0 1662799273 S Io:2:003:2 -115:64 8 = 0055aa00 ae00
(this ask radio to have stereo signal)
880022e380c0 1662831161 C Io:2:003:2 0:64 8 >
880022e380c0 1662831439 S Io:2:003:2 -115:64 8 = 0055aa03 a408
(this and next message set frequency)
880022e380c0 1662863161 C Io:2:003:2 0:64 8 >
880022e380c0 1662863233 S Io:2:003:2 -115:64 8 = 1dd00100 
880022e380c0 1662895155 C Io:2:003:2 0:64 8 >
880022e380c0 1662895190 S Io:2:003:2 -115:64 8 = 0055aa00 ab00
(this message starts radio)
880022e380c0 1662927156 C Io:2:003:2 0:64 8 >

Well, there is no sound from usb device after that.

On 32bit machine mplayer starts radio fine and works ok. Usbmon shows
me the same messages:

tux ~ # cat /sys/kernel/debug/usbmon/0u
f6530900 2647820070 S Io:2:002:2 -115:64 8 = 0055aa00 ab01
f6530900 2647859740 C Io:2:002:2 0:64 8 >
f6530900 2647859825 S Io:2:002:2 -115:64 8 = 0055aa00 ae00
f6530900 2647923747 C Io:2:002:2 0:64 8 >
f6530900 2647923942 S Io:2:002:2 -115:64 8 = 0055aa03 a408
f6530900 2647987749 C Io:2:002:2 0:64 8 >
f6530900 2647987766 S Io:2:002:2 -115:64 8 = 1dcf0100 
f6530900 2648051747 C Io:2:002:2 0:64 8 >
f6530900 2648051775 S Io:2:002:2 -115:64 8 = 0055aa00 ab00
f6530900 2648115753 C Io:2:002:2 0:64 8 >

So, the same messages to device works fine with radio on 32bit machine
and nothing on 64bit machine.
Good thing is if i add one more start message radio works on 64bit machine also.

Is this usb subsystem bug?
Should i make some workaround to deal with this and add comments about mplayer?

-- 
Best regards, Klimov Alexey
--
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: v4l-dvb and old kernels

2009-05-26 Thread Alexey Klimov
Hello, Antonio

On Tue, May 26, 2009 at 5:03 PM, Antonio Beamud Montero
 wrote:
> It would compile today's snapshot of v4l-dvb with an old kernel version (for
> example 2.6.16)? (or is better to upgrade the kernel?)

Not long time ago v4l-dvb community had discussions about dropping
support for kernels older than 2.6.22. And community decided to
support kernels 2.6.22 - 2.6.30+. One of the reason that it's big work
to support code to make it compiles and works in old kernels. Well,
developers want to spend more time working on new code.

So, the best way to you is to upgrade your kernel.

Second way to correct mistakes. Probably developers can help you here.

One more way, probably you can take old snapshot of v4l-dvb repository
that compiles and work on 2.6.16 if you need. Someone can point to
link to it (i don' know).

> Trying to compile today's mercurial snapshot in a SuSE 10.1 (2.6.16-21),
> give the next errors:
>
> /root/v4l-dvb/v4l/bttv-i2c.c: In function 'init_bttv_i2c':
> /root/v4l-dvb/v4l/bttv-i2c.c:411: error: storage size of 'info' isn't known
> /root/v4l-dvb/v4l/bttv-i2c.c:425: error: invalid application of 'sizeof' to
> incomplete type 'struct i2c_board_info'
> /root/v4l-dvb/v4l/bttv-i2c.c:425: error: invalid application of 'sizeof' to
> incomplete type 'struct i2c_board_info'
> /root/v4l-dvb/v4l/bttv-i2c.c:425: error: invalid application of 'sizeof' to
> incomplete type 'struct i2c_board_info'
> /root/v4l-dvb/v4l/bttv-i2c.c:425: error: invalid application of 'sizeof' to
> incomplete type 'struct i2c_board_info'
> /root/v4l-dvb/v4l/bttv-i2c.c:425: error: invalid application of 'sizeof' to
> incomplete type 'struct i2c_board_info'
> /root/v4l-dvb/v4l/bttv-i2c.c:425: error: invalid application of 'sizeof' to
> incomplete type 'struct i2c_board_info'
> /root/v4l-dvb/v4l/bttv-i2c.c:427: error: implicit declaration of function
> 'i2c_new_probed_device'
> /root/v4l-dvb/v4l/bttv-i2c.c:411: warning: unused variable 'info'
> make[5]: *** [/root/v4l-dvb/v4l/bttv-i2c.o] Error 1

Well, this mistakes appear in v4l-dvb daily build too.

-- 
Best regards, Klimov Alexey
--
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 1/4] radio-mr800.c: missing mutex include

2009-05-13 Thread Alexey Klimov
Hello,

On Wed, May 13, 2009 at 12:39 AM,   wrote:
> From: Alessio Igor Bogani 
>
> radio-mr800.c uses struct mutex, so while  seems to be
> pulled in indirectly by one of the headers it already includes, the right
> thing is to include it directly.
>
> Signed-off-by: Alessio Igor Bogani 
> Cc: Mauro Carvalho Chehab 
> Signed-off-by: Andrew Morton 
> ---
>
>  drivers/media/radio/radio-mr800.c |    1 +
>  1 file changed, 1 insertion(+)
>
> diff -puN 
> drivers/media/radio/radio-mr800.c~radio-mr800c-missing-mutex-include 
> drivers/media/radio/radio-mr800.c
> --- a/drivers/media/radio/radio-mr800.c~radio-mr800c-missing-mutex-include
> +++ a/drivers/media/radio/radio-mr800.c
> @@ -64,6 +64,7 @@
>  #include 
>  #include 
>  #include      /* for KERNEL_VERSION MACRO */
> +#include 
>
>  /* driver and module definitions */
>  #define DRIVER_AUTHOR "Alexey Klimov "
> _

There was discussion about this patch.
http://www.mail-archive.com/linux-media@vger.kernel.org/msg03556.html

Well, i'm not against this patch.

-- 
Best regards, Klimov Alexey
--
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: [cron job] v4l-dvb daily build 2.6.22 and up: ERRORS, 2.6.16-2.6.21: ERRORS

2009-05-04 Thread Alexey Klimov
Hello, Hans

On Mon, May 4, 2009 at 10:04 PM, Hans Verkuil  wrote:
> This message is generated daily by a cron job that builds v4l-dvb for
> the kernels and architectures in the list below.
>
> Results of the daily build of v4l-dvb:
>
> date:        Mon May  4 19:00:02 CEST 2009
> path:        http://www.linuxtv.org/hg/v4l-dvb
> changeset:   11658:83712d149893
> gcc version: gcc (GCC) 4.3.1

Sorry for bothering, but in the letter called "Daily build: updated
with new gcc and binutils" you said that you updated gcc version to
4.4.0. So, is there any mistake? Looks like 4.3.1 here.

-- 
Best regards, Klimov Alexey
--
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: [questions] dmesg: Non-NULL drvdata on register

2009-05-04 Thread Alexey Klimov
On Mon, May 4, 2009 at 5:03 PM, Hans Verkuil  wrote:
>
>> Hello,
>>
>> Not so many time ago i noticed such line in dmesg:
>>
>> radio-mr800 2-1:1.0: Non-NULL drvdata on register
>>
>> Quick review showed that it appears in usb_amradio_probe fucntions. Then
>> i found such code in v4l2_device_register() function (v4l2-device.c
>> file):
>>
>> /* Set name to driver name + device name if it is empty. */
>>         if (!v4l2_dev->name[0])
>>                 snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "%s %
>> s",
>>                         dev->driver->name, dev_name(dev));
>>         if (dev_get_drvdata(dev))
>>                 v4l2_warn(v4l2_dev, "Non-NULL drvdata on register\n");
>>         dev_set_drvdata(dev, v4l2_dev);
>>         return 0;
>>
>> The questions is - should i deal with this warning in dmesg? Probably
>> the order of callbacks in radio-mr800 probe function is incorrect.
>
> I (or you :-) should look into this: I think the usb subsystem is calling
> dev_set_drvdata as well, so we could have a clash here.

I can if i'll find free time for this :)

>> The second questions - should i make atomic_t users counter instead of
>> int users counter? Then i can use atomic_inc(), atomic_dec(),
>> atomic_set(). It helps me to remove lock/unlock_kernel() functions.
>
> 'users' can go away completely: if you grep for it, then you'll see that
> it is only set, but never used.
>
> I think I've commented on the kernel lock before: I think it is bogus
> here. And that the amradio_set_mute handling is wrong as well: you open
> the radio device twice, then close one file descriptor, and suddenly the
> audio will be muted, even though there still is a file descriptor open.
>
> Regards,
>
>        Hans

Well, looks like it's possible to null usb_amradio_open, right?
The only reason why users counter here is suspend/resume handling.
The idea was to stop radio in suspend procedure if there users>0 and
start radio on resume if users>0. If there are no users we can do
nothing on suspend/resume. The decision was based on radio->users
counter, and i see that i can do this using radio->muted.
This idea was not implemented yet. May i ask your comments here, Hans?

-- 
Best regards, Klimov Alexey
--
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


[questions] dmesg: Non-NULL drvdata on register

2009-05-04 Thread Alexey Klimov
Hello, 

Not so many time ago i noticed such line in dmesg:

radio-mr800 2-1:1.0: Non-NULL drvdata on register

Quick review showed that it appears in usb_amradio_probe fucntions. Then
i found such code in v4l2_device_register() function (v4l2-device.c
file):

/* Set name to driver name + device name if it is empty. */
if (!v4l2_dev->name[0])
snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "%s %
s",
dev->driver->name, dev_name(dev));
if (dev_get_drvdata(dev))
v4l2_warn(v4l2_dev, "Non-NULL drvdata on register\n");
dev_set_drvdata(dev, v4l2_dev);
return 0;

The questions is - should i deal with this warning in dmesg? Probably
the order of callbacks in radio-mr800 probe function is incorrect.

The second questions - should i make atomic_t users counter instead of
int users counter? Then i can use atomic_inc(), atomic_dec(),
atomic_set(). It helps me to remove lock/unlock_kernel() functions. 

-- 
Best regards, Klimov Alexey

--
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] zoran: Fix &&/|| typo

2009-05-02 Thread Alexey Klimov
Hello, Roel

On Sun, May 3, 2009 at 12:52 AM, Roel Kluin  wrote:
> Fix &&/|| typo
>
> diff --git a/drivers/media/video/zoran/zoran_card.c 
> b/drivers/media/video/zoran/zoran_card.c
> index ea6c577..ea9de8b 100644
> --- a/drivers/media/video/zoran/zoran_card.c
> +++ b/drivers/media/video/zoran/zoran_card.c
> @@ -1022,7 +1022,7 @@ zr36057_init (struct zoran *zr)
>        zr->vbuf_bytesperline = 0;
>
>        /* Avoid nonsense settings from user for default input/norm */
> -       if (default_norm < 0 && default_norm > 2)
> +       if (default_norm < 0 || default_norm > 2)
>                default_norm = 0;
>        if (default_norm == 0) {
>                zr->norm = V4L2_STD_PAL;

Please, remember that all patches that you send need 'Signed-off-by' field.
And i'm out of touch with events, but probably it's better to make
description more dilated/patulous (i'm not sure here).

-- 
Best regards, Klimov Alexey
--
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 2/5] V4L2 patches for Intel Moorestown Camera Imaging Drivers

2009-05-01 Thread Alexey Klimov
Hello, Xiaolin

On Fri, May 1, 2009 at 6:57 PM, Zhang, Xiaolin  wrote:
> No mind, welcome any comments.

Oops, i already did. Probably comments are lost in big letter, please
find them :)

> I am working on this issue why the first patch -isp drive can't send it out. 
> Actually it is a little bit large, size about 800k. I need time to split it.

Well, you can send link to it if possible, but yes - spliting it is better.

> BRs
> Xiaolin

-- 
Best regards, Klimov Alexey
--
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: [cron job] v4l-dvb daily build 2.6.22 and up: ERRORS, 2.6.16-2.6.21: ERRORS

2009-04-30 Thread Alexey Klimov
Hello,

On Mon, Apr 20, 2009 at 3:59 AM, Mike Isely  wrote:
> On Mon, 20 Apr 2009, Alexey Klimov wrote:
>
>   [...]
>
>> When trying to compile v4l-dvb tree under 2.6.30-rc2 (up-to-date) i
>> have such error with pvr2 module:
>>
>>   CC [M]  /w/new/v4l-dvb/v4l/pvrusb2-hdw.o
>> /w/new/v4l-dvb/v4l/pvrusb2-hdw.c: In function 'pvr2_upload_firmware1':
>> /w/new/v4l-dvb/v4l/pvrusb2-hdw.c:1474: error: implicit declaration of
>> function 'usb_settoggle'
>> /w/new/v4l-dvb/v4l/pvrusb2-hdw.c: In function 'pvr2_hdw_load_modules':
>> /w/new/v4l-dvb/v4l/pvrusb2-hdw.c:2133: warning: format not a string
>> literal and no format arguments
>> make[3]: *** [/w/new/v4l-dvb/v4l/pvrusb2-hdw.o] Error 1
>> make[2]: *** [_module_/w/new/v4l-dvb/v4l] Error 2
>>
>> It's probably due to this git commit:
>> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3444b26afa145148951112534f298bdc554ec789
>>
>> I don't have idea how to fix it fast and correctly.
>
> This might explain things a bit.  The following thread took place on
> linux-usb on 7-April:

Well, looks like it explains everything.

> 
>
> On Tue, 7 Apr 2009, Greg KH wrote:
>
>> On Tue, Apr 07, 2009 at 05:31:55PM +, David Vrabel wrote:
>> > Wireless USB endpoint state has a sequence number and a current
>> > window and not just a single toggle bit.  So allow HCDs to provide a
>> > endpoint_reset method and call this or clear the software toggles as
>> > required (after a clear halt).
>> >
>> > usb_settoggle() and friends are then HCD internal and are moved into
>> > core/hcd.h.
>>
>> You remove this api, yet the pvrusb2 driver used it, and you don't seem
>> to have resolved the issue where it was calling it:
>>
>> > diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c 
>> > b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
>> > index fa304e5..b86682d 100644
>> > --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
>> > +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
>> > @@ -1418,7 +1418,6 @@ static int pvr2_upload_firmware1(struct pvr2_hdw 
>> > *hdw)
>> >             return ret;
>> >     }
>> >
>> > -   usb_settoggle(hdw->usb_dev, 0 & 0xf, !(0 & USB_DIR_IN), 0);
>> >     usb_clear_halt(hdw->usb_dev, usb_sndbulkpipe(hdw->usb_dev, 0 & 0x7f));
>> >
>> >     pipe = usb_sndctrlpipe(hdw->usb_dev, 0);
>>
>> Should usb_reset_endpoint() be called here instead?
>>
>
> Speaking as the maintainer of that driver, I'm OK with accepting this
> as-is for now.  This is a sequence that should not interfere with normal
> driver operation.  I will look at this further a little later (not
> likely before the merge window closes) and if this change turns out to
> cause a problem I'll make a follow-up fix upstream.
>
> Acked-By: Mike Isely 
>
>  -Mike
>
> 
>
> So the kernel already has this; it just needs to be pulled back into
> v4l-dvb.  It's an obvious trivial thing for now and I've acked it there.
> Obviously we're getting had here because you're compiling against a
> kernel snapshot that's been changed but v4l-dvb doesn't have the
> corresponding change in its local copy of the pvrusb2 driver.  Part of
> the fun of synchronizing changes from different trees :-(

Well, good to know that this thing is already fixed.
I'm very sorry for the mess.

-- 
Best regards, Klimov Alexey
--
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] radio_si470x: Drop unused label

2009-04-30 Thread Alexey Klimov
(added Tobias and Mauro on c/c)

On Thu, Apr 30, 2009 at 6:16 PM, Nicola Soranzo  wrote:
> Fix this warning:
>
> /home/nicola/v4l-dvb/v4l/radio-si470x.c: In function 'si470x_fops_release':
> /home/nicola/v4l-dvb/v4l/radio-si470x.c:1218: warning: label 'unlock' defined 
> but not used
>
> Priority: normal
>
> Signed-off-by: Nicola Soranzo 
>
> ---
> diff -r 83712d149893 -r 97be9e920832 linux/drivers/media/radio/radio-si470x.c
> --- a/linux/drivers/media/radio/radio-si470x.c  Wed Apr 29 18:01:48 2009 -0300
> +++ b/linux/drivers/media/radio/radio-si470x.c  Thu Apr 30 16:10:24 2009 +0200
> @@ -1214,8 +1214,6 @@
>                retval = si470x_stop(radio);
>                usb_autopm_put_interface(radio->intf);
>        }
> -
> -unlock:
>        mutex_unlock(&radio->disconnect_lock);
>
>  done:

Looks good. Thank you.
When i built latest up-to-date git kernel i noticed that this warning
showed there also.
Probably, it's better this patch reach 2.6.30 kernel. Now we are at rc4.

-- 
Best regards, Klimov Alexey
--
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 2/5] V4L2 patches for Intel Moorestown Camera Imaging Drivers

2009-04-30 Thread Alexey Klimov
Hello,
do you mind if i make few comments?

Really, looks like
http://patchwork.kernel.org/project/linux-media/list/
didnt catch your [1/5] patch.

On Thu, Apr 30, 2009 at 12:22 PM, Zhang, Xiaolin
 wrote:
> From d8f37b4340ea4cfd28d6e620f1b3224d946b9fab Mon Sep 17 00:00:00 2001
> From: Xiaolin Zhang 
> Date: Thu, 30 Apr 2009 12:31:21 +0800
> Subject: [PATCH] sensor pseduo driver in camera imaging on Intel moorestown 
> platform.
>  The moorestown platform with dual cameras will have one the same side as
>  the display and the second on the oppsoite side of the display. The pseduo
>  driver provides the uniform interface for isp kernel driver.
>  Signed-off-by: Xiaolin Zhang 
>
> ---
>  drivers/media/video/Makefile                       |    1 +
>  drivers/media/video/mrstci/Kconfig                 |    1 +
>  drivers/media/video/mrstci/include/ci_sensor_ioc.h |   57 +
>  drivers/media/video/mrstci/include/sensordev.h     |  119 +++
>  drivers/media/video/mrstci/mrstsensor/Kconfig      |    9 +
>  drivers/media/video/mrstci/mrstsensor/Makefile     |    3 +
>  drivers/media/video/mrstci/mrstsensor/mrstsensor.c | 1094 
> 
>  .../media/video/mrstci/mrstsensor/sensordev_priv.h |   37 +
>  8 files changed, 1321 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/media/video/mrstci/include/ci_sensor_ioc.h
>  create mode 100644 drivers/media/video/mrstci/include/sensordev.h
>  create mode 100644 drivers/media/video/mrstci/mrstsensor/Kconfig
>  create mode 100644 drivers/media/video/mrstci/mrstsensor/Makefile
>  create mode 100644 drivers/media/video/mrstci/mrstsensor/mrstsensor.c
>  create mode 100644 drivers/media/video/mrstci/mrstsensor/sensordev_priv.h
>
> diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
> index f06f1cb..34a3461 100644
> --- a/drivers/media/video/Makefile
> +++ b/drivers/media/video/Makefile
> @@ -152,6 +152,7 @@ obj-$(CONFIG_VIDEO_AU0828) += au0828/
>
>  obj-$(CONFIG_USB_VIDEO_CLASS)  += uvc/
>  obj-$(CONFIG_VIDEO_MRST_ISP) += mrstci/mrstisp/
> +obj-$(CONFIG_VIDEO_MRST_SENSOR) += mrstci/mrstsensor/
>
>  EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
>  EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
> diff --git a/drivers/media/video/mrstci/Kconfig 
> b/drivers/media/video/mrstci/Kconfig
> index 8f0a620..bf01447 100644
> --- a/drivers/media/video/mrstci/Kconfig
> +++ b/drivers/media/video/mrstci/Kconfig
> @@ -10,6 +10,7 @@ if VIDEO_MRSTCI && VIDEO_V4L2
>
>  source "drivers/media/video/mrstci/mrstisp/Kconfig"
>
> +source "drivers/media/video/mrstci/mrstsensor/Kconfig"
>
>  endif # VIDEO_MRSTCI
>
> diff --git a/drivers/media/video/mrstci/include/ci_sensor_ioc.h 
> b/drivers/media/video/mrstci/include/ci_sensor_ioc.h
> new file mode 100644
> index 000..80d3b0f
> --- /dev/null
> +++ b/drivers/media/video/mrstci/include/ci_sensor_ioc.h
> @@ -0,0 +1,57 @@
> +/*
> + * Support for Moorestown Langwell Camera Imaging ISP subsystem.
> + *
> + * Copyright (c) 2009 Intel Corporation. All Rights Reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version
> + * 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> + * 02110-1301, USA.
> + *
> + *
> + * Xiaolin Zhang 
> + */
> +
> +/* Sensor IOCTL */
> +#ifndef _SENSOR_IOC_H
> +#define        _SENSOR_IOC_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif

Looks interesting. Why is this workaround for C++ here?

> +
> +#define SENSOR_MAGIC 0x83
> +
> +#define SENIOC_QUERYCAP _IOR(SENSOR_MAGIC, 0, struct ci_sensor_caps)
> +#define SENIOC_G_CONFIG _IOR(SENSOR_MAGIC, 1, struct ci_sensor_config)
> +#define SENIOC_S_CONFIG _IOW(SENSOR_MAGIC, 2, struct ci_sensor_config)
> +#define SENIOC_STREAM_ON _IO(SENSOR_MAGIC, 3)
> +#define SENIOC_STREAM_OFF _IO(SENSOR_MAGIC, 4)
> +#define SENIOC_G_REG _IOWR(SENSOR_MAGIC, 5, struct ci_sensor_reg)
> +#define SENIOC_S_REG _IOW(SENSOR_MAGIC, 6, struct ci_sensor_reg)
> +/* Get current focus position */
> +#define SENIOC_MDI_G_FOCUS _IOR(SENSOR_MAGIC, 9, unsigned int)
> +/* Set focus to the given position */
> +#define SENIOC_MDI_S_FOCUS _IOW(SENSOR_MAGIC, 10, unsigned int)
> +/* Trigger a forced calibration of focus hardware */
> +#define SENIOC_MDI_CALIBRATE _IO(SENSOR_MAGIC, 11)
> +#define SENIOC_MDI_MAX_STEP _IOR(SENSOR_MAGIC, 12, unsigned int)
> +/* Get the max step hardware can support */
> +#define SENIOC_ENUMPARM _IOWR(SENSOR_MAGIC, 13, struct ci_sensor_parm)
> +#define SENIOC_G_PARM _IOWR(SENSOR_MAGIC, 14, struc

Re: [cron job] v4l-dvb daily build 2.6.22 and up: ERRORS, 2.6.16-2.6.21: ERRORS

2009-04-19 Thread Alexey Klimov
On Sun, Apr 19, 2009 at 10:18 PM, Hans Verkuil  wrote:
> This message is generated daily by a cron job that builds v4l-dvb for
> the kernels and architectures in the list below.
>
> Results of the daily build of v4l-dvb:
>
> date:        Sun Apr 19 19:00:03 CEST 2009
> path:        http://www.linuxtv.org/hg/v4l-dvb
> changeset:   11517:cda79523a93c
> gcc version: gcc (GCC) 4.3.1
> hardware:    x86_64
> host os:     2.6.26
>
> linux-2.6.22.19-armv5: OK
> linux-2.6.23.12-armv5: OK
> linux-2.6.24.7-armv5: OK
> linux-2.6.25.11-armv5: OK
> linux-2.6.26-armv5: OK
> linux-2.6.27-armv5: OK
> linux-2.6.28-armv5: OK
> linux-2.6.29.1-armv5: OK
> linux-2.6.30-rc1-armv5: OK
> linux-2.6.27-armv5-ixp: OK
> linux-2.6.28-armv5-ixp: OK
> linux-2.6.29.1-armv5-ixp: OK
> linux-2.6.30-rc1-armv5-ixp: WARNINGS
> linux-2.6.28-armv5-omap2: OK
> linux-2.6.29.1-armv5-omap2: OK
> linux-2.6.30-rc1-armv5-omap2: WARNINGS
> linux-2.6.22.19-i686: WARNINGS
> linux-2.6.23.12-i686: ERRORS
> linux-2.6.24.7-i686: OK
> linux-2.6.25.11-i686: OK
> linux-2.6.26-i686: OK
> linux-2.6.27-i686: OK
> linux-2.6.28-i686: OK
> linux-2.6.29.1-i686: OK
> linux-2.6.30-rc1-i686: WARNINGS

When trying to compile v4l-dvb tree under 2.6.30-rc2 (up-to-date) i
have such error with pvr2 module:

  CC [M]  /w/new/v4l-dvb/v4l/pvrusb2-hdw.o
/w/new/v4l-dvb/v4l/pvrusb2-hdw.c: In function 'pvr2_upload_firmware1':
/w/new/v4l-dvb/v4l/pvrusb2-hdw.c:1474: error: implicit declaration of
function 'usb_settoggle'
/w/new/v4l-dvb/v4l/pvrusb2-hdw.c: In function 'pvr2_hdw_load_modules':
/w/new/v4l-dvb/v4l/pvrusb2-hdw.c:2133: warning: format not a string
literal and no format arguments
make[3]: *** [/w/new/v4l-dvb/v4l/pvrusb2-hdw.o] Error 1
make[2]: *** [_module_/w/new/v4l-dvb/v4l] Error 2

It's probably due to this git commit:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3444b26afa145148951112534f298bdc554ec789

I don't have idea how to fix it fast and correctly.

-- 
Best regards, Klimov Alexey
--
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 review] av7110_hw: fix compile warning

2009-04-19 Thread Alexey Klimov
One more warning fix.

Signed-off-by: Alexey Klimov 
--
diff -r cda79523a93c linux/drivers/media/dvb/ttpci/av7110_hw.c
--- a/linux/drivers/media/dvb/ttpci/av7110_hw.c Thu Apr 16 18:30:38 2009 +0200
+++ b/linux/drivers/media/dvb/ttpci/av7110_hw.c Mon Apr 20 00:17:51 2009 +0400
@@ -1089,7 +1089,7 @@
else {
int i, len = dc->x0-dc->color+1;
u8 __user *colors = (u8 __user *)dc->data;
-   u8 r, g, b, blend;
+   u8 r, g = 0, b = 0, blend = 0;
ret = 0;
for (i = 0; ihttp://vger.kernel.org/majordomo-info.html


[patch review] uvc_driver: fix compile warning

2009-04-19 Thread Alexey Klimov
Hello, all
I saw warnings in v4l-dvb daily build.
May this patch be helpful?

Signed-off-by: Alexey Klimov 

--
diff -r cda79523a93c linux/drivers/media/video/uvc/uvc_driver.c
--- a/linux/drivers/media/video/uvc/uvc_driver.cThu Apr 16 18:30:38 
2009 +0200
+++ b/linux/drivers/media/video/uvc/uvc_driver.cSun Apr 19 23:58:02 
2009 +0400
@@ -1726,7 +1726,7 @@
 static int __uvc_resume(struct usb_interface *intf, int reset)
 {
struct uvc_device *dev = usb_get_intfdata(intf);
-   int ret;
+   int ret = 0;
 
uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n",
intf->cur_altsetting->desc.bInterfaceNumber);
 



-- 
Best regards, Klimov Alexey

--
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: About the radio-si470x driver for I2C interface

2009-04-12 Thread Alexey Klimov
Hello, Tobias

On Mon, Apr 13, 2009 at 12:56 AM, Tobias Lorenz  wrote:
> Hi Joonyoung,
>
> Hi Alexey,
>
> I've split the driver into a couple of segments:
>
> - radio-si470x-common.c is for common functions
>
> - radio-si470x-usb.c are the usb support functions
>
> - radio-si470x-i2c.c is an untested prototyped file for your i2c support
> functions
>
> - radio-si470x.h is a header file with everything required by the c-files
>
> I hope this is a basis we can start on with i2c support. What do you think?
>
> The URL is:
>
> http://linuxtv.org/hg/~tlorenz/v4l-dvb
>
> Bye,
>
> Toby

Great! It's always interesting to see big changes.
I understand i2c interface not so good and have only general questions.

Many (most?) drivers in v4l tree were converted to use new v4l2-
framework. For example, dsbr100 was converted to v4l2_device
http://linuxtv.org/hg/v4l-dvb/rev/77f37ad5dd0c and em28xx was
converted to v4l2_subdev
http://linuxtv.org/hg/v4l-dvb/rev/00525b115901
As i remember, Hans Verkuil said that all v4l drivers should be
converted to new framework. Is it time to switch to this new interface
? Probably, there are a lot of code examples in current tree that can
help..

And second question. About lock/unlock_kernel in open functions.
Please, take a look at
http://www.spinics.net/lists/linux-media/msg04057.html
Well, is it time to do something with this?

Well, my questions about improving functionality, not about mistakes or bugs :)

-- 
Best regards, Klimov Alexey
--
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] usb: add reset endpoint operations

2009-04-08 Thread Alexey Klimov
On Thu, Apr 9, 2009 at 3:40 AM, Greg KH  wrote:
> On Thu, Apr 09, 2009 at 03:36:51AM +0400, Alexey Klimov wrote:
>> (added linux-media maillist)
>>
>> Hello, David
>>
>> On Wed, Apr 8, 2009 at 9:36 PM, David Vrabel  wrote:
>> > Wireless USB endpoint state has a sequence number and a current
>> > window and not just a single toggle bit.  So allow HCDs to provide a
>> > endpoint_reset method and call this or clear the software toggles as
>> > required (after a clear halt, set configuration etc.).
>> >
>> > usb_settoggle() and friends are then HCD internal and are moved into
>> > core/hcd.h and all device drivers call usb_reset_endpoint() instead.
>> >
>> > If the device endpoint state has been reset (with a clear halt) but
>> > the host endpoint state has not then subsequent data transfers will
>> > not complete. The device will only work again after it is reset or
>> > disconnected.
>> >
>> > Signed-off-by: David Vrabel 
>> > ---
>> >  drivers/block/ub.c                        |   20 -
>> >  drivers/isdn/hisax/st5481_usb.c           |    9 +
>> >  drivers/media/video/pvrusb2/pvrusb2-hdw.c |    1 -
>>
>> Looks like you change file under /drivers/video. It's better at least
>> to add linux-media maillist  or driver maintainer (not only linux-usb
>> list) to let developers know that you change drivers.
>
> He's already gotten an Ack from this driver author on the last time this
> patch was sent out.  Don't know why he forgot to add it to this version
> of the patch, it should still be valid :)
>
> thanks,
>
> greg k-h

Oh, good to know :)
Sorry for the mess.
-- 
Best regards, Klimov Alexey
--
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] usb: add reset endpoint operations

2009-04-08 Thread Alexey Klimov
(added linux-media maillist)

Hello, David

On Wed, Apr 8, 2009 at 9:36 PM, David Vrabel  wrote:
> Wireless USB endpoint state has a sequence number and a current
> window and not just a single toggle bit.  So allow HCDs to provide a
> endpoint_reset method and call this or clear the software toggles as
> required (after a clear halt, set configuration etc.).
>
> usb_settoggle() and friends are then HCD internal and are moved into
> core/hcd.h and all device drivers call usb_reset_endpoint() instead.
>
> If the device endpoint state has been reset (with a clear halt) but
> the host endpoint state has not then subsequent data transfers will
> not complete. The device will only work again after it is reset or
> disconnected.
>
> Signed-off-by: David Vrabel 
> ---
>  drivers/block/ub.c                        |   20 -
>  drivers/isdn/hisax/st5481_usb.c           |    9 +
>  drivers/media/video/pvrusb2/pvrusb2-hdw.c |    1 -

Looks like you change file under /drivers/video. It's better at least
to add linux-media maillist  or driver maintainer (not only linux-usb
list) to let developers know that you change drivers.

Another approach here - you can create separate patch for this driver
and post it to linux-media list at vger.kernel.org and to linux-usb
list. It will be easy for v4l developers to handle things like merging
changes from upstream kernel tree to v4l-dvb mercurial tree (in case
if there are changes that went to v4l drivers not from v4l).

>  drivers/usb/core/devio.c                  |    2 +-
>  drivers/usb/core/hcd.c                    |   26 +
>  drivers/usb/core/hcd.h                    |   14 +++
>  drivers/usb/core/message.c                |   58 ++--
>  drivers/usb/core/usb.c                    |    2 +-
>  drivers/usb/storage/transport.c           |    4 +-
>  include/linux/usb.h                       |    9 +
>  10 files changed, 91 insertions(+), 54 deletions(-)
>
> diff --git a/drivers/block/ub.c b/drivers/block/ub.c
> index 69b7f8e..689cd27 100644
> --- a/drivers/block/ub.c
> +++ b/drivers/block/ub.c
> @@ -1025,6 +1025,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct 
> ub_scsi_cmd *cmd)
>  {
>        struct urb *urb = &sc->work_urb;
>        struct bulk_cs_wrap *bcs;
> +       int endp;
>        int len;
>        int rc;
>
> @@ -1033,6 +1034,10 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, 
> struct ub_scsi_cmd *cmd)
>                return;
>        }
>
> +       endp = usb_pipeendpoint(sc->last_pipe);
> +       if (usb_pipein(sc->last_pipe))
> +               endp |= USB_DIR_IN;
> +
>        if (cmd->state == UB_CMDST_CLEAR) {
>                if (urb->status == -EPIPE) {
>                        /*
> @@ -1048,9 +1053,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct 
> ub_scsi_cmd *cmd)
>                 * We ignore the result for the halt clear.
>                 */
>
> -               /* reset the endpoint toggle */
> -               usb_settoggle(sc->dev, usb_pipeendpoint(sc->last_pipe),
> -                       usb_pipeout(sc->last_pipe), 0);
> +               usb_reset_endpoint(sc->dev, endp);
>
>                ub_state_sense(sc, cmd);
>
> @@ -1065,9 +1068,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct 
> ub_scsi_cmd *cmd)
>                 * We ignore the result for the halt clear.
>                 */
>
> -               /* reset the endpoint toggle */
> -               usb_settoggle(sc->dev, usb_pipeendpoint(sc->last_pipe),
> -                       usb_pipeout(sc->last_pipe), 0);
> +               usb_reset_endpoint(sc->dev, endp);
>
>                ub_state_stat(sc, cmd);
>
> @@ -1082,9 +1083,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct 
> ub_scsi_cmd *cmd)
>                 * We ignore the result for the halt clear.
>                 */
>
> -               /* reset the endpoint toggle */
> -               usb_settoggle(sc->dev, usb_pipeendpoint(sc->last_pipe),
> -                       usb_pipeout(sc->last_pipe), 0);
> +               usb_reset_endpoint(sc->dev, endp);
>
>                ub_state_stat_counted(sc, cmd);
>
> @@ -2119,8 +2118,7 @@ static int ub_probe_clear_stall(struct ub_dev *sc, int 
> stalled_pipe)
>        del_timer_sync(&timer);
>        usb_kill_urb(&sc->work_urb);
>
> -       /* reset the endpoint toggle */
> -       usb_settoggle(sc->dev, endp, usb_pipeout(sc->last_pipe), 0);
> +       usb_reset_endpoint(sc->dev, endp);
>
>        return 0;
>  }
> diff --git a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c
> index ec3c0e5..2b3a055 100644
> --- a/drivers/isdn/hisax/st5481_usb.c
> +++ b/drivers/isdn/hisax/st5481_usb.c
> @@ -149,14 +149,7 @@ static void usb_ctrl_complete(struct urb *urb)
>        if (ctrl_msg->dr.bRequest == USB_REQ_CLEAR_FEATURE) {
>                /* Special case handling for pipe reset */
>                le16_to_cpus(&ctrl_msg->dr.wIndex);
> -
> -               /* toggle is reset on clear */
> -     

Re: [cron job] v4l-dvb daily build 2.6.22 and up: ERRORS, 2.6.16-2.6.21: WARNINGS

2009-04-08 Thread Alexey Klimov
On Thu, Apr 9, 2009 at 2:10 AM, Hans Verkuil  wrote:
>
> Can someone take a look at these warnings and errors? Looking at the log
> these seem to be pretty easy to fix (compat stuff for the most part).
>
> I don't have the time for this for several more days, so I'd appreciate it
> if someone could take a look at this for me.
>
> Thanks,
>
>        Hans

Well, i already posted about problems with compat.h and usb_endpoint_type.
The subject was "trouble with v4l-dvb compilation, compat.h:
redefinition of 'usb_endpoint_type". Here it is:
http://www.spinics.net/lists/linux-media/msg03965.html

I wish i know how to patch that thing right but i don't know that.
My cuurent workaroung for that is:

diff -r 77ebdc14cc24 v4l/compat.h
--- a/v4l/compat.h  Wed Apr 08 14:01:19 2009 -0300
+++ b/v4l/compat.h  Thu Apr 09 03:08:07 2009 +0400
@@ -392,11 +392,13 @@
 }
 #endif

+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
 #ifdef NEED_USB_ENDPOINT_TYPE
 static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
 {
return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
 }
+#endif
 #endif
 #endif /* __LINUX_USB_H */

but as i i understand it's bad. If someone can repair it correctly it
will be cool.

-- 
Best regards, Klimov Alexey
--
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: Topro 6800 webcam driver

2009-04-07 Thread Alexey Klimov
On Tue, 2009-04-07 at 15:13 +0400, Andrey Panin wrote:
> On 097, 04 07, 2009 at 11:41:32AM +0200, Anders Blomdell wrote:




> > +static const struct sd_desc sd_desc = {
> > +   .name = MODULE_NAME,
> > +   .ctrls = sd_ctrls,
> > +   .nctrls = ARRAY_SIZE(sd_ctrls),
> > +   .config = sd_config,
> > +   .init = sd_init,
> > +   .start = sd_start,
> > +   .stopN = sd_stopN,
> > +   .pkt_scan = sd_pkt_scan,
> > +   .querymenu = sd_querymenu,
> > +
> > +};
> > +
> > +static const __devinitdata struct usb_device_id device_table[] = {
> > +   {USB_DEVICE(0x06a2, 0x0003)},
> > +   {}  /* Terminating entry */
> > +};
> > +
> > +MODULE_DEVICE_TABLE(usb, device_table);
> > +
> > +static int sd_probe(struct usb_interface *interface,
> > +   const struct usb_device_id *id)
> > +{
> > +   return gspca_dev_probe(interface, id, &sd_desc, sizeof(struct sd),
> > +  THIS_MODULE);
> > +}
> > +
> > +static struct usb_driver tp6800_driver = {
> > +   .name = MODULE_NAME,
> > +   .id_table = device_table,
> > +   .probe = sd_probe,
> > +   .disconnect = gspca_disconnect,
> > +#ifdef CONFIG_PM
> > +   .suspend = gspca_suspend,
> > +   .resume = gspca_resume,
> > +#endif
> > +};
> > +
> > +/* Module loading and unloading */
> > +
> > +static int __init tp6800_init(void)
> > +{
> > +   int result;
> > +
> > +   result = usb_register(&tp6800_driver);
> > +   if (result) {
> > +   printk(KERN_INFO "%s usb_register_failed %d\n",
> > +  MODULE_NAME, result);
> > +   } else {
> > +   printk(KERN_INFO "%s registered\n", MODULE_NAME);
> > +   }
> > +
> > +   return result;
> > +}
> > +
> > +static void __exit tp6800_exit(void)
> > +{
> > +   usb_deregister(&tp6800_driver);
> > +   printk(KERN_INFO "%s deregistered\n", MODULE_NAME);
> > +}
> 
> Are these registered/deregistered messages really useful ?

Looks like that gspca-framework use PDEBUG() messages for that.
For example, t613.c contains this:

static void __exit sd_mod_exit(void)
{
usb_deregister(&sd_driver);
PDEBUG(D_PROBE, "deregistered");
}


-- 
Best regards, Klimov Alexey

--
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 1/2] dsbr100 radio: convert to to v4l2_device

2009-04-03 Thread Alexey Klimov
dsbr100: convert to v4l2_device.

Signed-off-by: Alexey Klimov 

--
diff -r f86c84534cb4 linux/drivers/media/radio/dsbr100.c
--- a/linux/drivers/media/radio/dsbr100.c   Sun Mar 29 22:54:35 2009 -0300
+++ b/linux/drivers/media/radio/dsbr100.c   Tue Mar 31 15:54:36 2009 +0400
@@ -32,6 +32,9 @@
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
  History:
+
+ Version 0.45:
+   Converted to v4l2_device.
 
  Version 0.44:
Add suspend/resume functions, fix unplug of device,
@@ -88,7 +91,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include "compat.h"
@@ -98,39 +101,8 @@
  */
 #include  /* for KERNEL_VERSION MACRO */
 
-#define DRIVER_VERSION "v0.44"
-#define RADIO_VERSION KERNEL_VERSION(0, 4, 4)
-
-static struct v4l2_queryctrl radio_qctrl[] = {
-   {
-   .id= V4L2_CID_AUDIO_MUTE,
-   .name  = "Mute",
-   .minimum   = 0,
-   .maximum   = 1,
-   .default_value = 1,
-   .type  = V4L2_CTRL_TYPE_BOOLEAN,
-   },
-/* HINT: the disabled controls are only here to satify kradio and such apps */
-   {   .id = V4L2_CID_AUDIO_VOLUME,
-   .flags  = V4L2_CTRL_FLAG_DISABLED,
-   },
-   {
-   .id = V4L2_CID_AUDIO_BALANCE,
-   .flags  = V4L2_CTRL_FLAG_DISABLED,
-   },
-   {
-   .id = V4L2_CID_AUDIO_BASS,
-   .flags  = V4L2_CTRL_FLAG_DISABLED,
-   },
-   {
-   .id = V4L2_CID_AUDIO_TREBLE,
-   .flags  = V4L2_CTRL_FLAG_DISABLED,
-   },
-   {
-   .id = V4L2_CID_AUDIO_LOUDNESS,
-   .flags  = V4L2_CTRL_FLAG_DISABLED,
-   },
-};
+#define DRIVER_VERSION "v0.45"
+#define RADIO_VERSION KERNEL_VERSION(0, 4, 5)
 
 #define DRIVER_AUTHOR "Markus Demleitner "
 #define DRIVER_DESC "D-Link DSB-R100 USB FM radio driver"
@@ -168,6 +140,8 @@
 struct dsbr100_device {
struct usb_device *usbdev;
struct video_device videodev;
+   struct v4l2_device v4l2_dev;
+
u8 *transfer_buffer;
struct mutex lock;  /* buffer locking */
int curfreq;
@@ -387,6 +361,7 @@
mutex_unlock(&radio->lock);
 
video_unregister_device(&radio->videodev);
+   v4l2_device_disconnect(&radio->v4l2_dev);
 }
 
 
@@ -482,14 +457,11 @@
 static int vidioc_queryctrl(struct file *file, void *priv,
struct v4l2_queryctrl *qc)
 {
-   int i;
+   switch (qc->id) {
+   case V4L2_CID_AUDIO_MUTE:
+   return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1);
+   }
 
-   for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) {
-   if (qc->id && qc->id == radio_qctrl[i].id) {
-   memcpy(qc, &(radio_qctrl[i]), sizeof(*qc));
-   return 0;
-   }
-   }
return -EINVAL;
 }
 
@@ -659,6 +631,7 @@
 {
struct dsbr100_device *radio = videodev_to_radio(videodev);
 
+   v4l2_device_unregister(&radio->v4l2_dev);
kfree(radio->transfer_buffer);
kfree(radio);
 }
@@ -686,22 +659,15 @@
.vidioc_s_input = vidioc_s_input,
 };
 
-/* V4L2 interface */
-static struct video_device dsbr100_videodev_data = {
-   .name   = "D-Link DSB-R 100",
-   .fops   = &usb_dsbr100_fops,
-   .ioctl_ops  = &usb_dsbr100_ioctl_ops,
-   .release= usb_dsbr100_video_device_release,
-};
-
 /* check if the device is present and register with v4l and usb if it is */
 static int usb_dsbr100_probe(struct usb_interface *intf,
const struct usb_device_id *id)
 {
struct dsbr100_device *radio;
+   struct v4l2_device *v4l2_dev;
int retval;
 
-   radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL);
+   radio = kzalloc(sizeof(struct dsbr100_device), GFP_KERNEL);
 
if (!radio)
return -ENOMEM;
@@ -713,17 +679,35 @@
return -ENOMEM;
}
 
+   v4l2_dev = &radio->v4l2_dev;
+
+   retval = v4l2_device_register(&intf->dev, v4l2_dev);
+   if (retval < 0) {
+   v4l2_err(v4l2_dev, "couldn't register v4l2_device\n");
+   kfree(radio->transfer_buffer);
+   kfree(radio);
+   return retval;
+   }
+
+   strlcpy(radio->videodev.name, v4l2_dev->name, 
sizeof(radio->videodev.name));
+   radio->videodev.v4l2_dev = v4l2_dev;
+   radio->videodev.fops = &usb_dsbr100_fops;
+   radio->videodev.ioctl_ops = &usb_dsbr100_ioctl_ops;
+   radio->videodev.release = usb_dsbr100_video_device_r

[patch 2/2] radio-mr800: convert to to v4l2_device

2009-04-03 Thread Alexey Klimov
radio-mr800: convert to to v4l2_device.

Signed-off-by: Alexey Klimov 
--
diff -r 4cd17f5a20cc linux/drivers/media/radio/radio-mr800.c
--- a/linux/drivers/media/radio/radio-mr800.c   Thu Apr 02 20:50:21 2009 -0300
+++ b/linux/drivers/media/radio/radio-mr800.c   Sat Apr 04 01:32:08 2009 +0400
@@ -43,6 +43,7 @@
  * Douglas Schilling Landgraf  and
  * David Ellingsworth 
  * for discussion, help and support.
+ * Version 0.11:   Converted to v4l2_device.
  *
  * Many things to do:
  * - Correct power managment of device (suspend & resume)
@@ -59,7 +60,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include  /* for KERNEL_VERSION MACRO */
@@ -68,8 +69,8 @@
 /* driver and module definitions */
 #define DRIVER_AUTHOR "Alexey Klimov "
 #define DRIVER_DESC "AverMedia MR 800 USB FM radio driver"
-#define DRIVER_VERSION "0.10"
-#define RADIO_VERSION KERNEL_VERSION(0, 1, 0)
+#define DRIVER_VERSION "0.11"
+#define RADIO_VERSION KERNEL_VERSION(0, 1, 1)
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
@@ -114,38 +115,6 @@
 module_param(radio_nr, int, 0);
 MODULE_PARM_DESC(radio_nr, "Radio Nr");
 
-static struct v4l2_queryctrl radio_qctrl[] = {
-   {
-   .id= V4L2_CID_AUDIO_MUTE,
-   .name  = "Mute",
-   .minimum   = 0,
-   .maximum   = 1,
-   .step  = 1,
-   .default_value = 1,
-   .type  = V4L2_CTRL_TYPE_BOOLEAN,
-   },
-/* HINT: the disabled controls are only here to satify kradio and such apps */
-   {   .id = V4L2_CID_AUDIO_VOLUME,
-   .flags  = V4L2_CTRL_FLAG_DISABLED,
-   },
-   {
-   .id = V4L2_CID_AUDIO_BALANCE,
-   .flags  = V4L2_CTRL_FLAG_DISABLED,
-   },
-   {
-   .id = V4L2_CID_AUDIO_BASS,
-   .flags  = V4L2_CTRL_FLAG_DISABLED,
-   },
-   {
-   .id = V4L2_CID_AUDIO_TREBLE,
-   .flags  = V4L2_CTRL_FLAG_DISABLED,
-   },
-   {
-   .id = V4L2_CID_AUDIO_LOUDNESS,
-   .flags  = V4L2_CTRL_FLAG_DISABLED,
-   },
-};
-
 static int usb_amradio_probe(struct usb_interface *intf,
 const struct usb_device_id *id);
 static void usb_amradio_disconnect(struct usb_interface *intf);
@@ -160,6 +129,7 @@
/* reference to USB and video device */
struct usb_device *usbdev;
struct video_device *videodev;
+   struct v4l2_device v4l2_dev;
 
unsigned char *buffer;
struct mutex lock;  /* buffer locking */
@@ -332,6 +302,7 @@
 
usb_set_intfdata(intf, NULL);
video_unregister_device(radio->videodev);
+   v4l2_device_disconnect(&radio->v4l2_dev);
 }
 
 /* vidioc_querycap - query device capabilities */
@@ -466,14 +437,11 @@
 static int vidioc_queryctrl(struct file *file, void *priv,
struct v4l2_queryctrl *qc)
 {
-   int i;
+   switch (qc->id) {
+   case V4L2_CID_AUDIO_MUTE:
+   return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1);
+   }
 
-   for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) {
-   if (qc->id && qc->id == radio_qctrl[i].id) {
-   memcpy(qc, &(radio_qctrl[i]), sizeof(*qc));
-   return 0;
-   }
-   }
return -EINVAL;
 }
 
@@ -674,34 +642,29 @@
.vidioc_s_input = vidioc_s_input,
 };
 
-static void usb_amradio_device_release(struct video_device *videodev)
+static void usb_amradio_video_device_release(struct video_device *videodev)
 {
struct amradio_device *radio = video_get_drvdata(videodev);
 
/* we call v4l to free radio->videodev */
video_device_release(videodev);
 
+   v4l2_device_unregister(&radio->v4l2_dev);
+
/* free rest memory */
kfree(radio->buffer);
kfree(radio);
 }
-
-/* V4L2 interface */
-static struct video_device amradio_videodev_template = {
-   .name   = "AverMedia MR 800 USB FM Radio",
-   .fops   = &usb_amradio_fops,
-   .ioctl_ops  = &usb_amradio_ioctl_ops,
-   .release= usb_amradio_device_release,
-};
 
 /* check if the device is present and register with v4l and usb if it is */
 static int usb_amradio_probe(struct usb_interface *intf,
const struct usb_device_id *id)
 {
struct amradio_device *radio;
+   struct v4l2_device *v4l2_dev;
int retval;
 
-   radio = kmalloc(sizeof(struct amradio_device), GFP_KERNEL);
+   radio = kzalloc(sizeof(struct amradio_device), GFP_KERNEL);
 
if (!radio) 

  1   2   >