Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7526d31 authored by Phani Kumar Uppalapati's avatar Phani Kumar Uppalapati
Browse files

regmap: create a config option for register writes



Create a config option to allow register writes
using debugfs. Currently this requires source code
changes and re-compile. To facilitate client drivers
that are using regmap framework in debugging, would
need a way accessing registers from debugfs. Creating
config option would make this easy for the client drivers.

Change-Id: I1f5016ecff5d16991235c7691df1f120c0977ec2
Signed-off-by: default avatarPhani Kumar Uppalapati <phaniu@codeaurora.org>
parent fd854d74
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -29,3 +29,13 @@ config REGMAP_IRQ

config REGMAP_SWR
	tristate

config REGMAP_ALLOW_WRITE_DEBUGFS
	bool "Allow register writes through debugfs"
	depends on DEBUG_FS
	depends on REGMAP
	help
	 Add support to allow register writes through
	 debugfs. Client driver can enable this config
	 option to write registers using debugfs from
	 regmap registers file.
+2 −3
Original line number Diff line number Diff line
@@ -261,8 +261,7 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf,
				   count, ppos);
}

#undef REGMAP_ALLOW_WRITE_DEBUGFS
#ifdef REGMAP_ALLOW_WRITE_DEBUGFS
#if IS_ENABLED(CONFIG_REGMAP_ALLOW_WRITE_DEBUGFS)
/*
 * This can be dangerous especially when we have clients such as
 * PMICs, therefore don't provide any real compile time configuration option
@@ -518,7 +517,7 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
	if (map->max_register || regmap_readable(map, 0)) {
		umode_t registers_mode;

		if (IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS))
		if (IS_ENABLED(CONFIG_REGMAP_ALLOW_WRITE_DEBUGFS))
			registers_mode = 0600;
		else
			registers_mode = 0400;