V4L/DVB: bttv: Move PV951 IR to the right driver
PATCH 1/3 V4L/DVB: bttv: Move PV951 IR to the right driver
In reply to a message not in the archivedrivers/media/video/bt8xx/bttv-i2c.c +0 -38
@@ -390,41 +390,3 @@ int __devinit init_bttv_i2c(struct bttv *btv)return btv->i2c_rc; } - -/* Instantiate the I2C IR receiver device, if present */ -void __devinit init_bttv_i2c_ir (struct bttv *btv) -{ -if (0 == btv->i2c_rc) { -struct i2c_board_info info; -/* The external IR receiver is at i2c address 0x34 (0x35 for -reads). Future Hauppauge cards will have an internal -receiver at 0x30 (0x31 for reads). In theory, both can be -fitted, and Hauppauge suggest an external overrides an -internal. - -That's why we probe 0x1a (~0x34) first. CB -*/ -const unsigned short addr_list[] = { -0x1a ,0x18 ,0x4b ,0x64 ,0x30 ,0x71 , -I2C_CLIENT_END - }; - -memset (&info,0 ,sizeof (struct i2c_board_info )); -strlcpy (info.type,"ir_video" ,I2C_NAME_SIZE ); -i2c_new_probed_device (&btv->c.i2c_adap, &info, addr_list); - } -} - -int __devexit fini_bttv_i2c(struct bttv *btv) -{ -if (0 != btv->i2c_rc) -return 0 ; - -return i2c_del_adapter (&btv->c.i2c_adap); -} - -/* -* Local variables: -* c-basic-offset: 8 -* End: -*/
drivers/media/video/bt8xx/bttv-input.c +77 -7
93 lines not on this page · raw message
drivers/media/video/bt8xx/bttv.h +0 -1
@@ -18,7 +18,6 @@#include <linux/i2c.h> #include <media/v4l2-device.h> #include <media/ir-common.h> -#include <media/ir-kbd-i2c.h> #include <media/i2c-addr.h> #include <media/tuner.h>
drivers/media/video/bt8xx/bttvp.h +10 -3
@@ -42,7 +42,7 @@#include <media/videobuf-dma-sg.h> #include <media/tveeprom.h> #include <media/ir-common.h> - +#include <media/ir-kbd-i2c.h> #include "bt848.h" #include "bttv.h"
@@ -271,6 +271,12 @@ int bttv_sub_del_devices(struct bttv_core *core);extern int no_overlay;/* ---------------------------------------------------------- */ +/* bttv-input.c */ + +extern void init_bttv_i2c_ir (struct bttv *btv); +extern int fini_bttv_i2c (struct bttv *btv); + +/* ---------------------------------------------------------- */ /* bttv-driver.c */ /* insmod options */
@@ -279,8 +285,6 @@ extern unsigned int bttv_debug;extern unsigned int bttv_gpio;extern void bttv_gpio_tracking (struct bttv *btv,char *comment);extern int init_bttv_i2c (struct bttv *btv); -extern void init_bttv_i2c_ir (struct bttv *btv); -extern int fini_bttv_i2c (struct bttv *btv);#define bttv_printk if (bttv_verbose) printk#define dprintk if (bttv_debug >= 1) printk
@@ -366,6 +370,9 @@ struct bttv {int has_remote;struct card_ir *remote; +/* I2C remote data */ +struct IR_i2c_init_data init_data; +/* locking */ spinlock_t s_lock;struct mutex lock;
drivers/media/video/ir-kbd-i2c.c +0 -29
@@ -146,26 +146,6 @@ static int get_key_pixelview(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)return 1 ; } -static int get_key_pv951 (struct IR_i2c *ir,u32 *ir_key,u32 *ir_raw) -{ -unsigned char b; - -/* poll IR chip */ -if (1 !=i2c_master_recv (ir->c, &b,1 )) { -dprintk (1 ,"read error\n" ); -return -EIO ; - } - -/* ignore 0xaa */ -if (b==0xaa ) -return 0 ; -dprintk (2 ,"key %02x\n" , b); - - *ir_key = b; - *ir_raw = b; -return 1 ; -} -static int get_key_fusionhdtv (struct IR_i2c *ir,u32 *ir_key,u32 *ir_raw) {unsigned char buf[4 ];
@@ -321,12 +301,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ir_type =IR_TYPE_OTHER ; ir_codes =RC_MAP_EMPTY ;break ; -case 0x4b : - name ="PV951" ; - ir->get_key = get_key_pv951; - ir_type =IR_TYPE_OTHER ; - ir_codes =RC_MAP_PV951 ; -break ;case 0x18 :case 0x1f :case 0x1a :
@@ -396,9 +370,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)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 ;
include/media/ir-kbd-i2c.h +0 -1
@@ -24,7 +24,6 @@ struct IR_i2c {enum ir_kbd_get_key_fn {IR_KBD_GET_KEY_CUSTOM =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 ,
Signature · 1 line
1.7.1
PATCH 2/3 V4L/DVB: Remove the usage of I2C_HW_B_CX2388x on ir-kbd-i2c.c
In reply to a message not in the archiveMove the cx88 specific initialization for Hauppauge XVR remotes into cx88-input, removing the need for test it inside ir-kbd-i2c.
The reference at cx88 for this symbol, at:
drivers/media/video/cx88/cx88-i2c.c: core->i2c_adap.id = I2C_HW_B_CX2388x;drivers/media/video/cx88/cx88-vp3054-i2c.c: vp3054_i2c->adap.id = I2C_HW_B_CX2388x;
Can't be removed yet, since lirc-i2c still uses it.
drivers/media/video/cx88/cx88-i2c.c +0 -38
@@ -183,41 +183,3 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)return core->i2c_rc; } - -void cx88_i2c_init_ir (struct cx88_core *core) -{ -/* Instantiate the IR receiver device, if present */ -if (0 == core->i2c_rc) { -struct i2c_board_info info; -const unsigned short addr_list[] = { -0x18 ,0x6b ,0x71 , -I2C_CLIENT_END - }; -const unsigned short *addrp; - -memset (&info,0 ,sizeof (struct i2c_board_info )); -strlcpy (info.type,"ir_video" ,I2C_NAME_SIZE ); -/* -* We can't call i2c_new_probed_device() because it uses -* quick writes for probing and at least some R receiver -* devices only reply to reads. -*/ -for (addrp = addr_list; *addrp !=I2C_CLIENT_END ; addrp++) { -if (i2c_smbus_xfer (&core->i2c_adap, *addrp,0 , -I2C_SMBUS_READ ,0 , -I2C_SMBUS_QUICK ,NULL ) >=0 ) { - info.addr = *addrp; -i2c_new_device (&core->i2c_adap, &info); -break ; - } - } - } -} - -/* ----------------------------------------------------------------------- */ - -/* -* Local variables: -* c-basic-offset: 8 -* End: -*/
drivers/media/video/cx88/cx88-input.c +46 -5
59 lines not on this page · raw message
drivers/media/video/cx88/cx88.h +5 -10
@@ -31,9 +31,8 @@#include <media/videobuf-dma-sg.h> #include <media/v4l2-chip-ident.h> #include <media/cx2341x.h> -#if defined(CONFIG_VIDEO_CX88_DVB ) || defined(CONFIG_VIDEO_CX88_DVB_MODULE )#include <media/videobuf-dvb.h> -#endif +#include <media/ir-kbd-i2c.h> #include "btcx-risc.h" #include "cx88-reg.h"
@@ -377,6 +376,9 @@ struct cx88_core {/* IR remote control state */ struct cx88_IR *ir; +/* I2C remote data */ +struct IR_i2c_init_data init_data; +struct mutex lock;/* various v4l controls */ u32 freq;
@@ -650,7 +652,6 @@ extern const struct videobuf_queue_ops cx8800_vbi_qops;/* cx88-i2c.c */ extern int cx88_i2c_init (struct cx88_core *core,struct pci_dev *pci); -extern void cx88_i2c_init_ir (struct cx88_core *core);/* ----------------------------------------------------------- */
@@ -688,6 +689,7 @@ int cx88_ir_fini(struct cx88_core *core);void cx88_ir_irq (struct cx88_core *core);int cx88_ir_start (struct cx88_core *core);void cx88_ir_stop (struct cx88_core *core); +extern void cx88_i2c_init_ir (struct cx88_core *core);/* ----------------------------------------------------------- */ /* cx88-mpeg.c */
@@ -707,10 +709,3 @@ int cx88_set_freq (struct cx88_core *core,struct v4l2_frequency *f);int cx88_get_control (struct cx88_core *core,struct v4l2_control *ctl);int cx88_set_control (struct cx88_core *core,struct v4l2_control *ctl);int cx88_video_mux (struct cx88_core *core,unsigned int input); - -/* -* Local variables: -* c-basic-offset: 8 -* End: -* kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off -*/
drivers/media/video/ir-kbd-i2c.c +0 -19
@@ -325,25 +325,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ir_type =IR_TYPE_RC5 ; ir_codes =RC_MAP_FUSIONHDTV_MCE ;break ; -case 0x0b : -case 0x47 : -case 0x71 : -if (adap->id == I2C_HW_B_CX2388x) { -/* Handled by cx88-input */ - name ="CX2388x remote" ; - ir_type =IR_TYPE_RC5 ; - ir->get_key = get_key_haup_xvr; -if (hauppauge ==1 ) { - ir_codes =RC_MAP_HAUPPAUGE_NEW ; - }else { - ir_codes =RC_MAP_RC5_TV ; - } - }else { -/* Handled by saa7134-input */ - name ="SAA713x remote" ; - ir_type =IR_TYPE_OTHER ; - } -break ;case 0x40 : name ="AVerMedia Cardbus remote" ; ir->get_key = get_key_avermedia_cardbus;
Signature · 1 line
1.7.1
PATCH 3/3 V4L/DVB: saa7134: get rid of I2C_HW_SAA7134
In reply to a message not in the archiveThe only reason for keeping I2C_HW_SAA7134 is to allow setting a per-device polling interval. Just move this info to the platform data, allowing drivers to change it per device, where needed.
drivers/media/video/ir-kbd-i2c.c +5 -7
@@ -259,15 +259,9 @@ static void ir_key_poll(struct IR_i2c *ir)static void ir_work (struct work_struct *work) { struct IR_i2c *ir = container_of(work, struct IR_i2c, work.work); -int polling_interval =100 ; - -/* MSI TV@nywhere Plus requires more frequent polling -otherwise it will miss some keypresses */ -if (ir->c->adapter->id ==I2C_HW_SAA7134 && ir->c->addr ==0x30 ) - polling_interval =50 ;ir_key_poll (ir); -schedule_delayed_work (&ir->work,msecs_to_jiffies (polling_interval)); +schedule_delayed_work (&ir->work,msecs_to_jiffies (ir->polling_interval)); }/* ----------------------------------------------------------------------- */
@@ -292,6 +286,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ir->c = client; ir->input = input_dev; + ir->polling_interval =DEFAULT_POLLING_INTERVAL ;i2c_set_clientdata (client, ir);switch (addr) {
@@ -343,6 +338,9 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)if (init_data->type) ir_type = init_data->type; +if (init_data->polling_interval) + ir->polling_interval = init_data->polling_interval; +switch (init_data->internal_get_key_func) {case IR_KBD_GET_KEY_CUSTOM :/* The bridge driver provided us its own function */
drivers/media/video/saa7134/saa7134-i2c.c +0 -1
@@ -328,7 +328,6 @@ static struct i2c_algorithm saa7134_algo = {static struct i2c_adapter saa7134_adap_template = { .owner =THIS_MODULE , .name ="saa7134" , - .id =I2C_HW_SAA7134 , .algo = &saa7134_algo, };
drivers/media/video/saa7134/saa7134-input.c +5 -0
@@ -959,6 +959,11 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) dev->init_data.name ="MSI TV@nywhere Plus" ; dev->init_data.get_key = get_key_msi_tvanywhere_plus; dev->init_data.ir_codes =RC_MAP_MSI_TVANYWHERE_PLUS ; +/* +* MSI TV@nyware Plus requires more frequent polling +* otherwise it will miss some keypresses +*/ + dev->init_data.polling_interval =50 ; info.addr =0x30 ;/* MSI TV@nywhere Plus controller doesn't seem to respond to probes unless we read something from
include/media/ir-kbd-i2c.h +7 -2
@@ -3,6 +3,8 @@#include <media/ir-common.h> +#define DEFAULT_POLLING_INTERVAL 100/* ms */ +struct IR_i2c ;struct IR_i2c {
@@ -15,6 +17,8 @@ struct IR_i2c {/* Used to avoid fast repeating */ unsigned char old; +u32 polling_interval;/* in ms */ +struct delayed_work work;char name[32 ];char phys[32 ];
@@ -34,8 +38,9 @@ enum ir_kbd_get_key_fn {/* Can be passed when instantiating an ir_video i2c device */ struct IR_i2c_init_data {char *ir_codes; -const char *name; -u64 type;/* IR_TYPE_RC5, etc */ +const char *name; +u64 type;/* IR_TYPE_RC5, etc */ +u32 polling_interval;/* 0 means DEFAULT_POLLING_INTERVAL */ /* * Specify either a function pointer or a value indicating one of * ir_kbd_i2c's internal get_key functions
Signature · 1 line
1.7.1