Re: [3.0.y+] [media] Avoid sysfs oops when an rc_dev's raw device is absent

2012-08-07 Thread Herton Ronaldo Krzesinski
On Tue, Aug 07, 2012 at 07:58:44PM +1200, Douglas Bagnall wrote:
 Ben Hutchings wrote: 
  This returns without unlocking dev-lock, which isn't much of an
  improvement.  Please get that fixed in mainline, and then I can apply
  both of the changes to 3.2.y at once.

Thanks for reviewing it Ben.

 
 Oh dear. Quite right. Sorry. Thanks.
 
 Douglas

 From c1d4df58efb2d13551586d177bcbb4e9af588618 Mon Sep 17 00:00:00 2001
 From: Douglas Bagnall doug...@paradise.net.nz
 Date: Tue, 7 Aug 2012 19:30:36 +1200
 Subject: [PATCH] Unlock the rc_dev lock when the raw device is missing
 
 As pointed out by Ben Hutchings, after commit 720bb6436, the lock was
 being taken and not released when an rc_dev has a NULL raw device.
 
 Signed-off-by: Douglas Bagnall doug...@paradise.net.nz

As it's desired for stable, this could also have
Cc: sta...@vger.kernel.org when applied, so it's picked up
automatically when lands in mainline. Also nitpicking some more,
may be the patch could have a Reported-by line added.

Acked-by: Herton R. Krzesinski herton.krzesin...@canonical.com

 ---
  drivers/media/rc/rc-main.c |5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
 index cabc19c..dcd45d0 100644
 --- a/drivers/media/rc/rc-main.c
 +++ b/drivers/media/rc/rc-main.c
 @@ -778,9 +778,10 @@ static ssize_t show_protocols(struct device *device,
   } else if (dev-raw) {
   enabled = dev-raw-enabled_protocols;
   allowed = ir_raw_get_allowed_protocols();
 - } else
 + } else {
 + mutex_unlock(dev-lock);
   return -ENODEV;
 -
 + }
   IR_dprintk(1, allowed - 0x%llx, enabled - 0x%llx\n,
  (long long)allowed,
  (long long)enabled);
 -- 
 1.7.9.5
 


-- 
[]'s
Herton
--
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


Random crashes with v4l2_device_register_subdev

2011-04-01 Thread Herton Ronaldo Krzesinski
Hi,

Recently I received a report about crashes with mxb v4l driver
(https://bugs.launchpad.net/ubuntu/+source/linux/+bug/745213), there are
two slightly different reported crashes which I paste here:

1) BootDmesg.txt crash:

[   21.210232] general protection fault:  [#1] SMP 
[   21.210292] last sysfs file: /sys/bus/i2c/drivers/tda9840/uevent
[   21.210357] CPU 0 
[   21.210379] Modules linked in: tda9840 tea6415c tea6420 snd_hda_codec_hdmi 
snd_hda_codec_realtek snd_hda_intel snd_hda_codec saa7115 mxb(+) snd_seq_midi 
snd_hwdep snd_rawmidi snd_pcm snd_seq_midi_event snd_seq snd_timer 
snd_seq_device saa7146_vv saa7146 snd videobuf_dma_sg videobuf_core v4l2_common 
videodev edac_core soundcore shpchp snd_page_alloc sp5100_tco edac_mce_amd 
xhci_hcd v4l2_compat_ioctl32 k10temp i2c_piix4 asus_atk0110 lp parport radeon 
usbhid ttm hid drm_kms_helper drm ahci sym53c8xx firewire_ohci e1000 
scsi_transport_spi r8169 pata_atiixp firewire_core i2c_algo_bit libahci 
crc_itu_t pata_via
[   21.211030] 
[   21.211047] Pid: 812, comm: work_for_cpu Not tainted 2.6.38-7-generic 
#39-Ubuntu System manufacturer System Product Name/M4A88TD-V EVO/USB3
[   21.211187] RIP: 0010:[a029e745]  [a029e745] 
v4l2_device_register_subdev+0x95/0x170 [videodev]
[   21.211304] RSP: 0018:880209de5d10  EFLAGS: 00010202
[   21.211362] RAX: 6564656572662e67 RBX: ffea RCX: 88020f38d0c8
[   21.211438] RDX: 88020ea90e40 RSI: 88020b5ad380 RDI: 88020eb72018
[   21.211514] RBP: 880209de5d40 R08:  R09: dead00200200
[   21.211590] R10: 0001 R11: 0001 R12: 88020b5ad380
[   21.211667] R13: 88020eb72018 R14: a03820e0 R15: 88020eb72018
[   21.211743] FS:  7f9933fa1720() GS:8800cfc0() 
knlGS:
[   21.211831] CS:  0010 DS:  ES:  CR0: 8005003b
[   21.211892] CR2: 0048c000 CR3: 00020fb3b000 CR4: 06f0
[   21.211968] DR0:  DR1:  DR2: 
[   21.212045] DR3:  DR6: 0ff0 DR7: 0400
[   21.212121] Process work_for_cpu (pid: 812, threadinfo 880209de4000, 
task 88020d2716c0)
[   21.212214] Stack:
[   21.212236]  880209de5d40 8146fc05 88020b097c00 
88020b5ad380
[   21.212318]  88020eb72018 a03820e0 880209de5d70 
a028f6b5
[   21.212401]  880209de5d80  0042 
88020eb52010
[   21.212484] Call Trace:
[   21.212513]  [8146fc05] ? i2c_new_device+0x135/0x1c0
[   21.212578]  [a028f6b5] v4l2_i2c_new_subdev_board+0xf5/0x160 
[v4l2_common]
[   21.212663]  [a028f795] v4l2_i2c_new_subdev+0x75/0xa0 [v4l2_common]
[   21.215825]  [a0333714] mxb_probe+0x124/0x260 [mxb]
[   21.219016]  [a03345a3] mxb_attach+0x33/0x1f0 [mxb]
[   21.220214]  [a02e24c7] saa7146_init_one+0x887/0x13c0 [saa7146]
[   21.220214]  [812fef4f] local_pci_probe+0x5f/0xd0
[   21.220214]  [8107f890] ? do_work_for_cpu+0x0/0x30
[   21.220214]  [8107f8a8] do_work_for_cpu+0x18/0x30
[   21.220214]  [81086fe6] kthread+0x96/0xa0
[   21.220214]  [8100ce24] kernel_thread_helper+0x4/0x10
[   21.220214]  [81086f50] ? kthread+0x0/0xa0
[   21.220214]  [8100ce20] ? kernel_thread_helper+0x0/0x10
[   21.220214] Code: f6 74 19 41 83 3e 02 0f 84 eb 00 00 00 49 8b 86 68 02 00 
00 65 ff 00 66 66 66 66 90 49 8b 44 24 30 4d 89 6c 24 20 48 85 c0 74 13 48 8b 
00 48 85 c0 74 0b 4c 89 e7 ff d0 85 c0 89 c3 75 85 49 8b 
[   21.220214] RIP  [a029e745] v4l2_device_register_subdev+0x95/0x170 
[videodev]
[   21.220214]  RSP 880209de5d10
[   21.260394] ---[ end trace 5adfede4ff2f2907 ]---

2) Another crash, OopsText.txt:

043b
IP: [a014c745] v4l2_device_register_subdev+0x95/0x170 [videodev]
PGD 0 
Oops:  [#1] SMP 
last sysfs file: /sys/bus/i2c/drivers/tea6415c/uevent
CPU 0 
Modules linked in: tea6415c binfmt_misc tea6420 snd_hda_codec_hdmi 
snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_pcm 
snd_seq_midi snd_rawmidi saa7115 snd_seq_midi_event edac_core edac_mce_amd 
snd_seq mxb(+) saa7146_vv k10temp saa7146 videobuf_dma_sg videobuf_core 
asus_atk0110 v4l2_common snd_timer snd_seq_device videodev v4l2_compat_ioctl32 
snd soundcore snd_page_alloc sp5100_tco i2c_piix4 xhci_hcd shpchp lp parport 
usbhid hid sym53c8xx ahci scsi_transport_spi e1000 libahci firewire_ohci r8169 
pata_via pata_atiixp firewire_core crc_itu_t

Pid: 589, comm: work_for_cpu Not tainted 2.6.38-7-generic #39-Ubuntu System 
manufacturer System Product Name/M4A88TD-V EVO/USB3
RIP: 0010:[a014c745]  [a014c745] 
v4l2_device_register_subdev+0x95/0x170 [videodev]
RSP: 0018:88020e8dfd10  EFLAGS: 00010202
RAX: 043b RBX: ffea RCX: 88020e889908
RDX: 88020aeeb240 RSI: 88020f5a8200 RDI: 88020ff61a18
RBP: 88020e8dfd40 R08: 

[PATCH] v4l: subdev: initialize sd-internal_ops in v4l2_subdev_init

2011-04-01 Thread Herton Ronaldo Krzesinski
Many v4l drivers currently don't initialize their struct v4l2_subdev
with zeros, so since the addition of internal_ops in commit 45f6f84, we
are at risk of random oopses when code in v4l2_device_register_subdev
tries to dereference sd-internal_ops-*, as can be shown by the report
at http://bugs.launchpad.net/bugs/745213

So make sure internal_ops is cleared in v4l2_subdev_init.

BugLink: http://bugs.launchpad.net/bugs/745213
Cc: sta...@kernel.org # .38.x
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/media/video/v4l2-subdev.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/v4l2-subdev.c 
b/drivers/media/video/v4l2-subdev.c
index 0b80644..0f70c74 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -324,6 +324,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct 
v4l2_subdev_ops *ops)
sd-grp_id = 0;
sd-dev_priv = NULL;
sd-host_priv = NULL;
+   sd-internal_ops = NULL;
 #if defined(CONFIG_MEDIA_CONTROLLER)
sd-entity.name = sd-name;
sd-entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-- 
1.7.1

--
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] v4l: subdev: initialize sd-internal_ops in v4l2_subdev_init

2011-04-01 Thread Herton Ronaldo Krzesinski
On Fri, Apr 01, 2011 at 05:05:27PM +0200, Hans Verkuil wrote:
 On Friday, April 01, 2011 16:24:17 Herton Ronaldo Krzesinski wrote:
  Many v4l drivers currently don't initialize their struct v4l2_subdev
  with zeros, so since the addition of internal_ops in commit 45f6f84, we
  are at risk of random oopses when code in v4l2_device_register_subdev
  tries to dereference sd-internal_ops-*, as can be shown by the report
  at http://bugs.launchpad.net/bugs/745213
  
  So make sure internal_ops is cleared in v4l2_subdev_init.
 
 NACK: we need to replace those kmalloc's with kzalloc. This patch will just
 fix the internal_ops problem, but sd-entity isn't zeroed. It's going to be
 a neverending problem unless we fix those kmalloc's. It is my fault, I guess:
 I should always have required the use of kzalloc.
 
 I grepped for this and the number of kmalloc's is quite small:
 
 drivers/media/video/tda9840.c
 drivers/media/video/upd64031a.c
 drivers/media/video/m52790.c
 drivers/media/video/tea6415c.c
 drivers/media/video/tea6420.c
 drivers/media/video/upd64083.c
 drivers/media/radio/saa7706h.c
 drivers/media/radio/tef6862.c
 
 If you fix those kmalloc's, then I'll ack those changes. There is just one
 relevant kmalloc in each file.
 
 The reason this wasn't noticed before is that all these devices are all
 pretty rare. All the more common device drivers use kzalloc. I am really
 surprised to hear of mxb boards still in use! Just for the record: I have
 one myself for testing, although I clearly never realized that I should
 test that particular change with that board...
 
 Thanks for doing such a great job of tracking this down!

No problem, I'll take a look and send a new patch.

 
 Regards,
 
   Hans
 

-- 
[]'s
Herton
--
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] v4l: make sure drivers supply a zeroed struct v4l2_subdev

2011-04-01 Thread Herton Ronaldo Krzesinski
Some v4l drivers currently don't initialize their struct v4l2_subdev
with zeros, and this is a problem since some of the v4l2 code expects
this. One example is the addition of internal_ops in commit 45f6f84,
after that we are at risk of random oopses with these drivers when code
in v4l2_device_register_subdev tries to dereference sd-internal_ops-*,
as can be shown by the report at http://bugs.launchpad.net/bugs/745213
and analysis of its crash at https://lkml.org/lkml/2011/4/1/168

Use kzalloc within problematic drivers to ensure we have a zeroed struct
v4l2_subdev.

BugLink: http://bugs.launchpad.net/bugs/745213
Cc: sta...@kernel.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/media/radio/saa7706h.c  |2 +-
 drivers/media/radio/tef6862.c   |2 +-
 drivers/media/video/m52790.c|2 +-
 drivers/media/video/tda9840.c   |2 +-
 drivers/media/video/tea6415c.c  |2 +-
 drivers/media/video/tea6420.c   |2 +-
 drivers/media/video/upd64031a.c |2 +-
 drivers/media/video/upd64083.c  |2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/radio/saa7706h.c b/drivers/media/radio/saa7706h.c
