aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tuner-i2c.h
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-08-21 00:24:42 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:07:34 -0400
commitdb8a695658cda21eacfa2a5e3b15e8964bfb93ef (patch)
treeac69f32af5b52f78ad65ad1125d330aa19c7bdda /drivers/media/video/tuner-i2c.h
parent293197cd0f34eb6bfb5492a63a878575b69e9df4 (diff)
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 <mkrufky@linuxtv.org> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Acked-by: Mike Isely <isely@pobox.com> Acked-by: Steven Toth <stoth@hauppauge.com> Acked-by: Patrick Boettcher <pb@linuxtv.org> Acked-by: Jarod Wilson <jwilson@redhat.com> Acked-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tuner-i2c.h')
-rw-r--r--drivers/media/video/tuner-i2c.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/drivers/media/video/tuner-i2c.h b/drivers/media/video/tuner-i2c.h
new file mode 100644
index 000000000000..159019ec3373
--- /dev/null
+++ b/drivers/media/video/tuner-i2c.h
@@ -0,0 +1,70 @@
1/*
2 tuner-i2c.h - i2c interface for different tuners
3
4 Copyright (C) 2007 Michael Krufky (mkrufky@linuxtv.org)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef __TUNER_I2C_H__
22#define __TUNER_I2C_H__
23
24#include <linux/i2c.h>
25
26struct tuner_i2c_props {
27 u8 addr;
28 struct i2c_adapter *adap;
29};
30
31static inline int tuner_i2c_xfer_send(struct tuner_i2c_props *props, char *buf, int len)
32{
33 struct i2c_msg msg = { .addr = props->addr, .flags = 0,
34 .buf = buf, .len = len };
35 int ret = i2c_transfer(props->adap, &msg, 1);
36
37 return (ret == 1) ? len : ret;
38}
39
40static inline int tuner_i2c_xfer_recv(struct tuner_i2c_props *props, char *buf, int len)
41{
42 struct i2c_msg msg = { .addr = props->addr, .flags = I2C_M_RD,
43 .buf = buf, .len = len };
44 int ret = i2c_transfer(props->adap, &msg, 1);
45
46 return (ret == 1) ? len : ret;
47}
48
49#ifndef __TUNER_DRIVER_H__
50#define tuner_warn(fmt, arg...) do {\
51 printk(KERN_WARNING PREFIX "%d-%04x: " fmt, \
52 i2c_adapter_id(priv->i2c_props.adap), priv->i2c_props.addr , ##arg); } while (0)
53#define tuner_info(fmt, arg...) do {\
54 printk(KERN_INFO PREFIX "%d-%04x: " fmt, \
55 i2c_adapter_id(priv->i2c_props.adap), priv->i2c_props.addr , ##arg); } while (0)
56#define tuner_dbg(fmt, arg...) do {\
57 if ((debug)) \
58 printk(KERN_DEBUG PREFIX "%d-%04x: " fmt, \
59 i2c_adapter_id(priv->i2c_props.adap), priv->i2c_props.addr , ##arg); } while (0)
60#endif /* __TUNER_DRIVER_H__ */
61
62#endif /* __TUNER_I2C_H__ */
63
64/*
65 * Overrides for Emacs so that we follow Linus's tabbing style.
66 * ---------------------------------------------------------------------------
67 * Local variables:
68 * c-basic-offset: 8
69 * End:
70 */