[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEqHmAsyJntRMqX+7NbQN0OmDXz6ZGh0LzAMp5KB=-cAMgpsJA@mail.gmail.com>
Date: Fri, 4 May 2012 11:35:58 +0200
From: dd diasemi <dd.diasemi@...il.com>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc: linux-kernel@...r.kernel.org,
Anthony Olech <Anthony.Olech@...semi.com>
Subject: Re: Linux 3.4-rc2 register mapping and paging on I2C device.
On Mon, Apr 30, 2012 at 11:47 PM, Mark Brown
<broonie@...nsource.wolfsonmicro.com> wrote:
> On Mon, Apr 30, 2012 at 06:31:37PM +0100, dd diasemi wrote:
>
>> 3. Update regmap API to enable support for register page switching.
>
> Clearly this is the most sensible option. Open coding this in all the
> drivers that need it is going to lead to a lot of duplicated effort.
Below you can find my proposition of API for regmap paging support. It
is sufficient for my driver needs.
If you are OK with this proposition or you find any issues with it, let me know.
Kind Regards,
Krystian
---
diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig
index 0f6c7fb..590d72c 100644
--- a/drivers/base/regmap/Kconfig
+++ b/drivers/base/regmap/Kconfig
@@ -16,3 +16,6 @@ config REGMAP_SPI
config REGMAP_IRQ
bool
+
+config REGMAP_PAGING
+ bool
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index a90abb6..81a11c1 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -50,6 +50,15 @@ struct reg_default {
* @pad_bits: Number of bits of padding between register and value.
* @val_bits: Number of bits in a register value, mandatory.
*
+ * @page_bits: Number of bits of register page number. These are the top-most
+ * bits exdending register address. These bits will be written
+ * to page register, for page switch.
+ * @page_reg: Page register used for page update (available for any page).
+ * @page_shift: Formatting bit shift for page number, made prior to write to
+ * page register.
+ * @nonpageable_reg: Optional callback returning true if the register
+ * needs NO page switching (eg. page is irrelevant).
+ *
* @writeable_reg: Optional callback returning true if the register
* can be written to.
* @readable_reg: Optional callback returning true if the register
@@ -81,6 +90,13 @@ struct regmap_config {
int pad_bits;
int val_bits;
+#ifdef CONFIG_REGMAP_PAGING
+ int page_bits;
+ int page_shift;
+ unsigned int page_reg;
+ bool (*nonpageable_reg)(struct device *dev, unsigned int reg);
+#endif
+
bool (*writeable_reg)(struct device *dev, unsigned int reg);
bool (*readable_reg)(struct device *dev, unsigned int reg);
bool (*volatile_reg)(struct device *dev, unsigned int reg);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists