linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Patch IMX audmux debugfs.
@ 2010-11-09 23:11 Bill Pringlemeir
  2010-11-10 11:19 ` Sergei Shtylyov
  2010-11-10 15:26 ` Sascha Hauer
  0 siblings, 2 replies; 16+ messages in thread
From: Bill Pringlemeir @ 2010-11-09 23:11 UTC (permalink / raw)
  To: linux-arm-kernel


$ mount -t debugfs debugfs /sys/kernel/debug
$ cd /sys/kernel/debug/audmux
$ cat *
[crashes when accessing ssi7]

The index is one based, but the register map is zero based.  So the
ssi1 is actually sending info for ssi2.  Also, the ssi7 touches
non-existent data and can cause an exception (only registers sets 1-6
exist).

Alternatively, the MX31_AUDMUX_PORT6_SSI_PINS_6 and
MX27_AUDMUX_PPCR3_SSI_PINS_3 constants could be used for the loop
termination, but maybe that means conditionalization (and there are no
MX25 constants).

diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
index f9e7cdb..0547145 100644
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ b/arch/arm/plat-mxc/audmux-v2.c
@@ -66,7 +66,7 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
 {
        ssize_t ret;
        char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
-       int port = (int)file->private_data;
+       int port = ((int)file->private_data) - 1;
        u32 pdcr, ptcr;
 
        if (!buf)
@@ -150,7 +150,7 @@ static void audmux_debugfs_init(void)
                return;
        }
 
