From patchwork Sun Jan 6 08:37:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 154838 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2355374ljp; Sun, 6 Jan 2019 00:38:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wbhm6L95FYHPLLR4B20C+iM84d85E2nHJDp8/V5rSpT20OZzr2UUd/P89nLYrWCabSKIW0 X-Received: by 2002:a62:6e07:: with SMTP id j7mr60242726pfc.135.1546763908384; Sun, 06 Jan 2019 00:38:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546763908; cv=none; d=google.com; s=arc-20160816; b=Bvpr3iDsDjp+a4c3GNrgYt1CAx0Du5ep/kif92/vEbYgg74qdgsoRkVO+6+TBo4/IC AZQcWjbrrSLISAjHdn0smChB0e0Eq5MBktjwYe5KDv+iNng+jgGhumctzZ9vk7ck8LRu Wt0l0A716/oeYlnp8xZb88V3jg485XqKEOfOB9C4yd0wMbv6pSghqgh8lQNP+41AButx RBfcokeSjaB498imw1rPWBQgyJJK7mXhGFDweoi3J16umokS/QC39uYcOu4gyrfpyfxh JYZECOraBDmEfO5NQu0/e53/eloiknp+NMaCx6nQRy+BTJdJ44m7BSfjt9TpKDf56iW9 PigQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/nBWU2Bza79gex+/xGrOchQGP8ihZ0i37Bu4Uy4QKwg=; b=N6WI1/X5UlJ9V9z2mxMStVn0RUtMTMyC9HpzBS/4EUqPh5jtPqnSVYDQZxDKuwxy44 i+vpWEBTRVytHT9SJavI91nRw95lTq8kiEnUmSQktDNkvNLNJhWEp6MDUPs4bWJYt4yw PQcKzPLagyQZjfe4MHQ4rpyXXCt20iqWLCHrq/bA0Kd+Inw7RhiQTrsDDgsfMLrAYNSU 1FR8p2qqwcrNuA+j+4+V2Zzm09MYYv4nawnSWKsuQKl2s7VU6DeWJmwofRkKDQZOEZM5 l6cxjTRejbLHaAfyaFnwQyuc7OlSsAFxpk2WFpxOhWoiCQAkRPPfLInesPtAVM38Cipl p34A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3si58411548pgi.388.2019.01.06.00.38.28; Sun, 06 Jan 2019 00:38:28 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726573AbfAFIiG (ORCPT + 31 others); Sun, 6 Jan 2019 03:38:06 -0500 Received: from mx2.suse.de ([195.135.220.15]:57222 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726508AbfAFIiF (ORCPT ); Sun, 6 Jan 2019 03:38:05 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 1C747ACFA; Sun, 6 Jan 2019 08:38:04 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-lpwan@lists.infradead.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andrea?= =?utf-8?b?cyBGw6RyYmVy?= , Ben Whitten , "David S. Miller" Subject: [PATCH lora-next 05/11] net: lora: sx130x: Fix regmap field toggles Date: Sun, 6 Jan 2019 09:37:48 +0100 Message-Id: <20190106083754.6004-6-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190106083754.6004-1-afaerber@suse.de> References: <20190106083754.6004-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When toggling the value of a regmap field, such as for F_RADIO_RST or F_EMERGENCY_FORCE_HOST_CTRL, we need to ensure it gets written out. Sadly the timing of the writes got lost in the regmap field conversion. Introduce an sx130x_field_force_write() helper for this. While at it, make trivial sx130x_field_write() static inline, too. Cc: Ben Whitten Signed-off-by: Andreas Färber --- drivers/net/lora/sx130x.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) -- 2.16.4 diff --git a/drivers/net/lora/sx130x.c b/drivers/net/lora/sx130x.c index 4ba02836a35d..457f2396d9ee 100644 --- a/drivers/net/lora/sx130x.c +++ b/drivers/net/lora/sx130x.c @@ -174,12 +174,18 @@ const struct regmap_config sx130x_regmap_config = { }; EXPORT_SYMBOL_GPL(sx130x_regmap_config); -static int sx130x_field_write(struct sx130x_priv *priv, +static inline int sx130x_field_write(struct sx130x_priv *priv, enum sx130x_fields field_id, u8 val) { return regmap_field_write(priv->regmap_fields[field_id], val); } +static inline int sx130x_field_force_write(struct sx130x_priv *priv, + enum sx130x_fields field_id, u8 val) +{ + return regmap_field_force_write(priv->regmap_fields[field_id], val); +} + static int sx130x_soft_reset(struct sx130x_priv *priv) { int ret; @@ -373,7 +379,7 @@ static int sx130x_agc_calibrate(struct sx130x_priv *priv) return -EIO; } - ret = sx130x_field_write(priv, F_EMERGENCY_FORCE_HOST_CTRL, 0); + ret = sx130x_field_force_write(priv, F_EMERGENCY_FORCE_HOST_CTRL, 0); if (ret) { dev_err(priv->dev, "emergency force failed\n"); return ret; @@ -694,7 +700,7 @@ int sx130x_probe(struct device *dev) msleep(500); - ret = sx130x_field_write(priv, F_RADIO_RST, 1); + ret = sx130x_field_force_write(priv, F_RADIO_RST, 1); if (ret) { dev_err(dev, "radio assert reset failed (%d)\n", ret); return ret;