All of lore.kernel.org
 help / color / mirror / Atom feed
From: AceLan Kao <acelan.kao@canonical.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Alexandru Ardelean <alexandru.ardelean@analog.com>,
	William Sung <william.sung@advantech.com.tw>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio <linux-iio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Campion Kang <Campion.Kang@advantech.com.tw>
Subject: Re: [PATCH] iio: dac: ad5593r: Dynamically set AD5593R channel modes
Date: Fri, 4 Sep 2020 10:25:39 +0800	[thread overview]
Message-ID: <CAFv23Qnij-2ycXNqisQDbo9ix41ed1HPRJrOdRoMM2bjU407nw@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VcJp4zCxOUBgYTypv_R47vLAuAF2ZStLpA9mjFjbzWcxw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4036 bytes --]

Hi Andy,

Here is the updated ads5593r.asl, but I still got some troubles when
using configfs.
The modification I made
1. add DefinitionBlock() and External()
2. align _SB.I2C1
3. set _CRS serialized

The issues I got are,
1. The ADS5593 is defined in DSDT table, but I can't compile the asl
code when define it as DSDT table
$ iasl ads5593r.asl

Intel ACPI Component Architecture
ASL+ Optimizing Compiler/Disassembler version 20190509
Copyright (c) 2000 - 2019 Intel Corporation

ads5593r.asl      5:     Scope (_SB.I2C1)
Error    6148 -                       ^ Illegal open scope on external
object from within DSDT

ASL Input:     ads5593r.asl -    7917 bytes     30 keywords    257 source lines

Compilation failed. 1 Errors, 0 Warnings, 0 Remarks
No AML files were generated due to compiler error(s)

2. I got below errors in dmesg if I set it as SSDT
[  410.220993] ACPI: Host-directed Dynamic ACPI Table Load:
[  410.221013] ACPI: SSDT 0xFFFF89A4ADDE7C00 00035D (v01
ADS5593R 00000001 INTL 20190509)
[  410.221106] ACPI BIOS Error (bug): Failure creating named object
[\_SB.I2C1.I2CG], AE_ALREADY_EXISTS (20190816/dswload2-326)
[  410.221324] ACPI Error: AE_ALREADY_EXISTS, During name
lookup/catalog (20190816/psobject-220)
[  410.221468] ACPI: Skipping parse of AML opcode: Device (0x5B82)

Do you have any suggestions?
We may have a chance to convince BIOS to move ADS5593 to the SSDT
table, do you think it's a good idea?
BTW, the driver set the channels mode while probing, I'm not sure if
configfs will make the driver probe again when new table is loaded
If we can't use configfs, is there any other way we could try?
Thanks.

Andy Shevchenko <andy.shevchenko@gmail.com> 於 2020年9月3日 週四 下午6:54寫道:
>
> On Thu, Sep 3, 2020 at 1:42 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Thu, Sep 3, 2020 at 10:37 AM AceLan Kao <acelan.kao@canonical.com> wrote:
>
> Couple additional notes.
>
> ...
>
> > > I spent some time studying/reading what you wrote, but I still don't
> > > understand how to leverage meta-acpi.
> >
> > meta-acpi is a Yocto layer to support provided ACPI tables for the
> > build. My point here is to have it as a collection of ASL examples.
> > It's what you asked for below in this email.
>
> > Also we can collect your ASL example under board (presumably new) folder.
>
> Actually it seems Baytrail, so, minnowboard-max is good enough.
>
> ...
>
> > On the first glance I didn't see any issues with it, but on second
> > look here is one. Look into this [5] example.
> > If you noticed it uses the same path in Scope and in the reference in
> > I2cSerialBus() while in your ASL they are different.
>
> Also there is an _ADR value wrong for the second channel (I'm not sure
> if it affects anyhow the rest).
>
> > Do you have issues with loading it (as is and after above addressed)?
> >
> > [5]: https://github.com/westeri/meta-acpi/blob/master/recipes-bsp/acpi-tables/samples/edison/ft6236.asli
>
> Also a link [6] to our Buildroot repository which allows to create an
> initramfs with ASL compiled. Maybe used as a reference how we created
> initramfs and compile ASLs.
>
> [6]: https://github.com/andy-shev/buildroot/tree/intel/board/intel/common
> ...
>
> > > > One more useful link is SO answers on the topic:
> > > > https://stackoverflow.com/search?tab=newest&q=prp0001
> > > >
> > > > > [1]: https://www.kernel.org/doc/html/latest/firmware-guide/acpi/enumeration.html#device-tree-namespace-link-device-id
> > > > > [2]: https://elixir.bootlin.com/linux/v5.9-rc3/source/Documentation/devicetree/bindings/iio/dac/ad5592r.txt
> > > > > [3]: https://github.com/westeri/meta-acpi
> > > > > [4]: https://github.com/westeri/meta-acpi/tree/master/recipes-bsp/acpi-tables/samples
>
> > > > > > 1. https://www.advantech.com/products/9a0cc561-8fc2-4e22-969c-9df90a3952b5/uno-420/mod_2d6a546b-39e3-4bc4-bbf4-ac89e6b7667c
>
>
>
> --
> With Best Regards,
> Andy Shevchenko

