Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
d4e15bcd
Commit
d4e15bcd
authored
Nov 05, 2007
by
Mauro Carvalho Chehab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
V4L/DVB (12814): tm6000: fix eeprom reading on tm6000
Signed-off-by:
Mauro Carvalho Chehab
<
mchehab@redhat.com
>
parent
28cb88ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
28 deletions
+34
-28
drivers/staging/tm6000/tm6000-i2c.c
drivers/staging/tm6000/tm6000-i2c.c
+34
-28
No files found.
drivers/staging/tm6000/tm6000-i2c.c
View file @
d4e15bcd
...
...
@@ -163,8 +163,8 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
}
static
int
tm6000_i2c_eeprom
(
struct
tm6000_core
*
dev
,
unsigned
char
*
eedata
,
int
len
)
static
int
tm6000_i2c_eeprom
(
struct
tm6000_core
*
dev
,
unsigned
char
*
eedata
,
int
len
)
{
int
i
,
rc
;
unsigned
char
*
p
=
eedata
;
...
...
@@ -172,24 +172,16 @@ static int tm6000_i2c_eeprom( struct tm6000_core *dev,
dev
->
i2c_client
.
addr
=
0xa0
>>
1
;
//006779: OUT: 000006 ms 089867 ms c0 0e a0 00 00 00 01 00 <<< 00
//006780: OUT: 000005 ms 089873 ms c0 10 a0 00 00 00 01 00 <<< 00
//006781: OUT: 000108 ms 089878 ms 40 0e a0 00 00 00 01 00 >>> 99
//006782: OUT: 000015 ms 089986 ms c0 0e a0 00 01 00 01 00 <<< 99
//006783: OUT: 000004 ms 090001 ms c0 0e a0 00 10 00 01 00 <<< 99
//006784: OUT: 000005 ms 090005 ms 40 10 a0 00 00 00 01 00 >>> 00
//006785: OUT: 000308 ms 090010 ms 40 0e a0 00 00 00 01 00 >>> 00
for
(
i
=
0
;
i
<
len
;
i
++
)
{
bytes
[
0x14
+
i
]
=
0
;
rc
=
i2c_master_recv
(
&
dev
->
i2c_client
,
p
,
1
);
if
(
rc
<
1
)
{
if
(
p
==
eedata
)
{
printk
(
KERN_WARNING
"%s doesn't have eeprom"
,
dev
->
name
);
}
else
{
bytes
[
16
]
=
'\0'
;
for
(
i
=
0
;
i
<
len
;
)
{
*
p
=
i
;
rc
=
tm6000_read_write_usb
(
dev
,
USB_DIR_IN
|
USB_TYPE_VENDOR
|
USB_RECIP_DEVICE
,
REQ_16_SET_GET_I2CSEQ
,
0xa0
|
i
<<
8
,
0
,
p
,
1
);
if
(
rc
<
1
)
{
if
(
p
==
eedata
)
goto
noeeprom
;
else
{
printk
(
KERN_WARNING
"%s: i2c eeprom read error (err=%d)
\n
"
,
dev
->
name
,
rc
);
...
...
@@ -200,21 +192,32 @@ static int tm6000_i2c_eeprom( struct tm6000_core *dev,
if
(
0
==
(
i
%
16
))
printk
(
KERN_INFO
"%s: i2c eeprom %02x:"
,
dev
->
name
,
i
);
printk
(
" %02x"
,
eedata
[
i
]);
if
((
eedata
[
i
]
>=
' '
)
&&
(
eedata
[
i
]
<=
'z'
))
{
bytes
[
i
%
16
]
=
eedata
[
i
];
if
((
eedata
[
i
]
>=
' '
)
&&
(
eedata
[
i
]
<=
'z'
))
{
bytes
[
i
%
16
]
=
eedata
[
i
];
}
else
{
bytes
[
i
%
16
]
=
'.'
;
}
if
(
15
==
(
i
%
16
))
{
bytes
[
i
%
16
]
=
'\0'
;
i
++
;
if
(
0
==
(
i
%
16
))
{
bytes
[
16
]
=
'\0'
;
printk
(
" %s
\n
"
,
bytes
);
}
}
if
((
i
%
16
)
!=
15
)
{
bytes
[
i
%
16
]
=
'\0'
;
printk
(
" %s
\n
"
,
bytes
);
if
(
0
!=
(
i
%
16
))
{
bytes
[
i
%
16
]
=
'\0'
;
for
(
i
%=
16
;
i
<
16
;
i
++
)
printk
(
" "
);
}
printk
(
" %s
\n
"
,
bytes
);
return
0
;
noeeprom:
printk
(
KERN_INFO
"%s: Huh, no eeprom present (err=%d)?
\n
"
,
dev
->
name
,
rc
);
return
rc
;
}
/* ----------------------------------------------------------- */
...
...
@@ -319,7 +322,6 @@ static int attach_inform(struct i2c_client *client)
{
struct
tm6000_core
*
dev
=
client
->
adapter
->
algo_data
;
struct
tuner_setup
tun_setup
;
unsigned
char
eedata
[
11
];
i2c_dprintk
(
1
,
"%s i2c attach [addr=0x%x,client=%s]
\n
"
,
client
->
driver
->
driver
.
name
,
client
->
addr
,
client
->
name
);
...
...
@@ -416,6 +418,8 @@ void tm6000_i2c_call_clients(struct tm6000_core *dev, unsigned int cmd, void *ar
*/
int
tm6000_i2c_register
(
struct
tm6000_core
*
dev
)
{
unsigned
char
eedata
[
256
];
dev
->
i2c_adap
=
tm6000_adap_template
;
dev
->
i2c_adap
.
dev
.
parent
=
&
dev
->
udev
->
dev
;
strcpy
(
dev
->
i2c_adap
.
name
,
dev
->
name
);
...
...
@@ -428,6 +432,8 @@ int tm6000_i2c_register(struct tm6000_core *dev)
if
(
i2c_scan
)
do_i2c_scan
(
dev
->
name
,
&
dev
->
i2c_client
);
tm6000_i2c_eeprom
(
dev
,
eedata
,
sizeof
(
eedata
));
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment