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
995bf33f
Commit
995bf33f
authored
Oct 01, 2018
by
Ashish Syal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made BMM150 driver work for WP85/75 and WP76/77
parent
bf19fad9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
5 deletions
+87
-5
bmc150_magn.c
linux_kernel_modules/bmm150/bmc150_magn.c
+43
-4
bmc150_magn.mdef
linux_kernel_modules/bmm150/bmc150_magn.mdef
+26
-0
bmc150_magn_i2c.mdef
linux_kernel_modules/bmm150/bmc150_magn_i2c.mdef
+16
-0
mangOH.sdef
mangOH.sdef
+2
-1
No files found.
linux_kernel_modules/bmm150/bmc150_magn.c
View file @
995bf33f
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
* more details.
*/
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/interrupt.h>
...
@@ -103,6 +103,9 @@
...
@@ -103,6 +103,9 @@
#define BMC150_MAGN_REPXY_TO_REGVAL(rep) (((rep) - 1) / 2)
#define BMC150_MAGN_REPXY_TO_REGVAL(rep) (((rep) - 1) / 2)
#define BMC150_MAGN_REPZ_TO_REGVAL(rep) ((rep) - 1)
#define BMC150_MAGN_REPZ_TO_REGVAL(rep) ((rep) - 1)
enum
bmc150_magn_axis
{
enum
bmc150_magn_axis
{
AXIS_X
,
AXIS_X
,
AXIS_Y
,
AXIS_Y
,
...
@@ -150,6 +153,37 @@ struct bmc150_magn_data {
...
@@ -150,6 +153,37 @@ struct bmc150_magn_data {
int
max_odr
;
int
max_odr
;
int
irq
;
int
irq
;
};
};
#if 0
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
/**
* iio_device_set_drvdata() - Set trigger driver data
* @trig: IIO trigger structure
* @data: Driver specific data
*
* Allows to attach an arbitrary pointer to an IIO trigger, which can later be
* retrieved by iio_trigger_get_drvdata().
*/
static inline void iio_trigger_set_drvdata(struct iio_trigger *trig, void *data)
{
dev_set_drvdata(&trig->dev, data);
}
/**
* iio_trigger_get_drvdata() - Get trigger driver data
* @trig: IIO trigger structure
*
* Returns the data previously set with iio_trigger_set_drvdata()
*/
static inline void *iio_trigger_get_drvdata(struct iio_trigger *trig)
{
return dev_get_drvdata(&trig->dev);
}
#endif
#endif
static
const
struct
{
static
const
struct
{
int
freq
;
int
freq
;
...
@@ -463,7 +497,8 @@ static int bmc150_magn_read_raw(struct iio_dev *indio_dev,
...
@@ -463,7 +497,8 @@ static int bmc150_magn_read_raw(struct iio_dev *indio_dev,
int
*
val
,
int
*
val2
,
long
mask
)
int
*
val
,
int
*
val2
,
long
mask
)
{
{
struct
bmc150_magn_data
*
data
=
iio_priv
(
indio_dev
);
struct
bmc150_magn_data
*
data
=
iio_priv
(
indio_dev
);
int
ret
,
tmp
;
//int ret, tmp;
int
ret
;
s32
values
[
AXIS_XYZ_MAX
];
s32
values
[
AXIS_XYZ_MAX
];
switch
(
mask
)
{
switch
(
mask
)
{
...
@@ -508,6 +543,7 @@ static int bmc150_magn_read_raw(struct iio_dev *indio_dev,
...
@@ -508,6 +543,7 @@ static int bmc150_magn_read_raw(struct iio_dev *indio_dev,
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
return
IIO_VAL_INT
;
return
IIO_VAL_INT
;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
case
IIO_CHAN_INFO_OVERSAMPLING_RATIO
:
case
IIO_CHAN_INFO_OVERSAMPLING_RATIO
:
switch
(
chan
->
channel2
)
{
switch
(
chan
->
channel2
)
{
case
IIO_MOD_X
:
case
IIO_MOD_X
:
...
@@ -528,6 +564,7 @@ static int bmc150_magn_read_raw(struct iio_dev *indio_dev,
...
@@ -528,6 +564,7 @@ static int bmc150_magn_read_raw(struct iio_dev *indio_dev,
default:
default:
return
-
EINVAL
;
return
-
EINVAL
;
}
}
#endif
default:
default:
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -548,6 +585,7 @@ static int bmc150_magn_write_raw(struct iio_dev *indio_dev,
...
@@ -548,6 +585,7 @@ static int bmc150_magn_write_raw(struct iio_dev *indio_dev,
ret
=
bmc150_magn_set_odr
(
data
,
val
);
ret
=
bmc150_magn_set_odr
(
data
,
val
);
mutex_unlock
(
&
data
->
mutex
);
mutex_unlock
(
&
data
->
mutex
);
return
ret
;
return
ret
;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
case
IIO_CHAN_INFO_OVERSAMPLING_RATIO
:
case
IIO_CHAN_INFO_OVERSAMPLING_RATIO
:
switch
(
chan
->
channel2
)
{
switch
(
chan
->
channel2
)
{
case
IIO_MOD_X
:
case
IIO_MOD_X
:
...
@@ -586,6 +624,7 @@ static int bmc150_magn_write_raw(struct iio_dev *indio_dev,
...
@@ -586,6 +624,7 @@ static int bmc150_magn_write_raw(struct iio_dev *indio_dev,
default:
default:
return
-
EINVAL
;
return
-
EINVAL
;
}
}
#endif
default:
default:
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -623,12 +662,12 @@ static const struct attribute_group bmc150_magn_attrs_group = {
...
@@ -623,12 +662,12 @@ static const struct attribute_group bmc150_magn_attrs_group = {
.
attrs
=
bmc150_magn_attributes
,
.
attrs
=
bmc150_magn_attributes
,
};
};
#define BMC150_MAGN_CHANNEL(_axis) { \
#define BMC150_MAGN_CHANNEL(_axis) { \
.type = IIO_MAGN, \
.type = IIO_MAGN, \
.modified = 1, \
.modified = 1, \
.channel2 = IIO_MOD_##_axis, \
.channel2 = IIO_MOD_##_axis, \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), \
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ) | \
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ) | \
BIT(IIO_CHAN_INFO_SCALE), \
BIT(IIO_CHAN_INFO_SCALE), \
.scan_index = AXIS_##_axis, \
.scan_index = AXIS_##_axis, \
...
...
linux_kernel_modules/bmm150/bmc150_magn.mdef
0 → 100644
View file @
995bf33f
cflags:
{
-DCONFIG_IIO
-DCONFIG_IIO_BUFFER
-DCONFIG_IIO_TRIGGERED_BUFFER
-DCONFIG_IIO_TRIGGER
-DCONFIG_IIO_KFIFO_BUF
-DCONFIG_IIO_CONSUMERS_PER_TRIGGER=2
}
sources:
{
bmc150_magn.c
}
requires:
{
kernelModules:
{
#if ${MANGOH_KERNEL_LACKS_IIO} = 1
$CURDIR/../iio/iio-triggered-buffer
#endif // MANGOH_KERNEL_LACKS_IIO
}
}
linux_kernel_modules/bmm150/bmc150_magn_i2c.mdef
0 → 100644
View file @
995bf33f
cflags:
{
}
sources:
{
bmc150_magn_i2c.c
}
requires:
{
kernelModules:
{
$CURDIR/bmc150_magn
}
}
mangOH.sdef
View file @
995bf33f
...
@@ -172,7 +172,8 @@ kernelModules:
...
@@ -172,7 +172,8 @@ kernelModules:
$CURDIR/linux_kernel_modules/bmi160/bmi160-i2c
$CURDIR/linux_kernel_modules/bmi160/bmi160-i2c
$CURDIR/linux_kernel_modules/bmi160/bmi160
$CURDIR/linux_kernel_modules/bmi160/bmi160
$CURDIR/linux_kernel_modules/bmm150/bmc150_magn_i2c
$CURDIR/linux_kernel_modules/bmm150/bmc150_magn
$CURDIR/linux_kernel_modules/rtc-pcf85063/rtc-pcf85063
$CURDIR/linux_kernel_modules/rtc-pcf85063/rtc-pcf85063
$CURDIR/linux_kernel_modules/rtc_sync/rtc_sync
$CURDIR/linux_kernel_modules/rtc_sync/rtc_sync
$CURDIR/linux_kernel_modules/bq25601/bq25601
$CURDIR/linux_kernel_modules/bq25601/bq25601
...
...
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