[-- Attachment #2: ads5593.asl --]
[-- Type: application/octet-stream, Size: 7913 bytes --]

DefinitionBlock ("ads5593r.aml", "SSDT", 1, "", "ADS5593R", 1)
{
    External (\_SB.I2C1, DeviceObj)

    Scope (_SB.I2C1)
    {
        Device (I2CG)
        {
            Name (_HID, "ADS5593")  // _HID: Hardware ID
            Device (IOP0)
            {
                Name (_ADR, Zero)  // _ADR: Address
                Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */, 
                    Package (0x03)
                    {
                        Package (0x02)
                        {
                            "reg", 
                            Zero
                        }, 

                        Package (0x02)
                        {
                            "adi,mode", 
                            0x08
                        }, 

                        Package (0x02)
                        {
                            "adi,off-state", 
                            Zero
                        }
                    }
                })
            }

            Device (IOP1)
            {
                Name (_ADR, Zero)  // _ADR: Address
                Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */, 
                    Package (0x03)
                    {
                        Package (0x02)
                        {
                            "reg", 
                            One
                        }, 

                        Package (0x02)
                        {
                            "adi,mode", 
                            0x03
                        }, 

                        Package (0x02)
                        {
                            "adi,off-state", 
                            Zero
                        }
                    }
                })
            }

            Device (IOP2)
            {
                Name (_ADR, 0x02)  // _ADR: Address
                Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */, 
                    Package (0x03)
                    {
                        Package (0x02)
                        {
                            "reg", 
                            0x02
                        }, 

                        Package (0x02)
                        {
                            "adi,mode", 
                            0x02
                        }, 

                        Package (0x02)
                        {
                            "adi,off-state", 
                            Zero
                        }
                    }
                })
            }

            Device (IOP3)
            {
                Name (_ADR, 0x03)  // _ADR: Address
                Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */, 
                    Package (0x03)
                    {
                        Package (0x02)
                        {
                            "reg", 
                            0x03
                        }, 

                        Package (0x02)
                        {
                            "adi,mode", 
                            One
                        }, 

                        Package (0x02)
                        {
                            "adi,off-state", 
                            Zero
                        }
                    }
                })
            }

            Device (IOP4)
            {
                Name (_ADR, 0x04)  // _ADR: Address
                Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */, 
                    Package (0x03)
                    {
                        Package (0x02)
                        {
                            "reg", 
                            0x04
                        }, 

                        Package (0x02)
                        {
                            "adi,mode", 
                            0x08
                        }, 

                        Package (0x02)
                        {
                            "adi,off-state", 
                            Zero
                        }
                    }
                })
            }

            Device (IOP5)
            {
                Name (_ADR, 0x05)  // _ADR: Address
                Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */, 
                    Package (0x03)
                    {
                        Package (0x02)
                        {
                            "reg", 
                            0x05
                        }, 

                        Package (0x02)
                        {
                            "adi,mode", 
                            0x03
                        }, 

                        Package (0x02)
                        {
                            "adi,off-state", 
                            Zero
                        }
                    }
                })
            }

            Device (IOP6)
            {
                Name (_ADR, 0x06)  // _ADR: Address
                Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */, 
                    Package (0x03)
                    {
                        Package (0x02)
                        {
                            "reg", 
                            0x06
                        }, 

                        Package (0x02)
                        {
                            "adi,mode", 
                            0x02
                        }, 

                        Package (0x02)
                        {
                            "adi,off-state", 
                            Zero
                        }
                    }
                })
            }

            Device (IOP7)
            {
                Name (_ADR, 0x07)  // _ADR: Address
                Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */, 
                    Package (0x03)
                    {
                        Package (0x02)
                        {
                            "reg", 
                            0x07
                        }, 

                        Package (0x02)
                        {
                            "adi,mode", 
                            One
                        }, 

                        Package (0x02)
                        {
                            "adi,off-state", 
                            Zero
                        }
                    }
                })
            }

            Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
            {
                Name (RBUF, ResourceTemplate ()
                {
                    I2cSerialBusV2 (0x0010, ControllerInitiated, 0x00061A80,
                        AddressingMode7Bit, "\\_SB.I2C1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                })
                Return (RBUF) /* \_SB_.I2C1.I2CG._CRS.RBUF */
            }
        }
    }

  reply	other threads:[~2020-09-04  2:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24  5:43 [PATCH] iio: dac: ad5593r: Dynamically set AD5593R channel modes William Sung
2020-08-25  4:15 ` AceLan Kao
2020-08-30 17:07 ` Andy Shevchenko
2020-08-31 11:28   ` AceLan Kao
2020-08-31 12:45     ` Andy Shevchenko
2020-08-31 12:47       ` Andy Shevchenko
2020-09-03  7:37         ` AceLan Kao
2020-09-03 10:42           ` Andy Shevchenko
2020-09-03 10:54             ` Andy Shevchenko
2020-09-04  2:25               ` AceLan Kao [this message]
2020-09-04  7:40                 ` Andy Shevchenko
     [not found]             ` <b1581dc61d584cffa2588f72b888ffa0@taipei09.ADVANTECH.CORP>
2020-09-04  7:48               ` Andy Shevchenko
     [not found]                 ` <705b481901d64d30830689f0aa541cb9@taipei09.ADVANTECH.CORP>
2020-09-04 11:38                   ` Andy Shevchenko
2020-09-04 11:43                     ` Andy Shevchenko
2020-09-02  8:09       ` Hennerich, Michael
2020-09-02  8:52         ` Andy Shevchenko
2020-09-02  9:11           ` Hennerich, Michael
2020-09-02  9:28             ` Andy Shevchenko
2020-09-02 13:23               ` Jonathan Cameron

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=CAFv23Qnij-2ycXNqisQDbo9ix41ed1HPRJrOdRoMM2bjU407nw@mail.gmail.com \
    --to=acelan.kao@canonical.com \
    --cc=Campion.Kang@advantech.com.tw \
    --cc=Michael.Hennerich@analog.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=william.sung@advantech.com.tw \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.