Skip to contentSkip to conversation

MFD: AB8500 debugfs

PATCH In review Mattias Wallin 3 participants 5 messages Sep 13, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 MFD: AB8500 debugfs

This patch adds the possibility to read and write registers via the debug_fs. It also adds ranges of registers sorted by bank which makes it possible to read all defined registers in a bank.

---
Fixed comment from Mark Brown.
AB8500_DEBUG is enabled default if DEBUG_FS=y

---
 drivers/mfd/Kconfig          |    8 +
 drivers/mfd/Makefile         |    1 +
 drivers/mfd/ab8500-core.c    |    5 +
 drivers/mfd/ab8500-debugfs.c |  652 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 666 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/ab8500-debugfs.c
drivers/mfd/Kconfig +8 -0
index c957c3a..a7f3d47 100644
@@ -481,6 +481,14 @@ config AB8500_CORE
          read/write functions for the devices to get access to this chip.
          This chip embeds various other multimedia funtionalities as well.
 
+config AB8500_DEBUG
+       bool "Enable debug info via debugfs"
+       depends on AB8500_CORE && DEBUG_FS
+       default y if DEBUG_FS
+       help
+         Select this option if you want debug information using the debug
+         filesystem, debugfs.
+
 config AB3550_CORE
         bool "ST-Ericsson AB3550 Mixed Signal Circuit core functions"
        select MFD_CORE
drivers/mfd/Makefile +1 -0
index feaeeae..610b074 100644
@@ -69,6 +69,7 @@ obj-$(CONFIG_AB3100_CORE)     += ab3100-core.o
 obj-$(CONFIG_AB3100_OTP)       += ab3100-otp.o
 obj-$(CONFIG_AB3550_CORE)      += ab3550-core.o
 obj-$(CONFIG_AB8500_CORE)      += ab8500-core.o ab8500-spi.o
+obj-$(CONFIG_AB8500_DEBUG)     += ab8500-debugfs.o
 obj-$(CONFIG_MFD_TIMBERDALE)    += timberdale.o
 obj-$(CONFIG_PMIC_ADP5520)     += adp5520.o
 obj-$(CONFIG_LPC_SCH)          += lpc_sch.o
drivers/mfd/ab8500-core.c +5 -0
index 35a2d58..6548f50 100644
@@ -379,6 +379,11 @@ static struct resource ab8500_rtc_resources[] = {
 };
 
 static struct mfd_cell ab8500_devs[] = {
+#ifdef CONFIG_DEBUG_FS
+       {
+               .name = "ab8500-debug",
+       },
+#endif
        {
                .name = "ab8500-gpadc",
                .num_resources = ARRAY_SIZE(ab8500_gpadc_resources),
drivers/mfd/ab8500-debugfs.c new file +652 -0

652 lines not on this page · raw message

--
1.6.3.3

#2 lore raw
In reply to Mattias Wallin

Hi Mattias,

I have some addtional comments:

Quoted 8 lines · Mattias Wallin
drivers/mfd/ab8500-debugfs.c new file +8 -0
+static struct platform_driver ab8500_debug_driver = {
+       .driver = {
+               .name = "ab8500-debug",
+               .owner = THIS_MODULE,
+       },
+       .probe  = ab8500_debug_probe,
+       .remove = __devexit_p(ab8500_debug_remove)
+};

drivers/mfd/ab8500-debugfs.c line 646

Quoted 10 lines
drivers/mfd/ab8500-debugfs.c new file +10 -0
+
+static int __init ab8500_debug_init(void)
+{
+       return platform_driver_register(&ab8500_debug_driver);
+}
+
+static void __exit ab8500_debug_exit(void)
+{
+       platform_driver_unregister(&ab8500_debug_driver);
+}

It seems a bit awkward to me to have this code as an actual platform driver. Why not defining ab8500_debug_[probe|remove] in ab8500.h as no-op when CONFIG_AB8500_DEBUG is not defined and as extern otherwise ?

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#3 lore raw
Quoted 18 lines · Samuel Ortiz

Hi Mattias,

I have some addtional comments:

Quoted 13 lines · Mattias Wallin
drivers/mfd/ab8500-debugfs.c new file +13 -0
+static struct platform_driver ab8500_debug_driver = {
+       .driver = {
+               .name = "ab8500-debug",
+               .owner = THIS_MODULE,
+       },
+       .probe  = ab8500_debug_probe,
+       .remove = __devexit_p(ab8500_debug_remove)
+};
+
+static int __init ab8500_debug_init(void)
+{
+       return platform_driver_register(&ab8500_debug_driver);
+}
Quoted 8 lines

drivers/mfd/ab8500-debugfs.c line 646

Quoted 5 lines
drivers/mfd/ab8500-debugfs.c new file +5 -0
+
+static void __exit ab8500_debug_exit(void)
+{
+       platform_driver_unregister(&ab8500_debug_driver);
+}

It seems a bit awkward to me to have this code as an actual platform driver. Why not defining ab8500_debug_[probe|remove] in ab8500.h as no-op when CONFIG_AB8500_DEBUG is not defined and as extern otherwise ?

In the register access interface abx500_get_register_interruptible() the first argument is a struct *device. This struct *device needs to be a (platform) device "child" to the ab8500-core (dev->parent is used).
The idea is that we want only devices started by the ab8500 core to
be able to access the ab8500 registers. So all platform devices started by ab8500-core just pass in their own struct *device as first argument.

So the register access restricted to device children is one reason. I also want the debugfs driver to use the same access method as all other subdrivers.

BR,
/Mattias Wallin

#4 lore raw
Quoted 29 lines · Mattias Wallin
Quoted 18 lines · Samuel Ortiz

Hi Mattias,

I have some addtional comments:

Quoted 13 lines · Mattias Wallin
drivers/mfd/ab8500-debugfs.c new file +13 -0
+static struct platform_driver ab8500_debug_driver = {
+       .driver = {
+               .name = "ab8500-debug",
+               .owner = THIS_MODULE,
+       },
+       .probe  = ab8500_debug_probe,
+       .remove = __devexit_p(ab8500_debug_remove)
+};
+
+static int __init ab8500_debug_init(void)
+{
+       return platform_driver_register(&ab8500_debug_driver);
+}
Quoted 8 lines

drivers/mfd/ab8500-debugfs.c line 646

Quoted 5 lines
drivers/mfd/ab8500-debugfs.c new file +5 -0
+
+static void __exit ab8500_debug_exit(void)
+{
+       platform_driver_unregister(&ab8500_debug_driver);
+}

It seems a bit awkward to me to have this code as an actual platform driver. Why not defining ab8500_debug_[probe|remove] in ab8500.h as no-op when CONFIG_AB8500_DEBUG is not defined and as extern otherwise ?

Quoted 3 lines

In the register access interface abx500_get_register_interruptible() the first argument is a struct *device. This struct *device needs to be a (platform) device "child" to the ab8500-core (dev->parent is used).

Obviously. All 3 patches applied, many thanks.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/