snd-powermac: older kernel compatibility
PATCH 1/1 snd-powermac: older kernel compatibility
I had to do these small modifications to make it work with older kernels.
Risto
From: Risto Suominen <[email protected]>
Allow to compile snd-powermac on older kernels.
---
Kernel version < 2.6.16
pmac_old.c renamed from pmac_old.c.orig +6 -0
@@ -997,12 +997,14 @@ static int __init snd_pmac_detect(struct chip->can_byte_swap =0 ;/* FIXME: check this */ chip->control_mask =MASK_IEPC |0x11 ;/* disable IEE */ break ; +#ifdef SND_POWERMAC_SUPPORT_TOONIE case 0x3a : chip->num_freqs =ARRAY_SIZE (tumbler_freqs); chip->model =PMAC_TOONIE ; chip->can_byte_swap =0 ;/* FIXME: check this */ chip->control_mask =MASK_IEPC |0x11 ;/* disable IEE */ break ; +#endif } } prop = (unsigned int *)get_property (sound,"device-id" ,NULL );
@@ -1019,6 +1021,10 @@ static int __init snd_pmac_detect(structelse {struct pci_dev *pdev =NULL ; +#ifndef for_each_pci_dev +#define for_each_pci_dev (d) \ + while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) +#endif for_each_pci_dev (pdev) {struct device_node *np =pci_device_to_OF_node (pdev);if (np && np == macio->of_node) {
ppc/pmac.h renamed from ppc/pmac.h.orig +7 -0
@@ -207,4 +207,11 @@int snd_pmac_add_automute (struct snd_pmac *chip); +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,16 ) +#define of_device_is_compatible (dev, s) device_is_compatible(dev, s) +#define input_get_drvdata (dev) (dev->private) +#define i2c_smbus_write_i2c_block_data (client, cmd, len, vals) \ + i2c_smbus_write_block_data(client, cmd, len, vals) +#endif +#endif /* __PMAC_H */
memory.c renamed from memory.c.orig +3 -0
@@ -21,6 +21,9 @@#ifndef __safe#define __safe#endif +#ifndef __bitwise +#define __bitwise +#endif #endif #if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,0 )
beep.patch renamed from beep.patch.orig +17 -5
@@ -1,5 +1,5 @@ ---- ../alsa-kernel/ppc/beep.c 2007-12-20 11:47:37.000000000 +0100 -+++ beep.c 2007-12-20 12:23:31.000000000 +0100 +--- ../alsa-kernel/ppc/beep.c 2008-02-05 11:23:24.000000000 +0200 ++++ beep.c 2008-03-27 11:56:01.482564272 +0200 @@ -1,3 +1,10 @@ +#define __NO_VERSION__ +#include "adriver.h"
@@ -39,7 +39,18 @@ beep->dev = input_dev; beep->buf = dmabuf; -@@ -263,7 +281,12 @@ +@@ -256,14 +274,23 @@ + + chip->beep = beep; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15) + err = input_register_device(beep->dev); + if (err) + goto fail2; ++#else ++ input_register_device(beep->dev); ++#endif + return 0; fail2: snd_ctl_remove(chip->card, beep_ctl);
@@ -53,14 +64,15 @@ if (dmabuf) dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, dmabuf, beep->addr); -@@ -275,9 +298,15 @@ +@@ -275,9 +302,16 @@ { if (chip->beep) { input_unregister_device(chip->beep->dev); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15) + kfree(chip->beep->dev); -+#endif ++#else + input_free_device(chip->beep->dev); ++#endif dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, chip->beep->buf, chip->beep->addr); kfree(chip->beep);
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Wed, 16 Apr 2008 19:53:14 +0300,
Quoted 6 lines · Risto Suominen
From: Risto Suominen <[email protected]>
Allow to compile snd-powermac on older kernels.
Signed-off-by Risto Suominen <[email protected]>
OK, applied both patches to alsa-driver HG tree.
Thanks!
Takashi
Quoted 105 lines
---
Kernel version < 2.6.16pmac_old.c renamed from pmac_old.c.orig +6
-0@@ -997,12 +997,14 @@ static int __init snd_pmac_detect(struct chip->can_byte_swap =0 ;/* FIXME: check this */ chip->control_mask =MASK_IEPC |0x11 ;/* disable IEE */ break ; +#ifdef SND_POWERMAC_SUPPORT_TOONIE case 0x3a : chip->num_freqs =ARRAY_SIZE (tumbler_freqs); chip->model =PMAC_TOONIE ; chip->can_byte_swap =0 ;/* FIXME: check this */ chip->control_mask =MASK_IEPC |0x11 ;/* disable IEE */ break ; +#endif } } prop = (unsigned int *)get_property (sound,"device-id" ,NULL );@@ -1019,6 +1021,10 @@ static int __init snd_pmac_detect(structelse {struct pci_dev *pdev =NULL ; +#ifndef for_each_pci_dev +#define for_each_pci_dev (d) \ + while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) +#endif for_each_pci_dev (pdev) {struct device_node *np =pci_device_to_OF_node (pdev);if (np && np == macio->of_node) {ppc/pmac.h renamed from ppc/pmac.h.orig +7
-0@@ -207,4 +207,11 @@int snd_pmac_add_automute (struct snd_pmac *chip); +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,16 ) +#define of_device_is_compatible (dev, s) device_is_compatible(dev, s) +#define input_get_drvdata (dev) (dev->private) +#define i2c_smbus_write_i2c_block_data (client, cmd, len, vals) \ + i2c_smbus_write_block_data(client, cmd, len, vals) +#endif +#endif /* __PMAC_H */ memory.c renamed from memory.c.orig +3
-0@@ -21,6 +21,9 @@#ifndef __safe#define __safe#endif +#ifndef __bitwise +#define __bitwise +#endif #endif #if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,0 )beep.patch renamed from beep.patch.orig +17
-5@@ -1,5 +1,5 @@ ---- ../alsa-kernel/ppc/beep.c 2007-12-20 11:47:37.000000000 +0100 -+++ beep.c 2007-12-20 12:23:31.000000000 +0100 +--- ../alsa-kernel/ppc/beep.c 2008-02-05 11:23:24.000000000 +0200 ++++ beep.c 2008-03-27 11:56:01.482564272 +0200 @@ -1,3 +1,10 @@ +#define __NO_VERSION__ +#include "adriver.h"@@ -39,7 +39,18 @@ beep->dev = input_dev; beep->buf = dmabuf; -@@ -263,7 +281,12 @@ +@@ -256,14 +274,23 @@ + + chip->beep = beep; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15) + err = input_register_device(beep->dev); + if (err) + goto fail2; ++#else ++ input_register_device(beep->dev); ++#endif + return 0; fail2: snd_ctl_remove(chip->card, beep_ctl);@@ -53,14 +64,15 @@ if (dmabuf) dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, dmabuf, beep->addr); -@@ -275,9 +298,15 @@ +@@ -275,9 +302,16 @@ { if (chip->beep) { input_unregister_device(chip->beep->dev); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15) + kfree(chip->beep->dev); -+#endif ++#else + input_free_device(chip->beep->dev); ++#endif dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, chip->beep->buf, chip->beep->addr); kfree(chip->beep);
2008/4/16, Takashi Iwai <[email protected]>:
Quoted 2 lines
OK, applied both patches to alsa-driver HG tree.
Thanks.
But it looks like the hunk below was not accepted. Is this because it's in alsa-kernel? And it uses LINUX_VERSION_CODE? Anyway, these seem to be needed by others than snd-powermac, too. Maybe they would belong to include directory, maybe another compat.h file. I must confess that I'm not sure about the exact kernel versions where the names were changed.
ppc/pmac.h renamed from ppc/pmac.h.orig +7 -0
@@ -207,4 +207,11 @@int snd_pmac_add_automute (struct snd_pmac *chip); +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,16 ) +#define of_device_is_compatible (dev, s) device_is_compatible(dev, s) +#define input_get_drvdata (dev) (dev->private) +#define i2c_smbus_write_i2c_block_data (client, cmd, len, vals) \ + i2c_smbus_write_block_data(client, cmd, len, vals) +#endif +#endif /* __PMAC_H */
At Thu, 17 Apr 2008 10:10:06 +0300,
Quoted 9 lines · Risto Suominen
2008/4/16, Takashi Iwai <[email protected]>:
Quoted 2 lines
OK, applied both patches to alsa-driver HG tree.
Thanks.
But it looks like the hunk below was not accepted. Is this because it's in alsa-kernel?
Yes, alsa-kernel/* is independent from alsa-driver tree.
Quoted 5 lines
And it uses
LINUX_VERSION_CODE? Anyway, these
seem to be needed by others than snd-powermac, too. Maybe they would belong to include directory, maybe anothercompat.hfile. I must confess that I'm not sure about the exact kernel versions where the names were changed.
The hack isn't definitely for the latest upstream, so if this is needed, rather define in each *.c in alsa-driver/ppc please.
thanks,
Takashi
Quoted 15 lines
ppc/pmac.h renamed from ppc/pmac.h.orig +7
-0@@ -207,4 +207,11 @@int snd_pmac_add_automute (struct snd_pmac *chip); +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,16 ) +#define of_device_is_compatible (dev, s) device_is_compatible(dev, s) +#define input_get_drvdata (dev) (dev->private) +#define i2c_smbus_write_i2c_block_data (client, cmd, len, vals) \ + i2c_smbus_write_block_data(client, cmd, len, vals) +#endif +#endif /* __PMAC_H */