iio: magn: bmc150_magn: do not set power state twice when setting trigger state
When setting the trigger state, the device power state is set through
buffer preenable and postdisable hooks. There is no need
to also set it in the trigger set state call.
Remove duplicate set power state from the trigger set
state call.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: Export OF module alias information in missing drivers
The I2C core always reports the MODALIAS uevent as "i2c:<client name"
regardless if the driver was matched using the I2C id_table or the
of_match_table. So technically there's no need for a driver to export
the OF table since currently it's not used.
In fact, the I2C device ID table is mandatory for I2C drivers since
a i2c_device_id is passed to the driver's probe function even if the
I2C core used the OF table to match the driver.
And since the I2C core uses different tables, OF-only drivers needs to
have duplicated data that has to be kept in sync and also the dev node
compatible manufacturer prefix is stripped when reporting the MODALIAS.
To avoid the above, the I2C core behavior may be changed in the future
to not require an I2C device table for OF-only drivers and report the
OF module alias. So, it's better to also export the OF table to prevent
breaking module autoloading if that happens.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: Export I2C module alias information in missing drivers
The I2C core always reports the MODALIAS uevent as "i2c:<client name"
regardless if the driver was matched using the I2C id_table or the
of_match_table. So the driver needs to export the I2C table and this
be built into the module or udev won't have the necessary information
to auto load the correct module when the device is added.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Giuseppe Barba [Tue, 21 Jul 2015 08:35:42 +0000 (10:35 +0200)]
iio: st-sensors: add support for single full scale device
Some sensors could have only one full scale value. This means that the
sensor hasn't a full scale register. This commit add a check on the
configured full scale address to support such kind of sensors.
Signed-off-by: Giuseppe Barba <giuseppe.barba@st.com> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: fix drivers that consider 0 as a valid IRQ in client->irq
Since patch "i2c / ACPI: Use 0 to indicate that device does not have
interrupt assigned" [1], 0 is not a valid i2c client irq anymore, so
change all driver's checks accordingly.
The same issue occurs when the device is instantiated via device tree
with no IRQ, or from the i2c sysfs interface, even before the patch
above.
This patch indends to make some cleanup and send printf
error messages to stderr. The changes were performed with coccinelle
for failure messages and manual for other cases, such as wrong usage
messages.
Calculation of the length of an array can be done with the ARRAY_SIZE
macro to make code more abstract and remove the associated
checkpatch.pl warning.
iio: light: add support for TI's opt3001 light sensor
TI's opt3001 light sensor is a simple and yet powerful
little device. The device provides 99% IR rejection,
automatic full-scale, very low power consumption and
measurements from 0.01 to 83k lux.
This patch adds support for that device using the IIO
framework.
See http://www.ti.com/product/opt3001 for more information.
Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Andreas Dannenberg <dannenberg@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Harald Geyer [Tue, 7 Jul 2015 13:39:31 +0000 (13:39 +0000)]
iio: dht11: Use new function ktime_get_resolution_ns()
This cleans up the most ugly workaround in this driver. There are no
functional changes yet in the decoding algorithm, but we improve the
following things:
* Get rid of spurious warning messages on systems with fast HRTIMER.
* If the clock is not fast enough for decoding to work, we give
up immediately.
* In that case we return EAGAIN instead of EIO, so it's easier to
discriminate causes of failure.
Returning EAGAIN is somewhat controversial: It's technically correct
as a faster clock might become available. OTOH once all clocks are
enabled this is a permanent error. There is no ECLOCKTOOSLOW error
code.
Signed-off-by: Harald Geyer <harald@ccbib.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: vf610: Determine sampling frequencies by using minimum sample time
The driver currently does not take into account the minimum sample time
as per the Figure 6-8 Chapter 9.1.1 12-bit ADC electrical characteristics.
We set a static amount of cycles instead of considering the sample time
as a given value, which depends on hardware characteristics.
Determine sampling frequencies by first reading the device tree property
node and then calculating the required Long Sample Time Adder (LSTAdder)
value, based on the ADC clock frequency and sample time value obtained
from the device tree. This LSTAdder value is then used for calculating
the sampling frequencies possible.
In case the sample time property is not specified through the device
tree, a safe default value of 1000ns is assumed.
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com> Acked-by: Stefan Agner <stefan@agner.ch> Acked-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Stefan Wahren [Sat, 18 Jul 2015 12:30:46 +0000 (12:30 +0000)]
iio: mxs-lradc: add datasheet name for every usable channel
In order to provide a channel name to in kernel consumers add the
datasheet names for every usable AD channel. Since the channel names
differ between i.MX23 and i.MX28, we need to separate the channel
specs.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
In a later patch we will remove the duplicate codes. But the code also
needs to execute dgap_remove_driver_sysfiles() if it is being called
from dgap_remove_one() but if being called fron the error path of the
dgap_init_module() then the sysfiles should not be removed.
The code in dgap_stop() is almost a duplicate of the code that will be
executed on pci_unregister_driver(). So the error code was stopping and
unregistering everything twice.
The default value of status was _FAIL, it was only changed if kzalloc
succeeds and the check for status is immediately following kzalloc. We
can have the failure code in the else part as the failure code will be
executed only if kzalloc fails.
Now since the Big-Endian and Little-Endian based calculations are moved
into a macro we can make fb_read() and fb_write() common for both
Little-Endian and Big-Endian.
rtw_hal_enable_interrupt() and rtw_hal_disable_interrupt() are never
referenced, so remove them.
They used to be the only place where the enable_interrupt() and
disable_interrupt() callbacks were called, and the function pointer
is never set, so get rid of the function pointer as well.
staging/lustre/ldlm: Unregister ldlm namespace from sysfs on free
ldlm_namespace_sysfs_unregister needs to be called ldlm_namespace_free_post
so that we don't have this dangling object there after the namespace
has disappeared.
Benjamin Romer [Thu, 16 Jul 2015 16:40:48 +0000 (12:40 -0400)]
staging: unisys: fix copyright statements
The copyright statements in the drivers need to be correct and
consistent; this patch fixes the year for all of them, and makes the
statement text cover just the GPL V2.
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merge tag 'iio-for-4.3a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
First round of new drivers, cleanups and functionality for IIO in the 4.3 cycle.
Core and tools new stuff
* Allow explicit flush of hardware fifo by using an non blocking read.
This is needed to support some of the Android requirements for HW fifo
devices - also makes sense generally and clarifies a corner of the ABI.
* Add some missing modifier names. Mostly these exist for weird and
wonderful event types, but should still be present in the name array.
* Update iio_event_monitor to cope with new channel types.
* generic_buffer gains support for single byte scan elements (no idea
how this never got implemented before!)
New device support
* ROHM rpr0521 light and proximity sensor driver.
* bmc150 gains bmc156 support.
* ms5611 gains ms5607 temperature and pressure sensor support.
Driver functionality
* inv-mpu - add scale_available attributes to aid userspace in
configuring these devices.
* isl29125 - add scale_available attributes.
* stk8ba50 - sampling frequency control, triggered buffer support.
* stk8312 - sampling frequency control, triggered buffer support.
* cc10001 - ensure ADC powered up at probe time if shared by non linux
running CPUs.
* bmc150-magn - decouple the buffer and trigger allowing other triggers
to be used to drive this device's sampling.
Documentation
* Add some previously missed *scale_available attributes to the ABI docs.
Cleanups
* Clarify some crazy naming in iio_triggered_buffer_setup that seems to
have somehow ended up backwards (dates back a long way). Avoid the top
half and bottom half naming entirely given we are how dealing with a
handler and a thread in all cases.
* Tools cleanup including coding style, variable naming improvements, also
a new sanity check on a full event having been read.
* stk8ba50 - replace the scale table with a struct for clarity. Also suspend
the sensor if an error occurs in init.
* hid-sensor-prox - drop uneeded line break.
* mma9551 - use size in words for word read / write avoiding accidental
sending of an odd number of bytes.
* mma9553 - fix code alignment and document the use of a mutex.
* light/Kconfig - typo fix in commment.
* cm3323 - don't eat an error value, replace an unneeded local variable with
a generic local variable with the same use, add some blank lines for clarity.
* pressure/Kconfig - typo in Measurement Specialties name.
* bmc150-accel - actually use a mask definition rather than repeating the
value inline, code style cleanup.
* adc/Kconfig - general help description cleanup.
* ssp_sensors - drop redundant spi driver bus initialization (done in the
spi core)
* tmp006 - use genmask rather than hand generated masks.
* ms5611 - drop IIO_CHAN_INFO_SCALE as this driver provides a processed
output and as such the read only scale adds nothing useful.
* kxcjk-1013, adf4350, dummy - drop unwanted blank lines.
* Drop all owner assignments from i2c_drivers and this is done in the
i2c core.
Juston Li [Wed, 15 Jul 2015 04:14:41 +0000 (21:14 -0700)]
staging: sm750fb: add spaces around operators
Fixes checkpath.pl error:
ERROR: spaces required around that operator
Note running checkpatch.pl with '--strict' catches more
of these errors along with cases where spacing is optional
but preferred. Take care of these in a future patch.
Signed-off-by: Juston Li <juston.h.li@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Juston Li [Wed, 15 Jul 2015 04:14:30 +0000 (21:14 -0700)]
staging: sm750fb: use tabs for indentation
Replace spaces with tabs for indentation to fix the checkpatch.pl error
ERROR: code indent should use tabs where possible
WARNING: please, no spaces at the start of a line
Signed-off-by: Juston Li <juston.h.li@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dmitry Kalinkin [Fri, 26 Jun 2015 20:39:40 +0000 (23:39 +0300)]
staging: vme_user: allow large read()/write()
This changes large master transfers to do shorter read/write rather than
return -EINVAL. User space will now be able to optimistically request a
large transfer and get at least some data.
This also removes comments suggesting on how to implement large
transfers. Current vme_master_* read and write implementations use CPU
copies that don't produce burst PCI accesses and subsequently no block
transfer on VME bus. In the end overall performance is quiet low and it
can't be fixed by doing direct copy to user space. Much easier solution
would be to just reuse kernel buffer.
Gioh Kim [Mon, 6 Jul 2015 06:14:41 +0000 (15:14 +0900)]
staging: ion: debugfs to shrink pool
This patch enables debugfs file /sys/kernel/debug/ion/heaps/system_shrink
to shrink pool and get pool size. This technically enables debugfs
shrinking for all heaps, not just the system heap although the system heap
is the only one with a shrinker right now. It is already implemented
but not complete. This patch completes and enables it.
Reading the file returns pool size
in page unit and writing the number of pages shrinks pool.
It flushes all pages to write zero at the file.
Signed-off-by: Gioh Kim <gioh.kim@lge.com> Reviewed-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gioh Kim [Mon, 6 Jul 2015 06:14:40 +0000 (15:14 +0900)]
staging: ion: shrink page-pool by page unit
This patch shrink page-pool by page unit.
The system shrinker calls ion_heap_shrink_count() to get nr_to_scan,
and pass it to ion_heap_shrink_scan().
The problem is the return value of ion_heap_shrink_count() is the number
of pages but ion_system_heap_shrink(), which is called by
ion_heap_shrink_scan(), gets the number of chunk.
The main root of this is that ion_page_pool_shrink() returns page count
via ion_page_pool_total() if it have to check pool size. But it frees
chunks of pages if it have to free pools.
This patch first fix ion_page_pool_shrink() to count only pages,
not chunks. And then ion_system_heap_shrink() to work on pages.
Signed-off-by: Gioh Kim <gioh.kim@lge.com> Reviewed-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vaishali Thakkar [Fri, 26 Jun 2015 04:07:25 +0000 (09:37 +0530)]
Staging: rtl8192e: Replace memset with eth_zero_addr
Use eth_zero_addr to assign the zero address to the given address
array instead of memset when second argument is address of zero.
Note that the 6 in the third argument of memset appears to represent
an ethernet address size (ETH_ALEN).
The Coccinelle semantic patch that makes this change is as follows: