Commit 83526190 authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab

V4L/DVB (13445): cx18: Use per cx18 instance init data for ir-kbd-i2c instead of const data

This change creates per cx18 instances of IR_i2c_init_data for handing over
initialization data to ir-kbd-i2c, since that module wants non-const data
even though it never modifies the data.
Signed-off-by: default avatarAndy Walls <awalls@radix.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ad2fe2d4
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
#define CX18_HW_Z8F0811_IR_HAUP (CX18_HW_Z8F0811_IR_RX_HAUP | \ #define CX18_HW_Z8F0811_IR_HAUP (CX18_HW_Z8F0811_IR_RX_HAUP | \
CX18_HW_Z8F0811_IR_TX_HAUP) CX18_HW_Z8F0811_IR_TX_HAUP)
#define CX18_HW_IR_ANY (CX18_HW_Z8F0811_IR_RX_HAUP | \
CX18_HW_Z8F0811_IR_TX_HAUP)
/* video inputs */ /* video inputs */
#define CX18_CARD_INPUT_VID_TUNER 1 #define CX18_CARD_INPUT_VID_TUNER 1
#define CX18_CARD_INPUT_SVIDEO1 2 #define CX18_CARD_INPUT_SVIDEO1 2
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <media/v4l2-ioctl.h> #include <media/v4l2-ioctl.h>
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
#include <media/tuner.h> #include <media/tuner.h>
#include <media/ir-kbd-i2c.h>
#include "cx18-mailbox.h" #include "cx18-mailbox.h"
#include "cx18-av-core.h" #include "cx18-av-core.h"
#include "cx23418.h" #include "cx23418.h"
...@@ -606,6 +607,8 @@ struct cx18 { ...@@ -606,6 +607,8 @@ struct cx18 {
struct i2c_algo_bit_data i2c_algo[2]; struct i2c_algo_bit_data i2c_algo[2];
struct cx18_i2c_algo_callback_data i2c_algo_cb_data[2]; struct cx18_i2c_algo_callback_data i2c_algo_cb_data[2];
struct IR_i2c_init_data ir_i2c_init_data;
/* gpio */ /* gpio */
u32 gpio_dir; u32 gpio_dir;
u32 gpio_val; u32 gpio_val;
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "cx18-gpio.h" #include "cx18-gpio.h"
#include "cx18-i2c.h" #include "cx18-i2c.h"
#include "cx18-irq.h" #include "cx18-irq.h"
#include <media/ir-kbd-i2c.h>
#define CX18_REG_I2C_1_WR 0xf15000 #define CX18_REG_I2C_1_WR 0xf15000
#define CX18_REG_I2C_1_RD 0xf15008 #define CX18_REG_I2C_1_RD 0xf15008
...@@ -97,17 +96,11 @@ static const char * const hw_devicenames[] = { ...@@ -97,17 +96,11 @@ static const char * const hw_devicenames[] = {
"ir_rx_z8f0811_haup", "ir_rx_z8f0811_haup",
}; };
static const struct IR_i2c_init_data z8f0811_ir_init_data = { static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw,
.ir_codes = &ir_codes_hauppauge_new_table, const char *type, u8 addr)
.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR,
.type = IR_TYPE_RC5,
.name = "CX23418 Z8F0811 Hauppauge",
};
static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type,
u8 addr)
{ {
struct i2c_board_info info; struct i2c_board_info info;
struct IR_i2c_init_data *init_data = &cx->ir_i2c_init_data;
unsigned short addr_list[2] = { addr, I2C_CLIENT_END }; unsigned short addr_list[2] = { addr, I2C_CLIENT_END };
memset(&info, 0, sizeof(struct i2c_board_info)); memset(&info, 0, sizeof(struct i2c_board_info));
...@@ -116,9 +109,11 @@ static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type, ...@@ -116,9 +109,11 @@ static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type,
/* Our default information for ir-kbd-i2c.c to use */ /* Our default information for ir-kbd-i2c.c to use */
switch (hw) { switch (hw) {
case CX18_HW_Z8F0811_IR_RX_HAUP: case CX18_HW_Z8F0811_IR_RX_HAUP:
info.platform_data = (void *) &z8f0811_ir_init_data; init_data->ir_codes = &ir_codes_hauppauge_new_table;
break; init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
default: init_data->type = IR_TYPE_RC5;
init_data->name = cx->card_name;
info.platform_data = init_data;
break; break;
} }
...@@ -154,8 +149,8 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) ...@@ -154,8 +149,8 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx)
return sd != NULL ? 0 : -1; return sd != NULL ? 0 : -1;
} }
if (hw & CX18_HW_Z8F0811_IR_HAUP) if (hw & CX18_HW_IR_ANY)
return cx18_i2c_new_ir(adap, hw, type, hw_addrs[idx]); return cx18_i2c_new_ir(cx, adap, hw, type, hw_addrs[idx]);
/* Is it not an I2C device or one we do not wish to register? */ /* Is it not an I2C device or one we do not wish to register? */
if (!hw_addrs[idx]) if (!hw_addrs[idx])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment