05 Oct, 2020

3 commits

  • kernel test robot rightly points out that w1_poll_completion() should be
    static, so mark it as such.

    Cc: Ivan Zaentsev
    Reported-by: kernel test robot
    Link: https://lore.kernel.org/r/20201005123703.GA800532@kroah.com
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • The only usage of these structs is to assign their address to the fops
    field in the w1_family struct, which is a const pointer. Make them const
    to allow the compiler to put them in read-only memory.

    This was done with the following Coccinelle semantic patch
    (http://coccinelle.lip6.fr/):

    //
    @r1 disable optional_qualifier @
    identifier i;
    position p;
    @@
    static struct w1_family_ops i@p = {...};

    @ok1@
    identifier r1.i;
    position p;
    identifier s;
    @@
    static struct w1_family s = {
    .fops=&i@p,
    };

    @bad1@
    position p!={r1.p,ok1.p};
    identifier r1.i;
    @@
    i@p

    @depends on !bad1 disable optional_qualifier@
    identifier r1.i;
    @@
    static
    +const
    struct w1_family_ops i={};
    //

    Signed-off-by: Rikard Falkeborn
    Link: https://lore.kernel.org/r/20201004193202.4044-3-rikard.falkeborn@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Rikard Falkeborn
     
  • The fops field in the w1_family struct is never modified. Make it const
    to indicate that. Constifying the pointer makes it possible for drivers
    to declare static w1_family_ops structs const, which in turn will allow
    the compiler to put it in read-only memory.

    Reviewed-by: Sebastian Reichel
    Signed-off-by: Rikard Falkeborn
    Link: https://lore.kernel.org/r/20201004193202.4044-2-rikard.falkeborn@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Rikard Falkeborn
     

02 Oct, 2020

3 commits

  • On my platform (i.MX53) bus access sometimes fails with
    w1_search: max_slave_count 64 reached, will continue next search.

    The reason is the use of jiffies to implement a 200us timeout in
    mxc_w1_ds2_touch_bit().
    On some platforms the jiffies timer resolution is insufficient for this.

    Fix by replacing jiffies by ktime_get().

    For consistency apply the same change to the other use of jiffies in
    mxc_w1_ds2_reset_bus().

    Fixes: f80b2581a706 ("w1: mxc_w1: Optimize mxc_w1_ds2_touch_bit()")
    Cc: stable
    Signed-off-by: Martin Fuzzey
    Link: https://lore.kernel.org/r/1601455030-6607-1-git-send-email-martin.fuzzey@flowbird.group
    Signed-off-by: Greg Kroah-Hartman

    Martin Fuzzey
     
  • GX20MH01 device shares family number 0x28 with DS18B20. The device
    is generally compatible with DS18B20. Added are the lowest 2^-5, 2^-6
    temperature bits in Config register; R2 bit in Config register
    enabling 13 and 14 bit resolutions. It is powered up in 14 bit mode.

    Signed-off-by: Ivan Zaentsev
    Link: https://lore.kernel.org/r/20200904160004.87710-2-ivan.zaentsev@wirenboard.ru
    Acked-by: Evgeniy Polyakov
    Signed-off-by: Greg Kroah-Hartman

    Ivan Zaentsev
     
  • The conversion time of common DS18B20 clones deviates from
    datasheet specs. Allow adjustment and automatic measure of the
    conversion time.

    Add 'conv_time' sysfs attribute:
    *read*: Current conversion time in milliseconds.
    *write*:
    '0': Set default conversion time.
    '1': Measure and set the conversion time. Make a
    single temperature conversion, poll and measure
    an actual value. Measured value is increased
    by 20% for temperature drift. A new conversion
    time is returned by reading the same attribute.
    other positive value:
    Set the conversion time in milliseconds.

    The setting is active until a resolution change. Then it is reset to
    default conversion time for a new resolution.

    Add 'features' sysfs attribute to control optional driver settings
    per device. Bit masks to read/write (logical OR):
    1: Enable check for conversion success. If byte 6 of
    scratchpad memory is 0xC after conversion, and
    temperature reads 85.00 (powerup value) or 127.94
    (insufficient power) - return a conversion error.

    2: Enable poll for conversion completion. Generate read cycles
    after the conversion start and wait for 1's. In parasite
    power mode this feature is not available.

    There are some clones of DS18B20 with fixed 12 bit resolution. Make the
    driver verify the resolution by reading back the device after resolution
    change.

    Signed-off-by: Ivan Zaentsev
    Acked-by: Evgeniy Polyakov
    Link: https://lore.kernel.org/r/20200904160004.87710-1-ivan.zaentsev@wirenboard.ru
    Signed-off-by: Greg Kroah-Hartman

    Ivan Zaentsev
     

16 Jun, 2020

1 commit

  • There is a regular need in the kernel to provide a way to declare having a
    dynamically sized set of trailing elements in a structure. Kernel code should
    always use “flexible array members”[1] for these cases. The older style of
    one-element or zero-length arrays should no longer be used[2].

    [1] https://en.wikipedia.org/wiki/Flexible_array_member
    [2] https://github.com/KSPP/linux/issues/21

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

14 Jun, 2020

1 commit

  • Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over
    '---help---'"), the number of '---help---' has been gradually
    decreasing, but there are still more than 2400 instances.

    This commit finishes the conversion. While I touched the lines,
    I also fixed the indentation.

    There are a variety of indentation styles found.

    a) 4 spaces + '---help---'
    b) 7 spaces + '---help---'
    c) 8 spaces + '---help---'
    d) 1 space + 1 tab + '---help---'
    e) 1 tab + '---help---' (correct indentation)
    f) 1 tab + 1 space + '---help---'
    g) 1 tab + 2 spaces + '---help---'

    In order to convert all of them to 1 tab + 'help', I ran the
    following commend:

    $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

27 May, 2020

4 commits

  • If irq flags are not cleared for certain operations we
    print an error message.

    Since this should never occur in normal operation, this
    patch is an optional safety-net and debugging tool.

    Signed-off-by: H. Nikolaus Schaller
    Link: https://lore.kernel.org/r/2de305d3046c7281a7123347899abbaa64c54fb8.1590255176.git.hns@goldelico.com
    Signed-off-by: Greg Kroah-Hartman

    H. Nikolaus Schaller
     
  • Since

    commit 27d13da8782a ("w1: omap-hdq: Simplify driver with PM runtime autosuspend")

    was applied,

    I did see timeouts and wrong values when reading a bq27000 connected
    to hdq of the omap3. This occurred mainly after boot but remained and
    only sometimes settled down after several reads.

    root@letux:~# time cat /sys/class/power_supply/bq27000-battery/uevent
    POWER_SUPPLY_NAME=bq27000-battery
    POWER_SUPPLY_STATUS=Discharging
    POWER_SUPPLY_PRESENT=1
    POWER_SUPPLY_VOLTAGE_NOW=0
    POWER_SUPPLY_CURRENT_NOW=0
    POWER_SUPPLY_CAPACITY=0
    POWER_SUPPLY_CAPACITY_LEVEL=Normal
    POWER_SUPPLY_TEMP=-2731
    POWER_SUPPLY_TIME_TO_EMPTY_NOW=0
    POWER_SUPPLY_TIME_TO_EMPTY_AVG=0
    POWER_SUPPLY_TIME_TO_FULL_NOW=0
    POWER_SUPPLY_TECHNOLOGY=Li-ion
    POWER_SUPPLY_CHARGE_FULL=0
    POWER_SUPPLY_CHARGE_NOW=0
    POWER_SUPPLY_CHARGE_FULL_DESIGN=0
    POWER_SUPPLY_CYCLE_COUNT=0
    POWER_SUPPLY_ENERGY_NOW=0
    POWER_SUPPLY_POWER_AVG=0
    POWER_SUPPLY_HEALTH=Good
    POWER_SUPPLY_MANUFACTURER=Texas Instruments

    real    0m15.761s
    user    0m0.001s
    sys     0m0.025s
    root@letux:~#

    Sometimes the effect did disappear after accessing
    the device multiple times, speed went up and results
    became correct.

    All this indicates that some interrupts from the hdq
    controller are lost by the driver.

    Enabling debugging revealed that there were spurious tx
    and rx timeouts, i.e. the driver does not always recognise
    interrupts. The main problem is that rx and tx interrupts
    share a single variable which was sometimes reset to
    0 wiping out other interrupts. And it was overwritten
    by a second interrupt, independent of whether the
    previous interrupt was already processed or not.

    This patch improves interrupt handling to avoid such
    races and loss of interrupt flags.

    The ideas are:
    * only the hdq_isr() sets bits in hdq_status
    * it does not reset any bits
    * it does wake_up() if any interrupt is pending
    * bits are only reset by the read/write/break functions
    if they were waited for
    * this makes sure that no interrupts can be lost
    * rx/tx/timeout bits are completely decoupled from each
    other (and not reset all after waiting for any of them)
    * which bits to reset is now specified by a new parameter
    to hdq_reset_irqstatus()
    * hdq_reset_irqstatus() also returns the state before
    resetting so that we can encapsulate the spinlock
    * this should now handle the case that the write and read
    are both already finished quickly before the hdq_write_byte()
    ends.
    * Or that two interrupts occur in succession before
    they are processed by the driver.
    Old code may have reset all status bits making the next
    hdq_read_byte() timeout.
    * the spinlock now always protects changing of bits in function
    hdq_reset_irqstatus() which could become a read-write-modify
    problem if the interrupt handler tries to read-modify-write
    exactly at the same moment
    * we add mutex protection also for hdq_write_byte() just to
    be safe to not to disturb a hdq_read_byte() triggered by
    some other thread/process.

    This patch was tested on a GTA04 and results in no
    boot problems any more. And first read after boot is now ok:

    root@letux:~# time cat /sys/class/power_supply/bq27000-battery/uevent
    POWER_SUPPLY_NAME=bq27000-battery
    POWER_SUPPLY_STATUS=Discharging
    POWER_SUPPLY_PRESENT=1
    POWER_SUPPLY_VOLTAGE_NOW=3970000
    POWER_SUPPLY_CURRENT_NOW=354144
    POWER_SUPPLY_CAPACITY=82
    POWER_SUPPLY_CAPACITY_LEVEL=Normal
    POWER_SUPPLY_TEMP=266
    POWER_SUPPLY_TIME_TO_EMPTY_NOW=7680
    POWER_SUPPLY_TIME_TO_EMPTY_AVG=7380
    POWER_SUPPLY_TECHNOLOGY=Li-ion
    POWER_SUPPLY_CHARGE_FULL=934856
    POWER_SUPPLY_CHARGE_NOW=763976
    POWER_SUPPLY_CHARGE_FULL_DESIGN=1233792
    POWER_SUPPLY_CYCLE_COUNT=82
    POWER_SUPPLY_ENERGY_NOW=2852840
    POWER_SUPPLY_POWER_AVG=1392840
    POWER_SUPPLY_HEALTH=Good
    POWER_SUPPLY_MANUFACTURER=Texas Instruments

    real 0m0.233s
    user 0m0.000s
    sys 0m0.025s
    root@letux:~#

    It was also tested with dev_dbg enabled and more
    printk that all activities behave correctly, especially
    hdq_write_byte(), hdq_read_byte(), omap_hdq_break().

    Not tested is omap_w1_triplet().

    Fixes: 27d13da8782a ("w1: omap-hdq: Simplify driver with PM runtime autosuspend")
    Cc: stable@vger.kernel.org # v5.6+
    Signed-off-by: H. Nikolaus Schaller
    Link: https://lore.kernel.org/r/68fc8623ae741878beef049273696d2377526165.1590255176.git.hns@goldelico.com
    Signed-off-by: Greg Kroah-Hartman

    H. Nikolaus Schaller
     
  • omap_w1_read_byte() should return -1 (or 0xff) in case of
    error (e.g. missing battery).

    The code accidentially overwrites the variable ret and not val,
    which is returned. So it will return the initial value 0 instead
    of -1.

    Fixes: 27d13da8782a ("w1: omap-hdq: Simplify driver with PM runtime autosuspend")
    Cc: stable@vger.kernel.org # v5.6+
    Acked-by: Tony Lindgren
    Signed-off-by: H. Nikolaus Schaller
    Link: https://lore.kernel.org/r/b2c2192b461fbb9b8e9bea4ad514a49557a7210b.1590255176.git.hns@goldelico.com
    Signed-off-by: Greg Kroah-Hartman

    H. Nikolaus Schaller
     
  • Otherwise it will corrupt the console log during debugging.

    Fixes: 7b5362a603a1 ("w1: omap_hdq: Fix some error/debug handling.")
    Cc: stable@vger.kernel.org
    Acked-by: Tony Lindgren
    Signed-off-by: H. Nikolaus Schaller
    Link: https://lore.kernel.org/r/cd0d55749a091214106575f6e1d363c6db56622f.1590255176.git.hns@goldelico.com
    Signed-off-by: Greg Kroah-Hartman

    H. Nikolaus Schaller
     

21 May, 2020

2 commits

  • The variable ret is being initialized with a value that is never read
    and it is being updated later with a new value. The initialization
    is redundant and can be removed.

    Addresses-Coverity: ("Unused value")
    Signed-off-by: Colin Ian King
    Link: https://lore.kernel.org/r/20200519154553.873413-1-colin.king@canonical.com
    Signed-off-by: Greg Kroah-Hartman

    Colin Ian King
     
  • The problem is that we change "p_args" to point to the middle of the
    string so when we free it at the end of the function it's not freeing
    the same pointer that we originally allocated.

    Fixes: e2c94d6f5720 ("w1_therm: adding alarm sysfs entry")
    Signed-off-by: Dan Carpenter
    Link: https://lore.kernel.org/r/20200520120019.GA172354@mwanda
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     

15 May, 2020

9 commits

  • Adding bulk read support:
    Sending a 'trigger' command in the dedicated sysfs entry of bus master
    device send a conversion command for all the slaves on the bus. The sysfs
    entry is added as soon as at least one device supporting this feature
    is detected on the bus.

    The behavior of the sysfs reading temperature on the device is as follow:
    * If no bulk read pending, trigger a conversion on the device, wait for
    the conversion to be done, read the temperature in device RAM
    * If a bulk read has been trigger, access directly the device RAM
    This behavior is the same on the 2 sysfs entries ('temperature' and
    'w1_slave').

    Reading the therm_bulk_read sysfs give the status of bulk operations:
    * '-1': conversion in progress on at least 1 sensor
    * '1': conversion complete but at least one sensor has not been read yet
    * '0': no bulk operation. Reading temperature on ecah device will trigger
    a conversion

    As not all devices support bulk read feature, it has been added in device
    family structure.

    The attribute is set at master level as soon as a supporting device is
    discover. It is removed when the last supported device leave the bus.
    The count of supported device is kept with the static counter
    bulk_read_device_counter.

    A strong pull up is apply on the line if at least one device required it.
    The duration of the pull up is the max time required by a device on the
    line, which depends on the resolution settings of each device. The strong
    pull up could be adjust with the a module parameter.

    Updating documentation in Documentation/ABI/testing/sysfs-driver-w1_therm
    and Documentation/w1/slaves/w1_therm.rst accordingly.

    Signed-off-by: Akira Shimahara
    Link: https://lore.kernel.org/r/20200511203820.411483-1-akira215corp@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Akira Shimahara
     
  • Adding device alarms settings by a dedicated sysfs entry alarms (RW):
    read or write TH and TL in the device RAM. Checking devices in alarm
    state could be performed using the master search command.

    As alarms temperature level are store in a 8 bit register on the device
    and are signed values, a safe cast shall be performed using the min and
    max temperature that device are able to measure. This is done by
    int_to_short inline function.

    A 'write_data' field is added in the device structure, to bind the
    correct writing function, as some devices may have 2 or 3 bytes RAM.

    Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly.

    Signed-off-by: Akira Shimahara
    Link: https://lore.kernel.org/r/20200511203801.411253-1-akira215corp@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Akira Shimahara
     
  • Optimizing temperature reading by reducing waiting conversion time
    according to device resolution settings, as per device specification.
    This is device dependent as not all the devices supports resolution
    setting, so it has been added in device family structures.

    The process to read the temperature on the device has been adapted in a
    new function 'convert_t()', which replace the former 'read_therm()', is
    introduce to deal with this timing. Strong pull up is also applied during
    the required time, according to device power status needs and
    'strong_pullup' module parameter.

    'temperature_from_RAM()' function is introduced to get the correct
    temperature computation (device dependent) from device RAM data.

    An new sysfs entry has been added to ouptut only temperature. The old
    entry w1_slave has been kept for compatibility, without changing its
    output format.

    Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly.

    Signed-off-by: Akira Shimahara
    Link: https://lore.kernel.org/r/20200511203742.411039-1-akira215corp@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Akira Shimahara
     
  • The driver implement 2 hardware functions to access device RAM:
    * copy_scratchpad
    * recall_scratchpad
    They act according to device specifications.

    As EEPROM operations are not device dependent (all w1_therm can perform
    EEPROM read/write operation following the same protocol), it is removed
    from device families structures.

    Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly.

    Signed-off-by: Akira Shimahara
    Link: https://lore.kernel.org/r/20200511203725.410844-1-akira215corp@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Akira Shimahara
     
  • Adding resolution sysfs entry (RW) to get or set the device resolution
    Write values are managed as follow:
    * '9..12': resolution to set in bit
    * Anything else: do nothing
    Read values are :
    * '9..12': device resolution in bit
    * '-xx': xx is kernel error when reading the resolution

    Only supported devices will show the sysfs entry. A new family has been
    created for DS18S20 devices as they do not implement resolution feature.

    The resolution of each device is check when the device is
    discover by the bus master, in 'w1_therm_add_slave(struct w1_slave *)'.
    The status is stored in the device structure w1_therm_family_data so
    that the driver always knows the resolution of each device, which could
    be used later to determine the required conversion duration (resolution
    dependent).

    The resolution is re evaluate each time a user read or write the sysfs
    entry.

    To avoid looping through the w1_therm_families at run time, the pointer
    'specific_functions' is set up to the correct 'w1_therm_family_converter'
    when the slave is added (which mean when it is discovered by the master).
    This initialization is done by a helper function
    'device_family(struct w1_slave *sl)', and a dedicated macro
    'SLAVE_SPECIFIC_FUNC(sl)' allow the access to the specific function of the
    slave device.

    'read_scratchpad' and 'write_scratchpad' are the hardware functions to
    access the device RAM, as per protocol specification.

    It cancel the former 'precision' functions, which was only set and never
    read (so not stored in the device struct).

    Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly.

    Signed-off-by: Akira Shimahara
    Link: https://lore.kernel.org/r/20200511203708.410649-1-akira215corp@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Akira Shimahara
     
  • Adding ext_power sysfs entry (RO). Return the power status of the device:
    - 0: device parasite powered
    - 1: device externally powered
    - xx: xx is kernel error

    The power status of each device is check when the device is
    discover by the bus master, in 'w1_therm_add_slave(struct w1_slave *)'.
    The status is stored in the device structure w1_therm_family_data so
    that the driver always knows the power state of each device, which could
    be used later to determine the required strong pull up to apply on the
    line.

    The power status is re evaluate each time the sysfs ext_power read by
    a user.

    The hardware function 'read_powermode(struct w1_slave *sl)' act just as
    per device specifications, sending W1_READ_PSUPPLY command on the bus,
    and issue a read time slot, reading only one bit.

    A helper function 'bool bus_mutex_lock(struct mutex *lock)' is introduced.
    It try to aquire the bus mutex several times (W1_THERM_MAX_TRY), waiting
    W1_THERM_RETRY_DELAY between two attempt.

    Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly.

    Signed-off-by: Akira Shimahara
    Link: https://lore.kernel.org/r/20200511203650.410439-1-akira215corp@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Akira Shimahara
     
  • Fix reset_select_slave issue during devices discovery by the master on
    bus. The w1_reset_select_slave() from w1_io.c, which was previously used,
    assume that if the slave count is 1 there is only one slave attached on
    the bus. This is not always true. For example when discovering devices,
    when the first device is discover by the bus master, its slave count is
    1, but some other slaves may be on the bus.

    In that case instead of adressing command to the attached slave the
    master throw a SKIP ROM command so that all slaves attached on the bus
    will answer simultenaously causing data collision.

    A dedicated reset_select_slave() function is implemented here,
    it always perform an adressing to each slave using the MATCH ROM
    command.

    Signed-off-by: Akira Shimahara
    Link: https://lore.kernel.org/r/20200511203610.409975-1-akira215corp@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Akira Shimahara
     
  • Adding code comments to split code in dedicated parts. After the global
    declarations (defines, macros and function declarations), code is organized
    as follow :
    - Device and family dependent structures and functions
    - Interfaces functions
    - Helpers functions
    - Hardware functions
    - Sysfs interface functions

    Signed-off-by: Akira Shimahara
    Link: https://lore.kernel.org/r/20200511203535.409599-1-akira215corp@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Akira Shimahara
     
  • Non functional fix, set Kb to b, to avoid any misundertanding.

    Signed-off-by: Angelo Dureghello
    Link: https://lore.kernel.org/r/20200507195050.472483-1-angelo.dureghello@timesys.com
    Signed-off-by: Greg Kroah-Hartman

    Angelo Dureghello
     

