Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1702757lqp; Sat, 23 Mar 2024 05:38:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUiLBF+oP5kMKIkfHU2cvpbUTfw97vunJdo4W30vrYiyaZDgqcbli8zP7QWrcJqzCIG/0YoZNpyBFEkIkA1dkFMF1cqRV72OLKibSJ4GQ== X-Google-Smtp-Source: AGHT+IGW5yrxONmuAgWS517swapZRE0RaD9bts5BZ3d8X4bru6gotqMimZ36cIb1JYC3HAofM3AW X-Received: by 2002:a05:6e02:4ad:b0:368:6665:6f50 with SMTP id e13-20020a056e0204ad00b0036866656f50mr2052697ils.16.1711197535726; Sat, 23 Mar 2024 05:38:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711197535; cv=pass; d=google.com; s=arc-20160816; b=hK7brExGPFHRYK5hc1uQNfc/yREbWEMr3n3jRp7MaA+2HFoX19MmXruF7HgzWs7+Z+ XOotHKewJ7p7IS67IWvsINJ5DEZJT6C8UlFVcfeMCM8QdWVVNHH2pDeFtvGsRVF+0Xbg HPlWBIvaZaHDENzFfoVQQA4h1TiXzzEVXd4rrk3jCMPCrjaDMLATP+50SxVz3TJqq3ea xUTMMd1RzAZbia8mE5IrVYsDDa7BTt2sI/Hyzpul/28EPHQqjnwvFqk8P+C3p118sHh3 6l00LukCFgJO9JPwv0B8HVJ4XEMBD1qcem1K0SMVliq2JCxSrH0c7Tbab/rY1Asm0h7O jBDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sfD9ogcu0YmTy1/lsVwah5XVZmwlR7yt3/IMurcSlXI=; fh=yfeD9NgSb/TJoEei4nKvjZ3SEDivkL+YLHabf70qs6g=; b=AXlkmYsyUXHvyVaqAL6O6pcXFx08UkXAMIA5pb8YB6brqKKDA/mNP4gjX4eAxxnSdp AbzuOfn3oA+ePJFjZD6GjZmOwUxjb1Io11dk+iNjkkc0X1mPh264uNMIkxoQ5PVKD4Pf gHXMIoLiZRaWxobufTl7oGUqCEy/2+FoeT02rPYH7TE+fkQgk6mDabcwhYDBTxDpRexo FQjIPJ5mcwccl2v2dQaOolXiDExSims6UL+yucx+taXgWDzg1ZKPUGrbgLh5LztZEhNi hAvVM+M8ybcW7OovJsy8guq+2cHNuqPiUpKm6/1NHB7lBKzOiZzKE6emTXy3ROThvRH1 RW0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gNNLVOmm; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-112340-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112340-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t3-20020a63eb03000000b005e857e4cc0bsi3997714pgh.483.2024.03.23.05.38.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Mar 2024 05:38:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112340-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gNNLVOmm; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-112340-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112340-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1366CB2455E for ; Sat, 23 Mar 2024 12:21:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F062F4176C; Sat, 23 Mar 2024 12:20:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gNNLVOmm" Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 797CF3D0CD; Sat, 23 Mar 2024 12:20:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711196445; cv=none; b=dkoqxIao6sIzKeJXw+C9Pg6nATNyKR5+L+xq/lNzUiFTklQ63Ptn7dPmIdLrblev9MhzCPyWckwxIMfgpOe6rPQkLLjekofvvC+h0fkuxcvP08VTSMextEKHP8xJAEMrwTrhmnnyIBZqX7mD7Yy5T7ZKaAsyw8GMvUEwUPh486w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711196445; c=relaxed/simple; bh=FAvMVuNp7mg5L7oKkcGsDQhCb9LCgqTOmyldi4lvU7Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bc3nIh/fZVAMaI1DK7F87bp11N2G8Ewo4D459HvgrF7d2/W30yZ7uDQ+w5ecq1k/20Fcp0tprdyH6u9cHy2Js2cprTSqkV3kixE0ZcVeJA/jSzyv7YZCLLEIc0aBZgziZYzCoWnNEAow4ErB0qfgveQA15hqwNUuxroHToXIuR4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gNNLVOmm; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-56be159c0b3so1838232a12.3; Sat, 23 Mar 2024 05:20:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711196442; x=1711801242; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sfD9ogcu0YmTy1/lsVwah5XVZmwlR7yt3/IMurcSlXI=; b=gNNLVOmmkUzZ7RQccNruNzTYurYejQSpZZUJQQicr/aUSPP1OLdAa+KIJdjpXrGNI0 RXwuPFonjp1aMR6XQKyJZ330RSxjaBbqjnpZ3OZ4TGceICb9DNIomt4oZWDZiQISW+xv J9JjsHUCwZGhyotcfmB1nMb0kXMh1kHWDO7vMUAm9i28ApK+UCvWk+emuLY3vom57Hgr 0zWP9zECoXAxyXugeqmW3ex1+ZyjnfdwnjijzA3GylJjux3Y9o78qCzdszYFaUJoBCvl fBDQcXaNStAOA8Wq6WI3T4flT1XRq1Pi9U/5l+2P73hrS2fDWaB0ODBKSUOLw60v5xaa CCew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711196442; x=1711801242; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sfD9ogcu0YmTy1/lsVwah5XVZmwlR7yt3/IMurcSlXI=; b=OYjdLqlyaeL8QErkmh5+y2BLDeXiL8C0C5sQeHpcd323mGMPmcPQ12mZwOFg92bADg cj2yjANz9F6/O56FXPrDVZ+UQYpyEA8a+aGnjXmr8EhUkS0RpINpfC2JOX1EqeRwfd3R EaTepd8n2hZdl2liGkAATtrR56IBDyi11E9t30Rq0OkAtsP8bczh7HsJ4c2dCwGOoMVo JDV41CjvQ46ObM6+0LygcjZ6rLwTtF7foOCUc52J9+dDWXd5Zee8MmAxGphU3MgzIMtd oRK1uINtVKvMsXtV0lxGmxgo0QVcic8Oh4LLrHyOpEg4iTYI0PX25I/+fBa5ilRz5OuH 6nCw== X-Forwarded-Encrypted: i=1; AJvYcCVS4EIqJgrtFoCsrPKZ+6a5ugHzRPfJgcoEnTBYsYMZNpfoZCAifaIDplvoUZTcT86269LKfwMI81Ybkwzp0UsU1YHPSJB7PfBMcLORX1ScgiShAAkVfCzY2murqCUEONQc6lxa1dBBxw== X-Gm-Message-State: AOJu0YxwfVTCHF9kF263f70r1M4O7yrjVid3v69CHcg0Ss3vWg/sx/lV CUNOJULYC2LQNsMoMCHJgbamb+oFt2vA6NZhnNm1okJrxM12Fajb X-Received: by 2002:a17:906:24d9:b0:a45:2e21:c776 with SMTP id f25-20020a17090624d900b00a452e21c776mr1568865ejb.3.1711196441841; Sat, 23 Mar 2024 05:20:41 -0700 (PDT) Received: from 764c7355c69b.v.cablecom.net (84-72-156-211.dclient.hispeed.ch. [84.72.156.211]) by smtp.gmail.com with ESMTPSA id gx24-20020a1709068a5800b00a46f0d133b9sm857265ejc.98.2024.03.23.05.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Mar 2024 05:20:41 -0700 (PDT) From: Lothar Rubusch To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, eraretuya@gmail.com, l.rubusch@gmail.com Subject: [PATCH v3 2/6] iio: accel: adxl345: Make data_range obsolete Date: Sat, 23 Mar 2024 12:20:26 +0000 Message-Id: <20240323122030.21800-3-l.rubusch@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240323122030.21800-1-l.rubusch@gmail.com> References: <20240323122030.21800-1-l.rubusch@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Replace write() data_format by regmap_update_bits(), because bus specific pre-configuration may have happened before on the same register. Changes then need to be masked. Remove the data_range field from the struct adxl345_data, because it is not used anymore. Signed-off-by: Lothar Rubusch --- drivers/iio/accel/adxl345_core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c index ae12836b5..33424edca 100644 --- a/drivers/iio/accel/adxl345_core.c +++ b/drivers/iio/accel/adxl345_core.c @@ -42,13 +42,13 @@ #define ADXL345_DATA_FORMAT_4G 1 #define ADXL345_DATA_FORMAT_8G 2 #define ADXL345_DATA_FORMAT_16G 3 +#define ADXL345_DATA_FORMAT_MSK ~((u8) BIT(6)) /* ignore spi-3wire */ #define ADXL345_DEVID 0xE5 struct adxl345_data { const struct adxl345_chip_info *info; struct regmap *regmap; - u8 data_range; }; #define ADXL345_CHANNEL(index, axis) { \ @@ -227,14 +227,13 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap, data = iio_priv(indio_dev); data->regmap = regmap; /* Enable full-resolution mode */ - data->data_range = ADXL345_DATA_FORMAT_FULL_RES; data->info = device_get_match_data(dev); if (!data->info) return -ENODEV; - ret = regmap_write(data->regmap, ADXL345_REG_DATA_FORMAT, - data->data_range); - if (ret < 0) + ret = regmap_update_bits(regmap, ADXL345_REG_DATA_FORMAT, + ADXL345_DATA_FORMAT_MSK, ADXL345_DATA_FORMAT_FULL_RES); + if (ret) return dev_err_probe(dev, ret, "Failed to set data range\n"); indio_dev->name = data->info->name; -- 2.25.1