public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] iio: dac: mcp4821: add gain support and fix scale handling
@ 2026-04-13  9:44 Nikhil Gautam
  2026-04-13  9:44 ` [PATCH v4 1/3] iio: dac: mcp4821: fix spelling mistake in enum name Nikhil Gautam
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Nikhil Gautam @ 2026-04-13  9:44 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, dlechner, Nikhil Gautam

This series updates the MCP4821 DAC driver to support configurable gain
and ensures scale handling follows the IIO ABI.

Patch 1 fixes a spelling issue in an enum name.
Patch 2 performs a small refactor to simplify state handling.
Patch 3 adds configurable gain support and corrects scale handling.

The scale is exposed via IIO_CHAN_INFO_SCALE and reflects the selected
gain. The implementation uses IIO_VAL_FRACTIONAL_LOG2 and ensures that
scale_available matches scale. Writes to the scale attribute are validated
and only supported values are accepted.

Changes in v4:
- Split changes into separate patches as suggested
- Fix scale handling to comply with IIO ABI
- Ensure scale_available matches scale
- Handle sysfs write inputs correctly
- Reject invalid scale values

Changes in v3:
- Restore NULL check in indio_dev allocation

Changes in v2:
- Use IIO_CHAN_INFO_SCALE instead of CALIBSCALE
- Fix error handling and cleanup

Nikhil Gautam (3):
  iio: dac: mcp4821: fix spelling mistake in enum name
  iio: dac: mcp4821: move state initialization outside switch
  iio: dac: mcp4821: add configurable gain and fix scale handling

 drivers/iio/dac/mcp4821.c | 107 ++++++++++++++++++++++++++++++--------
 1 file changed, 85 insertions(+), 22 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-04-13 14:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-13  9:44 [PATCH v4 0/3] iio: dac: mcp4821: add gain support and fix scale handling Nikhil Gautam
2026-04-13  9:44 ` [PATCH v4 1/3] iio: dac: mcp4821: fix spelling mistake in enum name Nikhil Gautam
2026-04-13  9:44 ` [PATCH v4 2/3] iio: dac: mcp4821: move state initialization outside switch Nikhil Gautam
2026-04-13 14:33   ` David Lechner
2026-04-13  9:44 ` [PATCH v4 3/3] iio: dac: mcp4821: add configurable gain and fix scale handling Nikhil Gautam
2026-04-13 14:46   ` David Lechner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox