Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regmap #4

Merged
merged 132 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
18bb575
regmap: Fix debugfs-file 'registers' mode
Sep 8, 2014
87de53c
regmap: Add support for device with 24 data bits.
marc-cpdesign Mar 16, 2012
7da6064
regmap: Use pad_bits and reg_bits when determining register format.
marc-cpdesign Mar 16, 2012
5480678
regmap: introduce explicit bus_context for bus callbacks
nvswarren Apr 4, 2012
dc9cef6
regmap: introduce fast_io busses, and use a spinlock for them
nvswarren Apr 4, 2012
0f8aea0
regmap: add MMIO bus support
nvswarren Apr 4, 2012
1e24116
regmap: mmio: convert some error returns to BUG()
nvswarren Apr 6, 2012
f5c3a77
regmap: mmio: remove some error checks now in the core
nvswarren Apr 6, 2012
7dc2079
regmap: validate regmap_raw_read/write val_len
nvswarren Apr 6, 2012
30d8ef5
regmap: allow regmap instances to be named
nvswarren Apr 4, 2012
059c3db
regmap: fix compilation when !CONFIG_DEBUG_FS
nvswarren Apr 6, 2012
ebc1d4f
regmap: implement register striding
nvswarren Apr 9, 2012
3a3a4d1
regmap: fix compile errors in regmap-irq.c due to stride changes
nvswarren Apr 11, 2012
4948bdd
regmap: Cache single values read from the chip
broonie Apr 30, 2012
5591a06
regmap: Converts group operation into single read write operations
Apr 30, 2012
415212e
regmap: Devices using format_write don't support bulk operations
broonie Apr 30, 2012
a5569d1
regmap: Implement dev_get_regmap()
broonie May 8, 2012
af3d039
regmap: Pass back the allocated regmap IRQ controller data
broonie May 13, 2012
332b349
regmap: Convert regmap_irq to use irq_domain
broonie May 13, 2012
84bf9f3
regmap: add support for non contiguous status to regmap-irq
May 14, 2012
307a88d
regmap: Fix typo in IRQ register striding
broonie May 17, 2012
7b899ac
regmap: Use select .. if to get IRQ_DOMAIN enabled
broonie May 23, 2012
a8a6254
i2c: Split I2C_M_NOSTART support out of I2C_FUNC_PROTOCOL_MANGLING
broonie May 30, 2012
bf1f41c
regmap: allow busses to request formatting with specific endianness
nvswarren May 24, 2012
b777a2c
regmap: mmio: request native endian formatting
nvswarren May 24, 2012
e7cb987
regmap: clean up debugfs if regmap_init fails
nvswarren May 23, 2012
0d9ad5a
regmap: Fix the size calculation for map->format.buf_size
Jun 1, 2012
4330e86
regmap: Constify regmap_irq_chip
broonie May 31, 2012
dfc945b
regmap: Don't try to map non-existant IRQs
broonie Jun 5, 2012
ec9b244
regmap: Implement support for wake IRQs
broonie Jun 5, 2012
b7e1b6a
regmap: Export regmap_reinit_cache()
broonie May 14, 2012
6df64f3
regmap: mmio: Staticize regmap_mmio_gen_context()
AxelLin Jun 13, 2012
7146017
regmap: Move lock out from internal function _regmap_update_bits().
Jun 15, 2012
c6c6f4a
regmap: Add support for register indirect addressing.
Jun 15, 2012
1555de2
regmap: Fix work_buf switching for page update during virtual range a…
Jun 18, 2012
640f92b
regmap: Add hook for printk logging for debugging during early init
broonie Jul 6, 2012
5471a45
regmap: Fix incorrect arguments to kzalloc() call
Jul 18, 2012
0ccaec1
regmap: Don't lock in regmap_reinit_cache()
Jul 27, 2012
49af48f
regmap: fix some error messages to take account of irq_reg_stride
nvswarren Jul 27, 2012
b0166b0
regmap: irq: Only update mask bits when doing initial mask
broonie Aug 1, 2012
b99f6b2
regmap: store irq_chip inside regmap_irq_chip_data
nvswarren Aug 1, 2012
8c31bdd
regmap: name irq_chip based on regmap_irq_chip's name
nvswarren Aug 1, 2012
3a3b0c5
regmap: set MASK_ON_SUSPEND/SKIP_SET_WAKE if no wake_base
nvswarren Aug 1, 2012
28ff13d
regmap: irq: initialize all irqs to wake disabled
nvswarren Aug 1, 2012
e963853
regmap: irq: Enable devices for runtime PM while handling interrupts
broonie Jul 24, 2012
3432dd5
regmap: irq: Add mask invert flag for enable register
Aug 30, 2012
216ece1
regmap: no need primary handler for nested irq
Sep 8, 2012
0601300
regmap: irq: Allow users to retrieve the irq_domain
broonie Aug 20, 2012
740a55e
regmap: Rename n_ranges to num_ranges
broonie Oct 2, 2012
fd27f55
regmap: When we sanity check during range adds say what errors we find
broonie Oct 3, 2012
2866204
regmap: Allow ranges to be named
broonie Oct 3, 2012
f483c5e
regmap: Factor out debugfs register read
broonie Oct 3, 2012
7b8819d
regmap: Provide debugfs read of register ranges
broonie Oct 3, 2012
30f5649
regmap: Factor range lookup out of page selection
broonie Oct 4, 2012
03e0c3c
regmap: Make return code checks consistent
broonie Oct 4, 2012
30d0f24
regmap: Split raw writes that cross window boundaries
broonie Oct 4, 2012
0fe347b
regmap: make lock/unlock functions customizable
ciminaghi Oct 16, 2012
1be18d1
regmap: select REGMAP if REGMAP_MMIO and REGMAP_IRQ enabled
Oct 15, 2012
1b6ea2d
regmap: Fix printing of size_t variable
Oct 25, 2012
126c90d
regmap: core: Report registers in hex when we can't cache
broonie Oct 26, 2012
d60d0df
regmap: introduce tables for readable/writeable/volatile/precious checks
ciminaghi Nov 20, 2012
6f552a5
regmap: Cache register and value sizes for debugfs
broonie Dec 6, 2012
12e236b
regmap: debugfs: Avoid overflows for very small reads
broonie Dec 10, 2012
62463e5
regmap: debugfs: Factor out initial seek
broonie Dec 9, 2012
50961df
regmap: debugfs: Cache offsets of valid regions for dump
broonie Dec 10, 2012
1e754ac
regmap: irq: enable wake support by default
ldewangan Dec 19, 2012
084938f
regmap: flat: Add flat cache type
broonie Dec 19, 2012
b1d0804
regmap: irq: Factor register read out of the IRQ parsing loop
broonie Jan 3, 2013
dc9eb20
regmap: irq: Use a bulk read for interrupt status where possible
broonie Jan 3, 2013
4319fc4
regmap: irq: Fix sync of wake statuses to hardware
broonie Jan 4, 2013
5f6e488
regmap: irq: Support wake IRQ mask inversion
broonie Jan 4, 2013
aabf133
regmap: debugfs: Fix attempts to read nonexistant register blocks
broonie Jan 2, 2013
a192397
regmap: debugfs: Fix check for block start in cached seeks
broonie Jan 8, 2013
942e3f2
regmap: debugfs: Discard the cache if we fail to allocate an entry
broonie Jan 8, 2013
11a2dcb
regmap: debugfs: Ensure a correct return value for empty caches
broonie Jan 8, 2013
4090a4b
regmap: debugfs: Make sure we store the last entry in the offset cache
broonie Jan 8, 2013
d6053ff
regmap: Add support for 24 bit wide register addresses
larsclausen Jan 10, 2013
e49dd2d
regmap: Add provisions to have user-defined read operation
ndreys Jan 12, 2013
a5331ae
regmap: Add provisions to have user-defined write operation
ndreys Jan 12, 2013
fd653ba
regmap: debugfs: Fix seeking from the cache
broonie Jan 16, 2013
6dc2d9a
regmap: fix small typo in regmap_bulk_write comment
novroy Jan 18, 2013
a389d3e
regmap: regmap: avoid spurious warning in regmap_read_debugfs
Jan 26, 2013
eb50d34
regmap: Add "no-bus" option for regmap API
ndreys Jan 27, 2013
58e76df
regmap: Add asynchronous I/O support
broonie Jan 27, 2013
12986ff
regmap: spi: Support asynchronous I/O for SPI
broonie Jan 29, 2013
3bb83dd
regmap: include linux/sched.h to fix build
nvswarren Feb 3, 2013
a838822
regmap: Export regmap_async_complete_cb
AxelLin Feb 2, 2013
4d8ee30
regmap: Export regmap_async_complete()
broonie Feb 5, 2013
48e5fdf
regmap: spi: Handle allocation failures gracefully
broonie Feb 5, 2013
a4bdf04
regmap: debugfs: Fix reading in register field units
Feb 7, 2013
e54954d
regmap: debugfs: Add a `max_reg' member in struct regmap_debugfs_off_…
Feb 8, 2013
c2e7cbe
regmap: debugfs: Optimize seeking within blocks of registers
Feb 8, 2013
37421df
regmap: debugfs: Factor out debugfs_tot_len calc into a function
Feb 11, 2013
3d779f9
regmap: mmio: add register clock support
pH5 Feb 14, 2013
b448b80
regmap: irq: call pm_runtime_put in pm_runtime_get_sync failed case
fli24 Feb 28, 2013
371938c
regmap: async: Add tracepoints for async I/O
broonie Feb 21, 2013
4645399
regmap: rbtree: Don't bother checking for noop updates
broonie Feb 21, 2013
b0ff8c9
regmap: cache: Pass the map rather than the word size when updating v…
broonie Feb 21, 2013
4d61e84
regmap: cache: Use regcache_get_value() to check if we updated
broonie Feb 21, 2013
15d77d8
regmap: core: Split out in place value parsing
broonie Mar 4, 2013
206d292
regmap: cache: Store caches in native register format where possible
broonie Feb 21, 2013
2c87266
regmap: debugfs: Simplify calculation of `c->max_reg'
Feb 20, 2013
defca00
regmap: debugfs: Add a registers `range' file
Feb 20, 2013
c3e2eb6
regmap: Initialize `map->debugfs' before regcache
Mar 11, 2013
76d0b01
regmap: rbtree Expose total memory consumption in the rbtree debugfs …
Mar 12, 2013
19da2cf
regmap: irq: Clarify error message when we fail to request primary IRQ
broonie Mar 19, 2013
f5872ee
regmap: don't corrupt work buffer in _regmap_raw_write()
nvswarren Mar 20, 2013
dd77fd0
regmap: core: Warn on invalid operation combinations
broonie Mar 13, 2013
87a447b
regmap: core: Make raw write available to regcache
broonie Mar 13, 2013
b9d262d
regmap: Cut down on the average # of nodes in the rbtree cache
Mar 15, 2013
7b26cba
regmap: cache: Provide a get address of value operation
broonie Mar 13, 2013
31c1e53
regmap: core: Provide regmap_can_raw_write() operation
broonie Mar 26, 2013
2cc9bd2
regmap: cache: Use raw I/O to sync rbtrees if we can
broonie Mar 26, 2013
9431ae9
regmap: async: Add missing return
broonie Mar 27, 2013
203b6f6
regmap: cache: Factor out reg_present support from rbtree cache
broonie Mar 29, 2013
7686323
regmap: cache: Factor out block sync
broonie Mar 29, 2013
b3a2fa2
regmap: cache: Split raw and non-raw syncs
broonie Mar 29, 2013
c2ae71d
regmap: cache: Write consecutive registers in a single block write
broonie Mar 29, 2013
86ce68a
regmap: cache: Make regcache_sync_block_raw static
Apr 4, 2013
3857b43
regmap: cache: Fix format specifier in dev_dbg
Apr 4, 2013
2d48e41
regmap: Back out work buffer fix
broonie Apr 9, 2013
9e8c3d4
regmap: don't corrupt work buffer in _regmap_raw_write()
nvswarren Mar 20, 2013
ee748f8
regmap: debugfs: Check return value of regmap_write()
May 9, 2013
49004c2
regmap: regcache: Fixup locking for custom lock callbacks
larsclausen May 23, 2013
c7dfe4c
regmap: rbtree: Fixed node range check on sync
mthuurne May 31, 2013
d8edf7f
regmap: cache: bail in regmap_async_complete() for bus-less maps
zonque Jul 4, 2013
5975ad1
regmap: cache: Make sure to sync the last register in a block
larsclausen Aug 5, 2013
74f306f
regmap: rbtree: Fix overlapping rbnodes.
yope Aug 21, 2013
28711d5
regmap: debugfs: fix possbile NULL pointer dereference
Sep 28, 2014
a57a82a
regmap: fix NULL pointer dereference in _regmap_write/read
pankajkdubey Sep 27, 2014
1cf2b29
regmap: Fix regmap_bulk_read in BE mode
arun-chandran Jun 15, 2015
b1f8771
regmap: sync with 3.10.y by removing added change by patch patch-3.4.…
dorimanx Jan 11, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
regmap: Add provisions to have user-defined write operation
This commit is a preparatory commit to provide "no-bus" configuration
option for regmap API. It adds necessary plumbing needed to have the
ability to provide user define register write function.

