| 012091bc | 16-Oct-2024 |
Nuno Sa <[email protected]> |
iio: addac: ad74413r: simplify with cleanup.h
Make use of mutex guard() and IIO iio_device_claim_direct_scoped() to simplify code and error handling.
While at it, use devm_mutex_init() to initializ
iio: addac: ad74413r: simplify with cleanup.h
Make use of mutex guard() and IIO iio_device_claim_direct_scoped() to simplify code and error handling.
While at it, use devm_mutex_init() to initialize the mutex.
Signed-off-by: Nuno Sa <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
show more ...
|
| ab9795c1 | 16-Oct-2024 |
Nuno Sa <[email protected]> |
iio: addac: ad74413r: use devm_regulator_get_enable_read_voltage()
It's highly unlikely for the converter ref voltage to change at runtime. Hence, let's read the voltage and save it (instead of the
iio: addac: ad74413r: use devm_regulator_get_enable_read_voltage()
It's highly unlikely for the converter ref voltage to change at runtime. Hence, let's read the voltage and save it (instead of the regulator struct). While at it, simplify the code by using devm_regulator_get_enable_read_voltage().
Signed-off-by: Nuno Sa <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
show more ...
|
| 66fe5312 | 16-Sep-2023 |
William Breathitt Gray <[email protected]> |
iio: addac: stx104: Add 8254 Counter/Timer support
The STX104 features an 8254 Counter/Timer chip providing three counter/timers which can be used for frequency measurement, frequency output, pulse
iio: addac: stx104: Add 8254 Counter/Timer support
The STX104 features an 8254 Counter/Timer chip providing three counter/timers which can be used for frequency measurement, frequency output, pulse width modulation, pulse width measurement, event count, etc. The STX104 provides a register bank selection to bank select between the 8254 Bank and the Indexed Register Array Bank; the Indexed Register Array is not utilized by this driver, so the 8254 Bank is selected unconditionally.
Signed-off-by: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
show more ...
|
| e670bfe2 | 11-Sep-2023 |
Antoniu Miclaus <[email protected]> |
iio: addac: ad74413r: update channel function set
According to the datasheet switching to a new channel function implies multiple steps.
All functions must be selected for a minimum of 130 μs befor
iio: addac: ad74413r: update channel function set
According to the datasheet switching to a new channel function implies multiple steps.
All functions must be selected for a minimum of 130 μs before changing to another function. The DAC_CODEx registers are not reset by changing channel functions. Prior to changing channel functions, it is recommended to set the DAC code to 0x0000 via the DAC_CODEx registers. Set the channel function to high impedance via the CH_FUNC_SETUPx registers before transitioning to the new channel function. After the new channel function is configured, it is recommended to wait 150 μs before updating the DAC code.
Even though the channel switch is done at only at probe, where a device reset is performed, that does not guarantee that the steps prior changing to new channel function should be neglected.
Signed-off-by: Antoniu Miclaus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
show more ...
|
| 7c95a3f5 | 06-Apr-2023 |
William Breathitt Gray <[email protected]> |
iio: addac: stx104: Use regmap_read_poll_timeout() for conversion poll
ADC sample captures take a certain amount of time to complete after initiated; this conversion time range can be anywhere from
iio: addac: stx104: Use regmap_read_poll_timeout() for conversion poll
ADC sample captures take a certain amount of time to complete after initiated; this conversion time range can be anywhere from 5 microseconds to 53.68 seconds depending on the configuration of the Analog Input Frame Timer register. When the conversion is in progress, the ADC Status register CNV bit is high. Call regmap_read_poll_timeout() to poll until the ADC conversion is completed (or timeout if more than 53.68 seconds passes).
Suggested-by: Jonathan Cameron <[email protected]> Signed-off-by: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/9ef433f107afd1d4dcd2d97ef0e932d7045c2bbd.1680790580.git.william.gray@linaro.org Signed-off-by: Jonathan Cameron <[email protected]>
show more ...
|
| c7301b84 | 06-Apr-2023 |
William Breathitt Gray <[email protected]> |
iio: addac: stx104: Migrate to the regmap API
The regmap API supports IO port accessors so we can take advantage of regmap abstractions rather than handling access to the device registers directly i
iio: addac: stx104: Migrate to the regmap API
The regmap API supports IO port accessors so we can take advantage of regmap abstractions rather than handling access to the device registers directly in the driver.
In addition, to improve code organization in stx104_probe(), the devm_iio_device_register() call is moved above GPIO configuration in order to keep relevant code closer together.
Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/0bcdfc4738cc019fb2ff83f61eb46a3488bc166d.1680790580.git.william.gray@linaro.org Signed-off-by: Jonathan Cameron <[email protected]>
show more ...
|
| a94abc74 | 06-Apr-2023 |
William Breathitt Gray <[email protected]> |
iio: addac: stx104: Improve indentation in stx104_write_raw()
By bailing out early if chan->output is false for the IIO_CHAN_INFO_RAW, indentation can be decreased by a tab and code readability impr
iio: addac: stx104: Improve indentation in stx104_write_raw()
By bailing out early if chan->output is false for the IIO_CHAN_INFO_RAW, indentation can be decreased by a tab and code readability improved.
Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/487d17da9e2612f3e6b2bd1c3def2fa1b955db9b.1680790580.git.william.gray@linaro.org Signed-off-by: Jonathan Cameron <[email protected]>
show more ...
|
| 46a4cac7 | 06-Apr-2023 |
William Breathitt Gray <[email protected]> |
iio: addac: stx104: Use define rather than hardcoded limit for write val
The DAC register is 16 bits wide, so the value passed by write_raw() should be checked against that limit. Rather than hardco
iio: addac: stx104: Use define rather than hardcoded limit for write val
The DAC register is 16 bits wide, so the value passed by write_raw() should be checked against that limit. Rather than hardcoding the 16-bit maximum value limit, use a define to improve readability and make the intention of the code clearer. The explicit cast is also avoided by instead explicitly checking for negative values.
Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/4c9f4f1b4a270d133be70c82a091351b531b5e3e.1680790580.git.william.gray@linaro.org Signed-off-by: Jonathan Cameron <[email protected]>
show more ...
|
| 4f9b80ae | 06-Apr-2023 |
William Breathitt Gray <[email protected]> |
iio: addac: stx104: Fix race condition when converting analog-to-digital
The ADC conversion procedure requires several device I/O operations performed in a particular sequence. If stx104_read_raw()
iio: addac: stx104: Fix race condition when converting analog-to-digital
The ADC conversion procedure requires several device I/O operations performed in a particular sequence. If stx104_read_raw() is called concurrently, the ADC conversion procedure could be clobbered. Prevent such a race condition by utilizing a mutex.
Fixes: 4075a283ae83 ("iio: stx104: Add IIO support for the ADC channels") Signed-off-by: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/2ae5e40eed5006ca735e4c12181a9ff5ced65547.1680790580.git.william.gray@linaro.org Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
show more ...
|
| 0088dd68 | 01-Mar-2023 |
Rasmus Villemoes <[email protected]> |
iio: addac: ad74413r: fix Current Input, Loop Powered Mode
Currently, the driver handles CH_FUNC_CURRENT_INPUT_LOOP_POWER and CH_FUNC_CURRENT_INPUT_EXT_POWER completely identically. But that's not c
iio: addac: ad74413r: fix Current Input, Loop Powered Mode
Currently, the driver handles CH_FUNC_CURRENT_INPUT_LOOP_POWER and CH_FUNC_CURRENT_INPUT_EXT_POWER completely identically. But that's not correct. In order for CH_FUNC_CURRENT_INPUT_LOOP_POWER to work, two changes must be made:
(1) expose access to the DAC_CODE_x register so that the intended output current can be set, i.e. expose the channel as both current output and current input, and
(2) per the data sheet
When selecting the current input loop powered function, tie the VIOUTN_x pin to ground via the on-chip 200 kΩ resistor by enabling the CH_200K_TO_GND bit in the ADC_CONFIGx registers.
Signed-off-by: Rasmus Villemoes <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
show more ...
|