index 585680f..b1193df 100644
--- a/drivers/media/radio/saa7706h.c
+++ b/drivers/media/radio/saa7706h.c
@@ -376,7 +376,7 @@ static int __devinit saa7706h_probe(struct i2c_client 
*client,
v4l_info(client, chip found @ 0x%02x (%s)\n,
client-addr  1, client-adapter-name);
 
-   state = kmalloc(sizeof(struct saa7706h_state), GFP_KERNEL);
+   state = kzalloc(sizeof(struct saa7706h_state), GFP_KERNEL);
if (state == NULL)
return -ENOMEM;
sd = state-sd;
diff --git a/drivers/media/radio/tef6862.c b/drivers/media/radio/tef6862.c
index 7c0d777..0991e19 100644
--- a/drivers/media/radio/tef6862.c
+++ b/drivers/media/radio/tef6862.c
@@ -176,7 +176,7 @@ static int __devinit tef6862_probe(struct i2c_client 
*client,
v4l_info(client, chip found @ 0x%02x (%s)\n,
client-addr  1, client-adapter-name);
 
-   state = kmalloc(sizeof(struct tef6862_state), GFP_KERNEL);
+   state = kzalloc(sizeof(struct tef6862_state), GFP_KERNEL);
if (state == NULL)
return -ENOMEM;
state-freq = TEF6862_LO_FREQ;
diff --git a/drivers/media/video/m52790.c b/drivers/media/video/m52790.c
index 5e1c9a8..303ffa7 100644
--- a/drivers/media/video/m52790.c
+++ b/drivers/media/video/m52790.c
@@ -174,7 +174,7 @@ static int m52790_probe(struct i2c_client *client,
v4l_info(client, chip found @ 0x%x (%s)\n,
client-addr  1, client-adapter-name);
 
-   state = kmalloc(sizeof(struct m52790_state), GFP_KERNEL);
+   state = kzalloc(sizeof(struct m52790_state), GFP_KERNEL);
if (state == NULL)
return -ENOMEM;
 
diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c
index 5d4cf3b..22fa820 100644
--- a/drivers/media/video/tda9840.c
+++ b/drivers/media/video/tda9840.c
@@ -171,7 +171,7 @@ static int tda9840_probe(struct i2c_client *client,
v4l_info(client, chip found @ 0x%x (%s)\n,
client-addr  1, client-adapter-name);
 
-   sd = kmalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);
+   sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);
if (sd == NULL)
return -ENOMEM;
v4l2_i2c_subdev_init(sd, client, tda9840_ops);
diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c
index 19621ed..827425c 100644
--- a/drivers/media/video/tea6415c.c
+++ b/drivers/media/video/tea6415c.c
@@ -152,7 +152,7 @@ static int tea6415c_probe(struct i2c_client *client,
 
v4l_info(client, chip found @ 0x%x (%s)\n,
client-addr  1, client-adapter-name);
-   sd = kmalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);
+   sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);
if (sd == NULL)
return -ENOMEM;
v4l2_i2c_subdev_init(sd, client, tea6415c_ops);
diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c
index 5ea8404..f350b6c 100644
--- a/drivers/media/video/tea6420.c
+++ b/drivers/media/video/tea6420.c
@@ -125,7 +125,7 @@ static int tea6420_probe(struct i2c_client *client,
v4l_info(client, chip found @ 0x%x (%s)\n,
client-addr  1, client-adapter-name);
 
-   sd = kmalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);
+   sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);
if (sd == NULL)
return -ENOMEM;
v4l2_i2c_subdev_init(sd, client, tea6420_ops);
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c
index f8138c7..1aab96a 100644
--- a/drivers/media/video/upd64031a.c
+++ b/drivers/media/video/upd64031a.c
@@ -230,7 +230,7 @@ static int upd64031a_probe(struct i2c_client *client,
v4l_info(client, chip found @ 0x%x (%s)\n

[PATCH] saa7134: add RM-K6 remote control support for Avermedia M135A

2010-05-10 Thread Herton Ronaldo Krzesinski
This change adds support for one more remote control type for Avermedia
M135A (model RM-K6), shipped with Positivo machines.

Signed-off-by: Herton Ronaldo Krzesinski her...@mandriva.com.br
---
 drivers/media/IR/keymaps/Makefile  |2 +-
 .../media/IR/keymaps/rc-avermedia-m135a-rm-jx.c|   90 
 drivers/media/IR/keymaps/rc-avermedia-m135a.c  |  147 
 drivers/media/video/saa7134/saa7134-input.c|2 +-
 include/media/rc-map.h |2 +-
 5 files changed, 150 insertions(+), 93 deletions(-)
 delete mode 100644 drivers/media/IR/keymaps/rc-avermedia-m135a-rm-jx.c
 create mode 100644 drivers/media/IR/keymaps/rc-avermedia-m135a.c

diff --git a/drivers/media/IR/keymaps/Makefile 
b/drivers/media/IR/keymaps/Makefile
index 585f75c..aea649f 100644
--- a/drivers/media/IR/keymaps/Makefile
+++ b/drivers/media/IR/keymaps/Makefile
@@ -6,7 +6,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-avermedia.o \
rc-avermedia-cardbus.o \
rc-avermedia-dvbt.o \
-   rc-avermedia-m135a-rm-jx.o \
+   rc-avermedia-m135a.o \
rc-avermedia-m733a-rm-k6.o \
rc-avertv-303.o \
rc-behold.o \
diff --git a/drivers/media/IR/keymaps/rc-avermedia-m135a-rm-jx.c 
b/drivers/media/IR/keymaps/rc-avermedia-m135a-rm-jx.c
deleted file mode 100644
index 101e7ea..000
--- a/drivers/media/IR/keymaps/rc-avermedia-m135a-rm-jx.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* avermedia-m135a-rm-jx.h - Keytable for avermedia_m135a_rm_jx Remote 
Controller
- *
- * keymap imported from ir-keymaps.c
- *
- * Copyright (c) 2010 by Mauro Carvalho Chehab mche...@redhat.com
- *
- * 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.
- */
-
-#include media/rc-map.h
-
-/*
- * Avermedia M135A with IR model RM-JX
- * The same codes exist on both Positivo (BR) and original IR
- * Mauro Carvalho Chehab mche...@infradead.org
- */
-
-static struct ir_scancode avermedia_m135a_rm_jx[] = {
-   { 0x0200, KEY_POWER2 },
-   { 0x022e, KEY_DOT },/* '.' */
-   { 0x0201, KEY_MODE },   /* TV/FM or SOURCE */
-
-   { 0x0205, KEY_1 },
-   { 0x0206, KEY_2 },
-   { 0x0207, KEY_3 },
-   { 0x0209, KEY_4 },
-   { 0x020a, KEY_5 },
-   { 0x020b, KEY_6 },
-   { 0x020d, KEY_7 },
-   { 0x020e, KEY_8 },
-   { 0x020f, KEY_9 },
-   { 0x0211, KEY_0 },
-
-   { 0x0213, KEY_RIGHT },  /* - or L */
-   { 0x0212, KEY_LEFT },   /* - or R */
-
-   { 0x0217, KEY_SLEEP },  /* Capturar Imagem or Snapshot */
-   { 0x0210, KEY_SHUFFLE },/* Amostra or 16 chan prev */
-
-   { 0x0303, KEY_CHANNELUP },
-   { 0x0302, KEY_CHANNELDOWN },
-   { 0x021f, KEY_VOLUMEUP },
-   { 0x021e, KEY_VOLUMEDOWN },
-   { 0x020c, KEY_ENTER },  /* Full Screen */
-
-   { 0x0214, KEY_MUTE },
-   { 0x0208, KEY_AUDIO },
-
-   { 0x0203, KEY_TEXT },   /* Teletext */
-   { 0x0204, KEY_EPG },
-   { 0x022b, KEY_TV2 },/* TV2 or PIP */
-
-   { 0x021d, KEY_RED },
-   { 0x021c, KEY_YELLOW },
-   { 0x0301, KEY_GREEN },
-   { 0x0300, KEY_BLUE },
-
-   { 0x021a, KEY_PLAYPAUSE },
-   { 0x0219, KEY_RECORD },
-   { 0x0218, KEY_PLAY },
-   { 0x021b, KEY_STOP },
-};
-
-static struct rc_keymap avermedia_m135a_rm_jx_map = {
-   .map = {
-   .scan= avermedia_m135a_rm_jx,
-   .size= ARRAY_SIZE(avermedia_m135a_rm_jx),
-   .ir_type = IR_TYPE_NEC,
-   .name= RC_MAP_AVERMEDIA_M135A_RM_JX,
-   }
-};
-
-static int __init init_rc_map_avermedia_m135a_rm_jx(void)
-{
-   return ir_register_map(avermedia_m135a_rm_jx_map);
-}
-
-static void __exit exit_rc_map_avermedia_m135a_rm_jx(void)
-{
-   ir_unregister_map(avermedia_m135a_rm_jx_map);
-}
-
-module_init(init_rc_map_avermedia_m135a_rm_jx)
-module_exit(exit_rc_map_avermedia_m135a_rm_jx)
-
-MODULE_LICENSE(GPL);
-MODULE_AUTHOR(Mauro Carvalho Chehab mche...@redhat.com);
diff --git a/drivers/media/IR/keymaps/rc-avermedia-m135a.c 
b/drivers/media/IR/keymaps/rc-avermedia-m135a.c
new file mode 100644
index 000..e4471fb
--- /dev/null
+++ b/drivers/media/IR/keymaps/rc-avermedia-m135a.c
@@ -0,0 +1,147 @@
+/* avermedia-m135a.c - Keytable for Avermedia M135A Remote Controllers
+ *
+ * Copyright (c) 2010 by Mauro Carvalho Chehab mche...@redhat.com
+ * Copyright (c) 2010 by Herton Ronaldo Krzesinski her...@mandriva.com.br
+ *
+ * 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

Re: Status of the patches under review (85 patches) and some misc notes about the devel procedures

2010-05-10 Thread Herton Ronaldo Krzesinski
Em Sáb 08 Mai 2010, às 19:41:32, Mauro Carvalho Chehab escreveu:
 Herton Ronaldo Krzesinski wrote:
  Em Sex 07 Mai 2010, às 09:39:16, Mauro Carvalho Chehab escreveu:
 == Patch(broken) - waiting for Herton Ronaldo Krzesinski 
  her...@mandriva.com.br new submission == 
 
  Apr, 5 2010: saa7134: add support for Avermedia M733A  
   http://patchwork.kernel.org/patch/90692
  
  Hi, I submitted now a new fixed version of the patch to mailing list, under
  title [PATCH v2] saa7134: add support for Avermedia M733A
 
 OK, thanks!
 
  Mar,19 2010: saa7134: add support for one more remote control for 
  Avermedia M135A   http://patchwork.kernel.org/patch/86989
  
  This was the addition of RM-K6 remote control to M135A too, I think we can 
  drop
  this, since adding this to the kernel is deprecated now in favour of 
  assigning
  keymaps in userspace (keytable tool from v4l-utils), right?
 
 For now, I prefer to add the keytab there, since there are some scripts that 
 syncs v4l-util
 keytables with the kernel ones. If you prefer, you may the put RM-K6 table 
 together
 with the other M135A keytable. I intend to group the non-conflicting 
 keytables soon,
 and it makes kense to group both the original and the RM-K6 into the same 
 table, in order to 
 provide an easier hot-plug support for this device.

Ok, I updated and tested a new patch now, and sent with title
[PATCH] saa7134: add RM-K6 remote control support for Avermedia M135A

--
[]'s
Herton
--
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 v2] saa7134: add support for Avermedia M733A

2010-05-07 Thread Herton Ronaldo Krzesinski
This change adds support for Avermedia M733A. The original version for
linux 2.6.31 was sent to me from Avermedia, original author is unknown.
I ported it to current kernels, expanded and fixed key code handling for
RM-K6 remote control, and added an additional pci id also supported.

Signed-off-by: Herton Ronaldo Krzesinski her...@mandriva.com.br
---
 Documentation/video4linux/CARDLIST.saa7134 |5 +-
 drivers/media/IR/keymaps/Makefile  |1 +
 .../media/IR/keymaps/rc-avermedia-m733a-rm-k6.c|   95 
 drivers/media/video/saa7134/saa7134-cards.c|   57 -
 drivers/media/video/saa7134/saa7134-input.c|7 ++
 drivers/media/video/saa7134/saa7134.h  |1 +
 include/media/rc-map.h |1 +
 7 files changed, 164 insertions(+), 3 deletions(-)
 create mode 100644 drivers/media/IR/keymaps/rc-avermedia-m733a-rm-k6.c

diff --git a/Documentation/video4linux/CARDLIST.saa7134 
b/Documentation/video4linux/CARDLIST.saa7134
index 070f257..1387a69 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -176,5 +176,6 @@
 175 - Leadtek Winfast DTV1000S [107d:6655]
 176 - Beholder BeholdTV 505 RDS[:5051]
 177 - Hawell HW-404M7
-179 - Beholder BeholdTV H7[5ace:7190]
-180 - Beholder BeholdTV A7[5ace:7090]
+178 - Beholder BeholdTV H7 [5ace:7190]
+179 - Beholder BeholdTV A7 [5ace:7090]
+180 - Avermedia M733A  [1461:4155,1461:4255]
diff --git a/drivers/media/IR/keymaps/Makefile 
b/drivers/media/IR/keymaps/Makefile
index ec25258..585f75c 100644
--- a/drivers/media/IR/keymaps/Makefile
+++ b/drivers/media/IR/keymaps/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-avermedia-cardbus.o \
rc-avermedia-dvbt.o \
rc-avermedia-m135a-rm-jx.o \
+   rc-avermedia-m733a-rm-k6.o \
rc-avertv-303.o \
rc-behold.o \
rc-behold-columbus.o \
diff --git a/drivers/media/IR/keymaps/rc-avermedia-m733a-rm-k6.c 
b/drivers/media/IR/keymaps/rc-avermedia-m733a-rm-k6.c
new file mode 100644
index 000..cf8d457
--- /dev/null
+++ b/drivers/media/IR/keymaps/rc-avermedia-m733a-rm-k6.c
@@ -0,0 +1,95 @@
+/* avermedia-m733a-rm-k6.h - Keytable for avermedia_m733a_rm_k6 Remote 
Controller
+ *
+ * Copyright (c) 2010 by Herton Ronaldo Krzesinski her...@mandriva.com.br
+ *
+ * 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.
+ */
+
+#include media/rc-map.h
+
+/*
+ * Avermedia M733A with IR model RM-K6
+ * This is the stock remote controller used with Positivo machines with M733A
+ * Herton Ronaldo Krzesinski her...@mandriva.com.br
+ */
+
+static struct ir_scancode avermedia_m733a_rm_k6[] = {
+   { 0x0401, KEY_POWER2 },
+   { 0x0406, KEY_MUTE },
+   { 0x0408, KEY_MODE }, /* TV/FM */
+
+   { 0x0409, KEY_1 },
+   { 0x040a, KEY_2 },
+   { 0x040b, KEY_3 },
+   { 0x040c, KEY_4 },
+   { 0x040d, KEY_5 },
+   { 0x040e, KEY_6 },
+   { 0x040f, KEY_7 },
+   { 0x0410, KEY_8 },
+   { 0x0411, KEY_9 },
+   { 0x044c, KEY_DOT },  /* '.' */
+   { 0x0412, KEY_0 },
+   { 0x0407, KEY_REFRESH },  /* Refresh/Reload */
+
+   { 0x0413, KEY_AUDIO },
+   { 0x0440, KEY_SCREEN },   /* Full Screen toggle */
+   { 0x0441, KEY_HOME },
+   { 0x0442, KEY_BACK },
+   { 0x0447, KEY_UP },
+   { 0x0448, KEY_DOWN },
+   { 0x0449, KEY_LEFT },
+   { 0x044a, KEY_RIGHT },
+   { 0x044b, KEY_OK },
+   { 0x0404, KEY_VOLUMEUP },
+   { 0x0405, KEY_VOLUMEDOWN },
+   { 0x0402, KEY_CHANNELUP },
+   { 0x0403, KEY_CHANNELDOWN },
+
+   { 0x0443, KEY_RED },
+   { 0x0444, KEY_GREEN },
+   { 0x0445, KEY_YELLOW },
+   { 0x0446, KEY_BLUE },
+
+   { 0x0414, KEY_TEXT },
+   { 0x0415, KEY_EPG },
+   { 0x041a, KEY_TV2 },  /* PIP */
+   { 0x041b, KEY_MHP },  /* Snapshot */
+
+   { 0x0417, KEY_RECORD },
+   { 0x0416, KEY_PLAYPAUSE },
+   { 0x0418, KEY_STOP },
+   { 0x0419, KEY_PAUSE },
+
+   { 0x041f, KEY_PREVIOUS },
+   { 0x041c, KEY_REWIND },
+   { 0x041d, KEY_FORWARD },
+   { 0x041e, KEY_NEXT },
+};
+
+static struct rc_keymap avermedia_m733a_rm_k6_map = {
+   .map = {
+   .scan= avermedia_m733a_rm_k6,
+   .size= ARRAY_SIZE(avermedia_m733a_rm_k6),
+   .ir_type = IR_TYPE_NEC,
+   .name= RC_MAP_AVERMEDIA_M733A_RM_K6,
+   }
+};
+
+static int __init init_rc_map_avermedia_m733a_rm_k6(void

Re: Status of the patches under review (85 patches) and some misc notes about the devel procedures

2010-05-07 Thread Herton Ronaldo Krzesinski
Em Sex 07 Mai 2010, às 09:39:16, Mauro Carvalho Chehab escreveu:
   == Patch(broken) - waiting for Herton Ronaldo Krzesinski 
 her...@mandriva.com.br new submission == 
 
 Apr, 5 2010: saa7134: add support for Avermedia M733A 
   http://patchwork.kernel.org/patch/90692

Hi, I submitted now a new fixed version of the patch to mailing list, under
title [PATCH v2] saa7134: add support for Avermedia M733A

 Mar,19 2010: saa7134: add support for one more remote control for Avermedia 
 M135A   http://patchwork.kernel.org/patch/86989

This was the addition of RM-K6 remote control to M135A too, I think we can drop
this, since adding this to the kernel is deprecated now in favour of assigning
keymaps in userspace (keytable tool from v4l-utils), right?

--
[]'s
Herton
--
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] saa7134: add support for Avermedia M733A

2010-04-05 Thread Herton Ronaldo Krzesinski
This change adds support for Avermedia M733A. The original version for
linux 2.6.31 was sent to me from Avermedia, original author is unknown.
I ported it to current kernels, and modified for the two pci ids
supported (1461:4155, 1461:4255).

Signed-off-by: Herton Ronaldo Krzesinski her...@mandriva.com.br
---
 Documentation/video4linux/CARDLIST.saa7134  |1 +
 drivers/media/IR/ir-keymaps.c   |   53 +
 drivers/media/video/saa7134/saa7134-cards.c |   57 ++-
 drivers/media/video/saa7134/saa7134-input.c |6 +++
 drivers/media/video/saa7134/saa7134.h   |1 +
 include/media/ir-common.h   |1 +
 6 files changed, 118 insertions(+), 1 deletions(-)

diff --git a/Documentation/video4linux/CARDLIST.saa7134 
b/Documentation/video4linux/CARDLIST.saa7134
index bb3d5fa..321d00b 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -176,3 +176,4 @@
 175 - Leadtek Winfast DTV1000S [107d:6655]
 176 - Beholder BeholdTV 505 RDS[:5051]
 177 - Hawell HW-404M7
+178 - Avermedia M733A  [1461:4155,1461:4255]
diff --git a/drivers/media/IR/ir-keymaps.c b/drivers/media/IR/ir-keymaps.c
index dfc777b..8c8c056 100644
--- a/drivers/media/IR/ir-keymaps.c
+++ b/drivers/media/IR/ir-keymaps.c
@@ -172,6 +172,59 @@ static struct ir_scancode ir_codes_avermedia_m135a[] = {
 };
 IR_TABLE(avermedia_m135a, IR_TYPE_UNKNOWN, ir_codes_avermedia_m135a);
 
+/* Herton Ronaldo Krzesinski her...@mandriva.com.br */
+static struct ir_scancode ir_codes_avermedia_m733a[] = {
+   { 0x00, KEY_POWER2 },
+   { 0x2e, KEY_DOT },
+   { 0x01, KEY_MODE },
+
+   { 0x05, KEY_1 },
+   { 0x06, KEY_2 },
+   { 0x07, KEY_3 },
+   { 0x09, KEY_4 },
+   { 0x0a, KEY_5 },
+   { 0x0b, KEY_6 },
+   { 0x0d, KEY_7 },
+   { 0x0e, KEY_8 },
+   { 0x0f, KEY_9 },
+   { 0x11, KEY_0 },
+
+   { 0x13, KEY_RIGHT },
+   { 0x12, KEY_LEFT },
+
+   { 0x17, KEY_SLEEP },
+   { 0x10, KEY_SHUFFLE },
+
+   { 0x43, KEY_CHANNELUP },
+   { 0x42, KEY_CHANNELDOWN },
+   { 0x1f, KEY_VOLUMEUP },
+   { 0x1e, KEY_VOLUMEDOWN },
+   { 0x0c, KEY_ENTER },
+
+   { 0x14, KEY_MUTE },
+   { 0x08, KEY_AUDIO },
+
+   { 0x03, KEY_TEXT },
+   { 0x04, KEY_EPG },
+   { 0x2b, KEY_TV2 },
+
+   { 0x1d, KEY_RED },
+   { 0x1c, KEY_YELLOW },
+   { 0x41, KEY_GREEN },
+   { 0x40, KEY_BLUE },
+
+   { 0x1a, KEY_PLAYPAUSE },
+   { 0x19, KEY_RECORD },
+   { 0x18, KEY_PLAY },
+   { 0x1b, KEY_STOP },
+};
+
+struct ir_scancode_table ir_codes_avermedia_m733a_table = {
+   .scan = ir_codes_avermedia_m733a,
+   .size = ARRAY_SIZE(ir_codes_avermedia_m733a),
+};
+EXPORT_SYMBOL_GPL(ir_codes_avermedia_m733a_table);
+
 /* Oldrich Jedlicka oldium@seznam.cz */
 static struct ir_scancode ir_codes_avermedia_cardbus[] = {
{ 0x00, KEY_POWER },
diff --git a/drivers/media/video/saa7134/saa7134-cards.c 
b/drivers/media/video/saa7134/saa7134-cards.c
index 655068f..bf53270 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -3897,6 +3897,40 @@ struct saa7134_board saa7134_boards[] = {
.gpio = 0x01,
},
},
+   [SAA7134_BOARD_AVERMEDIA_M733A] = {
+   .name   = Avermedia PCI M733A,
+   .audio_clock= 0x00187de7,
+   .tuner_type = TUNER_PHILIPS_TDA8290,
+   .radio_type = UNSET,
+   .tuner_addr = ADDR_UNSET,
+   .radio_addr = ADDR_UNSET,
+   .tuner_config   = 0,
+   .gpiomask   = 0x02020,
+   .inputs = {{
+   .name = name_tv,
+   .vmux = 1,
+   .amux = TV,
+   .tv   = 1,
+   }, {
+   .name = name_comp1,
+   .vmux = 3,
+   .amux = LINE1,
+   }, {
+   .name = name_svideo,
+   .vmux = 8,
+   .amux = LINE1,
+   } },
+   .radio = {
+   .name = name_radio,
+   .amux = TV,
+   .gpio = 0x0020,
+   },
+   .mute = {
+   .name = name_mute,
+   .amux = TV,
+   .gpio = 0x01,
+   },
+   },
[SAA7134_BOARD_BEHOLD_401] = {
/*   Beholder Intl. Ltd. 2008  */
/*Dmitry Belimov d.beli...@gmail.com */
@@ -5764,7 +5798,19 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subvendor= 0x1461, /* Avermedia Technologies Inc */
.subdevice= 0xf11d,
.driver_data

saa7134: add support for one more remote control for Avermedia M135A

2010-03-19 Thread Herton Ronaldo Krzesinski
This change adds support for one more remote control type for Avermedia
M135A. The new remote control reports slightly different codes, and was
necessary to extend the mask_keycode to differentiate between original
remote control. One of the remote controls I had matched the original
binding, but some keys reported duplicated codes, probably because the
previous mask_keycode missing valid bits, so this should fix also
original remote control support (The keys bellow aren't ok comment).

Signed-off-by: Herton Ronaldo Krzesinski her...@mandriva.com.br
---
 drivers/media/IR/ir-keymaps.c   |  141 +++-
 drivers/media/video/saa7134/saa7134-input.c |2 
 2 files changed, 97 insertions(+), 46 deletions(-)

diff -p -up linux-2.6.33.1-1.1mnb/drivers/media/IR/ir-keymaps.c.orig 
linux-2.6.33.1-1.1mnb/drivers/media/IR/ir-keymaps.c
--- linux-2.6.33.1-1.1mnb/drivers/media/IR/ir-keymaps.c.orig2010-03-18 
22:25:12.0 -0300
+++ linux-2.6.33.1-1.1mnb/drivers/media/IR/ir-keymaps.c 2010-03-18 
22:46:29.0 -0300
@@ -122,51 +122,102 @@ EXPORT_SYMBOL_GPL(ir_codes_avermedia_dvb
 
 /* Mauro Carvalho Chehab mche...@infradead.org */
 static struct ir_scancode ir_codes_avermedia_m135a[] = {
-   { 0x00, KEY_POWER2 },
-   { 0x2e, KEY_DOT },  /* '.' */
-   { 0x01, KEY_MODE }, /* TV/FM */
-
-   { 0x05, KEY_1 },
-   { 0x06, KEY_2 },
-   { 0x07, KEY_3 },
-   { 0x09, KEY_4 },
-   { 0x0a, KEY_5 },
-   { 0x0b, KEY_6 },
-   { 0x0d, KEY_7 },
-   { 0x0e, KEY_8 },
-   { 0x0f, KEY_9 },
-   { 0x11, KEY_0 },
-
-   { 0x13, KEY_RIGHT },/* - */
-   { 0x12, KEY_LEFT }, /* - */
-
-   { 0x17, KEY_SLEEP },/* Capturar Imagem */
-   { 0x10, KEY_SHUFFLE },  /* Amostra */
-
-   /* FIXME: The keys bellow aren't ok */
-
-   { 0x43, KEY_CHANNELUP },
-   { 0x42, KEY_CHANNELDOWN },
-   { 0x1f, KEY_VOLUMEUP },
-   { 0x1e, KEY_VOLUMEDOWN },
-   { 0x0c, KEY_ENTER },
-
-   { 0x14, KEY_MUTE },
-   { 0x08, KEY_AUDIO },
-
-   { 0x03, KEY_TEXT },
-   { 0x04, KEY_EPG },
-   { 0x2b, KEY_TV2 },  /* TV2 */
-
-   { 0x1d, KEY_RED },
-   { 0x1c, KEY_YELLOW },
-   { 0x41, KEY_GREEN },
-   { 0x40, KEY_BLUE },
-
-   { 0x1a, KEY_PLAYPAUSE },
-   { 0x19, KEY_RECORD },
-   { 0x18, KEY_PLAY },
-   { 0x1b, KEY_STOP },
+   /* Remote control type 01 (32/54 keys) */
+   { 0x100, KEY_POWER2 },
+   { 0x12e, KEY_DOT }, /* '.' */
+   { 0x101, KEY_MODE },/* TV/FM */
+
+   { 0x105, KEY_1 },
+   { 0x106, KEY_2 },
+   { 0x107, KEY_3 },
+   { 0x109, KEY_4 },
+   { 0x10a, KEY_5 },
+   { 0x10b, KEY_6 },
+   { 0x10d, KEY_7 },
+   { 0x10e, KEY_8 },
+   { 0x10f, KEY_9 },
+   { 0x111, KEY_0 },
+
+   { 0x113, KEY_RIGHT },   /* - */
+   { 0x112, KEY_LEFT },/* - */
+
+   { 0x117, KEY_SHUFFLE }, /* Capturar Imagem */
+   { 0x110, KEY_F13 }, /* Amostra */
+
+   { 0x183, KEY_CHANNELUP },
+   { 0x182, KEY_CHANNELDOWN },
+   { 0x11f, KEY_VOLUMEUP },
+   { 0x11e, KEY_VOLUMEDOWN },
+   { 0x10c, KEY_ENTER },
+
+   { 0x114, KEY_MUTE },
+   { 0x108, KEY_AUDIO },
+
+   { 0x103, KEY_TEXT },
+   { 0x104, KEY_EPG },
+   { 0x12b, KEY_TV2 }, /* TV2 */
+
+   { 0x11d, KEY_RED },
+   { 0x11c, KEY_YELLOW },
+   { 0x181, KEY_GREEN },
+   { 0x180, KEY_BLUE },
+
+   { 0x11a, KEY_PLAYPAUSE },
+   { 0x119, KEY_RECORD },
+   { 0x118, KEY_PLAY },
+   { 0x11b, KEY_STOP },
+
+   /* Remote control type 04 (44 keys) */
+   { 0x201, KEY_POWER2 },
+   { 0x206, KEY_MUTE },
+   { 0x208, KEY_MODE },
+
+   { 0x209, KEY_1 },
+   { 0x20a, KEY_2 },
+   { 0x20b, KEY_3 },
+   { 0x20c, KEY_4 },
+   { 0x20d, KEY_5 },
+   { 0x20e, KEY_6 },
+   { 0x20f, KEY_7 },
+   { 0x210, KEY_8 },
+   { 0x211, KEY_9 },
+   { 0x24c, KEY_DOT },
+   { 0x212, KEY_0 },
+   { 0x207, KEY_LAST },
+
+   { 0x213, KEY_AUDIO },
+   { 0x240, KEY_ZOOM },
+   { 0x241, KEY_HOME },
+   { 0x242, KEY_BACK },
+   { 0x247, KEY_UP },
+   { 0x248, KEY_DOWN },
+   { 0x249, KEY_LEFT },
+   { 0x24a, KEY_RIGHT },
+   { 0x24b, KEY_OK },
+   { 0x204, KEY_VOLUMEUP },
+   { 0x205, KEY_VOLUMEDOWN },
+   { 0x202, KEY_CHANNELUP },
+   { 0x203, KEY_CHANNELDOWN },
+
+   { 0x243, KEY_TV },
+   { 0x244, KEY_VIDEO },
+   { 0x245, KEY_MP3 },
+   { 0x246, KEY_MHP },
+
+   { 0x214, KEY_TEXT },
+   { 0x215, KEY_EPG },
+   { 0x21a, KEY_MEDIA },
+   { 0x21b, KEY_SHUFFLE },
+
+   { 0x217, KEY_RECORD },
+   { 0x216, KEY_PLAYPAUSE },
+   { 0x218, KEY_STOP },
+   { 0x219, KEY_PAUSE },
+
+   { 0x21f, KEY_PREVIOUS },
+   { 0x21d, KEY_REWIND

[PATCH] saa7134: add support for one more remote control for Avermedia M135A

2010-03-19 Thread Herton Ronaldo Krzesinski
This change adds support for one more remote control type for Avermedia
M135A. The new remote control reports slightly different codes, and was
necessary to extend the mask_keycode to differentiate between original
remote control. One of the remote controls I had matched the original
binding, but some keys reported duplicated codes, probably because the
previous mask_keycode missing valid bits, so this should fix also
original remote control support (The keys bellow aren't ok comment).

Signed-off-by: Herton Ronaldo Krzesinski her...@mandriva.com.br
---
 drivers/media/IR/ir-keymaps.c   |  141 +++-
 drivers/media/video/saa7134/saa7134-input.c |2 
 2 files changed, 97 insertions(+), 46 deletions(-)

(sorry this is a resend of previous patch, I forgot [PATCH] in subject)

diff -p -up linux-2.6.33.1-1.1mnb/drivers/media/IR/ir-keymaps.c.orig 
linux-2.6.33.1-1.1mnb/drivers/media/IR/ir-keymaps.c
--- linux-2.6.33.1-1.1mnb/drivers/media/IR/ir-keymaps.c.orig2010-03-18 
22:25:12.0 -0300
+++ linux-2.6.33.1-1.1mnb/drivers/media/IR/ir-keymaps.c 2010-03-18 
22:46:29.0 -0300
@@ -122,51 +122,102 @@ EXPORT_SYMBOL_GPL(ir_codes_avermedia_dvb
 
 /* Mauro Carvalho Chehab mche...@infradead.org */
 static struct ir_scancode ir_codes_avermedia_m135a[] = {
-   { 0x00, KEY_POWER2 },
-   { 0x2e, KEY_DOT },  /* '.' */
-   { 0x01, KEY_MODE }, /* TV/FM */
-
-   { 0x05, KEY_1 },
-   { 0x06, KEY_2 },
-   { 0x07, KEY_3 },
-   { 0x09, KEY_4 },
-   { 0x0a, KEY_5 },
-   { 0x0b, KEY_6 },
-   { 0x0d, KEY_7 },
-   { 0x0e, KEY_8 },
-   { 0x0f, KEY_9 },
-   { 0x11, KEY_0 },
-
-   { 0x13, KEY_RIGHT },/* - */
-   { 0x12, KEY_LEFT }, /* - */
-
-   { 0x17, KEY_SLEEP },/* Capturar Imagem */
-   { 0x10, KEY_SHUFFLE },  /* Amostra */
-
-   /* FIXME: The keys bellow aren't ok */
-
-   { 0x43, KEY_CHANNELUP },
-   { 0x42, KEY_CHANNELDOWN },
-   { 0x1f, KEY_VOLUMEUP },
-   { 0x1e, KEY_VOLUMEDOWN },
-   { 0x0c, KEY_ENTER },
-
-   { 0x14, KEY_MUTE },
-   { 0x08, KEY_AUDIO },
-
-   { 0x03, KEY_TEXT },
-   { 0x04, KEY_EPG },
-   { 0x2b, KEY_TV2 },  /* TV2 */
-
-   { 0x1d, KEY_RED },
-   { 0x1c, KEY_YELLOW },
-   { 0x41, KEY_GREEN },
-   { 0x40, KEY_BLUE },
-
-   { 0x1a, KEY_PLAYPAUSE },
-   { 0x19, KEY_RECORD },
-   { 0x18, KEY_PLAY },
-   { 0x1b, KEY_STOP },
+   /* Remote control type 01 (32/54 keys) */
+   { 0x100, KEY_POWER2 },
+   { 0x12e, KEY_DOT }, /* '.' */
+   { 0x101, KEY_MODE },/* TV/FM */
+
+   { 0x105, KEY_1 },
+   { 0x106, KEY_2 },
+   { 0x107, KEY_3 },
+   { 0x109, KEY_4 },
+   { 0x10a, KEY_5 },
+   { 0x10b, KEY_6 },
+   { 0x10d, KEY_7 },
+   { 0x10e, KEY_8 },
+   { 0x10f, KEY_9 },
+   { 0x111, KEY_0 },
+
+   { 0x113, KEY_RIGHT },   /* - */
+   { 0x112, KEY_LEFT },/* - */
+
+   { 0x117, KEY_SHUFFLE }, /* Capturar Imagem */
+   { 0x110, KEY_F13 }, /* Amostra */
+
+   { 0x183, KEY_CHANNELUP },
+   { 0x182, KEY_CHANNELDOWN },
+   { 0x11f, KEY_VOLUMEUP },
+   { 0x11e, KEY_VOLUMEDOWN },
+   { 0x10c, KEY_ENTER },
+
+   { 0x114, KEY_MUTE },
+   { 0x108, KEY_AUDIO },
+
+   { 0x103, KEY_TEXT },
+   { 0x104, KEY_EPG },
+   { 0x12b, KEY_TV2 }, /* TV2 */
+
+   { 0x11d, KEY_RED },
+   { 0x11c, KEY_YELLOW },
+   { 0x181, KEY_GREEN },
+   { 0x180, KEY_BLUE },
+
+   { 0x11a, KEY_PLAYPAUSE },
+   { 0x119, KEY_RECORD },
+   { 0x118, KEY_PLAY },
+   { 0x11b, KEY_STOP },
+
+   /* Remote control type 04 (44 keys) */
+   { 0x201, KEY_POWER2 },
+   { 0x206, KEY_MUTE },
+   { 0x208, KEY_MODE },
+
+   { 0x209, KEY_1 },
+   { 0x20a, KEY_2 },
+   { 0x20b, KEY_3 },
+   { 0x20c, KEY_4 },
+   { 0x20d, KEY_5 },
+   { 0x20e, KEY_6 },
+   { 0x20f, KEY_7 },
+   { 0x210, KEY_8 },
+   { 0x211, KEY_9 },
+   { 0x24c, KEY_DOT },
+   { 0x212, KEY_0 },
+   { 0x207, KEY_LAST },
+
+   { 0x213, KEY_AUDIO },
+   { 0x240, KEY_ZOOM },
+   { 0x241, KEY_HOME },
+   { 0x242, KEY_BACK },
+   { 0x247, KEY_UP },
+   { 0x248, KEY_DOWN },
+   { 0x249, KEY_LEFT },
+   { 0x24a, KEY_RIGHT },
+   { 0x24b, KEY_OK },
+   { 0x204, KEY_VOLUMEUP },
+   { 0x205, KEY_VOLUMEDOWN },
+   { 0x202, KEY_CHANNELUP },
+   { 0x203, KEY_CHANNELDOWN },
+
+   { 0x243, KEY_TV },
+   { 0x244, KEY_VIDEO },
+   { 0x245, KEY_MP3 },
+   { 0x246, KEY_MHP },
+
+   { 0x214, KEY_TEXT },
+   { 0x215, KEY_EPG },
+   { 0x21a, KEY_MEDIA },
+   { 0x21b, KEY_SHUFFLE },
+
+   { 0x217, KEY_RECORD },
+   { 0x216, KEY_PLAYPAUSE },
+   { 0x218, KEY_STOP },
+   { 0x219, KEY_PAUSE

[PATCH] Revert V4L/DVB (11906): saa7134: Use v4l bounding/alignment function

2010-03-19 Thread Herton Ronaldo Krzesinski
This reverts commit bc52d6eb44de8f19934768d4d10d19fdbdc99950.

On newer kernels, a saa7134 board stopped to display TV video output
properly. After a bisect, I found it as the commit causing the issue.
Turns out that v4l_bound_align_image isn't doing the same bounding
calculation as manually done previously in saa7134_try_fmt_vid_cap.

What isn't equal is the calculation done in clamp align, while
previously it did f-fmt.pix.width = ~0x03, clamp_align function
does Round to nearest aligned value as stated in the comment, which
yields a different result. If I comment the round calculation in
clamp_align like this: x = (x /*+ (1  (align - 1))*/)  mask,
I get it fixed too, because this way the calculation is the same then.

Signed-off-by: Herton Ronaldo Krzesinski her...@mandriva.com.br
---
 drivers/media/video/saa7134/saa7134-video.c |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

Probaly this should be sent to stable as well (= 2.6.31)

diff --git a/drivers/media/video/saa7134/saa7134-video.c 
b/drivers/media/video/saa7134/saa7134-video.c
index ba87128..e305c16 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1640,8 +1640,15 @@ static int saa7134_try_fmt_vid_cap(struct file *file, 
void *priv,
}
 
f-fmt.pix.field = field;
-   v4l_bound_align_image(f-fmt.pix.width, 48, maxw, 2,
- f-fmt.pix.height, 32, maxh, 0, 0);
+   if (f-fmt.pix.width   48)
+   f-fmt.pix.width  = 48;
+   if (f-fmt.pix.height  32)
+   f-fmt.pix.height = 32;
+   if (f-fmt.pix.width  maxw)
+   f-fmt.pix.width = maxw;
+   if (f-fmt.pix.height  maxh)
+   f-fmt.pix.height = maxh;
+   f-fmt.pix.width = ~0x03;
f-fmt.pix.bytesperline =
(f-fmt.pix.width * fmt-depth)  3;
f-fmt.pix.sizeimage =
-- 
1.6.6

--
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] saa7134: add support for one more remote control for Avermedia M135A

2010-03-19 Thread Herton Ronaldo Krzesinski
Em Sex 19 Mar 2010, às 18:56:57, Mauro Carvalho Chehab escreveu:
 Hi Herton,
 
 Herton Ronaldo Krzesinski wrote:
  This change adds support for one more remote control type for Avermedia
  M135A. The new remote control reports slightly different codes, and was
  necessary to extend the mask_keycode to differentiate between original
  remote control. One of the remote controls I had matched the original
  binding, but some keys reported duplicated codes, probably because the
  previous mask_keycode missing valid bits, so this should fix also
  original remote control support (The keys bellow aren't ok comment).
 
 It would be a way better to extend it to use the full address+command scancode
 (16 bits, being 13 or 14 used). This would allow using this board with
 universal IR's and other third party ones.
 
 That's said, I have one of such board here, with one IR control (mine has the
 small control labaled RM-JX).
 
 As I have some things to do with IR core support, I'll do some tests in order
 to extend the IR support on saa7134 in order to get the full IR code and remap
 this IR.

Ok, when you have done it feel free to ask me to test any patches you have
etc., my control is labeled RM-K6, supplied by Avermedia I suppose to Positivo
(this controler comes with Positivo PC-TV machine with Avermedia card) , and
the original IR control unfortunately I don't have anymore here to test. I
suppose there would be more control types as well which Avermedia ships...

 
  
  Signed-off-by: Herton Ronaldo Krzesinski her...@mandriva.com.br
  ---
   drivers/media/IR/ir-keymaps.c   |  141 
  +++-
   drivers/media/video/saa7134/saa7134-input.c |2 
   2 files changed, 97 insertions(+), 46 deletions(-)
  
  (sorry this is a resend of previous patch, I forgot [PATCH] in subject)
  
  diff -p -up linux-2.6.33.1-1.1mnb/drivers/media/IR/ir-keymaps.c.orig 
  linux-2.6.33.1-1.1mnb/drivers/media/IR/ir-keymaps.c
  --- linux-2.6.33.1-1.1mnb/drivers/media/IR/ir-keymaps.c.orig
  2010-03-18 22:25:12.0 -0300
  +++ linux-2.6.33.1-1.1mnb/drivers/media/IR/ir-keymaps.c 2010-03-18 
  22:46:29.0 -0300
  @@ -122,51 +122,102 @@ EXPORT_SYMBOL_GPL(ir_codes_avermedia_dvb
   
   /* Mauro Carvalho Chehab mche...@infradead.org */
   static struct ir_scancode ir_codes_avermedia_m135a[] = {
  -   { 0x00, KEY_POWER2 },
  -   { 0x2e, KEY_DOT },  /* '.' */
  -   { 0x01, KEY_MODE }, /* TV/FM */
  -
  -   { 0x05, KEY_1 },
  -   { 0x06, KEY_2 },
  -   { 0x07, KEY_3 },
  -   { 0x09, KEY_4 },
  -   { 0x0a, KEY_5 },
  -   { 0x0b, KEY_6 },
  -   { 0x0d, KEY_7 },
  -   { 0x0e, KEY_8 },
  -   { 0x0f, KEY_9 },
  -   { 0x11, KEY_0 },
  -
  -   { 0x13, KEY_RIGHT },/* - */
  -   { 0x12, KEY_LEFT }, /* - */
  -
  -   { 0x17, KEY_SLEEP },/* Capturar Imagem */
  -   { 0x10, KEY_SHUFFLE },  /* Amostra */
  -
  -   /* FIXME: The keys bellow aren't ok */
  -
  -   { 0x43, KEY_CHANNELUP },
  -   { 0x42, KEY_CHANNELDOWN },
  -   { 0x1f, KEY_VOLUMEUP },
  -   { 0x1e, KEY_VOLUMEDOWN },
  -   { 0x0c, KEY_ENTER },
  -
  -   { 0x14, KEY_MUTE },
  -   { 0x08, KEY_AUDIO },
  -
  -   { 0x03, KEY_TEXT },
  -   { 0x04, KEY_EPG },
  -   { 0x2b, KEY_TV2 },  /* TV2 */
  -
  -   { 0x1d, KEY_RED },
  -   { 0x1c, KEY_YELLOW },
  -   { 0x41, KEY_GREEN },
  -   { 0x40, KEY_BLUE },
  -
  -   { 0x1a, KEY_PLAYPAUSE },
  -   { 0x19, KEY_RECORD },
  -   { 0x18, KEY_PLAY },
  -   { 0x1b, KEY_STOP },
  +   /* Remote control type 01 (32/54 keys) */
  +   { 0x100, KEY_POWER2 },
  +   { 0x12e, KEY_DOT }, /* '.' */
  +   { 0x101, KEY_MODE },/* TV/FM */
  +
  +   { 0x105, KEY_1 },
  +   { 0x106, KEY_2 },
  +   { 0x107, KEY_3 },
  +   { 0x109, KEY_4 },
  +   { 0x10a, KEY_5 },
  +   { 0x10b, KEY_6 },
  +   { 0x10d, KEY_7 },
  +   { 0x10e, KEY_8 },
  +   { 0x10f, KEY_9 },
  +   { 0x111, KEY_0 },
  +
  +   { 0x113, KEY_RIGHT },   /* - */
  +   { 0x112, KEY_LEFT },/* - */
  +
  +   { 0x117, KEY_SHUFFLE }, /* Capturar Imagem */
  +   { 0x110, KEY_F13 }, /* Amostra */
  +
  +   { 0x183, KEY_CHANNELUP },
  +   { 0x182, KEY_CHANNELDOWN },
  +   { 0x11f, KEY_VOLUMEUP },
  +   { 0x11e, KEY_VOLUMEDOWN },
  +   { 0x10c, KEY_ENTER },
  +
  +   { 0x114, KEY_MUTE },
  +   { 0x108, KEY_AUDIO },
  +
  +   { 0x103, KEY_TEXT },
  +   { 0x104, KEY_EPG },
  +   { 0x12b, KEY_TV2 }, /* TV2 */
  +
  +   { 0x11d, KEY_RED },
  +   { 0x11c, KEY_YELLOW },
  +   { 0x181, KEY_GREEN },
  +   { 0x180, KEY_BLUE },
  +
  +   { 0x11a, KEY_PLAYPAUSE },
  +   { 0x119, KEY_RECORD },
  +   { 0x118, KEY_PLAY },
  +   { 0x11b, KEY_STOP },
  +
  +   /* Remote control type 04 (44 keys) */
  +   { 0x201, KEY_POWER2 },
  +   { 0x206, KEY_MUTE },
  +   { 0x208, KEY_MODE },
  +
  +   { 0x209, KEY_1 },
  +   { 0x20a, KEY_2 },
  +   { 0x20b, KEY_3 },
  +   { 0x20c, KEY_4 },
  +   { 0x20d, KEY_5 },
  +   { 0x20e, KEY_6

V4L1 compatibility broken for VIDIOCGTUNER with radio

2009-12-03 Thread Herton Ronaldo Krzesinski
Hi,

After commit 9bedc7f (V4L/DVB (12429): v4l2-ioctl: fix G_STD and G_PARM 
default handlers), radio software using V4L1 stopped to work on a saa7134 
card, a git bisect pointed to this commit introducing the regression. All 
VIDIOCGTUNER calls on a v4l1 application are returning -EINVAL after this 
commit.

Investigating the issue, it turns out that v4l1_compat_get_tuner calls 
VIDIOC_G_STD ioctl, but as it is a radio device (saa7134-radio) it now is 
returning -EINVAL to user space applications which are being confused about 
this.

May be VIDIOC_G_STD change in the commit above should be reverted, or 
v4l1_compat_get_tuner changed to not return error with G_STD, or not call 
G_STD ioctl for a radio device?

--
[]'s
Herton
--
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