Commit Graph

18 Commits

Author SHA1 Message Date
Gerald Loacker 866a138917 iio: magnetometer: add ti tmag5273 driver
Add support for TI TMAG5273 Low-Power Linear 3D Hall-Effect Sensor.
Additionally to temperature and magnetic X, Y and Z-axes the angle and
magnitude are reported.
The sensor is operating in continuous measurement mode and changes to sleep
mode if not used for 5 seconds.

Datasheet: https://www.ti.com/lit/gpn/tmag5273
Signed-off-by: Gerald Loacker <gerald.loacker@wolfvision.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221201072220.402585-4-gerald.loacker@wolfvision.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-12-28 17:19:44 +00:00
Linus Walleij de8860b1ed iio: magnetometer: Add driver for Yamaha YAS530
This adds an IIO magnetometer driver for the Yamaha
YAS530 family of magnetometer/compass chips YAS530,
YAS532 and YAS533.

A quick survey of the source code released by different
vendors reveal that we have these variants in the family
with some deployments listed:

 * YAS529 MS-3C (2005 Samsung Aries)
 * YAS530 MS-3E (2011 Samsung Galaxy S Advance)
 * YAS532 MS-3R (2011 Samsung Galaxy S4)
 * YAS533 MS-3F (Vivo 1633, 1707, V3, Y21L)
 * (YAS534 is a magnetic switch)
 * YAS535 MS-6C
 * YAS536 MS-3W
 * YAS537 MS-3T (2015 Samsung Galaxy S6, Note 5)
 * YAS539 MS-3S (2018 Samsung Galaxy A7 SM-A750FN)

The YAS529 is so significantly different from the
YAS53x variants that it will require its own driver.
The YAS537 and YAS539 have slightly different register
sets but have strong similarities so a common driver
patching this one will probably be reasonable.

The source code for Samsung Galaxy A7's YAS539 is not
that is significantly different from the YAS530 in the
Galaxy S Advance, so I believe we will only need this
one driver with quirks to handle all of them.

The YAS539 is actively announced on Yamaha's devices
site:
https://device.yamaha.com/en/lsi/products/e_compass/

This is a driver written from scratch using buffered
IIO and runtime PM handling regulators and reset.

Thanks to Andy Shevchenko for great help in finding all
the special kernel infrastructure functions and quirks
during review of this driver.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: phone-devel@vger.kernel.org
Cc: Jonathan Bakker <xc-racer2@live.ca>
Link: https://lore.kernel.org/r/20201224120820.1120099-2-linus.walleij@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-01-09 21:52:46 +00:00
Song Qiang 121354b2ec iio: magnetometer: Add driver support for PNI RM3100
PNI RM3100 is a high resolution, large signal immunity magnetometer,
composed of 3 single sensors and a processing chip with a MagI2C
interface.

Following functions are available:
 - Single-shot measurement from
   /sys/bus/iio/devices/iio:deviceX/in_magn_{axis}_raw
 - Triggerd buffer measurement.
 - DRDY pin for data ready trigger.
 - Both i2c and spi interface are supported.
 - Both interrupt and polling measurement is supported, depends on if
   the 'interrupts' in DT is declared.

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-11-16 18:32:31 +00:00
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Linus Walleij 7c94a8b2ee iio: magn: add a driver for AK8974
This adds a driver for the Asahi Kasei AK8974 and its sibling
AMI305 magnetometers. It was deployed on scale in 2009 on a
multitude of devices. It is distincly different from AK8973
and AK8975 and needs its own driver.

This patch is based on the long lost work of Samu Onkalo at Nokia,
who made a misc character device driver for the Maemo/MeeGo Nokia
devices, before the time of the IIO subsystem. It was mounted in e.g.
the Nokia N950, N8, N86, N97 etc. It is also mounted on the
ST-Ericsson HREF reference designs.

It works nicely in sysfs:

$ cat in_magn_x_raw && cat in_magn_y_raw && cat in_magn_z_raw
-55
-101
161

And with buffered reads using a simple HRTimer trigger:
$ generic_buffer -c10 -a -n ak8974 -t foo
iio device number being used is 3
iio trigger number being used is 2
No channels are enabled, enabling all channels
Enabling: in_magn_x_en
Enabling: in_magn_y_en
Enabling: in_magn_z_en
Enabling: in_timestamp_en
/sys/bus/iio/devices/iio:device3 foo
-58.000000 -102.000000 157.000000 946684970985321044
-60.000000 -98.000000 159.000000 946684971012237548
-60.000000 -106.000000 163.000000 946684971032257080
-62.000000 -94.000000 169.000000 946684971052185058
-58.000000 -98.000000 163.000000 946684971072204589
-54.000000 -100.000000 163.000000 946684971092224121
-53.000000 -103.000000 164.000000 946684971112731933
-50.000000 -102.000000 165.000000 946684971132232666
-61.000000 -101.000000 164.000000 946684971152191162
-57.000000 -99.000000 168.000000 946684971172210693
Disabling: in_magn_x_en
Disabling: in_magn_y_en
Disabling: in_magn_z_en
Disabling: in_timestamp_en

