[Sun Aug 13 2006] [18:32:52] <mchehab> hi
[Sun Aug 13 2006] [18:34:32] <{ma}> this is what i implemented for the Hw I2C .. http://pastebin.ca/129383
[Sun Aug 13 2006] [18:34:53] <{ma}> how would you suggest to go on integrating it into the current cx88 scenario ?
[Sun Aug 13 2006] [18:36:42] <mchehab> looking...
[Sun Aug 13 2006] [18:39:20] <mchehab> hmm.. I should test your code.
[Sun Aug 13 2006] [18:39:36] <mchehab> Maybe it will just work fine with other cx88 boards.
[Sun Aug 13 2006] [18:40:21] <mchehab> I'm in doubt about this:
[Sun Aug 13 2006] [18:40:23] <mchehab> + core->int_status = status; + if (status & MO_INT_I2CDONE) + wake_up(&core->i2c_wq);
[Sun Aug 13 2006] [18:40:56] <mchehab> and this:
[Sun Aug 13 2006] [18:40:57] <mchehab> + init_waitqueue_head(&core->i2c_wq);
[Sun Aug 13 2006] [18:41:14] <{ma}> that is interrupt driven I2C
[Sun Aug 13 2006] [18:42:06] <{ma}> but i was wondering how to integrate that into the current cx88 implementation
[Sun Aug 13 2006] [18:42:23] <mchehab> that's the point...
[Sun Aug 13 2006] [18:42:39] <mchehab> currently, the functions are synchronous
[Sun Aug 13 2006] [18:43:01] <{ma}> currently, the i2c routines are just bitbanging
[Sun Aug 13 2006] [18:43:03] <mchehab> e.g., when you call I2C, it will return only after doing
[Sun Aug 13 2006] [18:43:09] <{ma}> that is not how it is in Hw
[Sun Aug 13 2006] [18:43:21] <{ma}> It is called upon in the case of an interrupt
[Sun Aug 13 2006] [18:43:25] <mchehab> cx88 and saa7134 are very close
[Sun Aug 13 2006] [18:43:33] <mchehab> in terms of source code
[Sun Aug 13 2006] [18:43:35] <{ma}> i wrote it from the cx88 specs
[Sun Aug 13 2006] [18:43:54] <{ma}> Ralph also agrees to it
[Sun Aug 13 2006] [18:44:38] <{ma}> but how it is to be integrated into the current scenario, i was thinking .. but the code as it is will work
[Sun Aug 13 2006] [18:44:42] <mchehab> hmm... on saa7134, there is this code:
[Sun Aug 13 2006] [18:44:43] <mchehab> i2c_is_busy
[Sun Aug 13 2006] [18:45:05] <{ma}> let 's not compare code from an another driver
[Sun Aug 13 2006] [18:45:17] <{ma}> there is pagemode operations as well for the cx88
[Sun Aug 13 2006] [18:45:32] <{ma}> ie the address sequencer is present
[Sun Aug 13 2006] [18:45:40] <mchehab> we need to compare. As I said, both codes are similar
[Sun Aug 13 2006] [18:45:41] <{ma}> which many devices do not have
[Sun Aug 13 2006] [18:46:06] <mchehab> so, we need to check how saa7134 does bind i2c support on it
[Sun Aug 13 2006] [18:46:09] <{ma}> currently on what i worked, the mantis also has a hw address sequencer
[Sun Aug 13 2006] [18:46:19] <{ma}> othre than the cx88
[Sun Aug 13 2006] [18:46:22] <mchehab> (of course, the i2c programming stuff will be different)
[Sun Aug 13 2006] [18:46:52] <{ma}> it does work as i tested it also, but that testing code did not have any V4L code at all
[Sun Aug 13 2006] [18:47:01] <{ma}> completely written from scratch
[Sun Aug 13 2006] [18:47:03] <mchehab> but, as saa7134 works fine with hardware i2c, the way i2c events are handled should be similar
[Sun Aug 13 2006] [18:47:21] <{ma}> saa7134 also doesn't implement HW I2C properly
[Sun Aug 13 2006] [18:47:43] <{ma}> it is a mixture of bitbanging and some convenience functions
[Sun Aug 13 2006] [18:47:48] <mchehab> hmm.. on saa7134, it have a loop to check for status. using irq for sure is better.
[Sun Aug 13 2006] [18:48:30] <{ma}> BTW, Ralph said he did not write the code for the CX88
[Sun Aug 13 2006] [18:48:44] <mchehab> weird to have his name on it then...
[Sun Aug 13 2006] [18:48:52] <{ma}> and he was not so happy to see the code in such a bad state and his copyright being in there
[Sun Aug 13 2006] [18:48:56] <mchehab> I dunno who included it
[Sun Aug 13 2006] [18:49:07] <{ma}> well, anyway ..
[Sun Aug 13 2006] [18:49:20] <mchehab> if he send a msg to V4L ML about it, I can remove its name from the driver
[Sun Aug 13 2006] [18:49:31] <mchehab> hmm...
[Sun Aug 13 2006] [18:49:33] <mchehab> better...
[Sun Aug 13 2006] [18:49:41] <{ma}> maybe somebody copied some of hios code into that for the bitbanging
[Sun Aug 13 2006] [18:49:43] <mchehab> he should send me a signed patch removing his name
[Sun Aug 13 2006] [18:49:59] <mchehab> c/c to mailing list
[Sun Aug 13 2006] [18:50:03] <{ma}> because he wrote bitbanging in the first place
[Sun Aug 13 2006] [18:50:11] <mchehab> ah
[Sun Aug 13 2006] [18:50:21] <{ma}> so many people copied his code
[Sun Aug 13 2006] [18:50:32] <{ma}> he said probably that could be a possible thing
[Sun Aug 13 2006] [18:50:49] <mchehab> on saa7134:
[Sun Aug 13 2006] [18:50:51] <mchehab> i2c_send_byte
[Sun Aug 13 2006] [18:51:00] <mchehab> ...
[Sun Aug 13 2006] [18:51:01] <mchehab> if (!i2c_is_busy_wait(dev))
[Sun Aug 13 2006] [18:51:01] <mchehab> return -EIO;
[Sun Aug 13 2006] [18:51:20] <{ma}> as i looked at saa7134 too, myself and ralph .. the implementation on saa7134 is also not correct
[Sun Aug 13 2006] [18:51:29] <mchehab> so, what saa7134 i2c implementation does is wait for i2c completion
[Sun Aug 13 2006] [18:51:33] <{ma}> -EIO is not correct in fact
[Sun Aug 13 2006] [18:51:39] <{ma}> it is -EREMOTEIO
[Sun Aug 13 2006] [18:51:52] <mchehab> ah, we need then to fix there.
[Sun Aug 13 2006] [18:51:54] <{ma}> i2c devices are called Remote devices
[Sun Aug 13 2006] [18:52:20] <mchehab> do you need asynchronous i2c ?
[Sun Aug 13 2006] [18:52:40] <{ma}> you mean interrupt driven .. ?
[Sun Aug 13 2006] [18:53:02] <{ma}> i have the logs on the other machine .. let me switch to it
[Sun Aug 13 2006] [18:53:05] <{ma}> one sec
[Sun Aug 13 2006] [18:53:29] <mchehab> no.
[Sun Aug 13 2006] [18:53:33] <mchehab> what I mean is:
[Sun Aug 13 2006] [18:53:56] <mchehab> the easiest way to make it work is to make i2c send/receive routines to wait for completion
[Sun Aug 13 2006] [18:54:10] <mchehab> this can be done using IRQ. No trouble with that.
[Sun Aug 13 2006] [18:54:35] <mchehab> we can make the routine to sleep until i2c completion or a timeout.
*** Logfile started
*** on Sun Aug 13 22:38:04 2006
[Sun Aug 13 2006] [22:38:04] <mchehab> manu?
[Sun Aug 13 2006] [22:43:22] <{ma}> yep
[Sun Aug 13 2006] [22:43:22] Away mchehab is away: No momento, estou ocupado. Currently I'm busy
[Sun Aug 13 2006] [22:43:46] <{ma}> i need to go now , will be back a while later
[Sun Aug 13 2006] [22:51:47] <mchehab> ok.
[Sun Aug 13 2006] [22:51:52] <mchehab> I think I found the trouble.
[Sun Aug 13 2006] [22:51:58] <mchehab> I'll do some tests
[Sun Aug 13 2006] [23:10:03] Quit mchehab has left this server (Read error: 60 (Operation timed out)).
[Mon Aug 14 2006] [01:03:29] Quit mchehab has left this server (Read error: 60 (Operation timed out)).