Hello!
I read Documentation/i2c/dev-interface and write probe programm:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <linux/i2c-dev.h>
#include "tvp5146control.h"
int main(int argc, char** argv)
{
int file, res;
char filename[10] = "/dev/i2c-0";
printf("Device File: %s.\n", filename);
printf("Device Address: 0x%x.\n", TVP5146_ADDR);
((file = open(filename, O_RDWR)) < 0) ?
printf("Error opening Device File.\n") :
printf("Device File opened successfully.\n");
res = ioctl(file, I2C_SLAVE, TVP5146_ADDR);
if (res < 0)
{
printf("IOCTL error with err = %d.\n", res);
exit(1);
} printf("IOCTL good.\n");
close(filename);
return 0;
}
I have succsefully compile and runing it, but I have error:
# ./tvp5146control
Device File: /dev/i2c-0.
Device Address: 0x5d.
Device File opened successfully.
IOCTL error with err = -1.
System contained only one i2c device:
# ls -l /dev | grep i2c
drwxr-xr-x 2 1000 1000 4096 Jul 21 2008 i2c
crw-rw---- 1 1000 1000 89, 0 Aug 27 2008 i2c-0
# ls -l /sys/bus/i2c/drivers/TVP5146\ Video\ Decoder\ I2C\ drive/
lrwxrwxrwx 1 root root 0 Jan 1 00:33 0-005d -> ../../../../devices/platform/i2c-0/0-005d
I have found device address in TMS320DM355 Evalution Module Technical Reference (509905-0001 Rev. E April 2008) on page 2-5.
But I have TMX320DM355 Evalution Module 702065 Rev C 30 Nov 07 manufactured by SpectrumDigital.
What problem and how I can solve it?
Thank you and excuse me for my bad english.