I cannot currently scale these raw values to gauss. This is
because of lack of documentation. I have sent a request for
a datasheet to Asahi Kasei.

The driver can optionally use a DRDY line IRQ to capture data,
else it will sleep and poll.

Cc: Samu Onkalo <samu.onkalo@intel.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Tested-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-08-15 16:49:39 +01:00
Daniel Baluta 534536acdb iio: magn: bmc150: Introduce SPI support
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-18 20:44:47 +01:00
Daniel Baluta 761b7910d4 iio: magn: Split bmc150 driver in common/i2c parts
This is useful for easily adding SPI support in later patches.

Now bmc150_magn exports core functions to be used by I2C/SPI drivers
instances. For the moment only I2C driver is supported.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Acked-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-18 20:44:40 +01:00
Cristina Moraru 7247645f68 iio: hmc5843: Move hmc5843 out of staging
This patch moves hmc5843 driver from staging/iio/magnetometer
to iio/magnetometer, updates the corresponding Makefiles and
moves the hmc5843* entries to the 'Industrial I/O support ->
Magnetometer sensors' menu.

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24 20:40:39 +00:00
Hartmut Knaack 2427d22de8 iio:magnetometer:bmc150_magn: sort entry alphabetically
Sort the entry for bmc105_magn in Kconfig and Makefile to its correct
position. Also add the minor module information for completeness.

Fixes: c91746a236 ("iio: magn: Add support for BMC150 magnetometer")

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-12 22:18:21 +01:00
Daniel Baluta abeb6b1e7b iio: magnetometer: Add support for MEMSIC MMC35240 sensor
Minimal implementation for MMC35240 3-axis magnetometer
sensor. It provides processed readings and possiblity to change
the sampling frequency.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:45 +01:00
Irina Tirdea c91746a236 iio: magn: Add support for BMC150 magnetometer
Add support for the Bosh BMC150 Magnetometer.
The specification can be downloaded from:
http://ae-bst.resource.bosch.com/media/products/dokumente/bmc150/BST-BMC150-DS000-04.pdf.
The chip contains both an accelerometer and a magnetometer.
This patch adds support only for the magnetometer part.

The temperature compensation formulas are based on bmm050_api.c
authored by contact@bosch.sensortec.com.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:43 +01:00
Gwendal Grignou 57e73a423b iio: ak8975: add ak09911 and ak09912 support
Add 2 new definition entries to support ak0991x compass.
Add a more advanced function to check we are dealing with the
expected device.
Remove standalone driver for ak09911.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:20 +00:00
Srinivas Pandruvada d14c0f10e7 iio: AK09911 : 3 axis compass support
Added IIO magnetometer driver for AK09911. In functionality is resembles
AK8975 or AK8963. But there are several differences, so instead of
modifying existing AK8975 driver and keep it clean, implemented as
a separate driver.
The key differences are:
- Register map is different and have different indexes
- AK09911 is a very compact interface with no DRDY pin. So no support
 of interrupt or GPIO poll
- Even for polled mode no mention on ST2 register, which is required in
ak8975 driver
- mode values are different for fuse access

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-06-16 20:55:24 +01:00
Peter Meerwald 39631b5f95 iio: Add Freescale mag3110 magnetometer driver
three-axis digital magnetometer with I2C interface

datasheet is available from
http://cache.freescale.com/files/sensors/doc/data_sheet/MAG3110.pdf

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-23 17:43:11 +01:00
Lars-Peter Clausen 3edc84e605 iio: Add a comment to about alphabetical order to Kconfigs and Makefiles
Keeping Makefile and Kconfig entries in alphabetical order usually works better
than just appending new entries at the end, since it reduces the amount of
conflicts. This patch adds a comment to the IIO Kconfig and Makefile files to
document that the entries should be kept in alphabetical order.

Also reorder those  entries which weren't in alphabetical order yet.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:36 +01:00
Jonathan Cameron 2fc72cd835 iio:magnetometer:ak8975 move driver out of staging
Issues raised in last series to propose this have now been resolved
so there should be no reason this driver cannot graduate from staging.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
2013-04-02 18:36:47 +01:00
Denis Ciocca 872e79add7 iio:magnetometer: Add STMicroelectronics magnetometers driver
This patch adds a generic magnetometer driver for STMicroelectronics
magnetometers, currently it supports:
LSM303DLHC, LSM303DLM, LIS3MDL.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-01-31 17:56:43 +00:00
srinivas pandruvada bc1d57ba06 iio: hid-sensors: Added Compass/Magnetometer 3D
Added usage id processing for Compass 3D. This uses IIO
interfaces for triggered buffer to present data to user
mode.This uses HID sensor framework for registering callback
events from the sensor hub.

Signed-off-by: srinivas pandruvada <srinivas.pandruvada@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-09-06 19:22:32 +01:00