~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/media/video/cx231xx/cx231xx-i2c.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
      }                                                 \
55
55
} while (0)
56
56
 
 
57
static inline bool is_tuner(struct cx231xx *dev, struct cx231xx_i2c *bus,
 
58
                        const struct i2c_msg *msg, int tuner_type)
 
59
{
 
60
        if (bus->nr != dev->board.tuner_i2c_master)
 
61
                return false;
 
62
 
 
63
        if (msg->addr != dev->board.tuner_addr)
 
64
                return false;
 
65
 
 
66
        if (dev->tuner_type != tuner_type)
 
67
                return false;
 
68
 
 
69
        return true;
 
70
}
 
71
 
57
72
/*
58
73
 * cx231xx_i2c_send_bytes()
59
74
 */
71
86
        u16 saddr = 0;
72
87
        u8 need_gpio = 0;
73
88
 
74
 
        if ((bus->nr == 1) && (msg->addr == 0x61)
75
 
            && (dev->tuner_type == TUNER_XC5000)) {
76
 
 
 
89
        if (is_tuner(dev, bus, msg, TUNER_XC5000)) {
77
90
                size = msg->len;
78
91
 
79
92
                if (size == 2) {        /* register write sub addr */
180
193
        u16 saddr = 0;
181
194
        u8 need_gpio = 0;
182
195
 
183
 
        if ((bus->nr == 1) && (msg->addr == 0x61)
184
 
            && dev->tuner_type == TUNER_XC5000) {
185
 
 
 
196
        if (is_tuner(dev, bus, msg, TUNER_XC5000)) {
186
197
                if (msg->len == 2)
187
198
                        saddr = msg->buf[0] << 8 | msg->buf[1];
188
199
                else if (msg->len == 1)
274
285
        else if (msg1->len == 1)
275
286
                saddr = msg1->buf[0];
276
287
 
277
 
        if ((bus->nr == 1) && (msg2->addr == 0x61)
278
 
            && dev->tuner_type == TUNER_XC5000) {
279
 
 
 
288
        if (is_tuner(dev, bus, msg2, TUNER_XC5000)) {
280
289
                if ((msg2->len < 16)) {
281
290
 
282
291
                        dprintk1(1,
454
463
        [0x32 >> 1] = "GeminiIII",
455
464
        [0x02 >> 1] = "Aquarius",
456
465
        [0xa0 >> 1] = "eeprom",
457
 
        [0xc0 >> 1] = "tuner/XC3028",
458
 
        [0xc2 >> 1] = "tuner/XC5000",
 
466
        [0xc0 >> 1] = "tuner",
 
467
        [0xc2 >> 1] = "tuner",
459
468
};
460
469
 
461
470
/*