[Patch v3] Fix audmuxv2 debugfs indexing.

Bill Pringlemeir bpringle at sympatico.ca
Tue Nov 30 16:07:35 EST 2010


On 15 Nov 2010, bpringle at sympatico.ca wrote:

> I will re-submit those patches later.

Here is the audmux debug directory after this patch,

   root at freescale /sys/kernel/debug/audmux$ ls
   SSI3       SSI4       SSI5       SSI6       SSI7       imx-ssi.0  imx-ssi.1
   root at freescale /sys/kernel/debug/audmux$ cat SSI7
   PDCR: 0000c000
   PTCR: 00000800
   TxFS input, TxClk input
   Port is symmetric
   Data received from SSI7

The ugly part is 'case 6:'.  However, there currently is no constants
defined in audmux.h for this port.  Also,
mxc_audmux_v2_configure_port() isn't protecting against ports out of
range and there are no constants for the IMX25.  I would need answers
to what should be done to invent a define for 'port 6 (SSI7)'.  Using
MX31 constants seems incomplete as this code could be active for an
MX35 and MX25 as well.

Signed-off-by: Bill Pringlemeir <bpringle at sympatico.ca>
diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
index f9e7cdb..205de57 100644
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ b/arch/arm/plat-mxc/audmux-v2.c
@@ -56,6 +56,8 @@ static const char *audmux_port_string(int port)
                return "SSI5";
        case MX31_AUDMUX_PORT6_SSI_PINS_6:
                return "SSI6";
+       case 6: /* internal or pins AUDMUX_PORT7 */
+               return "SSI7";
        default:
                return "UNKNOWN";
        }
@@ -142,7 +144,6 @@ static const struct file_operations audmux_debugfs_fops = {
 static void audmux_debugfs_init(void)
 {
        int i;
-       char buf[20];
 
        audmux_debugfs_root = debugfs_create_dir("audmux", NULL);
        if (!audmux_debugfs_root) {
@@ -150,9 +151,9 @@ static void audmux_debugfs_init(void)
                return;
        }
 
-       for (i = 1; i < 8; i++) {
-               snprintf(buf, sizeof(buf), "ssi%d", i);
-               if (!debugfs_create_file(buf, 0444, audmux_debugfs_root,
+       for (i = 0; i < 7; i++) {
+               if (!debugfs_create_file(audmux_port_string(i), 0444,
+                                        audmux_debugfs_root,
                                         (void *)i, &audmux_debugfs_fops))
                        pr_warning("Failed to create AUDMUX port %d debugfs file\n",
                                   i);



More information about the linux-arm-kernel mailing list