2012-11-01 20:56:28

by Ondrej Zary

[permalink] [raw]
Subject: [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 <[email protected]>
---
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],
&chip)) < 0) {
snd_card_free(card);
--
Ondrej Zary


2012-11-01 21:24:37

by Alan

[permalink] [raw]
Subject: Re: [PATCH] snd-es1968: remove pm_whitelist

On Thu, 1 Nov 2012 21:55:54 +0100
Ondrej Zary <[email protected]> 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)

2012-11-01 21:59:06

by Ondrej Zary

[permalink] [raw]
Subject: 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 <[email protected]> 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

2012-11-04 08:29:29

by Takashi Iwai

[permalink] [raw]
Subject: Re: [alsa-devel] [PATCH] snd-es1968: remove pm_whitelist

At Thu, 1 Nov 2012 22:58:30 +0100,
Ondrej Zary wrote:
>
> On Thursday 01 November 2012 22:29:43 Alan Cox wrote:
> > On Thu, 1 Nov 2012 21:55:54 +0100
> >
> > Ondrej Zary <[email protected]> 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).

You can't expect anything logical with the broken ACPI support on such
old hardware :)

> 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...

But better than possibly breaking all units without testing.

The fact that the device contains only the ES1978 SSID implies that
it's a PCI sound card, not an on-board device. Thus the possibility
to regress for such a case is fairly low. The concern is basically
only for the onboard sound devices on old laptops.


thanks,

Takashi