Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MNT Reform Tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reform
MNT Reform Tools
Commits
ab6c2517
Verified
Commit
ab6c2517
authored
1 year ago
by
Michael Fincham
Committed by
Johannes Schauer Marin Rodrigues
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
lpc/reform2_lpc.c: poweroff
parent
c6659fb0
No related branches found
No related tags found
1 merge request
!59
reform-tools 1.34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lpc/reform2_lpc.c
+20
-0
20 additions, 0 deletions
lpc/reform2_lpc.c
with
20 additions
and
0 deletions
lpc/reform2_lpc.c
+
20
−
0
View file @
ab6c2517
...
...
@@ -8,6 +8,7 @@
static
int
lpcProbe
(
struct
spi_device
*
spi
);
static
void
lpcRemove
(
struct
spi_device
*
spi
);
static
void
lpcPowerOff
(
void
);
static
ssize_t
showStatus
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
);
static
ssize_t
showCells
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
);
static
ssize_t
showFirmware
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
);
...
...
@@ -58,6 +59,8 @@ static struct power_supply_desc bat_desc = {
static
struct
power_supply_config
psy_cfg
=
{};
static
struct
device
*
poweroff_device
;
static
int
lpcProbe
(
struct
spi_device
*
spi
)
{
struct
lpc_driver_data
*
data
;
...
...
@@ -121,6 +124,10 @@ static int lpcProbe(struct spi_device *spi)
return
PTR_ERR
(
data
->
bat
);
}
// this overwrites something else that has already claimed pm_power_off on reform2 but it'll do for now
poweroff_device
=
&
spi
->
dev
;
pm_power_off
=
lpcPowerOff
;
return
ret
;
}
...
...
@@ -137,6 +144,11 @@ static void lpcRemove(struct spi_device *spi)
power_supply_unregister
(
data
->
bat
);
if
(
pm_power_off
==
&
lpcPowerOff
)
{
pm_power_off
=
NULL
;
}
kfree
(
data
);
}
...
...
@@ -289,6 +301,14 @@ static ssize_t lpcCommand(struct device *dev, char command, uint8_t arg1, uint8_
return
ret
;
}
static
void
lpcPowerOff
(
void
)
{
int
ret
=
0
;
uint8_t
buffer
[
8
];
ret
=
lpcCommand
(
poweroff_device
,
'p'
,
1
,
buffer
);
}
static
int
getBatProperty
(
struct
power_supply
*
psy
,
enum
power_supply_property
psp
,
union
power_supply_propval
*
val
)
...
...
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