aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/regmap.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-07-06 09:10:23 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-07-06 09:16:16 -0400
commit1044c180de4ba426aa5fb1b4b13b5f219ddb7105 (patch)
tree498879b6fe9de31960e8b914be70203a1c8a9223 /drivers/base/regmap/regmap.c
parente8790ab4ce2a46505a8e1479645414425dbc81f0 (diff)
regmap: Add hook for printk logging for debugging during early init
Sometimes for failures during very early init the trace infrastructure isn't available early enough to be used. For this sort of problem defining LOG_DEVICE will add printks for basic register I/O on a specific device, allowing trace to be extracted when the trace system doesn't come up early enough to work with. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap/regmap.c')
-rw-r--r--drivers/base/regmap/regmap.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 1cf721421bec..f8a937654af2 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -21,6 +21,18 @@
21 21
22#include "internal.h" 22#include "internal.h"
23 23
24/*
25 * Sometimes for failures during very early init the trace
26 * infrastructure isn't available early enough to be used. For this
27 * sort of problem defining LOG_DEVICE will add printks for basic
28 * register I/O on a specific device.
29 */
30#undef LOG_DEVICE
31
32static int _regmap_update_bits(struct regmap *map, unsigned int reg,
33 unsigned int mask, unsigned int val,
34 bool *change);
35
24bool regmap_writeable(struct regmap *map, unsigned int reg) 36bool regmap_writeable(struct regmap *map, unsigned int reg)
25{ 37{
26 if (map->max_register && reg > map->max_register) 38 if (map->max_register && reg > map->max_register)
@@ -700,6 +712,11 @@ int _regmap_write(struct regmap *map, unsigned int reg,
700 } 712 }
701 } 713 }
702 714
715#ifdef LOG_DEVICE
716 if (strcmp(dev_name(map->dev), LOG_DEVICE) == 0)
717 dev_info(map->dev, "%x <= %x\n", reg, val);
718#endif
719
703 trace_regmap_reg_write(map->dev, reg, val); 720 trace_regmap_reg_write(map->dev, reg, val);
704 721
705 if (map->format.format_write) { 722 if (map->format.format_write) {
@@ -903,6 +920,12 @@ static int _regmap_read(struct regmap *map, unsigned int reg,
903 ret = _regmap_raw_read(map, reg, map->work_buf, map->format.val_bytes); 920 ret = _regmap_raw_read(map, reg, map->work_buf, map->format.val_bytes);
904 if (ret == 0) { 921 if (ret == 0) {
905 *val = map->format.parse_val(map->work_buf); 922 *val = map->format.parse_val(map->work_buf);
923
924#ifdef LOG_DEVICE
925 if (strcmp(dev_name(map->dev), LOG_DEVICE) == 0)
926 dev_info(map->dev, "%x => %x\n", reg, *val);
927#endif
928
906 trace_regmap_reg_read(map->dev, reg, *val); 929 trace_regmap_reg_read(map->dev, reg, *val);
907 } 930 }
908 931