BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mangoh-drivers
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
mangoh-drivers
Commits
6177c956
Commit
6177c956
authored
May 01, 2017
by
David Frey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport bmi160 kernel driver for compilation against wp85 kernel
parent
47595ba4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
bmi160_core.c
linux_kernel_modules/bmi160/bmi160_core.c
+20
-2
No files found.
linux_kernel_modules/bmi160/bmi160_core.c
View file @
6177c956
...
...
@@ -21,6 +21,7 @@
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/buffer.h>
#include <linux/iio/sysfs.h>
#include <linux/version.h>
#include "bmi160.h"
...
...
@@ -110,6 +111,13 @@ enum bmi160_sensor_type {
struct
bmi160_data
{
struct
regmap
*
regmap
;
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
/*
* This member is necessary in kernel versions < 3.16 because
* regmap_get_device() is not defined.
*/
struct
device
*
dev
;
#endif
};
const
struct
regmap_config
bmi160_regmap_config
=
{
...
...
@@ -399,8 +407,11 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
buf
[
j
++
]
=
sample
;
}
iio_push_to_buffers_with_timestamp
(
indio_dev
,
buf
,
iio_get_time_ns
(
indio_dev
));
iio_push_to_buffers_with_timestamp
(
indio_dev
,
buf
,
iio_get_time_ns
(
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
indio_dev
#endif
));
done:
iio_trigger_notify_done
(
indio_dev
->
trig
);
return
IRQ_HANDLED
;
...
...
@@ -503,7 +514,11 @@ static int bmi160_chip_init(struct bmi160_data *data, bool use_spi)
{
int
ret
;
unsigned
int
val
;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
struct
device
*
dev
=
regmap_get_device
(
data
->
regmap
);
#else
struct
device
*
dev
=
data
->
dev
;
#endif
ret
=
regmap_write
(
data
->
regmap
,
BMI160_REG_CMD
,
BMI160_CMD_SOFTRESET
);
if
(
ret
<
0
)
...
...
@@ -563,6 +578,9 @@ int bmi160_core_probe(struct device *dev, struct regmap *regmap,
data
=
iio_priv
(
indio_dev
);
dev_set_drvdata
(
dev
,
indio_dev
);
data
->
regmap
=
regmap
;
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
data
->
dev
=
dev
;
#endif
ret
=
bmi160_chip_init
(
data
,
use_spi
);
if
(
ret
<
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