mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@gmail.com>,
	Simon <horms@verge.net.au>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] regmap: add regmap_field_update_bits()
Date: Thu, 29 Aug 2013 21:33:01 -0700 (PDT)	[thread overview]
Message-ID: <87r4dbre6e.wl%kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87sixrre8r.wl%kuninori.morimoto.gx@renesas.com>

Current regmap_field is supporting read/write functions.
This patch adds new update_bits function for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/base/regmap/regmap.c |   20 ++++++++++++++++++++
 include/linux/regmap.h       |    2 ++
 2 files changed, 22 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index e0d0c7d..7ae90d8 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1360,6 +1360,26 @@ int regmap_field_write(struct regmap_field *field, unsigned int val)
 }
 EXPORT_SYMBOL_GPL(regmap_field_write);
 
+/**
+ * regmap_field_update_bits():	Perform a read/modify/write cycle
+ *                              on the register field
+ *
+ * @field: Register field to write to
+ * @mask: Bitmask to change
+ * @val: Value to be written
+ *
+ * A value of zero will be returned on success, a negative errno will
+ * be returned in error cases.
+ */
+int regmap_field_update_bits(struct regmap_field *field, unsigned int mask, unsigned int val)
+{
+	mask = (mask << field->shift) & field->mask;
+
+	return regmap_update_bits(field->regmap, field->reg,
+				  mask, val << field->shift);
+}
+EXPORT_SYMBOL_GPL(regmap_field_write);
+
 /*
  * regmap_bulk_write(): Write multiple registers to the device
  *
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 75981d0..1425c91 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -446,6 +446,8 @@ void devm_regmap_field_free(struct device *dev,	struct regmap_field *field);
 
 int regmap_field_read(struct regmap_field *field, unsigned int *val);
 int regmap_field_write(struct regmap_field *field, unsigned int val);
+int regmap_field_update_bits(struct regmap_field *field,
+			     unsigned int mask, unsigned int val);
 
 /**
  * Description of an IRQ for the generic regmap irq_chip.
-- 
1.7.9.5


  reply	other threads:[~2013-08-30  4:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-30  4:31 [PATCH 0/4] add regmap_filelds and use it on Renesas Sound driver Kuninori Morimoto
2013-08-30  4:33 ` Kuninori Morimoto [this message]
2013-08-30  4:34 ` [PATCH 2/4] regmap: Add regmap_fields APIs Kuninori Morimoto
2013-09-02  2:36   ` Kuninori Morimoto
2013-08-30  4:34 ` [PATCH 3/4] ASoC: rsnd: gen: rsnd_gen_ops cares .probe and .remove Kuninori Morimoto
2013-08-30  4:35 ` [PATCH 4/4] ASoC: rsnd: use regmap instead of original register mapping method Kuninori Morimoto
2013-09-02  3:24 ` [PATCH v2 0/4] add regmap_filelds and use it on Renesas Sound driver Kuninori Morimoto
2013-09-02  3:24   ` [PATCH v2 1/4] regmap: add regmap_field_update_bits() Kuninori Morimoto
2013-09-03 11:20     ` Mark Brown
2013-09-02  3:30   ` [PATCH v2 2/4] regmap: Add regmap_fields APIs Kuninori Morimoto
2013-09-17 12:48     ` Mark Brown
2013-09-02  3:31   ` [PATCH v2 3/4] ASoC: rsnd: gen: rsnd_gen_ops cares .probe and .remove Kuninori Morimoto
2013-09-17 12:58     ` Mark Brown
2013-09-02  3:32   ` [PATCH v2 4/4] ASoC: rsnd: use regmap instead of original register mapping method Kuninori Morimoto
2013-09-17 13:04     ` Mark Brown
2013-09-17 13:23       ` Kuninori Morimoto
2013-09-17 13:35         ` Mark Brown
2013-09-24  6:10           ` [PATCH v3 0/2] " Kuninori Morimoto
2013-09-24  6:12             ` [PATCH 1/2] ASoC: rsnd: remove rsnd_priv_read/write/bset() Kuninori Morimoto
2013-09-24 18:53               ` Mark Brown
2013-09-24  6:12             ` [PATCH 2/2] ASoC: rsnd: use regmap instead of original register mapping method Kuninori Morimoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r4dbre6e.wl%kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=horms@verge.net.au \
    --cc=kuninori.morimoto.gx@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®