Skip to content

RFC regmap: Add Parity bit Calculation to regmaps

[email protected] lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest5 patches 1 replyIn review
  2. v1 RFC5 patches 1 replySuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5Add Parity bit Calculation to regmapsdrivers/base/regmap/internal.h drivers/base/regmap/regmap.c include/linux/regmap.h+204 -21 reply
2/5Altered regmap_format_X_X_write functions to account for padding bitsdrivers/base/regmap/regmap.c+23 -80 replies
3/5Added setting of writemap to formatted writedrivers/base/regmap/regmap.c+3 -00 replies
4/5Add Parity Calculation to formatted writedrivers/base/regmap/regmap.c+4 -00 replies
5/5Add parser for X_9 formatsdrivers/base/regmap/regmap.c+53 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFC PATCH v2 0/5] regmap: Add Parity bit Calculation to regmaps

From: Christopher Tyerman <[email protected]>

this patch set adds parity bit calculation to regmaps

this allow support for devices that require parity bits in their communications.

e.g. the texas instruments TPS92518-Q1 which requires a parity bit in the 7th bit of a 16 bit spi frame
or the TPS92518-Q1 which requires a parity bit in the 1st bit of a 16 bit spi frame

parity aimed to work devices where parity in reg block e.g. TPS65311-Q1 and TPS92518-Q1

TPS65311-Q1 frame format [PWRRRRRRDDDDDDDD]
TPS92518-Q1 frame format [WRRRRRPDDDDDDDDD]
P - parity bit, W - Read/Write bit, R - register, D -register data

TPS65311-Q1 parity mask 0x8000 (1000000000000000)
TPS92518-Q1 parity mask 0x0200 (0000001000000000)

calculates parity bit based up parity function defined by regmap_config->parity_calc

regmap_config->parity_calc defaults to regmap_parity_calc_even()

adds alternate parity function regmap_parity_calc_odd()

calculates parity bit for writes if regmap_config->parity_write_mask is > 0 calculates parity bit for reads if regmap_config->parity_read_mask is > 0

parity is not calculated when bus implements reg_update_bits()

Altered the regmap_format_X_X_write functions to account for padding bits allowing masks to write to either end of register address for formatted writes

Altered formatted_write to apply write and parity masks

Added parsers for 9 bit data format which are written by formatted write

Christopher Tyerman (5):
Add Parity bit Calculation to regmaps
Altered regmap_format_X_X_write functions to account for padding bits Added setting of writemap to formatted write
Add Parity Calculation to formatted write
Add parser for X_9 formats

 drivers/base/regmap/internal.h |   6 +
 drivers/base/regmap/regmap.c   | 259 +++++++++++++++++++++++++++++++--
 include/linux/regmap.h         |  32 ++++
 3 files changed, 287 insertions(+), 10 deletions(-)

base-commit: 02d6fdecb9c38de19065f6bed8d5214556fd061d

Signature · 1 line
2.25.1