From nobody Sat Apr 11 15:04:05 2026 Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53C6E34E762 for ; Mon, 6 Apr 2026 03:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775445622; cv=none; b=pYh7UremdNt8plvTlqvDJ09Dm5CBFjsdtkXrrhlTaf1s28mJy5eDDqY4kxN7R4MTZKXZei56n23ujLcVHq0wijG9Td/yDaQe4vd2LaOWccckCN/U1oZfM5B6dsMvWfLfZYIGToaCBb03TT4DSBZFvA39CkFMOhFjEljr9Huus80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775445622; c=relaxed/simple; bh=RguDGz8h/rrrWD2cTbBLxH+mDSZzcOeQwZ54p3UGGQg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=merEkJ9OeZxO7mUGdKLAp9G7FXYrdbm9Pzv1DvyllO3BF80ILa+theJmobWGDveqO26X60avMQToVGbmz+ReV0ou3v933PQUEFTZug17V5nOE3h4rrD6R5NzPbwSY2dwDwpfFRm7o491WTFqOXy9sL40MxUmzC5J0WBghHeZRJA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HdUTEm71; arc=none smtp.client-ip=209.85.217.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HdUTEm71" Received: by mail-vs1-f53.google.com with SMTP id ada2fe7eead31-604f327bafcso1263561137.0 for ; Sun, 05 Apr 2026 20:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775445620; x=1776050420; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=aaXOUdfTDOzAAAnykF1sMhRPk4OSoZf3KJ6n7qQxtHs=; b=HdUTEm71euvRfYS4+qYSwhzoDrhiEiFK0Swr8Dpf0tkXjn7ZJIo0IFGrofZyykbh2u tAZfwuTeNB2RFLhHAe1PGgqhuQZb6Vat6O4ymHRnQQJagtX8Zbx+Ix5dyS60cpSnPoNZ xAH7ZDkHlHM2QuE5IvsDzXZPng/vrg/LBkhOHCmPM59pEfFoqdiJ6KHA7bmNECv8arhO 05QW1Pl8IYFekxIa2tVRWJDHgkaTG0G8ATP30bU35dH3ynZ2AJkKU9AtoKV25w4/Kxww jFeoH4+kWxY26VNa6IioKpf1Be6sQfO/lILlTfEPGsXEk2ufyCklNanl9dWnAg3xWjES hEaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775445620; x=1776050420; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=aaXOUdfTDOzAAAnykF1sMhRPk4OSoZf3KJ6n7qQxtHs=; b=JKb09LqaQ8S5eWvdbux20ja4FzIo42WSIeOUd1F7DeyOb7yMCjqUxDhOg6yus/ISvD 90s6I0NaCpOtvgJEReTQGP42TeT6X7Ij/dDLBC/pEL4cWp+0wGQ8tRf3ZAF9iOroDdEy o22TVBYiZpvfmO7UwyUgQxC4H0BVXA2WP6iux2u8+Its5tJgJQvOAvjTSEXCrtx/DzJL j/lNlS1V8SiBVgrnSa2y5hiXApnp+HAVcDYqg5rRPxy5hRmva4SxRPzl6HxUMIbBuMBI L2g+zUDLiWBFLlrVE8IxYb9+r7IwuNyoZuCwZQnHVd4MmwiG9GstkYajlkCtSrF+aVXh vZ9Q== X-Forwarded-Encrypted: i=1; AJvYcCUUcPCdTIzsE6hlaTCYFawiBo9NIE+veTROrLpVG/nZ9DmJmuKOIJDFuI4CbtbEoK9H61/iXBFOkLX310I=@vger.kernel.org X-Gm-Message-State: AOJu0Yyn9dZ9BH20ByRFLiXbFPOitcOR/SHAkOBLkAt7ihgghocmrZk/ QxU19WqLEaaRrx8Rx7Zk1Eq+oHAUo/eHc6g4SKmlxv5g5wOlS+bPtCJH X-Gm-Gg: AeBDievLqBstVs9A7zs0t8VEgmWq4TcCaVfqWRhFPAK4/TzuvnnL/cfn7AkaeGY0Z2c rQDht+Mzv2q+WHEcxSg/XYSYrslBRa4c3lbGCGCMltjeMe2gKpo0Bf2PmVeFljpn/XEPSADJHVn gJ2wGl2i+wVZy736CkkVN7zke325b9r66N6q/8dmSbNefIK6VgJBeByxfcZt6vsQn2djN4AM7oy JBdgylYB+VAtM6X3bSj1uGQxvDmup8IddRaJnIZu6p0KOc7a9z+LtX1PNGT9ORhlBkKP/QQx6X1 TUVk5x7VWVzCAMQBKt2/SHZOXgqwjKYC/7GE2Lsz8qEhioe+9BsTMOOre33r+C5TPZZGj0K26Dr jJnK43gZ6AuxvtkaUwtsnWc5wGUgsK1Mn8c2wbX+uwB7q+iLbnCkR5v14QmM7owPTq2iWRWRhpJ GNDDLIhqpd532b1FFEeuM8XK860NFTFC7nGAOTlIEgOi6z85/bshiHcmef2dUPQBH4fBpcBK6qX sUi X-Received: by 2002:a05:6102:f89:b0:602:a9f3:74d7 with SMTP id ada2fe7eead31-605a4dbe20cmr3734393137.13.1775445620148; Sun, 05 Apr 2026 20:20:20 -0700 (PDT) Received: from [192.168.1.18] (177-4-161-167.user3p.v-tal.net.br. [177.4.161.167]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-605b214b45fsm9162146137.5.2026.04.05.20.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Apr 2026 20:20:19 -0700 (PDT) From: =?utf-8?q?C=C3=A1ssio_Gabriel?= Date: Mon, 06 Apr 2026 00:20:05 -0300 Subject: [PATCH 3/4] ALSA: gusextreme: add ISA suspend and resume callbacks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260406-b4-alsa-gus-isa-pm-v1-3-b6829a7457cd@gmail.com> References: <20260406-b4-alsa-gus-isa-pm-v1-0-b6829a7457cd@gmail.com> In-Reply-To: <20260406-b4-alsa-gus-isa-pm-v1-0-b6829a7457cd@gmail.com> To: Takashi Iwai , Jaroslav Kysela Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?C=C3=A1ssio_Gabriel?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=4588; i=cassiogabrielcontato@gmail.com; h=from:subject:message-id; bh=RguDGz8h/rrrWD2cTbBLxH+mDSZzcOeQwZ54p3UGGQg=; b=owGbwMvMwCV2IdZeKur/u2bG02pJDJmX1bKXPfsoe9Rq2+HN/7lqXXTDtv/N6pEVv3exqe/yz v+MywwedJSyMIhxMciKKbKsTlpkuafrwdX6uBUeMHNYmUCGMHBxCsBEhDIYGfZucXzkm3tBRH2W +p9DwnpXK6al2mgIGG4V6HD+3hcZoMjIMJutsSTWTtV6eXiH5YFE5bU5ExY/9M4tjHHbfG/BwjU XWAE= X-Developer-Key: i=cassiogabrielcontato@gmail.com; a=openpgp; fpr=AB62A239BC8AE0D57F5EA848D05D3F1A5AFFEE83 gusextreme still leaves its ISA PM callbacks disabled because the shared GF1 core had no suspend and resume path suitable for PM recovery. Resume on this board needs one extra step before the shared GF1 path can touch the chip again: the ES1688 side must restore the GF1 routing. Split that routing sequence into a helper, reuse it for probe and resume, reset the ES1688 side first on resume, and then wire the driver up to the shared GUS PM helpers. This restores usable post-resume GF1 operation on GUS Extreme without rerunning probe-only detection in the shared GF1 path. Signed-off-by: C=C3=A1ssio Gabriel --- sound/isa/gus/gusextreme.c | 57 ++++++++++++++++++++++++++++++++++++++----= ---- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index ed921b89b00a..0984731740c4 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c @@ -44,6 +44,11 @@ static int joystick_dac[SNDRV_CARDS] =3D {[0 ... (SNDRV_= CARDS - 1)] =3D 29}; static int channels[SNDRV_CARDS] =3D {[0 ... (SNDRV_CARDS - 1)] =3D 24}; static int pcm_channels[SNDRV_CARDS] =3D {[0 ... (SNDRV_CARDS - 1)] =3D 2}; =20 +struct snd_gusextreme { + struct snd_es1688 es1688; + struct snd_gus_card *gus; +}; + module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard."); module_param_array(id, charp, NULL, 0444); @@ -142,17 +147,15 @@ static int snd_gusextreme_gus_card_create(struct snd_= card *card, 0, channels[n], pcm_channels[n], 0, rgus); } =20 -static int snd_gusextreme_detect(struct snd_gus_card *gus, - struct snd_es1688 *es1688) +static void snd_gusextreme_enable_gf1(struct snd_gus_card *gus, + struct snd_es1688 *es1688) { - unsigned char d; - /* * This is main stuff - enable access to GF1 chip... * I'm not sure, if this will work for card which have * ES1688 chip in another place than 0x220. - * - * I used reverse-engineering in DOSEMU. [--jk] + * + * I used reverse-engineering in DOSEMU. [--jk] * * ULTRINIT.EXE: * 0x230 =3D 0,2,3 @@ -172,7 +175,14 @@ static int snd_gusextreme_detect(struct snd_gus_card *= gus, outb(0, 0x201); outb(gus->gf1.port & 0x010 ? 3 : 1, ES1688P(es1688, INIT1)); } +} + +static int snd_gusextreme_detect(struct snd_gus_card *gus, + struct snd_es1688 *es1688) +{ + unsigned char d; =20 + snd_gusextreme_enable_gf1(gus, es1688); udelay(100); =20 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ @@ -223,16 +233,18 @@ static int snd_gusextreme_probe(struct device *dev, u= nsigned int n) { struct snd_card *card; struct snd_gus_card *gus; + struct snd_gusextreme *gusextreme; struct snd_es1688 *es1688; struct snd_opl3 *opl3; int error; =20 error =3D snd_devm_card_new(dev, index[n], id[n], THIS_MODULE, - sizeof(struct snd_es1688), &card); + sizeof(*gusextreme), &card); if (error < 0) return error; =20 - es1688 =3D card->private_data; + gusextreme =3D card->private_data; + es1688 =3D &gusextreme->es1688; =20 if (mpu_port[n] =3D=3D SNDRV_AUTO_PORT) mpu_port[n] =3D 0; @@ -250,6 +262,7 @@ static int snd_gusextreme_probe(struct device *dev, uns= igned int n) error =3D snd_gusextreme_gus_card_create(card, dev, n, &gus); if (error < 0) return error; + gusextreme->gus =3D gus; =20 error =3D snd_gusextreme_detect(gus, es1688); if (error < 0) @@ -321,10 +334,36 @@ static int snd_gusextreme_probe(struct device *dev, u= nsigned int n) return 0; } =20 +#ifdef CONFIG_PM +static int snd_gusextreme_suspend(struct device *dev, unsigned int n, + pm_message_t state) +{ + struct snd_card *card =3D dev_get_drvdata(dev); + struct snd_gusextreme *gusextreme =3D card->private_data; + + return snd_gus_suspend(gusextreme->gus); +} + +static int snd_gusextreme_resume(struct device *dev, unsigned int n) +{ + struct snd_card *card =3D dev_get_drvdata(dev); + struct snd_gusextreme *gusextreme =3D card->private_data; + int err; + + err =3D snd_es1688_reset(&gusextreme->es1688); + if (err < 0) + return err; + + snd_gusextreme_enable_gf1(gusextreme->gus, &gusextreme->es1688); + usleep_range(100, 200); + return snd_gus_resume(gusextreme->gus); +} +#endif + static struct isa_driver snd_gusextreme_driver =3D { .match =3D snd_gusextreme_match, .probe =3D snd_gusextreme_probe, -#if 0 /* FIXME */ +#ifdef CONFIG_PM .suspend =3D snd_gusextreme_suspend, .resume =3D snd_gusextreme_resume, #endif --=20 2.53.0