* [PATCH] snd-opti9xx: Implement suspend/resume
@ 2012-07-17 7:16 Ondrej Zary
2012-07-17 8:38 ` [alsa-devel] " Rajeev kumar
2012-07-17 8:57 ` Takashi Iwai
0 siblings, 2 replies; 5+ messages in thread
From: Ondrej Zary @ 2012-07-17 7:16 UTC (permalink / raw)
To: alsa-devel; +Cc: Kernel development list
Implement suspend/resume support for Opti 92x and 93x chips.
Tested with Opti 929A+AD1848 and Opti 931.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -136,8 +136,8 @@ struct snd_opti9xx {
#ifdef OPTi93X
unsigned long mc_indir_index;
struct resource *res_mc_indir;
- struct snd_wss *codec;
#endif /* OPTi93X */
+ struct snd_wss *codec;
unsigned long pwd_reg;
spinlock_t lock;
@@ -870,9 +870,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
&codec);
if (error < 0)
return error;
-#ifdef OPTi93X
chip->codec = codec;
-#endif
error = snd_wss_pcm(codec, 0, &pcm);
if (error < 0)
return error;
@@ -1053,11 +1051,55 @@ static int __devexit snd_opti9xx_isa_remove(struct device *devptr,
return 0;
}
+#ifdef CONFIG_PM
+static int snd_opti9xx_suspend(struct snd_card *card)
+{
+ struct snd_opti9xx *chip = card->private_data;
+
+ snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+ chip->codec->suspend(chip->codec);
+ return 0;
+}
+
+static int snd_opti9xx_resume(struct snd_card *card)
+{
+ struct snd_opti9xx *chip = card->private_data;
+ int error, xdma2;
+#if defined(CS4231) || defined(OPTi93X)
+ xdma2 = dma2;
+#else
+ xdma2 = -1;
+#endif
+
+ error = snd_opti9xx_configure(chip, port, irq, dma1, xdma2,
+ mpu_port, mpu_irq);
+ if (error)
+ return error;
+ chip->codec->resume(chip->codec);
+ snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+ return 0;
+}
+
+static int snd_opti9xx_isa_suspend(struct device *dev, unsigned int n,
+ pm_message_t state)
+{
+ return snd_opti9xx_suspend(dev_get_drvdata(dev));
+}
+
+static int snd_opti9xx_isa_resume(struct device *dev, unsigned int n)
+{
+ return snd_opti9xx_resume(dev_get_drvdata(dev));
+}
+#endif
+
static struct isa_driver snd_opti9xx_driver = {
.match = snd_opti9xx_isa_match,
.probe = snd_opti9xx_isa_probe,
.remove = __devexit_p(snd_opti9xx_isa_remove),
- /* FIXME: suspend/resume */
+#ifdef CONFIG_PM
+ .suspend = snd_opti9xx_isa_suspend,
+ .resume = snd_opti9xx_isa_resume,
+#endif
.driver = {
.name = DEV_NAME
},
@@ -1123,12 +1165,29 @@ static void __devexit snd_opti9xx_pnp_remove(struct pnp_card_link * pcard)
snd_opti9xx_pnp_is_probed = 0;
}
+#ifdef CONFIG_PM
+static int snd_opti9xx_pnp_suspend(struct pnp_card_link *pcard,
+ pm_message_t state)
+{
+ return snd_opti9xx_suspend(pnp_get_card_drvdata(pcard));
+}
+
+static int snd_opti9xx_pnp_resume(struct pnp_card_link *pcard)
+{
+ return snd_opti9xx_resume(pnp_get_card_drvdata(pcard));
+}
+#endif
+
static struct pnp_card_driver opti9xx_pnpc_driver = {
.flags = PNP_DRIVER_RES_DISABLE,
.name = "opti9xx",
.id_table = snd_opti9xx_pnpids,
.probe = snd_opti9xx_pnp_probe,
.remove = __devexit_p(snd_opti9xx_pnp_remove),
+#ifdef CONFIG_PM
+ .suspend = snd_opti9xx_pnp_suspend,
+ .resume = snd_opti9xx_pnp_resume,
+#endif
};
#endif
--
Ondrej Zary
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [alsa-devel] [PATCH] snd-opti9xx: Implement suspend/resume
2012-07-17 7:16 [PATCH] snd-opti9xx: Implement suspend/resume Ondrej Zary
@ 2012-07-17 8:38 ` Rajeev kumar
2012-07-17 8:51 ` Ondrej Zary
2012-07-17 8:57 ` Takashi Iwai
1 sibling, 1 reply; 5+ messages in thread
From: Rajeev kumar @ 2012-07-17 8:38 UTC (permalink / raw)
To: Ondrej Zary; +Cc: alsa-devel@alsa-project.org, Kernel development list
Hello Ondrej,
On 7/17/2012 12:46 PM, Ondrej Zary wrote:
> Implement suspend/resume support for Opti 92x and 93x chips.
> Tested with Opti 929A+AD1848 and Opti 931.
>
> Signed-off-by: Ondrej Zary<linux@rainbow-software.org>
>
<snip...>
> +#ifdef CONFIG_PM
> +static int snd_opti9xx_suspend(struct snd_card *card)
> +{
> + struct snd_opti9xx *chip = card->private_data;
> +
> + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
> + chip->codec->suspend(chip->codec);
> + return 0;
> +}
> +
> +static int snd_opti9xx_resume(struct snd_card *card)
> +{
> + struct snd_opti9xx *chip = card->private_data;
> + int error, xdma2;
> +#if defined(CS4231) || defined(OPTi93X)
> + xdma2 = dma2;
> +#else
> + xdma2 = -1;
> +#endif
> +
> + error = snd_opti9xx_configure(chip, port, irq, dma1, xdma2,
> + mpu_port, mpu_irq);
dma1??
> + if (error)
> + return error;
Variable name is not convincing. You are assuming that the function is
returning error.
> + chip->codec->resume(chip->codec);
> + snd_power_change_state(card, SNDRV_CTL_POWER_D0);
blank line required.
> + return 0;
> +}
> +
> +static int snd_opti9xx_isa_suspend(struct device *dev, unsigned int n,
> + pm_message_t state)
> +{
> + return snd_opti9xx_suspend(dev_get_drvdata(dev));
> +}
> +
> +static int snd_opti9xx_isa_resume(struct device *dev, unsigned int n)
> +{
> + return snd_opti9xx_resume(dev_get_drvdata(dev));
> +}
> +#endif
> +
> static struct isa_driver snd_opti9xx_driver = {
> .match = snd_opti9xx_isa_match,
> .probe = snd_opti9xx_isa_probe,
> .remove = __devexit_p(snd_opti9xx_isa_remove),
> - /* FIXME: suspend/resume */
> +#ifdef CONFIG_PM
> + .suspend = snd_opti9xx_isa_suspend,
> + .resume = snd_opti9xx_isa_resume,
> +#endif
> .driver = {
> .name = DEV_NAME
> },
> @@ -1123,12 +1165,29 @@ static void __devexit snd_opti9xx_pnp_remove(struct pnp_card_link * pcard)
> snd_opti9xx_pnp_is_probed = 0;
> }
>
> +#ifdef CONFIG_PM
> +static int snd_opti9xx_pnp_suspend(struct pnp_card_link *pcard,
> + pm_message_t state)
> +{
> + return snd_opti9xx_suspend(pnp_get_card_drvdata(pcard));
> +}
> +
> +static int snd_opti9xx_pnp_resume(struct pnp_card_link *pcard)
> +{
> + return snd_opti9xx_resume(pnp_get_card_drvdata(pcard));
> +}
> +#endif
> +
> static struct pnp_card_driver opti9xx_pnpc_driver = {
> .flags = PNP_DRIVER_RES_DISABLE,
> .name = "opti9xx",
Why this is opti why not OPTi
~Rajeev
> .id_table = snd_opti9xx_pnpids,
> .probe = snd_opti9xx_pnp_probe,
> .remove = __devexit_p(snd_opti9xx_pnp_remove),
> +#ifdef CONFIG_PM
> + .suspend = snd_opti9xx_pnp_suspend,
> + .resume = snd_opti9xx_pnp_resume,
> +#endif
> };
> #endif
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [alsa-devel] [PATCH] snd-opti9xx: Implement suspend/resume
2012-07-17 8:38 ` [alsa-devel] " Rajeev kumar
@ 2012-07-17 8:51 ` Ondrej Zary
2012-07-17 9:01 ` Rajeev kumar
0 siblings, 1 reply; 5+ messages in thread
From: Ondrej Zary @ 2012-07-17 8:51 UTC (permalink / raw)
To: Rajeev kumar; +Cc: alsa-devel@alsa-project.org, Kernel development list
On Tuesday 17 July 2012, Rajeev kumar wrote:
> Hello Ondrej,
>
> On 7/17/2012 12:46 PM, Ondrej Zary wrote:
> > Implement suspend/resume support for Opti 92x and 93x chips.
> > Tested with Opti 929A+AD1848 and Opti 931.
> >
> > Signed-off-by: Ondrej Zary<linux@rainbow-software.org>
>
> <snip...>
>
> > +#ifdef CONFIG_PM
> > +static int snd_opti9xx_suspend(struct snd_card *card)
> > +{
> > + struct snd_opti9xx *chip = card->private_data;
> > +
> > + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
> > + chip->codec->suspend(chip->codec);
> > + return 0;
> > +}
> > +
> > +static int snd_opti9xx_resume(struct snd_card *card)
> > +{
> > + struct snd_opti9xx *chip = card->private_data;
> > + int error, xdma2;
> > +#if defined(CS4231) || defined(OPTi93X)
> > + xdma2 = dma2;
> > +#else
> > + xdma2 = -1;
> > +#endif
> > +
> > + error = snd_opti9xx_configure(chip, port, irq, dma1, xdma2,
> > + mpu_port, mpu_irq);
>
> dma1??
What's wrong with that? It's a global variable. The driver is old and only
supports one card.
> > + if (error)
> > + return error;
>
> Variable name is not convincing. You are assuming that the function is
> returning error.
This is consistent with other code in the driver.
>
> > + chip->codec->resume(chip->codec);
> > + snd_power_change_state(card, SNDRV_CTL_POWER_D0);
>
> blank line required.
This is consistent with other code in the driver.
> > + return 0;
> > +}
> > +
> > +static int snd_opti9xx_isa_suspend(struct device *dev, unsigned int n,
> > + pm_message_t state)
> > +{
> > + return snd_opti9xx_suspend(dev_get_drvdata(dev));
> > +}
> > +
> > +static int snd_opti9xx_isa_resume(struct device *dev, unsigned int n)
> > +{
> > + return snd_opti9xx_resume(dev_get_drvdata(dev));
> > +}
> > +#endif
> > +
> > static struct isa_driver snd_opti9xx_driver = {
> > .match = snd_opti9xx_isa_match,
> > .probe = snd_opti9xx_isa_probe,
> > .remove = __devexit_p(snd_opti9xx_isa_remove),
> > - /* FIXME: suspend/resume */
> > +#ifdef CONFIG_PM
> > + .suspend = snd_opti9xx_isa_suspend,
> > + .resume = snd_opti9xx_isa_resume,
> > +#endif
> > .driver = {
> > .name = DEV_NAME
> > },
> > @@ -1123,12 +1165,29 @@ static void __devexit
> > snd_opti9xx_pnp_remove(struct pnp_card_link * pcard)
> > snd_opti9xx_pnp_is_probed = 0;
> > }
> >
> > +#ifdef CONFIG_PM
> > +static int snd_opti9xx_pnp_suspend(struct pnp_card_link *pcard,
> > + pm_message_t state)
> > +{
> > + return snd_opti9xx_suspend(pnp_get_card_drvdata(pcard));
> > +}
> > +
> > +static int snd_opti9xx_pnp_resume(struct pnp_card_link *pcard)
> > +{
> > + return snd_opti9xx_resume(pnp_get_card_drvdata(pcard));
> > +}
> > +#endif
> > +
> > static struct pnp_card_driver opti9xx_pnpc_driver = {
> > .flags = PNP_DRIVER_RES_DISABLE,
> > .name = "opti9xx",
>
> Why this is opti why not OPTi
It's not my code. This patch is just adding suspend/resume and not changing
anything else.
> ~Rajeev
>
> > .id_table = snd_opti9xx_pnpids,
> > .probe = snd_opti9xx_pnp_probe,
> > .remove = __devexit_p(snd_opti9xx_pnp_remove),
> > +#ifdef CONFIG_PM
> > + .suspend = snd_opti9xx_pnp_suspend,
> > + .resume = snd_opti9xx_pnp_resume,
> > +#endif
> > };
> > #endif
--
Ondrej Zary
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [alsa-devel] [PATCH] snd-opti9xx: Implement suspend/resume
2012-07-17 7:16 [PATCH] snd-opti9xx: Implement suspend/resume Ondrej Zary
2012-07-17 8:38 ` [alsa-devel] " Rajeev kumar
@ 2012-07-17 8:57 ` Takashi Iwai
1 sibling, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2012-07-17 8:57 UTC (permalink / raw)
To: Ondrej Zary; +Cc: alsa-devel, Kernel development list
At Tue, 17 Jul 2012 09:16:44 +0200,
Ondrej Zary wrote:
>
> Implement suspend/resume support for Opti 92x and 93x chips.
> Tested with Opti 929A+AD1848 and Opti 931.
>
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Applied now. Thanks.
Takashi
>
> --- a/sound/isa/opti9xx/opti92x-ad1848.c
> +++ b/sound/isa/opti9xx/opti92x-ad1848.c
> @@ -136,8 +136,8 @@ struct snd_opti9xx {
> #ifdef OPTi93X
> unsigned long mc_indir_index;
> struct resource *res_mc_indir;
> - struct snd_wss *codec;
> #endif /* OPTi93X */
> + struct snd_wss *codec;
> unsigned long pwd_reg;
>
> spinlock_t lock;
> @@ -870,9 +870,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
> &codec);
> if (error < 0)
> return error;
> -#ifdef OPTi93X
> chip->codec = codec;
> -#endif
> error = snd_wss_pcm(codec, 0, &pcm);
> if (error < 0)
> return error;
> @@ -1053,11 +1051,55 @@ static int __devexit snd_opti9xx_isa_remove(struct device *devptr,
> return 0;
> }
>
> +#ifdef CONFIG_PM
> +static int snd_opti9xx_suspend(struct snd_card *card)
> +{
> + struct snd_opti9xx *chip = card->private_data;
> +
> + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
> + chip->codec->suspend(chip->codec);
> + return 0;
> +}
> +
> +static int snd_opti9xx_resume(struct snd_card *card)
> +{
> + struct snd_opti9xx *chip = card->private_data;
> + int error, xdma2;
> +#if defined(CS4231) || defined(OPTi93X)
> + xdma2 = dma2;
> +#else
> + xdma2 = -1;
> +#endif
> +
> + error = snd_opti9xx_configure(chip, port, irq, dma1, xdma2,
> + mpu_port, mpu_irq);
> + if (error)
> + return error;
> + chip->codec->resume(chip->codec);
> + snd_power_change_state(card, SNDRV_CTL_POWER_D0);
> + return 0;
> +}
> +
> +static int snd_opti9xx_isa_suspend(struct device *dev, unsigned int n,
> + pm_message_t state)
> +{
> + return snd_opti9xx_suspend(dev_get_drvdata(dev));
> +}
> +
> +static int snd_opti9xx_isa_resume(struct device *dev, unsigned int n)
> +{
> + return snd_opti9xx_resume(dev_get_drvdata(dev));
> +}
> +#endif
> +
> static struct isa_driver snd_opti9xx_driver = {
> .match = snd_opti9xx_isa_match,
> .probe = snd_opti9xx_isa_probe,
> .remove = __devexit_p(snd_opti9xx_isa_remove),
> - /* FIXME: suspend/resume */
> +#ifdef CONFIG_PM
> + .suspend = snd_opti9xx_isa_suspend,
> + .resume = snd_opti9xx_isa_resume,
> +#endif
> .driver = {
> .name = DEV_NAME
> },
> @@ -1123,12 +1165,29 @@ static void __devexit snd_opti9xx_pnp_remove(struct pnp_card_link * pcard)
> snd_opti9xx_pnp_is_probed = 0;
> }
>
> +#ifdef CONFIG_PM
> +static int snd_opti9xx_pnp_suspend(struct pnp_card_link *pcard,
> + pm_message_t state)
> +{
> + return snd_opti9xx_suspend(pnp_get_card_drvdata(pcard));
> +}
> +
> +static int snd_opti9xx_pnp_resume(struct pnp_card_link *pcard)
> +{
> + return snd_opti9xx_resume(pnp_get_card_drvdata(pcard));
> +}
> +#endif
> +
> static struct pnp_card_driver opti9xx_pnpc_driver = {
> .flags = PNP_DRIVER_RES_DISABLE,
> .name = "opti9xx",
> .id_table = snd_opti9xx_pnpids,
> .probe = snd_opti9xx_pnp_probe,
> .remove = __devexit_p(snd_opti9xx_pnp_remove),
> +#ifdef CONFIG_PM
> + .suspend = snd_opti9xx_pnp_suspend,
> + .resume = snd_opti9xx_pnp_resume,
> +#endif
> };
> #endif
>
>
> --
> Ondrej Zary
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [alsa-devel] [PATCH] snd-opti9xx: Implement suspend/resume
2012-07-17 8:51 ` Ondrej Zary
@ 2012-07-17 9:01 ` Rajeev kumar
0 siblings, 0 replies; 5+ messages in thread
From: Rajeev kumar @ 2012-07-17 9:01 UTC (permalink / raw)
To: Ondrej Zary; +Cc: alsa-devel@alsa-project.org, Kernel development list
On 7/17/2012 2:21 PM, Ondrej Zary wrote:
>>> static struct pnp_card_driver opti9xx_pnpc_driver = {
>>> > > .flags = PNP_DRIVER_RES_DISABLE,
>>> > > .name = "opti9xx",
>> >
>> > Why this is opti why not OPTi
> It's not my code. This patch is just adding suspend/resume and not changing
> anything else.
>
Oops, sorry for this comment. I thought this line is changed by you.
~Rajeev
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-17 9:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-17 7:16 [PATCH] snd-opti9xx: Implement suspend/resume Ondrej Zary
2012-07-17 8:38 ` [alsa-devel] " Rajeev kumar
2012-07-17 8:51 ` Ondrej Zary
2012-07-17 9:01 ` Rajeev kumar
2012-07-17 8:57 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox