30 Dec, 2020

1 commit

  • commit 3418bd7cfce0bd8ef1ccedc4655f9f86f6c3b0ca upstream.

    The ATMEL_TC_ETRGEDG_* defines are not masks but rather possible values
    for CMR. This patch fixes the action_get() callback to properly check
    for these values rather than mask them.

    Fixes: 106b104137fd ("counter: Add microchip TCB capture counter")
    Signed-off-by: William Breathitt Gray
    Acked-by: Alexandre Belloni
    Acked-by: Kamel Bouhara
    Cc:
    Link: https://lore.kernel.org/r/20201114232805.253108-1-vilhelm.gray@gmail.com
    Signed-off-by: Jonathan Cameron
    Signed-off-by: Greg Kroah-Hartman

    William Breathitt Gray
     

02 Nov, 2020

1 commit

  • The values given were the offset of the register after the last
    register instead of the actual last register in each range. Fix
    by using the correct last register of each range.

    Fixes: f213729f6796 ("counter: new TI eQEP driver")
    Signed-off-by: David Lechner
    Acked-by: William Breathitt Gray
    Link: https://lore.kernel.org/r/20201025165122.607866-1-david@lechnology.com
    Signed-off-by: Jonathan Cameron

    David Lechner
     

30 Sep, 2020

1 commit

  • Replace commas with semicolons. What is done is essentially described by
    the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):

    //
    @@ expression e1,e2; @@
    e1
    -,
    +;
    e2
    ... when any
    //

    Signed-off-by: Julia Lawall
    Reviewed-by: David Lechner
    Link: https://lore.kernel.org/r/1601233948-11629-16-git-send-email-Julia.Lawall@inria.fr
    Signed-off-by: Jonathan Cameron

    Julia Lawall
     

24 Sep, 2020

1 commit

  • The only usage of mchp_tc_ops is to assign its address to the ops field
    in the counter_device struct which is a const pointer. Make it const to
    allow the compiler to put it in read-only memory.

    Signed-off-by: Rikard Falkeborn
    Acked-by: William Breathitt Gray
    Link: https://lore.kernel.org/r/20200922201941.41328-1-rikard.falkeborn@gmail.com
    Signed-off-by: Jonathan Cameron

    Rikard Falkeborn
     

22 Aug, 2020

1 commit


22 Jul, 2020

1 commit


20 Jul, 2020

2 commits

  • This drivers allows to use the capture mode of the Timer Counter Block
    hardware block available in Microchip SoCs through the counter subsystem.

    Two functions of the counter are supported for the moment: period
    capture and quadrature decoder. The latter is only supported by the
    SAMA5 series of SoCs.

    For the period capture mode a basic setup has been chosen that will
    reset the counter each time the period is actually reached. Of course
    the device offers much more possibilities.

    For quadrature mode, both channel 0 and 1 must be configured even if we
    only capture the position (no revolution/rotation).

    Signed-off-by: Kamel Bouhara
    Signed-off-by: Jonathan Cameron

    Kamel Bouhara
     
  • We need the staging fixes in here, and it resolves a merge issue with an
    iio driver.

    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

14 Jun, 2020

3 commits

  • Add lock protection from race conditions to the 104-quad-8 counter
    driver for filter clock prescaler code changes. Mutex calls used for
    protection.

    Signed-off-by: Syed Nayyar Waris
    Fixes: de65d0556343 ("counter: 104-quad-8: Support Filter Clock Prescaler")
    Signed-off-by: Jonathan Cameron

    Syed Nayyar Waris
     
  • Add lock protection from race conditions to 104-quad-8 counter driver
    for differential encoder status code changes. Mutex lock calls used for
    protection.

    Signed-off-by: Syed Nayyar Waris
    Fixes: 954ab5cc5f3e ("counter: 104-quad-8: Support Differential Encoder Cable Status")
    Signed-off-by: Jonathan Cameron

    Syed Nayyar Waris
     
  • This patch applies the semantic patch:
    @@
    expression I, P, SP;
    @@
    I = devm_iio_device_alloc(P, SP);
    ...
    - I->dev.parent = P;

    It updates 302 files and does 307 deletions.
    This semantic patch also removes some comments like
    '/* Establish that the iio_dev is a child of the i2c device */'

    But this is is only done in case where the block is left empty.

    The patch does not seem to cover all cases. It looks like in some cases a
    different variable is used in some cases to assign the parent, but it
    points to the same reference.
    In other cases, the block covered by ... may be just too big to be covered
    by the semantic patch.

    However, this looks pretty good as well, as it does cover a big bulk of the
    drivers that should remove the parent assignment.

    Signed-off-by: Alexandru Ardelean
    Signed-off-by: Jonathan Cameron

    Alexandru Ardelean
     

20 Apr, 2020

1 commit


09 Mar, 2020

2 commits


21 Feb, 2020

2 commits

  • The stm32-timer-cnt driver doesn't use the iio interface. The iio headers
    aren't relevant and can be removed as reported by William in [1].
    With this change, mod_devicetable.h needs to be added to define the
    'of_device_id' struct.

    [1] https://lkml.org/lkml/2020/2/10/1516

    Reported-by: William Breathitt Gray
    Signed-off-by: Fabrice Gasnier
    Signed-off-by: Jonathan Cameron

    Fabrice Gasnier
     
  • Add suspend/resume PM sleep ops. When going to low power, enforce the
    counter isn't active. Gracefully restore its state upon resume in case
    it's been left enabled prior to suspend.

    Acked-by: William Breathitt Gray
    Signed-off-by: Fabrice Gasnier
    Signed-off-by: Jonathan Cameron

    Fabrice Gasnier
     

19 Oct, 2019

1 commit

  • The count_read and count_write callbacks are simplified to pass val as
    unsigned long rather than as an opaque data structure. The opaque
    counter_count_read_value and counter_count_write_value structures,
    counter_count_value_type enum, and relevant counter_count_read_value_set
    and counter_count_write_value_get functions, are removed as they are no
    longer used.

    Cc: Patrick Havelange
    Acked-by: Fabrice Gasnier
    Acked-by: David Lechner
    Signed-off-by: William Breathitt Gray
    Signed-off-by: Jonathan Cameron

    William Breathitt Gray
     

18 Oct, 2019

2 commits

  • Immutable branch being merged in. Created as this also involves
    moving some dependencies around, outside of the counter subsystem.
    It's possible it will want to be pulled into other trees.

    Jonathan Cameron
     
  • This adds a new counter driver for the Texas Instruments Enhanced
    Quadrature Encoder Pulse (eQEP) module.

    Only very basic functionality is currently implemented - only enough to
    be able to read the position. The actual device has many more features
    which can be added to the driver on an as-needed basis.

    It is not possible to read the QEPA/B signal values in hardware, so
    that feature is omitted.

    The TI_PWMSS kernel option is selected in Kconfig to enable the parent
    bus, which is needed for power management.

    Signed-off-by: David Lechner
    Signed-off-by: Jonathan Cameron

    David Lechner
     

08 Oct, 2019

1 commit


05 Oct, 2019

2 commits

  • Fix the following warnings when documentation is built:
    drivers/counter/stm32-lptimer-cnt.c:354: warning: cannot understand
    function prototype: 'enum stm32_lptim_cnt_function'

    Signed-off-by: Fabrice Gasnier
    Fixes: 597f55e3f36c ("counter: stm32-lptimer: add counter device")
    Signed-off-by: Jonathan Cameron

    Fabrice Gasnier
     
  • Fix the following warning when documentation is built:
    drivers/counter/stm32-timer-cnt.c:37: warning: cannot understand function
    prototype: 'enum stm32_count_function'

    Signed-off-by: Fabrice Gasnier
    Fixes: ad29937e206f ("counter: Add STM32 Timer quadrature encoder")
    Signed-off-by: Jonathan Cameron

    Fabrice Gasnier
     

28 Jul, 2019

1 commit


12 Jul, 2019

1 commit

  • Pull staging and IIO driver updates from Greg KH:
    "Here is the big Staging and IIO driver update for 5.3-rc1.

    Lots of new IIO drivers are in here, along with loads of tiny staging
    driver cleanups and fixes. Overall we almost break even with the same
    lines added as removed.

    Full details are in the shortlog, they are too large to list here.

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

    * tag 'staging-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (608 commits)
    staging: kpc2000: simplify comparison to NULL in fileops.c
    staging: kpc2000: simplify comparison to NULL in dma.c
    staging: kpc2000: simplify comparison to NULL in kpc2000_spi.c
    staging: rtl8723bs: hal: remove redundant assignment to packetType
    staging: rtl8723bs: Change return type of hal_btcoex_IsBtDisabled()
    staging: rtl8723bs: Remove rtw_btcoex_DisplayBtCoexInfo()
    staging: rtl8723bs: Remove function rtw_btcoex_GetDBG()
    staging: rtl8723bs: Remove function rtw_btcoex_SetDBG()
    staging: rtl8723bs: Remove rtw_btcoex_IsBTCoexCtrlAMPDUSize()
    staging: rtl8723bs: Remove rtw_btcoex_BtInfoNotify()
    staging: rtl8723bs: Remove rtw_btcoex_ScanNotify()
    staging: rtl8723bs: Remove rtw_btcoex_SetSingleAntPath()
    staging: rtl8723bs: Remove rtw_btcoex_SetPGAntNum()
    staging: rtl8192e: remove redundant initialization of rtstatus
    staging: rtl8723bs: Remove rtw_btcoex_GetRaMask()
    staging: rtl8723bs: Remove rtw_btcoex_SetChipType()
    staging: rtl8723bs: Remove rtw_btcoex_ConnectNotify()
    staging: rtl8723bs: Remove rtw_btcoex_SetBTCoexist()
    staging: rtl8723bs: Remove rtw_btcoex_IsBtDisabled()
    staging: rtl8723bs: Remove rtw_btcoex_IsBtControlLps()
    ...

    Linus Torvalds
     

01 Jul, 2019

1 commit

  • …iio into staging-next

    Jonathan writes:

    Second set of IIO device support, features, cleanups and minor fixes for 5.3.

    A few bits for the counters subsystem mixed in here as well.
    There are some late breaking fixes as well, which aren't so urgent
    they can't wait for the merge window.

    New Device Support
    * adf4371
    - New driver + bindings.
    - Support the adf4372 PLL. Mostly ID and bindings.
    * ad8366 (note includes rework of driver needed to allow support for these).
    - Support the ADL5240 variable gain amplifier (VGA).
    - Support the ADA4961 digital gain amplifier (DGA).
    * dps310
    - New driver, in several parts from different authors for this temp
    and pressure sensor.
    - Includes errata workaround for a temperature reading issue.
    * stk3310
    - Support the stk3335, mostly ID.

    Features and cleanups
    * core
    - drop error handling on debugfs registration.
    - harden by making sure we don't overrun iio_chan_info_postfix.
    * docs
    - convert remaining docs to rst. At somepoint we'll fit these few
    into the main IIO docs.
    - improve sampling_frequency_available docs but explaining the
    range form.
    * ad_sigma_delta
    - Drop a pointless goto.
    * ad2s1210
    - Drop pointless platform data null check seeing as we don't actually
    use platform data anymore.
    * ad7124
    - Relax limitation on channel numbers to allow pseudo different channels.
    - Support control of whether the input is buffered via DT.
    - Use dynamic allocation for channel configuration to make it easier
    to support new devices.
    - YAML binding conversion.
    * ad7150
    - Comment tidy up.
    - Consistent and simple if (ret) handling of i2c errors.
    - FIELD_GET and GENMASK.
    - Ternary rather than !!(condition) for readability.
    - Use macros to avoid repetition of channel definitions.
    * ad7606
    - Add software channel config (rather that pin controlled)
    - Refactor to simplify addition of new part in future.
    * ad7746
    - of_deivce_id table.
    * ad7780
    - MAINTAINERS entry
    - YAML DT bindings.
    * ad8366
    - Stop using core mlock in favour of well scoped local lock.
    - SPDX + copyright date update.
    * ad9834
    - of_device_id table
    * adf4371
    - Add support for output stage muting before lock on has occured.
    * adis library
    - MAINTAINERS entry to reflect that this now Alexandru's problem ;)
    * adis162xx:
    - Fix a slightly incorrect set of comments and print statements on
    minimum supported voltage.
    * adis16203
    - of_device_id table.
    * adis16240
    - Add of_device_id table (in two parts as first patch only used it for
    MODULE_DEVICE_TABLE.)
    * adt7316-spi
    - of_device_id table
    * adxl372
    - YAML DT binding conversion.
    - Cleanup use of buffer callback functions (precursor to core rework).
    * bh1710
    - Simplify getting the i2c adapter from the client.
    * dht11
    - Mote to newer GPIO consumer interface.
    * kxcjk-1013.c
    - Add binding for sensor in display of some ultrabooks after userspace
    tools updated for it not be a problem to report two similar sensors.
    * imx7d
    - drop unused variables.
    - white space
    - define instead of variable for clock frequency that is fixed.
    - drop pointless error message.
    * messon_saradc
    - SPDX
    * sps30
    - MAINTAINERS entry
    - YAML binding conversion.
    * st_accel
    - Tidy up ordering in various buffer related callbacks. This is
    part of a long running effort to simplify the core code.
    * stm32-dfsdm:
    - Manage the resolution cleanly in triggerd modes.
    - Add fast mode support which allows more flexible filter choices.
    - Add a comment on the reason for a 16 bit record when technically
    not 'required'.
    * st_lsm6dsx
    - Embed device name in the sensor_settings struct as i3c doesn't
    have a convenient name field to use for this.
    * xilinx-adc
    - Relax constraints on supported platforms to reflect that this
    can used with FPGAs on PCIe cards and hence many architectures.
    * counters/ftm-quaddec
    - Fix some formatting io MODULE_AUTHOR
    - MAINTAINERS entry

    Fixes
    * tools
    - fix incorrect handling of 32 bit channels.
    * sca3000
    - Potential endian bug that is unlikely to bite anyone (be64 host
    seems unlikely for this old part).
    * stm32-adc
    - Add vdda-supply. On some boards it needs to be turned on to supply
    the ADC. DT bindings included.
    * stm32-dfsdm
    - Fix output resolution to work with filter orders other than 3.
    - Fix output datatype as it's signed and previously claimed not to be.

    * tag 'iio-for-5.3b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (68 commits)
    iio: iio-utils: Fix possible incorrect mask calculation
    iio: frequency: adf4371: Add support for output stage mute
    dt-bindings: iio: frequency: Add ADF4372 PLL documentation
    iio: frequency: adf4371: Add support for ADF4372 PLL
    dt-bindings: iio: adc: Add buffered input property
    Convert AD7124 bindings documentation to YAML format.
    iio: adc: ad7124: Shift to dynamic allocation for channel configuration
    iio: adc: ad7124: Add buffered input support
    iio: adc: ad7124: Remove input number limitation
    MAINTAINERS: add ADIS IMU driver library entry
    iio: adis162xx: fix low-power docs & reports
    counter/ftm-quaddec: Add missing '>' in MODULE_AUTHOR
    iio: core: no need to check return value of debugfs_create functions
    docs: iio: convert to ReST
    iio: adc: stm32-adc: add missing vdda-supply
    dt-bindings: iio: adc: stm32: add missing vdda supply
    iio: adc: stm32-dfsdm: add comment for 16 bits record
    iio: adc: stm32-dfsdm: add fast mode support
    iio: adc: stm32-dfsdm: manage data resolution in trigger mode
    iio: adc: stm32-dfsdm: fix data type
    ...

    Greg Kroah-Hartman
     

23 Jun, 2019

1 commit


22 Jun, 2019

1 commit


18 Jun, 2019

