Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3965008ybl; Mon, 9 Dec 2019 03:10:08 -0800 (PST) X-Google-Smtp-Source: APXvYqxJACqJpf8nl3mK/E2QQnlgTURxKLfahWOsJ5ufhsMH6xFsyl+QnUS2sQXR5kqrcfWaIgAJ X-Received: by 2002:aca:3182:: with SMTP id x124mr24177576oix.170.1575889807350; Mon, 09 Dec 2019 03:10:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575889807; cv=none; d=google.com; s=arc-20160816; b=F5dASDKdYWebd239gj6ofsTOMsKvH9O5W6t83tBke2D+IOobnh2T+05l9PfJUdlgL0 B/4Qy16RHxYz/jLyHdbxVhM0jsI6isfcQQxs2UGDOTEfDfL7pMOAvjTRiwGsikksUYbz QNP0pXZaygKELgE8y5zgP6ALabA4+FsqiXmcCWZSeU7ZtdaFLz9g+SqNelm6nUHAn5UL 7O+lAp9S+0XUTNE8zBldPE8p5L/XqmqXJoY3JX12NHswVtE1VXBijOU7KZSY4j2sODG7 inGi9RK1Y301WipgCmNMc8/6jpzia89/KaDeLutF98v8aoTLB9v7WvtAoLQpShn7evBI WCUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=AgBjm1aK7bZZ7f+px93wU1N6DNXUidy3fXqWwe3+eFs=; b=cpRRcD5n+hF4tJnE7okkwYUop+doOFGzYQMHaV7ppiDHCX84MPYH8XUGlEI+KD9sJC zcnaB/zBwwijcMiskZ4/lmRZGokp/0RYSMCjU0y15C9BCTr/J/fNx9yG1ks+OLkXHy6i OzuxF7Hxgg/9PSDSHRIvehyMLIQyMFnywVLEzv5Q0Vi4LIs5v9kkTqwrMCcra+Lv/xQe NJGw5N7ILlMLN72paquyxyKH9+J2vyrQlHkBEKcPsjTI0lK4WRJI06zLcFqrDFAA0GxR fFcuJe+jJGvtk/fjzxNna53eQnY6YPJffGs4uQIV6Lj6Bsuea3y2aioli4kkUWEQ86YK B+hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=nnLF9cVN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=opensource.cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23si12819009otp.234.2019.12.09.03.09.55; Mon, 09 Dec 2019 03:10:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=nnLF9cVN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=opensource.cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727697AbfLILJX (ORCPT + 99 others); Mon, 9 Dec 2019 06:09:23 -0500 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:3452 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727668AbfLILJW (ORCPT ); Mon, 9 Dec 2019 06:09:22 -0500 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xB9B3UZi022346; Mon, 9 Dec 2019 05:09:18 -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-type; s=PODMain02222019; bh=AgBjm1aK7bZZ7f+px93wU1N6DNXUidy3fXqWwe3+eFs=; b=nnLF9cVNg6lVbyRk29psfurT3dvYMOX9BsdtVQsSt8YcbOYjul0BC/jP5SdOh4L48atM 9tp3d9oFvulp44reVE8L/kh3xDZj8r8unPyEMz2CX9p1UqNXgWDCFdeqpFwuvF3na/Rk dEnN9trx0vm0DrL2GOtNJ773EfQFozS3qD56nQLYzZEf4X/AMzBaHNWbn+FFxgKQRC1d DAg4/xlTWPlKkqWY0SG81/s4mnl7jKCiUNRTisy95AsASY9pfYwhMbBE4A92SBwGeuSP +is7iUTitxxy3QgmEE6qCsfB4L8drssy77q9fAPUPUS0qV8Ocl6d4KDpPg3GH4b00vuw 2Q== Authentication-Results: ppops.net; spf=fail smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from ediex01.ad.cirrus.com ([5.172.152.52]) by mx0a-001ae601.pphosted.com with ESMTP id 2wrac6j0mu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 09 Dec 2019 05:09:18 -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.1591.10; Mon, 9 Dec 2019 11:09:16 +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.1591.10 via Frontend Transport; Mon, 9 Dec 2019 11:09:16 +0000 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 3F01D2A1; Mon, 9 Dec 2019 11:09:16 +0000 (UTC) From: Charles Keepax To: CC: , , Subject: [PATCH 02/10] extcon: arizona: Make rev A register sequences atomic Date: Mon, 9 Dec 2019 11:09:08 +0000 Message-ID: <20191209110916.29524-2-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191209110916.29524-1-ckeepax@opensource.cirrus.com> References: <20191209110916.29524-1-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-SPF-Result: fail X-Proofpoint-SPF-Record: v=spf1 include:spf-001ae601.pphosted.com include:spf.protection.outlook.com -all X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 mlxlogscore=562 spamscore=0 mlxscore=0 clxscore=1011 adultscore=0 impostorscore=0 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912090094 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The special register sequences that are applied for rev A of wm5102 should be applied atomically with respect to any other register writes. Use regmap_multi_reg_write to ensure all writes happen under the regmap lock. Signed-off-by: Charles Keepax --- drivers/extcon/extcon-arizona.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 79e9a24101823..a8b0bc2d4323b 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -310,9 +310,13 @@ static void arizona_start_mic(struct arizona_extcon_info *info) } if (info->micd_reva) { - regmap_write(arizona->regmap, 0x80, 0x3); - regmap_write(arizona->regmap, 0x294, 0); - regmap_write(arizona->regmap, 0x80, 0x0); + const struct reg_sequence reva[] = { + { 0x80, 0x3 }, + { 0x294, 0x0 }, + { 0x80, 0x0 }, + }; + + regmap_multi_reg_write(arizona->regmap, reva, ARRAY_SIZE(reva)); } if (info->detecting && arizona->pdata.micd_software_compare) @@ -361,9 +365,13 @@ static void arizona_stop_mic(struct arizona_extcon_info *info) snd_soc_dapm_sync(dapm); if (info->micd_reva) { - regmap_write(arizona->regmap, 0x80, 0x3); - regmap_write(arizona->regmap, 0x294, 2); - regmap_write(arizona->regmap, 0x80, 0x0); + const struct reg_sequence reva[] = { + { 0x80, 0x3 }, + { 0x294, 0x2 }, + { 0x80, 0x0 }, + }; + + regmap_multi_reg_write(arizona->regmap, reva, ARRAY_SIZE(reva)); } ret = regulator_allow_bypass(info->micvdd, true); -- 2.11.0