18 Nov, 2011

1 commit

  • 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
    Acked-by: Evgeniy Polyakov
    Signed-off-by: Greg Kroah-Hartman

    Maciej Szmigiero
     

03 Nov, 2011

2 commits


26 Aug, 2011

2 commits


27 Jul, 2011

1 commit


27 May, 2011

2 commits

  • 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.

    [akpm@linux-foundation.org: use min_t()]
    Signed-off-by: Clifton Barnes
    Tested-by: Haojian Zhuang
    Cc: Evgeniy Polyakov
    Cc: Ryan Mallon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Clifton Barnes
     
  • This DS2408 w1 slave driver is not complete for all the features of the
    chip, but its sufficient if you use it as a simple IO expander.

    [randy.dunlap@oracle.com: fix w1_ds2408.c printk formats]
    Signed-off-by: Jean-François Dagenais
    Cc: Evgeniy Polyakov
    Cc: Szabolcs Gyurko
    Cc: Matt Reimer
    Signed-off-by: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jean-François Dagenais
     

14 Jan, 2011

1 commit

  • This is a 1-wire/w1 DS2423 slave driver for reading the values from all 4
    counters available DS2423 devices by using standard w1_slave file. In
    ds2423 the counters are tied to ram pages 12-15 in and each of those
    ram-pages. Each of these counter values (and asoociated ram page values)
    are represented as a own line in w1_slave file. Driver has been tested on
    mips and x86.

    usage example:
    cat /sys/bus/w1/devices/1d-00000009b964/w1_slave

    00 02 00 00 00 00 00 00 00 6d 38 00 ff ff 00 00 fe ff 00 00 ff ff 00 00 ff
    ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff crc=YES c=2
    00 02 00 00 00 00 00 00 00 e0 1f 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff
    ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff crc=YES c=2
    00 5a 0e 5f 18 00 00 00 00 0b 28 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff
    ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff crc=YES c=408882778
    00 05 00 00 00 00 00 00 00 8d 39 ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff crc=YES c=5

    Patch includes also the documentation.

    [randy.dunlap@oracle.com: fix ds2423 build, needs to select CRC16]
    Signed-off-by: Mika Laitio
    Signed-off-by: Randy Dunlap
    Cc: Evgeniy Polyakov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mika Laitio
     

22 May, 2010

1 commit


25 Apr, 2010

1 commit

  • Fix regression caused by commit 507e2fbaaacb6f164b4125b87c5002f95143174b
    ("w1: w1 temp calculation overflow fix") whereby negative temperatures for
    the DS18B20 are not converted properly.

    When the temperature exceeds 32767 milli-degrees the temperature overflows
    to -32768 millidegrees. These are both well within the -55 - +125 degree
    range for the sensor.

    Addresses https://bugzilla.kernel.org/show_bug.cgi?id=12646

    Signed-of-by: Ian Dall
    Cc: Evgeniy Polyakov
    Tested-by: Karsten Elfenbein
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Dall
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

09 Jun, 2009

2 commits

  • This adds support for ds2760's sleep mode feature. With this feature
    enabled, the chip enters a deep sleep mode and disconnects from the
    battery when the w1 line is held down for more than 2 seconds.

    This new behaviour can be switched on and off using a new module
    parameter.

    Signed-off-by: Daniel Mack
    Cc: Szabolcs Gyurko
    Acked-by: Matt Reimer
    Acked-by: Evgeniy Polyakov
    Signed-off-by: Anton Vorontsov

    Daniel Mack
     
  • In order to modify the DS2762's status registers and to add support for
    sleep mode, there is need for functions to write the internal EEPROM.

    Signed-off-by: Daniel Mack
    Acked-by: Matt Reimer
    Acked-by: Szabolcs Gyurko
    Acked-by: Evgeniy Polyakov
    Signed-off-by: Anton Vorontsov

    Daniel Mack
     

28 Feb, 2009

2 commits


12 Feb, 2009

1 commit

  • Addresses http://bugzilla.kernel.org/show_bug.cgi?id=12646

    When the temperature exceeds 32767 milli-degrees the temperature overflows
    to -32768 millidegrees. These are bothe well within the -55 - +125 degree
    range for the sensor.

    Fix overflow in left-shift of a u8.

    Signed-off-by: Ian Dall
    Signed-off-by: Evgeniy Polyakov
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Dall
     

13 Nov, 2008

1 commit


20 Oct, 2008