1 commit

  • …jic23/iio into staging-linus

    Jonathan writes:

    Second set of IIO fixes for the 5.2 cycle.

    * ad7150
    - sense of bit for controlling adaptive vs fixed threshold was flipped.
    * adt7316
    - Fix a build issue due to wrong headers for gpio usage.
    * lsm6dsx
    - correctly suspend / resume i2c slaves when the host goes to sleep.
    * mlx90632
    - relax a compatability check to allow for newer devices.

    Also one counters fix

    * counter/ftm-quaddec
    - missing dependencies in Kconfig.

    * tag 'iio-fixes-for-5.2b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
    counter/ftm-quaddec: Add missing dependencies in Kconfig
    staging: iio: adt7316: Fix build errors when GPIOLIB is not set
    iio: temperature: mlx90632 Relax the compatibility check
    iio: imu: st_lsm6dsx: fix PM support for st_lsm6dsx i2c controller
    staging:iio:ad7150: fix threshold mode config bit

    Greg Kroah-Hartman
     

09 Jun, 2019

1 commit


08 Jun, 2019

1 commit


25 May, 2019

1 commit


21 May, 2019

1 commit


26 Apr, 2019

5 commits

  • This driver exposes the counter for the quadrature decoder of the
    FlexTimer Module, present in the LS1021A soc.

    Signed-off-by: Patrick Havelange
    Signed-off-by: William Breathitt Gray
    Signed-off-by: Greg Kroah-Hartman

    Patrick Havelange
     
  • Add support for new counter device to stm32-lptimer.

    Signed-off-by: Fabrice Gasnier
    Reviewed-by: Jonathan Cameron
    Signed-off-by: William Breathitt Gray
    Signed-off-by: Greg Kroah-Hartman

    Fabrice Gasnier
     
  • Implement counter part of the STM32 timer hardware block by using
    counter API. Hardware only supports X2 and X4 quadrature modes. A
    ceiling value can be set to define the maximum value reachable by the
    counter.

    Signed-off-by: Benjamin Gaignard
    Co-authored-by: Fabrice Gasnier
    Reviewed-by: Jonathan Cameron
    Signed-off-by: William Breathitt Gray
    Signed-off-by: Greg Kroah-Hartman

    Benjamin Gaignard
     
  • This patch adds support for the Generic Counter interface to the
    104-QUAD-8 driver. The existing 104-QUAD-8 device interface should not
    be affected by this patch; all changes are intended as supplemental
    additions as perceived by the user.

    Generic Counter Counts are created for the eight quadrature channel
    counts, as well as their respective quadrature A and B Signals (which
    are associated via respective Synapse structures) and respective index
    Signals.

    The new Generic Counter interface sysfs attributes are intended to
    expose the same functionality and data available via the existing
    104-QUAD-8 IIO device interface; the Generic Counter interface serves
    to provide the respective functionality and data in a standard way
    expected of counter devices.

    Reviewed-by: Jonathan Cameron
    Signed-off-by: William Breathitt Gray
    Signed-off-by: Greg Kroah-Hartman

    William Breathitt Gray
     
  • This patch introduces the Generic Counter interface for supporting
    counter devices.

    In the context of the Generic Counter interface, a counter is defined as
    a device that reports one or more "counts" based on the state changes of
    one or more "signals" as evaluated by a defined "count function."

    Driver callbacks should be provided to communicate with the device: to
    read and write various Signals and Counts, and to set and get the
    "action mode" and "count function" for various Synapses and Counts
    respectively.

    To support a counter device, a driver must first allocate the available
    Counter Signals via counter_signal structures. These Signals should
    be stored as an array and set to the signals array member of an
    allocated counter_device structure before the Counter is registered to
    the system.

    Counter Counts may be allocated via counter_count structures, and
    respective Counter Signal associations (Synapses) made via
    counter_synapse structures. Associated counter_synapse structures are
    stored as an array and set to the the synapses array member of the
    respective counter_count structure. These counter_count structures are
    set to the counts array member of an allocated counter_device structure
    before the Counter is registered to the system.

    A counter device is registered to the system by passing the respective
    initialized counter_device structure to the counter_register function;
    similarly, the counter_unregister function unregisters the respective
    Counter. The devm_counter_register and devm_counter_unregister functions
    serve as device memory-managed versions of the counter_register and
    counter_unregister functions respectively.

    Reviewed-by: Jonathan Cameron
    Signed-off-by: William Breathitt Gray
    Signed-off-by: Greg Kroah-Hartman

    William Breathitt Gray