Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp641227pxb; Sat, 6 Mar 2021 11:28:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwMv3oKqIjPW1w3AtI8aAdEK8c9KTO6oXCSCQUm7K4/HadjHhqL9VSFEhj5AovfwmiCEpT5 X-Received: by 2002:a05:6402:50c8:: with SMTP id h8mr14737975edb.360.1615058890965; Sat, 06 Mar 2021 11:28:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615058890; cv=none; d=google.com; s=arc-20160816; b=o8ylydZMVrRY3YjMs7y4zzY9VcjfTqrpE5KkPqsowpsO//U22W3ADqtLlGvIzRQJLg Tx458w3SV2jAm+6p7RiBj4zfOx2wcDFKjaigl7TTOQLdNNlKh4BsmXq0BRVD/PtMpjCq w+340JLbNtpXQhGVP/YB3oreCR81slDRmXbJwyOee34LU2WtinFZ3fFXOQ/+/324jkmH kx3qoTinuiUtHuSUIVYkCYtahJkO7JPVUksTfsbdoqXx2AIPB8JAeQcNvO6v5fFyo35B T20aDbAJd5W79uSNYE4ucqQANamZCk+dN/JRzWzinDxlvEm3YtrBhRGfcNZYIoucCoDX zdVQ== 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=kNd2bY0yYzXE4zeUHnZxMKJTNKV9o6qwBbU7E9c3S8c=; b=KdSaKvz7GvBsb+Qb6pDgtO3QGARTKQhMDONHtW18v8batEdsW+mKjA6paFyVZ/6sUj 8nwasM2kbmWTyG1R4fGmv87OaYHKB0mYpG62Sfyl5q/7h4Hu9HQ71/euR+KucHFKpTK1 MIgfWGQ3cVACpJHSgVql+q0xnUp8cHBKj8mIOnX80S6DKaGMNdrIOxusqDZ/tWeVdzRm NwNw8y0/7YKrxG24RBDsxATyNLtx9MYq6f0JIsyWBfvSMq2vSDzZZvyofq816O5fYdBm StFQ+B+SXfQLg1aNRyiim0GiQ6usCWPf4C+NWSbktiTn/11XQhJSo4AqC96tiUYPJOPQ SXlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=nWZrkfM6; 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 fi16si3761181ejb.239.2021.03.06.11.27.48; Sat, 06 Mar 2021 11:28:10 -0800 (PST) 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=nWZrkfM6; 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 S231463AbhCFTOD (ORCPT + 99 others); Sat, 6 Mar 2021 14:14:03 -0500 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:60864 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231375AbhCFTNs (ORCPT ); Sat, 6 Mar 2021 14:13:48 -0500 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 126J6uDK011401; Sat, 6 Mar 2021 13:13:33 -0600 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=kNd2bY0yYzXE4zeUHnZxMKJTNKV9o6qwBbU7E9c3S8c=; b=nWZrkfM6tPyb8IjsnxSkabTdLtrIubSyNv2Mjg/8MBTJ/rlQ9P6Hrs5NOIfEkm21r96h I8yTP5+6H04xQIC7wuMrQAIRxzF7NElumn5OpCHeTddIFnQ5gP0zMJqA95vU7O+eEiTt vnP2aiXrl2Gd5YTiisAAeVNRaoMuxOidAPEgNl75OW921bMlK5ectLkYxHOH94W45cOH BjA8qW4v9l0l3e455wINusHkhDY9eor7UxVuuoCO/N+ohYm4+Vi+UTYZbSrfJ1XGCGo5 IRLG5+XMFoBH2w6GrZjw7a6DHP8kN00XWq78lOek8Nx/ctRcP01NYz7egLnPTSFCNrZx lg== Received: from ediex01.ad.cirrus.com ([87.246.76.36]) by mx0a-001ae601.pphosted.com with ESMTP id 3748198d06-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Sat, 06 Mar 2021 13:13:33 -0600 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_128_GCM_SHA256) id 15.1.2176.2; Sat, 6 Mar 2021 18:56:27 +0000 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.2176.2 via Frontend Transport; Sat, 6 Mar 2021 18:56:27 +0000 Received: from mail1.cirrus.com (unknown [198.61.64.35]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 4732B11D7; Sat, 6 Mar 2021 18:56:27 +0000 (UTC) From: Lucas Tanure To: James Schulman , David Rhodes , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai CC: , , , Lucas Tanure Subject: [PATCH v3 06/15] ASoC: cs42l42: Remove power if the driver is being removed Date: Sat, 6 Mar 2021 18:55:44 +0000 Message-ID: <20210306185553.62053-7-tanureal@opensource.cirrus.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210306185553.62053-1-tanureal@opensource.cirrus.com> References: <20210306185553.62053-1-tanureal@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 phishscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=793 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103060119 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ensure the power supplies are turned off when removing the driver Signed-off-by: Lucas Tanure --- Changes in v3: - Free IRQ before pm_suspend Changes in v2: - Use PM functions to shutdown the codec - Disable IRQ before pm_suspend sound/soc/codecs/cs42l42.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c index 811b7b1c9732e..f61404de139b0 100644 --- a/sound/soc/codecs/cs42l42.c +++ b/sound/soc/codecs/cs42l42.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -1842,8 +1843,9 @@ static int cs42l42_i2c_remove(struct i2c_client *i2c_client) { struct cs42l42_private *cs42l42 = i2c_get_clientdata(i2c_client); - /* Hold down reset */ - gpiod_set_value_cansleep(cs42l42->reset_gpio, 0); + devm_free_irq(&i2c_client->dev, i2c_client->irq, cs42l42); + pm_runtime_suspend(&i2c_client->dev); + pm_runtime_disable(&i2c_client->dev); return 0; } -- 2.30.1