1 commit

  • Tejun's commit 7b595756ec1f49e0049a9e01a1298d53a7faaa15 made sysfs
    attribute->owner unnecessary. But the field was left in the structure to
    ease the merge. It's been over a year since that change and it is now
    time to start killing attribute->owner along with its users - one arch at
    a time!

    This patch is attempt #1 to get rid of attribute->owner only for
    CONFIG_X86_64 or CONFIG_X86_32 . We will deal with other arches later on
    as and when possible - avr32 will be the next since that is something I
    can test. Compile (make allyesconfig / make allmodconfig / custom config)
    and boot tested.

    akpm: the idea is that we put the declaration of sttribute.owner inside
    `#ifndef CONFIG_X86'. But that proved to be too ambitious for now because
    new usages kept on turning up in subsystem trees.

    [akpm: remove the ifdef for now]
    Signed-off-by: Parag Warudkar
    Cc: Greg KH
    Cc: Ingo Molnar
    Cc: Tejun Heo
    Cc: Len Brown
    Cc: Jens Axboe
    Cc: Jean Delvare
    Cc: Roland Dreier
    Cc: David Brownell
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Parag Warudkar
     

17 Oct, 2008

4 commits

  • [akpm@linux-foundation.org: minor fixlets and cleanups]
    Signed-off-by: Bernhard Weirich
    Signed-off-by: Evgeniy Polyakov
    Cc: Ben Gardner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Bernhard Weirich
     
  • sl->master->mutex and dev->mutex refer to the same mutex variable, but be
    consistent and use the same set of pointers for the lock and unlock calls.
    It is less confusing (and one less pointer dereference this way).

    Signed-off-by: David Fries
    Signed-off-by: Evgeniy Polyakov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Fries
     
  • Fixed data reading bug by replacing binary attribute with device one.

    Switching the sysfs read from bin_attribute to device_attribute. The data
    is far under PAGE_SIZE so the binary interface isn't required. As the
    device_attribute interface will make one call to w1_therm_read per file
    open and buffer, the result is, the following problems go away.

    buffer overflow:
    Execute a short read on w1_slave and w1_therm_read_bin would still
    return the full string size worth of data clobbering the user space
    buffer when it returned. Switching to device_attribute avoids the
    buffer overflow problems. With the snprintf formatted output dealing
    with short reads without doing a conversion per read would have
    been difficult.
    bad behavior:
    `cat w1_slave` would cause two temperature conversions to take place.
    Previously the code assumed W1_SLAVE_DATA_SIZE would be returned with
    each read. It would not return 0 unless the offset was less
    than W1_SLAVE_DATA_SIZE. The result was the first read did a
    temperature conversion, filled the buffer and returned, the
    offset in the second read would be less than
    W1_SLAVE_DATA_SIZE and also fill the buffer and return, the
    third read would finnally have a big enough offset to return 0
    and cause cat to stop. Now w1_therm_read will be called at
    most once per open.

    Signed-off-by: David Fries
    Signed-off-by: Evgeniy Polyakov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Fries
     
  • Added strong pullup to thermal sensor driver and general documentation on
    the sensor.

    Signed-off-by: David Fries
    Signed-off-by: Evgeniy Polyakov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Fries
     

07 Feb, 2008

1 commit

  • Standardize the temperature units to millidegrees C for the two sensor
    conversion routines. Previously the routines were,

    w1_DS18B20_convert_temp degrees C
    w1_DS18S20_convert_temp millidegrees C

    Unfortunately this will break any program using the ds18b20 value as it
    will now be 1000 times bigger. Fortunately there can't be that many users
    out there, or some of these bugs will have been fixed by now, such as the
    negative C error (see previous patch) that makes me think the ds18b20 is
    the better choice to change because of the current bugs.

    Signed-off-by: David Fries
    Cc: Evgeniy Polyakov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Fries
     

23 Jan, 2008

2 commits

  • The extra rom[0] check is flagging valid temperatures as invalid when
    there is already a CRC data transmission check.

    w1_therm_read_bin()
    if (rom[8] == crc && rom[0])
    verdict = 1;

    Requiring rom[0] to be non-zero will flag as invalid temperature
    conversions when the low byte is zero, specifically the temperatures 0C,
    16C, 32C, 48C, -16C, -32C, and -48C.

    The CRC check is produced on the device for the previous 8 bytes and is
    required to ensure the data integrity in transmission. I don't see why the
    extra check for rom[0] being non-zero is in there. Evgeniy Polyakov didn't
    know either. Just for a check I unplugged the sensor, executed a
    temperature conversion, and read the results. The read was all ff's, which
    also failed the CRC, so it doesn't need to protect against a disconnected
    sensor.

    I have more extensive patches in the work, but these two trivial ones will
    do for today. I would like to hear from people who use the ds2490 USB to
    one wire dongle. 1 if you would be willing to test the patches as I
    currently only have the one sensor on a short parisite powered wire, 2 if
    there is any cheap sources for the ds2490.

    Signed-off-by: David Fries
    Acked-by: Evgeniy Polyakov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Fries
     
  • Correct the decoding of negative C temperatures. The code did a binary OR
    of two bytes to make a 16 bit value, but assignd it to an integer. This
    caused the value to not be sign extended and to loose that it was a
    negative number in the assignment.

    Before the patch (in my freezer),
    w1_slave
    ed fe 4b 46 7f ff 03 10 e4 : crc=e4 YES
    ed fe 4b 46 7f ff 03 10 e4 t=4078
    With the patch,
    e3 fe 4b 46 7f ff 0d 10 81 : crc=81 YES
    e3 fe 4b 46 7f ff 0d 10 81 t=-17

    Signed-off-by: David Fries
    Acked-by: Evgeniy Polyakov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Fries
     

20 Jul, 2007

1 commit

  • Transform some calls to kmalloc/memset to a single kzalloc (or kcalloc).

    Here is a short excerpt of the semantic patch performing
    this transformation:

    @@
    type T2;
    expression x;
    identifier f,fld;
    expression E;
    expression E1,E2;
    expression e1,e2,e3,y;
    statement S;
    @@

    x =
    - kmalloc
    + kzalloc
    (E1,E2)
    ... when != \(x->fld=E;\|y=f(...,x,...);\|f(...,x,...);\|x=E;\|while(...) S\|for(e1;e2;e3) S\)
    - memset((T2)x,0,E1);

    @@
    expression E1,E2,E3;
    @@

    - kzalloc(E1 * E2,E3)
    + kcalloc(E1,E2,E3)

    [akpm@linux-foundation.org: get kcalloc args the right way around]
    Signed-off-by: Yoann Padioleau
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Acked-by: Russell King
    Cc: Bryan Wu
    Acked-by: Jiri Slaby
    Cc: Dave Airlie
    Acked-by: Roland Dreier
    Cc: Jiri Kosina
    Acked-by: Dmitry Torokhov
    Cc: Benjamin Herrenschmidt
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Pierre Ossman
    Cc: Jeff Garzik
    Cc: "David S. Miller"
    Acked-by: Greg KH
    Cc: James Bottomley
    Cc: "Antonino A. Daplas"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yoann Padioleau
     

17 Jul, 2007

1 commit

  • Use menuconfigs instead of menus, so the whole menu can be disabled at once
    instead of going through all options.

    Signed-off-by: Jan Engelhardt
    Cc: Evgeniy Polyakov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Engelhardt
     

16 Jul, 2007

2 commits


12 Jul, 2007

2 commits

  • Well, first of all, I don't want to change so many files either.

    What I do:
    Adding a new parameter "struct bin_attribute *" in the
    .read/.write methods for the sysfs binary attributes.

    In fact, only the four lines change in fs/sysfs/bin.c and
    include/linux/sysfs.h do the real work.
    But I have to update all the files that use binary attributes
    to make them compatible with the new .read and .write methods.
    I'm not sure if I missed any. :(

    Why I do this:
    For a sysfs attribute, we can get a pointer pointing to the
    struct attribute in the .show/.store method,
    while we can't do this for the binary attributes.
    I don't know why this is different, but this does make it not
    so handy to use the binary attributes as the regular ones.
    So I think this patch is reasonable. :)

    Who benefits from it:
    The patch that exposes ACPI tables in sysfs
    requires such an improvement.
    All the table binary attributes share the same .read method.
    Parameter "struct bin_attribute *" is used to get
    the table signature and instance number which are used to
    distinguish different ACPI table binary attributes.

    Without this parameter, we need to offer different .read methods
    for different ACPI table binary attributes.
    This is impossible as there are various ACPI tables on different
    platforms, and we don't know what they are until they are loaded.

    Signed-off-by: Zhang Rui
    Signed-off-by: Greg Kroah-Hartman

    Zhang Rui
     
  • sysfs is now completely out of driver/module lifetime game. After
    deletion, a sysfs node doesn't access anything outside sysfs proper,
    so there's no reason to hold onto the attribute owners. Note that
    often the wrong modules were accounted for as owners leading to
    accessing removed modules.

    This patch kills now unnecessary attribute->owner. Note that with
    this change, userland holding a sysfs node does not prevent the
    backing module from being unloaded.

    For more info regarding lifetime rule cleanup, please read the
    following message.

    http://article.gmane.org/gmane.linux.kernel/510293

    (tweaked by Greg to not delete the field just yet, to make it easier to
    merge things properly.)

    Signed-off-by: Tejun Heo
    Cc: Cornelia Huck
    Cc: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     

10 Jul, 2007

1 commit


29 Jun, 2007

1 commit


13 Feb, 2007

1 commit


14 Dec, 2006

1 commit


08 Dec, 2006

1 commit


04 Dec, 2006

1 commit


23 Jun, 2006

2 commits