From patchwork Fri May 31 11:27:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Trimmer X-Patchwork-Id: 800553 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6380FC25B75 for ; Fri, 31 May 2024 11:31:45 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 85ED7823; Fri, 31 May 2024 13:31:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 85ED7823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1717155103; bh=ir4kvqus4+b9A6TsrDobyBFHj6/X6jwrEM/lRyMJYGE=; h=From:To:CC:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=r+IFNHhXuI7jrS/MFhskvXunm+aaB+SsKhUvRQbQpRF7K/IAf16ULblrK07fbGC6B QB/mqyoZZugTmkx8rUN1yTBX+5kszZfU7radJ3YDArvgQleR+TOUOBZko+I61wyMaS WVZLWdf/8Nr5zay0hf+sn7YBoJR7GrUwL44cVOvo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C391FF804FF; Fri, 31 May 2024 13:31:11 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id CBE96F805AD; Fri, 31 May 2024 13:31:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 42B1FF8026D; Fri, 31 May 2024 13:27:31 +0200 (CEST) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BFF8AF8003A for ; Fri, 31 May 2024 13:27:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BFF8AF8003A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=cirrus.com header.i=@cirrus.com header.a=rsa-sha256 header.s=PODMain02222019 header.b=fYSedm1/ Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44V6vAHn004232; Fri, 31 May 2024 06:27:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=PODMain02222019; bh=uqUvYOPYn4wZFfXt U6r/PgcMGfsmSJF3lS2+gb15emQ=; b=fYSedm1/p2UvZjvMBhJ6DMJb07bq0Ork iTixbRh21i5VmEyYK5GzLhMwrx+caF+pbf7BO2YMZUb5jx1SNMMvUnvAJfnjEt1s d2cvvTiZ+I4C8KG01CSdkHfPMC0BRf9OJPHRKogNQTDcDs/Hpx1enA1nVZGoE6TQ qaO5K7/H0uIi94UYzsPIw6wrUzbLjXsf96j10hm7I3k+EJxkitZjV2ZPYTTH/5qB 9dUz54SMG4SuKR9BIOi5HRyd/+0joIQELHwblsny2rk+eHEfMATn5Ea8uWON4oJ2 EmDGCgIX89lZtW0NeE+KpINf2Cq21nbFDLzjE+ERHa0tiZhuUJH/Rg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3ybdcwwqa6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 May 2024 06:27:21 -0500 (CDT) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 31 May 2024 12:27:19 +0100 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by anon-ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1544.9 via Frontend Transport; Fri, 31 May 2024 12:27:19 +0100 Received: from EDIN6ZZ2FY3.ad.cirrus.com (EDIN6ZZ2FY3.ad.cirrus.com [198.61.65.72]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id C5B9B820249; Fri, 31 May 2024 11:27:18 +0000 (UTC) From: Simon Trimmer To: CC: , , , , "Simon Trimmer" Subject: [PATCH] ALSA: hda: cs35l56: Fix lifecycle of codec pointer Date: Fri, 31 May 2024 12:27:16 +0100 Message-ID: <20240531112716.25323-1-simont@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Proofpoint-GUID: 8-xrWWee19RIF5fSr4rUExGKLCpecmYY X-Proofpoint-ORIG-GUID: 8-xrWWee19RIF5fSr4rUExGKLCpecmYY X-Proofpoint-Spam-Reason: safe Message-ID-Hash: JL4464YBKK7OIKIZR4NQJFSIQP7JLZBB X-Message-ID-Hash: JL4464YBKK7OIKIZR4NQJFSIQP7JLZBB X-MailFrom: prvs=3881dca93d=simont@opensource.cirrus.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The codec should be cleared when the amp driver is unbound and when resuming it should be tested to prevent loading firmware into the device and ALSA in a partially configured system state. Signed-off-by: Simon Trimmer --- sound/pci/hda/cs35l56_hda.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/pci/hda/cs35l56_hda.c b/sound/pci/hda/cs35l56_hda.c index 11b0570ff56d..0923e2589f5f 100644 --- a/sound/pci/hda/cs35l56_hda.c +++ b/sound/pci/hda/cs35l56_hda.c @@ -735,6 +735,8 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void * if (comps[cs35l56->index].dev == dev) memset(&comps[cs35l56->index], 0, sizeof(*comps)); + cs35l56->codec = NULL; + dev_dbg(cs35l56->base.dev, "Unbound\n"); } @@ -840,6 +842,9 @@ static int cs35l56_hda_system_resume(struct device *dev) cs35l56->suspended = false; + if (!cs35l56->codec) + return 0; + ret = cs35l56_is_fw_reload_needed(&cs35l56->base); dev_dbg(cs35l56->base.dev, "fw_reload_needed: %d\n", ret); if (ret > 0) {