-       for (i = 1; i < 8; i++) {
+       for (i = 1; i < 7; i++) {
                snprintf(buf, sizeof(buf), "ssi%d", i);
                if (!debugfs_create_file(buf, 0444, audmux_debugfs_root,
                                         (void *)i, &audmux_debugfs_fops))

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Patch IMX audmux debugfs.
  2010-11-09 23:11 Patch IMX audmux debugfs Bill Pringlemeir
@ 2010-11-10 11:19 ` Sergei Shtylyov
  2010-11-10 15:26 ` Sascha Hauer
  1 sibling, 0 replies; 16+ messages in thread
From: Sergei Shtylyov @ 2010-11-10 11:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 10-11-2010 2:11, Bill Pringlemeir wrote:

> $ mount -t debugfs debugfs /sys/kernel/debug
> $ cd /sys/kernel/debug/audmux
> $ cat *
> [crashes when accessing ssi7]

> The index is one based, but the register map is zero based.  So the
> ssi1 is actually sending info for ssi2.  Also, the ssi7 touches
> non-existent data and can cause an exception (only registers sets 1-6
> exist).

> Alternatively, the MX31_AUDMUX_PORT6_SSI_PINS_6 and
> MX27_AUDMUX_PPCR3_SSI_PINS_3 constants could be used for the loop
> termination, but maybe that means conditionalization (and there are no
> MX25 constants).

> diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
> index f9e7cdb..0547145 100644
> --- a/arch/arm/plat-mxc/audmux-v2.c
> +++ b/arch/arm/plat-mxc/audmux-v2.c
> @@ -66,7 +66,7 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
>   {
>          ssize_t ret;
>          char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
> -       int port = (int)file->private_data;
> +       int port = ((int)file->private_data) - 1;

    Parens around typecast not necessary.

WBR, Sergei

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Patch IMX audmux debugfs.
  2010-11-09 23:11 Patch IMX audmux debugfs Bill Pringlemeir
  2010-11-10 11:19 ` Sergei Shtylyov
@ 2010-11-10 15:26 ` Sascha Hauer
  2010-11-11 16:38   ` Bill Pringlemeir
  1 sibling, 1 reply; 16+ messages in thread
From: Sascha Hauer @ 2010-11-10 15:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Bill,

On Tue, Nov 09, 2010 at 06:11:12PM -0500, Bill Pringlemeir wrote:
> 
> $ mount -t debugfs debugfs /sys/kernel/debug
> $ cd /sys/kernel/debug/audmux
> $ cat *
> [crashes when accessing ssi7]
> 
> The index is one based, but the register map is zero based.  So the
> ssi1 is actually sending info for ssi2.  Also, the ssi7 touches
> non-existent data and can cause an exception (only registers sets 1-6
> exist).
> 
> Alternatively, the MX31_AUDMUX_PORT6_SSI_PINS_6 and
> MX27_AUDMUX_PPCR3_SSI_PINS_3 constants could be used for the loop
> termination, but maybe that means conditionalization (and there are no
> MX25 constants).
> 
> diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
> index f9e7cdb..0547145 100644
> --- a/arch/arm/plat-mxc/audmux-v2.c
> +++ b/arch/arm/plat-mxc/audmux-v2.c
> @@ -66,7 +66,7 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
>  {
>         ssize_t ret;
>         char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
> -       int port = (int)file->private_data;
> +       int port = ((int)file->private_data) - 1;
>         u32 pdcr, ptcr;
>  
>         if (!buf)
> @@ -150,7 +150,7 @@ static void audmux_debugfs_init(void)
>                 return;
>         }
>  
> -       for (i = 1; i < 8; i++) {
> +       for (i = 1; i < 7; i++) {
>                 snprintf(buf, sizeof(buf), "ssi%d", i);
>                 if (!debugfs_create_file(buf, 0444, audmux_debugfs_root,
>                                          (void *)i, &audmux_debugfs_fops))

I prefer passing (void *)(i - 1) here and skipping the first hunk.
Please add your Signed-off-by next time you send a patch.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Patch IMX audmux debugfs.
  2010-11-10 15:26 ` Sascha Hauer
@ 2010-11-11 16:38   ` Bill Pringlemeir
  2010-11-12  7:17     ` Sascha Hauer
  0 siblings, 1 reply; 16+ messages in thread
From: Bill Pringlemeir @ 2010-11-11 16:38 UTC (permalink / raw)
  To: linux-arm-kernel

On 10 Nov 2010, s.hauer at pengutronix.de wrote:

> On Tue, Nov 09, 2010 at 06:11:12PM -0500, Bill Pringlemeir wrote:

>> $ mount -t debugfs debugfs /sys/kernel/debug
>> $ cd /sys/kernel/debug/audmux
>> $ cat *
>> [crashes when accessing ssi7]

>> The index is one based, but the register map is zero based.  So the
>> ssi1 is actually sending info for ssi2.  Also, the ssi7 touches
>> non-existent data and can cause an exception (only registers sets 1-6
>> exist).

> I prefer passing (void *)(i - 1) here and skipping the first hunk.
> Please add your Signed-off-by next time you send a patch.

Something similar occured in to me after reading Sergei message.  This
patch treats i as the port instead of the file name.  The file name is
generated from audmux_port_string making the filenames and file
content the same.

Signed-off-by: Bill Pringlemeir <bpringle@sympatico.ca>
diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
index f9e7cdb..ac30fdc 100644
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ b/arch/arm/plat-mxc/audmux-v2.c
@@ -142,7 +142,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 +149,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 < 6; 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);

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Patch IMX audmux debugfs.
  2010-11-11 16:38   ` Bill Pringlemeir
@ 2010-11-12  7:17     ` Sascha Hauer
  2010-11-12 11:49       ` Mark Brown
  0 siblings, 1 reply; 16+ messages in thread
From: Sascha Hauer @ 2010-11-12  7:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Nov 11, 2010 at 11:38:48AM -0500, Bill Pringlemeir wrote:
> On 10 Nov 2010, s.hauer at pengutronix.de wrote:
> 
> > On Tue, Nov 09, 2010 at 06:11:12PM -0500, Bill Pringlemeir wrote:
> 
> >> $ mount -t debugfs debugfs /sys/kernel/debug
> >> $ cd /sys/kernel/debug/audmux
> >> $ cat *
> >> [crashes when accessing ssi7]
> 
> >> The index is one based, but the register map is zero based.  So the
> >> ssi1 is actually sending info for ssi2.  Also, the ssi7 touches
> >> non-existent data and can cause an exception (only registers sets 1-6
> >> exist).
> 
> > I prefer passing (void *)(i - 1) here and skipping the first hunk.
> > Please add your Signed-off-by next time you send a patch.
> 
> Something similar occured in to me after reading Sergei message.  This
> patch treats i as the port instead of the file name.  The file name is
> generated from audmux_port_string making the filenames and file
> content the same.

Ok, looks sensible to me. I added Mark Brown to Cc as he added the
debugfs support in the first place. Maybe he has some comment to add.

Sascha

> 
> Signed-off-by: Bill Pringlemeir <bpringle@sympatico.ca>
> diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
> index f9e7cdb..ac30fdc 100644
> --- a/arch/arm/plat-mxc/audmux-v2.c
> +++ b/arch/arm/plat-mxc/audmux-v2.c
> @@ -142,7 +142,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 +149,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 < 6; 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);
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Patch IMX audmux debugfs.
  2010-11-12  7:17     ` Sascha Hauer
@ 2010-11-12 11:49       ` Mark Brown
  2010-11-14 20:15         ` Bill Pringlemeir
       [not found]         ` <87oc9rk6fe.fsf@sympatico.ca>
  0 siblings, 2 replies; 16+ messages in thread
From: Mark Brown @ 2010-11-12 11:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Nov 12, 2010 at 08:17:06AM +0100, Sascha Hauer wrote:

> Ok, looks sensible to me. I added Mark Brown to Cc as he added the
> debugfs support in the first place. Maybe he has some comment to add.

Not really, except that the numbers used correspond to the numbers used
by the audmux APIs in the kernel IIRC.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Patch IMX audmux debugfs.
  2010-11-12 11:49       ` Mark Brown
@ 2010-11-14 20:15         ` Bill Pringlemeir
       [not found]         ` <87oc9rk6fe.fsf@sympatico.ca>
  1 sibling, 0 replies; 16+ messages in thread
From: Bill Pringlemeir @ 2010-11-14 20:15 UTC (permalink / raw)
  To: linux-arm-kernel

On 12 Nov 2010, broonie at opensource.wolfsonmicro.com wrote:

On Fri, Nov 12, 2010 at 08:17:06AM +0100, Sascha Hauer wrote:

>> Ok, looks sensible to me. I added Mark Brown to Cc as he added the
>> debugfs support in the first place. Maybe he has some comment to add.
>
> Not really, except that the numbers used correspond to the numbers used
> by the audmux APIs in the kernel IIRC.

I guess that was non-obvious as 'port 0' (corresponding to imx-ssi.0)
has no associated file in the current code.  I can re-submit a patch
with just this correction; add SSI0 and remove SSI6, SSI7 files.

However, as someone who is/was debugging an SOC audio system and
stumbled upon this debugfs entry, I don't think those numbers are
apparently obvious even with the fix.  I think both Sascha and I had
thought SSI1 corresponded to what should have been SSI0 (er, maybe I
lead Sascha that way).  I still think that having the 'port/channel'
name used in the file correspond to the the actual file names is
probably at least as debugfs user friendly.  The files names/content
are being viewed together so consistency seems in order.

Also, the kernel numbers *can* be referred to by macros and some users
might not even realize these numbers exist.  In any case, I would have
probably clued in if SSI0 had existed.  So I will fix that if we want
to remain with it?  The first patch submitted didn't do this.

Regards,
Bill Pringlemeir.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Patch v3] Fix audmuxv2 debugfs indexing. [was: Patch IMX audmux debugfs.]
       [not found]         ` <87oc9rk6fe.fsf@sympatico.ca>
@ 2010-11-15 15:09           ` Bill Pringlemeir
  2010-11-15 15:30             ` Mark Brown
       [not found]           ` <87zktavd2f.fsf_-_@sympatico.ca>
  1 sibling, 1 reply; 16+ messages in thread
From: Bill Pringlemeir @ 2010-11-15 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

On 14 Nov 2010, bpringle at sympatico.ca wrote:
On 12 Nov 2010, broonie at opensource.wolfsonmicro.com wrote:
On Fri, Nov 12, 2010 at 08:17:06AM +0100, Sascha Hauer wrote:

>>> Ok, looks sensible to me. I added Mark Brown to Cc as he added the
>>> debugfs support in the first place. Maybe he has some comment to add.
>>
>> Not really, except that the numbers used correspond to the numbers used
>> by the audmux APIs in the kernel IIRC.

[snip]

> Also, the kernel numbers *can* be referred to by macros and some users
> might not even realize these numbers exist.  In any case, I would have
> probably clued in if SSI0 had existed.  So I will fix that if we want
> to remain with it?  The first patch submitted didn't do this.

Following is the simple patch which corrects improper file indexing of
audmux port numbers.  Ie, ssi6, ssi7.  It also adds the ssi0 file.
The directory looks like this,

   root at uclibc /sys/kernel/debug/audmux$ ls
   ssi0  ssi1  ssi2  ssi3  ssi4  ssi5

With the number in ssi[0-5], corresponding to the
'MX31_AUDMUX_PORT[1-6]_*' and 'MX27_AUDMUX_[PH]PCR[1-3]_*' in audmux.h
or the raw value of the 'port' parameter of
mxc_audmux_v2_configure_port().

Signed-off-by: Bill Pringlemeir <bpringle@sympatico.ca>
diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
index f9e7cdb..2a1021f 100644
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ b/arch/arm/plat-mxc/audmux-v2.c
@@ -150,7 +150,7 @@ static void audmux_debugfs_init(void)
                return;
        }
 
-       for (i = 1; i < 8; i++) {
+       for (i = 0; i < 6; i++) {
                snprintf(buf, sizeof(buf), "ssi%d", i);
                if (!debugfs_create_file(buf, 0444, audmux_debugfs_root,
                                         (void *)i, &audmux_debugfs_fops))

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Patch v3] Fix audmuxv2 debugfs indexing.
       [not found]           ` <87zktavd2f.fsf_-_@sympatico.ca>
@ 2010-11-15 15:24             ` Bill Pringlemeir
  0 siblings, 0 replies; 16+ messages in thread
From: Bill Pringlemeir @ 2010-11-15 15:24 UTC (permalink / raw)
  To: linux-arm-kernel

On 15 Nov 2010, bpringle at sympatico.ca wrote:
> Following is the simple patch which corrects improper file indexing of
> audmux port numbers.  Ie, ssi6, ssi7.  It also adds the ssi0 file.
> The directory looks like this,

> root at uclibc /sys/kernel/debug/audmux$ ls
> ssi0  ssi1  ssi2  ssi3  ssi4  ssi5

The attached incremental patch changes the audmux v2 file naming to
correspond to the names used within the file.

   root at uclibc /sys/kernel/debug/audmux$ ls
   SSI3       SSI4       SSI5       SSI6       imx-ssi.0  imx-ssi.1

   root at uclibc /sys/kernel/debug/audmux$ cat imx-ssi.1 
   PDCR: 00008000
   PTCR: a5000800
   TxFS output from SSI5, TxClk output from SSI5
   Port is symmetric
   Data received from SSI5

The file 'imx-ssi.1' was 'ssi1'.  Here, the imx-ssi.1 driver is
connected to audmux pin set 5.  Perhaps 'audmux[3-5]' are better names
than SSI[3-5], if we are updating the naming scheme.  I think the
upper case names shout hardware loud enough.

Signed-off-by: Bill Pringlemeir <bpringle@sympatico.ca>
diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
index 2a1021f..8157704 100644
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ b/arch/arm/plat-mxc/audmux-v2.c
@@ -142,7 +142,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) {
@@ -151,8 +150,8 @@ static void audmux_debugfs_init(void)
        }
 
        for (i = 0; i < 6; i++) {
-               snprintf(buf, sizeof(buf), "ssi%d", i);
-               if (!debugfs_create_file(buf, 0444, audmux_debugfs_root,
+               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);

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Patch v3] Fix audmuxv2 debugfs indexing. [was: Patch IMX audmux debugfs.]
  2010-11-15 15:09           ` [Patch v3] Fix audmuxv2 debugfs indexing. [was: Patch IMX audmux debugfs.] Bill Pringlemeir
@ 2010-11-15 15:30             ` Mark Brown
  2010-11-15 15:53               ` [Patch v3] Fix audmuxv2 debugfs indexing Bill Pringlemeir
       [not found]               ` <87oc9qeg75.fsf@sympatico.ca>
  0 siblings, 2 replies; 16+ messages in thread
From: Mark Brown @ 2010-11-15 15:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 15, 2010 at 10:09:12AM -0500, Bill Pringlemeir wrote:

> -       for (i = 1; i < 8; i++) {
> +       for (i = 0; i < 6; i++) {
>                 snprintf(buf, sizeof(buf), "ssi%d", i);
>                 if (!debugfs_create_file(buf, 0444, audmux_debugfs_root,
>                                          (void *)i, &audmux_debugfs_fops))

We appear to have misplaced a SSI port here...

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Patch v3] Fix audmuxv2 debugfs indexing.
  2010-11-15 15:30             ` Mark Brown
@ 2010-11-15 15:53               ` Bill Pringlemeir
       [not found]               ` <87oc9qeg75.fsf@sympatico.ca>
  1 sibling, 0 replies; 16+ messages in thread
From: Bill Pringlemeir @ 2010-11-15 15:53 UTC (permalink / raw)
  To: linux-arm-kernel

On 15 Nov 2010, broonie at opensource.wolfsonmicro.com wrote:
On Mon, Nov 15, 2010 at 10:09:12AM -0500, Bill Pringlemeir wrote:

>> -       for (i = 1; i < 8; i++) {
>> +       for (i = 0; i < 6; i++) {
>> snprintf(buf, sizeof(buf), "ssi%d", i);
>> if (!debugfs_create_file(buf, 0444, audmux_debugfs_root,
>> (void *)i, &audmux_debugfs_fops))

> We appear to have misplaced a SSI port here...

Hmm, that is right.  SSI6 was returning bogus data (inside the debugfs
file "UNKNOWN" occured)...  Maybe it is just never setup right.  I
will look.

-- 
Yow!  Legally-imposed CULTURE-reduction is CABBAGE-BRAINED!

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Patch v3] Fix audmuxv2 debugfs indexing.
       [not found]               ` <87oc9qeg75.fsf@sympatico.ca>
@ 2010-11-15 16:10                 ` Bill Pringlemeir
  2010-11-15 16:26                   ` Mark Brown
  0 siblings, 1 reply; 16+ messages in thread
From: Bill Pringlemeir @ 2010-11-15 16:10 UTC (permalink / raw)
  To: linux-arm-kernel

On 15 Nov 2010, bpringle at sympatico.ca wrote:
On 15 Nov 2010, broonie at opensource.wolfsonmicro.com wrote:
On Mon, Nov 15, 2010 at 10:09:12AM -0500, Bill Pringlemeir wrote:

>>> -       for (i = 1; i < 8; i++) {
>>> +       for (i = 0; i < 6; i++) {
>>> snprintf(buf, sizeof(buf), "ssi%d", i);
>>> if (!debugfs_create_file(buf, 0444, audmux_debugfs_root,
>>> (void *)i, &audmux_debugfs_fops))

>> We appear to have misplaced a SSI port here...

> Hmm, that is right.  SSI6 was returning bogus data (inside the debugfs
> file "UNKNOWN" occured)...  Maybe it is just never setup right.  I
> will look.

I had thought the audmux_port_string() was correct and 'SSI6' was
looking at some 'bad memory'.

Sorry, I should have waited to email.  audmux_port_string() only
handles six values (not seven).  Also, the audmux.h only has six
defines for both MX31 and MX27.  There isn't an SSI7 that is being
reported by the debugfs.  However, a user of the audmux-v2.c code can
call mxc_audmux_v2_configure_port() with a port value of '6' to
configure audmux pin set 7 ;-)

The documentation we are working with isn't that helpful.  For the iMx
25 pg 13-4, it says there are "Three internal ports", but I can only
find two ssi devices (with two channels of audio each)...

fwiw,
Bill Pringlemeir.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Patch v3] Fix audmuxv2 debugfs indexing.
  2010-11-15 16:10                 ` Bill Pringlemeir
@ 2010-11-15 16:26                   ` Mark Brown
  2010-11-15 18:17                     ` Bill Pringlemeir
       [not found]                     ` <8762vy4fki.fsf@sympatico.ca>
  0 siblings, 2 replies; 16+ messages in thread
From: Mark Brown @ 2010-11-15 16:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 15, 2010 at 11:10:31AM -0500, Bill Pringlemeir wrote:

> Sorry, I should have waited to email.  audmux_port_string() only
> handles six values (not seven).  Also, the audmux.h only has six
> defines for both MX31 and MX27.  There isn't an SSI7 that is being
> reported by the debugfs.  However, a user of the audmux-v2.c code can
> call mxc_audmux_v2_configure_port() with a port value of '6' to
> configure audmux pin set 7 ;-)

SSI7 is an internal network connection thing of some kind.

> The documentation we are working with isn't that helpful.  For the iMx
> 25 pg 13-4, it says there are "Three internal ports", but I can only
> find two ssi devices (with two channels of audio each)...

It's not an SSI port.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Patch v3] Fix audmuxv2 debugfs indexing.
  2010-11-15 16:26                   ` Mark Brown
@ 2010-11-15 18:17                     ` Bill Pringlemeir
       [not found]                     ` <8762vy4fki.fsf@sympatico.ca>
  1 sibling, 0 replies; 16+ messages in thread
From: Bill Pringlemeir @ 2010-11-15 18:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 15 Nov 2010, broonie at opensource.wolfsonmicro.com wrote:
On Mon, Nov 15, 2010 at 11:10:31AM -0500, Bill Pringlemeir wrote:

>> Sorry, I should have waited to email.  audmux_port_string() only
>> handles six values (not seven).  Also, the audmux.h only has six
>> defines for both MX31 and MX27.  There isn't an SSI7 that is being
>> reported by the debugfs.  However, a user of the audmux-v2.c code can
>> call mxc_audmux_v2_configure_port() with a port value of '6' to
>> configure audmux pin set 7 ;-)

> SSI7 is an internal network connection thing of some kind.

On pg 4-60 of the IMX 25 reference manual, the IOMUX configuration for
ALT3 is AUD7_TXFS.  This makes me think it is a 'physical' pin after
the IOMUX routing.

 $ grep AUD7 arch/arm/plat-mxc/include/mach/iomux-mx25.h
    364:#define MX25_PAD_SD1_DATA1__AUD7_RXD  
    469:#define MX25_PAD_GPIO_E__AUD7_TXD     
    472:#define MX25_PAD_GPIO_F__AUD7_TXC     
    481:#define MX25_PAD_VSTBY_REQ__AUD7_TXFS 
    487:#define MX25_PAD_POWER_FAIL__AUD7_RXD 

Oddly, the iomux-mx25.h is the only 'iomux-mx[1235]*.h' one with this
audmux 7 configuration, but some of the ALT configuration values are
missing from these files.  Maybe the MX25 is different.  It is the
only IMX processor that I am familar with.

'iomux-mx25.h' has

     77:#define MX25_PAD_EB0__AUD4_TXD         
     81:#define MX25_PAD_EB1__AUD4_RXD         
     85:#define MX25_PAD_OE__AUD4_TXC          
    117:#define MX25_PAD_RW__AUD4_TXFS         
    364:#define MX25_PAD_SD1_DATA1__AUD7_RXD   
    394:#define MX25_PAD_KPP_COL0__AUD5_TXD    
    399:#define MX25_PAD_KPP_COL1__AUD5_RXD    
    404:#define MX25_PAD_KPP_COL2__AUD5_TXC    
    409:#define MX25_PAD_KPP_COL3__AUD5_TXFS   
    413:#define MX25_PAD_FEC_MDC__AUD4_TXD     
    417:#define MX25_PAD_FEC_MDIO__AUD4_RXD    
    424:#define MX25_PAD_FEC_TDATA1__AUD4_TXFS 
    469:#define MX25_PAD_GPIO_E__AUD7_TXD      
    472:#define MX25_PAD_GPIO_F__AUD7_TXC      
    481:#define MX25_PAD_VSTBY_REQ__AUD7_TXFS  
    487:#define MX25_PAD_POWER_FAIL__AUD7_RXD  

As well, chapter 4 (IOMUX) of the IMX25 RM has,

  LD8, ALT4  -> AUD3_TXD
  LD9, ALT4  -> AUD3_RXD
  LD10, ALT4 -> AUD3_TXC
  LD11, ALT4 -> AUD3_TXFS
  LD14, ALT6 -> AUD3_RXC
  LD15, ALT6 -> AUD3_RXFS

  CSID8, ALT2 -> AUD6_RXC
... etc.

>> The documentation we are working with isn't that helpful.  For the iMx
>> 25 pg 13-4, it says there are "Three internal ports", but I can only
>> find two ssi devices (with two channels of audio each)...

> It's not an SSI port.

No, I don't think it is an SSI protocol device either.  I think there
are two internal ports and five external ports, at least on the IMX
25.  Maybe the documentation is cut and paste from another processor?

There is this cryptic section of the on pg 13-4,

   13.2      External Signal Description

   Table 13-2 lists AUDMUX pin-level signals for the external ports,
   where:

      ? Pn is P4, through P7
      ? m = n ? 3.

   The port is configured as an external port by a static system-level
   signal input pn_int_ext_select.

I guess they could be 'internal' if you didn't configure an external
pin with the iomux module.  Register
IOMUXC_AUDMUX_P4_INPUT_DA_AMX_SELECT_INPUT (offset 0x460) might be
what the above section refers to, but this involves 'daisy chaining'
and only AUDMUX_P4 and AUDMUX_P7 are listed here (No P3,P5,P6).

Thanks for you help.  I *think* I am getting closer to understanding
this now.

Regards,
Bill Pringlemeir.

-- 
Someday we'll look back on all this and plow into a parked car.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Patch v3] Fix audmuxv2 debugfs indexing.
       [not found]                     ` <8762vy4fki.fsf@sympatico.ca>
@ 2010-11-19 15:47                       ` Bill Pringlemeir
       [not found]                       ` <87r5ehuxh5.fsf@sympatico.ca>
  1 sibling, 0 replies; 16+ messages in thread
From: Bill Pringlemeir @ 2010-11-19 15:47 UTC (permalink / raw)
  To: linux-arm-kernel

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

> No, I don't think it is an SSI protocol device either.  I think there
> are two internal ports and five external ports, at least on the IMX
> 25.  Maybe the documentation is cut and paste from another processor?

[snip]

> Thanks for you help.  I *think* I am getting closer to understanding
> this now.

I sent a service request to Freescale,

[Technical Support Freescale Semiconductor] 

   In reply to your Service Request SR 1-694170620: The i.MX25 AUDMUX
   Port1 and Port2 are connected to the internal SSI modules, the
   Port3 to Port7 are connected to external pins through the IOMUX
   module. The Port7 can be always used as external port, regardless
   of the CE bus mode. Should you need to contact us with regard to
   this message, please see the notes below.

It looks like the i.MX25 is a mix of the i.MX31 and i.MX35.  I think
it makes the most sense to change the audmux_port_string() to return
"SSI7" instead of "UNKNOWN" for this port and fix the loop indexes.

I will re-submit those patches later.

Regards,
Bill Pringlemeir.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Patch v3] Fix audmuxv2 debugfs indexing.
       [not found]                       ` <87r5ehuxh5.fsf@sympatico.ca>
@ 2010-11-30 21:07                         ` Bill Pringlemeir
  0 siblings, 0 replies; 16+ messages in thread
From: Bill Pringlemeir @ 2010-11-30 21:07 UTC (permalink / raw)
  To: linux-arm-kernel

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@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);

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-11-30 21:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-09 23:11 Patch IMX audmux debugfs Bill Pringlemeir
2010-11-10 11:19 ` Sergei Shtylyov
2010-11-10 15:26 ` Sascha Hauer
2010-11-11 16:38   ` Bill Pringlemeir
2010-11-12  7:17     ` Sascha Hauer
2010-11-12 11:49       ` Mark Brown
2010-11-14 20:15         ` Bill Pringlemeir
     [not found]         ` <87oc9rk6fe.fsf@sympatico.ca>
2010-11-15 15:09           ` [Patch v3] Fix audmuxv2 debugfs indexing. [was: Patch IMX audmux debugfs.] Bill Pringlemeir
2010-11-15 15:30             ` Mark Brown
2010-11-15 15:53               ` [Patch v3] Fix audmuxv2 debugfs indexing Bill Pringlemeir
     [not found]               ` <87oc9qeg75.fsf@sympatico.ca>
2010-11-15 16:10                 ` Bill Pringlemeir
2010-11-15 16:26                   ` Mark Brown
2010-11-15 18:17                     ` Bill Pringlemeir
     [not found]                     ` <8762vy4fki.fsf@sympatico.ca>
2010-11-19 15:47                       ` Bill Pringlemeir
     [not found]                       ` <87r5ehuxh5.fsf@sympatico.ca>
2010-11-30 21:07                         ` Bill Pringlemeir
     [not found]           ` <87zktavd2f.fsf_-_@sympatico.ca>
2010-11-15 15:24             ` Bill Pringlemeir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).