From patchwork Fri Jul 17 20:35:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Walls X-Patchwork-Id: 1328 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Fri, 17 Jul 2009 20:34:23 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Fri, 17 Jul 2009 17:36:13 -0300 (BRT) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MRu8M-0005c8-RB; Fri, 17 Jul 2009 20:34:23 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753174AbZGQUeB (ORCPT + 1 other); Fri, 17 Jul 2009 16:34:01 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754320AbZGQUeA (ORCPT ); Fri, 17 Jul 2009 16:34:00 -0400 Received: from mail1.radix.net ([207.192.128.31]:37352 "EHLO mail1.radix.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753636AbZGQUeA (ORCPT ); Fri, 17 Jul 2009 16:34:00 -0400 Received: from [192.168.1.2] (02-180.155.popsite.net [66.217.132.180]) (authenticated bits=0) by mail1.radix.net (8.13.4/8.13.4) with ESMTP id n6HKXS6E018313; Fri, 17 Jul 2009 16:33:29 -0400 (EDT) Subject: [PATCH 1/3] ir-kbd-i2c: Allow use of ir-kdb-i2c internal get_key funcs and set ir_type From: Andy Walls To: Jean Delvare Cc: linux-media@vger.kernel.org, Jarod Wilson , Mark Lord , Mike Isely , Hans Verkuil , Mauro Carvalho Chehab , Janne Grunau In-Reply-To: <1247862585.10066.16.camel@palomino.walls.org> References: <1247862585.10066.16.camel@palomino.walls.org> Date: Fri, 17 Jul 2009 16:35:37 -0400 Message-Id: <1247862937.10066.21.camel@palomino.walls.org> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 (2.24.5-1.fc10) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch augments the init data passed by bridge drivers to ir-kbd-i2c so that the ir_type can be set explicitly and so ir-kbd-i2c internal get_key functions can be reused without requiring symbols from ir-kbd-i2c in the bridge driver. Regards, Andy --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -r d754a2d5a376 linux/drivers/media/video/ir-kbd-i2c.c --- a/linux/drivers/media/video/ir-kbd-i2c.c Wed Jul 15 07:28:02 2009 -0300 +++ b/linux/drivers/media/video/ir-kbd-i2c.c Fri Jul 17 16:05:28 2009 -0400 @@ -478,7 +480,34 @@ ir_codes = init_data->ir_codes; name = init_data->name; + if (init_data->type) + ir_type = init_data->type; ir->get_key = init_data->get_key; + switch (init_data->internal_get_key_func) { + case IR_KBD_GET_KEY_PIXELVIEW: + ir->get_key = get_key_pixelview; + break; + case IR_KBD_GET_KEY_PV951: + ir->get_key = get_key_pv951; + break; + case IR_KBD_GET_KEY_HAUP: + ir->get_key = get_key_haup; + break; + case IR_KBD_GET_KEY_KNC1: + ir->get_key = get_key_knc1; + break; + case IR_KBD_GET_KEY_FUSIONHDTV: + ir->get_key = get_key_fusionhdtv; + break; + case IR_KBD_GET_KEY_HAUP_XVR: + ir->get_key = get_key_haup_xvr; + break; + case IR_KBD_GET_KEY_AVERMEDIA_CARDBUS: + ir->get_key = get_key_avermedia_cardbus; + break; + default: + break; + } } /* Make sure we are all setup before going on */ diff -r d754a2d5a376 linux/include/media/ir-kbd-i2c.h --- a/linux/include/media/ir-kbd-i2c.h Wed Jul 15 07:28:02 2009 -0300 +++ b/linux/include/media/ir-kbd-i2c.h Fri Jul 17 16:05:28 2009 -0400 @@ -24,10 +24,27 @@ int (*get_key)(struct IR_i2c*, u32*, u32*); }; +enum ir_kbd_get_key_fn { + IR_KBD_GET_KEY_NONE = 0, + IR_KBD_GET_KEY_PIXELVIEW, + IR_KBD_GET_KEY_PV951, + IR_KBD_GET_KEY_HAUP, + IR_KBD_GET_KEY_KNC1, + IR_KBD_GET_KEY_FUSIONHDTV, + IR_KBD_GET_KEY_HAUP_XVR, + IR_KBD_GET_KEY_AVERMEDIA_CARDBUS, +}; + /* Can be passed when instantiating an ir_video i2c device */ struct IR_i2c_init_data { IR_KEYTAB_TYPE *ir_codes; const char *name; + int type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */ + /* + * Specify either a function pointer or a value indicating one of + * ir_kbd_i2c's internal get_key functions + */ int (*get_key)(struct IR_i2c*, u32*, u32*); + enum ir_kbd_get_key_fn internal_get_key_func; }; #endif