Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Linux kernel RD
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Osipenko
Linux kernel RD
Commits
ea95e922
Commit
ea95e922
authored
2 months ago
by
Dmitry Osipenko
Browse files
Options
Downloads
Patches
Plain Diff
WIP: mfd: rk8xx: Use atomic SPI transfer for power-off
Signed-off-by:
Dmitry Osipenko
<
dmitry.osipenko@collabora.com
>
parent
59ec8ff7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
drivers/mfd/rk8xx-core.c
+1
-1
1 addition, 1 deletion
drivers/mfd/rk8xx-core.c
drivers/mfd/rk8xx-spi.c
+13
-0
13 additions, 0 deletions
drivers/mfd/rk8xx-spi.c
with
14 additions
and
1 deletion
drivers/mfd/rk8xx-core.c
+
1
−
1
View file @
ea95e922
...
@@ -634,7 +634,7 @@ static int rk808_power_off(struct sys_off_data *data)
...
@@ -634,7 +634,7 @@ static int rk808_power_off(struct sys_off_data *data)
default:
default:
return
NOTIFY_DONE
;
return
NOTIFY_DONE
;
}
}
ret
=
regmap_update_bits
(
rk808
->
regmap
,
reg
,
bit
,
bit
);
ret
=
regmap_update_bits
_atomic
(
rk808
->
regmap
,
reg
,
bit
,
bit
);
if
(
ret
)
if
(
ret
)
dev_err
(
rk808
->
dev
,
"Failed to shutdown device!
\n
"
);
dev_err
(
rk808
->
dev
,
"Failed to shutdown device!
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
drivers/mfd/rk8xx-spi.c
+
13
−
0
View file @
ea95e922
...
@@ -38,6 +38,12 @@ static const struct regmap_config rk806_regmap_config_spi = {
...
@@ -38,6 +38,12 @@ static const struct regmap_config rk806_regmap_config_spi = {
.
volatile_table
=
&
rk806_volatile_table
,
.
volatile_table
=
&
rk806_volatile_table
,
};
};
static
inline
bool
in_atomic_xfer_mode
(
void
)
{
return
system_state
>
SYSTEM_RUNNING
&&
(
IS_ENABLED
(
CONFIG_PREEMPT_COUNT
)
?
!
preemptible
()
:
irqs_disabled
());
}
static
int
rk806_spi_bus_write
(
void
*
context
,
const
void
*
vdata
,
size_t
count
)
static
int
rk806_spi_bus_write
(
void
*
context
,
const
void
*
vdata
,
size_t
count
)
{
{
struct
device
*
dev
=
context
;
struct
device
*
dev
=
context
;
...
@@ -57,6 +63,9 @@ static int rk806_spi_bus_write(void *context, const void *vdata, size_t count)
...
@@ -57,6 +63,9 @@ static int rk806_spi_bus_write(void *context, const void *vdata, size_t count)
xfer
[
1
].
tx_buf
=
vdata
;
xfer
[
1
].
tx_buf
=
vdata
;
xfer
[
1
].
len
=
count
;
xfer
[
1
].
len
=
count
;
if
(
in_atomic_xfer_mode
())
return
spi_sync_transfer_atomic
(
spi
,
xfer
,
ARRAY_SIZE
(
xfer
));
return
spi_sync_transfer
(
spi
,
xfer
,
ARRAY_SIZE
(
xfer
));
return
spi_sync_transfer
(
spi
,
xfer
,
ARRAY_SIZE
(
xfer
));
}
}
...
@@ -75,6 +84,10 @@ static int rk806_spi_bus_read(void *context, const void *vreg, size_t reg_size,
...
@@ -75,6 +84,10 @@ static int rk806_spi_bus_read(void *context, const void *vreg, size_t reg_size,
txbuf
[
0
]
=
RK806_CMD_WITH_SIZE
(
READ
,
val_size
);
txbuf
[
0
]
=
RK806_CMD_WITH_SIZE
(
READ
,
val_size
);
memcpy
(
txbuf
+
1
,
vreg
,
reg_size
);
memcpy
(
txbuf
+
1
,
vreg
,
reg_size
);
if
(
in_atomic_xfer_mode
())
return
spi_write_then_read_atomic
(
spi
,
txbuf
,
sizeof
(
txbuf
),
val
,
val_size
);
return
spi_write_then_read
(
spi
,
txbuf
,
sizeof
(
txbuf
),
val
,
val_size
);
return
spi_write_then_read
(
spi
,
txbuf
,
sizeof
(
txbuf
),
val
,
val_size
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment