Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fleur
firmware
Commits
81e1412a
Verified
Commit
81e1412a
authored
5 years ago
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
fix(pmic): Relax lock requirements to prevent busy lock
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
c8dbb334
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
epicardium/modules/pmic.c
+6
-5
6 additions, 5 deletions
epicardium/modules/pmic.c
with
6 additions
and
5 deletions
epicardium/modules/pmic.c
+
6
−
5
View file @
81e1412a
...
...
@@ -18,6 +18,8 @@
#include
<stdio.h>
#include
<string.h>
#define LOCK_WAIT pdMS_TO_TICKS(1000)
/* Task ID for the pmic handler */
static
TaskHandle_t
pmic_task_id
=
NULL
;
...
...
@@ -51,12 +53,12 @@ int pmic_read_amux(enum pmic_amux_signal sig, float *result)
return
-
EINVAL
;
}
int
adc_ret
=
hwlock_acquire
(
HWLOCK_ADC
,
pdMS_TO_TICKS
(
100
)
);
int
adc_ret
=
hwlock_acquire
(
HWLOCK_ADC
,
LOCK_WAIT
);
if
(
adc_ret
<
0
)
{
ret
=
adc_ret
;
goto
done
;
}
i2c_ret
=
hwlock_acquire
(
HWLOCK_I2C
,
pdMS_TO_TICKS
(
100
)
);
i2c_ret
=
hwlock_acquire
(
HWLOCK_I2C
,
LOCK_WAIT
);
if
(
i2c_ret
<
0
)
{
ret
=
i2c_ret
;
goto
done
;
...
...
@@ -71,10 +73,9 @@ int pmic_read_amux(enum pmic_amux_signal sig, float *result)
* release the I2C mutex.
*/
hwlock_release
(
HWLOCK_I2C
);
i2c_ret
=
0
;
vTaskDelay
(
pdMS_TO_TICKS
(
5
));
i2c_ret
=
hwlock_acquire
(
HWLOCK_I2C
,
pdMS_TO_TICKS
(
100
)
);
i2c_ret
=
hwlock_acquire
(
HWLOCK_I2C
,
LOCK_WAIT
);
if
(
i2c_ret
<
0
)
{
ret
=
i2c_ret
;
goto
done
;
...
...
@@ -138,7 +139,7 @@ done:
static
void
pmic_poll_interrupts
(
TickType_t
*
button_start_tick
,
TickType_t
duration
)
{
while
(
hwlock_acquire
(
HWLOCK_I2C
,
pdMS_TO_TICKS
(
500
)
)
<
0
)
{
while
(
hwlock_acquire
(
HWLOCK_I2C
,
LOCK_WAIT
)
<
0
)
{
LOG_WARN
(
"pmic"
,
"Failed to acquire I2C. Retrying ..."
);
xTaskNotify
(
pmic_task_id
,
PMIC_NOTIFY_IRQ
,
eSetBits
);
return
;
...
...
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