From db8a695658cda21eacfa2a5e3b15e8964bfb93ef Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 21 Aug 2007 01:24:42 -0300 Subject: V4L/DVB (6127): tuner: kill i2c_client interface to tuner sub-drivers To ease the conversion of the analog tuner sub-drivers into dvb_frontend style tuner modules, we must remove the i2c_client interface. dvb_frontend style tuner modules use i2c_transfer directly on the i2c_adapter. This change only alters the interface between tuner.ko and the tuner sub-drivers. The v4l2 / i2c_client interface to tuner.ko remains intact. This patch adds inline functions tuner_i2c_xfer_send, and tuner_i2c_xfer_recv, to replace i2c_master_send and i2c_master_recv inside the tuner sub-drivers. Signed-off-by: Michael Krufky Acked-by: Hans Verkuil Acked-by: Mike Isely Acked-by: Steven Toth Acked-by: Patrick Boettcher Acked-by: Jarod Wilson Acked-by: Trent Piepho Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/tuner-i2c.h | 70 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 drivers/media/video/tuner-i2c.h (limited to 'drivers/media/video/tuner-i2c.h') diff --git a/drivers/media/video/tuner-i2c.h b/drivers/media/video/tuner-i2c.h new file mode 100644 index 00000000000..159019ec337 --- /dev/null +++ b/drivers/media/video/tuner-i2c.h @@ -0,0 +1,70 @@ +/* + tuner-i2c.h - i2c interface for different tuners + + Copyright (C) 2007 Michael Krufky (mkrufky@linuxtv.org) + + 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. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __TUNER_I2C_H__ +#define __TUNER_I2C_H__ + +#include + +struct tuner_i2c_props { + u8 addr; + struct i2c_adapter *adap; +}; + +static inline int tuner_i2c_xfer_send(struct tuner_i2c_props *props, char *buf, int len) +{ + struct i2c_msg msg = { .addr = props->addr, .flags = 0, + .buf = buf, .len = len }; + int ret = i2c_transfer(props->adap, &msg, 1); + + return (ret == 1) ? len : ret; +} + +static inline int tuner_i2c_xfer_recv(struct tuner_i2c_props *props, char *buf, int len) +{ + struct i2c_msg msg = { .addr = props->addr, .flags = I2C_M_RD, + .buf = buf, .len = len }; + int ret = i2c_transfer(props->adap, &msg, 1); + + return (ret == 1) ? len : ret; +} + +#ifndef __TUNER_DRIVER_H__ +#define tuner_warn(fmt, arg...) do {\ + printk(KERN_WARNING PREFIX "%d-%04x: " fmt, \ + i2c_adapter_id(priv->i2c_props.adap), priv->i2c_props.addr , ##arg); } while (0) +#define tuner_info(fmt, arg...) do {\ + printk(KERN_INFO PREFIX "%d-%04x: " fmt, \ + i2c_adapter_id(priv->i2c_props.adap), priv->i2c_props.addr , ##arg); } while (0) +#define tuner_dbg(fmt, arg...) do {\ + if ((debug)) \ + printk(KERN_DEBUG PREFIX "%d-%04x: " fmt, \ + i2c_adapter_id(priv->i2c_props.adap), priv->i2c_props.addr , ##arg); } while (0) +#endif /* __TUNER_DRIVER_H__ */ + +#endif /* __TUNER_I2C_H__ */ + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * --------------------------------------------------------------------------- + * Local variables: + * c-basic-offset: 8 + * End: + */ -- cgit v1.2.3