Signed-off-by: Andrey Smirnov <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
ndreys authored and gj86 committed Jun 1, 2020
commit a5331ae1ddc28355fff95d6a0fa937414c85342d
1 change: 1 addition & 0 deletions drivers/base/regmap/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct regmap {
const struct regmap_access_table *precious_table;

int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
int (*reg_write)(void *context, unsigned int reg, unsigned int val);

u8 read_flag_mask;
u8 write_flag_mask;
Expand Down
83 changes: 54 additions & 29 deletions drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,

static int _regmap_bus_read(void *context, unsigned int reg,
unsigned int *val);
static int _regmap_bus_formatted_write(void *context, unsigned int reg,
unsigned int val);
static int _regmap_bus_raw_write(void *context, unsigned int reg,
unsigned int val);

bool regmap_reg_in_ranges(unsigned int reg,
const struct regmap_range *ranges,
Expand Down Expand Up @@ -586,6 +590,11 @@ struct regmap *regmap_init(struct device *dev,
goto err_map;
}

if (map->format.format_write)
map->reg_write = _regmap_bus_formatted_write;
else if (map->format.format_val)
map->reg_write = _regmap_bus_raw_write;

map->range_tree = RB_ROOT;
for (i = 0; i < config->num_ranges; i++) {
const struct regmap_range_cfg *range_cfg = &config->ranges[i];
Expand Down Expand Up @@ -992,12 +1001,54 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg,
return ret;
}

static int _regmap_bus_formatted_write(void *context, unsigned int reg,
unsigned int val)
{
int ret;
struct regmap_range_node *range;
struct regmap *map = context;

BUG_ON(!map->format.format_write);

range = _regmap_range_lookup(map, reg);
if (range) {
ret = _regmap_select_page(map, &reg, range, 1);
if (ret != 0)
return ret;
}

map->format.format_write(map, reg, val);

trace_regmap_hw_write_start(map->dev, reg, 1);

ret = map->bus->write(map->bus_context, map->work_buf,
map->format.buf_size);

trace_regmap_hw_write_done(map->dev, reg, 1);

return ret;
}

static int _regmap_bus_raw_write(void *context, unsigned int reg,
unsigned int val)
{
struct regmap *map = context;

BUG_ON(!map->format.format_val);

map->format.format_val(map->work_buf + map->format.reg_bytes
+ map->format.pad_bytes, val, 0);
return _regmap_raw_write(map, reg,
map->work_buf +
map->format.reg_bytes +
map->format.pad_bytes,
map->format.val_bytes);
}

int _regmap_write(struct regmap *map, unsigned int reg,
unsigned int val)
{
struct regmap_range_node *range;
int ret;
BUG_ON(!map->format.format_write && !map->format.format_val);

if (!map->cache_bypass && map->format.format_write) {
ret = regcache_write(map, reg, val);
Expand All @@ -1016,33 +1067,7 @@ int _regmap_write(struct regmap *map, unsigned int reg,

trace_regmap_reg_write(map->dev, reg, val);

if (map->format.format_write) {
range = _regmap_range_lookup(map, reg);
if (range) {
ret = _regmap_select_page(map, &reg, range, 1);
if (ret != 0)
return ret;
}

map->format.format_write(map, reg, val);

trace_regmap_hw_write_start(map->dev, reg, 1);

ret = map->bus->write(map->bus_context, map->work_buf,
map->format.buf_size);

trace_regmap_hw_write_done(map->dev, reg, 1);

return ret;
} else {
map->format.format_val(map->work_buf + map->format.reg_bytes
+ map->format.pad_bytes, val, 0);
return _regmap_raw_write(map, reg,
map->work_buf +
map->format.reg_bytes +
map->format.pad_bytes,
map->format.val_bytes);
}
return map->reg_write(map, reg, val);
}

/**
Expand Down