1/ change request_module call to zero-pad single digit
family numbers. This appears to be the intention of
the code, but not what it actually does.
This means that the alias created for W1_FAMILY_SMEM_01
might actually be useful.
2/ Define a family name for the BQ27000 battery charge monitor.
Unfortunately this is the same number as W1_FAMILY_SMEM_01
so if both a compiled on a system, one module might need to
be blacklisted.
3/ Add a MODULE_ALIAS for the bq27000.
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
commit 94859308a2 "w1: new w1_ds2406 driver" added a new driver
that uses the crc16 library, but didn't ensure that the core is
there. This adds the necessary Kconfig statements, just like we
have it for other w1 drivers.
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Acked-by: Scott Alfter <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This patch replaces all calls to the "printk" function within the "slaves"
subdirectory by calls to the appropriate "pr_*" function thus addressing
the following warning generated by the checkpatch script:
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ...
then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
Signed-off-by: Fjodor Schelichow <[email protected]>
Signed-off-by: Roman Sommer <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Some preliminary work at making use of this driver led me to implement
CRC-16 checks on read and write to deal with the occasional glitchiness of
the 1-Wire bus. The revised driver (attached) returns an I/O error if the
CRC check fails. When reading the chip's state, either you get a valid
indication or you get an I/O error. When changing its state, either the
change is successful or an I/O error is returned.
Signed-off-by: Scott Alfter <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Configuration for masters and slaves is included only if W1 symbol
enabled, so no reason to check it once more.
Signed-off-by: Alexander Shiyan <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
The first line printed from w1_slave gives the context of the w1
device. So does the second line, but if the CRC check failed, the
second line contains the last successful result. It is confusing when
it prints the temperature next to the line that might be a previous
conversion and has nothing to do with that printed temperature value.
Modify the code to store the last good conversion in family_data,
which is designed for custom data structures.
Signed-off-by: David Fries <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This moves the sysfs file creation/removal to the w1 core by using the
.groups field, saving code in the slave driver.
Acked-by: Evgeniy Polyakov <[email protected]>
Cc: Alexander Stein <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This moves the sysfs file creation/removal to the w1 core by using the
.groups field, saving code in the slave driver.
Acked-by: Evgeniy Polyakov <[email protected]>
Cc: Alexander Stein <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This moves the sysfs file creation/removal to the w1 core by using the
.groups field, saving code in the slave driver.
Acked-by: Evgeniy Polyakov <[email protected]>
Cc: Alexander Stein <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This moves the sysfs file creation/removal to the w1 core by using the
.groups field, saving code in the slave driver.
Acked-by: Evgeniy Polyakov <[email protected]>
Cc: Alexander Stein <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This moves the sysfs file creation/removal to the w1 core by using the
.groups field, saving code in the slave driver.
Acked-by: Evgeniy Polyakov <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Alexander Stein <[email protected]>
Cc: Mariusz Bialonczyk <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This moves the sysfs file creation/removal to the w1 core by using the
.groups field, saving code in the slave driver.
Acked-by: Evgeniy Polyakov <[email protected]>
Cc: Jean-Francois Dagenais <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Alexander Stein <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Power-up timing
The DS2408 is sensitive to the power-on slew rate and can inadvertently
power up with a test mode feature enabled. When this occurs, the P0 port
does not respond to the Channel Access Write command. For most reliable
operation, it is recommended to disable the test mode after every power-on
reset using the Disable Test Mode sequence shown below. The 64-bit ROM
code must be transmitted in the same bit sequence as with the Match ROM
command, i.e., least significant bit first. This precaution is
recommended in parasite power mode (VCC pin connected to GND) as well as
with VCC power.
Disable Test Mode:
RST,PD,96h,<64-bit DS2408 ROM Code>,3Ch,RST,PD
[[email protected]: don't use kerenldoc token to introduce a non-kerneldoc comment, tweak whitespace]
Signed-off-by: Jean-Francois Dagenais <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>
Cc: Greg KH <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This patch allows the 1-wire bus to autoload the corresponding module
for each slave being attached.
This works similar to bluetooth protocols.
Signed-off-by: Alexander Stein <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Use platform_device_put() instead of platform_device_unregister() if
platform_device_add() fail, and platform_device_del() should be used in
the error handling case after platform_device_add() success.
Signed-off-by: Wei Yongjun <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Neil Brown <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Use platform_device_put() instead of platform_device_unregister() if
platform_device_add() fail, and platform_device_del() should be used in
the error handling case after platform_device_add() success.
Signed-off-by: Wei Yongjun <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Neil Brown <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Use platform_device_put() instead of platform_device_unregister() if
platform_device_add() fail, and platform_device_del() should be used in
the error handling case after platform_device_add() success.
Signed-off-by: Wei Yongjun <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Neil Brown <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Use platform_device_put() instead of platform_device_unregister() if
platform_device_add() fails, and also add the return value check of
platform_device_add_data().
Signed-off-by: Wei Yongjun <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Neil Brown <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
De-activating this reading back will effectively half the time required
for a write to the output register.
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Jean-Francois Dagenais <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Also fixes some whitespace inconsistency in Kconfig and w1_family.h when
DS2408 chip support was added.
Signed-off-by: Mariusz Bialonczyk <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
w1_therm includes some obsolete code to detect bad_roms, this is no
longer relevant.
The retry code is only used for this bad_rom test, however there is a
CRC check that detects a bad read, but does not trigger a retry. This
patch removes all the bad_rom code and uses the CRC check to trigger
retries.
Signed-off-by: David Stevenson <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This patch adds support for maxim ds1825 based 1-wire temperature sensors.
Signed-off-by: Raphael Assenat <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
The 'mutex' in struct w1_master is use for two very different
purposes.
Firstly it protects various data structures such as the list of all
slaves.
Secondly it protects the w1 buss against concurrent accesses.
This can lead to deadlocks when the ->probe code called while adding a
slave needs to talk on the bus, as is the case for power_supply
devices.
ds2780 and ds2781 drivers contain a work around to track which
process hold the lock simply to avoid this deadlock. bq27000 doesn't
have that work around and so deadlocks.
There are other possible deadlocks involving sysfs.
When removing a device the sysfs s_active lock is held, so the lock
that protects the slave list must take precedence over s_active.
However when access power_supply attributes via sysfs, the s_active
lock must take precedence over the lock that protects accesses to
the bus.
So to avoid deadlocks between w1 slaves and sysfs, these must be
two separate locks. Making them separate means that the work around
in ds2780 and ds2781 can be removed.
So this patch:
- adds a new mutex: "bus_mutex" which serialises access to the bus.
- takes in mutex in w1_search and ds1wm_search while they access
the bus for searching. The mutex is dropped before calling the
callback which adds the slave.
- changes all slaves to use bus_mutex instead of mutex to
protect access to the bus
- removes w1_ds2790_io_nolock and w1_ds2781_io_nolock, and the
related code from drivers/power/ds278[01]_battery.c which
calls them.
Signed-off-by: NeilBrown <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
w1 devices need a mutex to serial IO. Most use master->mutex.
However that is used for other purposes and they can conflict.
In particular master->mutex is held while w1_attach_slave_device is
called.
For bq27000, this registers a 'powersupply' device which tries to read the
current status. The attempt to read will cause a deadlock on
master->mutex.
So create a new per-slave mutex and use that for serializing IO for
bq27000.
Signed-off-by: NeilBrown <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
NULL not 0 should be used with pointers. Just remove the offending
lines since they will default to NULL anyway.
Signed-off-by: H Hartley Sweeten <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This reverts commit f19420c1ac.
It contained lots of errors and warnings and shouldn't have ever been
applied, that was my fault, sorry.
Cc: Markus Franke <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>,
Signed-off-by: Greg Kroah-Hartman <[email protected]>
The function is never used so remove it to avoid bit-rot.
It can trivially be re-added if there is ever a need.
Signed-off-by: NeilBrown <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
As recent change means that we now dereference 'dev' before testing
for NULL.
That means either the change was wrong, or the test isn't needed.
As this function is only called from one driver (bq27x000_battery) and
it always passed a non-NULL dev, it seems good to assume that the
test isn't needed.
So remove it.
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
w1_bq27000 adds a bq27000-battery platform device but does not provide
platform data for it. This causes the bq27x00 driver to dereference a NULL
pointer.
So provide the appropriate platform data. This requires modifying
w1_bq27000_read so that it find the w1 device as the parent of the bq device.
Also there is no point exporting w1_bq27000_read as nothing else uses it
or could use it. So make it static.
Finally, as there is no way to track how many batteries have been found, and
we will probably only find one, use an id number of '-1' to assert that this
is a unique instance.
Signed-off-by: NeilBrown <[email protected]>
Tested-by: Thomas Weber <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
w1_therm devices can either be bus powered or externally powered.
When device is bus powered during temperature conversion the bus
have to be left high to provide necessary power. Some masters also allow
strong power-up to be enabled in this case.
Naturally, no communication over bus can occur during that time.
However, if device has external power then there is no such restriction,
and host can talk to other devices during temperature conversion.
There is command which allows us to check how device is powered,
this patch uses it to release the bus on externally w1_therm powered devices
during temperature conversion.
Also, this changes uninterruptible sleeps there into interruptible ones to
avoid long uninterruptible sleep if w1 subsystem happens to grab bus for
scan during w1_therm_read().
Signed-off-by: Maciej Szmigiero <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Straightforward. As an aside, the ida_init calls are not needed as far as
I can see needed. (DEFINE_IDA does the same already).
Signed-off-by: Jonathan Cameron <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>
Acked-by: Clifton Barnes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
The for loop was looking for i <= 0 instead of i >= 0 so this function
never did anything. Also we started with i = NB_SYSFS_BIN_FILES instead
of "NB_SYSFS_BIN_FILES - 1" which is an off by one bug.
Reported-by: Bojan Prtvar <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Jean-Franois Dagenais <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Add support for the Maxim/Dallas DS2780 Stand-Alone Fuel Gauge IC.
It was suggested to combine this functionality with the current ds2782
driver. Unfortunately, I'm unable to commit the time to refactoring this
driver to that extent and I don't have a platform with the ds2782 part to
validate that there are no regression issues by adding this functionality.
[[email protected]: use min_t()]
Signed-off-by: Clifton Barnes <[email protected]>
Tested-by: Haojian Zhuang <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>
Cc: Ryan Mallon <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>