Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp127648lql; Sun, 10 Mar 2024 17:55:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVTakxk14OFgUTS5X7/VSys4mVZ0bwQVhY4mAfKidUj5tK5rdCNkYpprvM2RlEzVvJRGLvKopY72U1l+OGPVUZVtz89pmf+1dOrlmXYHQ== X-Google-Smtp-Source: AGHT+IGzIfNgN4a1swil237SNA3X5etbWzp6SQK86fFNv0CNhWGjpe19X5ZFQhEAF0tckePvuKI3 X-Received: by 2002:a05:620a:ccf:b0:788:6231:1875 with SMTP id b15-20020a05620a0ccf00b0078862311875mr4422228qkj.12.1710118499990; Sun, 10 Mar 2024 17:54:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710118499; cv=pass; d=google.com; s=arc-20160816; b=MH8kHSaSdvaB4Y9QyjnaYmoHsAECLpOAdL+b9ZERHjT40VRmt3fSbhZs8l/YwUAAp+ p4eML3tEg5ECLWjog4Des5bOpiYSIIIc2LO1pxa7wWXh2Kn7la8ix6Y6VQPOCBGLf274 RfpS7+iXh6/zLtFc5UNZdVNrCVFOn3eLX/6q2ikZ3gAPHAJhnYGPjGUYppiUsv5S4ARn +KZSt1NdJ6ezRq9okNeQ6KS5GIHXPOtZ1FsZZtcw41u7bFPg5p7SF9Tx3wIpfFQXIVAE gm9e7VUcQ5BCXMf28rQe1yCsQUlP8lJ/GSZpA8mRStm2cTMJZ7pMku5K3uQPDEmAMODR Tosg== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=jRtxWB8Q0Yuuhy6rs9UUDDIt6Ct+XJ8tkpooJ1CMz/E=; fh=7x9sVH+92jbbgiyD4uasS4tB30R5knZKE6SGSb4kZkc=; b=WlhbaH+MPCfAXWJ1BglmokhyJPX77buzoCUsAT9S+1I4Vihw31tNXHpj9Hrh2S8q0d GCU83Nkskzc9LrhPB+dE+DUZFS9sXCrFeJK13Nxa+XuzN32tvn6xhyaa5k52HhUFXc4x GGQFv5mGTdDMBp3rP19cCPPFiaYmYbkqqn41bQHkyha74iQpnA3S98uSueSpKvnPPOF5 BxNoORKOXFnN/HYiylpxGvII7lQ5AuMaG0xR21OPyisXK4C6tX5965fxmEgo5E3G2xmn piLI+T92ae1i6BbA8KF3FTZl6k0bLz8mfIC+f35lD6JhMVZgYXfogqihIfxl4IC0INYR 4fog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KBL7+as6; 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-98390-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98390-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i14-20020ad45c6e000000b00690d10b5f1fsi1413968qvh.495.2024.03.10.17.54.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 17:54:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98390-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KBL7+as6; 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-98390-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98390-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B2D851C20E78 for ; Mon, 11 Mar 2024 00:54:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5459A3F; Mon, 11 Mar 2024 00:54:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KBL7+as6" Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 4578F622; Mon, 11 Mar 2024 00:54:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710118492; cv=none; b=bC5mLAukTKwIv2DZGZP9/f4O8CIi1QVutbD8yaxR66ZFrOAAYqlAivAgDoVHCUwXseMGm368Y1yMCQJSIMtQ/AzLrhsO6nIetnP3nd5TU81guyFqLueRrOpKLKOB2NBSTZTmcsNHt22v8lFZ+yqPd9WN6lWRUJvEm83+MSCFh60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710118492; c=relaxed/simple; bh=HJxx/b9XqDNTujCI2CqDQmRKxxztVUqH1ZaHHY1D4J0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=RHj3aiC96kM2Jx34FP3K0hkOvXxAD/WoZ9NxUL7XeZH929XCEgMD098S438Oqcrm+BObRv8TP9TKXX7+YvGbLqmwJ3W+BFEz28LvhVeRzJrxbhatjGNhoW7QUVsbNRhug8guuq9Quq6d491Q3a7rVRDJOOztv2PXKT57Uef0QHo= 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=KBL7+as6; arc=none smtp.client-ip=209.85.218.53 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-ej1-f53.google.com with SMTP id a640c23a62f3a-a28a6cef709so363167266b.1; Sun, 10 Mar 2024 17:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710118489; x=1710723289; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jRtxWB8Q0Yuuhy6rs9UUDDIt6Ct+XJ8tkpooJ1CMz/E=; b=KBL7+as6qx6sQ8lQ22I7vwLTv7pkd0CM9VrTd0yBzqEttv2lEC7g2UFaJ6rIj8HpB5 cVFavcBRmV+JMURKdAM6B4R3b1JcTJ1b2+9zprlzEG2fawzAQF21QrJnoYlHlo4/2jJX r8cfMEGhDTjVS6ASIiPyvVOPqKL/4tuyRuBgCfZHd5JREAsy5/5lG8azILcWLPjyjGGz FRf4YdZhLERQbKgtfr59qFy8Zg5onF0QMUcTUFaTIOmz6dy0ARL6MiKKSdZqvmlQDbbU z1JQZ+J3eHSiVQKiy4qIXD50PHLtjSaCzcFxPXBXM3XuLjbFWeNjcy3ZoZyvtJvfE0GK 2nxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710118489; x=1710723289; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jRtxWB8Q0Yuuhy6rs9UUDDIt6Ct+XJ8tkpooJ1CMz/E=; b=PM0W4jYroRvcUujpS0RtlgexSApPKXxyaSmbE4NnQjhoqMxaSHwj7rXB6n/2JWxbGA 0eAQBJ/dhFQrWQ9qcWCJDNT02VCobgPAzTI4+MTFW5pUsN10wkckVG2Bx1qVqQTjY3cf uk04gV0TrZr8xgRospkOyZ4SGG4bOxx1g0v90sLUiL4+OJ1H6/yVw7Awvr7tHCMkoBzX fJVvQ99h3c6jFckD1rOsxxKghI5pa5co6rYZdouzyyJxNWQ1G47qVUldLT2zTP46cFe+ 6WMvsavuvdvfVYjYMkCjfifP53a9N4+krknRftrR7qfyi4x95RGHAEgCYbIVYBI8GxHD AqaA== X-Forwarded-Encrypted: i=1; AJvYcCWAGEZZS9OQUqF2vhvXU4fjM44uEmZ0VXEG6T1FHCT0wLPNA0dJNDPcURLp6Oo05on284b/zezKg9ySW7yvIJtvUbZjQt05X9dWn3jybpYf0wFFe4EFMKUtjlekfI9QdlBDWTQ5x6H7 X-Gm-Message-State: AOJu0YxCIfGAjwWoIZ5Fvo5mJomnUoE9FP1ZDNqtwj+LH03U2p8JY3lQ 9g/vYf1Nv70Yk9O5lrWvJ3JpPLh23G2GvX65OBtGSaQLUnbVDkVn X-Received: by 2002:a17:906:7084:b0:a3f:804f:c1a4 with SMTP id b4-20020a170906708400b00a3f804fc1a4mr3505703ejk.74.1710118489342; Sun, 10 Mar 2024 17:54:49 -0700 (PDT) Received: from localhost.localdomain ([2a04:ee41:82:7577:b24d:a5cc:76ea:4a7a]) by smtp.gmail.com with ESMTPSA id qu21-20020a170907111500b00a45d17148a3sm2403535ejb.13.2024.03.10.17.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 17:54:48 -0700 (PDT) From: Vasileios Amoiridis To: jic23@kernel.org Cc: lars@metafoo.de, andriy.shevchenko@linux.intel.com, ang.iglesiasg@gmail.com, phil@raspberrypi.com, 579lpy@gmail.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Vasileios Amoiridis Subject: [PATCH] iio: pressure: Fixes SPI support for BMP3xx devices Date: Mon, 11 Mar 2024 01:54:32 +0100 Message-Id: <20240311005432.1752853-1-vassilisamir@gmail.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Bosch does not use unique BMPxxx_CHIP_ID for the different versions of the device which leads to misidentification of devices if their ID is used. Use a new value in the chip_info structure instead of the BMPxxx_CHIP_ID, in order to choose the regmap_bus to be used. Fixes: a9dd9ba32311 ("iio: pressure: Fixes BMP38x and BMP390 SPI support") Signed-off-by: Vasileios Amoiridis --- drivers/iio/pressure/bmp280-core.c | 1 + drivers/iio/pressure/bmp280-spi.c | 9 ++------- drivers/iio/pressure/bmp280.h | 1 + 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c index fe8734468ed3..5ea9039caf75 100644 --- a/drivers/iio/pressure/bmp280-core.c +++ b/drivers/iio/pressure/bmp280-core.c @@ -1233,6 +1233,7 @@ const struct bmp280_chip_info bmp380_chip_info = { .chip_id = bmp380_chip_ids, .num_chip_id = ARRAY_SIZE(bmp380_chip_ids), .regmap_config = &bmp380_regmap_config, + .spi_read_extra_byte = 1, .start_up_time = 2000, .channels = bmp380_channels, .num_channels = 2, diff --git a/drivers/iio/pressure/bmp280-spi.c b/drivers/iio/pressure/bmp280-spi.c index a444d4b2978b..3a5fec5d47fd 100644 --- a/drivers/iio/pressure/bmp280-spi.c +++ b/drivers/iio/pressure/bmp280-spi.c @@ -96,15 +96,10 @@ static int bmp280_spi_probe(struct spi_device *spi) chip_info = spi_get_device_match_data(spi); - switch (chip_info->chip_id[0]) { - case BMP380_CHIP_ID: - case BMP390_CHIP_ID: + if (chip_info->spi_read_extra_byte) bmp_regmap_bus = &bmp380_regmap_bus; - break; - default: + else bmp_regmap_bus = &bmp280_regmap_bus; - break; - } regmap = devm_regmap_init(&spi->dev, bmp_regmap_bus, diff --git a/drivers/iio/pressure/bmp280.h b/drivers/iio/pressure/bmp280.h index 4012387d7956..70bceaccf447 100644 --- a/drivers/iio/pressure/bmp280.h +++ b/drivers/iio/pressure/bmp280.h @@ -423,6 +423,7 @@ struct bmp280_chip_info { int num_chip_id; const struct regmap_config *regmap_config; + int spi_read_extra_byte; const struct iio_chan_spec *channels; int num_channels; -- 2.25.1