[PATCH v3] [resend] Enable A20 using KBC for some MSI laptops to fix S3 resume
Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to enable A20 line but resume code assumes that KBC was used. The laptop will not resume from S3 otherwise but powers off after a while and then powers on again stuck with a blank screen. Fix it by enabling A20 using KBC. Affected laptop list and DMI data are from bug reports at Ubuntu Launchpad. Also add kernel parameter to easily activate this quirk on any system. Only compile tested. The original patch was tested with EX600 and PR200. Fixes https://bugzilla.kernel.org/show_bug.cgi?id=12878 Signed-off-by: Ondrej Zary --- Documentation/kernel-parameters.txt |6 ++ arch/x86/kernel/acpi/boot.c | 122 +++ 2 files changed, 128 insertions(+), 0 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 9776f06..eb3d6a4 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -153,6 +153,12 @@ multipliers 'Kilo', 'Mega', and 'Giga', equalling 2^10, 2^20, and 2^30 bytes respectively. Such letter suffixes can also be entirely omitted. + a20_enable_kbc [ACPI,X86] + Enable A20 line using KBC even if it's already + enabled using other method. + This is needed for some MSI laptops to resume from + S3. + acpi= [HW,ACPI,X86] Advanced Configuration and Power Interface Format: { force | off | strict | noirq | rsdt } diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index e651f7a..64169ca 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -1349,6 +1349,67 @@ static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) } /* + * Copied from arch/x86/boot/a20.c. Direct port writes (and no locking) are safe + * here because this is executed very early, before any drivers (like i8042). + */ +#define MAX_8042_LOOPS 10 +#define MAX_8042_FF32 + +static int empty_8042(void) +{ + u8 status; + int loops = MAX_8042_LOOPS; + int ffs = MAX_8042_FF; + + while (loops--) { + outb(0, 0x80); /* delay */ + + status = inb(0x64); + if (status == 0xff) { + /* FF is a plausible, but very unlikely status */ + if (!--ffs) + return -1; /* Assume no KBC present */ + } + if (status & 1) { + /* Read and discard input data */ + outb(0, 0x80); /* delay */ + (void)inb(0x60); + } else if (!(status & 2)) { + /* Buffers empty, finished! */ + return 0; + } + } + + return -1; +} + +static void enable_a20_kbc(void) +{ + empty_8042(); + + outb(0xd1, 0x64); /* Command write */ + empty_8042(); + + outb(0xdf, 0x60); /* A20 on */ + empty_8042(); + + outb(0xff, 0x64); /* Null command, but UHCI wants it */ + empty_8042(); +} + +/* + * Enable A20 line using KBC even if it's already enabled using other method. + * This is needed for some MSI laptops to resume from S3. + */ +static int __init a20_enable_kbc(const struct dmi_system_id *d) +{ + printk(KERN_NOTICE "%s detected: enabling A20 using KBC\n", d->ident); + enable_a20_kbc(); + + return 0; +} + +/* * If your system is blacklisted here, but you find that acpi=force * works for you, please contact linux-a...@vger.kernel.org */ @@ -1423,6 +1484,60 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"), }, }, + /* +* Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to +* enable A20 line but resume code assumes that KBC was used. +* The laptop will not resume from S3 otherwise but powers off +* after a while and then powers on again stuck with a blank screen. +*/ + { +.callback = a20_enable_kbc, +.ident = "MSI EX600 Laptop", +.matches = { +DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), +DMI_MATCH(DMI_PRODUCT_NAME, "MSI Notebook EX600"), +}, +}, + { +.callback = a20_enable_kbc, +.ident = "MSI EX700 Laptop", +.matches = { +DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), +DMI_MATCH(DMI_PRODUCT_NAME, "EX700"), +}, +}, + { +.callback = a20_enable_kbc, +
Re: Compex FreedomLine 32 PnP-PCI2 broken with de2104x
On Saturday 26 January 2008 21:58:10 Ondrej Zary wrote: > Hello, > I was having problems with these FreedomLine cards with Linux before but > tested it thoroughly today. This card uses DEC 21041 chip and has TP and > BNC connectors: > > 00:12.0 Ethernet controller [0200]: Digital Equipment Corporation DECchip > 21041 [Tulip Pass 3] [1011:0014] (rev 21) > > > de2104x driver was loaded automatically by udev and card seemed to work. > Until I disconnected the TP cable and putting it back after a while. The > driver then switched to (non-existing) AUI port and remained there. I tried > to set media to TP using ethtool - and the whole kernel crashed because of > BUG_ON(de_is_running(de)); > in de_set_media(). Seems that the driver is unable to stop the DMA in > de_stop_rxtx(). > > I commented out AUI detection in the driver - this time it switched to BNC > after unplugging the cable and remained there. I also attempted to reset > the chip when de_stop_rxtx failed but failed to do it. > > Then I found that there's de4x5 driver which supports the same cards as > de2104x (and some other too) - and this one works fine! I can plug and > unplug the cable and even change between TP and BNC ports just by > unplugging one and plugging the other cable in. Unfortunately, this driver > is blacklisted by default - at least in Slackware and Debian. > > The question is: why does de2104x exist? Does it work better with some > hardware? > > BTW. Found that the problem exist at least since 2003: > http://oss.sgi.com/archives/netdev/2003-08/msg00951.html Does the de2104x driver work correctly for anyone? -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [RFC] 3c509: convert to isa_driver and pnp_driver
1, -1, -1, -1}; -static int xcvr[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; +static int xcvr[] = {-1, -1, -1, -1, -1, -1, -1, -1}; module_param(debug,int, 0); module_param_array(irq, int, NULL, 0); @@ -1515,61 +1543,87 @@ MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); MODULE_PARM_DESC(xcvr,"transceiver(s) (0=internal, 1=external)"); MODULE_PARM_DESC(max_interrupt_work, "maximum events handled per interrupt"); -#if defined(__ISAPNP__) +#ifdef CONFIG_PNP module_param(nopnp, int, 0); MODULE_PARM_DESC(nopnp, "disable ISA PnP support (0-1)"); -MODULE_DEVICE_TABLE(isapnp, el3_isapnp_adapters); -#endif /* __ISAPNP__ */ -MODULE_DESCRIPTION("3Com Etherlink III (3c509, 3c509B) ISA/PnP ethernet driver"); +#endif /* CONFIG_PNP */ +MODULE_DESCRIPTION("3Com Etherlink III (3c509, 3c509B) ethernet driver"); MODULE_LICENSE("GPL"); static int __init el3_init_module(void) { int ret = 0; - el3_cards = 0; if (debug >= 0) el3_debug = debug; - el3_root_dev = NULL; - while (el3_probe(el3_cards) == 0) { - if (irq[el3_cards] > 1) - el3_root_dev->irq = irq[el3_cards]; - if (xcvr[el3_cards] >= 0) - el3_root_dev->if_port = xcvr[el3_cards]; - el3_cards++; +// while (el3_probe(el3_cards) == 0) { +// if (irq[el3_cards] > 1) +// el3_root_dev->irq = irq[el3_cards]; +// if (xcvr[el3_cards] >= 0) +// el3_root_dev->if_port = xcvr[el3_cards]; +// el3_cards++; +// } + +#ifdef CONFIG_PNP + if (!nopnp) { + ret = pnp_register_driver(&el3_pnp_driver); + if (!ret) + pnp_registered = 1; } - +#endif + ret = isa_register_driver(&el3_isa_driver, EL3_MAX_CARDS); + if (!ret) + isa_registered = 1; #ifdef CONFIG_EISA ret = eisa_driver_register(&el3_eisa_driver); + if (!ret) + eisa_registeted = 1; #endif #ifdef CONFIG_MCA - { - int err = mca_register_driver(&el3_mca_driver); - if (ret == 0) - ret = err; - } + ret = mca_register_driver(&el3_mca_driver); + if (!ret) + mca_registered = 1; +#endif + +#ifdef CONFIG_PNP + if (pnp_registered) + ret = 0; +#endif + if (isa_registered) + ret = 0; +#ifdef CONFIG_EISA + if (eisa_registered) + ret = 0; #endif +#ifdef CONFIG_MCA + if (mca_registered) + ret = 0; +#endif + printk("el3_cards=%d\n", el3_cards); return ret; } static void __exit el3_cleanup_module(void) { - struct net_device *next_dev; - - while (el3_root_dev) { - struct el3_private *lp = netdev_priv(el3_root_dev); - - next_dev = lp->next_dev; - el3_common_remove (el3_root_dev); - el3_root_dev = next_dev; - } - + int i; + +// for (i = 0; i < el3_cards; i++) +// el3_common_remove(el3_devs[i]); + +#ifdef CONFIG_PNP + if (pnp_registered) + pnp_unregister_driver(&el3_pnp_driver); +#endif + if (isa_registered) + isa_unregister_driver(&el3_isa_driver); #ifdef CONFIG_EISA - eisa_driver_unregister (&el3_eisa_driver); + if (eisa_registered) + eisa_driver_unregister (&el3_eisa_driver); #endif #ifdef CONFIG_MCA - mca_unregister_driver(&el3_mca_driver); + if (mca_registered) + mca_unregister_driver(&el3_mca_driver); #endif } -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [RFC] 3c509: convert to isa_driver and pnp_driver v2
el3_common_remove (dev); return 0; } -#endif +//#endif /* Read a word from the EEPROM using the regular EEPROM access register. Assume that we are in register window zero. @@ -1450,7 +1491,7 @@ } /* Power Management support functions */ -#ifdef EL3_SUSPEND +#ifdef CONFIG_PM static int el3_suspend(struct device *pdev, pm_message_t state) @@ -1500,12 +1541,12 @@ return 0; } -#endif /* EL3_SUSPEND */ +#endif /* CONFIG_PM */ /* Parameters that may be passed into the module. */ static int debug = -1; static int irq[] = {-1, -1, -1, -1, -1, -1, -1, -1}; -static int xcvr[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; +static int xcvr[] = {-1, -1, -1, -1, -1, -1, -1, -1}; module_param(debug,int, 0); module_param_array(irq, int, NULL, 0); @@ -1515,64 +1556,85 @@ MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); MODULE_PARM_DESC(xcvr,"transceiver(s) (0=internal, 1=external)"); MODULE_PARM_DESC(max_interrupt_work, "maximum events handled per interrupt"); -#if defined(__ISAPNP__) +#ifdef CONFIG_PNP module_param(nopnp, int, 0); MODULE_PARM_DESC(nopnp, "disable ISA PnP support (0-1)"); -MODULE_DEVICE_TABLE(isapnp, el3_isapnp_adapters); -#endif /* __ISAPNP__ */ -MODULE_DESCRIPTION("3Com Etherlink III (3c509, 3c509B) ISA/PnP ethernet driver"); +#endif /* CONFIG_PNP */ +MODULE_DESCRIPTION("3Com Etherlink III (3c509, 3c509B) ethernet driver"); MODULE_LICENSE("GPL"); static int __init el3_init_module(void) { int ret = 0; - el3_cards = 0; if (debug >= 0) el3_debug = debug; - el3_root_dev = NULL; - while (el3_probe(el3_cards) == 0) { - if (irq[el3_cards] > 1) - el3_root_dev->irq = irq[el3_cards]; - if (xcvr[el3_cards] >= 0) - el3_root_dev->if_port = xcvr[el3_cards]; - el3_cards++; +// while (el3_probe(el3_cards) == 0) { +// if (irq[el3_cards] > 1) +// el3_root_dev->irq = irq[el3_cards]; +// if (xcvr[el3_cards] >= 0) +// el3_root_dev->if_port = xcvr[el3_cards]; +// el3_cards++; +// } + +#ifdef CONFIG_PNP + if (!nopnp) { + ret = pnp_register_driver(&el3_pnp_driver); + if (!ret) + pnp_registered = 1; } - +#endif + ret = isa_register_driver(&el3_isa_driver, EL3_MAX_CARDS); + if (!ret) + isa_registered = 1; #ifdef CONFIG_EISA ret = eisa_driver_register(&el3_eisa_driver); + if (!ret) + eisa_registeted = 1; #endif #ifdef CONFIG_MCA - { - int err = mca_register_driver(&el3_mca_driver); - if (ret == 0) - ret = err; - } + ret = mca_register_driver(&el3_mca_driver); + if (!ret) + mca_registered = 1; +#endif + +#ifdef CONFIG_PNP + if (pnp_registered) + ret = 0; +#endif + if (isa_registered) + ret = 0; +#ifdef CONFIG_EISA + if (eisa_registered) + ret = 0; +#endif +#ifdef CONFIG_MCA + if (mca_registered) + ret = 0; #endif return ret; } static void __exit el3_cleanup_module(void) { - struct net_device *next_dev; - - while (el3_root_dev) { - struct el3_private *lp = netdev_priv(el3_root_dev); - - next_dev = lp->next_dev; - el3_common_remove (el3_root_dev); - el3_root_dev = next_dev; - } - +#ifdef CONFIG_PNP + if (pnp_registered) + pnp_unregister_driver(&el3_pnp_driver); +#endif + if (isa_registered) + isa_unregister_driver(&el3_isa_driver); + if (id_port) + release_region(id_port, 1); #ifdef CONFIG_EISA - eisa_driver_unregister (&el3_eisa_driver); + if (eisa_registered) + eisa_driver_unregister (&el3_eisa_driver); #endif #ifdef CONFIG_MCA - mca_unregister_driver(&el3_mca_driver); + if (mca_registered) + mca_unregister_driver(&el3_mca_driver); #endif } module_init (el3_init_module); module_exit (el3_cleanup_module); - -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [RFC] 3c509: convert to isa_driver and pnp_driver v2
On Saturday 02 February 2008 21:50:25 Jeff Garzik wrote: > Ondrej Zary wrote: > > Hello, > > this is second version of the patch. Autoloading using udev works fine > > with PnP card. Hibernation now works both in PnP and ISA modes. The I/O > > address used for non-pnp ISA card detection is now not released as it's > > needed to wake up the card. > > > > Manual irq and transceiver settings aren't implemented yet. Operation > > with multiple cards is not tested - I'll try 3 cards in both PnP and ISA > > modes. There is some code that is the same in each of the 4 probe > > functions (isa, pnp, eisa and mca), which should be probably separated > > into a function. > > > > I have no EISA or MCA machine so I hope that I didn't break them. > > Looks pretty good at first glance... > > I'll throw it in my queue. Want to add a signed-off-by: ? > > Jeff I think that the ISA resume will not work with more than 1 card. I'll fix that first and test with 3 cards. So the next version can include signed-off-by. I also wonder about the old el3_cleanup_module() function - it called el3_common_remove for all cards. With isa_driver and pnp_driver, it oopsed - I think that's because the remove() functions were called by driver core on isa_unregister_driver (and pnp_unregister_driver) - but what about MCA and EISA? -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [RFC] 3c509: convert to isa_driver and pnp_driver v2
On Saturday 02 February 2008 22:07:20 Pekka Enberg wrote: > Hi, > > On Feb 2, 2008 8:25 PM, Ondrej Zary <[EMAIL PROTECTED]> wrote: > > +//static __be16 el3_phys_addr[EL3_MAX_CARDS][3]; > > [snip] > > > +//#if defined(CONFIG_MCA) || defined(CONFIG_EISA) > > [snip] > > > +// while (el3_probe(el3_cards) == 0) { > > +// if (irq[el3_cards] > 1) > > +// el3_root_dev->irq = irq[el3_cards]; > > +// if (xcvr[el3_cards] >= 0) > > +// el3_root_dev->if_port = xcvr[el3_cards]; > > +// el3_cards++; > > +// } > > You might want to consider dropping these hunks... Yes, they're going away. The last one is there just as a reminder that the irq and xcvr parameters should be used in the ISA code. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [RFC] 3c509: convert to isa_driver and pnp_driver v3
Hello, this patch converts 3c509 driver to isa_driver and pnp_driver. The result is that autoloading using udev and hibernation works with ISA PnP cards. It also adds hibernation support for non-PnP ISA cards. xcvr module parameter was removed as its value was not used. Tested using 3 ISA cards in various combinations of PnP and non-PnP modes. Signed-off-by: Ondrej Zary <[EMAIL PROTECTED]> --- linux-2.6.24-orig/drivers/net/3c509.c 2008-01-27 19:48:19.0 +0100 +++ linux-2.6.24-pentium/drivers/net/3c509.c2008-02-04 22:30:37.0 +0100 @@ -54,25 +54,24 @@ v1.19a 28Oct2002 Davud Ruggiero <[EMAIL PROTECTED]> - Increase *read_eeprom udelay to workaround oops with 2 cards. v1.19b 08Nov2002 Marc Zyngier <[EMAIL PROTECTED]> - - Introduce driver model for EISA cards. + - Introduce driver model for EISA cards. + v1.20 04Feb2008 Ondrej Zary <[EMAIL PROTECTED]> + - convert to isa_driver and pnp_driver and some cleanups */ #define DRV_NAME "3c509" -#define DRV_VERSION"1.19b" -#define DRV_RELDATE"08Nov2002" +#define DRV_VERSION"1.20" +#define DRV_RELDATE"04Feb2008" /* A few values that may be tweaked. */ /* Time in jiffies before concluding the transmitter is hung. */ #define TX_TIMEOUT (400*HZ/1000) -/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ -static int max_interrupt_work = 10; #include -#ifdef CONFIG_MCA #include -#endif -#include +#include +#include #include #include #include @@ -97,10 +96,6 @@ static char version[] __initdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " [EMAIL PROTECTED]"; -#if defined(CONFIG_PM) && (defined(CONFIG_MCA) || defined(CONFIG_EISA)) -#define EL3_SUSPEND -#endif - #ifdef EL3_DEBUG static int el3_debug = EL3_DEBUG; #else @@ -111,6 +106,7 @@ * a global variable so that the mca/eisa probe routines can increment * it */ static int el3_cards = 0; +#define EL3_MAX_CARDS 8 /* To minimize the size of the driver source I only define operating constants if they are used several times. You'll need the manual @@ -119,7 +115,7 @@ #define EL3_DATA 0x00 #define EL3_CMD 0x0e #define EL3_STATUS 0x0e -#define EEPROM_READ 0x80 +#defineEEPROM_READ 0x80 #define EL3_IO_EXTENT 16 @@ -168,23 +164,31 @@ */ #define SKB_QUEUE_SIZE 64 +typedef enum { EL3_ISA, EL3_PNP, EL3_MCA, EL3_EISA } el3_cardtype; + struct el3_private { struct net_device_stats stats; - struct net_device *next_dev; spinlock_t lock; /* skb send-queue */ int head, size; struct sk_buff *queue[SKB_QUEUE_SIZE]; - enum { - EL3_MCA, - EL3_PNP, - EL3_EISA, - } type; /* type of device */ - struct device *dev; + el3_cardtype type; }; -static int id_port __initdata = 0x110; /* Start with 0x110 to avoid new sound cards.*/ -static struct net_device *el3_root_dev; +static int id_port; +static int current_tag; +static struct net_device *el3_devs[EL3_MAX_CARDS]; + +/* Parameters that may be passed into the module. */ +static int debug = -1; +static int irq[] = {-1, -1, -1, -1, -1, -1, -1, -1}; +/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ +static int max_interrupt_work = 10; +#ifdef CONFIG_PNP +static int nopnp; +#endif +static int __init el3_common_init(struct net_device *dev); +static void el3_common_remove (struct net_device *dev); static ushort id_read_eeprom(int index); static ushort read_eeprom(int ioaddr, int index); static int el3_open(struct net_device *dev); @@ -199,23 +203,277 @@ static void el3_down(struct net_device *dev); static void el3_up(struct net_device *dev); static const struct ethtool_ops ethtool_ops; -#ifdef EL3_SUSPEND +#ifdef CONFIG_PM static int el3_suspend(struct device *, pm_message_t); static int el3_resume(struct device *); -#else -#define el3_suspend NULL -#define el3_resume NULL #endif /* generic device remove for all device types */ -#if defined(CONFIG_EISA) || defined(CONFIG_MCA) static int el3_device_remove (struct device *device); -#endif #ifdef CONFIG_NET_POLL_CONTROLLER static void el3_poll_controller(struct net_device *dev); #endif +/* Return 0 on success, 1 on error, 2 when found already detected PnP card */ +static int el3_isa_id_sequence(__be16 *phys_addr) +{ + short lrs_state = 0xff; + int i; + + /* ISA boards are detected by sending the ID sequence to the + ID_PORT. We find cards past the first by setting the 'current_tag' + on cards as they are found. Cards with their tag set will not + respond to subsequent ID sequences. */ + + outb(0x00, id_port); +
Re: [PATCH -next] sound: ice1712 build errors
On Tuesday 23 October 2012 19:34:16 Randy Dunlap wrote: > From: Randy Dunlap > > Fix build errors by using correct kconfig symbol name: > > sound/pci/ice1712/psc724.c:417:5: error: 'struct snd_ice1712' has no member > named 'pm_resume' sound/pci/ice1712/psc724.c:418:5: error: 'struct > snd_ice1712' has no member named 'pm_suspend_enabled' Thanks, I tried to test with CONFIG_PM disabled but was unable to disable it. Probably because of some CONFIG_PM and CONFIG_PM_SLEEP changes I missed... > Signed-off-by: Randy Dunlap > Cc: Ondrej Zary > Cc: Jaroslav Kysela > Cc: Takashi Iwai > Cc: alsa-de...@alsa-project.org > --- > sound/pci/ice1712/psc724.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > --- linux-next-20121023.orig/sound/pci/ice1712/psc724.c > +++ linux-next-20121023/sound/pci/ice1712/psc724.c > @@ -413,7 +413,7 @@ static int __devinit psc724_init(struct > snd_wm8776_init(&spec->wm8776); > spec->wm8766.ops.write = psc724_wm8766_write; > spec->wm8766.card = ice->card; > -#ifdef CONFIG_PM > +#ifdef CONFIG_PM_SLEEP > ice->pm_resume = psc724_resume; > ice->pm_suspend_enabled = 1; > #endif -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Enable A20 using KBC for some MSI laptops to fix S3 resume
Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to enable A20 line but resume code assumes that KBC was used. The laptop will not resume from S3 otherwise but powers off after a while and then powers on again stuck with a blank screen. Fix it by enabling A20 using KBC. Affected laptop list and DMI data are from bug reports at Ubuntu Launchpad. Tested with EX600 and PR200. Fixes https://bugzilla.kernel.org/show_bug.cgi?id=12878 Signed-off-by: Ondrej Zary --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -1349,6 +1349,20 @@ static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) } /* + * Enable A20 line using KBC even if it's already enabled using other method. + * This is needed for some MSI laptops to resume from S3. + */ +static int __init a20_enable_kbc(const struct dmi_system_id *d) +{ + printk(KERN_NOTICE "%s detected: enabling A20 using KBC\n", d->ident); + outb(0xd1, 0x64); /* Command write */ + outb(0xdf, 0x60); /* A20 on */ + outb(0xff, 0x64); /* Null command, but UHCI wants it */ + + return 0; +} + +/* * If your system is blacklisted here, but you find that acpi=force * works for you, please contact linux-a...@vger.kernel.org */ @@ -1423,6 +1437,60 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"), }, }, + /* +* Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to +* enable A20 line but resume code assumes that KBC was used. +* The laptop will not resume from S3 otherwise but powers off +* after a while and then powers on again stuck with a blank screen. +*/ + { +.callback = a20_enable_kbc, +.ident = "MSI EX600 Laptop", +.matches = { +DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), +DMI_MATCH(DMI_PRODUCT_NAME, "MSI Notebook EX600"), +}, +}, + { +.callback = a20_enable_kbc, +.ident = "MSI EX700 Laptop", +.matches = { +DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), +DMI_MATCH(DMI_PRODUCT_NAME, "EX700"), +}, +}, + { +.callback = a20_enable_kbc, +.ident = "MSI GX700 Laptop", +.matches = { +DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), +DMI_MATCH(DMI_PRODUCT_NAME, "GX700"), +}, +}, + { +.callback = a20_enable_kbc, +.ident = "MSI VR201 Laptop", +.matches = { +DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), +DMI_MATCH(DMI_PRODUCT_NAME, "MSI Notebook VR201"), +}, +}, + { +.callback = a20_enable_kbc, +.ident = "MSI VR601 Laptop", +.matches = { +DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), +DMI_MATCH(DMI_PRODUCT_NAME, "MSI Notebook VR601"), +}, +}, + { +.callback = a20_enable_kbc, +.ident = "MSI PR200 Laptop", +.matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), +DMI_MATCH(DMI_PRODUCT_NAME, "MSI Notebook PR200"), +}, +}, {} }; -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Enable A20 using KBC for some MSI laptops to fix S3 resume
On Wednesday 24 October 2012 21:36:04 H. Peter Anvin wrote: > Minor concern: it should do the wait for ready before sending each command. It was a hack and then I forgot to add the waits... Should I redo the patch? I'll not be able to test it as I have to return the machine. > "Rafael J. Wysocki" wrote: > >On Wednesday 24 of October 2012 08:47:52 Ondrej Zary wrote: > >> Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to > > > >enable A20 > > > >> line but resume code assumes that KBC was used. > >> The laptop will not resume from S3 otherwise but powers off after a > > > >while > > > >> and then powers on again stuck with a blank screen. > >> > >> Fix it by enabling A20 using KBC. Affected laptop list and DMI data > > > >are from > > > >> bug reports at Ubuntu Launchpad. > >> > >> Tested with EX600 and PR200. > >> > >> Fixes https://bugzilla.kernel.org/show_bug.cgi?id=12878 > >> > >> Signed-off-by: Ondrej Zary > > > >Acked-by: Rafael J. Wysocki > > > >> --- a/arch/x86/kernel/acpi/boot.c > >> +++ b/arch/x86/kernel/acpi/boot.c > >> @@ -1349,6 +1349,20 @@ static int __init > > > >dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) > > > >> } > >> > >> /* > >> + * Enable A20 line using KBC even if it's already enabled using > > > >other method. > > > >> + * This is needed for some MSI laptops to resume from S3. > >> + */ > >> +static int __init a20_enable_kbc(const struct dmi_system_id *d) > >> +{ > >> + printk(KERN_NOTICE "%s detected: enabling A20 using KBC\n", > > > >d->ident); > > > >> + outb(0xd1, 0x64); /* Command write */ > >> + outb(0xdf, 0x60); /* A20 on */ > >> + outb(0xff, 0x64); /* Null command, but UHCI wants it */ > >> + > >> + return 0; > >> +} > >> + > >> +/* > >> * If your system is blacklisted here, but you find that acpi=force > >> * works for you, please contact linux-a...@vger.kernel.org > >> */ > >> @@ -1423,6 +1437,60 @@ static struct dmi_system_id __initdata > > > >acpi_dmi_table[] = { > > > >> DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"), > >> }, > >> }, > >> + /* > >> + * Some MSI laptop BIOSes are broken - INT 15h code uses port 92h > > > >to > > > >> + * enable A20 line but resume code assumes that KBC was used. > >> + * The laptop will not resume from S3 otherwise but powers off > >> + * after a while and then powers on again stuck with a blank > > > >screen. > > > >> + */ > >> + { > >> + .callback = a20_enable_kbc, > >> + .ident = "MSI EX600 Laptop", > >> + .matches = { > >> + DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), > >> + DMI_MATCH(DMI_PRODUCT_NAME, "MSI Notebook EX600"), > >> + }, > >> + }, > >> + { > >> + .callback = a20_enable_kbc, > >> + .ident = "MSI EX700 Laptop", > >> + .matches = { > >> + DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), > >> + DMI_MATCH(DMI_PRODUCT_NAME, "EX700"), > >> + }, > >> + }, > >> + { > >> + .callback = a20_enable_kbc, > >> + .ident = "MSI GX700 Laptop", > >> + .matches = { > >> + DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), > >> + DMI_MATCH(DMI_PRODUCT_NAME, "GX700"), > >> + }, > >> + }, > >> + { > >> + .callback = a20_enable_kbc, > >> + .ident = "MSI VR201 Laptop", > >> + .matches = { > >> + DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), > >> + DMI_MATCH(DMI_PRODUCT_NAME, "MSI Notebook VR201"), > >> + }, > >> + }, > >> + { > >> + .callback = a20_enable_kbc, > >> + .ident = "MSI VR601 Laptop", > >> + .matches = { > >> + DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), > >> + DMI_MATCH(DMI_PRODUCT_NAME, "MSI Notebook VR601"), > >> + }, > >> + }, > >> + { > >> + .callback = a20_enable_kbc, > >> + .ident = "MSI PR200 Laptop", > >> + .matches = { > >> + DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), > >> + DMI_MATCH(DMI_PRODUCT_NAME, "MSI Notebook PR200"), > >> + }, > >> + }, > >>{} > >> }; -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] Enable A20 using KBC for some MSI laptops to fix S3 resume
On Wednesday 24 October 2012, H. Peter Anvin wrote: > On 10/24/2012 02:16 PM, Ondrej Zary wrote: > > Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to enable > > A20 line but resume code assumes that KBC was used. > > The laptop will not resume from S3 otherwise but powers off after a while > > and then powers on again stuck with a blank screen. > > > > Fix it by enabling A20 using KBC. Affected laptop list and DMI data are > > from bug reports at Ubuntu Launchpad. > > > > Also add kernel parameter to easily activate this quirk on any system. > > > > Only compile tested. The original patch was tested with EX600 and PR200. > > > > Fixes https://bugzilla.kernel.org/show_bug.cgi?id=12878 > > Are we guaranteed that this executes *before* the keyboard driver > initializes? If not, this needs to use the i8042 interface in the input > subsystem or at least acquire i8042_lock. > > -hpa The code is called in: start_kernel()->setup_arch()->acpi_boot_table_init() I think that it's before any drivers are initialized. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Enable A20 using KBC for some MSI laptops to fix S3 resume
On Friday 26 October 2012, H. Peter Anvin wrote: > My guess is that Windows explicitly enables A20 on resume. We should do > that too, really... with the current heavily unified realmode code it > should be easy - let me hack up a patch in the morning. Neither s3_beep nor s3_leds (this patch: https://lists.ubuntu.com/archives/kernel-team/2011-May/015621.html ) worked for me so I thing that BIOS breaks on resume before we can do anything. > Robert Hancock wrote: > >On 10/24/2012 02:09 PM, Alan Cox wrote: > >> On Wed, 24 Oct 2012 12:36:04 -0700 > >> > >> "H. Peter Anvin" wrote: > >>> Minor concern: it should do the wait for ready before sending each > > > >command. > > > >> Can we get a command line to do this quirk too - it strikes me that > > > >if > > > >> the MSIs rely upon it then it may be something Windows always does so > >> will be useful to try on other problem machines as an experiment. > > > >I agree, one has to keep in mind the age-old question "how does Windows > > > >work?" since it surely has no such quirk. I'd say we're sometimes too > >quick to add these DMI quirks when a more general solution would be > >somehow figure out how the Linux behavior differs from what Windows is > >doing. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3] Enable A20 using KBC for some MSI laptops to fix S3 resume
Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to enable A20 line but resume code assumes that KBC was used. The laptop will not resume from S3 otherwise but powers off after a while and then powers on again stuck with a blank screen. Fix it by enabling A20 using KBC. Affected laptop list and DMI data are from bug reports at Ubuntu Launchpad. Also add kernel parameter to easily activate this quirk on any system. Only compile tested. The original patch was tested with EX600 and PR200. Fixes https://bugzilla.kernel.org/show_bug.cgi?id=12878 Signed-off-by: Ondrej Zary --- Documentation/kernel-parameters.txt |6 ++ arch/x86/kernel/acpi/boot.c | 122 +++ 2 files changed, 128 insertions(+), 0 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 9776f06..eb3d6a4 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -153,6 +153,12 @@ multipliers 'Kilo', 'Mega', and 'Giga', equalling 2^10, 2^20, and 2^30 bytes respectively. Such letter suffixes can also be entirely omitted. + a20_enable_kbc [ACPI,X86] + Enable A20 line using KBC even if it's already + enabled using other method. + This is needed for some MSI laptops to resume from + S3. + acpi= [HW,ACPI,X86] Advanced Configuration and Power Interface Format: { force | off | strict | noirq | rsdt } diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index e651f7a..64169ca 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -1349,6 +1349,67 @@ static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) } /* + * Copied from arch/x86/boot/a20.c. Direct port writes (and no locking) are safe + * here because this is executed very early, before any drivers (like i8042). + */ +#define MAX_8042_LOOPS 10 +#define MAX_8042_FF32 + +static int empty_8042(void) +{ + u8 status; + int loops = MAX_8042_LOOPS; + int ffs = MAX_8042_FF; + + while (loops--) { + outb(0, 0x80); /* delay */ + + status = inb(0x64); + if (status == 0xff) { + /* FF is a plausible, but very unlikely status */ + if (!--ffs) + return -1; /* Assume no KBC present */ + } + if (status & 1) { + /* Read and discard input data */ + outb(0, 0x80); /* delay */ + (void)inb(0x60); + } else if (!(status & 2)) { + /* Buffers empty, finished! */ + return 0; + } + } + + return -1; +} + +static void enable_a20_kbc(void) +{ + empty_8042(); + + outb(0xd1, 0x64); /* Command write */ + empty_8042(); + + outb(0xdf, 0x60); /* A20 on */ + empty_8042(); + + outb(0xff, 0x64); /* Null command, but UHCI wants it */ + empty_8042(); +} + +/* + * Enable A20 line using KBC even if it's already enabled using other method. + * This is needed for some MSI laptops to resume from S3. + */ +static int __init a20_enable_kbc(const struct dmi_system_id *d) +{ + printk(KERN_NOTICE "%s detected: enabling A20 using KBC\n", d->ident); + enable_a20_kbc(); + + return 0; +} + +/* * If your system is blacklisted here, but you find that acpi=force * works for you, please contact linux-a...@vger.kernel.org */ @@ -1423,6 +1484,60 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"), }, }, + /* +* Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to +* enable A20 line but resume code assumes that KBC was used. +* The laptop will not resume from S3 otherwise but powers off +* after a while and then powers on again stuck with a blank screen. +*/ + { +.callback = a20_enable_kbc, +.ident = "MSI EX600 Laptop", +.matches = { +DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), +DMI_MATCH(DMI_PRODUCT_NAME, "MSI Notebook EX600"), +}, +}, + { +.callback = a20_enable_kbc, +.ident = "MSI EX700 Laptop", +.matches = { +DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), +DMI_MATCH(DMI_PRODUCT_NAME, "EX700"), +}, +}, + { +.callback = a20_enable_kbc, +
[PATCH] [resend] 3c509: convert to isa_driver and pnp_driver v5
Hello, this patch converts 3c509 driver to isa_driver and pnp_driver. The result is that autoloading using udev and hibernation works with ISA PnP cards. It also adds hibernation support for non-PnP ISA cards. xcvr module parameter was removed as its value was not used. Tested using 3 ISA cards in various combinations of PnP and non-PnP modes. EISA and MCA only compile-tested. Signed-off-by: Ondrej Zary <[EMAIL PROTECTED]> --- linux-2.6.24-orig/drivers/net/3c509.c 2008-01-27 19:48:19.0 +0100 +++ linux-2.6.24-pentium/drivers/net/3c509.c2008-02-10 21:52:04.0 +0100 @@ -54,25 +54,24 @@ v1.19a 28Oct2002 Davud Ruggiero <[EMAIL PROTECTED]> - Increase *read_eeprom udelay to workaround oops with 2 cards. v1.19b 08Nov2002 Marc Zyngier <[EMAIL PROTECTED]> - - Introduce driver model for EISA cards. + - Introduce driver model for EISA cards. + v1.20 04Feb2008 Ondrej Zary <[EMAIL PROTECTED]> + - convert to isa_driver and pnp_driver and some cleanups */ #define DRV_NAME "3c509" -#define DRV_VERSION"1.19b" -#define DRV_RELDATE"08Nov2002" +#define DRV_VERSION"1.20" +#define DRV_RELDATE"04Feb2008" /* A few values that may be tweaked. */ /* Time in jiffies before concluding the transmitter is hung. */ #define TX_TIMEOUT (400*HZ/1000) -/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ -static int max_interrupt_work = 10; #include -#ifdef CONFIG_MCA #include -#endif -#include +#include +#include #include #include #include @@ -97,10 +96,6 @@ static char version[] __initdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " [EMAIL PROTECTED]"; -#if defined(CONFIG_PM) && (defined(CONFIG_MCA) || defined(CONFIG_EISA)) -#define EL3_SUSPEND -#endif - #ifdef EL3_DEBUG static int el3_debug = EL3_DEBUG; #else @@ -111,6 +106,7 @@ * a global variable so that the mca/eisa probe routines can increment * it */ static int el3_cards = 0; +#define EL3_MAX_CARDS 8 /* To minimize the size of the driver source I only define operating constants if they are used several times. You'll need the manual @@ -119,7 +115,7 @@ #define EL3_DATA 0x00 #define EL3_CMD 0x0e #define EL3_STATUS 0x0e -#define EEPROM_READ 0x80 +#defineEEPROM_READ 0x80 #define EL3_IO_EXTENT 16 @@ -168,23 +164,31 @@ */ #define SKB_QUEUE_SIZE 64 +enum el3_cardtype { EL3_ISA, EL3_PNP, EL3_MCA, EL3_EISA }; + struct el3_private { struct net_device_stats stats; - struct net_device *next_dev; spinlock_t lock; /* skb send-queue */ int head, size; struct sk_buff *queue[SKB_QUEUE_SIZE]; - enum { - EL3_MCA, - EL3_PNP, - EL3_EISA, - } type; /* type of device */ - struct device *dev; + enum el3_cardtype type; }; -static int id_port __initdata = 0x110; /* Start with 0x110 to avoid new sound cards.*/ -static struct net_device *el3_root_dev; +static int id_port; +static int current_tag; +static struct net_device *el3_devs[EL3_MAX_CARDS]; + +/* Parameters that may be passed into the module. */ +static int debug = -1; +static int irq[] = {-1, -1, -1, -1, -1, -1, -1, -1}; +/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ +static int max_interrupt_work = 10; +#ifdef CONFIG_PNP +static int nopnp; +#endif +static int __init el3_common_init(struct net_device *dev); +static void el3_common_remove(struct net_device *dev); static ushort id_read_eeprom(int index); static ushort read_eeprom(int ioaddr, int index); static int el3_open(struct net_device *dev); @@ -199,23 +203,279 @@ static void el3_down(struct net_device *dev); static void el3_up(struct net_device *dev); static const struct ethtool_ops ethtool_ops; -#ifdef EL3_SUSPEND +#ifdef CONFIG_PM static int el3_suspend(struct device *, pm_message_t); static int el3_resume(struct device *); -#else -#define el3_suspend NULL -#define el3_resume NULL #endif /* generic device remove for all device types */ -#if defined(CONFIG_EISA) || defined(CONFIG_MCA) static int el3_device_remove (struct device *device); -#endif #ifdef CONFIG_NET_POLL_CONTROLLER static void el3_poll_controller(struct net_device *dev); #endif +/* Return 0 on success, 1 on error, 2 when found already detected PnP card */ +static int el3_isa_id_sequence(__be16 *phys_addr) +{ + short lrs_state = 0xff; + int i; + + /* ISA boards are detected by sending the ID sequence to the + ID_PORT. We find cards past the first by setting the 'current_tag' + on cards as they are found. Cards with their tag set will not + respond to subsequent ID sequences. */
[PATCH] snd-es1968: remove pm_whitelist
pm_whitelist breaks suspend on all non-whitelisted cards for unknown purpose. Remove it. This fixes suspend on Terratec DMX and SF64-PCE2 cards. Signed-off-by: Ondrej Zary --- sound/pci/es1968.c | 40 1 files changed, 0 insertions(+), 40 deletions(-) diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 5d0e568..a9c92a4 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -137,7 +137,6 @@ static int total_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1024 }; static int pcm_substreams_p[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4 }; static int pcm_substreams_c[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1 }; static int clock[SNDRV_CARDS]; -static int use_pm[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; static int enable_mpu[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; #ifdef SUPPORT_JOYSTICK static bool joystick[SNDRV_CARDS]; @@ -158,8 +157,6 @@ module_param_array(pcm_substreams_c, int, NULL, 0444); MODULE_PARM_DESC(pcm_substreams_c, "PCM Capture substreams for " CARD_NAME " soundcard."); module_param_array(clock, int, NULL, 0444); MODULE_PARM_DESC(clock, "Clock on " CARD_NAME " soundcard. (0 = auto-detect)"); -module_param_array(use_pm, int, NULL, 0444); -MODULE_PARM_DESC(use_pm, "Toggle power-management. (0 = off, 1 = on, 2 = auto)"); module_param_array(enable_mpu, int, NULL, 0444); MODULE_PARM_DESC(enable_mpu, "Enable MPU401. (0 = off, 1 = on, 2 = auto)"); #ifdef SUPPORT_JOYSTICK @@ -519,7 +516,6 @@ struct es1968 { struct pci_dev *pci; struct snd_card *card; struct snd_pcm *pcm; - int do_pm; /* power-management enabled */ /* DMA memory block */ struct list_head buf_list; @@ -2387,9 +2383,6 @@ static int es1968_suspend(struct device *dev) struct snd_card *card = dev_get_drvdata(dev); struct es1968 *chip = card->private_data; - if (! chip->do_pm) - return 0; - chip->in_suspend = 1; cancel_work_sync(&chip->hwvol_work); snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); @@ -2410,9 +2403,6 @@ static int es1968_resume(struct device *dev) struct es1968 *chip = card->private_data; struct esschan *es; - if (! chip->do_pm) - return 0; - /* restore all our config */ pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); @@ -2648,15 +2638,6 @@ struct ess_device_list { unsigned short vendor; /* subsystem vendor id */ }; -static struct ess_device_list pm_whitelist[] __devinitdata = { - { TYPE_MAESTRO2E, 0x0e11 }, /* Compaq Armada */ - { TYPE_MAESTRO2E, 0x1028 }, - { TYPE_MAESTRO2E, 0x103c }, - { TYPE_MAESTRO2E, 0x1179 }, - { TYPE_MAESTRO2E, 0x14c0 }, /* HP omnibook 4150 */ - { TYPE_MAESTRO2E, 0x1558 }, -}; - static struct ess_device_list mpu_blacklist[] __devinitdata = { { TYPE_MAESTRO2, 0x125d }, }; @@ -2667,7 +2648,6 @@ static int __devinit snd_es1968_create(struct snd_card *card, int play_streams, int capt_streams, int chip_type, - int do_pm, int radio_nr, struct es1968 **chip_ret) { @@ -2736,25 +2716,6 @@ static int __devinit snd_es1968_create(struct snd_card *card, /* just to be sure */ pci_set_master(pci); - if (do_pm > 1) { - /* disable power-management if not on the whitelist */ - unsigned short vend; - pci_read_config_word(chip->pci, PCI_SUBSYSTEM_VENDOR_ID, &vend); - for (i = 0; i < (int)ARRAY_SIZE(pm_whitelist); i++) { - if (chip->type == pm_whitelist[i].type && - vend == pm_whitelist[i].vendor) { - do_pm = 1; - break; - } - } - if (do_pm > 1) { - /* not matched; disabling pm */ - printk(KERN_INFO "es1968: not attempting power management.\n"); - do_pm = 0; - } - } - chip->do_pm = do_pm; - snd_es1968_chip_init(chip); if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { @@ -2817,7 +2778,6 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci, pcm_substreams_p[dev], pcm_substreams_c[dev], pci_id->driver_data, -use_pm[dev], radio_nr[dev],
Re: [PATCH] snd-es1968: remove pm_whitelist
On Thursday 01 November 2012 22:29:43 Alan Cox wrote: > On Thu, 1 Nov 2012 21:55:54 +0100 > > Ondrej Zary wrote: > > pm_whitelist breaks suspend on all non-whitelisted cards for unknown > > purpose. Remove it. This fixes suspend on Terratec DMX and SF64-PCE2 > > cards. > > Because lots of them broke laptops. > > Why not just whitelist the ones you know works, given there are ones we > know doesn't so your patch is an instant regression guarantee ? > > (and yes a blacklist might have been brighter but I don't know the > history and it's a bit late to fix) I wonder what does the suspend/resume code break? Currently, all non-whitelisted cards are broken (not working after resume). The problem with adding cards to the whitelist is that Terratec DMX has generic subsystem ID: ESS Technology ES1978 Maestro 2E [125d:1978] (rev 10) Subsystem: ESS Technology ES1978 Maestro 2E [125d:1978] Adding this to the whitelist does not look like a good idea... -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] snd-es1968: Add ESS vendor ID to pm_whitelist
Add generic ESS vendor ID to pm_whitelist. This should fix suspend on all Maestro-2 and Maestro-2E based PCI cards. Tested on Terratec DMX and SF64-PCE2. Signed-off-by: Ondrej Zary --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -2655,6 +2655,8 @@ static struct ess_device_list pm_whitelist[] __devinitdata = { { TYPE_MAESTRO2E, 0x1179 }, { TYPE_MAESTRO2E, 0x14c0 }, /* HP omnibook 4150 */ { TYPE_MAESTRO2E, 0x1558 }, + { TYPE_MAESTRO2E, 0x125d }, /* a PCI card, e.g. Terratec DMX */ + { TYPE_MAESTRO2, 0x125d }, /* a PCI card, e.g. SF64-PCE2 */ }; static struct ess_device_list mpu_blacklist[] __devinitdata = { -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3] Enable A20 using KBC for some MSI laptops to fix S3 resume
On Friday 26 October 2012 10:56:44 Ondrej Zary wrote: > Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to enable > A20 line but resume code assumes that KBC was used. > The laptop will not resume from S3 otherwise but powers off after a while > and then powers on again stuck with a blank screen. > > Fix it by enabling A20 using KBC. Affected laptop list and DMI data are > from bug reports at Ubuntu Launchpad. > > Also add kernel parameter to easily activate this quirk on any system. > > Only compile tested. The original patch was tested with EX600 and PR200. > > Fixes https://bugzilla.kernel.org/show_bug.cgi?id=12878 The bug was marked as RESOLVED CODE_FIX but I wonder what happened to this patch. Was it applied? Or is someone working on a better way to fix this problem? -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH 5/5] snd-ice1712: Fix resume on ice1724
On Wednesday 17 October 2012 08:57:39 Takashi Iwai wrote: > At Sun, 14 Oct 2012 21:09:23 +0200, > > Ondrej Zary wrote: > > set_pro_rate() is called from hw_params() but not from prepare(), > > breaking running PCM on suspend/resume. Call it from prepare() if PCM was > > suspended to fix the problem. > > > > Signed-off-by: Ondrej Zary > > This should be fixed in the resume callback. Could you check the > patch below instead? I've now verified that this patch fixes a real problem. When "multi track rate locking" is disabled and some sound is played at non-default (non-48kHz) frequency during suspend, the frequency is wrong (48kHz) after resume. This patch fixes that. > thanks, > > Takashi > > --- > diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c > index 161c8f6..5cc3fa5 100644 > --- a/sound/pci/ice1712/ice1724.c > +++ b/sound/pci/ice1712/ice1724.c > @@ -2867,7 +2867,12 @@ static int snd_vt1724_resume(struct device *dev) > ice->set_spdif_clock(ice, 0); > } else { > /* internal on-card clock */ > - snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1); > + int rate; > + if (ice->cur_rate) > + rate = ice->cur_rate; > + else > + rate = ice->pro_rate_default; > + snd_vt1724_set_pro_rate(ice, rate, 1); > } > > update_spdif_bits(ice, ice->pm_saved_spdif_ctrl); > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Asus F5RL laptop unable to resume from S3 because of radeon module
On Sunday 25 August 2013 16:51:06 Deucher, Alexander wrote: > > -Original Message- > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > Sent: Friday, August 23, 2013 1:55 PM > > To: Deucher, Alexander > > Cc: Kernel development list > > Subject: Re: Asus F5RL laptop unable to resume from S3 because of radeon > > module > > > > On Friday 23 August 2013 00:08:33 Ondrej Zary wrote: > > > On Thursday 22 August 2013 22:56:03 Ondrej Zary wrote: > > > > On Thursday 22 August 2013 22:24:17 Deucher, Alexander wrote: > > > > > > -Original Message- > > > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > > > Sent: Thursday, August 22, 2013 4:00 PM > > > > > > To: Deucher, Alexander > > > > > > Cc: Kernel development list > > > > > > Subject: Re: Asus F5RL laptop unable to resume from S3 because of > > > > > > radeon module > > > > > > > > > > > > On Thursday 22 August 2013 21:49:41 Deucher, Alexander wrote: > > > > > > > > -Original Message- > > > > > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > > > > > Sent: Thursday, August 22, 2013 2:18 PM > > > > > > > > To: Kernel development list > > > > > > > > Cc: Deucher, Alexander > > > > > > > > Subject: Asus F5RL laptop unable to resume from S3 because of > > > > > > > > radeon module > > > > > > > > > > > > > > > > Hello, > > > > > > > > resume from suspend-to-RAM (S3) on Asus F5RL laptop does not > > > > > > > > work. According to many reports found by Google, it was > > > > > > > > always been that and there > > > > > > > > is no fix or workaround. > > > > > > > > > > > > > > Make sure your kernel has this patch: > > > > > > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/ > > > > > > >comm it /? id=c ef1d00cd56f600121ad121875655ad410a001b8 > > > > > > > > > > > > Just tried latest git (3.11-rc6+) and the problem persists. > > > > > > > > > > You might try adding a quirk for your system in > > > > > radeon_combios_asic_init() in radeon_combios.c. You can try > > > > something > > > > > > > like this for testing: > > > > > > > > > > diff --git a/drivers/gpu/drm/radeon/radeon_combios.c > > > > > b/drivers/gpu/drm/radeon/radeon_combios.c index 68ce360..0419a2c > > > > 100644 > > > > > > > --- a/drivers/gpu/drm/radeon/radeon_combios.c > > > > > +++ b/drivers/gpu/drm/radeon/radeon_combios.c > > > > > @@ -3398,6 +3398,8 @@ void radeon_combios_asic_init(struct > > > > drm_device > > > > > > > *dev) rdev->pdev->subsystem_device == 0x30ae) > > > > > return; > > > > > > > > > > + return; > > > > > + > > > > > /* DYN CLK 1 */ > > > > > table = combios_get_table_offset(dev, > > > > COMBIOS_DYN_CLK_1_TABLE); > > > > > > > if (table) > > > > > > > > > > If that doesn't work, you'll probably have to track down where it's > > > > > hanging during resume, or compare registers before and after resume > > > > to > > > > > > > see if it's some particular state that's causing a problem. > > > > > > > > No change. > > > > > > > > Inserted "return -1;" before radeon_device_init() to > > > > radeon_driver_load_kms() - driver fails to load and resume works. > > > > Moved it (and changed to "r = -1; goto out;") a bit down before > > > > radeon_modeset_init() - driver fails to load and resume stopped > > > > working. > > > > > Going deeper... it works before rs400_startup() and does not work after > > > that. Will continue later. > > > > Tracked the problem down to rs400_gart_enable(). When this "Disable AGP > > mode" > > code is commented out, the machine resumes fine: > > > > if ((rdev->family == CHIP_RS690) || (rdev->family == CHIP_RS740)) > >
Re: Asus F5RL laptop unable to resume from S3 because of radeon module
On Sunday 25 August 2013 19:12:32 Ondrej Zary wrote: > On Sunday 25 August 2013 16:51:06 Deucher, Alexander wrote: > > > -Original Message- > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > Sent: Friday, August 23, 2013 1:55 PM > > > To: Deucher, Alexander > > > Cc: Kernel development list > > > Subject: Re: Asus F5RL laptop unable to resume from S3 because of > > > radeon module > > > > > > On Friday 23 August 2013 00:08:33 Ondrej Zary wrote: > > > > On Thursday 22 August 2013 22:56:03 Ondrej Zary wrote: > > > > > On Thursday 22 August 2013 22:24:17 Deucher, Alexander wrote: > > > > > > > -Original Message- > > > > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > > > > Sent: Thursday, August 22, 2013 4:00 PM > > > > > > > To: Deucher, Alexander > > > > > > > Cc: Kernel development list > > > > > > > Subject: Re: Asus F5RL laptop unable to resume from S3 because > > > > > > > of radeon module > > > > > > > > > > > > > > On Thursday 22 August 2013 21:49:41 Deucher, Alexander wrote: > > > > > > > > > -Original Message- > > > > > > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > > > > > > Sent: Thursday, August 22, 2013 2:18 PM > > > > > > > > > To: Kernel development list > > > > > > > > > Cc: Deucher, Alexander > > > > > > > > > Subject: Asus F5RL laptop unable to resume from S3 because > > > > > > > > > of radeon module > > > > > > > > > > > > > > > > > > Hello, > > > > > > > > > resume from suspend-to-RAM (S3) on Asus F5RL laptop does > > > > > > > > > not work. According to many reports found by Google, it was > > > > > > > > > always been that and there > > > > > > > > > is no fix or workaround. > > > > > > > > > > > > > > > > Make sure your kernel has this patch: > > > > > > > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.gi > > > > > > > >t/ comm it /? id=c ef1d00cd56f600121ad121875655ad410a001b8 > > > > > > > > > > > > > > Just tried latest git (3.11-rc6+) and the problem persists. > > > > > > > > > > > > You might try adding a quirk for your system in > > > > > > radeon_combios_asic_init() in radeon_combios.c. You can try > > > > > > something > > > > > > > > > like this for testing: > > > > > > > > > > > > diff --git a/drivers/gpu/drm/radeon/radeon_combios.c > > > > > > b/drivers/gpu/drm/radeon/radeon_combios.c index 68ce360..0419a2c > > > > > > 100644 > > > > > > > > > --- a/drivers/gpu/drm/radeon/radeon_combios.c > > > > > > +++ b/drivers/gpu/drm/radeon/radeon_combios.c > > > > > > @@ -3398,6 +3398,8 @@ void radeon_combios_asic_init(struct > > > > > > drm_device > > > > > > > > > *dev) rdev->pdev->subsystem_device == 0x30ae) > > > > > > return; > > > > > > > > > > > > + return; > > > > > > + > > > > > > /* DYN CLK 1 */ > > > > > > table = combios_get_table_offset(dev, > > > > > > COMBIOS_DYN_CLK_1_TABLE); > > > > > > > > > if (table) > > > > > > > > > > > > If that doesn't work, you'll probably have to track down where > > > > > > it's hanging during resume, or compare registers before and after > > > > > > resume > > > > > > to > > > > > > > > > see if it's some particular state that's causing a problem. > > > > > > > > > > No change. > > > > > > > > > > Inserted "return -1;" before radeon_device_init() to > > > > > radeon_driver_load_kms() - driver fails to load and resume works. > > > > > Moved it (and changed to "r = -1; goto out;") a bit down before > > > > > radeon_modeset_
Re: Asus F5RL laptop unable to resume from S3 because of radeon module
On Monday 26 August 2013 00:01:11 Ondrej Zary wrote: > On Sunday 25 August 2013 19:12:32 Ondrej Zary wrote: > > On Sunday 25 August 2013 16:51:06 Deucher, Alexander wrote: > > > > -Original Message- > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > Sent: Friday, August 23, 2013 1:55 PM > > > > To: Deucher, Alexander > > > > Cc: Kernel development list > > > > Subject: Re: Asus F5RL laptop unable to resume from S3 because of > > > > radeon module > > > > > > > > On Friday 23 August 2013 00:08:33 Ondrej Zary wrote: > > > > > On Thursday 22 August 2013 22:56:03 Ondrej Zary wrote: > > > > > > On Thursday 22 August 2013 22:24:17 Deucher, Alexander wrote: > > > > > > > > -Original Message- > > > > > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > > > > > Sent: Thursday, August 22, 2013 4:00 PM > > > > > > > > To: Deucher, Alexander > > > > > > > > Cc: Kernel development list > > > > > > > > Subject: Re: Asus F5RL laptop unable to resume from S3 > > > > > > > > because of radeon module > > > > > > > > > > > > > > > > On Thursday 22 August 2013 21:49:41 Deucher, Alexander wrote: > > > > > > > > > > -Original Message- > > > > > > > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > > > > > > > Sent: Thursday, August 22, 2013 2:18 PM > > > > > > > > > > To: Kernel development list > > > > > > > > > > Cc: Deucher, Alexander > > > > > > > > > > Subject: Asus F5RL laptop unable to resume from S3 > > > > > > > > > > because of radeon module > > > > > > > > > > > > > > > > > > > > Hello, > > > > > > > > > > resume from suspend-to-RAM (S3) on Asus F5RL laptop does > > > > > > > > > > not work. According to many reports found by Google, it > > > > > > > > > > was always been that and there > > > > > > > > > > is no fix or workaround. > > > > > > > > > > > > > > > > > > Make sure your kernel has this patch: > > > > > > > > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux. > > > > > > > > >gi t/ comm it /? id=c > > > > > > > > > ef1d00cd56f600121ad121875655ad410a001b8 > > > > > > > > > > > > > > > > Just tried latest git (3.11-rc6+) and the problem persists. > > > > > > > > > > > > > > You might try adding a quirk for your system in > > > > > > > radeon_combios_asic_init() in radeon_combios.c. You can try > > > > > > > > something > > > > > > > > > > > like this for testing: > > > > > > > > > > > > > > diff --git a/drivers/gpu/drm/radeon/radeon_combios.c > > > > > > > b/drivers/gpu/drm/radeon/radeon_combios.c index > > > > > > > 68ce360..0419a2c > > > > > > > > 100644 > > > > > > > > > > > --- a/drivers/gpu/drm/radeon/radeon_combios.c > > > > > > > +++ b/drivers/gpu/drm/radeon/radeon_combios.c > > > > > > > @@ -3398,6 +3398,8 @@ void radeon_combios_asic_init(struct > > > > > > > > drm_device > > > > > > > > > > > *dev) rdev->pdev->subsystem_device == 0x30ae) > > > > > > > return; > > > > > > > > > > > > > > + return; > > > > > > > + > > > > > > > /* DYN CLK 1 */ > > > > > > > table = combios_get_table_offset(dev, > > > > > > > > COMBIOS_DYN_CLK_1_TABLE); > > > > > > > > > > > if (table) > > > > > > > > > > > > > > If that doesn't work, you'll probably have to track down where > > > > > > > it's hanging during resume, or compare registers before and > > > > > > > after resume > > > > > > > > to > >
Re: Asus F5RL laptop unable to resume from S3 because of radeon module
On Monday 26 August 2013 23:55:27 Deucher, Alexander wrote: > > -Original Message- > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > Sent: Monday, August 26, 2013 5:23 PM > > To: Deucher, Alexander > > Cc: Kernel development list > > Subject: Re: Asus F5RL laptop unable to resume from S3 because of radeon > > module > > > > On Monday 26 August 2013 00:01:11 Ondrej Zary wrote: > > > On Sunday 25 August 2013 19:12:32 Ondrej Zary wrote: > > > > On Sunday 25 August 2013 16:51:06 Deucher, Alexander wrote: > > > > > > -Original Message- > > > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > > > Sent: Friday, August 23, 2013 1:55 PM > > > > > > To: Deucher, Alexander > > > > > > Cc: Kernel development list > > > > > > Subject: Re: Asus F5RL laptop unable to resume from S3 because of > > > > > > radeon module > > > > > > > > > > > > On Friday 23 August 2013 00:08:33 Ondrej Zary wrote: > > > > > > > On Thursday 22 August 2013 22:56:03 Ondrej Zary wrote: > > > > > > > > On Thursday 22 August 2013 22:24:17 Deucher, Alexander wrote: > > > > > > > > > > -Original Message- > > > > > > > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > > > > > > > Sent: Thursday, August 22, 2013 4:00 PM > > > > > > > > > > To: Deucher, Alexander > > > > > > > > > > Cc: Kernel development list > > > > > > > > > > Subject: Re: Asus F5RL laptop unable to resume from S3 > > > > > > > > > > because of radeon module > > > > > > > > > > > > > > > > > > > > On Thursday 22 August 2013 21:49:41 Deucher, Alexander > > > > wrote: > > > > > > > > > > > > -Original Message- > > > > > > > > > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > > > > > > > > > Sent: Thursday, August 22, 2013 2:18 PM > > > > > > > > > > > > To: Kernel development list > > > > > > > > > > > > Cc: Deucher, Alexander > > > > > > > > > > > > Subject: Asus F5RL laptop unable to resume from S3 > > > > > > > > > > > > because of radeon module > > > > > > > > > > > > > > > > > > > > > > > > Hello, > > > > > > > > > > > > resume from suspend-to-RAM (S3) on Asus F5RL laptop > > > > does > > > > > > > > > > > > > > not work. According to many reports found by Google, > > > > > > > > > > > > it was always been that and there > > > > > > > > > > > > is no fix or workaround. > > > > > > > > > > > > > > > > > > > > > > Make sure your kernel has this patch: > > > > > > > > > > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/li > > > > > > > > > > >nux. gi t/ comm it /? id=c > > > > > > > > > > > ef1d00cd56f600121ad121875655ad410a001b8 > > > > > > > > > > > > > > > > > > > > Just tried latest git (3.11-rc6+) and the problem > > > > > > > > > > persists. > > > > > > > > > > > > > > > > > > You might try adding a quirk for your system in > > > > > > > > > radeon_combios_asic_init() in radeon_combios.c. You can > > > > > > > > > try > > > > > > > > > > > > something > > > > > > > > > > > > > > > like this for testing: > > > > > > > > > > > > > > > > > > diff --git a/drivers/gpu/drm/radeon/radeon_combios.c > > > > > > > > > b/drivers/gpu/drm/radeon/radeon_combios.c index > > > > > > > > > 68ce360..0419a2c > > > > > > > > > > > > 100644 > > > > > > > > > > > > > > > --- a/drivers/gpu/drm/radeon/radeon_combios.c > > > > &
Re: [PATCH] pata_isapnp: Don't use invalid I/O ports
On Friday 13 September 2013 20:54:37 Ondrej Zary wrote: > On Thursday 12 September 2013 23:01:29 Ondrej Zary wrote: > > The test for 2nd I/O port validity is broken (reversed): > > On devices with no control port, the driver attempts to use invalid port > > 0, resulting in logs full of bad_io_access errors. > > On devices with control port, the driver does not use it. > > > > Signed-off-by: Ondrej Zary > > --- > > drivers/ata/pata_isapnp.c |2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c > > index 4bceb88..b33d1f9 100644 > > --- a/drivers/ata/pata_isapnp.c > > +++ b/drivers/ata/pata_isapnp.c > > @@ -78,7 +78,7 @@ static int isapnp_init_one(struct pnp_dev *idev, const > > struct pnp_device_id *dev > > > > ap->ioaddr.cmd_addr = cmd_addr; > > > > - if (pnp_port_valid(idev, 1) == 0) { > > + if (pnp_port_valid(idev, 1)) { > > ctl_addr = devm_ioport_map(&idev->dev, > >pnp_port_start(idev, 1), 1); > > ap->ioaddr.altstatus_addr = ctl_addr; > > With this patch, the ATA port works fine if there is a device connected to > it. However, it takes ages to boot if there are no devices connected. Looks > like the driver retries IDENTIFY command for both slave and master drives > in a hope that the devices are there. > > log: > > [7.692344] pata_isapnp 01:01.02: [io 0x01e8-0x01ef] > [7.692474] pata_isapnp 01:01.02: [io 0x0168-0x016f] > [7.692644] pata_isapnp 01:01.02: [irq 10] > [7.695012] pata_isapnp 01:01.02: activated > [7.751153] scsi2 : pata_isapnp > [7.751781] ata3: PATA max PIO0 cmd 0x168 ctl 0x0 irq 10 > [ 12.751446] ata3.01: qc timeout (cmd 0xec) > [ 12.751571] ata3.01: failed to IDENTIFY (I/O error, err_mask=0x5) > [ 22.752270] ata3.01: qc timeout (cmd 0xec) > [ 22.752396] ata3.01: failed to IDENTIFY (I/O error, err_mask=0x5) > [ 52.754737] ata3.01: qc timeout (cmd 0xec) > [ 52.754861] ata3.01: failed to IDENTIFY (I/O error, err_mask=0x5) > [ 57.755149] ata3.00: qc timeout (cmd 0xec) > [ 57.755275] ata3.00: failed to IDENTIFY (I/O error, err_mask=0x5) > [ 67.755974] ata3.00: qc timeout (cmd 0xec) > [ 67.756099] ata3.00: failed to IDENTIFY (I/O error, err_mask=0x5) This is caused by skipping ata_sff_softreset() when ap->ioaddr.ctl_addr is unset so ata_devchk() is never called. This patch seems to fix the problem. Is it OK or can it cause more problems? --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c @@ -2008,13 +2008,15 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); - /* software reset. causes dev0 to be selected */ - iowrite8(ap->ctl, ioaddr->ctl_addr); - udelay(20); /* FIXME: flush */ - iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); - udelay(20); /* FIXME: flush */ - iowrite8(ap->ctl, ioaddr->ctl_addr); - ap->last_ctl = ap->ctl; + if (ap->ioaddr.ctl_addr) { + /* software reset. causes dev0 to be selected */ + iowrite8(ap->ctl, ioaddr->ctl_addr); + udelay(20); /* FIXME: flush */ + iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); + udelay(20); /* FIXME: flush */ + iowrite8(ap->ctl, ioaddr->ctl_addr); + ap->last_ctl = ap->ctl; + } /* wait the port to become ready */ return ata_sff_wait_after_reset(&ap->link, devmask, deadline); @@ -2215,10 +2217,6 @@ void ata_sff_error_handler(struct ata_port *ap) spin_unlock_irqrestore(ap->lock, flags); - /* ignore ata_sff_softreset if ctl isn't accessible */ - if (softreset == ata_sff_softreset && !ap->ioaddr.ctl_addr) - softreset = NULL; - /* ignore built-in hardresets if SCR access is not available */ if ((hardreset == sata_std_hardreset || hardreset == sata_sff_hardreset) && !sata_scr_valid(&ap->link)) -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH] ES938 support for ES18xx driver
Hello, this is an attempt to support ES938 3-D Audio Effects Processor found on some ES18xx (and possibly other) sound cards, doing bass/treble and 3D control. ES938 is controlled by MIDI SysEx commands sent through card's MPU401 port. The following patch works but has a problem: the midi port cannot be used by userspace applications. Opening and closing the rawmidi device on each control change would probably work (as long as the port is not used by an application) but that just does not seem right. Is there a way to cleanly fix this? (There are two problems: 3D level does not have any effect and alsamixer does not display the TLV dB values - but don't know why). --- sound/isa/Kconfig |4 + sound/isa/Makefile |2 + sound/isa/es18xx.c | 12 +++- sound/isa/es938.c | 181 sound/isa/es938.h | 24 +++ 5 files changed, 222 insertions(+), 1 deletions(-) create mode 100644 sound/isa/es938.c create mode 100644 sound/isa/es938.h diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index affa134..a8bf3e3 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -17,6 +17,9 @@ config SND_SB16_DSP select SND_PCM select SND_SB_COMMON +config SND_ES938 + tristate + menuconfig SND_ISA bool "ISA sound devices" depends on ISA && ISA_DMA_API @@ -183,6 +186,7 @@ config SND_ES18XX select SND_OPL3_LIB select SND_MPU401_UART select SND_PCM + select SND_ES938 help Say Y here to include support for ESS AudioDrive ES18xx chips. diff --git a/sound/isa/Makefile b/sound/isa/Makefile index 9a15f14..d59e0bf 100644 --- a/sound/isa/Makefile +++ b/sound/isa/Makefile @@ -8,6 +8,7 @@ snd-als100-objs := als100.o snd-azt2320-objs := azt2320.o snd-cmi8328-objs := cmi8328.o snd-cmi8330-objs := cmi8330.o +snd-es938-objs := es938.o snd-es18xx-objs := es18xx.o snd-opl3sa2-objs := opl3sa2.o snd-sc6000-objs := sc6000.o @@ -19,6 +20,7 @@ obj-$(CONFIG_SND_ALS100) += snd-als100.o obj-$(CONFIG_SND_AZT2320) += snd-azt2320.o obj-$(CONFIG_SND_CMI8328) += snd-cmi8328.o obj-$(CONFIG_SND_CMI8330) += snd-cmi8330.o +obj-$(CONFIG_SND_ES938) += snd-es938.o obj-$(CONFIG_SND_ES18XX) += snd-es18xx.o obj-$(CONFIG_SND_OPL3SA2) += snd-opl3sa2.o obj-$(CONFIG_SND_SC6000) += snd-sc6000.o diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 12978b8..c502aa0 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -96,6 +96,7 @@ #define SNDRV_LEGACY_FIND_FREE_IRQ #define SNDRV_LEGACY_FIND_FREE_DMA #include +#include "es938.h" #define PFX "es18xx: " @@ -122,6 +123,7 @@ struct snd_es18xx { struct snd_pcm_substream *playback_b_substream; struct snd_rawmidi *rmidi; + struct snd_es938 es938; struct snd_kcontrol *hw_volume; struct snd_kcontrol *hw_switch; @@ -2166,7 +2168,15 @@ static int snd_audiodrive_probe(struct snd_card *card, int dev) return err; } - return snd_card_register(card); + err = snd_card_register(card); + if (err < 0) + return err; + + if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) + if (snd_es938_init(&chip->es938, card, 0, 0) == 0) + printk("es938 found!\n"); + + return 0; } static int snd_es18xx_isa_match(struct device *pdev, unsigned int dev) diff --git a/sound/isa/es938.c b/sound/isa/es938.c new file mode 100644 index 000..cfe8ae7 --- /dev/null +++ b/sound/isa/es938.c @@ -0,0 +1,181 @@ +/* + * Driver for ESS ES938 3-D Audio Effects Processor + * Copyright (c) 2013 Ondrej Zary + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +//#include +#include +#include +#include +#include +#include +#include "es938.h" + +#define PFX "es938: " + +MODULE_AUTHOR("Ondrej Zary"); +MODULE_DESCRIPTION("ESS ES938"); +MODULE_LICENSE("GPL"); + +static int snd_es938_read_reg(struct snd_es938 *chip, u8 reg, u8 *out) +{ + u8 buf[8]; + int i = 0, res; + u8 sysex[] = { MIDI_CMD_COMMON_SYSEX, ES938_ID, ES938_CMD_REG_R, reg, + MIDI_CMD_
Re: [RFC PATCH] ES938 support for ES18xx driver
On Sunday 15 September 2013 20:49:02 Andreas Mohr wrote: > Hi, > > > ES938 is controlled by MIDI SysEx commands sent through card's MPU401 > > port. > > > > The following patch works but has a problem: the midi port cannot be used > > by userspace applications. Opening and closing the rawmidi device on each > > control change would probably work (as long as the port is not used by an > > application) but that just does not seem right. Is there a way to cleanly > > fix this? > > Just to clarify matters: > > The story here was a bit split, but then I got it: > you're saying that since ES938 control is via MIDI SysEx, > these operations will occupy MIDI resources at least while controlling > ES938 and therefore they're unavailable for userspace. > > Don't tell me we'd require a MIDI access multiplexing layer which perhaps > does not exist yet... Probably some hack that would allow the driver to send MIDI data behind everyone's back would be enough. Receiving is not needed (because the read register command is used only once for device detection). The SNDRV_RAWMIDI_LFLG_APPEND thing looks like that but does not seem to work. And another bad thing I forgot to mention before: the driver cannot be unloaded because the MIDI device is open (circular dependency between snd-es18xx and snd-es938). Maybe rawmidi_open_priv() would work, only if it was exported (and not _priv). > > (There are two problems: 3D level does not have any effect and alsamixer > > does not display the TLV dB values - but don't know why). > > Hmm, I'm rather in the dark here as well - however from my driver > experiences the actually sort-of standardized 3D level control > may have some "weird" deviations (at least when talking AC97 or > pseudo-AC97) such as different bitmask indices or possibly even inverted > volume operation (background: azt3328 is pseudo-AC97, thus it has some > deviations). Sorry for not knowing any more helpful hints... > > Hmm, or perhaps ES938_REG_POWER needs some special values configured > to have 3D sound effects powered up, too? > OTOH if this is a simple non-DSP implementation then 3D probably is > implemented via delay lines etc., so perhaps it is so simple that it does > not have a special "enable power" switch after all. > > Oh, and BTW, my azt3328.c said: > > * - (non-bug) "Bass/Treble or 3D settings don't work" - they do get > evaluated > *if you set PCM output switch to "pre 3D" instead of "post 3D". > *If this can't be set, then get a mixer application that Isn't Stupid > (tm) > *(e.g. kmix, gamix) - unfortunately several are!! BTW. I've got an AZT3328 card and it works fine with your driver. Thanks for it. I'm thinking about doing some reverse-engineering of thunderbird-based sound cards (VLSI Thunderbird - Aztech PCI 368-DSP, Thunderbird Avenger - Philips Acoustic/Seismic/Rhythmic Edge). > So perhaps ES938 has (perhaps since it might more or less conform to > certain standards specs?) another control for PCM output switch as well > which would need implementing or simply isn't set properly? > (to clarify, we're talking about a switch which would cause output signal > to be grabbed pre or post the 3D manipulation block) The good thing is that there's a datasheet available for ES938 - e.g. at http://www.datasheetarchive.com/ES938-datasheet.html The 3D switch works but the level doesn't. Maybe I should use only the 3 specific level values from the datasheet and not a variable scale. Or just remove the level control completely as Windows driver does (there's only a 3D switch). > > + if (snd_es938_init(&chip->es938, card, 0, 0) == 0) > > + printk("es938 found!\n"); > > Perhaps we could have a more verbose message here? > That ES938 surely must have some human-readable characteristics... > (hmm, what about "ES938 3D audio effects processor found!"?) > ((or "Detected ...")) Yes, that's wrong - it's only for testing purposes. There should probably be no message at all as the es18xx driver itself does not display anything if everything is OK. > > + /* try to read a register to detect chip presence */ > > + if (snd_es938_read_reg(chip, ES938_REG_MISC, NULL) < 0) > > + return -ENODEV; > > Perhaps that check is not specific enough, i.e. it might be useful > to figure out a more precise check? snd_es938_read_reg() checks that the returned data match the format used by ES938. Maybe we can reread all the register values back after writing to be sure. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH] ES938 support for ES18xx driver
On Sunday 15 September 2013 22:35:20 Andreas Mohr wrote: > Hi, > > On Sun, Sep 15, 2013 at 10:25:45PM +0200, Ondrej Zary wrote: > > On Sunday 15 September 2013 20:49:02 Andreas Mohr wrote: > > BTW. I've got an AZT3328 card and it works fine with your driver. Thanks > > for it. > > What!?!? I didn't quite expect any kernel dev to have that one, too ;) Don't remember where I got it from but it looked nice so I bought it :) > (got several commits sitting here and waiting for submission though) > > > I'm thinking about doing some reverse-engineering of thunderbird-based > > sound cards (VLSI Thunderbird - Aztech PCI 368-DSP, Thunderbird Avenger - > > Philips Acoustic/Seismic/Rhythmic Edge). > > Oh, nice. I've got the Aztech PCI 368-DSP, too (that was somewhat > obligatory due to having written another Aztech card driver...). > > And yeah, the PCI 368 (etc.) series does seem to be some rather heavy > support hole indeed, IIRC (especially as it's more modern PCI-based and not > ISA). Got it on eBay but the Philips Edge cards are not that uncommon - they were sold here (in Slovakia) too, IIRC. I have Seismic Edge PSC705 (but bought it used). > > > So perhaps ES938 has (perhaps since it might more or less conform to > > > certain standards specs?) another control for PCM output switch as well > > > which would need implementing or simply isn't set properly? > > > (to clarify, we're talking about a switch which would cause output > > > signal to be grabbed pre or post the 3D manipulation block) > > > > The good thing is that there's a datasheet available for ES938 - e.g. at > > http://www.datasheetarchive.com/ES938-datasheet.html > > > > The 3D switch works but the level doesn't. Maybe I should use only the 3 > > specific level values from the datasheet and not a variable scale. Or > > just remove the level control completely as Windows driver does (there's > > only a 3D switch). > > Hmm. Perhaps they removed it "Since It Does Not Work"? ;-P Maybe. The value is configured in the INF file and never changed. > Thanks for hinting at the TLV control dB values thingy! Didn't know that > such thing existed, thus azt3328 does not have it (yet?). It's a nice thing, especially for cards that can go above 0 dB. You then know that the sound can be distorted when you set e.g. PCM volume too high. > > > Perhaps we could have a more verbose message here? > > > That ES938 surely must have some human-readable characteristics... > > > (hmm, what about "ES938 3D audio effects processor found!"?) > > > ((or "Detected ...")) > > > > Yes, that's wrong - it's only for testing purposes. There should probably > > be no message at all as the es18xx driver itself does not display > > anything if everything is OK. > > ...or that, yeah. > > > > Perhaps that check is not specific enough, i.e. it might be useful > > > to figure out a more precise check? > > > > snd_es938_read_reg() checks that the returned data match the format used > > by ES938. Maybe we can reread all the register values back after writing > > to be sure. > > Is there any chip ID/version register to be identified? No, there are only 8 registers, all(? - haven't tested) R/W. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH] ES938 support for ES18xx driver
On Sunday 15 September 2013 23:23:58 Andreas Mohr wrote: > On Sun, Sep 15, 2013 at 11:04:26PM +0200, Ondrej Zary wrote: > > On Sunday 15 September 2013 22:35:20 Andreas Mohr wrote: > > > What!?!? I didn't quite expect any kernel dev to have that one, too ;) > > > > Don't remember where I got it from but it looked nice so I bought it :) > > Yup, e.g. the builtin amp is quite nice. > > > > Thanks for hinting at the TLV control dB values thingy! Didn't know > > > that such thing existed, thus azt3328 does not have it (yet?). > > > > It's a nice thing, especially for cards that can go above 0 dB. You then > > know that the sound can be distorted when you set e.g. PCM volume too > > high. > > Hmm, any hint how to precisely do dB values normalization scaling, > for a card where this is not documented? Or perhaps that's actually easy - > haven't thought about it... Perhaps with 3 sound cards: one for recording, one with known dB values and one unknown. First play some test signal at known dB value and record that. Then play the signal using on the unknown card and ajdust its mixer so that the recording revel is the same as before. Repeat a few times to find out the dB value of mixer step. > > > Is there any chip ID/version register to be identified? > > > > No, there are only 8 registers, all(? - haven't tested) R/W. > > OK, but possibly they happen to be creating another virtual register > mapping range? (i.e. index/data register combo?) Datasheet says that there are no more registers - just 0..7 (2,3,4 are reserved). -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH] ES938 support for ES18xx driver
This is v2, which opens/closes the MIDI device everytime a mixer control value is changed. Userspace apps can now use the MIDI port. Changing the mixer controls will fail when the MIDI port is open. Also the 3D level control now works - seems that the reserved bit 0 must be set. --- sound/isa/Kconfig |4 + sound/isa/Makefile |2 + sound/isa/es18xx.c | 11 +++- sound/isa/es938.c | 203 sound/isa/es938.h | 29 5 files changed, 248 insertions(+), 1 deletions(-) create mode 100644 sound/isa/es938.c create mode 100644 sound/isa/es938.h diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index affa134..a8bf3e3 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -17,6 +17,9 @@ config SND_SB16_DSP select SND_PCM select SND_SB_COMMON +config SND_ES938 + tristate + menuconfig SND_ISA bool "ISA sound devices" depends on ISA && ISA_DMA_API @@ -183,6 +186,7 @@ config SND_ES18XX select SND_OPL3_LIB select SND_MPU401_UART select SND_PCM + select SND_ES938 help Say Y here to include support for ESS AudioDrive ES18xx chips. diff --git a/sound/isa/Makefile b/sound/isa/Makefile index 9a15f14..d59e0bf 100644 --- a/sound/isa/Makefile +++ b/sound/isa/Makefile @@ -8,6 +8,7 @@ snd-als100-objs := als100.o snd-azt2320-objs := azt2320.o snd-cmi8328-objs := cmi8328.o snd-cmi8330-objs := cmi8330.o +snd-es938-objs := es938.o snd-es18xx-objs := es18xx.o snd-opl3sa2-objs := opl3sa2.o snd-sc6000-objs := sc6000.o @@ -19,6 +20,7 @@ obj-$(CONFIG_SND_ALS100) += snd-als100.o obj-$(CONFIG_SND_AZT2320) += snd-azt2320.o obj-$(CONFIG_SND_CMI8328) += snd-cmi8328.o obj-$(CONFIG_SND_CMI8330) += snd-cmi8330.o +obj-$(CONFIG_SND_ES938) += snd-es938.o obj-$(CONFIG_SND_ES18XX) += snd-es18xx.o obj-$(CONFIG_SND_OPL3SA2) += snd-opl3sa2.o obj-$(CONFIG_SND_SC6000) += snd-sc6000.o diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 12978b8..5e496a7 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -96,6 +96,7 @@ #define SNDRV_LEGACY_FIND_FREE_IRQ #define SNDRV_LEGACY_FIND_FREE_DMA #include +#include "es938.h" #define PFX "es18xx: " @@ -122,6 +123,7 @@ struct snd_es18xx { struct snd_pcm_substream *playback_b_substream; struct snd_rawmidi *rmidi; + struct snd_es938 es938; struct snd_kcontrol *hw_volume; struct snd_kcontrol *hw_switch; @@ -2166,7 +2168,14 @@ static int snd_audiodrive_probe(struct snd_card *card, int dev) return err; } - return snd_card_register(card); + err = snd_card_register(card); + if (err < 0) + return err; + + if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) + snd_es938_init(&chip->es938, card, 0, 0); + + return 0; } static int snd_es18xx_isa_match(struct device *pdev, unsigned int dev) diff --git a/sound/isa/es938.c b/sound/isa/es938.c new file mode 100644 index 000..a01f887 --- /dev/null +++ b/sound/isa/es938.c @@ -0,0 +1,203 @@ +/* + * Driver for ESS ES938 3-D Audio Effects Processor + * Copyright (c) 2013 Ondrej Zary + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include +#include "es938.h" + +MODULE_AUTHOR("Ondrej Zary"); +MODULE_DESCRIPTION("ESS ES938"); +MODULE_LICENSE("GPL"); + +static int snd_es938_read_reg(struct snd_es938 *chip, u8 reg, u8 *out) +{ + u8 buf[8]; + int i = 0, res; + u8 sysex[] = { MIDI_CMD_COMMON_SYSEX, 0x00, 0x00, ES938_ID, + ES938_CMD_REG_R, reg, MIDI_CMD_COMMON_SYSEX_END }; + unsigned long end_time; + + snd_rawmidi_kernel_write(chip->rfile.output, sysex, sizeof(sysex)); + + memset(buf, 0, sizeof(buf)); + end_time = jiffies + msecs_to_jiffies(100); + while (i < sizeof(buf)) { + res = snd_rawmidi_kernel_read(chip->rfile.input, buf + i, + sizeof(buf) - i); + if (res > 0) + i += res; + if (time_after(jiffies, end_t
[PATCH 1/2] snd-ac97-codec: Add ID for TI TLV320AIC27 codec
Add 0x54584e03 ID for TI TLV320AIC27 AC'97 codec according to datasheet: http://www.ti.com/lit/ds/slas253a/slas253a.pdf The weird thing is that the chip is physically marked 320AD91. Signed-off-by: Ondrej Zary --- sound/pci/ac97/ac97_codec.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 445ca48..bf578ba2 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -175,6 +175,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = { { 0x54524106, 0x, "TR28026", NULL, NULL }, { 0x54524108, 0x, "TR28028", patch_tritech_tr28028, NULL }, // added by xin jin [07/09/99] { 0x54524123, 0x, "TR28602", NULL, NULL }, // only guess --jk [TR28023 = eMicro EM28023 (new CT1297)] +{ 0x54584e03, 0x, "TLV320AIC27", NULL, NULL }, { 0x54584e20, 0x, "TLC320AD9xC", NULL, NULL }, { 0x56494161, 0x, "VIA1612A", NULL, NULL }, // modified ICE1232 with S/PDIF { 0x56494170, 0x, "VIA1617A", patch_vt1617a, NULL }, // modified VT1616 with S/PDIF -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] snd-ac97-codec: Use complete ID when the codec is not known
Currently, if the codec ID is not known, the last byte of the ID is used as name. It's not helpful at all, use full codec ID instead. Signed-off-by: Ondrej Zary --- sound/pci/ac97/ac97_codec.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index bf578ba2..30a40a8 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -1830,7 +1830,7 @@ void snd_ac97_get_name(struct snd_ac97 *ac97, unsigned int id, char *name, int m pid->patch(ac97); } } else - sprintf(name + strlen(name), " id %x", id & 0xff); + sprintf(name + strlen(name), " id %x", id); } /** -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] pata_isapnp: Don't use invalid I/O ports
The test for 2nd I/O port validity is broken (reversed): On devices with no control port, the driver attempts to use invalid port 0, resulting in logs full of bad_io_access errors. On devices with control port, the driver does not use it. Signed-off-by: Ondrej Zary --- drivers/ata/pata_isapnp.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c index 4bceb88..b33d1f9 100644 --- a/drivers/ata/pata_isapnp.c +++ b/drivers/ata/pata_isapnp.c @@ -78,7 +78,7 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev ap->ioaddr.cmd_addr = cmd_addr; - if (pnp_port_valid(idev, 1) == 0) { + if (pnp_port_valid(idev, 1)) { ctl_addr = devm_ioport_map(&idev->dev, pnp_port_start(idev, 1), 1); ap->ioaddr.altstatus_addr = ctl_addr; -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] pata_isapnp: Don't use invalid I/O ports
On Thursday 12 September 2013 23:01:29 Ondrej Zary wrote: > The test for 2nd I/O port validity is broken (reversed): > On devices with no control port, the driver attempts to use invalid port 0, > resulting in logs full of bad_io_access errors. > On devices with control port, the driver does not use it. > > Signed-off-by: Ondrej Zary > --- > drivers/ata/pata_isapnp.c |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c > index 4bceb88..b33d1f9 100644 > --- a/drivers/ata/pata_isapnp.c > +++ b/drivers/ata/pata_isapnp.c > @@ -78,7 +78,7 @@ static int isapnp_init_one(struct pnp_dev *idev, const > struct pnp_device_id *dev > > ap->ioaddr.cmd_addr = cmd_addr; > > - if (pnp_port_valid(idev, 1) == 0) { > + if (pnp_port_valid(idev, 1)) { > ctl_addr = devm_ioport_map(&idev->dev, > pnp_port_start(idev, 1), 1); > ap->ioaddr.altstatus_addr = ctl_addr; With this patch, the ATA port works fine if there is a device connected to it. However, it takes ages to boot if there are no devices connected. Looks like the driver retries IDENTIFY command for both slave and master drives in a hope that the devices are there. log: [7.692344] pata_isapnp 01:01.02: [io 0x01e8-0x01ef] [7.692474] pata_isapnp 01:01.02: [io 0x0168-0x016f] [7.692644] pata_isapnp 01:01.02: [irq 10] [7.695012] pata_isapnp 01:01.02: activated [7.751153] scsi2 : pata_isapnp [7.751781] ata3: PATA max PIO0 cmd 0x168 ctl 0x0 irq 10 [ 12.751446] ata3.01: qc timeout (cmd 0xec) [ 12.751571] ata3.01: failed to IDENTIFY (I/O error, err_mask=0x5) [ 22.752270] ata3.01: qc timeout (cmd 0xec) [ 22.752396] ata3.01: failed to IDENTIFY (I/O error, err_mask=0x5) [ 52.754737] ata3.01: qc timeout (cmd 0xec) [ 52.754861] ata3.01: failed to IDENTIFY (I/O error, err_mask=0x5) [ 57.755149] ata3.00: qc timeout (cmd 0xec) [ 57.755275] ata3.00: failed to IDENTIFY (I/O error, err_mask=0x5) [ 67.755974] ata3.00: qc timeout (cmd 0xec) [ 67.756099] ata3.00: failed to IDENTIFY (I/O error, err_mask=0x5) -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] [RESEND] snd-ac97-codec: Add ID for TI TLV320AIC27 codec
Add 0x54584e03 ID for TI TLV320AIC27 AC'97 codec according to datasheet: http://www.ti.com/lit/ds/slas253a/slas253a.pdf The weird thing is that the chip is physically marked 320AD91. Signed-off-by: Ondrej Zary --- sound/pci/ac97/ac97_codec.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 445ca48..bf578ba2 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -175,6 +175,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = { { 0x54524106, 0x, "TR28026", NULL, NULL }, { 0x54524108, 0x, "TR28028", patch_tritech_tr28028, NULL }, // added by xin jin [07/09/99] { 0x54524123, 0x, "TR28602", NULL, NULL }, // only guess --jk [TR28023 = eMicro EM28023 (new CT1297)] +{ 0x54584e03, 0x, "TLV320AIC27", NULL, NULL }, { 0x54584e20, 0x, "TLC320AD9xC", NULL, NULL }, { 0x56494161, 0x, "VIA1612A", NULL, NULL }, // modified ICE1232 with S/PDIF { 0x56494170, 0x, "VIA1617A", patch_vt1617a, NULL }, // modified VT1616 with S/PDIF -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] [RESEND] snd-ac97-codec: Use complete ID when the codec is not known
Currently, if the codec ID is not known, the last byte of the ID is used as name. It's not helpful at all, use full codec ID instead. Signed-off-by: Ondrej Zary --- sound/pci/ac97/ac97_codec.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index bf578ba2..30a40a8 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -1830,7 +1830,7 @@ void snd_ac97_get_name(struct snd_ac97 *ac97, unsigned int id, char *name, int m pid->patch(ac97); } } else - sprintf(name + strlen(name), " id %x", id & 0xff); + sprintf(name + strlen(name), " id %x", id); } /** -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [PATCH 2/2] [RESEND] snd-ac97-codec: Use complete ID when the codec is not known
On Monday 30 September 2013 11:08:50 Takashi Iwai wrote: > At Fri, 27 Sep 2013 20:28:03 +0200, > > Ondrej Zary wrote: > > Currently, if the codec ID is not known, the last byte of the ID is used > > as name. It's not helpful at all, use full codec ID instead. > > The full bytes are already shown at the beginning, no? > It's masked because the upper three bytes are shown in printable form, > and the last byte is usually a model number. Thanks, I see now. So this patch is not needed. > > Takashi > > > Signed-off-by: Ondrej Zary > > --- > > sound/pci/ac97/ac97_codec.c |2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c > > index bf578ba2..30a40a8 100644 > > --- a/sound/pci/ac97/ac97_codec.c > > +++ b/sound/pci/ac97/ac97_codec.c > > @@ -1830,7 +1830,7 @@ void snd_ac97_get_name(struct snd_ac97 *ac97, > > unsigned int id, char *name, int m pid->patch(ac97); > > } > > } else > > - sprintf(name + strlen(name), " id %x", id & 0xff); > > + sprintf(name + strlen(name), " id %x", id); > > } > > > > /** > > -- > > Ondrej Zary > > ___ > > Alsa-devel mailing list > > alsa-de...@alsa-project.org > > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel > > ___ > Alsa-devel mailing list > alsa-de...@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] pata_isapnp: Don't use invalid I/O ports
On Sunday 22 September 2013 18:49:42 Tejun Heo wrote: > Hello, Ondrej. > > On Fri, Sep 13, 2013 at 11:44:27PM +0200, Ondrej Zary wrote: > > This is caused by skipping ata_sff_softreset() when ap->ioaddr.ctl_addr > > is unset so ata_devchk() is never called. This patch seems to fix the > > problem. Is it OK or can it cause more problems? > > > > --- a/drivers/ata/libata-sff.c > > +++ b/drivers/ata/libata-sff.c > > @@ -2008,13 +2008,15 @@ static int ata_bus_softreset(struct ata_port *ap, > > unsigned int devmask, > > > > DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); > > > > - /* software reset. causes dev0 to be selected */ > > - iowrite8(ap->ctl, ioaddr->ctl_addr); > > - udelay(20); /* FIXME: flush */ > > - iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); > > - udelay(20); /* FIXME: flush */ > > - iowrite8(ap->ctl, ioaddr->ctl_addr); > > - ap->last_ctl = ap->ctl; > > + if (ap->ioaddr.ctl_addr) { > > + /* software reset. causes dev0 to be selected */ > > + iowrite8(ap->ctl, ioaddr->ctl_addr); > > + udelay(20); /* FIXME: flush */ > > + iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); > > + udelay(20); /* FIXME: flush */ > > + iowrite8(ap->ctl, ioaddr->ctl_addr); > > + ap->last_ctl = ap->ctl; > > + } > > > > /* wait the port to become ready */ > > return ata_sff_wait_after_reset(&ap->link, devmask, deadline); > > @@ -2215,10 +2217,6 @@ void ata_sff_error_handler(struct ata_port *ap) > > > > spin_unlock_irqrestore(ap->lock, flags); > > > > - /* ignore ata_sff_softreset if ctl isn't accessible */ > > - if (softreset == ata_sff_softreset && !ap->ioaddr.ctl_addr) > > - softreset = NULL; > > - > > /* ignore built-in hardresets if SCR access is not available */ > > if ((hardreset == sata_std_hardreset || > > hardreset == sata_sff_hardreset) && !sata_scr_valid(&ap->link)) > > Hmm... I'm unsure what to do with these patches. It's a mostly dead > driver, so I don't wanna mess with it too much unless it's an obvious > fix. What hardware are you playing with? IMHO, the first patch (invalid I/O ports) is an obvious fix. That bug causes problems with ES968 sound cards. The second patch is not-so-obvious. Only few ATA controllers don't have control register, but they're all broken now. I'm not sure if the patch is 100% correct but it seems to work fine and it does not affect most controllers. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] pata_isapnp: Don't use invalid I/O ports
On Monday 23 September 2013 15:00:42 Tejun Heo wrote: > On Mon, Sep 23, 2013 at 04:51:16PM +0400, Sergei Shtylyov wrote: > > >Applied to libata/for-3.13. > > > >Why only 3.13? Isn't it a simple fix? > > Hmmm, maybe, the driver is such low impact, I don't think it matters > either way; otherwise, it should be marked -stable too. It's a driver > which shouldn't be enabled by default by distros and I didn't think > it'd be worthwhile to create any traffic for it. That said, if > there's a reason this matters, I'd be happy to add -stable and push it > through ASAP. > > Thanks. At least Debian ships pata_isapnp.ko. Some distros probably stopped building the driver because it was broken. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[bisected] PS/2 keyboard and mouse dead on resume on Intel D845BG
Hello, Intel D845BG board comes out of S3 with PS/2 keyboard and mouse completely dead. The machine works otherwise (with USB keyboard or over network). When rebooted in this state, the BIOS hangs with blank screen. I have the latest BIOS installed (P08). Old kernels worked. Bisection pointed to commit: b6dacf63e9fb2e7a1369843d6cef332f76fca6a3 (ACPI: Unconditionally set SCI_EN on resume) Commenting out this line in drivers/acpi/sleep.c: acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); fixes the problem. Any ideas why this breaks on this system? -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [bisected] PS/2 keyboard and mouse dead on resume on Intel D845BG
On Sunday 07 October 2012 15:13:27 Ondrej Zary wrote: > Hello, > Intel D845BG board comes out of S3 with PS/2 keyboard and mouse completely > dead. The machine works otherwise (with USB keyboard or over network). When > rebooted in this state, the BIOS hangs with blank screen. I have the latest > BIOS installed (P08). > > Old kernels worked. Bisection pointed to commit: > b6dacf63e9fb2e7a1369843d6cef332f76fca6a3 > (ACPI: Unconditionally set SCI_EN on resume) > > Commenting out this line in drivers/acpi/sleep.c: > acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); > fixes the problem. > > Any ideas why this breaks on this system? Added acpi_read_bit_register there and it seems that SCI_EN is already set! This patch fixes the problem here. I wonder how this affects systems that require SCI_EN to be set. --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -271,6 +271,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) acpi_status status = AE_OK; u32 acpi_state = acpi_target_sleep_state; int error; + u32 sci_enabled; ACPI_FLUSH_CPU_CACHE(); @@ -289,7 +290,9 @@ static int acpi_suspend_enter(suspend_state_t pm_state) } /* This violates the spec but is required for bug compatibility. */ - acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); + acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &sci_enabled); + if (!sci_enabled) + acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); /* Reprogram control registers */ acpi_leave_sleep_state_prep(acpi_state); -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [bisected] PS/2 keyboard and mouse dead on resume on Intel D845BG
On Tuesday 09 October 2012, Len Brown wrote: > On 10/08/2012 10:42 AM, Matthew Garrett wrote: > > On Sun, Oct 07, 2012 at 09:00:09PM +0200, Ondrej Zary wrote: > >> Added acpi_read_bit_register there and it seems that SCI_EN is already > >> set! > >> > >> This patch fixes the problem here. I wonder how this affects systems > >> that require SCI_EN to be set. > > > > I /think/ that this will be safe, but it doesn't match my recollection > > of how Windows behaves so it may break something. Any chance you can > > find someone with one of the machines mentioned in > > https://bugzilla.kernel.org/show_bug.cgi?id=13745 and make sure that > > they still work with your patch? > > yikes. > we started with a white-list, > then we made setting SCI_EN the default, > and here is at least one box that wants to be on a black list > so that we don't set SCI_EN:-( I wonder what Windows does here. Haven't tested it on this machine but I assume that it works. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [3.5 regression / mcs7830 / bisected] bridge constantly toggeling between disabled and forwarding
On Tuesday 09 October 2012, Michael Leun wrote: > On Thu, 27 Sep 2012 10:39:05 -0700 > > Greg KH wrote: > > On Tue, Jul 24, 2012 at 01:36:34AM +0200, Michael Leun wrote: > > > On Mon, 23 Jul 2012 09:15:04 +0200 > > > Michael Leun wrote: > > > > > > [see issue description below] > > > > > > Bisecting yielded > > > > > > b1ff4f96fd1c63890d78d8939c6e0f2b44ce3113 is the first bad commit > > > commit b1ff4f96fd1c63890d78d8939c6e0f2b44ce3113 > > > Author: Ondrej Zary > > > Date: Fri Jun 1 10:29:08 2012 + > > > > > > mcs7830: Implement link state detection > > > > > > Add .status callback that detects link state changes. > > > Tested with MCS7832CV-AA chip (9710:7830, identified as rev.C > > > by the driver). Fixes > > > https://bugzilla.kernel.org/show_bug.cgi?id=28532 > > > > > > Signed-off-by: Ondrej Zary > > > Signed-off-by: David S. Miller > > > > > > :04 04 5480780cb5e75c57122a621fc3bab0108c16be27 > > > > > > d97efd9cc0a465dff76bcd3a3c547f718f2a5345 Mdrivers > > > > > > > > > Reverting that from 3.5 makes the issue go away. > > > > Did this ever get resolved in 3.6-rc7 or any older kernel? I can't > > revert the patch from 3.5.y unless it's also fixed in Linus's tree. > > Please excuse me for answering a bit late. > > No, that never got resolved, I still have the problem with 3.6 but I'm > not shure about the correct solution. > > Maybe link state detection just does not work with some of that devices > and we should have an possibility to enable/disable it per device, > maybe it can be handeled with an blacklist of not working devices, > maybe it could be fixed - I do not know and also do not know how to > find out. > > But I'm willing to test. Does the problem appear only in a bridge? Or the link state detection is completely wrong? -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [3.5 regression / mcs7830 / bisected] bridge constantly toggeling between disabled and forwarding
On Tuesday 09 October 2012, Michael Leun wrote: > On Thu, 27 Sep 2012 10:39:05 -0700 > > Greg KH wrote: > > On Tue, Jul 24, 2012 at 01:36:34AM +0200, Michael Leun wrote: > > > On Mon, 23 Jul 2012 09:15:04 +0200 > > > Michael Leun wrote: > > > > > > [see issue description below] > > > > > > Bisecting yielded > > > > > > b1ff4f96fd1c63890d78d8939c6e0f2b44ce3113 is the first bad commit > > > commit b1ff4f96fd1c63890d78d8939c6e0f2b44ce3113 > > > Author: Ondrej Zary > > > Date: Fri Jun 1 10:29:08 2012 + > > > > > > mcs7830: Implement link state detection > > > > > > Add .status callback that detects link state changes. > > > Tested with MCS7832CV-AA chip (9710:7830, identified as rev.C > > > by the driver). Fixes > > > https://bugzilla.kernel.org/show_bug.cgi?id=28532 > > > > > > Signed-off-by: Ondrej Zary > > > Signed-off-by: David S. Miller > > > > > > :04 04 5480780cb5e75c57122a621fc3bab0108c16be27 > > > > > > d97efd9cc0a465dff76bcd3a3c547f718f2a5345 Mdrivers > > > > > > > > > Reverting that from 3.5 makes the issue go away. > > > > Did this ever get resolved in 3.6-rc7 or any older kernel? I can't > > revert the patch from 3.5.y unless it's also fixed in Linus's tree. > > Please excuse me for answering a bit late. > > No, that never got resolved, I still have the problem with 3.6 but I'm > not shure about the correct solution. > > Maybe link state detection just does not work with some of that devices > and we should have an possibility to enable/disable it per device, > maybe it can be handeled with an blacklist of not working devices, > maybe it could be fixed - I do not know and also do not know how to > find out. > > But I'm willing to test. Can you please apply this debug patch and provide the output? --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c @@ -638,6 +638,7 @@ static void mcs7830_status(struct usbnet *dev, struct urb *urb) return; link = !(buf[1] & 0x20); + printk("netif_carrier_ok=%d, link=%d, buf[0]=0x%02x, buf[1]=0x%02x\n", netif_carrier_ok(dev->net), link, buf[0], buf[1]); if (netif_carrier_ok(dev->net) != link) { if (link) { netif_carrier_on(dev->net); -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] staging: ft1000: unify struct ft1000_info between USB and PCMCIA drivers
Unify struct ft1000_info between ft1000-usb and ft1000-pcmcia and move it to common ft1000.h. Signed-off-by: Ondrej Zary --- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 33 +- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 21 ++- drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c | 10 +- drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 147 ++-- .../staging/ft1000/ft1000-usb/ft1000_download.c| 70 +- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 100 +++--- drivers/staging/ft1000/ft1000-usb/ft1000_proc.c|4 +- drivers/staging/ft1000/ft1000-usb/ft1000_usb.c | 30 ++-- drivers/staging/ft1000/ft1000-usb/ft1000_usb.h | 54 +-- drivers/staging/ft1000/ft1000.h| 35 + 10 files changed, 238 insertions(+), 266 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h index adb436e..65f7ab6 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h @@ -31,41 +31,10 @@ #define SUCCESS0x00 #define FAILURE0x01 -struct ft1000_info { - struct net_device_stats stats; - u16 DrvErrNum; - u16 AsicID; +struct ft1000_pcmcia { int PktIntfErr; - int CardReady; - int registered; - int mediastate; u16 packetseqnum; - u8 squeseqnum; /* sequence number on slow queue */ - spinlock_t dpram_lock; - u16 fifo_cnt; - u8 DspVer[DSPVERSZ];/* DSP version number */ - u8 HwSerNum[HWSERNUMSZ];/* Hardware Serial Number */ - u8 Sku[SKUSZ]; /* SKU */ - u8 eui64[EUISZ];/* EUI64 */ - time_t ConTm; /* Connection Time */ - u16 LedStat; - u16 ConStat; - u16 ProgConStat; - u8 ProductMode[MODESZ]; - u8 RfCalVer[CALVERSZ]; - u8 RfCalDate[CALDATESZ]; - u16 DSP_TIME[4]; - struct list_head prov_list; - u16 DSPInfoBlklen; - int (*ft1000_reset)(void *); void *link; - u16 DSPInfoBlk[MAX_DSP_SESS_REC]; - union { - u16 Rec[MAX_DSP_SESS_REC]; - u32 MagRec[MAX_DSP_SESS_REC/2]; - } DSPSess; - struct proc_dir_entry *proc_ft1000; - char netdevname[IFNAMSIZ]; }; struct pcmcia_device; diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index 86a680c..3fd499f 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -328,11 +328,12 @@ static void ft1000_disable_interrupts(struct net_device *dev) static void ft1000_reset_asic(struct net_device *dev) { struct ft1000_info *info = netdev_priv(dev); + struct ft1000_pcmcia *pcmcia = info->priv; u16 tempword; DEBUG(1, "ft1000_hw:ft1000_reset_asic called\n"); - (*info->ft1000_reset) (info->link); + (*info->ft1000_reset) (pcmcia->link); // Let's use the register provided by the Magnemite ASIC to reset the // ASIC and DSP. @@ -1397,12 +1398,13 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) { struct ft1000_info *info = netdev_priv(dev); + struct ft1000_pcmcia *pcmcia = info->priv; u16 i; u32 templong; u16 tempword; DEBUG(1, "ft1000:ft1000_hw:ft1000_flush_fifo called\n"); - if (info->PktIntfErr > MAX_PH_ERR) { + if (pcmcia->PktIntfErr > MAX_PH_ERR) { if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = ft1000_read_dpram(dev, FT1000_DSP_TIMER0); @@ -1491,7 +1493,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) FIFO_FLUSH_BADCNT; } else { // Let's assume that we really flush the FIFO - info->PktIntfErr++; + pcmcia->PktIntfErr++; return; } } else { @@ -1522,7 +1524,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) DEBUG(0, "FT1000_REG_MAG_DFSR = 0x%x\n", tempword); } if (DrvErrNum) { - info->PktIntfErr++; + pcmcia->PktIntfErr++; } } } @@ -1731,6 +1733,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev) static int ft1000_copy_dow
[PATCH] staging: ft1000: rename struct ft1000_device to ft1000_usb
After unifying struct ft1000_info, struct ft1000_device is now wrong name. Rename it to ft1000_usb to match its semantics. Signed-off-by: Ondrej Zary --- drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 12 ++-- .../staging/ft1000/ft1000-usb/ft1000_download.c| 40 +- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 78 ++-- drivers/staging/ft1000/ft1000-usb/ft1000_proc.c|2 +- drivers/staging/ft1000/ft1000-usb/ft1000_usb.c |6 +- drivers/staging/ft1000/ft1000-usb/ft1000_usb.h | 30 6 files changed, 84 insertions(+), 84 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c index fb197ab..297389e 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c @@ -137,7 +137,7 @@ void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist) // Notes: Only called by init_module(). // //--- -int ft1000_create_dev(struct ft1000_device *dev) +int ft1000_create_dev(struct ft1000_usb *dev) { int result; int i; @@ -227,7 +227,7 @@ fail: void ft1000_destroy_dev(struct net_device *netdev) { struct ft1000_info *info = netdev_priv(netdev); - struct ft1000_device *dev = info->priv; + struct ft1000_usb *dev = info->priv; int i; struct dpram_blk *pdpram_blk; struct dpram_blk *ptr; @@ -292,7 +292,7 @@ void ft1000_destroy_dev(struct net_device *netdev) static int ft1000_open (struct inode *inode, struct file *file) { struct ft1000_info *info; - struct ft1000_device *dev = (struct ft1000_device *)inode->i_private; + struct ft1000_usb *dev = (struct ft1000_usb *)inode->i_private; int i,num; DEBUG("%s called\n", __func__); @@ -349,7 +349,7 @@ static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait) { struct net_device *netdev = file->private_data; struct ft1000_info *info = netdev_priv(netdev); - struct ft1000_device *dev = info->priv; + struct ft1000_usb *dev = info->priv; int i; //DEBUG("ft1000_poll_dev called\n"); @@ -398,7 +398,7 @@ static long ft1000_ioctl (struct file *file, unsigned int command, { void __user *argp = (void __user *)argument; struct ft1000_info *info; -struct ft1000_device *ft1000dev; +struct ft1000_usb *ft1000dev; int result=0; int cmd; int i; @@ -740,7 +740,7 @@ static int ft1000_release (struct inode *inode, struct file *file) { struct ft1000_info *info; struct net_device *dev; -struct ft1000_device *ft1000dev; +struct ft1000_usb *ft1000dev; int i; struct dpram_blk *pdpram_blk; diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c index cc00e94..5190c8a 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c @@ -114,7 +114,7 @@ struct dsp_image_info { //--- // Function:check_usb_db // -// Parameters: struct ft1000_device - device structure +// Parameters: struct ft1000_usb - device structure // // Returns: 0 - success // @@ -123,7 +123,7 @@ struct dsp_image_info { // Notes: // //--- -static u32 check_usb_db (struct ft1000_device *ft1000dev) +static u32 check_usb_db (struct ft1000_usb *ft1000dev) { int loopcnt; u16 temp; @@ -172,7 +172,7 @@ static u32 check_usb_db (struct ft1000_device *ft1000dev) //--- // Function:get_handshake // -// Parameters: struct ft1000_device - device structure +// Parameters: struct ft1000_usb - device structure // u16 expected_value - the handshake value expected // // Returns: handshakevalue - success @@ -183,7 +183,7 @@ static u32 check_usb_db (struct ft1000_device *ft1000dev) // Notes: // //--- -static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value) +static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 expected_value) { u16 handshake; int loopcnt; @@ -232,7 +232,7 @@ static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value) //--- // Function:put_handshake // -// Parameters: struct ft1000_device - device structure +// Parameters: struct ft1000_usb - device structure // u16 handshake_value - handshake to be written // // Returns: none @@ -243,7 +243,7 @@ stat
Re: [alsa-devel] [PATCH 5/5] snd-ice1712: Fix resume on ice1724
On Wednesday 17 October 2012 08:57:39 Takashi Iwai wrote: > At Sun, 14 Oct 2012 21:09:23 +0200, > > Ondrej Zary wrote: > > set_pro_rate() is called from hw_params() but not from prepare(), > > breaking running PCM on suspend/resume. Call it from prepare() if PCM was > > suspended to fix the problem. > > > > Signed-off-by: Ondrej Zary > > This should be fixed in the resume callback. Could you check the > patch below instead? Now I'm confused. This patch does not work with mplayer+dmix. And my patch doesn't either... When mplayer is set to s32le (without dmix), it works fine without this or my patch. Also aplay seems to work without these patches. I bet that when I tested my patch before, it fixed some real problem. But I'm now unable to reproduce that... > thanks, > > Takashi > > --- > diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c > index 161c8f6..5cc3fa5 100644 > --- a/sound/pci/ice1712/ice1724.c > +++ b/sound/pci/ice1712/ice1724.c > @@ -2867,7 +2867,12 @@ static int snd_vt1724_resume(struct device *dev) > ice->set_spdif_clock(ice, 0); > } else { > /* internal on-card clock */ > - snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1); > + int rate; > + if (ice->cur_rate) > + rate = ice->cur_rate; > + else > + rate = ice->pro_rate_default; > + snd_vt1724_set_pro_rate(ice, rate, 1); > } > > update_spdif_bits(ice, ice->pm_saved_spdif_ctrl); > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3] Enable A20 using KBC for some MSI laptops to fix S3 resume
On Monday 10 December 2012 22:26:18 H. Peter Anvin wrote: > On 11/05/2012 12:35 PM, Ondrej Zary wrote: > > On Friday 26 October 2012 10:56:44 Ondrej Zary wrote: > >> Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to enable > >> A20 line but resume code assumes that KBC was used. > >> The laptop will not resume from S3 otherwise but powers off after a > >> while and then powers on again stuck with a blank screen. > >> > >> Fix it by enabling A20 using KBC. Affected laptop list and DMI data are > >> from bug reports at Ubuntu Launchpad. > >> > >> Also add kernel parameter to easily activate this quirk on any system. > >> > >> Only compile tested. The original patch was tested with EX600 and PR200. > >> > >> Fixes https://bugzilla.kernel.org/show_bug.cgi?id=12878 > > > > The bug was marked as RESOLVED CODE_FIX but I wonder what happened to > > this patch. Was it applied? Or is someone working on a better way to fix > > this problem? > > Sorry, I managed to forget about this. > > Is there any way you could test this patch by any chance? > > I would be a lot happier if this works as a general solution rather than > relying on a quirk... I have a PR200 laptop for a while now so I'll try to test this patch. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3] Enable A20 using KBC for some MSI laptops to fix S3 resume
On Monday 10 December 2012 22:26:18 H. Peter Anvin wrote: > On 11/05/2012 12:35 PM, Ondrej Zary wrote: > > On Friday 26 October 2012 10:56:44 Ondrej Zary wrote: > >> Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to enable > >> A20 line but resume code assumes that KBC was used. > >> The laptop will not resume from S3 otherwise but powers off after a > >> while and then powers on again stuck with a blank screen. > >> > >> Fix it by enabling A20 using KBC. Affected laptop list and DMI data are > >> from bug reports at Ubuntu Launchpad. > >> > >> Also add kernel parameter to easily activate this quirk on any system. > >> > >> Only compile tested. The original patch was tested with EX600 and PR200. > >> > >> Fixes https://bugzilla.kernel.org/show_bug.cgi?id=12878 > > > > The bug was marked as RESOLVED CODE_FIX but I wonder what happened to > > this patch. Was it applied? Or is someone working on a better way to fix > > this problem? > > Sorry, I managed to forget about this. > > Is there any way you could test this patch by any chance? I've just tested the patch and it does not work (no change in behavior). > I would be a lot happier if this works as a general solution rather than > relying on a quirk... As I said before, the BIOS probably breaks on resume before any Linux code is executed. So any fix must be done before suspending. I hate quirks too. A general solution would be to always enable A20 using KBC (if KBC is present) but that's probably not acceptable. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3] Enable A20 using KBC for some MSI laptops to fix S3 resume
On Tuesday 11 December 2012 20:07:50 H. Peter Anvin wrote: > On 12/11/2012 10:59 AM, Ondrej Zary wrote: > > As I said before, the BIOS probably breaks on resume before any Linux > > code is executed. So any fix must be done before suspending. > > Well, that code should be independent of A20, being in low memory, but > if the BIOS itself crashes, then that's... yeah. > > > I hate quirks too. A general solution would be to always enable A20 using > > KBC (if KBC is present) but that's probably not acceptable. > > I don't see why not. If so we could just do it as part of the > initialization of the i8042 driver. Something like this? (It works.) diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index d6cc77a..0807ac7 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h @@ -921,6 +921,7 @@ static int __init i8042_platform_init(void) int retval; #ifdef CONFIG_X86 + u8 a20_on = 0xdf; /* Just return if pre-detection shows no i8042 controller exist */ if (!x86_platform.i8042_detect()) return -ENODEV; @@ -960,6 +961,13 @@ static int __init i8042_platform_init(void) if (dmi_check_system(i8042_dmi_dritek_table)) i8042_dritek = true; + + /* +* A20 was already enabled during early kernel init. But some buggy +* BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to +* resume from S3. So we do it here and hope that nothing breaks. +*/ + i8042_command(&a20_on, 0x10d1); #endif /* CONFIG_X86 */ return retval; -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3] Enable A20 using KBC for some MSI laptops to fix S3 resume
On Tuesday 11 December 2012 21:36:46 H. Peter Anvin wrote: > On 12/11/2012 12:29 PM, Ondrej Zary wrote: > > Something like this? (It works.) > > Something like that. We need to make sure we send the proper sequence, > though, or it might break some SMM firmware... Could you please create proper patch? You're the x86 expert (and I'm not). I've read that 0xd1 command with 0xdf data is often used to enable A20. But I don't know when this must be done or what else needs to be done for the SMM to not break. > > diff --git a/drivers/input/serio/i8042-x86ia64io.h > > b/drivers/input/serio/i8042-x86ia64io.h index d6cc77a..0807ac7 100644 > > --- a/drivers/input/serio/i8042-x86ia64io.h > > +++ b/drivers/input/serio/i8042-x86ia64io.h > > @@ -921,6 +921,7 @@ static int __init i8042_platform_init(void) > > int retval; > > > > #ifdef CONFIG_X86 > > + u8 a20_on = 0xdf; > > /* Just return if pre-detection shows no i8042 controller exist */ > > if (!x86_platform.i8042_detect()) > > return -ENODEV; > > @@ -960,6 +961,13 @@ static int __init i8042_platform_init(void) > > > > if (dmi_check_system(i8042_dmi_dritek_table)) > > i8042_dritek = true; > > + > > + /* > > +* A20 was already enabled during early kernel init. But some buggy > > +* BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to > > +* resume from S3. So we do it here and hope that nothing breaks. > > +*/ > > + i8042_command(&a20_on, 0x10d1); > > #endif /* CONFIG_X86 */ > > > > return retval; -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4] 8042: Enable A20 using KBC to fix S3 resume on some MSI laptops
Some MSI laptop BIOSes are broken - INT 15h code uses port 92h to enable A20 line but resume code assumes that KBC was used. The laptop will not resume from S3 otherwise but powers off after a while and then powers on again stuck with a blank screen. Fix it by enabling A20 using KBC in i8042_platform_init for x86. Fixes https://bugzilla.kernel.org/show_bug.cgi?id=12878 Signed-off-by: Ondrej Zary --- drivers/input/serio/i8042-x86ia64io.h |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index d6cc77a..5f306f7 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h @@ -921,6 +921,7 @@ static int __init i8042_platform_init(void) int retval; #ifdef CONFIG_X86 + u8 a20_on = 0xdf; /* Just return if pre-detection shows no i8042 controller exist */ if (!x86_platform.i8042_detect()) return -ENODEV; @@ -960,6 +961,14 @@ static int __init i8042_platform_init(void) if (dmi_check_system(i8042_dmi_dritek_table)) i8042_dritek = true; + + /* +* A20 was already enabled during early kernel init. But some buggy +* BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to +* resume from S3. So we do it here and hope that nothing breaks. +*/ + i8042_command(&a20_on, 0x10d1); + i8042_command(NULL, 0x00ff);/* Null command for SMM firmware */ #endif /* CONFIG_X86 */ return retval; -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC, RFT] [PATCH] staging: ft1000: unify struct ft1000_info between USB and PCMCIA drivers
On Monday 12 November 2012, Belisko Marek wrote: > Hi Ondrej, > > On Fri, Nov 9, 2012 at 10:42 PM, Ondrej Zary wrote: > > Unify struct ft1000_info between ft1000-usb and ft1000-pcmcia and move it > > to common ft1000.h. > > > > ft1000-pcmcia seems to work. Please test ft1000-usb. > > > > Signed-off-by: Ondrej Zary > > --- > > drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 33 +- > > drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 21 ++- > > drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c | 10 +- > > drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 147 > > ++-- .../staging/ft1000/ft1000-usb/ft1000_download.c| > > 70 +- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 99 > > +++--- drivers/staging/ft1000/ft1000-usb/ft1000_proc.c|4 > > +- > > drivers/staging/ft1000/ft1000-usb/ft1000_usb.c | 30 ++-- > > drivers/staging/ft1000/ft1000-usb/ft1000_usb.h | 54 +-- > > drivers/staging/ft1000/ft1000.h| 35 + > > 10 files changed, 236 insertions(+), 267 deletions(-) > > > > diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h > > b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h index adb436e..65f7ab6 > > 100644 > > --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h > > +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h > > @@ -31,41 +31,10 @@ > > #define SUCCESS0x00 > > #define FAILURE0x01 > > > > -struct ft1000_info { > > - struct net_device_stats stats; > > - u16 DrvErrNum; > > - u16 AsicID; > > +struct ft1000_pcmcia { > > To be consistent can you please name also usb part not ft100_device > but e.g. ft1000_usb or something? Yes, that's a good idea. I'd like to do that in a separate patch, this one is already big enough. > > @@ -1179,8 +1179,6 @@ static int ft1000_open(struct net_device *dev) > > struct ft1000_info *pInfo = netdev_priv(dev); > > struct timeval tv; > > > > - DEBUG("ft1000_open is called for card %d\n", pInfo->CardNumber); > > ^^^ Why removing this debug? I don't remember exactly (this is from an old patch) but probably because I didn't want to add code to reach CardNumber (which should be removed too). The debug messages are a mess, some are completely useless, some should be non-debug instead. If you have the USB hardware, please test if this patch does not break anything. I have only a PCMCIA card. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch] ALSA: es1968: precedence bug in snd_es1968_tea575x_get_pins()
On Tuesday 13 November 2012 08:44:54 Dan Carpenter wrote: > I don't think this works as intended. '|' higher precedence than ?: so > the bitwize OR "0 | (val & STR_MOST)" is a no-op. > > I have re-written it to be more clear. > > Signed-off-by: Dan Carpenter > --- > I don't have a way to test this. Thanks for the patch. I tested it and it works. The same way as without the patch...weird. DATA pin reading works because that's required for the chip detection. Stereo indication (MOST pin) works too. > > diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c > index 50169bc..7266020 100644 > --- a/sound/pci/es1968.c > +++ b/sound/pci/es1968.c > @@ -2581,9 +2581,14 @@ static u8 snd_es1968_tea575x_get_pins(struct > snd_tea575x *tea) struct es1968 *chip = tea->private_data; > unsigned long io = chip->io_port + GPIO_DATA; > u16 val = inw(io); > - > - return (val & STR_DATA) ? TEA575X_DATA : 0 | > - (val & STR_MOST) ? TEA575X_MOST : 0; > + u8 ret; > + > + ret = 0; > + if (val & STR_DATA) > + ret |= TEA575X_DATA; > + if (val & STR_MOST) > + ret |= TEA575X_MOST; > + return ret; > } > > static void snd_es1968_tea575x_set_direction(struct snd_tea575x *tea, bool > output) -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC, RFT] [PATCH] staging: ft1000: unify struct ft1000_info between USB and PCMCIA drivers
Unify struct ft1000_info between ft1000-usb and ft1000-pcmcia and move it to common ft1000.h. ft1000-pcmcia seems to work. Please test ft1000-usb. Signed-off-by: Ondrej Zary --- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 33 +- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 21 ++- drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c | 10 +- drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 147 ++-- .../staging/ft1000/ft1000-usb/ft1000_download.c| 70 +- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 99 +++--- drivers/staging/ft1000/ft1000-usb/ft1000_proc.c|4 +- drivers/staging/ft1000/ft1000-usb/ft1000_usb.c | 30 ++-- drivers/staging/ft1000/ft1000-usb/ft1000_usb.h | 54 +-- drivers/staging/ft1000/ft1000.h| 35 + 10 files changed, 236 insertions(+), 267 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h index adb436e..65f7ab6 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h @@ -31,41 +31,10 @@ #define SUCCESS0x00 #define FAILURE0x01 -struct ft1000_info { - struct net_device_stats stats; - u16 DrvErrNum; - u16 AsicID; +struct ft1000_pcmcia { int PktIntfErr; - int CardReady; - int registered; - int mediastate; u16 packetseqnum; - u8 squeseqnum; /* sequence number on slow queue */ - spinlock_t dpram_lock; - u16 fifo_cnt; - u8 DspVer[DSPVERSZ];/* DSP version number */ - u8 HwSerNum[HWSERNUMSZ];/* Hardware Serial Number */ - u8 Sku[SKUSZ]; /* SKU */ - u8 eui64[EUISZ];/* EUI64 */ - time_t ConTm; /* Connection Time */ - u16 LedStat; - u16 ConStat; - u16 ProgConStat; - u8 ProductMode[MODESZ]; - u8 RfCalVer[CALVERSZ]; - u8 RfCalDate[CALDATESZ]; - u16 DSP_TIME[4]; - struct list_head prov_list; - u16 DSPInfoBlklen; - int (*ft1000_reset)(void *); void *link; - u16 DSPInfoBlk[MAX_DSP_SESS_REC]; - union { - u16 Rec[MAX_DSP_SESS_REC]; - u32 MagRec[MAX_DSP_SESS_REC/2]; - } DSPSess; - struct proc_dir_entry *proc_ft1000; - char netdevname[IFNAMSIZ]; }; struct pcmcia_device; diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index 86a680c..3fd499f 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -328,11 +328,12 @@ static void ft1000_disable_interrupts(struct net_device *dev) static void ft1000_reset_asic(struct net_device *dev) { struct ft1000_info *info = netdev_priv(dev); + struct ft1000_pcmcia *pcmcia = info->priv; u16 tempword; DEBUG(1, "ft1000_hw:ft1000_reset_asic called\n"); - (*info->ft1000_reset) (info->link); + (*info->ft1000_reset) (pcmcia->link); // Let's use the register provided by the Magnemite ASIC to reset the // ASIC and DSP. @@ -1397,12 +1398,13 @@ static int ft1000_parse_dpram_msg(struct net_device *dev) static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) { struct ft1000_info *info = netdev_priv(dev); + struct ft1000_pcmcia *pcmcia = info->priv; u16 i; u32 templong; u16 tempword; DEBUG(1, "ft1000:ft1000_hw:ft1000_flush_fifo called\n"); - if (info->PktIntfErr > MAX_PH_ERR) { + if (pcmcia->PktIntfErr > MAX_PH_ERR) { if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = ft1000_read_dpram(dev, FT1000_DSP_TIMER0); @@ -1491,7 +1493,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) FIFO_FLUSH_BADCNT; } else { // Let's assume that we really flush the FIFO - info->PktIntfErr++; + pcmcia->PktIntfErr++; return; } } else { @@ -1522,7 +1524,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) DEBUG(0, "FT1000_REG_MAG_DFSR = 0x%x\n", tempword); } if (DrvErrNum) { - info->PktIntfErr++; + pcmcia->PktIntfErr++; } } } @@ -1731,6 +1733,7 @@ static int ft1000_copy_up_pkt(struc
[PATCH] snd-ice1712: enable suspend on unknown ICE1724 cards
Assume that unknown ICE1724-based cards are AC97-only that can suspend without any additional card-specific code. This fixes suspend on Gainward Hollywood@Home 7.1. Signed-off-by: Ondrej Zary --- sound/pci/ice1712/ice1724.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 5cc3fa5..aebd584 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -2363,6 +2363,8 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, } printk(KERN_WARNING "ice1724: No matching model found for ID 0x%x\n", ice->eeprom.subvendor); + /* assume AC97-only card which can suspend without additional code */ + ice->pm_suspend_enabled = 1; found: ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04); -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] x86: Fix AMD K6 indirect call check v2
On Monday 22 April 2013, Wolfram Gloger wrote: > Hi, > > >Yeah, I was thinking of asking my old contacts about it but it is simply > >not worth it. Those CPUs are on their way to the museum if they're not > >there already. > > I have a perfectly running K6 system (the legendary K6-III I believe), > though I am about to have it taken to recycling. > If you want anything tested, I can still do it this week. This bug was present on the original K6 only, not K6-2 or K6-3. I think that I have a K6 somewhere but I doubt that it's one of the early buggy ones. Here are the details: http://membres.multimania.fr/poulot/k6bug_faq.html -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [resend] snd-es1968: Add radio support for MediaForte M56VAP
Add support for TEA5757 tuner on MediaForte M56VAP sound+modem+radio card. The GPIO connection type is automatically detected (like snd-fm801 driver). Also add a safety subsystem vendor check to skip radio detection if vendor differs from ESS (so we don't touch GPIOs on laptops). Tested with SF64-PCE2 and M56VAP cards. Signed-off-by: Ondrej Zary --- sound/pci/es1968.c | 73 +++ 1 files changed, 50 insertions(+), 23 deletions(-) diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index a1f32b5..db08641 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -564,6 +564,7 @@ struct es1968 { #ifdef CONFIG_SND_ES1968_RADIO struct v4l2_device v4l2_dev; struct snd_tea575x tea; + unsigned int tea575x_tuner; #endif }; @@ -2557,37 +2558,47 @@ static int snd_es1968_input_register(struct es1968 *chip) bits 1=unmask write to given bit */ #define IO_DIR 8 /* direction register offset from GPIO_DATA bits 0/1=read/write direction */ -/* mask bits for GPIO lines */ -#define STR_DATA 0x0040 /* GPIO6 */ -#define STR_CLK0x0080 /* GPIO7 */ -#define STR_WREN 0x0100 /* GPIO8 */ -#define STR_MOST 0x0200 /* GPIO9 */ + +/* GPIO to TEA575x maps */ +struct snd_es1968_tea575x_gpio { + u8 data, clk, wren, most; + char *name; +}; + +static struct snd_es1968_tea575x_gpio snd_es1968_tea575x_gpios[] = { + { .data = 6, .clk = 7, .wren = 8, .most = 9, .name = "SF64-PCE2" }, + { .data = 7, .clk = 8, .wren = 6, .most = 10, .name = "M56VAP" }, +}; + +#define get_tea575x_gpio(chip) \ + (&snd_es1968_tea575x_gpios[(chip)->tea575x_tuner]) + static void snd_es1968_tea575x_set_pins(struct snd_tea575x *tea, u8 pins) { struct es1968 *chip = tea->private_data; - unsigned long io = chip->io_port + GPIO_DATA; + struct snd_es1968_tea575x_gpio gpio = *get_tea575x_gpio(chip); u16 val = 0; - val |= (pins & TEA575X_DATA) ? STR_DATA : 0; - val |= (pins & TEA575X_CLK) ? STR_CLK : 0; - val |= (pins & TEA575X_WREN) ? STR_WREN : 0; + val |= (pins & TEA575X_DATA) ? (1 << gpio.data) : 0; + val |= (pins & TEA575X_CLK) ? (1 << gpio.clk) : 0; + val |= (pins & TEA575X_WREN) ? (1 << gpio.wren) : 0; - outw(val, io); + outw(val, chip->io_port + GPIO_DATA); } static u8 snd_es1968_tea575x_get_pins(struct snd_tea575x *tea) { struct es1968 *chip = tea->private_data; - unsigned long io = chip->io_port + GPIO_DATA; - u16 val = inw(io); - u8 ret; + struct snd_es1968_tea575x_gpio gpio = *get_tea575x_gpio(chip); + u16 val = inw(chip->io_port + GPIO_DATA); + u8 ret = 0; - ret = 0; - if (val & STR_DATA) + if (val & (1 << gpio.data)) ret |= TEA575X_DATA; - if (val & STR_MOST) + if (val & (1 << gpio.most)) ret |= TEA575X_MOST; + return ret; } @@ -2596,13 +2607,18 @@ static void snd_es1968_tea575x_set_direction(struct snd_tea575x *tea, bool outpu struct es1968 *chip = tea->private_data; unsigned long io = chip->io_port + GPIO_DATA; u16 odir = inw(io + IO_DIR); + struct snd_es1968_tea575x_gpio gpio = *get_tea575x_gpio(chip); if (output) { - outw(~(STR_DATA | STR_CLK | STR_WREN), io + IO_MASK); - outw(odir | STR_DATA | STR_CLK | STR_WREN, io + IO_DIR); + outw(~((1 << gpio.data) | (1 << gpio.clk) | (1 << gpio.wren)), + io + IO_MASK); + outw(odir | (1 << gpio.data) | (1 << gpio.clk) | (1 << gpio.wren), + io + IO_DIR); } else { - outw(~(STR_CLK | STR_WREN | STR_DATA | STR_MOST), io + IO_MASK); - outw((odir & ~(STR_DATA | STR_MOST)) | STR_CLK | STR_WREN, io + IO_DIR); + outw(~((1 << gpio.clk) | (1 << gpio.wren) | (1 << gpio.data) | (1 << gpio.most)), + io + IO_MASK); + outw((odir & ~((1 << gpio.data) | (1 << gpio.most))) + | (1 << gpio.clk) | (1 << gpio.wren), io + IO_DIR); } } @@ -2772,6 +2788,9 @@ static int snd_es1968_create(struct snd_card *card, snd_card_set_dev(card, &pci->dev); #ifdef CONFIG_SND_ES1968_RADIO + /* don't play with GPIOs on laptops */ + if (chip->pci->subsystem_vendor != 0x125d) + goto no_radio; err = v4l2_device_register(&pci->dev, &chip->v4l2_dev); if (err < 0) { snd_es1968_free(chip); @@ -2781,10 +2800,18 @@ static int snd_es1968_create(struct snd_card *card
Re: SATA hdd refuses to reallocate a sector?
1048576 #define SECTOR_SIZE 512 int main(int argc, char *argv[]) { if (argc < 2) { fprintf(stderr, "Usage: %s [pos]\n", argv[0]); return 1; } int dev = open(argv[1], O_RDWR | O_DIRECT | O_SYNC); if (dev < 1) { perror("Unable to open device"); return 2; } posix_fadvise(dev, 0, 0, POSIX_FADV_RANDOM); off64_t startpos = 0, pos = 0; if (argc > 2) { sscanf(argv[2], "%lld", &startpos); } pos = startpos; char *buf = valloc(BLOCK_SIZE); char *zeros = valloc(SECTOR_SIZE); if (!buf || !zeros) { fprintf(stderr, "Memory allocation error\n"); return 2; } memset(zeros, 0, SECTOR_SIZE); time_t starttime = time(NULL); while (1) { printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); printf("Position: %lld B (%lld MiB, %lld GiB, sector %lld), rate %lld MiB/s", pos, pos / 1024 / 1024, pos / 1024 / 1024 / 1024, pos / SECTOR_SIZE, (pos - startpos) / 1024 / 1024 / ((time(NULL) - starttime) ? (time(NULL) - starttime) : 1) ); lseek64(dev, pos, SEEK_SET); int count = read(dev, buf, BLOCK_SIZE); if (count == 0) {/* EOF */ printf("End of disk\n"); break; } if (count < 0) { /* read error */ printf("\n"); perror("Read error"); printf("Examining %lld\n", pos); for (int i = 0; i < BLOCK_SIZE/SECTOR_SIZE; i++) { lseek64(dev, pos, SEEK_SET); if (read(dev, buf, SECTOR_SIZE) < SECTOR_SIZE) { printf("Unable to read at %lld, rewriting...", pos); lseek64(dev, pos, SEEK_SET); int result = write(dev, zeros, SECTOR_SIZE); if (result < 0) { printf("write error\n"); } else { lseek64(dev, pos, SEEK_SET); if (read(dev, buf, SECTOR_SIZE) < SECTOR_SIZE) printf("read error after rewrite\n"); else printf("OK\n"); } } pos += SECTOR_SIZE; } } else /* no error */ pos += count; } return 0; } -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: SATA hdd refuses to reallocate a sector?
On Monday 24 June 2013, Zdenek Kaspar wrote: > On 06/23/2013 12:19 PM, Pavel Machek wrote: > > Hi! > > > > This may very well be hw problem, but... > > > > I have error on sda4. I tried to make hdd reallocate it by writing > > zeros there, but it will not. Is there special kind of write that > > needs to be done to force reallocation? > > Hi Pavel, maybe smartctl -t long /dev/sda will do the trick reliable for > your drive.. It's a read-only test that ends with an error on the first bad sector. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: SATA hdd refuses to reallocate a sector?
On Wednesday 26 June 2013, James Bottomley wrote: > On Mon, 2013-06-24 at 08:18 -0400, Mark Lord wrote: > > And the SCSI stack in Linux has rather atrocious error handling. > > It lumps multiple requests together, and can fail the entire lot even > > if only a single sector is bad. > > That's rather misleading. SCSI doesn't lump anything together; it > handles the requests it was passed. For reads and writes through the > page cache, block will aggregate in the elevators, but you avoid that by > not using the page cache (O_DIRECT or SG_IO). Yes, it works fine with O_DIRECT - that's why hdd_realloc reads sector-by-sector when an error was detected. I'd also like to disable read retries but that does not seem to be possible. > For devices which report failing sectors correctly data up to the failed > sector is returned and the request is shortened and retried from the > failed sector on. If we get a second failure at the beginning (where > the previous bad sector was), then we give up. > > James -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Asus F5RL laptop unable to resume from S3 because of radeon module
Hello, resume from suspend-to-RAM (S3) on Asus F5RL laptop does not work. According to many reports found by Google, it was always been that and there is no fix or workaround. Did some tests: radeon module loaded (usual state): After "echo mem>/sys/power/state", the laptop suspends correctly (power LED blinks). When power button is pressed, power LED goes on and that's all. No more activity, machine is frozen completely. radeon module not loaded at all: Laptop resumes correctly (keyboard LED work, network works), only the LCD is blank (obviously). Loading radeon module now initializes the card properly: LCD goes on and console works. radeon module loaded (but fbcon module not loaded) and then unloaded: Machine freezes the same way as when the module is loaded. So it looks like the radeon module does some initialization that prevents resume from working. Hibernation works fine. Any ideas what to test or how to debug this? Details: 01:05.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] RC410M [Mobility Radeon Xpress 200M] [1002:5a62] (prog-if 00 [VGA controller]) Subsystem: ASUSTeK Computer Inc. Device [1043:1402] Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 10 Memory at c000 (32-bit, prefetchable) [size=256M] I/O ports at 9800 [size=256] Memory at fa8f (32-bit, non-prefetchable) [size=64K] Expansion ROM at fa8c [disabled] [size=128K] Capabilities: [50] Power Management version 2 Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit- Kernel driver in use: radeon [4.836009] [drm] radeon kernel modesetting enabled. [4.837169] [drm] initializing kernel modesetting (RS400 0x1002:0x5A62 0x1043:0x1402). [4.837251] [drm] register mmio base: 0xFA8F [4.837302] [drm] register mmio size: 65536 [4.837570] [drm] Generation 2 PCI interface, using max accessible memory [4.837653] radeon :01:05.0: VRAM: 128M 0x7800 - 0x7FFF (128M used) [4.837714] radeon :01:05.0: GTT: 512M 0x8000 - 0x9FFF [4.837787] [drm] Detected VRAM RAM=128M, BAR=256M [4.837839] [drm] RAM width 128bits DDR [4.839854] [TTM] Zone kernel: Available graphics memory: 444588 kiB [4.839907] [TTM] Zone highmem: Available graphics memory: 972784 kiB [4.839959] [TTM] Initializing pool allocator [4.840042] [drm] radeon: 128M of VRAM memory ready [4.840094] [drm] radeon: 512M of GTT memory ready. [4.840160] [drm] GART: num cpu pages 131072, num gpu pages 131072 [4.866905] [drm] radeon: 2 quad pipes, 1 z pipes initialized. [4.872945] [drm] PCIE GART of 512M enabled (table at 0x35A0). [4.873213] radeon :01:05.0: WB enabled [4.873301] radeon :01:05.0: fence driver on ring 0 use gpu addr 0x8000 and cpu addr 0xf592c000 [4.874929] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010). [4.874988] [drm] Driver supports precise vblank timestamp query. [4.875055] [drm] radeon: irq initialized. [4.875119] [drm] Loading R300 Microcode [4.962083] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [5.088150] ohci-pci: OHCI PCI platform driver [5.141799] [drm] radeon: ring at 0x80001000 [5.141883] [drm] ring test succeeded in 2 usecs [5.142064] spurious 8259A interrupt: IRQ7. [5.142073] [drm] ib test succeeded in 0 usecs [5.142317] [drm] Panel ID String: LPL [5.142370] [drm] Panel Size 1280x800 [5.166305] [drm] radeon legacy LVDS backlight initialized [5.166358] [drm] Radeon Display Connectors [5.166408] [drm] Connector 0: [5.166458] [drm] VGA-1 [5.166509] [drm] DDC: 0x68 0x68 0x68 0x68 0x68 0x68 0x68 0x68 [5.166560] [drm] Encoders: [5.166610] [drm] CRT1: INTERNAL_DAC2 [5.10] [drm] Connector 1: [5.166710] [drm] LVDS-1 [5.166760] [drm] DDC: 0x198 0x198 0x19c 0x19c 0x1a0 0x1a0 0x1a4 0x1a4 [5.166812] [drm] Encoders: [5.166862] [drm] LCD1: INTERNAL_LVDS [5.426968] [drm] fb mappable at 0xC004 [5.427026] [drm] vram apper at 0xC000 [5.427076] [drm] size 4096000 [5.427126] [drm] fb depth is 24 [5.427176] [drm]pitch is 5120 [5.427388] radeon :01:05.0: fb0: radeondrmfb frame buffer device [5.427442] radeon :01:05.0: registered panic notifier [5.427501] [drm] Initialized radeon 2.34.0 20080528 for 0000:01:05.0 on minor 0 -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Asus F5RL laptop unable to resume from S3 because of radeon module
On Thursday 22 August 2013 21:49:41 Deucher, Alexander wrote: > > -Original Message- > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > Sent: Thursday, August 22, 2013 2:18 PM > > To: Kernel development list > > Cc: Deucher, Alexander > > Subject: Asus F5RL laptop unable to resume from S3 because of radeon > > module > > > > Hello, > > resume from suspend-to-RAM (S3) on Asus F5RL laptop does not work. > > According to many reports found by Google, it was always been that and > > there > > is no fix or workaround. > > Make sure your kernel has this patch: > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c >ef1d00cd56f600121ad121875655ad410a001b8 Just tried latest git (3.11-rc6+) and the problem persists. > Alex > > > Did some tests: > > > > radeon module loaded (usual state): > > After "echo mem>/sys/power/state", the laptop suspends correctly (power > > LED > > blinks). When power button is pressed, power LED goes on and that's all. > > No more activity, machine is frozen completely. > > > > radeon module not loaded at all: > > Laptop resumes correctly (keyboard LED work, network works), only the LCD > > is > > blank (obviously). Loading radeon module now initializes the card > > properly: LCD goes on and console works. > > > > radeon module loaded (but fbcon module not loaded) and then unloaded: > > Machine freezes the same way as when the module is loaded. > > > > So it looks like the radeon module does some initialization that prevents > > resume from working. > > > > Hibernation works fine. > > > > Any ideas what to test or how to debug this? > > > > Details: > > 01:05.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. > > [AMD/ATI] RC410M [Mobility Radeon Xpress 200M] [1002:5a62] (prog-if 00 > > [VGA controller]) > > Subsystem: ASUSTeK Computer Inc. Device [1043:1402] > > Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 10 > > Memory at c000 (32-bit, prefetchable) [size=256M] > > I/O ports at 9800 [size=256] > > Memory at fa8f (32-bit, non-prefetchable) [size=64K] > > Expansion ROM at fa8c [disabled] [size=128K] > > Capabilities: [50] Power Management version 2 > > Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit- > > Kernel driver in use: radeon > > > > [4.836009] [drm] radeon kernel modesetting enabled. > > [4.837169] [drm] initializing kernel modesetting (RS400 0x1002:0x5A62 > > 0x1043:0x1402). > > [4.837251] [drm] register mmio base: 0xFA8F > > [4.837302] [drm] register mmio size: 65536 > > [4.837570] [drm] Generation 2 PCI interface, using max accessible > > memory [4.837653] radeon :01:05.0: VRAM: 128M 0x7800 > > - 0x7FFF (128M used) > > [4.837714] radeon :01:05.0: GTT: 512M 0x8000 - > > 0x9FFF > > [4.837787] [drm] Detected VRAM RAM=128M, BAR=256M > > [4.837839] [drm] RAM width 128bits DDR > > [4.839854] [TTM] Zone kernel: Available graphics memory: 444588 kiB > > [4.839907] [TTM] Zone highmem: Available graphics memory: 972784 kiB > > [4.839959] [TTM] Initializing pool allocator > > [4.840042] [drm] radeon: 128M of VRAM memory ready > > [4.840094] [drm] radeon: 512M of GTT memory ready. > > [4.840160] [drm] GART: num cpu pages 131072, num gpu pages 131072 > > [4.866905] [drm] radeon: 2 quad pipes, 1 z pipes initialized. > > [4.872945] [drm] PCIE GART of 512M enabled (table at > > 0x35A0). > > [4.873213] radeon :01:05.0: WB enabled > > [4.873301] radeon :01:05.0: fence driver on ring 0 use gpu addr > > 0x8000 and cpu addr 0xf592c000 > > [4.874929] [drm] Supports vblank timestamp caching Rev 1 > > (10.10.2010). [4.874988] [drm] Driver supports precise vblank > > timestamp query. [4.875055] [drm] radeon: irq initialized. > > [4.875119] [drm] Loading R300 Microcode > > [4.962083] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver > > [5.088150] ohci-pci: OHCI PCI platform driver > > [5.141799] [drm] radeon: ring at 0x80001000 > > [5.141883] [drm] ring test succeeded in 2 usecs > > [5.142064] spurious 8259A interrupt: IRQ7. > > [5.142073] [drm] ib test succeeded in 0 usecs > > [5.142317] [drm] Panel ID String: LPL > > [5.142370] [drm] Panel Size 1280x800
Re: Asus F5RL laptop unable to resume from S3 because of radeon module
On Thursday 22 August 2013 22:24:17 Deucher, Alexander wrote: > > -Original Message- > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > Sent: Thursday, August 22, 2013 4:00 PM > > To: Deucher, Alexander > > Cc: Kernel development list > > Subject: Re: Asus F5RL laptop unable to resume from S3 because of radeon > > module > > > > On Thursday 22 August 2013 21:49:41 Deucher, Alexander wrote: > > > > -Original Message- > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > Sent: Thursday, August 22, 2013 2:18 PM > > > > To: Kernel development list > > > > Cc: Deucher, Alexander > > > > Subject: Asus F5RL laptop unable to resume from S3 because of radeon > > > > module > > > > > > > > Hello, > > > > resume from suspend-to-RAM (S3) on Asus F5RL laptop does not work. > > > > According to many reports found by Google, it was always been that > > > > and there > > > > is no fix or workaround. > > > > > > Make sure your kernel has this patch: > > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/? > > >id=c ef1d00cd56f600121ad121875655ad410a001b8 > > > > Just tried latest git (3.11-rc6+) and the problem persists. > > You might try adding a quirk for your system in radeon_combios_asic_init() > in radeon_combios.c. You can try something like this for testing: > > diff --git a/drivers/gpu/drm/radeon/radeon_combios.c > b/drivers/gpu/drm/radeon/radeon_combios.c index 68ce360..0419a2c 100644 > --- a/drivers/gpu/drm/radeon/radeon_combios.c > +++ b/drivers/gpu/drm/radeon/radeon_combios.c > @@ -3398,6 +3398,8 @@ void radeon_combios_asic_init(struct drm_device *dev) > rdev->pdev->subsystem_device == 0x30ae) > return; > > + return; > + > /* DYN CLK 1 */ > table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE); > if (table) > > If that doesn't work, you'll probably have to track down where it's hanging > during resume, or compare registers before and after resume to see if it's > some particular state that's causing a problem. No change. Inserted "return -1;" before radeon_device_init() to radeon_driver_load_kms() - driver fails to load and resume works. Moved it (and changed to "r = -1; goto out;") a bit down before radeon_modeset_init() - driver fails to load and resume stopped working. > Alex > > > > Alex > > > > > > > Did some tests: > > > > > > > > radeon module loaded (usual state): > > > > After "echo mem>/sys/power/state", the laptop suspends correctly > > > > (power > > > > > > LED > > > > blinks). When power button is pressed, power LED goes on and that's > > > > all. No more activity, machine is frozen completely. > > > > > > > > radeon module not loaded at all: > > > > Laptop resumes correctly (keyboard LED work, network works), only the > > > > LCD > > > > > > is > > > > blank (obviously). Loading radeon module now initializes the card > > > > properly: LCD goes on and console works. > > > > > > > > radeon module loaded (but fbcon module not loaded) and then > > > > unloaded: > > > > Machine freezes the same way as when the module is loaded. > > > > > > > > So it looks like the radeon module does some initialization that > > > > prevents resume from working. > > > > > > > > Hibernation works fine. > > > > > > > > Any ideas what to test or how to debug this? > > > > > > > > Details: > > > > 01:05.0 VGA compatible controller [0300]: Advanced Micro Devices, > > > > Inc. [AMD/ATI] RC410M [Mobility Radeon Xpress 200M] [1002:5a62] > > > > (prog-if > > > > 00 > > > > > > [VGA controller]) > > > > Subsystem: ASUSTeK Computer Inc. Device [1043:1402] > > > > Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 10 > > > > Memory at c000 (32-bit, prefetchable) [size=256M] > > > > I/O ports at 9800 [size=256] > > > > Memory at fa8f (32-bit, non-prefetchable) [size=64K] > > > > Expansion ROM at fa8c [disabled] [size=128K] > > > > Capabilities: [50] Power Management version 2 > > > > Capabilities: [80] MSI
Re: Asus F5RL laptop unable to resume from S3 because of radeon module
On Thursday 22 August 2013 22:56:03 Ondrej Zary wrote: > On Thursday 22 August 2013 22:24:17 Deucher, Alexander wrote: > > > -Original Message- > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > Sent: Thursday, August 22, 2013 4:00 PM > > > To: Deucher, Alexander > > > Cc: Kernel development list > > > Subject: Re: Asus F5RL laptop unable to resume from S3 because of > > > radeon module > > > > > > On Thursday 22 August 2013 21:49:41 Deucher, Alexander wrote: > > > > > -Original Message- > > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > > Sent: Thursday, August 22, 2013 2:18 PM > > > > > To: Kernel development list > > > > > Cc: Deucher, Alexander > > > > > Subject: Asus F5RL laptop unable to resume from S3 because of > > > > > radeon module > > > > > > > > > > Hello, > > > > > resume from suspend-to-RAM (S3) on Asus F5RL laptop does not work. > > > > > According to many reports found by Google, it was always been that > > > > > and there > > > > > is no fix or workaround. > > > > > > > > Make sure your kernel has this patch: > > > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit > > > >/? id=c ef1d00cd56f600121ad121875655ad410a001b8 > > > > > > Just tried latest git (3.11-rc6+) and the problem persists. > > > > You might try adding a quirk for your system in > > radeon_combios_asic_init() in radeon_combios.c. You can try something > > like this for testing: > > > > diff --git a/drivers/gpu/drm/radeon/radeon_combios.c > > b/drivers/gpu/drm/radeon/radeon_combios.c index 68ce360..0419a2c 100644 > > --- a/drivers/gpu/drm/radeon/radeon_combios.c > > +++ b/drivers/gpu/drm/radeon/radeon_combios.c > > @@ -3398,6 +3398,8 @@ void radeon_combios_asic_init(struct drm_device > > *dev) rdev->pdev->subsystem_device == 0x30ae) > > return; > > > > + return; > > + > > /* DYN CLK 1 */ > > table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE); > > if (table) > > > > If that doesn't work, you'll probably have to track down where it's > > hanging during resume, or compare registers before and after resume to > > see if it's some particular state that's causing a problem. > > No change. > > Inserted "return -1;" before radeon_device_init() to > radeon_driver_load_kms() - driver fails to load and resume works. > Moved it (and changed to "r = -1; goto out;") a bit down before > radeon_modeset_init() - driver fails to load and resume stopped working. Going deeper... it works before rs400_startup() and does not work after that. Will continue later. > > Alex > > > > > > Alex > > > > > > > > > Did some tests: > > > > > > > > > > radeon module loaded (usual state): > > > > > After "echo mem>/sys/power/state", the laptop suspends correctly > > > > > > (power > > > > > > > > LED > > > > > blinks). When power button is pressed, power LED goes on and that's > > > > > all. No more activity, machine is frozen completely. > > > > > > > > > > radeon module not loaded at all: > > > > > Laptop resumes correctly (keyboard LED work, network works), only > > > > > the > > > > > > LCD > > > > > > > > is > > > > > blank (obviously). Loading radeon module now initializes the card > > > > > properly: LCD goes on and console works. > > > > > > > > > > radeon module loaded (but fbcon module not loaded) and then > > > > > > unloaded: > > > > > Machine freezes the same way as when the module is loaded. > > > > > > > > > > So it looks like the radeon module does some initialization that > > > > > prevents resume from working. > > > > > > > > > > Hibernation works fine. > > > > > > > > > > Any ideas what to test or how to debug this? > > > > > > > > > > Details: > > > > > 01:05.0 VGA compatible controller [0300]: Advanced Micro Devices, > > > > > Inc. [AMD/ATI] RC410M [Mobility Radeon Xpress 200M] [1002:5a62] > > > >
Re: Asus F5RL laptop unable to resume from S3 because of radeon module
On Friday 23 August 2013 00:08:33 Ondrej Zary wrote: > On Thursday 22 August 2013 22:56:03 Ondrej Zary wrote: > > On Thursday 22 August 2013 22:24:17 Deucher, Alexander wrote: > > > > -Original Message- > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > Sent: Thursday, August 22, 2013 4:00 PM > > > > To: Deucher, Alexander > > > > Cc: Kernel development list > > > > Subject: Re: Asus F5RL laptop unable to resume from S3 because of > > > > radeon module > > > > > > > > On Thursday 22 August 2013 21:49:41 Deucher, Alexander wrote: > > > > > > -Original Message- > > > > > > From: Ondrej Zary [mailto:li...@rainbow-software.org] > > > > > > Sent: Thursday, August 22, 2013 2:18 PM > > > > > > To: Kernel development list > > > > > > Cc: Deucher, Alexander > > > > > > Subject: Asus F5RL laptop unable to resume from S3 because of > > > > > > radeon module > > > > > > > > > > > > Hello, > > > > > > resume from suspend-to-RAM (S3) on Asus F5RL laptop does not > > > > > > work. According to many reports found by Google, it was always > > > > > > been that and there > > > > > > is no fix or workaround. > > > > > > > > > > Make sure your kernel has this patch: > > > > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/comm > > > > >it /? id=c ef1d00cd56f600121ad121875655ad410a001b8 > > > > > > > > Just tried latest git (3.11-rc6+) and the problem persists. > > > > > > You might try adding a quirk for your system in > > > radeon_combios_asic_init() in radeon_combios.c. You can try something > > > like this for testing: > > > > > > diff --git a/drivers/gpu/drm/radeon/radeon_combios.c > > > b/drivers/gpu/drm/radeon/radeon_combios.c index 68ce360..0419a2c 100644 > > > --- a/drivers/gpu/drm/radeon/radeon_combios.c > > > +++ b/drivers/gpu/drm/radeon/radeon_combios.c > > > @@ -3398,6 +3398,8 @@ void radeon_combios_asic_init(struct drm_device > > > *dev) rdev->pdev->subsystem_device == 0x30ae) > > > return; > > > > > > + return; > > > + > > > /* DYN CLK 1 */ > > > table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE); > > > if (table) > > > > > > If that doesn't work, you'll probably have to track down where it's > > > hanging during resume, or compare registers before and after resume to > > > see if it's some particular state that's causing a problem. > > > > No change. > > > > Inserted "return -1;" before radeon_device_init() to > > radeon_driver_load_kms() - driver fails to load and resume works. > > Moved it (and changed to "r = -1; goto out;") a bit down before > > radeon_modeset_init() - driver fails to load and resume stopped working. > > Going deeper... it works before rs400_startup() and does not work after > that. Will continue later. Tracked the problem down to rs400_gart_enable(). When this "Disable AGP mode" code is commented out, the machine resumes fine: if ((rdev->family == CHIP_RS690) || (rdev->family == CHIP_RS740)) { WREG32_MC(RS480_MC_MISC_CNTL, (RS480_GART_INDEX_REG_EN | RS690_BLOCK_GFX_D3_EN)); } else { WREG32_MC(RS480_MC_MISC_CNTL, RS480_GART_INDEX_REG_EN); } > > > Alex > > > > > > > > Alex > > > > > > > > > > > Did some tests: > > > > > > > > > > > > radeon module loaded (usual state): > > > > > > After "echo mem>/sys/power/state", the laptop suspends correctly > > > > > > > > (power > > > > > > > > > > LED > > > > > > blinks). When power button is pressed, power LED goes on and > > > > > > that's all. No more activity, machine is frozen completely. > > > > > > > > > > > > radeon module not loaded at all: > > > > > > Laptop resumes correctly (keyboard LED work, network works), only > > > > > > the > > > > > > > > LCD > > > > > > > > > > is > > > > > > blank (obviously). Loading radeon module now initializes the c
[PATCH] snd-es1968: Add radio support for MediaForte M56VAP
Add support for TEA5757 tuner on MediaForte M56VAP sound+modem+radio card. The GPIO connection type is automatically detected (like snd-fm801 driver). Also add a safety subsystem vendor check to skip radio detection if vendor differs from ESS (so we don't touch GPIOs on laptops). Tested with SF64-PCE2 and M56VAP cards. Signed-off-by: Ondrej Zary --- sound/pci/es1968.c | 73 +++ 1 files changed, 50 insertions(+), 23 deletions(-) diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index a1f32b5..db08641 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -564,6 +564,7 @@ struct es1968 { #ifdef CONFIG_SND_ES1968_RADIO struct v4l2_device v4l2_dev; struct snd_tea575x tea; + unsigned int tea575x_tuner; #endif }; @@ -2557,37 +2558,47 @@ static int snd_es1968_input_register(struct es1968 *chip) bits 1=unmask write to given bit */ #define IO_DIR 8 /* direction register offset from GPIO_DATA bits 0/1=read/write direction */ -/* mask bits for GPIO lines */ -#define STR_DATA 0x0040 /* GPIO6 */ -#define STR_CLK0x0080 /* GPIO7 */ -#define STR_WREN 0x0100 /* GPIO8 */ -#define STR_MOST 0x0200 /* GPIO9 */ + +/* GPIO to TEA575x maps */ +struct snd_es1968_tea575x_gpio { + u8 data, clk, wren, most; + char *name; +}; + +static struct snd_es1968_tea575x_gpio snd_es1968_tea575x_gpios[] = { + { .data = 6, .clk = 7, .wren = 8, .most = 9, .name = "SF64-PCE2" }, + { .data = 7, .clk = 8, .wren = 6, .most = 10, .name = "M56VAP" }, +}; + +#define get_tea575x_gpio(chip) \ + (&snd_es1968_tea575x_gpios[(chip)->tea575x_tuner]) + static void snd_es1968_tea575x_set_pins(struct snd_tea575x *tea, u8 pins) { struct es1968 *chip = tea->private_data; - unsigned long io = chip->io_port + GPIO_DATA; + struct snd_es1968_tea575x_gpio gpio = *get_tea575x_gpio(chip); u16 val = 0; - val |= (pins & TEA575X_DATA) ? STR_DATA : 0; - val |= (pins & TEA575X_CLK) ? STR_CLK : 0; - val |= (pins & TEA575X_WREN) ? STR_WREN : 0; + val |= (pins & TEA575X_DATA) ? (1 << gpio.data) : 0; + val |= (pins & TEA575X_CLK) ? (1 << gpio.clk) : 0; + val |= (pins & TEA575X_WREN) ? (1 << gpio.wren) : 0; - outw(val, io); + outw(val, chip->io_port + GPIO_DATA); } static u8 snd_es1968_tea575x_get_pins(struct snd_tea575x *tea) { struct es1968 *chip = tea->private_data; - unsigned long io = chip->io_port + GPIO_DATA; - u16 val = inw(io); - u8 ret; + struct snd_es1968_tea575x_gpio gpio = *get_tea575x_gpio(chip); + u16 val = inw(chip->io_port + GPIO_DATA); + u8 ret = 0; - ret = 0; - if (val & STR_DATA) + if (val & (1 << gpio.data)) ret |= TEA575X_DATA; - if (val & STR_MOST) + if (val & (1 << gpio.most)) ret |= TEA575X_MOST; + return ret; } @@ -2596,13 +2607,18 @@ static void snd_es1968_tea575x_set_direction(struct snd_tea575x *tea, bool outpu struct es1968 *chip = tea->private_data; unsigned long io = chip->io_port + GPIO_DATA; u16 odir = inw(io + IO_DIR); + struct snd_es1968_tea575x_gpio gpio = *get_tea575x_gpio(chip); if (output) { - outw(~(STR_DATA | STR_CLK | STR_WREN), io + IO_MASK); - outw(odir | STR_DATA | STR_CLK | STR_WREN, io + IO_DIR); + outw(~((1 << gpio.data) | (1 << gpio.clk) | (1 << gpio.wren)), + io + IO_MASK); + outw(odir | (1 << gpio.data) | (1 << gpio.clk) | (1 << gpio.wren), + io + IO_DIR); } else { - outw(~(STR_CLK | STR_WREN | STR_DATA | STR_MOST), io + IO_MASK); - outw((odir & ~(STR_DATA | STR_MOST)) | STR_CLK | STR_WREN, io + IO_DIR); + outw(~((1 << gpio.clk) | (1 << gpio.wren) | (1 << gpio.data) | (1 << gpio.most)), + io + IO_MASK); + outw((odir & ~((1 << gpio.data) | (1 << gpio.most))) + | (1 << gpio.clk) | (1 << gpio.wren), io + IO_DIR); } } @@ -2772,6 +2788,9 @@ static int snd_es1968_create(struct snd_card *card, snd_card_set_dev(card, &pci->dev); #ifdef CONFIG_SND_ES1968_RADIO + /* don't play with GPIOs on laptops */ + if (chip->pci->subsystem_vendor != 0x125d) + goto no_radio; err = v4l2_device_register(&pci->dev, &chip->v4l2_dev); if (err < 0) { snd_es1968_free(chip); @@ -2781,10 +2800,18 @@ static int snd_es1968_create(struct snd_card *card
Move snd_legacy_find_free_ioport to initval.h
Move snd_legacy_find_free_ioport() function back to initval.h as it is used by two drivers. Signed-off-by: Ondrej Zary diff --git a/include/sound/initval.h b/include/sound/initval.h index f99a0d2..ac62c67 100644 --- a/include/sound/initval.h +++ b/include/sound/initval.h @@ -50,6 +50,20 @@ #define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE } #define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR +#ifdef SNDRV_LEGACY_FIND_FREE_IOPORT +static long snd_legacy_find_free_ioport(long *port_table, long size) +{ + while (*port_table != -1) { + if (request_region(*port_table, size, "ALSA test")) { + release_region(*port_table, size); + return *port_table; + } + port_table++; + } + return -1; +} +#endif + #ifdef SNDRV_LEGACY_FIND_FREE_IRQ #include diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index c24594c..3d1afb6 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c @@ -37,6 +37,7 @@ #include #include #include +#define SNDRV_LEGACY_FIND_FREE_IOPORT #define SNDRV_LEGACY_FIND_FREE_IRQ #define SNDRV_LEGACY_FIND_FREE_DMA #include @@ -770,20 +771,6 @@ static int __devinit snd_miro_mixer(struct snd_card *card, return 0; } -static long snd_legacy_find_free_ioport(long *port_table, long size) -{ - while (*port_table != -1) { - struct resource *res; - if ((res = request_region(*port_table, size, - "ALSA test")) != NULL) { - release_and_free_resource(res); - return *port_table; - } - port_table++; - } - return -1; -} - static int __devinit snd_miro_init(struct snd_miro *chip, unsigned short hardware) { diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index f8fbe22..2899c9f 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -39,6 +39,7 @@ #ifndef OPTi93X #include #endif +#define SNDRV_LEGACY_FIND_FREE_IOPORT #define SNDRV_LEGACY_FIND_FREE_IRQ #define SNDRV_LEGACY_FIND_FREE_DMA #include @@ -185,19 +186,6 @@ static char * snd_opti9xx_names[] = { "82C930", "82C931", "82C933" }; - -static long __devinit snd_legacy_find_free_ioport(long *port_table, long size) -{ - while (*port_table != -1) { - if (request_region(*port_table, size, "ALSA test")) { - release_region(*port_table, size); - return *port_table; - } - port_table++; - } - return -1; -} - static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, unsigned short hardware) { -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] leds-clevo-mail: add MODULE_DEVICE_TABLE
Enable autoloading of leds-clevo-mail by using MODULE_DEVICE_TABLE. Signed-off-by: Ondrej Zary --- a/drivers/leds/leds-clevo-mail.c +++ b/drivers/leds/leds-clevo-mail.c @@ -31,7 +31,7 @@ static int __init clevo_mail_led_dmi_callback(const struct dmi_system_id *id) } /* - * struct mail_led_whitelist - List of known good models + * struct clevo_mail_led_dmi_table - List of known good models * * Contains the known good models this driver is compatible with. * When adding a new model try to be as strict as possible. This @@ -39,7 +39,7 @@ static int __init clevo_mail_led_dmi_callback(const struct dmi_system_id *id) * detected as working, but in reality it is not) as low as * possible. */ -static struct dmi_system_id __initdata mail_led_whitelist[] = { +static struct dmi_system_id __initdata clevo_mail_led_dmi_table[] = { { .callback = clevo_mail_led_dmi_callback, .ident = "Clevo D410J", @@ -89,6 +89,7 @@ static struct dmi_system_id __initdata mail_led_whitelist[] = { }, { } }; +MODULE_DEVICE_TABLE(dmi, clevo_mail_led_dmi_table); static void clevo_mail_led_set(struct led_classdev *led_cdev, enum led_brightness value) @@ -180,7 +181,7 @@ static int __init clevo_mail_led_init(void) /* Check with the help of DMI if we are running on supported hardware */ if (!nodetect) { - count = dmi_check_system(mail_led_whitelist); + count = dmi_check_system(clevo_mail_led_dmi_table); } else { count = 1; printk(KERN_ERR KBUILD_MODNAME ": Skipping DMI detection. " -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] leds-clevo-mail: Fix Clevo M5x0V DMI strings
There are more variants of Clevo M5x0V laptops and Positivo Mobile is just one of them. Another one is UMAX VisionBook 2400WXC. Use only generic Clevo DMI strings to match all variants. Signed-off-by: Ondrej Zary --- a/drivers/leds/leds-clevo-mail.c +++ b/drivers/leds/leds-clevo-mail.c @@ -59,11 +59,10 @@ static struct dmi_system_id __initdata clevo_mail_led_dmi_table[] = { }, { .callback = clevo_mail_led_dmi_callback, - .ident = "Positivo Mobile", + .ident = "Clevo M5x0V", .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "CLEVO Co. "), DMI_MATCH(DMI_BOARD_NAME, "M5X0V "), - DMI_MATCH(DMI_PRODUCT_NAME, "Positivo Mobile"), DMI_MATCH(DMI_PRODUCT_VERSION, "VT6198") } }, -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
viafb on Clevo M5x0V laptop (+VT1631L)
Hello, I've got a Clevo M5x0V laptop which has VIA PM800 chipset (1106:3118) and 1280x768 LCD panel connected using VT1631L LVDS transmitter. There's a schematic of this laptop available on the web which shows that VT1631L's I2C port is not connected anywhere... viafb does not work properly - LCD panel (and backlight) is turned off upon module load and there's 640x480 signal on VGA connector (even when monitor was not connected during module load). Looking at the code, there's almost nothing for VT1631. What needs to be done in order for the LCD to work? Xorg seems to work using openchrome (but it is not able to restore the card on resume from S3): (II) CHROME(0): Unable to get panel size from EDID. Return code: 0 (II) CHROME(0): ViaPanelGetNativeModeFromScratchPad (II) CHROME(0): Native Panel Resolution is 1280x768 This is from kernel 3.5 with VIAFB_DEBUG and VIAFB_WARN enabled: [ 153.051061] VIA Graphics Integration Chipset framebuffer 2.4 initializing [ 153.051765] viafb :01:00.0: power state changed by ACPI to D0 [ 153.051773] viafb :01:00.0: power state changed by ACPI to D0 [ 153.053535] Device ID = 3259 [ 153.053553] FB Size = 4000 [ 153.059984] VIAFB PCI Probe!! [ 153.060044] viafb: Probing I2C bus 0x26 [ 153.092761] viafb: Probing I2C bus 0x31 [ 155.588019] viafb: Probing I2C bus 0x2C [ 155.619016] viafb: Finished I2C bus probing [ 155.619021] parse_lcd_port: viafb_lcd_port:,interface:0 [ 155.619023] parse_dvi_port: viafb_dvi_port:,interface:0 [ 155.713224] TMDS Chip = 0 [ 155.713227] viafb_init_dvi_size() [ 155.713229] viafb_dvi_sense!! [ 155.714415] viafb_dvi_query_EDID!! [ 155.716820] viafb_dvi_query_EDID!! [ 155.719179] viafb_lvds_identify_vt1636. [ 155.812018] viafb_lvds_identify_vt1636. [ 155.814383] viafb_init_lcd_size() [ 155.814384] fp_get_panel_id() [ 155.814387] LVDS Chip = 0 [ 155.814389] LVDS1 output_interface = 6 [ 155.814391] LVDS2 output_interface = 6 [ 155.814405] viafb_check_var! [ 155.815250] fbcon: Via (fb0) is primary device [ 155.815257] viafb_open! [ 155.818608] viafb_set_par! [ 155.818720] via_set_primary_pitch(0x0A00) [ 155.818723] via_set_secondary_pitch(0x0A00) [ 155.818727] via_set_primary_color_depth(24) [ 155.818730] via_set_secondary_color_depth(24) [ 155.818788] viafb_pan_display, address = 0 [ 155.818789] via_set_primary_address(0x) [ 155.818793] via_set_secondary_address(0x) [ 155.819020] viafb_pan_display, address = 0 [ 155.819021] via_set_primary_address(0x) [ 155.819025] via_set_secondary_address(0x) [ 155.819044] viafb 2D engine: imageblit ...many imageblits... [ 155.826516] Console: switching to colour frame buffer device 80x30 [ 155.826522] viafb_pan_display, address = 0 [ 155.826523] via_set_primary_address(0x) [ 155.826527] via_set_secondary_address(0x) ...many imageblits... [ 155.833889] fb0: Via frame buffer device 640x480-32bpp -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: viafb on Clevo M5x0V laptop (+VT1631L)
On Thursday 02 August 2012 22:46:18 Florian Tobias Schandinat wrote: > Hi Ondrej, > > On 08/02/2012 06:03 PM, Ondrej Zary wrote: > > Hello, > > I've got a Clevo M5x0V laptop which has VIA PM800 chipset (1106:3118) and > > 1280x768 LCD panel connected using VT1631L LVDS transmitter. There's a > > schematic of this laptop available on the web which shows that VT1631L's > > I2C port is not connected anywhere... > > > > viafb does not work properly - LCD panel (and backlight) is turned off > > upon module load and there's 640x480 signal on VGA connector (even when > > monitor was not connected during module load). > > Yes, that's the default (640x480-60 on the VGA output) that VIA selected > when they wrote the module. I tried to add some auto detect mechanism, > but I guess in your case it wouldn't help, even if it were complete. The > traditional way to use viafb is via module parameters as described in > Documentation/fb/viafb.txt > In your case something like this might work: > viafb_mode=1280x768 viafb_lcd_panel_id=3 viafb_active_dev=LCD Thank you very much, it works with these parameters! Looks like viafb can wake up the chip from S3, only the colors are messed up (X<->VT switch fixes that). > Additionally it might be required to add viafb_lcd_port with any of > DVP0, DVP1, DFP_HIGHLOW, DFP_HIGH, DFP_LOW. > > > Looking at the code, there's almost nothing for VT1631. What needs to be > > done in order for the LCD to work? Xorg seems to work using openchrome > > (but it is not able to restore the card on resume from S3): > > (II) CHROME(0): Unable to get panel size from EDID. Return code: 0 > > (II) CHROME(0): ViaPanelGetNativeModeFromScratchPad > > (II) CHROME(0): Native Panel Resolution is 1280x768 > > Interesting that they get the panel resolution from the scratch pad. The > official documentation does not contain any useful information about it > (and openchrome didn't work on any of my LCD devices that I tested, > hence I didn't care whether they did have any code in that area) > Maybe the above module parameters will help you, otherwise more > investigation will be required. Looking at openchrome and viafb code - the code is already present in viafb in fp_id_to_vindex() function in lcd.c. It even finds correct panel_id for me (3). But it looks like that the result is not used. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Drop support for x86-32
On Thursday 23 August 2012 19:22:07 wbrana wrote: > x86-32 > - is deprecated since Linux supports X32. > - will slow down adoption of X32 - there won't be X32 versions of many > software - if new ABI was added, old one should be removed > - wastes time of developers who can spend their time supporting X32 > instead of x86-32 or support x86-64 only as 99% of users will be able > to run x86-64 software if x86-32 will be dropped > - wouldn't be dropped this year, but there should be plan when it will > be dropped e.g. when Windows 9 will be released > > On 8/23/12, Martin Nybo Andersen wrote: > > Why? Please stop trolling (and top-posting). Linux is NOT Windows where people must throw out their hardware because it stopped working in new version. There are millions of 32-bit x86 machines all around the world. If new Windows will not run on them, Linux will. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Drop support for x86-32
On Friday 24 August 2012, wbrana wrote: > On 8/24/12, Brian Gerst wrote: > > If you don't want to support it that's your opinion. Those of us who > > do don't care what you think. There is no profit motive in open > > source. > > Support needs time. Time is money. So stop wasting time with this trolling. -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH v2 0/5] snd-ice1712: Add Philips PSC724 Ultimate Edge
Hello, this is second attempt to add Philips PSC724 Ultimate Edge sound card support to snd-ice1712 driver. Unlike other snd-ice1712 subdrivers, the codec code is splitted into separate modules and thus reusable by other ice1712 subdrivers. Working: all analog outputs (front, rear, center+lfe, headphone) and inputs (front mic, rear mic, line, cd, aux), mixer, headphone jack detection, suspend/resume Currently untested: SPDIF Buggy: switching AGC mode in mixer causes alsamixer to crash - looks like it does not like notifications about control activating/deactivating -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/5] snd-ice1712: add chip_exit callback
Add chip_exit callback to allow card subdrivers to do cleanup work on module removal. Needed by Philips PSC724 subdriver to cancel delayed work. Signed-off-by: Ondrej Zary --- sound/pci/ice1712/ice1712.c |8 +++- sound/pci/ice1712/ice1712.h |3 +++ sound/pci/ice1712/ice1724.c |8 +++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 5be2e12..f42b5b1 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -2686,6 +2686,7 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, for (tbl = card_tables; *tbl; tbl++) { for (c = *tbl; c->subvendor; c++) { if (c->subvendor == ice->eeprom.subvendor) { + ice->card_info = c; strcpy(card->shortname, c->name); if (c->driver) /* specific driver? */ strcpy(card->driver, c->driver); @@ -2799,7 +2800,12 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, static void __devexit snd_ice1712_remove(struct pci_dev *pci) { - snd_card_free(pci_get_drvdata(pci)); + struct snd_card *card = pci_get_drvdata(pci); + struct snd_ice1712 *ice = card->private_data; + + if (ice->card_info && ice->card_info->chip_exit) + ice->card_info->chip_exit(ice); + snd_card_free(card); pci_set_drvdata(pci, NULL); } diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h index 0da778a..79f8aeb 100644 --- a/sound/pci/ice1712/ice1712.h +++ b/sound/pci/ice1712/ice1712.h @@ -288,6 +288,7 @@ struct snd_ice1712_spdif { } ops; }; +struct snd_ice1712_card_info; struct snd_ice1712 { unsigned long conp_dma_size; @@ -324,6 +325,7 @@ struct snd_ice1712 { struct snd_info_entry *proc_entry; struct snd_ice1712_eeprom eeprom; + struct snd_ice1712_card_info *card_info; unsigned int pro_volumes[20]; unsigned int omni:1;/* Delta Omni I/O */ @@ -517,6 +519,7 @@ struct snd_ice1712_card_info { char *model; char *driver; int (*chip_init)(struct snd_ice1712 *); + void (*chip_exit)(struct snd_ice1712 *); int (*build_controls)(struct snd_ice1712 *); unsigned int no_mpu401:1; unsigned int mpu401_1_info_flags; diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index bed9f34..a529d30 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -2348,6 +2348,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, ice->eeprom.subvendor = c->subvendor; } else if (c->subvendor != ice->eeprom.subvendor) continue; + ice->card_info = c; if (!c->eeprom_size || !c->eeprom_data) goto found; /* if the EEPROM is given by the driver, use it */ @@ -2788,7 +2789,12 @@ __found: static void __devexit snd_vt1724_remove(struct pci_dev *pci) { - snd_card_free(pci_get_drvdata(pci)); + struct snd_card *card = pci_get_drvdata(pci); + struct snd_ice1712 *ice = card->private_data; + + if (ice->card_info && ice->card_info->chip_exit) + ice->card_info->chip_exit(ice); + snd_card_free(card); pci_set_drvdata(pci, NULL); } -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/5] snd-ice1712: Add Wolfson Microelectronics WM8766 codec support
Needed by Philips PSC724 subdriver. The code does not contain any card-specific bits so other ice17xx cards using this codec could be converted to use this generic code. Signed-off-by: Ondrej Zary --- sound/pci/ice1712/wm8766.c | 383 sound/pci/ice1712/wm8766.h | 161 +++ 2 files changed, 544 insertions(+), 0 deletions(-) create mode 100644 sound/pci/ice1712/wm8766.c create mode 100644 sound/pci/ice1712/wm8766.h diff --git a/sound/pci/ice1712/wm8766.c b/sound/pci/ice1712/wm8766.c new file mode 100644 index 000..a782533 --- /dev/null +++ b/sound/pci/ice1712/wm8766.c @@ -0,0 +1,383 @@ +/* + * ALSA driver for WM8766 codecs + * + * Copyright (c) 2012 Ondrej Zary + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include +#include "wm8766.h" + +MODULE_AUTHOR("Ondrej Zary "); +MODULE_DESCRIPTION("Routines for control of WM8766 codecs"); +MODULE_LICENSE("GPL"); + +/* low-level access */ + +static void snd_wm8766_write(struct snd_wm8766 *wm, u16 addr, u16 data) +{ + if (addr < WM8766_REG_RESET) + wm->regs[addr] = data; + wm->ops.write(wm, addr, data); +} + +/* mixer controls */ + +static const DECLARE_TLV_DB_SCALE(wm8766_tlv, -12750, 50, 1); + +static struct snd_wm8766_ctl default_ctl[WM8766_CTL_COUNT] = { + [WM8766_CTL_CH1_VOL] = { + .name = "Channel 1 Playback Volume", + .type = SNDRV_CTL_ELEM_TYPE_INTEGER, + .tlv = wm8766_tlv, + .reg1 = WM8766_REG_DACL1, + .reg2 = WM8766_REG_DACR1, + .mask1 = WM8766_VOL_MASK, + .mask2 = WM8766_VOL_MASK, + .max = 0xff, + .flags = WM8766_FLAG_STEREO | WM8766_FLAG_VOL_UPDATE, + }, + [WM8766_CTL_CH2_VOL] = { + .name = "Channel 2 Playback Volume", + .type = SNDRV_CTL_ELEM_TYPE_INTEGER, + .tlv = wm8766_tlv, + .reg1 = WM8766_REG_DACL2, + .reg2 = WM8766_REG_DACR2, + .mask1 = WM8766_VOL_MASK, + .mask2 = WM8766_VOL_MASK, + .max = 0xff, + .flags = WM8766_FLAG_STEREO | WM8766_FLAG_VOL_UPDATE, + }, + [WM8766_CTL_CH3_VOL] = { + .name = "Channel 3 Playback Volume", + .type = SNDRV_CTL_ELEM_TYPE_INTEGER, + .tlv = wm8766_tlv, + .reg1 = WM8766_REG_DACL3, + .reg2 = WM8766_REG_DACR3, + .mask1 = WM8766_VOL_MASK, + .mask2 = WM8766_VOL_MASK, + .max = 0xff, + .flags = WM8766_FLAG_STEREO | WM8766_FLAG_VOL_UPDATE, + }, + [WM8766_CTL_CH1_SW] = { + .name = "Channel 1 Playback Switch", + .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN, + .reg1 = WM8766_REG_DACCTRL2, + .mask1 = WM8766_DAC2_MUTE1, + .flags = WM8766_FLAG_INVERT, + }, + [WM8766_CTL_CH2_SW] = { + .name = "Channel 2 Playback Switch", + .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN, + .reg1 = WM8766_REG_DACCTRL2, + .mask1 = WM8766_DAC2_MUTE2, + .flags = WM8766_FLAG_INVERT, + }, + [WM8766_CTL_CH3_SW] = { + .name = "Channel 3 Playback Switch", + .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN, + .reg1 = WM8766_REG_DACCTRL2, + .mask1 = WM8766_DAC2_MUTE3, + .flags = WM8766_FLAG_INVERT, + }, + [WM8766_CTL_PHASE1_SW] = { + .name = "Channel 1 Phase Invert Playback Switch", + .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN, + .reg1 = WM8766_REG_IFCTRL, + .mask1 = WM8766_PHASE_INVERT1, + }, + [WM8766_CTL_PHASE2_SW] = { + .name = "Channel 2 Phase Invert Playback Switch", + .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN, + .reg1 = WM8766_REG_IFCTRL, + .mask1 = WM8766_PHASE_INVERT2, + }, + [WM8766_CTL_PHASE3_SW] = { + .name = "C
[PATCH 3/5] snd-ice1712: Add Wolfson Microelectronics WM8776 codec support
Needed by Philips PSC724 subdriver. The code does not contain any card-specific bits so other ice17xx cards using this codec could be converted to use this generic code. Signed-off-by: Ondrej Zary --- sound/pci/ice1712/wm8776.c | 655 sound/pci/ice1712/wm8776.h | 224 +++ 2 files changed, 879 insertions(+), 0 deletions(-) create mode 100644 sound/pci/ice1712/wm8776.c create mode 100644 sound/pci/ice1712/wm8776.h diff --git a/sound/pci/ice1712/wm8776.c b/sound/pci/ice1712/wm8776.c new file mode 100644 index 000..36a3060 --- /dev/null +++ b/sound/pci/ice1712/wm8776.c @@ -0,0 +1,655 @@ +/* + * ALSA driver for WM8776 codecs + * + * Copyright (c) 2012 Ondrej Zary + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include +#include "wm8776.h" + +MODULE_AUTHOR("Ondrej Zary "); +MODULE_DESCRIPTION("Routines for control of WM8776 codecs"); +MODULE_LICENSE("GPL"); + +/* low-level access */ + +static void snd_wm8776_write(struct snd_wm8776 *wm, u16 addr, u16 data) +{ + u8 bus_addr = addr << 1 | data >> 8;/* addr + 9th data bit */ + u8 bus_data = data & 0xff; /* remaining 8 data bits */ + + if (addr < WM8776_REG_RESET) + wm->regs[addr] = data; + wm->ops.write(wm, bus_addr, bus_data); +} + +/* register-level functions */ + +static void snd_wm8776_activate_ctl(struct snd_wm8776 *wm, char *ctl_name, + bool active) +{ + struct snd_card *card = wm->card; + struct snd_kcontrol *kctl; + struct snd_kcontrol_volatile *vd; + struct snd_ctl_elem_id elem_id; + unsigned int index_offset; + + memset(&elem_id, 0, sizeof(elem_id)); + strncpy(elem_id.name, ctl_name, sizeof(elem_id.name)); + elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; + kctl = snd_ctl_find_id(card, &elem_id); + if (!kctl) + return; + index_offset = snd_ctl_get_ioff(kctl, &kctl->id); + vd = &kctl->vd[index_offset]; + if (active) + vd->access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; + else + vd->access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; + snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id); +} + +static void snd_wm8776_update_agc_ctl(struct snd_wm8776 *wm) +{ + int i, flags_on = 0, flags_off = 0; + + switch (wm->agc_mode) { + case WM8776_AGC_OFF: + flags_off = WM8776_FLAG_LIM | WM8776_FLAG_ALC; + break; + case WM8776_AGC_LIM: + flags_off = WM8776_FLAG_ALC; + flags_on = WM8776_FLAG_LIM; + break; + case WM8776_AGC_ALC_R: + case WM8776_AGC_ALC_L: + case WM8776_AGC_ALC_STEREO: + flags_off = WM8776_FLAG_LIM; + flags_on = WM8776_FLAG_ALC; + break; + } + + for (i = 0; i < WM8776_CTL_COUNT; i++) + if (wm->ctl[i].flags & flags_off) + snd_wm8776_activate_ctl(wm, wm->ctl[i].name, false); + else if (wm->ctl[i].flags & flags_on) + snd_wm8776_activate_ctl(wm, wm->ctl[i].name, true); +} + +static void snd_wm8776_set_agc(struct snd_wm8776 *wm, u16 agc, u16 nothing) +{ + u16 alc1 = wm->regs[WM8776_REG_ALCCTRL1] & ~WM8776_ALC1_LCT_MASK; + u16 alc2 = wm->regs[WM8776_REG_ALCCTRL2] & ~WM8776_ALC2_LCEN; + + switch (agc) { + case 0: /* Off */ + wm->agc_mode = WM8776_AGC_OFF; + break; + case 1: /* Limiter */ + alc2 |= WM8776_ALC2_LCEN; + wm->agc_mode = WM8776_AGC_LIM; + break; + case 2: /* ALC Right */ + alc1 |= WM8776_ALC1_LCSEL_ALCR; + alc2 |= WM8776_ALC2_LCEN; + wm->agc_mode = WM8776_AGC_ALC_R; + break; + case 3: /* ALC Left */ + alc1 |= WM8776_ALC1_LCSEL_ALCL; + alc2 |= WM8776_ALC2_LCEN; + wm->agc_mode = WM8776_AGC_ALC_L; + brea
[PATCH 5/5] snd-ice1712: Fix resume on ice1724
set_pro_rate() is called from hw_params() but not from prepare(), breaking running PCM on suspend/resume. Call it from prepare() if PCM was suspended to fix the problem. Signed-off-by: Ondrej Zary --- sound/pci/ice1712/ice1724.c | 14 ++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 0eb7ec6..ade3354 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -783,6 +783,13 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream) struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); unsigned char val; unsigned int size; + int err; + + if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { + err = snd_vt1724_set_pro_rate(ice, substream->runtime->rate, 0); + if (err < 0) + return err; + } spin_lock_irq(&ice->reg_lock); val = (8 - substream->runtime->channels) >> 1; @@ -853,6 +860,13 @@ static int snd_vt1724_pcm_prepare(struct snd_pcm_substream *substream) { struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); const struct vt1724_pcm_reg *reg = substream->runtime->private_data; + int err; + + if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { + err = snd_vt1724_set_pro_rate(ice, substream->runtime->rate, 0); + if (err < 0) + return err; + } spin_lock_irq(&ice->reg_lock); outl(substream->runtime->dma_addr, ice->profi_port + reg->addr); -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/5] snd-ice1712: Add Philips PSC724 Ultimate Edge
Add psc724 subdriver to snd-ice1712 that provides full support for Philips PSC724 Ultimate Edge sound cards. Outputs and inputs are provided by WM8766 and WM8776 codec drivers. Signed-off-by: Ondrej Zary --- sound/pci/Kconfig |2 +- sound/pci/ice1712/Makefile |6 +- sound/pci/ice1712/ice1724.c |4 +- sound/pci/ice1712/psc724.c | 464 +++ sound/pci/ice1712/psc724.h | 13 ++ 5 files changed, 485 insertions(+), 4 deletions(-) create mode 100644 sound/pci/ice1712/psc724.c create mode 100644 sound/pci/ice1712/psc724.h diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index ff3af6e..5df1635 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -630,7 +630,7 @@ config SND_ICE1724 AudioTrak Prodigy 192, 7.1 (HIFI/LT/XT), HD2; Hercules Fortissimo IV; ESI Juli@; Pontis MS300; EGO-SYS WaveTerminal 192M; Albatron K8X800 Pro II; Chaintech ZNF3-150/250, 9CJS, - AV-710; Shuttle SN25P. + AV-710; Shuttle SN25P; Philips PSC724 Ultimate Edge. To compile this driver as a module, choose M here: the module will be called snd-ice1724. diff --git a/sound/pci/ice1712/Makefile b/sound/pci/ice1712/Makefile index f7ce33f..6502636 100644 --- a/sound/pci/ice1712/Makefile +++ b/sound/pci/ice1712/Makefile @@ -4,9 +4,11 @@ # snd-ice17xx-ak4xxx-objs := ak4xxx.o +snd-wm8766-objs := wm8766.o +snd-wm8776-objs := wm8776.o snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o -snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o vt1720_mobo.o pontis.o prodigy192.o prodigy_hifi.o juli.o phase.o wtm.o se.o maya44.o quartet.o +snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o vt1720_mobo.o pontis.o prodigy192.o prodigy_hifi.o juli.o phase.o wtm.o se.o maya44.o quartet.o psc724.o # Toplevel Module Dependency obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o snd-ice17xx-ak4xxx.o -obj-$(CONFIG_SND_ICE1724) += snd-ice1724.o snd-ice17xx-ak4xxx.o +obj-$(CONFIG_SND_ICE1724) += snd-ice1724.o snd-ice17xx-ak4xxx.o snd-wm8766.o snd-wm8776.o diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index a529d30..0eb7ec6 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -54,6 +54,7 @@ #include "wtm.h" #include "se.h" #include "quartet.h" +#include "psc724.h" MODULE_AUTHOR("Jaroslav Kysela "); MODULE_DESCRIPTION("VIA ICEnsemble ICE1724/1720 (Envy24HT/PT)"); @@ -2257,6 +2258,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = { snd_vt1724_se_cards, snd_vt1724_qtet_cards, snd_vt1724_ooaoo_cards, + snd_vt1724_psc724_cards, NULL, }; @@ -2372,7 +2374,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, return -EIO; } ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05); - if (ice->eeprom.version != 2) + if (ice->eeprom.version != 1 && ice->eeprom.version != 2) printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n", ice->eeprom.version); size = ice->eeprom.size - 6; diff --git a/sound/pci/ice1712/psc724.c b/sound/pci/ice1712/psc724.c new file mode 100644 index 000..5a4abe7 --- /dev/null +++ b/sound/pci/ice1712/psc724.c @@ -0,0 +1,464 @@ +/* + * ALSA driver for ICEnsemble VT1724 (Envy24HT) + * + * Lowlevel functions for Philips PSC724 Ultimate Edge + * + * Copyright (c) 2012 Ondrej Zary + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include + +#include "ice1712.h" +#include "envy24ht.h" +#include "psc724.h" +#include "wm8766.h" +#include "wm8776.h" + +struct psc724_spec { + struct snd_wm8766 wm8766; + struct snd_wm8776 wm8776; + bool mute_all, jack_detect; + struct snd_ice1712 *ice; + struct delayed_work hp_work; + bool hp_connected; +}; + +// +/* PHILIPS PSC724 ULTIMATE EDGE*/ +/
Re: [alsa-devel] [RFC PATCH v2 0/5] snd-ice1712: Add Philips PSC724 Ultimate Edge
On Wednesday 19 September 2012 17:28:21 Takashi Iwai wrote: > At Tue, 18 Sep 2012 20:58:31 +0200, > > Ondrej Zary wrote: > > Hello, > > this is second attempt to add Philips PSC724 Ultimate Edge sound card > > support to snd-ice1712 driver. Unlike other snd-ice1712 subdrivers, the > > codec code is splitted into separate modules and thus reusable by other > > ice1712 subdrivers. > > Well, the problem is that most of ice17xx boards use only a part of > channels on codecs. Thus you don't want to expose controls for all > channels, too. Otherwise user will get confusing dead controls. The controls can be easily hidden by setting its name to NULL. It's even used in the psc724 subdriver. > If these new modules are supposed to be used by other ice1712/ice1724 > sub drivers, they should provide some good binding mechanism, too. > (And that's one of the good reasons why ASoC has been nominated.) They're easy to use, you just need to provide wm87x6_write() function. I think that other subdrivers could be easily converted to use this (with hardware to test). > thanks, > > Takashi > > > Working: all analog outputs (front, rear, center+lfe, headphone) and > > inputs (front mic, rear mic, line, cd, aux), mixer, headphone jack > > detection, suspend/resume > > > > Currently untested: SPDIF > > > > Buggy: switching AGC mode in mixer causes alsamixer to crash - looks like > > it does not like notifications about control activating/deactivating > > ___ > > Alsa-devel mailing list > > alsa-de...@alsa-project.org > > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [alsa-devel] [RFC PATCH v2 0/5] snd-ice1712: Add Philips PSC724 Ultimate Edge
On Wednesday 19 September 2012 19:58:15 Takashi Iwai wrote: > At Wed, 19 Sep 2012 19:03:14 +0200, > > Ondrej Zary wrote: > > On Wednesday 19 September 2012 17:28:21 Takashi Iwai wrote: > > > At Tue, 18 Sep 2012 20:58:31 +0200, > > > > > > Ondrej Zary wrote: > > > > Hello, > > > > this is second attempt to add Philips PSC724 Ultimate Edge sound card > > > > support to snd-ice1712 driver. Unlike other snd-ice1712 subdrivers, > > > > the codec code is splitted into separate modules and thus reusable by > > > > other ice1712 subdrivers. > > > > > > Well, the problem is that most of ice17xx boards use only a part of > > > channels on codecs. Thus you don't want to expose controls for all > > > channels, too. Otherwise user will get confusing dead controls. > > > > The controls can be easily hidden by setting its name to NULL. It's even > > used in the psc724 subdriver. > > > > > If these new modules are supposed to be used by other ice1712/ice1724 > > > sub drivers, they should provide some good binding mechanism, too. > > > (And that's one of the good reasons why ASoC has been nominated.) > > > > They're easy to use, you just need to provide wm87x6_write() function. I > > think that other subdrivers could be easily converted to use this (with > > hardware to test). > > OK, but I'd like to have modules only when the code sharing happens. > Also, it'd be better to have different module names, indicating that > they are ice17xx-specific. OK, I'll change the code to not produce modules. > > > > Working: all analog outputs (front, rear, center+lfe, headphone) and > > > > inputs (front mic, rear mic, line, cd, aux), mixer, headphone jack > > > > detection, suspend/resume > > > > > > > > Currently untested: SPDIF > > > > > > > > Buggy: switching AGC mode in mixer causes alsamixer to crash - looks > > > > like it does not like notifications about control > > > > activating/deactivating What about this? Is it a bug in my code or somewhere else? -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH v3 0/5] snd-ice1712: Add Philips PSC724 Ultimate Edge
Hello, this is third attempt to add Philips PSC724 Ultimate Edge sound card support to snd-ice1712 driver. Unlike other snd-ice1712 subdrivers, the codec code is splitted into separate files, reusable by other ice1712 subdrivers. Working: all analog outputs (front, rear, center+lfe, headphone) and inputs (front mic, rear mic, line, cd, aux), mixer, headphone jack detection, suspend/resume Currently untested: SPDIF Buggy: switching AGC mode in mixer causes alsamixer to crash - looks like it does not like notifications about control activating/deactivating -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/5] snd-ice1712: add chip_exit callback
Add chip_exit callback to allow card subdrivers to do cleanup work on module removal. Needed by Philips PSC724 subdriver to cancel delayed work. Signed-off-by: Ondrej Zary --- sound/pci/ice1712/ice1712.c |8 +++- sound/pci/ice1712/ice1712.h |3 +++ sound/pci/ice1712/ice1724.c |8 +++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 5be2e12..f42b5b1 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -2686,6 +2686,7 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, for (tbl = card_tables; *tbl; tbl++) { for (c = *tbl; c->subvendor; c++) { if (c->subvendor == ice->eeprom.subvendor) { + ice->card_info = c; strcpy(card->shortname, c->name); if (c->driver) /* specific driver? */ strcpy(card->driver, c->driver); @@ -2799,7 +2800,12 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, static void __devexit snd_ice1712_remove(struct pci_dev *pci) { - snd_card_free(pci_get_drvdata(pci)); + struct snd_card *card = pci_get_drvdata(pci); + struct snd_ice1712 *ice = card->private_data; + + if (ice->card_info && ice->card_info->chip_exit) + ice->card_info->chip_exit(ice); + snd_card_free(card); pci_set_drvdata(pci, NULL); } diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h index 0da778a..79f8aeb 100644 --- a/sound/pci/ice1712/ice1712.h +++ b/sound/pci/ice1712/ice1712.h @@ -288,6 +288,7 @@ struct snd_ice1712_spdif { } ops; }; +struct snd_ice1712_card_info; struct snd_ice1712 { unsigned long conp_dma_size; @@ -324,6 +325,7 @@ struct snd_ice1712 { struct snd_info_entry *proc_entry; struct snd_ice1712_eeprom eeprom; + struct snd_ice1712_card_info *card_info; unsigned int pro_volumes[20]; unsigned int omni:1;/* Delta Omni I/O */ @@ -517,6 +519,7 @@ struct snd_ice1712_card_info { char *model; char *driver; int (*chip_init)(struct snd_ice1712 *); + void (*chip_exit)(struct snd_ice1712 *); int (*build_controls)(struct snd_ice1712 *); unsigned int no_mpu401:1; unsigned int mpu401_1_info_flags; diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index bed9f34..a529d30 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -2348,6 +2348,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, ice->eeprom.subvendor = c->subvendor; } else if (c->subvendor != ice->eeprom.subvendor) continue; + ice->card_info = c; if (!c->eeprom_size || !c->eeprom_data) goto found; /* if the EEPROM is given by the driver, use it */ @@ -2788,7 +2789,12 @@ __found: static void __devexit snd_vt1724_remove(struct pci_dev *pci) { - snd_card_free(pci_get_drvdata(pci)); + struct snd_card *card = pci_get_drvdata(pci); + struct snd_ice1712 *ice = card->private_data; + + if (ice->card_info && ice->card_info->chip_exit) + ice->card_info->chip_exit(ice); + snd_card_free(card); pci_set_drvdata(pci, NULL); } -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/5] snd-ice1712: Add Wolfson Microelectronics WM8766 codec support
Needed by Philips PSC724 subdriver. The code does not contain any card-specific bits so other ice17xx cards using this codec could be converted to use this generic code. Signed-off-by: Ondrej Zary --- sound/pci/ice1712/wm8766.c | 361 sound/pci/ice1712/wm8766.h | 163 2 files changed, 524 insertions(+), 0 deletions(-) create mode 100644 sound/pci/ice1712/wm8766.c create mode 100644 sound/pci/ice1712/wm8766.h diff --git a/sound/pci/ice1712/wm8766.c b/sound/pci/ice1712/wm8766.c new file mode 100644 index 000..8072ade --- /dev/null +++ b/sound/pci/ice1712/wm8766.c @@ -0,0 +1,361 @@ +/* + * ALSA driver for ICEnsemble VT17xx + * + * Lowlevel functions for WM8766 codec + * + * Copyright (c) 2012 Ondrej Zary + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include "wm8766.h" + +/* low-level access */ + +static void snd_wm8766_write(struct snd_wm8766 *wm, u16 addr, u16 data) +{ + if (addr < WM8766_REG_RESET) + wm->regs[addr] = data; + wm->ops.write(wm, addr, data); +} + +/* mixer controls */ + +static const DECLARE_TLV_DB_SCALE(wm8766_tlv, -12750, 50, 1); + +static struct snd_wm8766_ctl snd_wm8766_default_ctl[WM8766_CTL_COUNT] = { + [WM8766_CTL_CH1_VOL] = { + .name = "Channel 1 Playback Volume", + .type = SNDRV_CTL_ELEM_TYPE_INTEGER, + .tlv = wm8766_tlv, + .reg1 = WM8766_REG_DACL1, + .reg2 = WM8766_REG_DACR1, + .mask1 = WM8766_VOL_MASK, + .mask2 = WM8766_VOL_MASK, + .max = 0xff, + .flags = WM8766_FLAG_STEREO | WM8766_FLAG_VOL_UPDATE, + }, + [WM8766_CTL_CH2_VOL] = { + .name = "Channel 2 Playback Volume", + .type = SNDRV_CTL_ELEM_TYPE_INTEGER, + .tlv = wm8766_tlv, + .reg1 = WM8766_REG_DACL2, + .reg2 = WM8766_REG_DACR2, + .mask1 = WM8766_VOL_MASK, + .mask2 = WM8766_VOL_MASK, + .max = 0xff, + .flags = WM8766_FLAG_STEREO | WM8766_FLAG_VOL_UPDATE, + }, + [WM8766_CTL_CH3_VOL] = { + .name = "Channel 3 Playback Volume", + .type = SNDRV_CTL_ELEM_TYPE_INTEGER, + .tlv = wm8766_tlv, + .reg1 = WM8766_REG_DACL3, + .reg2 = WM8766_REG_DACR3, + .mask1 = WM8766_VOL_MASK, + .mask2 = WM8766_VOL_MASK, + .max = 0xff, + .flags = WM8766_FLAG_STEREO | WM8766_FLAG_VOL_UPDATE, + }, + [WM8766_CTL_CH1_SW] = { + .name = "Channel 1 Playback Switch", + .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN, + .reg1 = WM8766_REG_DACCTRL2, + .mask1 = WM8766_DAC2_MUTE1, + .flags = WM8766_FLAG_INVERT, + }, + [WM8766_CTL_CH2_SW] = { + .name = "Channel 2 Playback Switch", + .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN, + .reg1 = WM8766_REG_DACCTRL2, + .mask1 = WM8766_DAC2_MUTE2, + .flags = WM8766_FLAG_INVERT, + }, + [WM8766_CTL_CH3_SW] = { + .name = "Channel 3 Playback Switch", + .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN, + .reg1 = WM8766_REG_DACCTRL2, + .mask1 = WM8766_DAC2_MUTE3, + .flags = WM8766_FLAG_INVERT, + }, + [WM8766_CTL_PHASE1_SW] = { + .name = "Channel 1 Phase Invert Playback Switch", + .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN, + .reg1 = WM8766_REG_IFCTRL, + .mask1 = WM8766_PHASE_INVERT1, + }, + [WM8766_CTL_PHASE2_SW] = { + .name = "Channel 2 Phase Invert Playback Switch", + .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN, + .reg1 = WM8766_REG_IFCTRL, + .mask1 = WM8766_PHASE_INVERT2, + }, + [WM8766_CTL_PHASE3_SW] = { + .name = "Channel 3 Phase Invert Playback Switch", + .type = SNDRV_CT
[PATCH 3/5] snd-ice1712: Add Wolfson Microelectronics WM8776 codec support
Needed by Philips PSC724 subdriver. The code does not contain any card-specific bits so other ice17xx cards using this codec could be converted to use this generic code. Signed-off-by: Ondrej Zary --- sound/pci/ice1712/wm8776.c | 632 sound/pci/ice1712/wm8776.h | 226 2 files changed, 858 insertions(+), 0 deletions(-) create mode 100644 sound/pci/ice1712/wm8776.c create mode 100644 sound/pci/ice1712/wm8776.h diff --git a/sound/pci/ice1712/wm8776.c b/sound/pci/ice1712/wm8776.c new file mode 100644 index 000..dc333ce --- /dev/null +++ b/sound/pci/ice1712/wm8776.c @@ -0,0 +1,632 @@ +/* + * ALSA driver for ICEnsemble VT17xx + * + * Lowlevel functions for WM8776 codec + * + * Copyright (c) 2012 Ondrej Zary + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include "wm8776.h" + +/* low-level access */ + +static void snd_wm8776_write(struct snd_wm8776 *wm, u16 addr, u16 data) +{ + u8 bus_addr = addr << 1 | data >> 8;/* addr + 9th data bit */ + u8 bus_data = data & 0xff; /* remaining 8 data bits */ + + if (addr < WM8776_REG_RESET) + wm->regs[addr] = data; + wm->ops.write(wm, bus_addr, bus_data); +} + +/* register-level functions */ + +static void snd_wm8776_activate_ctl(struct snd_wm8776 *wm, char *ctl_name, + bool active) +{ + struct snd_card *card = wm->card; + struct snd_kcontrol *kctl; + struct snd_kcontrol_volatile *vd; + struct snd_ctl_elem_id elem_id; + unsigned int index_offset; + + memset(&elem_id, 0, sizeof(elem_id)); + strncpy(elem_id.name, ctl_name, sizeof(elem_id.name)); + elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; + kctl = snd_ctl_find_id(card, &elem_id); + if (!kctl) + return; + index_offset = snd_ctl_get_ioff(kctl, &kctl->id); + vd = &kctl->vd[index_offset]; + if (active) + vd->access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; + else + vd->access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; + snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id); +} + +static void snd_wm8776_update_agc_ctl(struct snd_wm8776 *wm) +{ + int i, flags_on = 0, flags_off = 0; + + switch (wm->agc_mode) { + case WM8776_AGC_OFF: + flags_off = WM8776_FLAG_LIM | WM8776_FLAG_ALC; + break; + case WM8776_AGC_LIM: + flags_off = WM8776_FLAG_ALC; + flags_on = WM8776_FLAG_LIM; + break; + case WM8776_AGC_ALC_R: + case WM8776_AGC_ALC_L: + case WM8776_AGC_ALC_STEREO: + flags_off = WM8776_FLAG_LIM; + flags_on = WM8776_FLAG_ALC; + break; + } + + for (i = 0; i < WM8776_CTL_COUNT; i++) + if (wm->ctl[i].flags & flags_off) + snd_wm8776_activate_ctl(wm, wm->ctl[i].name, false); + else if (wm->ctl[i].flags & flags_on) + snd_wm8776_activate_ctl(wm, wm->ctl[i].name, true); +} + +static void snd_wm8776_set_agc(struct snd_wm8776 *wm, u16 agc, u16 nothing) +{ + u16 alc1 = wm->regs[WM8776_REG_ALCCTRL1] & ~WM8776_ALC1_LCT_MASK; + u16 alc2 = wm->regs[WM8776_REG_ALCCTRL2] & ~WM8776_ALC2_LCEN; + + switch (agc) { + case 0: /* Off */ + wm->agc_mode = WM8776_AGC_OFF; + break; + case 1: /* Limiter */ + alc2 |= WM8776_ALC2_LCEN; + wm->agc_mode = WM8776_AGC_LIM; + break; + case 2: /* ALC Right */ + alc1 |= WM8776_ALC1_LCSEL_ALCR; + alc2 |= WM8776_ALC2_LCEN; + wm->agc_mode = WM8776_AGC_ALC_R; + break; + case 3: /* ALC Left */ + alc1 |= WM8776_ALC1_LCSEL_ALCL; + alc2 |= WM8776_ALC2_LCEN; + wm->agc_mode = WM8776_AGC_ALC_L; + break; + case 4: /* ALC Stereo */ + alc1 |= WM8776_ALC1_LCSEL_ALCSTEREO; + alc2 |= WM8
[PATCH 4/5] snd-ice1712: Add Philips PSC724 Ultimate Edge
Add psc724 subdriver to snd-ice1712 that provides full support for Philips PSC724 Ultimate Edge sound cards. Signed-off-by: Ondrej Zary --- sound/pci/Kconfig |2 +- sound/pci/ice1712/Makefile |2 +- sound/pci/ice1712/ice1724.c |4 +- sound/pci/ice1712/psc724.c | 464 +++ sound/pci/ice1712/psc724.h | 13 ++ 5 files changed, 482 insertions(+), 3 deletions(-) create mode 100644 sound/pci/ice1712/psc724.c create mode 100644 sound/pci/ice1712/psc724.h diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index ff3af6e..5df1635 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -630,7 +630,7 @@ config SND_ICE1724 AudioTrak Prodigy 192, 7.1 (HIFI/LT/XT), HD2; Hercules Fortissimo IV; ESI Juli@; Pontis MS300; EGO-SYS WaveTerminal 192M; Albatron K8X800 Pro II; Chaintech ZNF3-150/250, 9CJS, - AV-710; Shuttle SN25P. + AV-710; Shuttle SN25P; Philips PSC724 Ultimate Edge. To compile this driver as a module, choose M here: the module will be called snd-ice1724. diff --git a/sound/pci/ice1712/Makefile b/sound/pci/ice1712/Makefile index f7ce33f..7e50c13 100644 --- a/sound/pci/ice1712/Makefile +++ b/sound/pci/ice1712/Makefile @@ -5,7 +5,7 @@ snd-ice17xx-ak4xxx-objs := ak4xxx.o snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o -snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o vt1720_mobo.o pontis.o prodigy192.o prodigy_hifi.o juli.o phase.o wtm.o se.o maya44.o quartet.o +snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o vt1720_mobo.o pontis.o prodigy192.o prodigy_hifi.o juli.o phase.o wtm.o se.o maya44.o quartet.o psc724.o wm8766.o wm8776.o # Toplevel Module Dependency obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o snd-ice17xx-ak4xxx.o diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index a529d30..0eb7ec6 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -54,6 +54,7 @@ #include "wtm.h" #include "se.h" #include "quartet.h" +#include "psc724.h" MODULE_AUTHOR("Jaroslav Kysela "); MODULE_DESCRIPTION("VIA ICEnsemble ICE1724/1720 (Envy24HT/PT)"); @@ -2257,6 +2258,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = { snd_vt1724_se_cards, snd_vt1724_qtet_cards, snd_vt1724_ooaoo_cards, + snd_vt1724_psc724_cards, NULL, }; @@ -2372,7 +2374,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, return -EIO; } ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05); - if (ice->eeprom.version != 2) + if (ice->eeprom.version != 1 && ice->eeprom.version != 2) printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n", ice->eeprom.version); size = ice->eeprom.size - 6; diff --git a/sound/pci/ice1712/psc724.c b/sound/pci/ice1712/psc724.c new file mode 100644 index 000..5a4abe7 --- /dev/null +++ b/sound/pci/ice1712/psc724.c @@ -0,0 +1,464 @@ +/* + * ALSA driver for ICEnsemble VT1724 (Envy24HT) + * + * Lowlevel functions for Philips PSC724 Ultimate Edge + * + * Copyright (c) 2012 Ondrej Zary + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include + +#include "ice1712.h" +#include "envy24ht.h" +#include "psc724.h" +#include "wm8766.h" +#include "wm8776.h" + +struct psc724_spec { + struct snd_wm8766 wm8766; + struct snd_wm8776 wm8776; + bool mute_all, jack_detect; + struct snd_ice1712 *ice; + struct delayed_work hp_work; + bool hp_connected; +}; + +// +/* PHILIPS PSC724 ULTIMATE EDGE*/ +// +/* + * VT1722 (Envy24GT) - 6 outputs, 4 inputs (only 2 used), 24-bit/96kHz + * + * system configuration ICE_EEP2_SYSCONF=0x42 + *XIN1 49.152MHz + *no MPU401 + *one stereo ADC, no S/PDIF receiver + *three stereo DACs (FRONT, REAR, CEN
[PATCH 5/5] snd-ice1712: Fix resume on ice1724
set_pro_rate() is called from hw_params() but not from prepare(), breaking running PCM on suspend/resume. Call it from prepare() if PCM was suspended to fix the problem. Signed-off-by: Ondrej Zary --- sound/pci/ice1712/ice1724.c | 14 ++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 0eb7ec6..ade3354 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -783,6 +783,13 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream) struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); unsigned char val; unsigned int size; + int err; + + if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { + err = snd_vt1724_set_pro_rate(ice, substream->runtime->rate, 0); + if (err < 0) + return err; + } spin_lock_irq(&ice->reg_lock); val = (8 - substream->runtime->channels) >> 1; @@ -853,6 +860,13 @@ static int snd_vt1724_pcm_prepare(struct snd_pcm_substream *substream) { struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); const struct vt1724_pcm_reg *reg = substream->runtime->private_data; + int err; + + if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { + err = snd_vt1724_set_pro_rate(ice, substream->runtime->rate, 0); + if (err < 0) + return err; + } spin_lock_irq(&ice->reg_lock); outl(substream->runtime->dma_addr, ice->profi_port + reg->addr); -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [resend] 3c509: convert to isa_driver and pnp_driver v5
Hello, this patch converts 3c509 driver to isa_driver and pnp_driver. The result is that autoloading using udev and hibernation works with ISA PnP cards. It also adds hibernation support for non-PnP ISA cards. xcvr module parameter was removed as its value was not used. Tested using 3 ISA cards in various combinations of PnP and non-PnP modes. EISA and MCA only compile-tested. Signed-off-by: Ondrej Zary <[EMAIL PROTECTED]> --- linux-2.6.24-orig/drivers/net/3c509.c 2008-01-27 19:48:19.0 +0100 +++ linux-2.6.24-pentium/drivers/net/3c509.c2008-02-10 21:52:04.0 +0100 @@ -54,25 +54,24 @@ v1.19a 28Oct2002 Davud Ruggiero <[EMAIL PROTECTED]> - Increase *read_eeprom udelay to workaround oops with 2 cards. v1.19b 08Nov2002 Marc Zyngier <[EMAIL PROTECTED]> - - Introduce driver model for EISA cards. + - Introduce driver model for EISA cards. + v1.20 04Feb2008 Ondrej Zary <[EMAIL PROTECTED]> + - convert to isa_driver and pnp_driver and some cleanups */ #define DRV_NAME "3c509" -#define DRV_VERSION"1.19b" -#define DRV_RELDATE"08Nov2002" +#define DRV_VERSION"1.20" +#define DRV_RELDATE"04Feb2008" /* A few values that may be tweaked. */ /* Time in jiffies before concluding the transmitter is hung. */ #define TX_TIMEOUT (400*HZ/1000) -/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ -static int max_interrupt_work = 10; #include -#ifdef CONFIG_MCA #include -#endif -#include +#include +#include #include #include #include @@ -97,10 +96,6 @@ static char version[] __initdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " [EMAIL PROTECTED]"; -#if defined(CONFIG_PM) && (defined(CONFIG_MCA) || defined(CONFIG_EISA)) -#define EL3_SUSPEND -#endif - #ifdef EL3_DEBUG static int el3_debug = EL3_DEBUG; #else @@ -111,6 +106,7 @@ * a global variable so that the mca/eisa probe routines can increment * it */ static int el3_cards = 0; +#define EL3_MAX_CARDS 8 /* To minimize the size of the driver source I only define operating constants if they are used several times. You'll need the manual @@ -119,7 +115,7 @@ #define EL3_DATA 0x00 #define EL3_CMD 0x0e #define EL3_STATUS 0x0e -#define EEPROM_READ 0x80 +#defineEEPROM_READ 0x80 #define EL3_IO_EXTENT 16 @@ -168,23 +164,31 @@ */ #define SKB_QUEUE_SIZE 64 +enum el3_cardtype { EL3_ISA, EL3_PNP, EL3_MCA, EL3_EISA }; + struct el3_private { struct net_device_stats stats; - struct net_device *next_dev; spinlock_t lock; /* skb send-queue */ int head, size; struct sk_buff *queue[SKB_QUEUE_SIZE]; - enum { - EL3_MCA, - EL3_PNP, - EL3_EISA, - } type; /* type of device */ - struct device *dev; + enum el3_cardtype type; }; -static int id_port __initdata = 0x110; /* Start with 0x110 to avoid new sound cards.*/ -static struct net_device *el3_root_dev; +static int id_port; +static int current_tag; +static struct net_device *el3_devs[EL3_MAX_CARDS]; + +/* Parameters that may be passed into the module. */ +static int debug = -1; +static int irq[] = {-1, -1, -1, -1, -1, -1, -1, -1}; +/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ +static int max_interrupt_work = 10; +#ifdef CONFIG_PNP +static int nopnp; +#endif +static int __init el3_common_init(struct net_device *dev); +static void el3_common_remove(struct net_device *dev); static ushort id_read_eeprom(int index); static ushort read_eeprom(int ioaddr, int index); static int el3_open(struct net_device *dev); @@ -199,23 +203,279 @@ static void el3_down(struct net_device *dev); static void el3_up(struct net_device *dev); static const struct ethtool_ops ethtool_ops; -#ifdef EL3_SUSPEND +#ifdef CONFIG_PM static int el3_suspend(struct device *, pm_message_t); static int el3_resume(struct device *); -#else -#define el3_suspend NULL -#define el3_resume NULL #endif /* generic device remove for all device types */ -#if defined(CONFIG_EISA) || defined(CONFIG_MCA) static int el3_device_remove (struct device *device); -#endif #ifdef CONFIG_NET_POLL_CONTROLLER static void el3_poll_controller(struct net_device *dev); #endif +/* Return 0 on success, 1 on error, 2 when found already detected PnP card */ +static int el3_isa_id_sequence(__be16 *phys_addr) +{ + short lrs_state = 0xff; + int i; + + /* ISA boards are detected by sending the ID sequence to the + ID_PORT. We find cards past the first by setting the 'current_tag' + on cards as they are found. Cards with their tag set will not + respond to subsequent ID sequences. */
Re: Compex FreedomLine 32 PnP-PCI2 broken with de2104x
On Monday 18 February 2008 04:21:11 Grant Grundler wrote: > On Wed, Jan 30, 2008 at 09:23:06PM +0100, Ondrej Zary wrote: > > On Saturday 26 January 2008 21:58:10 Ondrej Zary wrote: > > > Hello, > > > I was having problems with these FreedomLine cards with Linux before > > > but tested it thoroughly today. This card uses DEC 21041 chip and has > > > TP and BNC connectors: > > > > > > 00:12.0 Ethernet controller [0200]: Digital Equipment Corporation > > > DECchip 21041 [Tulip Pass 3] [1011:0014] (rev 21) > > > > > > > > > de2104x driver was loaded automatically by udev and card seemed to > > > work. Until I disconnected the TP cable and putting it back after a > > > while. The driver then switched to (non-existing) AUI port and remained > > > there. I tried to set media to TP using ethtool - and the whole kernel > > > crashed because of BUG_ON(de_is_running(de)); > > > in de_set_media(). Seems that the driver is unable to stop the DMA in > > > de_stop_rxtx(). > > The BUG_ON() is probably fine normally. But the media selection sounds > broken. It's possible to select the wrong media type with 21040 chip but > shouldn't be possible with 21041. For 21040 support, see > de21040_get_media_info(). But de21041_get_srom_info() is expected to > determine which media > types are supported from SEPROM "media blocks". My guess is that code > is broken since it seems to work with de405 driver. If you care to > work the difference, I'd be happy to make a patch to fix that up. I don't think that BUG_ON() should be there. It should probably printk a warning but certainly not crash the whole machine. > Also, from code review, DE2104X driver still has a few places with > potential PCI MMIO Write posting issues. Specifically, I was looking > in de_stop_hw() and de_set_media(). Several other bits of code correctly > flush MMIO writes: e.g. tulip_read_eeprom(). > > > > I commented out AUI detection in the driver - this time it switched to > > > BNC after unplugging the cable and remained there. I also attempted to > > > reset the chip when de_stop_rxtx failed but failed to do it. > > You'd have to basically hardcode only one media type and it's corresponding > parameters. That's bad. It just works with de4x5 with any cable at any time. > > > Then I found that there's de4x5 driver which supports the same cards as > > > de2104x (and some other too) - and this one works fine! I can plug and > > > unplug the cable and even change between TP and BNC ports just by > > > unplugging one and plugging the other cable in. Unfortunately, this > > > driver is blacklisted by default - at least in Slackware and Debian. > > ISTR there was a time when tulip would compete with de4x5 for devices. > tulip is the preferred driver. That's clearly no longer the case > and perhaps both distro's need to revisit this. de4x5 has no MODULE_DEVICE_TABLE for PCI devices anymore, so no conflicts. That's probably good for cards that work with tulip driver but bad for mine card and also probably for some other cards that (should) work with de2104x. > > > > The question is: why does de2104x exist? Does it work better with some > > > hardware? > > de2104x is a "work in progress". > That's why it's marked "EXPERIMENTAL" in the Kconfig file. Great, it looks to be 6 years old and it's still experimental. Probably because it never worked properly. I think that de2104x driver should be removed (or at least its MODULE_DEVICE_TABLE) and MODULE_DEVICE_TABLE with only 21040 and 21041 PCI IDs added to de4x5. I can send a patch if this is acceptable. > > > > BTW. Found that the problem exist at least since 2003: > > > http://oss.sgi.com/archives/netdev/2003-08/msg00951.html > > > > Does the de2104x driver work correctly for anyone? > > No idea. I've only used tulip driver. > > thanks for the bug report, > grant > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to [EMAIL PROTECTED] > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [resend] 3c509: convert to isa_driver and pnp_driver v3
Hello, this patch converts 3c509 driver to isa_driver and pnp_driver. The result is that autoloading using udev and hibernation works with ISA PnP cards. It also adds hibernation support for non-PnP ISA cards. xcvr module parameter was removed as its value was not used. Tested using 3 ISA cards in various combinations of PnP and non-PnP modes. Signed-off-by: Ondrej Zary <[EMAIL PROTECTED]> --- linux-2.6.24-orig/drivers/net/3c509.c 2008-01-27 19:48:19.0 +0100 +++ linux-2.6.24-pentium/drivers/net/3c509.c2008-02-04 22:30:37.0 +0100 @@ -54,25 +54,24 @@ v1.19a 28Oct2002 Davud Ruggiero <[EMAIL PROTECTED]> - Increase *read_eeprom udelay to workaround oops with 2 cards. v1.19b 08Nov2002 Marc Zyngier <[EMAIL PROTECTED]> - - Introduce driver model for EISA cards. + - Introduce driver model for EISA cards. + v1.20 04Feb2008 Ondrej Zary <[EMAIL PROTECTED]> + - convert to isa_driver and pnp_driver and some cleanups */ #define DRV_NAME "3c509" -#define DRV_VERSION"1.19b" -#define DRV_RELDATE"08Nov2002" +#define DRV_VERSION"1.20" +#define DRV_RELDATE"04Feb2008" /* A few values that may be tweaked. */ /* Time in jiffies before concluding the transmitter is hung. */ #define TX_TIMEOUT (400*HZ/1000) -/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ -static int max_interrupt_work = 10; #include -#ifdef CONFIG_MCA #include -#endif -#include +#include +#include #include #include #include @@ -97,10 +96,6 @@ static char version[] __initdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " [EMAIL PROTECTED]"; -#if defined(CONFIG_PM) && (defined(CONFIG_MCA) || defined(CONFIG_EISA)) -#define EL3_SUSPEND -#endif - #ifdef EL3_DEBUG static int el3_debug = EL3_DEBUG; #else @@ -111,6 +106,7 @@ * a global variable so that the mca/eisa probe routines can increment * it */ static int el3_cards = 0; +#define EL3_MAX_CARDS 8 /* To minimize the size of the driver source I only define operating constants if they are used several times. You'll need the manual @@ -119,7 +115,7 @@ #define EL3_DATA 0x00 #define EL3_CMD 0x0e #define EL3_STATUS 0x0e -#define EEPROM_READ 0x80 +#defineEEPROM_READ 0x80 #define EL3_IO_EXTENT 16 @@ -168,23 +164,31 @@ */ #define SKB_QUEUE_SIZE 64 +typedef enum { EL3_ISA, EL3_PNP, EL3_MCA, EL3_EISA } el3_cardtype; + struct el3_private { struct net_device_stats stats; - struct net_device *next_dev; spinlock_t lock; /* skb send-queue */ int head, size; struct sk_buff *queue[SKB_QUEUE_SIZE]; - enum { - EL3_MCA, - EL3_PNP, - EL3_EISA, - } type; /* type of device */ - struct device *dev; + el3_cardtype type; }; -static int id_port __initdata = 0x110; /* Start with 0x110 to avoid new sound cards.*/ -static struct net_device *el3_root_dev; +static int id_port; +static int current_tag; +static struct net_device *el3_devs[EL3_MAX_CARDS]; + +/* Parameters that may be passed into the module. */ +static int debug = -1; +static int irq[] = {-1, -1, -1, -1, -1, -1, -1, -1}; +/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ +static int max_interrupt_work = 10; +#ifdef CONFIG_PNP +static int nopnp; +#endif +static int __init el3_common_init(struct net_device *dev); +static void el3_common_remove (struct net_device *dev); static ushort id_read_eeprom(int index); static ushort read_eeprom(int ioaddr, int index); static int el3_open(struct net_device *dev); @@ -199,23 +203,277 @@ static void el3_down(struct net_device *dev); static void el3_up(struct net_device *dev); static const struct ethtool_ops ethtool_ops; -#ifdef EL3_SUSPEND +#ifdef CONFIG_PM static int el3_suspend(struct device *, pm_message_t); static int el3_resume(struct device *); -#else -#define el3_suspend NULL -#define el3_resume NULL #endif /* generic device remove for all device types */ -#if defined(CONFIG_EISA) || defined(CONFIG_MCA) static int el3_device_remove (struct device *device); -#endif #ifdef CONFIG_NET_POLL_CONTROLLER static void el3_poll_controller(struct net_device *dev); #endif +/* Return 0 on success, 1 on error, 2 when found already detected PnP card */ +static int el3_isa_id_sequence(__be16 *phys_addr) +{ + short lrs_state = 0xff; + int i; + + /* ISA boards are detected by sending the ID sequence to the + ID_PORT. We find cards past the first by setting the 'current_tag' + on cards as they are found. Cards with their tag set will not + respond to subsequent ID sequences. */ + + outb(0x00, id_port); +
[PATCH] 3c509: convert to isa_driver and pnp_driver v4
Hello, this patch converts 3c509 driver to isa_driver and pnp_driver. The result is that autoloading using udev and hibernation works with ISA PnP cards. It also adds hibernation support for non-PnP ISA cards. xcvr module parameter was removed as its value was not used. Tested using 3 ISA cards in various combinations of PnP and non-PnP modes. EISA and MCA only compile-tested. Signed-off-by: Ondrej Zary <[EMAIL PROTECTED]> --- linux-2.6.24-orig/drivers/net/3c509.c 2008-01-27 19:48:19.0 +0100 +++ linux-2.6.24-pentium/drivers/net/3c509.c2008-02-07 17:58:45.0 +0100 @@ -54,25 +54,24 @@ v1.19a 28Oct2002 Davud Ruggiero <[EMAIL PROTECTED]> - Increase *read_eeprom udelay to workaround oops with 2 cards. v1.19b 08Nov2002 Marc Zyngier <[EMAIL PROTECTED]> - - Introduce driver model for EISA cards. + - Introduce driver model for EISA cards. + v1.20 04Feb2008 Ondrej Zary <[EMAIL PROTECTED]> + - convert to isa_driver and pnp_driver and some cleanups */ #define DRV_NAME "3c509" -#define DRV_VERSION"1.19b" -#define DRV_RELDATE"08Nov2002" +#define DRV_VERSION"1.20" +#define DRV_RELDATE"04Feb2008" /* A few values that may be tweaked. */ /* Time in jiffies before concluding the transmitter is hung. */ #define TX_TIMEOUT (400*HZ/1000) -/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ -static int max_interrupt_work = 10; #include -#ifdef CONFIG_MCA #include -#endif -#include +#include +#include #include #include #include @@ -97,10 +96,6 @@ static char version[] __initdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " [EMAIL PROTECTED]"; -#if defined(CONFIG_PM) && (defined(CONFIG_MCA) || defined(CONFIG_EISA)) -#define EL3_SUSPEND -#endif - #ifdef EL3_DEBUG static int el3_debug = EL3_DEBUG; #else @@ -111,6 +106,7 @@ * a global variable so that the mca/eisa probe routines can increment * it */ static int el3_cards = 0; +#define EL3_MAX_CARDS 8 /* To minimize the size of the driver source I only define operating constants if they are used several times. You'll need the manual @@ -119,7 +115,7 @@ #define EL3_DATA 0x00 #define EL3_CMD 0x0e #define EL3_STATUS 0x0e -#define EEPROM_READ 0x80 +#defineEEPROM_READ 0x80 #define EL3_IO_EXTENT 16 @@ -168,23 +164,31 @@ */ #define SKB_QUEUE_SIZE 64 +typedef enum { EL3_ISA, EL3_PNP, EL3_MCA, EL3_EISA } el3_cardtype; + struct el3_private { struct net_device_stats stats; - struct net_device *next_dev; spinlock_t lock; /* skb send-queue */ int head, size; struct sk_buff *queue[SKB_QUEUE_SIZE]; - enum { - EL3_MCA, - EL3_PNP, - EL3_EISA, - } type; /* type of device */ - struct device *dev; + el3_cardtype type; }; -static int id_port __initdata = 0x110; /* Start with 0x110 to avoid new sound cards.*/ -static struct net_device *el3_root_dev; +static int id_port; +static int current_tag; +static struct net_device *el3_devs[EL3_MAX_CARDS]; + +/* Parameters that may be passed into the module. */ +static int debug = -1; +static int irq[] = {-1, -1, -1, -1, -1, -1, -1, -1}; +/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ +static int max_interrupt_work = 10; +#ifdef CONFIG_PNP +static int nopnp; +#endif +static int __init el3_common_init(struct net_device *dev); +static void el3_common_remove (struct net_device *dev); static ushort id_read_eeprom(int index); static ushort read_eeprom(int ioaddr, int index); static int el3_open(struct net_device *dev); @@ -199,23 +203,277 @@ static void el3_down(struct net_device *dev); static void el3_up(struct net_device *dev); static const struct ethtool_ops ethtool_ops; -#ifdef EL3_SUSPEND +#ifdef CONFIG_PM static int el3_suspend(struct device *, pm_message_t); static int el3_resume(struct device *); -#else -#define el3_suspend NULL -#define el3_resume NULL #endif /* generic device remove for all device types */ -#if defined(CONFIG_EISA) || defined(CONFIG_MCA) static int el3_device_remove (struct device *device); -#endif #ifdef CONFIG_NET_POLL_CONTROLLER static void el3_poll_controller(struct net_device *dev); #endif +/* Return 0 on success, 1 on error, 2 when found already detected PnP card */ +static int el3_isa_id_sequence(__be16 *phys_addr) +{ + short lrs_state = 0xff; + int i; + + /* ISA boards are detected by sending the ID sequence to the + ID_PORT. We find cards past the first by setting the 'current_tag' + on cards as they are found. Cards with their tag set will not + respond to subsequent ID sequences. */
[PATCH] [resend] 3c509: convert to isa_driver and pnp_driver v4
Hello, this patch converts 3c509 driver to isa_driver and pnp_driver. The result is that autoloading using udev and hibernation works with ISA PnP cards. It also adds hibernation support for non-PnP ISA cards. xcvr module parameter was removed as its value was not used. Tested using 3 ISA cards in various combinations of PnP and non-PnP modes. EISA and MCA only compile-tested. Signed-off-by: Ondrej Zary <[EMAIL PROTECTED]> --- linux-2.6.24-orig/drivers/net/3c509.c 2008-01-27 19:48:19.0 +0100 +++ linux-2.6.24-pentium/drivers/net/3c509.c2008-02-07 17:58:45.0 +0100 @@ -54,25 +54,24 @@ v1.19a 28Oct2002 Davud Ruggiero <[EMAIL PROTECTED]> - Increase *read_eeprom udelay to workaround oops with 2 cards. v1.19b 08Nov2002 Marc Zyngier <[EMAIL PROTECTED]> - - Introduce driver model for EISA cards. + - Introduce driver model for EISA cards. + v1.20 04Feb2008 Ondrej Zary <[EMAIL PROTECTED]> + - convert to isa_driver and pnp_driver and some cleanups */ #define DRV_NAME "3c509" -#define DRV_VERSION"1.19b" -#define DRV_RELDATE"08Nov2002" +#define DRV_VERSION"1.20" +#define DRV_RELDATE"04Feb2008" /* A few values that may be tweaked. */ /* Time in jiffies before concluding the transmitter is hung. */ #define TX_TIMEOUT (400*HZ/1000) -/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ -static int max_interrupt_work = 10; #include -#ifdef CONFIG_MCA #include -#endif -#include +#include +#include #include #include #include @@ -97,10 +96,6 @@ static char version[] __initdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " [EMAIL PROTECTED]"; -#if defined(CONFIG_PM) && (defined(CONFIG_MCA) || defined(CONFIG_EISA)) -#define EL3_SUSPEND -#endif - #ifdef EL3_DEBUG static int el3_debug = EL3_DEBUG; #else @@ -111,6 +106,7 @@ * a global variable so that the mca/eisa probe routines can increment * it */ static int el3_cards = 0; +#define EL3_MAX_CARDS 8 /* To minimize the size of the driver source I only define operating constants if they are used several times. You'll need the manual @@ -119,7 +115,7 @@ #define EL3_DATA 0x00 #define EL3_CMD 0x0e #define EL3_STATUS 0x0e -#define EEPROM_READ 0x80 +#defineEEPROM_READ 0x80 #define EL3_IO_EXTENT 16 @@ -168,23 +164,31 @@ */ #define SKB_QUEUE_SIZE 64 +typedef enum { EL3_ISA, EL3_PNP, EL3_MCA, EL3_EISA } el3_cardtype; + struct el3_private { struct net_device_stats stats; - struct net_device *next_dev; spinlock_t lock; /* skb send-queue */ int head, size; struct sk_buff *queue[SKB_QUEUE_SIZE]; - enum { - EL3_MCA, - EL3_PNP, - EL3_EISA, - } type; /* type of device */ - struct device *dev; + el3_cardtype type; }; -static int id_port __initdata = 0x110; /* Start with 0x110 to avoid new sound cards.*/ -static struct net_device *el3_root_dev; +static int id_port; +static int current_tag; +static struct net_device *el3_devs[EL3_MAX_CARDS]; + +/* Parameters that may be passed into the module. */ +static int debug = -1; +static int irq[] = {-1, -1, -1, -1, -1, -1, -1, -1}; +/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ +static int max_interrupt_work = 10; +#ifdef CONFIG_PNP +static int nopnp; +#endif +static int __init el3_common_init(struct net_device *dev); +static void el3_common_remove (struct net_device *dev); static ushort id_read_eeprom(int index); static ushort read_eeprom(int ioaddr, int index); static int el3_open(struct net_device *dev); @@ -199,23 +203,277 @@ static void el3_down(struct net_device *dev); static void el3_up(struct net_device *dev); static const struct ethtool_ops ethtool_ops; -#ifdef EL3_SUSPEND +#ifdef CONFIG_PM static int el3_suspend(struct device *, pm_message_t); static int el3_resume(struct device *); -#else -#define el3_suspend NULL -#define el3_resume NULL #endif /* generic device remove for all device types */ -#if defined(CONFIG_EISA) || defined(CONFIG_MCA) static int el3_device_remove (struct device *device); -#endif #ifdef CONFIG_NET_POLL_CONTROLLER static void el3_poll_controller(struct net_device *dev); #endif +/* Return 0 on success, 1 on error, 2 when found already detected PnP card */ +static int el3_isa_id_sequence(__be16 *phys_addr) +{ + short lrs_state = 0xff; + int i; + + /* ISA boards are detected by sending the ID sequence to the + ID_PORT. We find cards past the first by setting the 'current_tag' + on cards as they are found. Cards with their tag set will not + respond to subsequent ID sequences. */
Re: [PATCH] [resend] 3c509: convert to isa_driver and pnp_driver v4
On Saturday 09 February 2008 22:48:05 Stephen Hemminger wrote: > On Sat, 9 Feb 2008 22:33:07 +0100 > > Ondrej Zary <[EMAIL PROTECTED]> wrote: > > Hello, > > this patch converts 3c509 driver to isa_driver and pnp_driver. The result > > is that autoloading using udev and hibernation works with ISA PnP cards. > > It also adds hibernation support for non-PnP ISA cards. > > > > xcvr module parameter was removed as its value was not used. > > > > Tested using 3 ISA cards in various combinations of PnP and non-PnP > > modes. EISA and MCA only compile-tested. > > > > Signed-off-by: Ondrej Zary <[EMAIL PROTECTED]> > > > > --- linux-2.6.24-orig/drivers/net/3c509.c 2008-01-27 19:48:19.0 > > +0100 +++ linux-2.6.24-pentium/drivers/net/3c509.c 2008-02-07 > > 17:58:45.0 +0100 @@ -54,25 +54,24 @@ > > v1.19a 28Oct2002 Davud Ruggiero <[EMAIL PROTECTED]> > > - Increase *read_eeprom udelay to workaround oops with > > 2 cards. > > v1.19b 08Nov2002 Marc Zyngier <[EMAIL PROTECTED]> > > - - Introduce driver model for EISA cards. > > + - Introduce driver model for EISA cards. > > + v1.20 04Feb2008 Ondrej Zary <[EMAIL PROTECTED]> > > + - convert to isa_driver and pnp_driver and some cleanups > > */ > > Don't bother with comment, kernel uses git change log to figure out > who to blame. > > > #define DRV_NAME "3c509" > > -#define DRV_VERSION"1.19b" > > -#define DRV_RELDATE"08Nov2002" > > +#define DRV_VERSION"1.20" > > +#define DRV_RELDATE"04Feb2008" > > > > /* A few values that may be tweaked. */ > > > > /* Time in jiffies before concluding the transmitter is hung. */ > > #define TX_TIMEOUT (400*HZ/1000) > > -/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ > > -static int max_interrupt_work = 10; > > > > #include > > -#ifdef CONFIG_MCA > > #include > > -#endif > > -#include > > +#include > > +#include > > #include > > #include > > #include > > @@ -97,10 +96,6 @@ > > > > static char version[] __initdata = DRV_NAME ".c:" DRV_VERSION " " > > DRV_RELDATE " [EMAIL PROTECTED]"; > > > > -#if defined(CONFIG_PM) && (defined(CONFIG_MCA) || defined(CONFIG_EISA)) > > -#define EL3_SUSPEND > > -#endif > > - > > #ifdef EL3_DEBUG > > static int el3_debug = EL3_DEBUG; > > #else > > @@ -111,6 +106,7 @@ > > * a global variable so that the mca/eisa probe routines can increment > > * it */ > > static int el3_cards = 0; > > +#define EL3_MAX_CARDS 8 > > > > /* To minimize the size of the driver source I only define operating > > constants if they are used several times. You'll need the manual > > @@ -119,7 +115,7 @@ > > #define EL3_DATA 0x00 > > #define EL3_CMD 0x0e > > #define EL3_STATUS 0x0e > > -#define EEPROM_READ 0x80 > > +#defineEEPROM_READ 0x80 > > > > #define EL3_IO_EXTENT 16 > > > > @@ -168,23 +164,31 @@ > > */ > > #define SKB_QUEUE_SIZE 64 > > > > +typedef enum { EL3_ISA, EL3_PNP, EL3_MCA, EL3_EISA } el3_cardtype; > > + > > No typedef please (see checkpatch) Is there any standard way to solve this without a typedef? I added el3_dev_fill() function which fills that card type value according to a parameter passed to it. "int" could be used instead and "#define EL3_ISA 0", "#define EL3_PNP 1" - but I think that's ugly. > > > struct el3_private { > > struct net_device_stats stats; > > Use network device stats in net_device now OK, looks like the driver will need some more patches. > > - struct net_device *next_dev; > > spinlock_t lock; > > /* skb send-queue */ > > int head, size; > > struct sk_buff *queue[SKB_QUEUE_SIZE]; > > What about sk_buff_head (linked list instead)? I don't know anything about this, maybe in next patch. > > > - enum { > > - EL3_MCA, > > - EL3_PNP, > > - EL3_EISA, > > - } type; /* type of device */ > > - struct device *dev; > > + el3_cardtype type; > > }; > > -static int id_port __initdata = 0x110; /* Start with 0x110 to avoid new > > sound cards.*/ -static struct net_device *el3_root_dev;
[PATCH] 3c509: convert to isa_driver and pnp_driver v5
Hello, this patch converts 3c509 driver to isa_driver and pnp_driver. The result is that autoloading using udev and hibernation works with ISA PnP cards. It also adds hibernation support for non-PnP ISA cards. xcvr module parameter was removed as its value was not used. Tested using 3 ISA cards in various combinations of PnP and non-PnP modes. EISA and MCA only compile-tested. Signed-off-by: Ondrej Zary <[EMAIL PROTECTED]> --- linux-2.6.24-orig/drivers/net/3c509.c 2008-01-27 19:48:19.0 +0100 +++ linux-2.6.24-pentium/drivers/net/3c509.c2008-02-10 21:52:04.0 +0100 @@ -54,25 +54,24 @@ v1.19a 28Oct2002 Davud Ruggiero <[EMAIL PROTECTED]> - Increase *read_eeprom udelay to workaround oops with 2 cards. v1.19b 08Nov2002 Marc Zyngier <[EMAIL PROTECTED]> - - Introduce driver model for EISA cards. + - Introduce driver model for EISA cards. + v1.20 04Feb2008 Ondrej Zary <[EMAIL PROTECTED]> + - convert to isa_driver and pnp_driver and some cleanups */ #define DRV_NAME "3c509" -#define DRV_VERSION"1.19b" -#define DRV_RELDATE"08Nov2002" +#define DRV_VERSION"1.20" +#define DRV_RELDATE"04Feb2008" /* A few values that may be tweaked. */ /* Time in jiffies before concluding the transmitter is hung. */ #define TX_TIMEOUT (400*HZ/1000) -/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ -static int max_interrupt_work = 10; #include -#ifdef CONFIG_MCA #include -#endif -#include +#include +#include #include #include #include @@ -97,10 +96,6 @@ static char version[] __initdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " [EMAIL PROTECTED]"; -#if defined(CONFIG_PM) && (defined(CONFIG_MCA) || defined(CONFIG_EISA)) -#define EL3_SUSPEND -#endif - #ifdef EL3_DEBUG static int el3_debug = EL3_DEBUG; #else @@ -111,6 +106,7 @@ * a global variable so that the mca/eisa probe routines can increment * it */ static int el3_cards = 0; +#define EL3_MAX_CARDS 8 /* To minimize the size of the driver source I only define operating constants if they are used several times. You'll need the manual @@ -119,7 +115,7 @@ #define EL3_DATA 0x00 #define EL3_CMD 0x0e #define EL3_STATUS 0x0e -#define EEPROM_READ 0x80 +#defineEEPROM_READ 0x80 #define EL3_IO_EXTENT 16 @@ -168,23 +164,31 @@ */ #define SKB_QUEUE_SIZE 64 +enum el3_cardtype { EL3_ISA, EL3_PNP, EL3_MCA, EL3_EISA }; + struct el3_private { struct net_device_stats stats; - struct net_device *next_dev; spinlock_t lock; /* skb send-queue */ int head, size; struct sk_buff *queue[SKB_QUEUE_SIZE]; - enum { - EL3_MCA, - EL3_PNP, - EL3_EISA, - } type; /* type of device */ - struct device *dev; + enum el3_cardtype type; }; -static int id_port __initdata = 0x110; /* Start with 0x110 to avoid new sound cards.*/ -static struct net_device *el3_root_dev; +static int id_port; +static int current_tag; +static struct net_device *el3_devs[EL3_MAX_CARDS]; + +/* Parameters that may be passed into the module. */ +static int debug = -1; +static int irq[] = {-1, -1, -1, -1, -1, -1, -1, -1}; +/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ +static int max_interrupt_work = 10; +#ifdef CONFIG_PNP +static int nopnp; +#endif +static int __init el3_common_init(struct net_device *dev); +static void el3_common_remove(struct net_device *dev); static ushort id_read_eeprom(int index); static ushort read_eeprom(int ioaddr, int index); static int el3_open(struct net_device *dev); @@ -199,23 +203,279 @@ static void el3_down(struct net_device *dev); static void el3_up(struct net_device *dev); static const struct ethtool_ops ethtool_ops; -#ifdef EL3_SUSPEND +#ifdef CONFIG_PM static int el3_suspend(struct device *, pm_message_t); static int el3_resume(struct device *); -#else -#define el3_suspend NULL -#define el3_resume NULL #endif /* generic device remove for all device types */ -#if defined(CONFIG_EISA) || defined(CONFIG_MCA) static int el3_device_remove (struct device *device); -#endif #ifdef CONFIG_NET_POLL_CONTROLLER static void el3_poll_controller(struct net_device *dev); #endif +/* Return 0 on success, 1 on error, 2 when found already detected PnP card */ +static int el3_isa_id_sequence(__be16 *phys_addr) +{ + short lrs_state = 0xff; + int i; + + /* ISA boards are detected by sending the ID sequence to the + ID_PORT. We find cards past the first by setting the 'current_tag' + on cards as they are found. Cards with their tag set will not + respond to subsequent ID sequences. */
[PATCH 1/2] snd-ad1816a: remove useless struct snd_card_ad1816a
struct snd_card_ad1816a is only set but the values are never used then. Removing it allows struct snd_card's private_data to be used for struct snd_ad1816a, simplifying the code. Signed-off-by: Ondrej Zary diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h index d010858..62da41e 100644 --- a/include/sound/ad1816a.h +++ b/include/sound/ad1816a.h @@ -165,7 +165,7 @@ struct snd_ad1816a { extern int snd_ad1816a_create(struct snd_card *card, unsigned long port, int irq, int dma1, int dma2, - struct snd_ad1816a **chip); + struct snd_ad1816a *chip); extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm); extern int snd_ad1816a_mixer(struct snd_ad1816a *chip); diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index 94b83b6..1a374e6 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c @@ -63,11 +63,6 @@ MODULE_PARM_DESC(enable, "Enable ad1816a based soundcard."); module_param_array(clockfreq, int, NULL, 0444); MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0)."); -struct snd_card_ad1816a { - struct pnp_dev *dev; - struct pnp_dev *devmpu; -}; - static struct pnp_card_device_id snd_ad1816a_pnpids[] = { /* Analog Devices AD1815 */ { .id = "ADS7150", .devs = { { .id = "ADS7150" }, { .id = "ADS7151" } } }, @@ -99,25 +94,16 @@ MODULE_DEVICE_TABLE(pnp_card, snd_ad1816a_pnpids); #defineDRIVER_NAME "snd-card-ad1816a" -static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acard, - struct pnp_card_link *card, +static int __devinit snd_card_ad1816a_pnp(int dev, struct pnp_card_link *card, const struct pnp_card_device_id *id) { struct pnp_dev *pdev; int err; - acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); - if (acard->dev == NULL) + pdev = pnp_request_card_device(card, id->devs[0].id, NULL); + if (pdev == NULL) return -EBUSY; - acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL); - if (acard->devmpu == NULL) { - mpu_port[dev] = -1; - snd_printk(KERN_WARNING PFX "MPU401 device busy, skipping.\n"); - } - - pdev = acard->dev; - err = pnp_activate_dev(pdev); if (err < 0) { printk(KERN_ERR PFX "AUDIO PnP configure failure\n"); @@ -130,16 +116,17 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar dma2[dev] = pnp_dma(pdev, 1); irq[dev] = pnp_irq(pdev, 0); - if (acard->devmpu == NULL) + pdev = pnp_request_card_device(card, id->devs[1].id, NULL); + if (pdev == NULL) { + mpu_port[dev] = -1; + snd_printk(KERN_WARNING PFX "MPU401 device busy, skipping.\n"); return 0; - - pdev = acard->devmpu; + } err = pnp_activate_dev(pdev); if (err < 0) { printk(KERN_ERR PFX "MPU401 PnP configure failure\n"); mpu_port[dev] = -1; - acard->devmpu = NULL; } else { mpu_port[dev] = pnp_port_start(pdev, 0); mpu_irq[dev] = pnp_irq(pdev, 0); @@ -153,18 +140,17 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard { int error; struct snd_card *card; - struct snd_card_ad1816a *acard; struct snd_ad1816a *chip; struct snd_opl3 *opl3; struct snd_timer *timer; error = snd_card_create(index[dev], id[dev], THIS_MODULE, - sizeof(struct snd_card_ad1816a), &card); + sizeof(struct snd_ad1816a), &card); if (error < 0) return error; - acard = card->private_data; + chip = card->private_data; - if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) { + if ((error = snd_card_ad1816a_pnp(dev, pcard, pid))) { snd_card_free(card); return error; } @@ -174,7 +160,7 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard irq[dev], dma1[dev], dma2[dev], - &chip)) < 0) { + chip)) < 0) { snd_card_free(card); return error; } diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index 177eed3..de5cc1c 100644 --- a/sound/isa/ad
[PATCH 2/2] snd-ad1816a: Implement suspend/resume
Implement suspend/resume support for AD1816 chips. Tested with Terratec SoundSystem Base-1. Signed-off-by: Ondrej Zary diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h index 62da41e..2a89f0d 100644 --- a/include/sound/ad1816a.h +++ b/include/sound/ad1816a.h @@ -147,6 +147,9 @@ struct snd_ad1816a { unsigned int c_dma_size; struct snd_timer *timer; +#ifdef CONFIG_PM + unsigned short image[48]; +#endif }; @@ -171,5 +174,9 @@ extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm extern int snd_ad1816a_mixer(struct snd_ad1816a *chip); extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device, struct snd_timer **rtimer); +#ifdef CONFIG_PM +extern void snd_ad1816a_suspend(struct snd_ad1816a *chip); +extern void snd_ad1816a_resume(struct snd_ad1816a *chip); +#endif #endif /* __SOUND_AD1816A_H */ diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index 1a374e6..2c2f829 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c @@ -244,13 +244,37 @@ static void __devexit snd_ad1816a_pnp_remove(struct pnp_card_link * pcard) pnp_set_card_drvdata(pcard, NULL); } +#ifdef CONFIG_PM +static int snd_ad1816a_pnp_suspend(struct pnp_card_link *pcard, + pm_message_t state) +{ + struct snd_card *card = pnp_get_card_drvdata(pcard); + + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + snd_ad1816a_suspend(card->private_data); + return 0; +} + +static int snd_ad1816a_pnp_resume(struct pnp_card_link *pcard) +{ + struct snd_card *card = pnp_get_card_drvdata(pcard); + + snd_ad1816a_resume(card->private_data); + snd_power_change_state(card, SNDRV_CTL_POWER_D0); + return 0; +} +#endif + static struct pnp_card_driver ad1816a_pnpc_driver = { .flags = PNP_DRIVER_RES_DISABLE, .name = "ad1816a", .id_table = snd_ad1816a_pnpids, .probe = snd_ad1816a_pnp_detect, .remove = __devexit_p(snd_ad1816a_pnp_remove), - /* FIXME: suspend/resume */ +#ifdef CONFIG_PM + .suspend= snd_ad1816a_pnp_suspend, + .resume = snd_ad1816a_pnp_resume, +#endif }; static int __init alsa_card_ad1816a_init(void) diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index de5cc1c..db64df6 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c @@ -491,7 +491,7 @@ static int snd_ad1816a_capture_close(struct snd_pcm_substream *substream) } -static void __devinit snd_ad1816a_init(struct snd_ad1816a *chip) +static void snd_ad1816a_init(struct snd_ad1816a *chip) { unsigned long flags; @@ -511,6 +511,32 @@ static void __devinit snd_ad1816a_init(struct snd_ad1816a *chip) spin_unlock_irqrestore(&chip->lock, flags); } +#ifdef CONFIG_PM +void snd_ad1816a_suspend(struct snd_ad1816a *chip) +{ + int reg; + unsigned long flags; + + snd_pcm_suspend_all(chip->pcm); + spin_lock_irqsave(&chip->lock, flags); + for (reg = 0; reg < 48; reg++) + chip->image[reg] = snd_ad1816a_read(chip, reg); + spin_unlock_irqrestore(&chip->lock, flags); +} + +void snd_ad1816a_resume(struct snd_ad1816a *chip) +{ + int reg; + unsigned long flags; + + snd_ad1816a_init(chip); + spin_lock_irqsave(&chip->lock, flags); + for (reg = 0; reg < 48; reg++) + snd_ad1816a_write(chip, reg, chip->image[reg]); + spin_unlock_irqrestore(&chip->lock, flags); +} +#endif + static int __devinit snd_ad1816a_probe(struct snd_ad1816a *chip) { unsigned long flags; -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] snd-als100: fix suspend/resume
snd_card_als100_probe() does not set pcm field in struct snd_sb. As a result, PCM is not suspended and applications don't know that they need to resume the playback. Tested with Labway A381-F20 card (ALS120). Signed-off-by: Ondrej Zary --- a/sound/isa/als100.c +++ b/sound/isa/als100.c @@ -233,7 +233,7 @@ static int __devinit snd_card_als100_probe(int dev, irq[dev], dma8[dev], dma16[dev]); } - if ((error = snd_sb16dsp_pcm(chip, 0, NULL)) < 0) { + if ((error = snd_sb16dsp_pcm(chip, 0, &chip->pcm)) < 0) { snd_card_free(card); return error; } -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] introduce snd-cmi8328: C-Media CMI8328 driver
Introduce snd-cmi8328 driver for C-Media CMI8328-based sound cards, such as AudioExcel AV500. It supports PCM playback and capture (full-duplex) through wss_lib, gameport, OPL3 and MPU401. The AV500 card has onboard Dream wavetable synth connected to the MPU401 port and Aux 1 input internally which works too. The CDROM interface is not supported (as the drivers for these CDROMs were removed from the kernel some time ago). A separate driver is needed because CMI8328 is completely different chip to CMI8329/CMI8330. It's configured by magic registers (there's no PnP). Sound is provided by a real WSS codec (CS4231A) and the SB part is just a SB Pro emulation (for DOS games, useless for Linux). When SB is enabled, the CMI8328 chip disables access to the WSS codec, emulates SoundBlaster on one side and outputs sound data to the codec - so SB and WSS can't work together with this card. The WSS codec can do full duplex by itself so there's no need for crazy things like snd-cmi8330 does (combining SB and WSS parts into one driver). Signed-off-by: Ondrej Zary commit ebd26fe68c73eb979ace14b51a4fbdd899233952 Author: Ondrej Zary Date: Thu Aug 2 09:17:57 2012 +0200 introduce snd-cmi8328: C-Media CMI8328 driver Introduce snd-cmi8328 driver for C-Media CMI8328-based sound cards, such as AudioExcel AV500. It supports PCM playback and capture (full-duplex) through wss_lib, gameport, OPL3 and MPU401. The AV500 card has onboard Dream wavetable synth connected to the MPU401 port and Aux 1 input internally which works too. The CDROM interface is not supported (as the drivers for these CDROMs were removed from the kernel some time ago). diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index 52064cf..a38d964 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -117,6 +117,18 @@ config SND_AZT2320 To compile this driver as a module, choose M here: the module will be called snd-azt2320. +config SND_CMI8328 + tristate "C-Media CMI8328" + select SND_WSS_LIB + select SND_OPL3_LIB + select SND_MPU401_UART + help + Say Y here to include support for soundcards based on the + C-Media CMI8328 chip. + + To compile this driver as a module, choose M here: the module + will be called snd-cmi8328. + config SND_CMI8330 tristate "C-Media CMI8330" select SND_WSS_LIB diff --git a/sound/isa/Makefile b/sound/isa/Makefile index 8d781e4..9a15f14 100644 --- a/sound/isa/Makefile +++ b/sound/isa/Makefile @@ -6,6 +6,7 @@ snd-adlib-objs := adlib.o snd-als100-objs := als100.o snd-azt2320-objs := azt2320.o +snd-cmi8328-objs := cmi8328.o snd-cmi8330-objs := cmi8330.o snd-es18xx-objs := es18xx.o snd-opl3sa2-objs := opl3sa2.o @@ -16,6 +17,7 @@ snd-sscape-objs := sscape.o obj-$(CONFIG_SND_ADLIB) += snd-adlib.o obj-$(CONFIG_SND_ALS100) += snd-als100.o obj-$(CONFIG_SND_AZT2320) += snd-azt2320.o +obj-$(CONFIG_SND_CMI8328) += snd-cmi8328.o obj-$(CONFIG_SND_CMI8330) += snd-cmi8330.o obj-$(CONFIG_SND_ES18XX) += snd-es18xx.o obj-$(CONFIG_SND_OPL3SA2) += snd-opl3sa2.o diff --git a/sound/isa/cmi8328.c b/sound/isa/cmi8328.c new file mode 100644 index 000..aefafff --- /dev/null +++ b/sound/isa/cmi8328.c @@ -0,0 +1,482 @@ +/* + * Driver for C-Media CMI8328-based soundcards, such as AudioExcel AV500 + * Copyright (c) 2012 Ondrej Zary + * + * AudioExcel AV500 card consists of: + * - CMI8328 - main chip (SB Pro emulation, gameport, OPL3, MPU401, CD-ROM) + * - CS4231A - WSS codec + * - Dream SAM9233+GMS950400+RAM+ROM: Wavetable MIDI, connected to MPU401 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define SNDRV_LEGACY_FIND_FREE_IOPORT +#define SNDRV_LEGACY_FIND_FREE_IRQ +#define SNDRV_LEGACY_FIND_FREE_DMA +#include + +MODULE_AUTHOR("Ondrej Zary "); +MODULE_DESCRIPTION("C-Media CMI8328"); +MODULE_LICENSE("GPL"); + +#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE) +#define SUPPORT_JOYSTICK 1 +#endif + +/* I/O port is configured by jumpers on the card to one of these */ +static int cmi8328_ports[] = { 0x530, 0xe80, 0xf40, 0x604 }; +#define CMI8328_MAXARRAY_SIZE(cmi8328_ports) + +static int index[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = -1}; +static char *id[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = NULL}; +static long port[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_PORT}; +static int irq[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_IRQ}; +static int dma1[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_DMA}; +static int dma2[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_DMA}; +static long mpuport[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_PORT}; +static int mpuirq[CMI8328_MAX] ={[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_IRQ}; +#ifdef SUPPORT_JOYSTICK +static bool gameport[CMI8328_
[RFC PATCH] introduce snd-cmi8328: C-Media CMI8328 driver
Hello, this patch introduces snd-cmi8328 driver for C-Media CMI8328-based sound cards, such as AudioExcel AV500. It supports PCM playback and capture (full-duplex) through wss_lib, gameport, OPL3 and MPU401. The AV500 card has onboard Dream wavetable synth connected to the MPU401 port and Aux 1 input internally which works too. The CDROM interface is not supported (as the drivers for these CDROMs were removed from the kernel some time ago). snd_legacy_find_free_ioport() function is present in a couple of ISA sound drivers so perhaps it should be moved to sound/initval.h diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index 52064cf..a38d964 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -117,6 +117,18 @@ config SND_AZT2320 To compile this driver as a module, choose M here: the module will be called snd-azt2320. +config SND_CMI8328 + tristate "C-Media CMI8328" + select SND_WSS_LIB + select SND_OPL3_LIB + select SND_MPU401_UART + help + Say Y here to include support for soundcards based on the + C-Media CMI8328 chip. + + To compile this driver as a module, choose M here: the module + will be called snd-cmi8328. + config SND_CMI8330 tristate "C-Media CMI8330" select SND_WSS_LIB diff --git a/sound/isa/Makefile b/sound/isa/Makefile index 8d781e4..9a15f14 100644 --- a/sound/isa/Makefile +++ b/sound/isa/Makefile @@ -6,6 +6,7 @@ snd-adlib-objs := adlib.o snd-als100-objs := als100.o snd-azt2320-objs := azt2320.o +snd-cmi8328-objs := cmi8328.o snd-cmi8330-objs := cmi8330.o snd-es18xx-objs := es18xx.o snd-opl3sa2-objs := opl3sa2.o @@ -16,6 +17,7 @@ snd-sscape-objs := sscape.o obj-$(CONFIG_SND_ADLIB) += snd-adlib.o obj-$(CONFIG_SND_ALS100) += snd-als100.o obj-$(CONFIG_SND_AZT2320) += snd-azt2320.o +obj-$(CONFIG_SND_CMI8328) += snd-cmi8328.o obj-$(CONFIG_SND_CMI8330) += snd-cmi8330.o obj-$(CONFIG_SND_ES18XX) += snd-es18xx.o obj-$(CONFIG_SND_OPL3SA2) += snd-opl3sa2.o diff --git a/sound/isa/cmi8328.c b/sound/isa/cmi8328.c new file mode 100644 index 000..2691116 --- /dev/null +++ b/sound/isa/cmi8328.c @@ -0,0 +1,482 @@ +/* + * Driver for C-Media CMI8328-based soundcards, such as AudioExcel AV500 + * Copyright (c) 2012 Ondrej Zary + * + * AudioExcel AV500 card consists of: + * - CMI8328 - main chip (SB Pro emulation, gameport, OPL3, MPU401, CD-ROM) + * - CS4231A - WSS codec + * - Dream SAM9233+GMS950400+RAM+ROM: Wavetable MIDI, connected to MPU401 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define SNDRV_LEGACY_FIND_FREE_IRQ +#define SNDRV_LEGACY_FIND_FREE_DMA +#include + +MODULE_AUTHOR("Ondrej Zary "); +MODULE_DESCRIPTION("C-Media CMI8328"); +MODULE_LICENSE("GPL"); + +#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE) +#define SUPPORT_JOYSTICK 1 +#endif + +/* I/O port is configured by jumpers on the card to one of these */ +static int cmi8328_ports[] = { 0x530, 0xe80, 0xf40, 0x604 }; +#define CMI8328_MAXARRAY_SIZE(cmi8328_ports) + +static int index[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = -1}; +static char *id[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = NULL}; +static long port[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_PORT}; +static int irq[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_IRQ}; +static int dma1[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_DMA}; +static int dma2[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_DMA}; +static long mpuport[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_PORT}; +static int mpuirq[CMI8328_MAX] ={[0 ... (CMI8328_MAX-1)] = SNDRV_AUTO_IRQ}; +#ifdef SUPPORT_JOYSTICK +static bool gameport[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = true}; +#endif + +module_param_array(index, int, NULL, 0444); +MODULE_PARM_DESC(index, "Index value for CMI8328 soundcard."); +module_param_array(id, charp, NULL, 0444); +MODULE_PARM_DESC(id, "ID string for CMI8328 soundcard."); + +module_param_array(port, long, NULL, 0444); +MODULE_PARM_DESC(port, "Port # for CMI8328 driver."); +module_param_array(irq, int, NULL, 0444); +MODULE_PARM_DESC(irq, "IRQ # for CMI8328 driver."); +module_param_array(dma1, int, NULL, 0444); +MODULE_PARM_DESC(dma1, "DMA1 for CMI8328 driver."); +module_param_array(dma2, int, NULL, 0444); +MODULE_PARM_DESC(dma2, "DMA2 for CMI8328 driver."); + +module_param_array(mpuport, long, NULL, 0444); +MODULE_PARM_DESC(mpuport, "MPU-401 port # for CMI8328 driver."); +module_param_array(mpuirq, int, NULL, 0444); +MODULE_PARM_DESC(mpuirq, "IRQ # for CMI8328 MPU-401 port."); +#ifdef SUPPORT_JOYSTICK +module_param_array(gameport, bool, NULL, 0444); +MODULE_PARM_DESC(gameport, "Enable gameport."); +#endif + +struct snd_cmi8328 { + u16 port; + u8 cfg[3]; +
[PATCH] wss_lib: fix suspend/resume
By setting SNDRV_PCM_INFO_RESUME, wss_lib claims that it can restore the card state fully on resume. But in fact, it can't as DMA is not restored so any playback/capture running during suspend will fail to continue after resume. Remove SNDRV_PCM_INFO_RESUME flag from pcm info field to fix the problem. Signed-off-by: Ondrej Zary --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -1456,7 +1456,6 @@ static struct snd_pcm_hardware snd_wss_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID | -SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_SYNC_START), .formats = (SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW | SNDRV_PCM_FMTBIT_IMA_ADPCM | SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE), -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/