switch (priv->ver) {
case TDA8290 | TDA8275:
- strlcpy(t->i2c.name, "tda8290+75", sizeof(t->i2c.name));
+ strlcpy(t->i2c->name, "tda8290+75", sizeof(t->i2c->name));
break;
case TDA8295 | TDA8275:
- strlcpy(t->i2c.name, "tda8295+75", sizeof(t->i2c.name));
+ strlcpy(t->i2c->name, "tda8295+75", sizeof(t->i2c->name));
break;
case TDA8290 | TDA8275A:
- strlcpy(t->i2c.name, "tda8290+75a", sizeof(t->i2c.name));
+ strlcpy(t->i2c->name, "tda8290+75a", sizeof(t->i2c->name));
break;
case TDA8295 | TDA8275A:
- strlcpy(t->i2c.name, "tda8295+75a", sizeof(t->i2c.name));
+ strlcpy(t->i2c->name, "tda8295+75a", sizeof(t->i2c->name));
break;
case TDA8290 | TDA18271:
- strlcpy(t->i2c.name, "tda8290+18271", sizeof(t->i2c.name));
+ strlcpy(t->i2c->name, "tda8290+18271", sizeof(t->i2c->name));
break;
case TDA8295 | TDA18271:
- strlcpy(t->i2c.name, "tda8295+18271", sizeof(t->i2c.name));
+ strlcpy(t->i2c->name, "tda8295+18271", sizeof(t->i2c->name));
break;
default:
return -EINVAL;
return -ENOMEM;
fe->analog_demod_priv = priv;
- priv->i2c_props.addr = t->i2c.addr;
- priv->i2c_props.adap = t->i2c.adapter;
+ priv->i2c_props.addr = t->i2c->addr;
+ priv->i2c_props.adap = t->i2c->adapter;
priv->cfg.config = &t->config;
priv->cfg.tuner_callback = t->tuner_callback;
priv->t = t;
} else if (priv->ver & TDA8295)
tda8295_init_if(fe);
- tuner_info("type set to %s\n", t->i2c.name);
+ tuner_info("type set to %s\n", t->i2c->name);
t->mode = V4L2_TUNER_ANALOG_TV;
int tda8290_probe(struct tuner *t)
{
struct tuner_i2c_props i2c_props = {
- .adap = t->i2c.adapter,
- .addr = t->i2c.addr
+ .adap = t->i2c->adapter,
+ .addr = t->i2c->addr
};
unsigned char soft_reset[] = { 0x00, 0x00 };
module_param_named(debug, tda9887_debug, int, 0644);
#define tda9887_info(fmt, arg...) do {\
- printk(KERN_INFO "%s %d-%04x: " fmt, priv->t->i2c.name, \
- i2c_adapter_id(priv->t->i2c.adapter), \
- priv->t->i2c.addr, ##arg); } while (0)
+ printk(KERN_INFO "%s %d-%04x: " fmt, priv->t->i2c->name, \
+ i2c_adapter_id(priv->t->i2c->adapter), \
+ priv->t->i2c->addr, ##arg); } while (0)
#define tda9887_dbg(fmt, arg...) do {\
if (tda9887_debug) \
- printk(KERN_INFO "%s %d-%04x: " fmt, priv->t->i2c.name, \
- i2c_adapter_id(priv->t->i2c.adapter), \
- priv->t->i2c.addr, ##arg); } while (0)
+ printk(KERN_INFO "%s %d-%04x: " fmt, priv->t->i2c->name, \
+ i2c_adapter_id(priv->t->i2c->adapter), \
+ priv->t->i2c->addr, ##arg); } while (0)
struct tda9887_priv {
struct tuner_i2c_props i2c_props;
return -ENOMEM;
t->fe.analog_demod_priv = priv;
- priv->i2c_props.addr = t->i2c.addr;
- priv->i2c_props.adap = t->i2c.adapter;
+ priv->i2c_props.addr = t->i2c->addr;
+ priv->i2c_props.adap = t->i2c->adapter;
priv->t = t;
- strlcpy(t->i2c.name, "tda9887", sizeof(t->i2c.name));
+ strlcpy(t->i2c->name, "tda9887", sizeof(t->i2c->name));
- tda9887_info("tda988[5/6/7] found @ 0x%x (%s)\n", t->i2c.addr,
- t->i2c.driver->driver.name);
+ tda9887_info("tda988[5/6/7] found @ 0x%x (%s)\n", t->i2c->addr,
+ t->i2c->driver->driver.name);
t->fe.ops.analog_demod_ops = &tda9887_tuner_ops;
static void tuner_i2c_address_check(struct tuner *t)
{
if ((t->type == UNSET || t->type == TUNER_ABSENT) ||
- ((t->i2c.addr < 0x64) || (t->i2c.addr > 0x6f)))
+ ((t->i2c->addr < 0x64) || (t->i2c->addr > 0x6f)))
return;
tuner_warn("====================== WARNING! ======================\n");
tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n");
tuner_warn("will soon be dropped. This message indicates that your\n");
tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n",
- t->i2c.name, t->i2c.addr);
+ t->i2c->name, t->i2c->addr);
tuner_warn("To ensure continued support for your device, please\n");
tuner_warn("send a copy of this message, along with full dmesg\n");
tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n");
tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n");
tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n",
- t->i2c.adapter->name, t->i2c.addr, t->type,
+ t->i2c->adapter->name, t->i2c->addr, t->type,
tuners[t->type].name);
tuner_warn("====================== WARNING! ======================\n");
}
.type = t->type,
.tun = &tuners[t->type]
};
- simple_tuner_attach(&t->fe, t->i2c.adapter, t->i2c.addr, &cfg);
+ simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr, &cfg);
}
static void set_type(struct i2c_client *c, unsigned int type,
switch (t->type) {
case TUNER_MT2032:
- microtune_attach(&t->fe, t->i2c.adapter, t->i2c.addr);
+ microtune_attach(&t->fe, t->i2c->adapter, t->i2c->addr);
break;
case TUNER_PHILIPS_TDA8290:
{
break;
}
case TUNER_TEA5767:
- if (tea5767_attach(&t->fe, t->i2c.adapter, t->i2c.addr) == NULL) {
+ if (tea5767_attach(&t->fe, t->i2c->adapter, t->i2c->addr) == NULL) {
t->type = TUNER_ABSENT;
t->mode_mask = T_UNINITIALIZED;
return;
t->mode_mask = T_RADIO;
break;
case TUNER_TEA5761:
- if (tea5761_attach(&t->fe, t->i2c.adapter, t->i2c.addr) == NULL) {
+ if (tea5761_attach(&t->fe, t->i2c->adapter, t->i2c->addr) == NULL) {
t->type = TUNER_ABSENT;
t->mode_mask = T_UNINITIALIZED;
return;
if (((NULL == ops) ||
((NULL == ops->set_tv_freq) && (NULL == ops->set_radio_freq))) &&
(fe_tuner_ops->set_analog_params)) {
- strlcpy(t->i2c.name, fe_tuner_ops->info.name, sizeof(t->i2c.name));
+ strlcpy(t->i2c->name, fe_tuner_ops->info.name,
+ sizeof(t->i2c->name));
t->fe.ops.analog_demod_ops = &tuner_core_ops;
t->fe.analog_demod_priv = t;
}
- tuner_info("type set to %s\n", t->i2c.name);
+ tuner_info("type set to %s\n", t->i2c->name);
if (t->mode_mask == T_UNINITIALIZED)
t->mode_mask = new_mode_mask;
*/
static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
{
+ struct i2c_client *client;
struct tuner *t;
- client_template.adapter = adap;
- client_template.addr = addr;
+ client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+ if (NULL == client)
+ return -ENOMEM;
t = kzalloc(sizeof(struct tuner), GFP_KERNEL);
- if (NULL == t)
+ if (NULL == t) {
+ kfree(client);
return -ENOMEM;
- memcpy(&t->i2c, &client_template, sizeof(struct i2c_client));
- i2c_set_clientdata(&t->i2c, t);
+ }
+ t->i2c = client;
+ client_template.adapter = adap;
+ client_template.addr = addr;
+ memcpy(client, &client_template, sizeof(struct i2c_client));
+ i2c_set_clientdata(client, t);
t->type = UNSET;
t->audmode = V4L2_TUNER_MODE_STEREO;
t->mode_mask = T_UNINITIALIZED;
int i,rc;
memset(buffer, 0, sizeof(buffer));
- rc = i2c_master_recv(&t->i2c, buffer, sizeof(buffer));
+ rc = i2c_master_recv(client, buffer, sizeof(buffer));
tuner_info("I2C RECV = ");
for (i=0;i<rc;i++)
printk("%02x ",buffer[i]);
if (!no_autodetect) {
switch (addr) {
case 0x10:
- if (tea5761_autodetection(t->i2c.adapter, t->i2c.addr) != EINVAL) {
+ if (tea5761_autodetection(t->i2c->adapter, t->i2c->addr) != EINVAL) {
t->type = TUNER_TEA5761;
t->mode_mask = T_RADIO;
t->mode = T_STANDBY;
}
break;
case 0x60:
- if (tea5767_autodetection(t->i2c.adapter, t->i2c.addr) != EINVAL) {
+ if (tea5767_autodetection(t->i2c->adapter, t->i2c->addr) != EINVAL) {
t->type = TUNER_TEA5767;
t->mode_mask = T_RADIO;
t->mode = T_STANDBY;
/* Should be just before return */
register_client:
tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
- i2c_attach_client (&t->i2c);
- set_type (&t->i2c,t->type, t->mode_mask, t->config, t->tuner_callback);
+ i2c_attach_client (client);
+ set_type (client,t->type, t->mode_mask, t->config, t->tuner_callback);
return 0;
}
struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
int err;
- err = i2c_detach_client(&t->i2c);
+ err = i2c_detach_client(t->i2c);
if (err) {
tuner_warn
("Client deregistration failed, client not detached.\n");
ops->release(&t->fe);
kfree(t);
+ kfree(client);
return 0;
}
struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
if (tuner_debug>1)
- v4l_i2c_print_ioctl(&(t->i2c),cmd);
+ v4l_i2c_print_ioctl(client,cmd);
switch (cmd) {
/* --- configuration --- */
struct tuner {
/* device */
- struct i2c_client i2c;
+ struct i2c_client *i2c;
unsigned int type; /* chip type */
/* ------------------------------------------------------------------------ */
#define tuner_warn(fmt, arg...) do {\
- printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
- i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
+ printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c->driver->driver.name, \
+ i2c_adapter_id(t->i2c->adapter), t->i2c->addr , ##arg); } while (0)
#define tuner_info(fmt, arg...) do {\
- printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
- i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
+ printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c->driver->driver.name, \
+ i2c_adapter_id(t->i2c->adapter), t->i2c->addr , ##arg); } while (0)
#define tuner_dbg(fmt, arg...) do {\
extern int tuner_debug; \
if (tuner_debug) \
- printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
- i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
+ printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c->driver->driver.name, \
+ i2c_adapter_id(t->i2c->adapter), t->i2c->addr , ##arg); } while (0)
#endif /* __TUNER_DRIVER_H__ */