30 Jan, 2020

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here is the big char/misc/whatever driver changes for 5.6-rc1

    Included in here are loads of things from a variety of different
    driver subsystems:
    - soundwire updates
    - binder updates
    - nvmem updates
    - firmware drivers updates
    - extcon driver updates
    - various misc driver updates
    - fpga driver updates
    - interconnect subsystem and driver updates
    - bus driver updates
    - uio driver updates
    - mei driver updates
    - w1 driver cleanups
    - various other small driver updates

    All of these have been in linux-next for a while with no reported
    issues"

    * tag 'char-misc-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (86 commits)
    mei: me: add jasper point DID
    char: hpet: Use flexible-array member
    binder: fix log spam for existing debugfs file creation.
    mei: me: add comet point (lake) H device ids
    nvmem: add QTI SDAM driver
    dt-bindings: nvmem: add binding for QTI SPMI SDAM
    dt-bindings: imx-ocotp: Add i.MX8MP compatible
    dt-bindings: soundwire: fix example
    soundwire: cadence: fix kernel-doc parameter descriptions
    soundwire: intel: report slave_ids for each link to SOF driver
    siox: Use the correct style for SPDX License Identifier
    w1: omap-hdq: Simplify driver with PM runtime autosuspend
    firmware: stratix10-svc: Remove unneeded semicolon
    firmware: google: Probe for a GSMI handler in firmware
    firmware: google: Unregister driver_info on failure and exit in gsmi
    firmware: google: Release devices before unregistering the bus
    slimbus: qcom: add missed clk_disable_unprepare in remove
    slimbus: Use the correct style for SPDX License Identifier
    slimbus: qcom-ngd-ctrl: Use dma_request_chan() instead dma_request_slave_channel()
    dt-bindings: SLIMBus: add slim devices optional properties
    ...

    Linus Torvalds
     

15 Jan, 2020

1 commit

  • We've had generic code handling module sysconfig and OCP reset registers
    for omap variants for many years now and all the drivers really needs to
    do is just call runtime PM functions.

    Looks like the omap-hdq driver got only partially updated over the years
    to use runtime PM, and still has lots of custom PM code left.

    We can replace all the custom code for sysconfig, OCP reset, and PM with
    just a few lines of runtime PM autosuspend code.

    In order to set the device mode properly when pm_runtime_get_sync() is
    called during probe, we need to also move parsing of "ti,mode" to happen
    earlier before we call pm_runtime_enable().

    Since we now disable interrupts lazily in omap_hdq_runtime_suspend(), we
    must remove the call to hdq_disable_interrupt() in omap_w1_read_byte().
    And we must clear irqstatus calling wait_event_timeout() on it, so let's
    add hdq_reset_irqstatus() for that.

    Note that the earlier driver specific usage count limit of four seems
    completely artificial and should not be an issue in normal use.

    Cc: Adam Ford
    Cc: Andrew F. Davis
    Cc: Andreas Kemnade
    Cc: H. Nikolaus Schaller
    Cc: Vignesh R
    Tested-by: Andreas Kemnade # gta04
    Tested-by: Adam Ford #logicpd-torpedo-37xx-devkit
    Signed-off-by: Tony Lindgren
    Link: https://lore.kernel.org/r/20191217004048.46298-1-tony@atomide.com
    Signed-off-by: Greg Kroah-Hartman

    Tony Lindgren
     

06 Jan, 2020

1 commit


14 Nov, 2019

1 commit

  • add support for ds2430, 1 page, 256bit (32bytes) eeprom
    (family 0x14).

    Tests done:

    32 bytes dump:

    x@y:~# hexdump -C -n 32 /sys/bus/w1/devices/14-00000158556e/eeprom
    00000000 39 39 0a 00 00 36 0a ff ff ff ff ff ff ff ff ff
    00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    00000020

    34 bytes dump: 32 only displayed

    x@y:~# hexdump -C -n 34 /sys/bus/w1/devices/14-00000158556e/eeprom
    00000000 39 39 0a 00 00 36 0a ff ff ff ff ff ff ff ff ff
    00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    00000020

    pattern write:

    x@y:~# echo 123456789 > /sys/bus/w1/devices/14-00000158556e/eeprom
    x@y:~# hexdump -C -n 54 /sys/bus/w1/devices/14-00000158556e/eeprom
    00000000 31 32 33 34 35 36 37 38 39 0a ff ff ff ff ff ff
    00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    00000020

    specific address 1-byte write

    x@y:~# dd if=/dev/zero of=/sys/bus/w1/devices/14-00000158556e/eeprom \
    count=1 bs=1 seek=4
    1+0 records in
    1+0 records out
    x@y:~# hexdump -C -n 54 /sys/bus/w1/devices/14-00000158556e/eeprom
    00000000 31 32 33 34 00 36 37 38 39 0a ff ff ff ff ff ff
    00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    00000020

    writing binary block

    x@y:~# cat dump-128bytes.bin > /sys/bus/w1/devices/14-00000158556e/eeprom
    cat: write error: File too large

    x@y:~# cat dump-32bytes.bin > /sys/bus/w1/devices/14-00000158556e/eeprom
    x@y:~# hexdump -C -n 54 /sys/bus/w1/devices/14-00000158556e/eeprom
    00000000 10 0b 5b ff ff ff ff ff ff ff ff ff ff ff ff ff
    00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 40
    00000020

    Signed-off-by: Angelo Dureghello
    Link: https://lore.kernel.org/r/20191019204015.61474-1-angelo.dureghello@timesys.com
    Signed-off-by: Greg Kroah-Hartman

    Angelo Dureghello
     

14 Oct, 2019

1 commit


10 Oct, 2019

2 commits

  • If CRC16 is not set, building will fails:

    drivers/w1/slaves/w1_ds250x.o: In function `w1_ds2505_read_page':
    w1_ds250x.c:(.text+0x82f): undefined reference to `crc16'
    w1_ds250x.c:(.text+0x90a): undefined reference to `crc16'
    w1_ds250x.c:(.text+0x91a): undefined reference to `crc16'

    Reported-by: Hulk Robot
    Fixes: 25ec8710d9c2 ("w1: add DS2501, DS2502, DS2505 EPROM device driver")
    Signed-off-by: YueHaibing
    Signed-off-by: Arnd Bergmann
    Link: https://lore.kernel.org/r/20190920060318.35020-1-yuehaibing@huawei.com
    Signed-off-by: Greg Kroah-Hartman

    YueHaibing
     
  • Use devm_platform_ioremap_resource() to simplify the code a bit.
    This is detected by coccinelle.

    Signed-off-by: YueHaibing
    Link: https://lore.kernel.org/r/20191009144435.12656-1-yuehaibing@huawei.com
    Signed-off-by: Greg Kroah-Hartman

    YueHaibing
     

04 Sep, 2019

2 commits

  • Add a 1-Wire slave driver to support DS250x EPROM deivces. This
    slave driver attaches the devices to the NVMEM subsystem for
    an easy in-kernel usage.

    Signed-off-by: Thomas Bogendoerfer
    Link: https://lore.kernel.org/r/20190831082623.15627-3-tbogendoerfer@suse.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Bogendoerfer
     
  • Starting with SGI Origin machines nearly every new SGI ASIC contains
    an 1-Wire master. They are used for attaching One-Wire prom devices,
    which contain information about part numbers, revision numbers,
    serial number etc. and MAC addresses for ethernet interfaces.
    This patch adds a master driver to support this IP block.
    It also adds an extra field dev_id to struct w1_bus_master, which
    could be in used in slave drivers for creating unique device names.

    Signed-off-by: Thomas Bogendoerfer
    Link: https://lore.kernel.org/r/20190831082623.15627-2-tbogendoerfer@suse.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Bogendoerfer
     

05 Aug, 2019

2 commits


15 Jul, 2019

2 commits

  • There are lots of documents under Documentation/*.txt and a few other
    orphan documents elsehwere that belong to the driver-API book.

    Move them to their right place.

    Reviewed-by: Cornelia Huck # vfio-related parts
    Acked-by: Logan Gunthorpe # switchtec
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • As it has some function definitions, move them to connector.h.

    The remaining conversion is actually:
    - add blank lines and identation in order to identify paragraphs;
    - fix tables markups;
    - add some lists markups;
    - mark literal blocks;
    - adjust title markups.

    At its new index.rst, let's add a :orphan: while this is not linked to
    the main index.rst file, in order to avoid build warnings.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

23 Jun, 2019

1 commit


19 Jun, 2019

2 commits

  • Based on 2 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation #

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 4122 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Enrico Weigelt
    Reviewed-by: Kate Stewart
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • Based on 2 normalized pattern(s):

    this source code is licensed under the gnu general public license
    version 2 see the file copying for more details

    this source code is licensed under general public license version 2
    see

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 52 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Enrico Weigelt
    Reviewed-by: Allison Randal
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190602204653.449021192@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

09 Jun, 2019

1 commit