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
Kirill Smelkov
linux
Commits
fb3de30c
Commit
fb3de30c
authored
Jan 07, 2015
by
Wolfram Sang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
i2c: pmcmsp: make use of the new infrastructure for quirks
Signed-off-by:
Wolfram Sang
<
wsa@the-dreams.de
>
parent
f2325c54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
26 deletions
+16
-26
drivers/i2c/busses/i2c-pmcmsp.c
drivers/i2c/busses/i2c-pmcmsp.c
+16
-26
No files found.
drivers/i2c/busses/i2c-pmcmsp.c
View file @
fb3de30c
...
@@ -456,14 +456,6 @@ static enum pmcmsptwi_xfer_result pmcmsptwi_xfer_cmd(
...
@@ -456,14 +456,6 @@ static enum pmcmsptwi_xfer_result pmcmsptwi_xfer_cmd(
return
-
EINVAL
;
return
-
EINVAL
;
}
}
if
(
cmd
->
read_len
>
MSP_MAX_BYTES_PER_RW
||
cmd
->
write_len
>
MSP_MAX_BYTES_PER_RW
)
{
dev_err
(
&
pmcmsptwi_adapter
.
dev
,
"%s: Cannot transfer more than %d bytes
\n
"
,
__func__
,
MSP_MAX_BYTES_PER_RW
);
return
-
EINVAL
;
}
mutex_lock
(
&
data
->
lock
);
mutex_lock
(
&
data
->
lock
);
dev_dbg
(
&
pmcmsptwi_adapter
.
dev
,
dev_dbg
(
&
pmcmsptwi_adapter
.
dev
,
"Setting address to 0x%04x
\n
"
,
cmd
->
addr
);
"Setting address to 0x%04x
\n
"
,
cmd
->
addr
);
...
@@ -520,25 +512,14 @@ static int pmcmsptwi_master_xfer(struct i2c_adapter *adap,
...
@@ -520,25 +512,14 @@ static int pmcmsptwi_master_xfer(struct i2c_adapter *adap,
struct
pmcmsptwi_cfg
oldcfg
,
newcfg
;
struct
pmcmsptwi_cfg
oldcfg
,
newcfg
;
int
ret
;
int
ret
;
if
(
num
>
2
)
{
if
(
num
==
2
)
{
dev_dbg
(
&
adap
->
dev
,
"%d messages unsupported
\n
"
,
num
);
return
-
EINVAL
;
}
else
if
(
num
==
2
)
{
/* Check for a dual write-then-read command */
struct
i2c_msg
*
nextmsg
=
msg
+
1
;
struct
i2c_msg
*
nextmsg
=
msg
+
1
;
if
(
!
(
msg
->
flags
&
I2C_M_RD
)
&&
(
nextmsg
->
flags
&
I2C_M_RD
)
&&
cmd
.
type
=
MSP_TWI_CMD_WRITE_READ
;
msg
->
addr
==
nextmsg
->
addr
)
{
cmd
.
write_len
=
msg
->
len
;
cmd
.
type
=
MSP_TWI_CMD_WRITE_READ
;
cmd
.
write_data
=
msg
->
buf
;
cmd
.
write_len
=
msg
->
len
;
cmd
.
read_len
=
nextmsg
->
len
;
cmd
.
write_data
=
msg
->
buf
;
cmd
.
read_data
=
nextmsg
->
buf
;
cmd
.
read_len
=
nextmsg
->
len
;
cmd
.
read_data
=
nextmsg
->
buf
;
}
else
{
dev_dbg
(
&
adap
->
dev
,
"Non write-read dual messages unsupported
\n
"
);
return
-
EINVAL
;
}
}
else
if
(
msg
->
flags
&
I2C_M_RD
)
{
}
else
if
(
msg
->
flags
&
I2C_M_RD
)
{
cmd
.
type
=
MSP_TWI_CMD_READ
;
cmd
.
type
=
MSP_TWI_CMD_READ
;
cmd
.
read_len
=
msg
->
len
;
cmd
.
read_len
=
msg
->
len
;
...
@@ -598,6 +579,14 @@ static u32 pmcmsptwi_i2c_func(struct i2c_adapter *adapter)
...
@@ -598,6 +579,14 @@ static u32 pmcmsptwi_i2c_func(struct i2c_adapter *adapter)
I2C_FUNC_SMBUS_WORD_DATA
|
I2C_FUNC_SMBUS_PROC_CALL
;
I2C_FUNC_SMBUS_WORD_DATA
|
I2C_FUNC_SMBUS_PROC_CALL
;
}
}
static
struct
i2c_adapter_quirks
pmcmsptwi_i2c_quirks
=
{
.
flags
=
I2C_AQ_COMB_WRITE_THEN_READ
,
.
max_write_len
=
MSP_MAX_BYTES_PER_RW
,
.
max_read_len
=
MSP_MAX_BYTES_PER_RW
,
.
max_comb_1st_msg_len
=
MSP_MAX_BYTES_PER_RW
,
.
max_comb_2nd_msg_len
=
MSP_MAX_BYTES_PER_RW
,
};
/* -- Initialization -- */
/* -- Initialization -- */
static
struct
i2c_algorithm
pmcmsptwi_algo
=
{
static
struct
i2c_algorithm
pmcmsptwi_algo
=
{
...
@@ -609,6 +598,7 @@ static struct i2c_adapter pmcmsptwi_adapter = {
...
@@ -609,6 +598,7 @@ static struct i2c_adapter pmcmsptwi_adapter = {
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
class
=
I2C_CLASS_HWMON
|
I2C_CLASS_SPD
,
.
class
=
I2C_CLASS_HWMON
|
I2C_CLASS_SPD
,
.
algo
=
&
pmcmsptwi_algo
,
.
algo
=
&
pmcmsptwi_algo
,
.
quirks
=
&
pmcmsptwi_i2c_quirks
,
.
name
=
DRV_NAME
,
.
name
=
DRV_NAME
,
};
};
...
...
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