Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4701399pxt; Wed, 11 Aug 2021 12:00:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzg6ig2Sk8vRWkbkH65FGEv9bMa32X72ocmrxxv+ydxP7tGnk7bhtUlGOYOfaX4xq0/5m2J X-Received: by 2002:a6b:c895:: with SMTP id y143mr80929iof.74.1628708405252; Wed, 11 Aug 2021 12:00:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628708405; cv=none; d=google.com; s=arc-20160816; b=1JmD16SPzQ88B9lJlT3LAdo1sNhbqPNTWrhC2UlBX0QR+5RydxHvstkxJLpPzA9wCV nehT08EsIBfXlbzuQrGIEmty7nkMjKL1dVqQ3TgGdvKpwpOhBqvwmrEtuKdNqF7tolNB 5qJh2k5UKw0Zh9TDidZphCA/Ca9cF60ykX/OjV80MMGCDg+isUxsK2zbEdAaXzYp/YTG k9E7/Tsg/WJxhwj0pU6ltb6CxKUnCBy+2SzhRjxtTAWnl8gi5JzNL69K4m53s8naICJm CMFhH+qZzUJ7nZjrrQW958aGuFnJLe5ARoeRD94mXGs2lpEQW7STAAaT4Z6qA829KGIk Ee5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yGOpi/V7qnlMdnjjeS2+crhpBIrtvp8jFYtOuYnAt6g=; b=cM8TEkA/ftn68iLs1Q6GGTn0MseNJAXeM6+N3XulPY64x32/eQgENTVxdhJjEfmHww HsWPdZO7Pbu8JJwvq1PeIhsLsp3Oug04LtOmalVqxMWMUKm7y6m013cYwrk0cCGXvcH7 WwHhMSnyThRjXWXvKaG7tJBZlyr93dtvJQ8FaTUzS9KtlkqwLTcJHgF9kAnmcv5JCQhh 3CkBuS+DBk+QfwxweTurJt+8OmgnzOLds6gjsY+Ahi41wP5fZa2HxR7sAMg1DXilR6// 22O+0EIQ9+g5HyKlEsEvnLaxof2ysoMvIwMnXVR5oCujjwgNfewBjecSVSHMKmsoQ/R9 6EEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=YZ2FaZGz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si270310jac.69.2021.08.11.11.59.42; Wed, 11 Aug 2021 12:00:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=YZ2FaZGz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231787AbhHKS6k (ORCPT + 99 others); Wed, 11 Aug 2021 14:58:40 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:28756 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231436AbhHKS6M (ORCPT ); Wed, 11 Aug 2021 14:58:12 -0400 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 17BEiOkF019640; Wed, 11 Aug 2021 13:57:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=yGOpi/V7qnlMdnjjeS2+crhpBIrtvp8jFYtOuYnAt6g=; b=YZ2FaZGzT6c8iTV6VDuqtsbZHurXiiAtrTfmsQ3MPHvmg1+Hc68X+tjGpFMKEl5SQUz+ UBxR+ZXFrEn+OeF5OdwwDtDfr1d6QY7YMdYxWLWNQb6IMjFNLlnQww9UZKVb2OMjMkud yPxcYg24jUJJl5bM6kbu8brVtCcqSN1r0/c5ixy5RbOCuQW5h+GsfL1umX8zuCjp3UnJ v4rMV8OpzvwUGXKwMHL3t99A1c7FRjo3gAjsNxBcGZ/K7ncW7cD6F0O9lA32936WIWw1 bEZfbG6uRlibhJLFB0HV3Qn0HBs9MZkwO0su4uQLDeBQ5ouMiwXVt0agOYwsXO5TbW33 dw== Received: from ediex02.ad.cirrus.com ([87.246.76.36]) by mx0a-001ae601.pphosted.com with ESMTP id 3acgjkra57-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 11 Aug 2021 13:57:35 -0500 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 11 Aug 2021 19:57:33 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.2242.12 via Frontend Transport; Wed, 11 Aug 2021 19:57:33 +0100 Received: from vitaly-Inspiron-5415.ad.cirrus.com (unknown [198.90.238.180]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id DB7872A9; Wed, 11 Aug 2021 18:57:32 +0000 (UTC) From: Vitaly Rodionov To: Jaroslav Kysela , Takashi Iwai CC: , , , Stefan Binding Subject: [PATCH v4 26/27] ALSA: hda/cs8409: Follow correct CS42L42 power down sequence for suspend Date: Wed, 11 Aug 2021 19:56:53 +0100 Message-ID: <20210811185654.6837-27-vitalyr@opensource.cirrus.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210811185654.6837-1-vitalyr@opensource.cirrus.com> References: <20210811185654.6837-1-vitalyr@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: W0JoOAzYimRb1z2Rer_NAPNg0vI8MTrd X-Proofpoint-ORIG-GUID: W0JoOAzYimRb1z2Rer_NAPNg0vI8MTrd X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 impostorscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 adultscore=0 mlxscore=0 spamscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108110130 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Binding Signed-off-by: Stefan Binding Signed-off-by: Vitaly Rodionov --- Changes in v2: - No changes Changes in v3: - No changes Changes in v4: - No changes sound/pci/hda/patch_cs8409.c | 23 ++++++++++++++++++++++- sound/pci/hda/patch_cs8409.h | 2 ++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_cs8409.c b/sound/pci/hda/patch_cs8409.c index b528c8353b3c..928972b4315d 100644 --- a/sound/pci/hda/patch_cs8409.c +++ b/sound/pci/hda/patch_cs8409.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "patch_cs8409.h" @@ -219,6 +220,7 @@ static int cs8409_i2c_read(struct sub_codec *scodec, unsigned int addr) read_data = cs8409_vendor_coef_get(codec, CS8409_I2C_QREAD); mutex_unlock(&spec->i2c_mux); + return read_data & 0x0ff; error: @@ -675,9 +677,28 @@ static void cs42l42_suspend(struct sub_codec *cs42l42) { struct hda_codec *codec = cs42l42->codec; unsigned int gpio_data; + int reg_cdc_status = 0; + const struct cs8409_i2c_param cs42l42_pwr_down_seq[] = { + { 0x2301, 0x3F }, + { 0x2302, 0x3F }, + { 0x2303, 0x3F }, + { 0x2001, 0x0F }, + { 0x2A01, 0x00 }, + { 0x1207, 0x00 }, + { 0x1101, 0xFE }, + { 0x1102, 0x8C }, + { 0x1101, 0xFF }, + }; + + cs8409_i2c_bulk_write(cs42l42, cs42l42_pwr_down_seq, ARRAY_SIZE(cs42l42_pwr_down_seq)); + + if (read_poll_timeout(cs8409_i2c_read, reg_cdc_status, + (reg_cdc_status & 0x1), CS42L42_PDN_SLEEP_US, CS42L42_PDN_TIMEOUT_US, + true, cs42l42, 0x1308) < 0) + codec_warn(codec, "Timeout waiting for PDN_DONE for CS42L42\n"); /* Power down CS42L42 ASP/EQ/MIX/HP */ - cs8409_i2c_write(cs42l42, 0x1101, 0xfe); + cs8409_i2c_write(cs42l42, 0x1102, 0x9C); cs42l42->suspended = 1; cs42l42->last_page = 0; diff --git a/sound/pci/hda/patch_cs8409.h b/sound/pci/hda/patch_cs8409.h index 71dbbd8e2f3b..09987daa9cbf 100644 --- a/sound/pci/hda/patch_cs8409.h +++ b/sound/pci/hda/patch_cs8409.h @@ -233,6 +233,8 @@ enum cs8409_coefficient_index_registers { #define CS42L42_JACK_REMOVED (0x00) #define CS42L42_I2C_TIMEOUT_US (20000) #define CS42L42_I2C_SLEEP_US (2000) +#define CS42L42_PDN_TIMEOUT_US (250000) +#define CS42L42_PDN_SLEEP_US (2000) /* Dell BULLSEYE / WARLOCK / CYBORG Specific Definitions */ -- 2.25.1