[alsa-devel] [WM5102/ARIZONA] spi driver needs to support ACPI
Christian Hartmann
cornogle at googlemail.com
Tue May 19 15:39:59 CEST 2015
Hi,
at the moment I am totally confused. I thought adding an ACPI ID is
trivial, but it is not.
I have again a null pointer exception in arizona_spi_probe()
could it be with the new num_chipselect value in spi-pxa2xx.c ??
I attach the trace of the last try
Any hints or tips are welcome.
cheers
chris
2015-05-19 11:04 GMT+02:00 Christian Hartmann <cornogle at googlemail.com>:
> Hi,
>
> so the ACPI id string, which I want to add to arizona-spi.c should be
>
> WM510205 ??
>
> I have changed the ACPI string to
>
> {"WM510205", WM5102},
>
> now and give it a try.
>
> cheers
> chris
>
> 2015-05-18 18:29 GMT+02:00 Pierre-Louis Bossart
> <pierre-louis.bossart at linux.intel.com>:
>> On 5/15/15 4:16 AM, Christian Hartmann wrote:
>>>
>>> Hi list,
>>>
>>>
>>> I need ACPI support for the arizona-core / arizona-spi driver for the
>>> ACPI ID WM5102.
>>> This audio codec is build into the Lenovo Yoga 851F. This device is a
>>> 32Bit (UEFI) system
>>>
>>>
>>> http://support.lenovo.com/de/de/products/tablets/yoga-series/yoga-tablet-2-851
>>>
>>>
>>> I have tested with vanilla kernels from kernel.org 3.19.y ,4.0.y and
>>> master (from torvalds) currently its 4.1.0-rc3. As distribution I am
>>> working with Fedora / Fedlet was the initial install image.
>>>
>>> With all vanilla kernels I got at first an error message from spi32766:
>>>
>>> [ 0.296297] pxa2xx-spi 80860F0E:00: cs1 >= max 1
>>> [ 0.296311] spi_master spi32766: failed to add SPI device
>>> WM510205:00 from ACPI
>>>
>>> so I have at first patched as suggested by broonie the arizona-core
>>>
>>> commit 48203a0fede057d6a8c5f6872c53326395350f45
>>> Author: somebody anybody <somebody at foobar.com>
>>> Date: Mon May 11 13:35:43 2015 +0200
>>>
>>> spi-pxa2xx : raise chipselect
>>>
>>> Signed-off-by: somebody anybody <somebody at foobar.com>
>>>
>>> diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
>>> index e3223ac..9c919ea 100644
>>> --- a/drivers/spi/spi-pxa2xx.c
>>> +++ b/drivers/spi/spi-pxa2xx.c
>>> @@ -1279,7 +1279,7 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device
>>> *pdev)
>>> if (adev->pnp.unique_id && !kstrtoint(adev->pnp.unique_id, 0,
>>> &devid))
>>> ssp->port_id = devid;
>>>
>>> - pdata->num_chipselect = 1;
>>> + pdata->num_chipselect = 20;
>>> pdata->enable_dma = true;
>>>
>>> return pdata;
>>>
>>> This leds the spi master do the further ACPI configuration and inital
>>> setup for the arizona-spi device, but adding the ACPI ID to it
>>> does not work yet as expected:
>>>
>>> The current last patchset on top of master is
>>>
>>>
>>> Author: somebody anybody <somebody at foobar.com>
>>> Date: Wed May 13 11:36:25 2015 +0200
>>>
>>> arizona : added ACPI id of wm5102 to SPI driver, too
>>>
>>> Signed-off-by: somebody anybody <somebody at foobar.com>
>>>
>>> diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c
>>> index 1e845f6..c19a4c1 100644
>>> --- a/drivers/mfd/arizona-spi.c
>>> +++ b/drivers/mfd/arizona-spi.c
>>> @@ -17,6 +17,7 @@
>>> #include <linux/regulator/consumer.h>
>>> #include <linux/slab.h>
>>> #include <linux/spi/spi.h>
>>> +#include <linux/acpi.h>
>>> #include <linux/of.h>
>>>
>>> #include <linux/mfd/arizona/core.h>
>>> @@ -82,6 +83,15 @@ static int arizona_spi_remove(struct spi_device *spi)
>>> return 0;
>>> }
>>>
>>> +#ifdef CONFIG_ACPI
>>> +static struct acpi_device_id wm5102_acpi_match[] = {
>>> + { "WM5102", 0},
>>> + { "WM510205", 0},
>>> + { },
>>> +};
>>> +MODULE_DEVICE_TABLE(acpi, wm5102_acpi_match);
>>> +#endif
>>> +
>>> static const struct spi_device_id arizona_spi_ids[] = {
>>> { "wm5102", WM5102 },
>>> { "wm5110", WM5110 },
>>> @@ -96,6 +106,9 @@ static struct spi_driver arizona_spi_driver = {
>>> .owner = THIS_MODULE,
>>> .pm = &arizona_pm_ops,
>>> .of_match_table = of_match_ptr(arizona_of_match),
>>> +#ifdef CONFIG_ACPI
>>> + .acpi_match_table = ACPI_PTR(wm5102_acpi_match),
>>> +#endif
>>> },
>>> .probe = arizona_spi_probe,
>>> .remove = arizona_spi_remove,
>>>
>>>
>>>
>>>
>>> commit 268e21d29c942205e40f749c6d71c77839dc67da
>>> Author: somebody anybody <somebody at foobar.com>
>>> Date: Wed May 13 11:36:04 2015 +0200
>>>
>>> arizona : added ACPI id of wm5102 to i2c driver
>>>
>>> Signed-off-by: somebody anybody <somebody at foobar.com>
>>>
>>> diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c
>>> index ff782a5..45ece1b 100644
>>> --- a/drivers/mfd/arizona-i2c.c
>>> +++ b/drivers/mfd/arizona-i2c.c
>>> @@ -18,6 +18,7 @@
>>> #include <linux/regulator/consumer.h>
>>> #include <linux/slab.h>
>>> #include <linux/of.h>
>>> +#include <linux/acpi.h>
>>>
>>> #include <linux/mfd/arizona/core.h>
>>>
>>> @@ -85,6 +86,15 @@ static int arizona_i2c_remove(struct i2c_client *i2c)
>>> return 0;
>>> }
>>>
>>> +#ifdef CONFIG_ACPI
>>> +static struct acpi_device_id wm5102_acpi_match[] = {
>>> + { "WM5102", 0},
>>> + { "WM510205", 0},
>>> + { },
>>
>>
>> Those IDs don't really look like ACPI ones? Isn't there a rule that the _HID
>> is represented by a 4-letter vendor ID followed by part ID? see
>> http://www.uefi.org/PNP_ACPI_Registry
>>
>>
>>> +};
>>> +MODULE_DEVICE_TABLE(acpi, wm5102_acpi_match);
>>> +#endif
>>> +
>>> static const struct i2c_device_id arizona_i2c_id[] = {
>>> { "wm5102", WM5102 },
>>> { "wm5110", WM5110 },
>>> @@ -100,6 +110,9 @@ static struct i2c_driver arizona_i2c_driver = {
>>> .owner = THIS_MODULE,
>>> .pm = &arizona_pm_ops,
>>> .of_match_table = of_match_ptr(arizona_of_match),
>>> +#ifdef CONFIG_ACPI
>>> + .acpi_match_table = ACPI_PTR(wm5102_acpi_match),
>>> +#endif
>>> },
>>> .probe = arizona_i2c_probe,
>>> .remove = arizona_i2c_remove,
>>>
>>>
>>>
>>> with these two patches the local master branch compiles fine, but at
>>> initialzing the arizona-spi driver gots a NULL pointer exception.
>>>
>>> I attach the whole dmesg of 4.1.0-rc3 (build 4.1.0.24-rc3).
>>>
>>> I need some assistance or hints to the right direction, I am looking
>>> myself and I also try what I can, but I think it would be easy peasy
>>> with some experts like here on this list :)
>>>
>>>
>>> PS: the message : spi_master spi32766: raised num_chipselect to 20 for
>>> WM510205:00
>>>
>>> is a dev_err() line added to the function static acpi_status
>>> acpi_spi_add_device(), there I had raised the num_chipselect first
>>> (that was wrong, the raise is now done as in the first patch above.
>>> this is only a debug message and will be removed soon)
>>>
>>>
>>> PPS: for me it seems that there is a missing 'link' from WM5102 to the
>>> sst-acpi 80860F28:00 device, which complaints NOW / the first time
>>> with the three patches applied on top on master.... will have a look
>>> into it.
>>>
>>> I hope I got this device working with some more help from you.
>>>
>>> cheers
>>> chris
>>>
>>>
>>>
>>> _______________________________________________
>>> Alsa-devel mailing list
>>> Alsa-devel at alsa-project.org
>>> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>>>
>>
>
>
>
> --
> --
> ......oooO..............
> .....(....).....Oooo...
> ......)../.....(....)....
> .....(_/.......)../.....
> ...............(_/.......
> ... I WAS ..............
> .......... HERE...... ;)
--
--
......oooO..............
.....(....).....Oooo...
......)../.....(....)....
.....(_/.......)../.....
...............(_/.......
... I WAS ..............
.......... HERE...... ;)
-------------- next part --------------
[ 5.772216] BUG: unable to handle kernel NULL pointer dereference at 00000020
[ 5.779625] IP: [<f7e9a043>] arizona_spi_probe+0x23/0xf4 [arizona_spi]
[ 5.787016] *pde = 00000000
[ 5.794351] Oops: 0000 [#1] SMP
[ 5.801668] Modules linked in: int3403_thermal(+) int3400_thermal(+) acpi_thermal_rel arizona_spi(+) int340x_thermal_zone pwm_lpss_platform rfkill_gpio pwm_lpss arizona_i2c snd_soc_sst_acpi i2c_designware_platform(+) acpi_pad rfkill i2c_designware_core ax88179_178a usbnet mii
[ 5.817124] CPU: 1 PID: 429 Comm: systemd-udevd Not tainted 4.1.0.28-rc4 #137
[ 5.824944] Hardware name: LENOVO 60072/INVALID, BIOS 02WT18WW 08/01/2014
[ 5.832822] task: f41f8000 ti: f4136000 task.ti: f4136000
[ 5.840695] EIP: 0060:[<f7e9a043>] EFLAGS: 00010246 CPU: 1
[ 5.848572] EIP is at arizona_spi_probe+0x23/0xf4 [arizona_spi]
[ 5.856456] EAX: 00000000 EBX: f4bbb800 ECX: f7e9c010 EDX: f7e9b0c8
[ 5.864375] ESI: 00000000 EDI: f7e9c000 EBP: f4137ce8 ESP: f4137ccc
[ 5.872276] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
[ 5.880187] CR0: 80050033 CR2: 00000020 CR3: 36d9a000 CR4: 001007d0
[ 5.888134] Stack:
[ 5.896023] f4137ce0 c0744192 f4bbb800 f4bbb800 00000000 f4bbb800 f7e9c000 f4137cfc
[ 5.904090] c091b534 f4bbb800 f7e9c010 00000000 f4137d30 c08a156a f7e9c060 f7e9c010
[ 5.912227] f4137d1c c07465e7 666b9647 f4bbb834 00000014 f4bbb834 f4bbb800 f7e9c010
[ 5.920407] Call Trace:
[ 5.928510] [<c0744192>] ? acpi_dev_pm_attach+0x57/0x79
[ 5.936666] [<c091b534>] spi_drv_probe+0x34/0x60
[ 5.944836] [<c08a156a>] driver_probe_device+0x1ba/0x400
[ 5.953041] [<c07465e7>] ? acpi_driver_match_device+0x36/0x3f
[ 5.961275] [<c08a1861>] __driver_attach+0x71/0x80
[ 5.969512] [<c08a17f0>] ? __device_attach+0x40/0x40
[ 5.977748] [<c089f827>] bus_for_each_dev+0x57/0xa0
[ 5.985995] [<c08a0f4e>] driver_attach+0x1e/0x20
[ 5.994234] [<c08a17f0>] ? __device_attach+0x40/0x40
[ 6.002476] [<c08a0b97>] bus_add_driver+0x157/0x230
[ 6.010715] [<f7e9f000>] ? 0xf7e9f000
[ 6.018932] [<f7e9f000>] ? 0xf7e9f000
[ 6.027146] [<c08a1f69>] driver_register+0x59/0xe0
[ 6.035420] [<c06d3820>] ? kvasprintf+0x40/0x50
[ 6.043695] [<c091b4b1>] spi_register_driver+0x41/0x50
[ 6.051991] [<f7e9f00d>] arizona_spi_driver_init+0xd/0x1000 [arizona_spi]
[ 6.060360] [<c0400472>] do_one_initcall+0xc2/0x1f0
[ 6.068728] [<f7e9f000>] ? 0xf7e9f000
[ 6.077084] [<c052b3b3>] ? free_pages_prepare+0x1c3/0x360
[ 6.085482] [<c0569d7d>] ? kmem_cache_alloc_trace+0x17d/0x1e0
[ 6.093878] [<c05694bf>] ? kfree+0xcf/0x100
[ 6.102240] [<c0b2e3de>] ? do_init_module+0x24/0x1ae
[ 6.110563] [<c0b2e40d>] do_init_module+0x53/0x1ae
[ 6.118823] [<c04c4ee4>] load_module+0x1034/0x16b0
[ 6.127016] [<c04c1ef9>] ? copy_module_from_fd.isra.48+0x109/0x1a0
[ 6.135281] [<c04c574d>] SyS_finit_module+0x8d/0xd0
[ 6.143545] [<c053f143>] ? vm_mmap_pgoff+0x93/0xb0
[ 6.151813] [<c0b3b38f>] sysenter_do_call+0x12/0x12
[ 6.160097] Code: 00 00 8d bf 00 00 00 00 55 89 e5 57 56 53 83 ec 10 3e 8d 74 26 00 89 c3 e8 db 23 a8 c8 85 db 89 c6 74 35 8b 83 70 01 00 00 85 c0 <8b> 46 20 74 2b 89 44 24 08 c7 44 24 04 24 b0 e9 f7 89 1c 24 e8
[ 6.177597] EIP: [<f7e9a043>] arizona_spi_probe+0x23/0xf4 [arizona_spi] SS:ESP 0068:f4137ccc
[ 6.186298] CR2: 0000000000000020
[ 6.998720] intel_sst_acpi 80860F28:00: No matching machine driver found
More information about the Alsa-devel
mailing list