From patchwork Thu Nov 21 08:19:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13881744 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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 7F65712FB1B; Thu, 21 Nov 2024 08:19:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177200; cv=none; b=eiMXlvIWejbChgbwUg6JssYj3VLj4/ciV+8TMMbEj0ItDNSXMfRULnrQctk+qQOjtOo+VmQB4hcatV4+fptc3lBZzm+lWxf143Xi+zIlyoqbk/QRg8XmrJu7RHlya1Xk8hdTneme1uEKwPv4gysIyD3Dg06f4vM88y35sG8zik0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177200; c=relaxed/simple; bh=Tss0VRh4bUkpnT4e1pQi/xtE4i7zCt6siIj9oXDm590=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VA3LcNZOZ326KqwPG5yl7d5RMDVKTvtSnrzC5sUFyyGxubrEI4nidh7PYOMwJHAxLw4kpn4yecFTRNfMjtagf23yXgXVQrZbTm9obo5Bc9wQ0lbOK+uThT91AvIHIB8X5NXGyMfBj3VgbVQoov+G0C6JTciZ5RZJqEwJUl8L3V4= 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=Z6CS8PSs; arc=none smtp.client-ip=209.85.167.45 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z6CS8PSs" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-53c779ef19cso601994e87.3; Thu, 21 Nov 2024 00:19:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732177197; x=1732781997; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=OlxAXQkdmtS4BM481s0Fp1t7se/dqFGAYGKKgz2EH/M=; b=Z6CS8PSs974sbWHNHK1bt8POU38JN6kJEKDQA3rD4Q5Zw4lBxmfPXHCIATd+F/ogUh PTjRvspllNSvW2J2QkNCagokJSvSY6z8C4BUKRYVcyhf4Cr2XwHyqNIpqBVk/imGa6Ql GUFw5aoAN+OPtjLSqt10ac0rCzcXkBJB84IJudXv9pl8yZJcUCkW6fbjbX7Y5ON/Elws ZpLZLUX0DabpifEZPwnDnYQ4HXdLnQNODE24yU2BS/1CV30zEnW3yBUVCOz7FJ4SB8T6 lXCxewUXqwpkh/BkCm9Y5vnuH106kA5L9NzcPsar/+JwfigweNYU6matXROho3dWUgq/ dzDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732177197; x=1732781997; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OlxAXQkdmtS4BM481s0Fp1t7se/dqFGAYGKKgz2EH/M=; b=HW1Tuk8wG93twME1CvzKh8AEwv4pcmMdSHDKeOhOaWw1fFAoImposm1qfipLAlLn5p t8NFxd0DwA3vO+lj41kEkvWD2nhm+wEeA6qxQ/XhEEylyNpko3kWcUHEwautm4GmvIQI Og4tUg1DiBt6AF1p/Ly2hXnt23pDkh5DMuUfMDTW9L6R5gfMgEEIg0pOUTMRmLH70LdI 2TjunG+I1/mp2bfNOhexchYRJK0WOArxTd/d5DNk5AcWlUlv0SFY+kBLHU3Q/CpxzXqP 3xOCKnQAX1NyzL2y1Rarp2j3rq3hTgcUnitFBrF9qUtZqvesxQeXdE5QJBoH19FF96ay NkvA== X-Forwarded-Encrypted: i=1; AJvYcCW5DUhwWIPWQn6f00zWGDdo0sJUJFt3cqyL0IrP21iMvbGs9jERccGewvIk5UTBu5gjDPEOxcoHZLgP@vger.kernel.org, AJvYcCWMCoOSQ6yy1eVpqrOGQsL7KaucAHZAmtDzlnndaJaGD3msEjNDr4flpUQnkUqBjGbu+hMhGbNmUzFOtMok@vger.kernel.org, AJvYcCXTqNIqa3Rb1E66ARhiqHwMjK8+0UHoHKx1H/cIgOACA5E9aZpADPjRopdwt8+CZOHk8Cm64Otbr86l@vger.kernel.org X-Gm-Message-State: AOJu0YxOz6Mwk11/l1Pa5Qh70ge57I33h8RsCRhdeaFH7FBu9c66q44c 2TMh1ObZKvVU6lR+3eAeBeZxI6o3biZ2fg4FBPYmGKuW4XOI5kVY X-Google-Smtp-Source: AGHT+IGJpIHKOj5CJVrOfwGtGE4ZDsCzVd9RLKW0rpNvfkRI/vdt9yfJLkLmfW+ioEK13LToXgGydg== X-Received: by 2002:ac2:4c28:0:b0:53a:97a:a394 with SMTP id 2adb3069b0e04-53dc136d9b2mr2157280e87.57.1732177196343; Thu, 21 Nov 2024 00:19:56 -0800 (PST) Received: from mva-rohm ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dbd3fcd9fsm901063e87.108.2024.11.21.00.19.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 00:19:54 -0800 (PST) Date: Thu, 21 Nov 2024 10:19:50 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/8] iio: accel: kx022a: Improve reset delay Message-ID: References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: All the sensors supported by kx022a driver seemed to require some delay after software reset to be operational again. More or less a random msleep(1) was added to cause the driver to go to sleep so the sensor has time to become operational again. Now we have official docuumentation available: https://fscdn.rohm.com/kionix/en/document/AN010_KX022ACR-Z_Power-on_Procedure_E.pdf https://fscdn.rohm.com/kionix/en/document/TN027-Power-On-Procedure.pdf https://fscdn.rohm.com/kionix/en/document/AN011_KX134ACR-LBZ_Power-on_Procedure_E.pdf stating the required time is 2 ms. Due to the nature of the current msleep implementation, the msleep(1) is likely to be sleeping more than 2ms already - but the value "1" is misleading in case someone needs to optimize the start time and change the msleep to a more accurate delay. Hence it is better for "documentation" purposes to use value which actually reflects the specified 2ms wait time. Change the value of delay after software reset to match the specifications and add links to the power-on procedure specifications. Signed-off-by: Matti Vaittinen --- Revision history: v1 => v2: - Included in the series of improvements (was a separate patch) - rebased on iio/testing to avoid conflicts with queued fixes --- drivers/iio/accel/kionix-kx022a.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c index 53261e1d5d1f..b6664299e0d5 100644 --- a/drivers/iio/accel/kionix-kx022a.c +++ b/drivers/iio/accel/kionix-kx022a.c @@ -1121,10 +1121,15 @@ static int kx022a_chip_init(struct kx022a_data *data) return ret; /* - * I've seen I2C read failures if we poll too fast after the sensor - * reset. Slight delay gives I2C block the time to recover. + * According to the power-on procedure documents, there is (at least) + * 2ms delay required after the software reset. This should be same for + * all, KX022ACR-Z, KX132-1211, KX132ACR-LBZ and KX134ACR-LBZ. + * + * https://fscdn.rohm.com/kionix/en/document/AN010_KX022ACR-Z_Power-on_Procedure_E.pdf + * https://fscdn.rohm.com/kionix/en/document/TN027-Power-On-Procedure.pdf + * https://fscdn.rohm.com/kionix/en/document/AN011_KX134ACR-LBZ_Power-on_Procedure_E.pdf */ - msleep(1); + msleep(2); ret = regmap_read_poll_timeout(data->regmap, data->chip_info->cntl2, val, !(val & KX022A_MASK_SRST), From patchwork Thu Nov 21 08:20:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13881745 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (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 9755512FB1B; Thu, 21 Nov 2024 08:20:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177218; cv=none; b=OU5JGo5IDmzAAxcEa/X9ghhEFhJ2JcIfBMZhsH5BafJck84V77c0ifUWixsHJHkLYyqi/K0T+Bx9gobzR5wG8nj9kBhUTyQxx9ZOE05nVJJKw0vDoLgEq/31Cw3tdRaldreW/A3/Ap5xcfT9R/RH3E8UKTlGPYxLKTLgoBiC1vw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177218; c=relaxed/simple; bh=7Rt42u/XCjYpglpy1boRCDwPVpqgQFmGqiV2rb0uP6Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ho/ucXURCugH8FdgPLzl/7/rek6G5/BXAmjj5XTiYnHng5o0VG5RaOswcXeXGYwD0vKxMtu7unPXGDGniEHBT1U657eDVEurS/y++5Q8tjghmpGDkys6jtUyWpoiWy7dIki1dYIkIlEs8Lr4LrdtgcQzOuVmxLd5fgUlEHAMpaI= 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=hMn8/S+T; arc=none smtp.client-ip=209.85.208.171 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hMn8/S+T" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2fb561f273eso6545201fa.2; Thu, 21 Nov 2024 00:20:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732177215; x=1732782015; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=lmhBGQ/m+qVWheJtFzpyd5mx+oTRXoNs7skerrQrF0g=; b=hMn8/S+TZQm9Eg9CYjyQ3yEAZHMoc0td6eVgn09fueJljMj2+tolJ9ZtiNbJihw4Hb nOPGdIc7DauUD/m+2orxSTLSrgrLAyqfSdB3soggJuvV+yG0sHZT/7UYXtuAEaKPmsIW xOhg10T4kRXq2AH4x4n3CmxohO+q/ZYxLVcE0U1KdrbSKTq2XRV9jwky8Y5XVlv6RvHJ LjhGVB5JnDRNXm0bN16EbJs8UESl0H1JF6+CDX+z2MaPtihnovA0AZWpqbKbT3ViT4Iy GEcWS0qv/eMJU/k7WPXK9owK1K7skHZOeUsAwBEifiiEBW1XhYmVFDt0iHc9/Nnmse51 6YuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732177215; x=1732782015; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lmhBGQ/m+qVWheJtFzpyd5mx+oTRXoNs7skerrQrF0g=; b=XBlTqhhiDwWO3aL0exiXNy96yI1dqH+0LUIP5q/NTGV6RxjVRn9KSjNHJGI1a8kQ73 G8gBU9rpCB4+tTGHG4Rf4Ir/82jThEzcUnS71Le/vgKa0lcpMrhn0VPXWcOnV1u9HIjl SIN1ISqyPZUZ+ghGg7i4X7VqzdlYPhtbfynou0DjY5u+GgBvOxGKTZBFbWjAMovQkXeQ So/vaExsHAHfdqd6NpFPCwLuOW9KbE0N421A33/nRJkFgswJpvwiWFbQmnXaXLHNB59o EBDr1UYBADgW/abZBBIXwtzW80GycWyHbHdbPbRbchjT3hezh8BZOMEWTg2eqiqWRWVo 65SA== X-Forwarded-Encrypted: i=1; AJvYcCW7Ecrkie4ucaVUc10F8urh2BpsPEpkOnZr/KFapFSeTvwrwJ1AA6pQALpMzL73BBN9qRQRCwvUAQXd@vger.kernel.org, AJvYcCX+3Ox2RN9FYoeBSAzVvnEWpE5DlTzrEVFRwAMwCAyJXHbcCFtoiIOUZWsn+ju9HPBuPH+lzsfr1nC99g8+@vger.kernel.org, AJvYcCXfbhv6SXWMFgoxrf6mnWaTP47KOagOr9VXqMJxd8zhunAsS3Vv6XgBnijq4lJ1dOt6uMcpyC9UCtW9@vger.kernel.org X-Gm-Message-State: AOJu0YyFKZG3TrWokWTJoZEoASafB+25nSgtaRkO8hzPuHTq9PTWoltA tGwpvf9TaBmtP4Pbuywgvcz6640vLZnHO7/7y0bGmSTKjmhe8NxMUbgiDdEu X-Google-Smtp-Source: AGHT+IEXAKD/iUvWWuPhg6BgTI8jpoaIDpC5HIqcCZiH/v34w/m3LLezWKo9yLndSf2xo7t5UfgRfA== X-Received: by 2002:a05:651c:e04:b0:2fb:5723:c9ea with SMTP id 38308e7fff4ca-2ff8dcc9c31mr21887501fa.30.1732177214588; Thu, 21 Nov 2024 00:20:14 -0800 (PST) Received: from mva-rohm ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ff69967dedsm18104251fa.56.2024.11.21.00.20.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 00:20:12 -0800 (PST) Date: Thu, 21 Nov 2024 10:20:07 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/8] iio: gts: Simplify using __free Message-ID: <5efc30d832275778d1f48d7e2c75b1ecc63511d5.1732105157.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The error path in the gain_to_scaletables() uses goto for unwinding an allocation on failure. This can be slightly simplified by using the automated free when exiting the scope. Use __free(kfree) and drop the goto based error handling. Signed-off-by: Matti Vaittinen --- Revision history: v1 => v2: - patch number changed because a change was added to the series. - rebased on iio/testing to avoid conflicts with queued fixes --- drivers/iio/industrialio-gts-helper.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/iio/industrialio-gts-helper.c b/drivers/iio/industrialio-gts-helper.c index 291c0fc332c9..602d3d338e66 100644 --- a/drivers/iio/industrialio-gts-helper.c +++ b/drivers/iio/industrialio-gts-helper.c @@ -4,6 +4,7 @@ * Copyright (c) 2023 Matti Vaittinen */ +#include #include #include #include @@ -167,8 +168,8 @@ static int iio_gts_gain_cmp(const void *a, const void *b) static int gain_to_scaletables(struct iio_gts *gts, int **gains, int **scales) { - int i, j, new_idx, time_idx, ret = 0; - int *all_gains; + int ret, i, j, new_idx, time_idx; + int *all_gains __free(kfree) = NULL; size_t gain_bytes; for (i = 0; i < gts->num_itime; i++) { @@ -232,10 +233,9 @@ static int gain_to_scaletables(struct iio_gts *gts, int **gains, int **scales) gts->avail_all_scales_table = kcalloc(new_idx, 2 * sizeof(int), GFP_KERNEL); - if (!gts->avail_all_scales_table) { - ret = -ENOMEM; - goto free_out; - } + if (!gts->avail_all_scales_table) + return -ENOMEM; + gts->num_avail_all_scales = new_idx; for (i = 0; i < gts->num_avail_all_scales; i++) { @@ -246,14 +246,11 @@ static int gain_to_scaletables(struct iio_gts *gts, int **gains, int **scales) if (ret) { kfree(gts->avail_all_scales_table); gts->num_avail_all_scales = 0; - goto free_out; + return ret; } } -free_out: - kfree(all_gains); - - return ret; + return 0; } /** From patchwork Thu Nov 21 08:20:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13881746 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (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 2570B1C9DFE; Thu, 21 Nov 2024 08:20:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177235; cv=none; b=HVGao6COO9KfeWNzknSPECC47Hs3FSv3AomSnsbHmaDx5o3OxbGQiP0EFErzmtEwCvhhbOzzqUMhnk8AcNt+ohV0lHLyvptzjBBSF/2hEx4Z8Eq9y6uh2nhE/JWYdOQAPMnWf/w2jjAePjljgh5F7AVp3T6zloMVArXUXWk31tk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177235; c=relaxed/simple; bh=l3uIrlJwPeaICVlO2YsPWovLE+v5JJmIMSKJ/S8b7Dk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QsTUCF7mIOVlk8DGpDLLMBlirsFszFyaqhAAQnS8cAroQrGzj4ASvTolo5uWwLABr/mk198GI5afSHjBaLU2M5VwE+BPAj1zHTJRxVKBI7fwYD5jMz7Nw77ziDH0X1ZNYr3BqCGHe3jUkHSOVht1ZWe7UCJhuguroMh2qq3zpqc= 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=V/09NQYZ; arc=none smtp.client-ip=209.85.208.178 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V/09NQYZ" Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2fb51e00c05so10757271fa.0; Thu, 21 Nov 2024 00:20:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732177231; x=1732782031; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Wz0Yhn/+UnMGTflEuTVJTUtrlxk/nxP7mdwTw0nLivE=; b=V/09NQYZrDwYvunyLe044w4wk2pZxIr4N5cruRviUvz7bssxkfw7VcRWpvTKcrdyzY 08WZFNPsenTCGfYxr6mANN7oVenNUgfvsVEF3r3OMUXnfnQvgnHACdV2JDM+gkKvmxXC X7agF/rfdOqKVfEvM2PBDEB3U+y55veKlwh4yrRpqrzu3EgQqeoKvsqa/Sj7Hr6xLAkW VIQZSt8sWSw7kTq/+WGmrk5YGZhyI+i9PZiEXW+xKSpMl0HCyyD778qd/lYujgvo3ZbJ xlSzTfPfTkaiGBT6mzk+9LFswiSoqYqTBFdxBdvWT1awBUv/GgvL3X+7YOTURiva+iGG tqyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732177231; x=1732782031; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Wz0Yhn/+UnMGTflEuTVJTUtrlxk/nxP7mdwTw0nLivE=; b=b46MEi3WOrNwD7uRj8MTzBiaQSz2wU+OLDhEUYzE/j55byx/KoS4thDzRkRThHCwI+ Zdenwl0ZFUwUh+2rOcQJwvpZBDbRZ9uIbOuxJtbmYA0EJWt1LvQeM6o+0pTsOvrTLmZP iaYQl77cdRhwm5JLFrv5upRYAfm6m6jsqQGK113Jv8fO6gsMS+4AK+PYyecTwSJ2g7xE /jUcbUfwI4Yvss2wWn0VqgToXkT69CNTy2yZq3Kq5eFwyLK/oS1vA1hX+5BWxMq82ppJ DqzSfdhiQivN+x8/aqksDy/1GVc33ZQY1U0fhAATyAuTRu7GbJM9E9aT43HA/dbj4wA6 NjZg== X-Forwarded-Encrypted: i=1; AJvYcCU0vwQUflKWaI9n8J6arSc38/qF67aBY7+jkt//T7eMCfhR/wUz6q0rpzkD34/61qk4C2FNCuebA+/JugvY@vger.kernel.org, AJvYcCWX2IDJwZQtn0fXMZmgAtkXsKe0xSKrQKLvcgMudzz0G/9W0E5iVw7P0vHS8a0RA0HvVJ+Z6/g4IqlQ@vger.kernel.org, AJvYcCXmgmGhDEZrRohhrgOs7jr1f09wBKSqSwRQ/1ICJkN6UnT71km0zpEDZO5Ngr/XXG6RcJ+bCFQCmTro@vger.kernel.org X-Gm-Message-State: AOJu0YwRarilAPsqJpWqra+gYKu44/IJ4fwlwzR26h4r4TYK769yI4fB D04+VQ2fCmcywSgU/GI0/laWL0IV6kybel3ioTFWL8sPC11CVyaR X-Google-Smtp-Source: AGHT+IFpaR7sDe0yFaLb1WGuLhgutz8aqP7RUJtn6zo7QdZbydR9Xl+6qUK6bxp1bl6BkJNClln2pA== X-Received: by 2002:a2e:bc03:0:b0:2fa:c0c2:d311 with SMTP id 38308e7fff4ca-2ff8db1659bmr44182111fa.5.1732177230827; Thu, 21 Nov 2024 00:20:30 -0800 (PST) Received: from mva-rohm ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ff69ae805dsm17951641fa.72.2024.11.21.00.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 00:20:28 -0800 (PST) Date: Thu, 21 Nov 2024 10:20:23 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/8] iio: accel: kx022a: Use cleanup.h helpers Message-ID: <037985fe50fe79c79b9df95fa7b4e577378f9a60.1732105157.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: A few functions in KX022A need to use mutex for protecting the enabling/disabling of the measurement while configurations are being made. Some of the functions can be slightly simplified by using the __cleanup based scoped mutexes, which allows dropping the goto based unlocking at error path. Simplify error paths using guard(mutex). Signed-off-by: Matti Vaittinen --- Revision history: v1 => v2: - patch number changed because a change was added to the series. - rebased on iio/testing to avoid conflicts with queued fixes --- drivers/iio/accel/kionix-kx022a.c | 61 ++++++++++++------------------- 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c index b6664299e0d5..98953178a580 100644 --- a/drivers/iio/accel/kionix-kx022a.c +++ b/drivers/iio/accel/kionix-kx022a.c @@ -5,6 +5,7 @@ * ROHM/KIONIX accelerometer driver */ +#include #include #include #include @@ -448,7 +449,7 @@ static void kx022a_reg2scale(unsigned int val, unsigned int *val1, *val2 = kx022a_scale_table[val][1]; } -static int kx022a_turn_on_off_unlocked(struct kx022a_data *data, bool on) +static int __kx022a_turn_on_off(struct kx022a_data *data, bool on) { int ret; @@ -469,7 +470,7 @@ static int kx022a_turn_off_lock(struct kx022a_data *data) int ret; mutex_lock(&data->mutex); - ret = kx022a_turn_on_off_unlocked(data, false); + ret = __kx022a_turn_on_off(data, false); if (ret) mutex_unlock(&data->mutex); @@ -480,7 +481,7 @@ static int kx022a_turn_on_unlock(struct kx022a_data *data) { int ret; - ret = kx022a_turn_on_off_unlocked(data, true); + ret = __kx022a_turn_on_off(data, true); mutex_unlock(&data->mutex); return ret; @@ -912,18 +913,19 @@ static int kx022a_fifo_disable(struct kx022a_data *data) { int ret = 0; - ret = kx022a_turn_off_lock(data); + guard(mutex)(&data->mutex); + ret = __kx022a_turn_on_off(data, false); if (ret) return ret; ret = regmap_clear_bits(data->regmap, data->ien_reg, KX022A_MASK_WMI); if (ret) - goto unlock_out; + return ret; ret = regmap_clear_bits(data->regmap, data->chip_info->buf_cntl2, KX022A_MASK_BUF_EN); if (ret) - goto unlock_out; + return ret; data->state &= ~KX022A_STATE_FIFO; @@ -931,12 +933,7 @@ static int kx022a_fifo_disable(struct kx022a_data *data) kfree(data->fifo_buffer); - return kx022a_turn_on_unlock(data); - -unlock_out: - mutex_unlock(&data->mutex); - - return ret; + return __kx022a_turn_on_off(data, true); } static int kx022a_buffer_predisable(struct iio_dev *idev) @@ -959,33 +956,29 @@ static int kx022a_fifo_enable(struct kx022a_data *data) if (!data->fifo_buffer) return -ENOMEM; - ret = kx022a_turn_off_lock(data); + guard(mutex)(&data->mutex); + ret = __kx022a_turn_on_off(data, false); if (ret) return ret; /* Update watermark to HW */ ret = kx022a_fifo_set_wmi(data); if (ret) - goto unlock_out; + return ret; /* Enable buffer */ ret = regmap_set_bits(data->regmap, data->chip_info->buf_cntl2, KX022A_MASK_BUF_EN); if (ret) - goto unlock_out; + return ret; data->state |= KX022A_STATE_FIFO; ret = regmap_set_bits(data->regmap, data->ien_reg, KX022A_MASK_WMI); if (ret) - goto unlock_out; - - return kx022a_turn_on_unlock(data); - -unlock_out: - mutex_unlock(&data->mutex); + return ret; - return ret; + return __kx022a_turn_on_off(data, true); } static int kx022a_buffer_postenable(struct iio_dev *idev) @@ -1053,7 +1046,7 @@ static irqreturn_t kx022a_irq_thread_handler(int irq, void *private) struct kx022a_data *data = iio_priv(idev); irqreturn_t ret = IRQ_NONE; - mutex_lock(&data->mutex); + guard(mutex)(&data->mutex); if (data->trigger_enabled) { iio_trigger_poll_nested(data->trig); @@ -1068,8 +1061,6 @@ static irqreturn_t kx022a_irq_thread_handler(int irq, void *private) ret = IRQ_HANDLED; } - mutex_unlock(&data->mutex); - return ret; } @@ -1079,32 +1070,26 @@ static int kx022a_trigger_set_state(struct iio_trigger *trig, struct kx022a_data *data = iio_trigger_get_drvdata(trig); int ret = 0; - mutex_lock(&data->mutex); + guard(mutex)(&data->mutex); if (data->trigger_enabled == state) - goto unlock_out; + return 0; if (data->state & KX022A_STATE_FIFO) { dev_warn(data->dev, "Can't set trigger when FIFO enabled\n"); - ret = -EBUSY; - goto unlock_out; + return -EBUSY; } - ret = kx022a_turn_on_off_unlocked(data, false); + ret = __kx022a_turn_on_off(data, false); if (ret) - goto unlock_out; + return ret; data->trigger_enabled = state; ret = kx022a_set_drdy_irq(data, state); if (ret) - goto unlock_out; - - ret = kx022a_turn_on_off_unlocked(data, true); - -unlock_out: - mutex_unlock(&data->mutex); + return ret; - return ret; + return __kx022a_turn_on_off(data, true); } static const struct iio_trigger_ops kx022a_trigger_ops = { From patchwork Thu Nov 21 08:20:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13881747 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (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 E489612FB1B; Thu, 21 Nov 2024 08:20:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177250; cv=none; b=haGw4uNrrJOF5mhhIrVOys6ZT2FGqvQGVdZKeIDVSsH7aTcAHD90BAAAUAafmo7vl0aPNpXK13/5f/Uf3Kdn4Ae8o8LEiH++U6i10DkebmZ4r+Wz6+VkSVLLHqzOqnMbTcgpcwvpQRTwFukDfxUBqoZaG4ERxm9jtbXPmDmRkJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177250; c=relaxed/simple; bh=D6Gk23yPn+Pf+BfSoF++QzMUir3tcaJIxUjG5pKdssU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MEpgNyANV2WmVgedBNVWzHYG6X3nifZZHdnNITQzs+YLdPUCbb/Yv5eFj+6TZlUAK6tKiB5hWgHstriTAYnnC8/Wcnp1ieWAW5YV9qMUeyLGjA1Z2kABrXJJof/tSGVsipbEo5Qhh9qg230Jwi7QrvX/Px41+F5d4/h/4tiEZ/M= 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=LYScxxev; arc=none smtp.client-ip=209.85.208.178 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LYScxxev" Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2fb51e00c05so10761451fa.0; Thu, 21 Nov 2024 00:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732177247; x=1732782047; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=nadS3kyGO1tCxcQ0OWmMFA5pJwFg8BTRjcC/TXXsp3c=; b=LYScxxev6zZCEvTSa0kym9t1/+4YsycRe2j2A1+UFAijNo1KlL9lNG9OKU5uudn74A 9NqqyjXnGtdOSQA4oLzUC08dal4N+vKnclAnG1STJpJEsaXwwLcoNJWs8bn/yx1edtkp zekeOmJp/6Q+BL8FOPhofNsXSBZfgRKMOn4jxI7xZS0lYT8YbQMOSq6+hOYM74w1ekrl /+cXNHvPKIh3pVveM8AeuFEd1beo0dlyBDKb/fuiIeYqWltSj3UN31zwUV6JToQQfbFP H2HR0HkTe0iIq0F4f2srIGmkFI5TnAH30fFfnM8J6d3FBq+SmFLPN5fQ3y3e+NGl8h0E wRAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732177247; x=1732782047; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nadS3kyGO1tCxcQ0OWmMFA5pJwFg8BTRjcC/TXXsp3c=; b=K/XuRUy3Z40+dS75VNJlncRda2cDomU6STRVyHBWKVo1xyOCqT7rX0ZnG5xQ4KXe8h ftl6cSDwFSGTe11OmbxwHUrvfr1UZVyEhViIrRhq3VSkEcIl8Qy2+8KOd7CcjK8GRoNA aLh+lOHD4w5ZrLVQbKWG/g4KjwXCHX5QFhMhE8B0k55ND+JlTSaydqs2eejeuAvuTN+O 7QbOOO7FrrIxuPxaLS09HOH816yhgq6KE8OqfiElcqOgCuQCTYw+TTZLFStqIwgsP9sR vObHjoUSPJE+48Hv60s6w02k0i5uUWKBnEbereIA7J14vQ8fttW0qyaOIwWfAy8XWn6M +VkQ== X-Forwarded-Encrypted: i=1; AJvYcCUhN3ZdzbY0cYEmsLRUqPIJwLWL4tfnPcHVmLmWm9VSYsJ3gyZzABll4Rbsv+2baSn0AXWS9SpC+X6s@vger.kernel.org, AJvYcCWoOQaIS/aWQ+Z4HOOQEuOoxfgMSPP9dKg4CeUdCKCqCmZyk2eB+j0zhTzxaZ/tud8yoyS8mWLWJXamurXF@vger.kernel.org, AJvYcCXkJnOHKIBPzyinurrjr8GtZ3eoqhTZ60KwkIKXPelKx6yGk9tgxGu02CiKpj7W0mw60exIPfe9+7cW@vger.kernel.org X-Gm-Message-State: AOJu0YyR3ByVfC6XJ1ZrChk3jGqPTxKNHive/TRZgEWjjULDSBs0a2zk Ob3R8YgMvUFx94Jga3UAPb970t1carQFpbcBaWlbpJR2qUdw5UdT X-Google-Smtp-Source: AGHT+IFO/wkCZwRDPfXP6zNmTgQQ3Wc6KHl9afYQRDg3+vzoiBKCDmG5siAY7tZqTRqIsQvTrzvSqQ== X-Received: by 2002:a2e:a596:0:b0:2f7:5a41:b0b with SMTP id 38308e7fff4ca-2ff8dc762admr62599591fa.26.1732177246897; Thu, 21 Nov 2024 00:20:46 -0800 (PST) Received: from mva-rohm ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ff69959957sm18020121fa.43.2024.11.21.00.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 00:20:44 -0800 (PST) Date: Thu, 21 Nov 2024 10:20:39 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/8] iio: accel: kx022a: Support ICs with different G-ranges Message-ID: <5eda60de7d8fce910bc638918cbd3a204a7989e6.1732105157.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The register interface of the ROHM KX134ACR-LBZ accelerometer is almost identical to the KX132ACR-LBZ. Main difference between these accelerometers is that the KX134ACR-LBZ supports G-ranges +/- 8, 16, 32 and 64G. All the other sensors supported by the kx022a driver can measure +/- 2, 4, 8 and 16G. Prepare supporting the KX134ACR-LBZ with different G-ranges by storing a pointer to the scale tables in IC specific structure. Signed-off-by: Matti Vaittinen --- Revision history: v1 => v2: - patch number changed because a change was added to the series. - rebased on iio/testing to avoid conflicts with queued fixes --- drivers/iio/accel/kionix-kx022a.c | 32 ++++++++++++++++++++----------- drivers/iio/accel/kionix-kx022a.h | 2 ++ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c index 98953178a580..b23a27623a46 100644 --- a/drivers/iio/accel/kionix-kx022a.c +++ b/drivers/iio/accel/kionix-kx022a.c @@ -413,6 +413,8 @@ static int kx022a_read_avail(struct iio_dev *indio_dev, const int **vals, int *type, int *length, long mask) { + struct kx022a_data *data = iio_priv(indio_dev); + switch (mask) { case IIO_CHAN_INFO_SAMP_FREQ: *vals = (const int *)kx022a_accel_samp_freq_table; @@ -421,9 +423,8 @@ static int kx022a_read_avail(struct iio_dev *indio_dev, *type = IIO_VAL_INT_PLUS_MICRO; return IIO_AVAIL_LIST; case IIO_CHAN_INFO_SCALE: - *vals = (const int *)kx022a_scale_table; - *length = ARRAY_SIZE(kx022a_scale_table) * - ARRAY_SIZE(kx022a_scale_table[0]); + *vals = (const int *)data->chip_info->scale_table; + *length = data->chip_info->scale_table_size; *type = IIO_VAL_INT_PLUS_NANO; return IIO_AVAIL_LIST; default: @@ -439,14 +440,14 @@ static void kx022a_reg2freq(unsigned int val, int *val1, int *val2) *val2 = kx022a_accel_samp_freq_table[val & KX022A_MASK_ODR][1]; } -static void kx022a_reg2scale(unsigned int val, unsigned int *val1, - unsigned int *val2) +static void kx022a_reg2scale(struct kx022a_data *data, unsigned int val, + unsigned int *val1, unsigned int *val2) { val &= KX022A_MASK_GSEL; val >>= KX022A_GSEL_SHIFT; - *val1 = kx022a_scale_table[val][0]; - *val2 = kx022a_scale_table[val][1]; + *val1 = data->chip_info->scale_table[val][0]; + *val2 = data->chip_info->scale_table[val][1]; } static int __kx022a_turn_on_off(struct kx022a_data *data, bool on) @@ -544,11 +545,11 @@ static int kx022a_write_raw(struct iio_dev *idev, kx022a_turn_on_unlock(data); break; case IIO_CHAN_INFO_SCALE: - n = ARRAY_SIZE(kx022a_scale_table); + n = data->chip_info->scale_table_size / 2; while (n-- > 0) - if (val == kx022a_scale_table[n][0] && - val2 == kx022a_scale_table[n][1]) + if (val == data->chip_info->scale_table[n][0] && + val2 == data->chip_info->scale_table[n][1]) break; if (n < 0) { ret = -EINVAL; @@ -643,7 +644,7 @@ static int kx022a_read_raw(struct iio_dev *idev, if (ret < 0) return ret; - kx022a_reg2scale(regval, val, val2); + kx022a_reg2scale(data, regval, val, val2); return IIO_VAL_INT_PLUS_NANO; } @@ -1148,6 +1149,9 @@ const struct kx022a_chip_info kx022a_chip_info = { .regmap_config = &kx022a_regmap_config, .channels = kx022a_channels, .num_channels = ARRAY_SIZE(kx022a_channels), + .scale_table = kx022a_scale_table, + .scale_table_size = ARRAY_SIZE(kx022a_scale_table) * + ARRAY_SIZE(kx022a_scale_table[0]), .fifo_length = KX022A_FIFO_LENGTH, .who = KX022A_REG_WHO, .id = KX022A_ID, @@ -1173,6 +1177,9 @@ const struct kx022a_chip_info kx132_chip_info = { .regmap_config = &kx132_regmap_config, .channels = kx132_channels, .num_channels = ARRAY_SIZE(kx132_channels), + .scale_table = kx022a_scale_table, + .scale_table_size = ARRAY_SIZE(kx022a_scale_table) * + ARRAY_SIZE(kx022a_scale_table[0]), .fifo_length = KX132_FIFO_LENGTH, .who = KX132_REG_WHO, .id = KX132_ID, @@ -1206,6 +1213,9 @@ const struct kx022a_chip_info kx132acr_chip_info = { .regmap_config = &kx022a_regmap_config, .channels = kx022a_channels, .num_channels = ARRAY_SIZE(kx022a_channels), + .scale_table = kx022a_scale_table, + .scale_table_size = ARRAY_SIZE(kx022a_scale_table) * + ARRAY_SIZE(kx022a_scale_table[0]), .fifo_length = KX022A_FIFO_LENGTH, .who = KX022A_REG_WHO, .id = KX132ACR_LBZ_ID, diff --git a/drivers/iio/accel/kionix-kx022a.h b/drivers/iio/accel/kionix-kx022a.h index 7060438ad88c..36e9d9de8c13 100644 --- a/drivers/iio/accel/kionix-kx022a.h +++ b/drivers/iio/accel/kionix-kx022a.h @@ -161,6 +161,8 @@ struct kx022a_data; struct kx022a_chip_info { const char *name; const struct regmap_config *regmap_config; + const int (*scale_table)[2]; + const int scale_table_size; const struct iio_chan_spec *channels; unsigned int num_channels; unsigned int fifo_length; From patchwork Thu Nov 21 08:20:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13881748 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 56D8A1CACE8; Thu, 21 Nov 2024 08:21:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177266; cv=none; b=lIl+YvhfQBXHnCZG1/he1klrRXtXoZqkFEV7WqACWXN17NytILKbBJxvRgY5y1qvNJ1F6H3IimNFYJaRF+NjaVVhI3Ho6J198fFn54cONuo9J/N5rEVPiH96QWDEC5CSR6uMYpyZM1L6ghmjN7pZ6BcLdmO8B4mLMvOK2bLqdWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177266; c=relaxed/simple; bh=YXH017JA7rXf3Ha7fPn0GQ2Azhq4k8FSj95fLOD9lz0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MpeQ7Z038PzUlM8M0CuCzcCqGCjjpUef7gGXPJiooWyOiKvqG2F4bMxnht/7fOVIYYpk89EVldq4+DuO3FnJQriqilVjkLcMpDno/7bDtUai87SiVd/YmTC+GVRMBarkdZFPTWqyE2XUOTK//PiDaaAA+WW2Ta8f0NsbLCF/C+0= 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=l2m0vZQF; arc=none smtp.client-ip=209.85.208.182 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="l2m0vZQF" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2fb49510250so6925281fa.0; Thu, 21 Nov 2024 00:21:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732177262; x=1732782062; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MjTBJQdW/deFc59xWASUDW+0/Ls2P158bu8ZfEU7/Rc=; b=l2m0vZQFWXcOQ5u36wr2CnlxnY2Wxv1ID9wos8/al4+X3l274dNKayc+uPAcvKilt6 MUv+qcaq6NGL9fY9D4odZ3XYPDJYCN6DopAH07F/izV4hZS75jOpQHutUTYo2yJqLkro 97dRyeAhVNPsmI37IgC0pudmbYXwU2UztefKUJMFbMyB/srQNtZukU9CqT3pn2T3T6c5 6geGxSy6JpjeOpq8YBYQj+dRLhAmILTsZNJKAZ9ZFswv7z19QQ4egTxBsD7TiIUdIXJT CPhuUIzmyMIXcw8Qppg2PdFt48coI/SVnhN6Sj32H7G87TC4QudcINadluycpiDtgY6D mosw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732177262; x=1732782062; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MjTBJQdW/deFc59xWASUDW+0/Ls2P158bu8ZfEU7/Rc=; b=ZqtsxPouXHGAUCByZryVEZmmdAy1d4Gv209c/pM5vDtCAzmU6PgeQJllPi2NVWbYq+ ayS/4fJd3YRJ+OyGCThwpHqmEqVCxjKGHKREP64CWvb4MvsYOOBSRGmS+2Pl/WC07pLU GgoV5WzO/YoHufFkrdbxL6p0mjsAAI2PztVTQOiM7PzPgCmqcS4vTIsPPFSYP1SQUx8r lVeVvzbD/AddLUyravcvxZEs4WQNbecyH3lO592bYMOxruymhJT0v7p3vGKRdYodrs5C cxOSTUB0+KtH3EHxn719POtNBOgQJft1dcja6esuEamB4098AW2oK4mywQehD6oQydJJ 8DIg== X-Forwarded-Encrypted: i=1; AJvYcCVFkkgspKccXPY+9qZpS4GfmwWvp1vRS0A7v1KzynH6HE+J9gE8Hx+GatONmhHxAiNM32dj/Oypurdd@vger.kernel.org, AJvYcCWCze3Z9o/ZMLxIDsszIXzz0AC/GI+M0UxwQIBlKsui++AiqJacZQPyBZJfbeqVYiVXdoo1thoF/7IHkCVB@vger.kernel.org, AJvYcCWlaPBZJhcaXl64efoKbor8X53GdUBZh+EzneeFXiynEttXYojgQwYEMjSnuKByGxR0NiPqmYwQ+Wj2@vger.kernel.org X-Gm-Message-State: AOJu0YxVyQ7HjHlyWFvja+7FjLHdjxlVoZKIaKa8SQUkrWB85mTUqskw M8wGy270MgR9vHlidajdHGVDYxu1kF7i6MoMbY/1IjgJGUPKaWNe X-Google-Smtp-Source: AGHT+IHIeZelgBKhIrZrbl/c+jDtLkhO0KDO2uuyEqqBjg8KZi6cq7elkK/970+OAKKq/9kCLQq8JQ== X-Received: by 2002:a2e:bd84:0:b0:2fb:955e:5c17 with SMTP id 38308e7fff4ca-2ff8dd01cc1mr37322001fa.40.1732177262376; Thu, 21 Nov 2024 00:21:02 -0800 (PST) Received: from mva-rohm ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ff698515basm18120171fa.23.2024.11.21.00.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 00:21:01 -0800 (PST) Date: Thu, 21 Nov 2024 10:20:56 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/8] dt-bindings: ROHM KX134ACR-LBZ Message-ID: References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: From the software point of view, the KX134ACR-LBZ is almost identical to the KX132ACR-LBZ. They, however, have different g ranges and ID register values which makes them incompatible. Add compatible and information for ROHM KX134ACR-LBZ accelerometer. Signed-off-by: Matti Vaittinen Acked-by: Conor Dooley --- Revision history: v1 => v2: - Improve commit message by explaining why compatible is needed. - patch number changed because a change was added to the series. - rebased on iio/testing to avoid conflicts with queued fixes --- .../devicetree/bindings/iio/accel/kionix,kx022a.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/iio/accel/kionix,kx022a.yaml b/Documentation/devicetree/bindings/iio/accel/kionix,kx022a.yaml index 66ea894dbe55..c973f4941a6d 100644 --- a/Documentation/devicetree/bindings/iio/accel/kionix,kx022a.yaml +++ b/Documentation/devicetree/bindings/iio/accel/kionix,kx022a.yaml @@ -11,7 +11,8 @@ maintainers: description: | KX022A, KX132ACR-LBZ and KX132-1211 are 3-axis accelerometers supporting - +/- 2G, 4G, 8G and 16G ranges, variable output data-rates and a + +/- 2G, 4G, 8G and 16G ranges. The KX134ACR-LBZ supports +/- 8G, 16G, + 32G and 64G. All the sensors also have variable output data-rates and a hardware-fifo buffering. These accelerometers can be accessed either via I2C or SPI. @@ -21,6 +22,7 @@ properties: - kionix,kx022a - kionix,kx132-1211 - rohm,kx132acr-lbz + - rohm,kx134acr-lbz reg: maxItems: 1 From patchwork Thu Nov 21 08:21:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13881749 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 64CCE1C9EB3; Thu, 21 Nov 2024 08:21:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177284; cv=none; b=Y6DKAZd683jQMvkFSn127flRtSjaSFl3c11hOA5+rDLV2qFJZg7D77P8GdndQGdGQEhPqlaActx1gxnh0tYJVICEDrfHCZg3NKX2RgW4j6gU9mAfrF3+zZHWslCmMrC+ynDWYM5mIvCb5hH+iGvTpg7HAV/RDyENm7lGXXwWb1s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177284; c=relaxed/simple; bh=QyrEhCXNAhpBOqwFALJpqV7cpP14N52tdA96aUoxEC8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oqasPZfGZiQVNGt1JWaX8QaHQaTbLgEzRFN8Rc5p/koNtHkLZZ9hFfDSMDDyuVW3PilS5sF0KpRCF3x4UPJe36O/as21GRSyE2ICfj/ysWIkajd+IkKm1DK9DVZvBS5KDSF18sr4WHBBbFquqdSS6PS6M6RrwKnMP5JYIPyibxE= 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=PJZsfm7r; arc=none smtp.client-ip=209.85.208.179 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PJZsfm7r" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2fb3c3d5513so6639181fa.1; Thu, 21 Nov 2024 00:21:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732177280; x=1732782080; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ac6DcT7m+XqERQTxslNvsybc6SvgcEDlo0rPf5G7rM4=; b=PJZsfm7rwOthaTFmou+8FV5OkLqruk+fnZqBfDlS/Lagt4AIJBsHuk7PeKxLBQvcg9 lOcb0bEmY0633GIU6M/djtPVkgGbusnnLFMvYXhLCd5tkYUySoe9Fyahh5xHQT79U5A4 oi6YeCOP75Cs+19AlO8goGGbM7YMFlwdnWIfhoaj0grWdEaB4xOKrBiVXDtJclw1sYTe dSXjMVEs9vKHEdiFw4uNiBkRdQ4GaXGXmIn4hOApnBrKmqBMaCx4tTfv3fpm/i3oapXW DVr2n32R5p92OLsiEIhewWkmzz4D5eryTKLHd4v7vvXmfTUW7xmPT9slbmfmNY9xL68p CEzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732177280; x=1732782080; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ac6DcT7m+XqERQTxslNvsybc6SvgcEDlo0rPf5G7rM4=; b=kMeU2DpyeFDUTRGX4aeQGeTa21z4PUF8AJilVxqfYnCPh7jCIlOOz2LMgerHcEp8FV Xk0AkytaUjF8OkyU5Mt1VSvJCSnAzEW91194pCAfQxsK1Sa7DDP8oDfSSUIdb9Omku19 3AIX/taPXX8PLx7yZPJjFd9gTGwH8aYj/yKZiG9OTAFYGBFl2oPK86ThfmvjAMGiZ8td q4xdiEhV4GXuTLxbLl422IRYp6Mvw1onDdJx/ijQ+4PegT+KCids17+SGrBevxuX0pGc o12sWTdNitZTVxaNUJDeg5P1KzAbhatWhYtI4hLRr8FZc1zN/aSqJa0S0wHgF7eGihvZ x24A== X-Forwarded-Encrypted: i=1; AJvYcCUJtHZI9EeZZOOnXefLnA6krDaq7MsfHF+wNyjWDDjA5IknSLx4hmx08Ps4QR2UXi6ySmq3TUwiwonS@vger.kernel.org, AJvYcCV6LSE8CPibucu4JacIEUWaTWSe7ziBNsws45BQDby+OZG3C6AhtrqId4ba5PWrcBPHmICoO0sbCzLnxHO0@vger.kernel.org, AJvYcCWzAkirZ9f3X/TPZlP0xDMsKfR2UV4h4I7A7EJseTVoDnKACL5Vx3UqRwBjUJNDnWGt79iobUZ8qIoI@vger.kernel.org X-Gm-Message-State: AOJu0YxtOvWZeULQxf0R0HgoKDE5k3Owm022v8iB50hVJK3uko3WuOTY TJFsd4ppPsC2PfNrT+dXASsrcs9Ymxxa4lyjHLnylCnHhweUgg5X X-Google-Smtp-Source: AGHT+IFpTRtafYfo+W4m9opflshPgglG4mD7WloZ6X8pHAWv94FP85Jd9cKM6AWAj44y7zQ2ZlXuGA== X-Received: by 2002:a2e:bc03:0:b0:2ff:55a0:91ff with SMTP id 38308e7fff4ca-2ff8db0e497mr26811131fa.3.1732177280238; Thu, 21 Nov 2024 00:21:20 -0800 (PST) Received: from mva-rohm ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ff69ae80d2sm18682291fa.79.2024.11.21.00.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 00:21:19 -0800 (PST) Date: Thu, 21 Nov 2024 10:21:14 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 6/8] iio: kx022a: Support ROHM KX134ACR-LBZ Message-ID: References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The register interface of the ROHM KX134ACR-LBZ accelerometer is almost identical to the KX132ACR-LBZ. The main difference between these accelerometers is that the KX134ACR-LBZ supports different G-ranges. The driver can model this by informing different scale to users. Also, the content of the "who_am_I" register is different. Add an ID and scales for the KX134ACR-LBZ. Signed-off-by: Matti Vaittinen --- Revision history: v1 => v2:. - patch number changed because a change was added to the series. - rebased on iio/testing to avoid conflicts with queued fixes --- drivers/iio/accel/kionix-kx022a-i2c.c | 2 ++ drivers/iio/accel/kionix-kx022a-spi.c | 2 ++ drivers/iio/accel/kionix-kx022a.c | 36 +++++++++++++++++++++++++++ drivers/iio/accel/kionix-kx022a.h | 2 ++ 4 files changed, 42 insertions(+) diff --git a/drivers/iio/accel/kionix-kx022a-i2c.c b/drivers/iio/accel/kionix-kx022a-i2c.c index 8a1d4fc28ddd..9fd049c2b62e 100644 --- a/drivers/iio/accel/kionix-kx022a-i2c.c +++ b/drivers/iio/accel/kionix-kx022a-i2c.c @@ -39,6 +39,7 @@ static const struct i2c_device_id kx022a_i2c_id[] = { { .name = "kx022a", .driver_data = (kernel_ulong_t)&kx022a_chip_info }, { .name = "kx132-1211", .driver_data = (kernel_ulong_t)&kx132_chip_info }, { .name = "kx132acr-lbz", .driver_data = (kernel_ulong_t)&kx132acr_chip_info }, + { .name = "kx134acr-lbz", .driver_data = (kernel_ulong_t)&kx134acr_chip_info }, { } }; MODULE_DEVICE_TABLE(i2c, kx022a_i2c_id); @@ -47,6 +48,7 @@ static const struct of_device_id kx022a_of_match[] = { { .compatible = "kionix,kx022a", .data = &kx022a_chip_info }, { .compatible = "kionix,kx132-1211", .data = &kx132_chip_info }, { .compatible = "rohm,kx132acr-lbz", .data = &kx132acr_chip_info }, + { .compatible = "rohm,kx134acr-lbz", .data = &kx134acr_chip_info }, { } }; MODULE_DEVICE_TABLE(of, kx022a_of_match); diff --git a/drivers/iio/accel/kionix-kx022a-spi.c b/drivers/iio/accel/kionix-kx022a-spi.c index f798b964d0b5..b20978afc565 100644 --- a/drivers/iio/accel/kionix-kx022a-spi.c +++ b/drivers/iio/accel/kionix-kx022a-spi.c @@ -39,6 +39,7 @@ static const struct spi_device_id kx022a_id[] = { { .name = "kx022a", .driver_data = (kernel_ulong_t)&kx022a_chip_info }, { .name = "kx132-1211", .driver_data = (kernel_ulong_t)&kx132_chip_info }, { .name = "kx132acr-lbz", .driver_data = (kernel_ulong_t)&kx132acr_chip_info }, + { .name = "kx134acr-lbz", .driver_data = (kernel_ulong_t)&kx134acr_chip_info }, { } }; MODULE_DEVICE_TABLE(spi, kx022a_id); @@ -47,6 +48,7 @@ static const struct of_device_id kx022a_of_match[] = { { .compatible = "kionix,kx022a", .data = &kx022a_chip_info }, { .compatible = "kionix,kx132-1211", .data = &kx132_chip_info }, { .compatible = "rohm,kx132acr-lbz", .data = &kx132acr_chip_info }, + { .compatible = "rohm,kx134acr-lbz", .data = &kx134acr_chip_info }, { } }; MODULE_DEVICE_TABLE(of, kx022a_of_match); diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c index b23a27623a46..9fe16802c125 100644 --- a/drivers/iio/accel/kionix-kx022a.c +++ b/drivers/iio/accel/kionix-kx022a.c @@ -408,6 +408,14 @@ static const int kx022a_scale_table[][2] = { { 0, 4788403 }, }; +/* KX134ACR-LBZ ranges are (+/-) 8, 16, 32, 64 G */ +static const int kx134acr_lbz_scale_table[][2] = { + { 0, 2394202 }, + { 0, 4788403 }, + { 0, 9576807 }, + { 0, 19153613 }, +}; + static int kx022a_read_avail(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, const int **vals, int *type, int *length, @@ -1236,6 +1244,34 @@ const struct kx022a_chip_info kx132acr_chip_info = { }; EXPORT_SYMBOL_NS_GPL(kx132acr_chip_info, IIO_KX022A); +const struct kx022a_chip_info kx134acr_chip_info = { + .name = "kx134acr-lbz", + .regmap_config = &kx022a_regmap_config, + .channels = kx022a_channels, + .num_channels = ARRAY_SIZE(kx022a_channels), + .scale_table = kx134acr_lbz_scale_table, + .scale_table_size = ARRAY_SIZE(kx134acr_lbz_scale_table) * + ARRAY_SIZE(kx134acr_lbz_scale_table[0]), + .fifo_length = KX022A_FIFO_LENGTH, + .who = KX022A_REG_WHO, + .id = KX134ACR_LBZ_ID, + .cntl = KX022A_REG_CNTL, + .cntl2 = KX022A_REG_CNTL2, + .odcntl = KX022A_REG_ODCNTL, + .buf_cntl1 = KX022A_REG_BUF_CNTL1, + .buf_cntl2 = KX022A_REG_BUF_CNTL2, + .buf_clear = KX022A_REG_BUF_CLEAR, + .buf_status1 = KX022A_REG_BUF_STATUS_1, + .buf_read = KX022A_REG_BUF_READ, + .inc1 = KX022A_REG_INC1, + .inc4 = KX022A_REG_INC4, + .inc5 = KX022A_REG_INC5, + .inc6 = KX022A_REG_INC6, + .xout_l = KX022A_REG_XOUT_L, + .get_fifo_bytes_available = kx022a_get_fifo_bytes_available, +}; +EXPORT_SYMBOL_NS_GPL(kx134acr_chip_info, IIO_KX022A); + int kx022a_probe_internal(struct device *dev, const struct kx022a_chip_info *chip_info) { static const char * const regulator_names[] = {"io-vdd", "vdd"}; diff --git a/drivers/iio/accel/kionix-kx022a.h b/drivers/iio/accel/kionix-kx022a.h index 36e9d9de8c13..ea32fd252a38 100644 --- a/drivers/iio/accel/kionix-kx022a.h +++ b/drivers/iio/accel/kionix-kx022a.h @@ -14,6 +14,7 @@ #define KX022A_REG_WHO 0x0f #define KX022A_ID 0xc8 #define KX132ACR_LBZ_ID 0xd8 +#define KX134ACR_LBZ_ID 0xcc #define KX022A_REG_CNTL2 0x19 #define KX022A_MASK_SRST BIT(7) @@ -190,5 +191,6 @@ int kx022a_probe_internal(struct device *dev, const struct kx022a_chip_info *chi extern const struct kx022a_chip_info kx022a_chip_info; extern const struct kx022a_chip_info kx132_chip_info; extern const struct kx022a_chip_info kx132acr_chip_info; +extern const struct kx022a_chip_info kx134acr_chip_info; #endif From patchwork Thu Nov 21 08:21:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13881750 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 3054B4502F; Thu, 21 Nov 2024 08:21:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177302; cv=none; b=MchfSTRqNCGi01qoH5HUfGsLc8SfnhiG4VjIBNZEjVeF4YWHYjDzmTvWr+sWJSiEnDu0U7EthG9Jka/sI5nhRwLa92nWOJXAixd2UEKic+zKH2ChFPUAhsIGKRKSksrfncSX9xu1ZI9PjUSdSp5XvwFYeOULipbrqV1eA7IJing= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177302; c=relaxed/simple; bh=eBuaFTPsyQJykGH0VszjvZETRY6TC4PFlE95VjKRQc4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aZRgHisRj6R7XPr3sKsUMLwiyf1q6aFVQHw/A6qPKc9YQA+VIG9AkoamnO6SJ4nrrrWCibVTjgVG6mRtKRWJBZwmSUL7lV3pP9eCcqRjGxCuHEgfq7J4++MOtfwL1MssYFH9dPYD4Ul2EVVz+C/axkNu7g+gwIkxlT6YHYrg+tM= 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=UL99SWv0; arc=none smtp.client-ip=209.85.167.41 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UL99SWv0" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-53a007743e7so619978e87.1; Thu, 21 Nov 2024 00:21:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732177297; x=1732782097; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=uxsH47pyuzzcy8deLj7BAaJCTtPX0VhoHVXiRse14mM=; b=UL99SWv0vjDNY8qZmJFYdTpxuQoKtQpie+wfOnwe3F+EdbQuRRO5nrOt001/8hsFwU UWD6bHA4sGikfFHqyJeforYlx3XaGKf/py66LRiTtlCDq7ywAysv2dmSOToe9snGlUEI 3Ep67/IUJO9Ri0nL75p015RWn/6cSd1MKoyZFdPcCVdsIaAB8Gtf9dbuWy0CW/i2LrAm Aem7z1fQLZk7Hv3R6M5u94pGKv2Z8f6fMScZYWvVfFaTgbPMgt/fLhYSQKE7OtkU/Ey2 CkL0BnMMfofdBfkUgeNd5UZ+Bs+4RY7Vu8KteUgJ6GXWArqRiTkF6FvkfhruGjgmboXA AG+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732177297; x=1732782097; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uxsH47pyuzzcy8deLj7BAaJCTtPX0VhoHVXiRse14mM=; b=haadKNFEv0sBf5U2Yq0UqIhpXKo4CySMzJGFsL1ic8YN4xDPbt7apfCJYawtbpQMNt M2coOUG1fQHcZcjqWbMDQQLsH8qec8zb0MTE3NFfSg6WxHC6S/WNKM4WgF/vghFUPRpR alB94y1oKPwQpUKS0uLp86sG+Lh4ryXfN6/Xk06/qmwbTZUX5JDzh4iU0TX9mFTruF2i aUWizqocm3jOBv9Xq/Fu6ibrZxrc4EgFzpIQgkJpzpi1MG/CEKRjzkXZCQEPAzkp6YWJ JHoXzFT5KZzxjGfPiM4+HcsQDT06ZpmHQVh3V7gLLo56ZuxkQyxKYJBgt3pG8S3l5HMF ZAhw== X-Forwarded-Encrypted: i=1; AJvYcCVUZysWFfC210+/iEZTQYludchm9YqK6DaA62bmuOmewY6LIYF/40mNkW+ghFHjloD2jClbHUl4FQCK@vger.kernel.org, AJvYcCWchrBNn6A4lkDoaxfvSvMkXPAkg4nIj8j6X8tsUde446Es510hvJvFzi+YrZpZu1vuRZk7YwpYFgRGthdx@vger.kernel.org, AJvYcCXYPlf2bW5vJQaNWjxyP9hgujEnQk13a6eWjbxprD2KxUjTZBizQR+uQtg94plDZwdnq2PFBdFBRx8M@vger.kernel.org X-Gm-Message-State: AOJu0YyiNRIrVOx3MWvbltlhaBTjqZzP92L9WqtoQV6YSrzuRpy1iAhG 9/YvN2YZjqRgDAg9ofCstsJESG4N0lFWTCAEqLV0DqP89yGu0WZA X-Google-Smtp-Source: AGHT+IHfknFjd3pbOWmUjS/Ujetybo/zVW7dEoFRdakdwkdNaqeIXqb2fVL9Umt77JLVCIZmNIXCFg== X-Received: by 2002:a05:6512:118c:b0:539:f1ce:5fa8 with SMTP id 2adb3069b0e04-53dc136debcmr2522795e87.49.1732177297087; Thu, 21 Nov 2024 00:21:37 -0800 (PST) Received: from mva-rohm ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dbd478053sm892541e87.230.2024.11.21.00.21.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 00:21:36 -0800 (PST) Date: Thu, 21 Nov 2024 10:21:30 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 7/8] dt-bindings: iio: kx022a: Support KX134-1211 Message-ID: <8d0ae2f58678f4daf2e24c8f4a8419cd5d225db8.1732105157.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The ROHM KX134-1211 is very similar to KX132-1211. The main difference is supported g-ranges. The KX132-1211 can measure ranges from +/- 2g to +/-16g where the KX134-1211 supports measuring ranges +/- 8g to +/- 64g. Support the ROHM KX134-1211. Signed-off-by: Matti Vaittinen Acked-by: Conor Dooley --- Revision history: v1 => v2: - new patch --- .../devicetree/bindings/iio/accel/kionix,kx022a.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/accel/kionix,kx022a.yaml b/Documentation/devicetree/bindings/iio/accel/kionix,kx022a.yaml index c973f4941a6d..f07c70e51c45 100644 --- a/Documentation/devicetree/bindings/iio/accel/kionix,kx022a.yaml +++ b/Documentation/devicetree/bindings/iio/accel/kionix,kx022a.yaml @@ -4,23 +4,24 @@ $id: http://devicetree.org/schemas/iio/accel/kionix,kx022a.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: ROHM/Kionix KX022A, KX132-1211 and KX132ACR-LBZ Accelerometers +title: ROHM/Kionix KX022A, KX132/134-1211 and KX132/134ACR-LBZ Accelerometers maintainers: - Matti Vaittinen description: | KX022A, KX132ACR-LBZ and KX132-1211 are 3-axis accelerometers supporting - +/- 2G, 4G, 8G and 16G ranges. The KX134ACR-LBZ supports +/- 8G, 16G, - 32G and 64G. All the sensors also have variable output data-rates and a - hardware-fifo buffering. These accelerometers can be accessed either - via I2C or SPI. + +/- 2G, 4G, 8G and 16G ranges. The KX134ACR-LBZ and KX134-1211 support + +/- 8G, 16G, 32G and 64G. All the sensors also have variable output + data-rates and a hardware-fifo buffering. These accelerometers can be + accessed either via I2C or SPI. properties: compatible: enum: - kionix,kx022a - kionix,kx132-1211 + - kionix,kx134-1211 - rohm,kx132acr-lbz - rohm,kx134acr-lbz From patchwork Thu Nov 21 08:21:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13881751 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (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 B92011CB33F; Thu, 21 Nov 2024 08:21:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177317; cv=none; b=vBcn+U9xKyVhC0wqT56xtqEkZwL6b7/UMSWf+8hppv9yXx4Fa4nH2K/7h2S+RSo9IBPVXosaZg+ObbZpyr75K6ZwKWoSSnT+9BH+K4fV4+lH+vsbYgVMLn2bdpJP5BUZCi7vtQaTGxM2E7OmG/3vSWLFHsFMRySNOdcp2WtjLJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732177317; c=relaxed/simple; bh=dGN2Nm+0BkDArBThjkDHlNygFnYu8lKpAr+UO7Am8CM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SIQj34yhfLBX+Zanc/1F+4+OePUIEg2XtvEgblg3Ubj9XjrSU1pRm0bJVv4A0gmB1TgTVtJSidGcC6P1kxS3poYrCRcl8eJH2ATVNG4wSCmuNezdZLnIg3NqOYotiv7M5DKu2rhiOzec9lAh/lZTuyKNxIG7BhMOPUmu5yVKCf4= 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=K8kDCojT; arc=none smtp.client-ip=209.85.208.180 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K8kDCojT" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2ff550d37a6so7600711fa.0; Thu, 21 Nov 2024 00:21:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732177313; x=1732782113; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Jn43AcFqNBvQ9O6y3AMVs8AexQzeuQlFzw2cpuwp37E=; b=K8kDCojTI8ltoQHovc3C5D6FElnHhbNe6udGcds7assdgGLAstNhQTZ5shrxl3GOcg 5YPRBsUKH8pw9KfLzGjgxGxLtaXmh4RVRIcwcLEGeVYUofIanbvJ/eib59rJTnV98w/S A7VU4xMbAK4dKj9EecjD2CqG6Hnytob0uJwNE0Tjlkv/8Jo9hSM2sjUcBOyxVTrU00fO Lq7fAo7MRWye7NXAuPogV22APTUs5M31zr+Y29lkAbVSvywKOcjC0UhPGn2JfRAS7CT9 AS41j/uPbrTtFqnkdtpBJMycLvPwK85/vnZNkZRKlgzcGzb/LLDk9UQfR9dShE2rC8A7 QMug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732177313; x=1732782113; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Jn43AcFqNBvQ9O6y3AMVs8AexQzeuQlFzw2cpuwp37E=; b=cfHOBxgucxATGmwH70t06QGDPxZa5qbfsVy+Yd82CNqQ8QalY3Ae7A2mSF2vOWmAc0 J7jUeizOHvikcvw8DNsd458ASJobJFYWas+q4Hn4U83BSR6eEpyuVtlxM9TJwfLfICuE aW0lS95RiGQ4lmjXBhS89dkz4c+qCSTxvKQUYMNmdR3sNCztObWQHM2U+ZsG0/cb76Ce CwkzkIxXtODpdi+Dm249ThrxKt/PFzo8NwPgDWkJaM0dQMaiZewTxkTR3J9+05JElWLs 6t35SmlHY+et+rZ7bRj3ihfZ5UUfkEjRyQ/vEILS8VVDOVl3F5qVaZ6bjs32G9VWanD0 pG8g== X-Forwarded-Encrypted: i=1; AJvYcCV+3SoBmhJtOfisZE9Ta6D8WDCCS7C1TEa7VUkXrBlsNwPvhAXXXlOZZEFDx23TseHdexbo7HtDndxVki6K@vger.kernel.org, AJvYcCW1DoNcbkiAfacUsH3AaQ4YBYKF+7oYeAI0RYys2DcdAb4ZHb3MZPjQLnEIfNaeEaZEbB01hBGH0HAj@vger.kernel.org, AJvYcCXHhVXjsX8WBI1mVeL1dIsczUJZyogpmbDelKcwWuMftPvultuU8zTP91134iJkQzMvKahZZyTZ4xp5@vger.kernel.org X-Gm-Message-State: AOJu0YxAhr7advbb1aup0PNqm5KuTeSOWUM8m/ueN/nEVfT+XOTgIS1k TDtWXPnBqMsRcDofx93ZX7HRcwFLjZLJVZO1oU5P79HWqw2yvqIc X-Gm-Gg: ASbGncv/O/+aTex9zCHh8ZVGxTQguV500mimGvtLABfm9zj+bRzRnjpiutzqsd0ZVHG Bx/7vMuzx+JFN5A/xlELV9AqzTMoLunumeEhNdjkvG0zMPP5PpiLkNLQtDaZ1gRa6kBps9sERBb ocuDiqyFAqE8LheP7SE33EqWNI/Q7+ZI8CQ+cCV1QCIq5Pijv64ZQNqJDwUCprujpyl0n1IscYE VnTm7nNf5uRCqVYA3OFKtw9E5M7G7589/ki4QXpsi6oLXnTKyrG X-Google-Smtp-Source: AGHT+IG8q8e6bzQ90TXu7yt52oGt8qHW6ZY1jHaXuiCoCg9dksvHwao03XMcXo0Ja6yigUjZfcY4ng== X-Received: by 2002:a05:651c:12c4:b0:2fb:607b:4cde with SMTP id 38308e7fff4ca-2ff8dcd2f96mr28224791fa.39.1732177312557; Thu, 21 Nov 2024 00:21:52 -0800 (PST) Received: from mva-rohm ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ff69851577sm17891751fa.9.2024.11.21.00.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 00:21:51 -0800 (PST) Date: Thu, 21 Nov 2024 10:21:46 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 8/8] iio: accel: kx022a: Support KX134-1211 Message-ID: <833f2f066e12021bfbca25d84f9c4673b902a8bc.1732105157.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The ROHM KX134-1211 has very similar register interface as KX132-1211 does. The main differencies are the content of the "Who am I" identification register and different g-ranges. The KX132-1211 can measure ranges from +/- 2g to +/-16g where the KX134-1211 supports measuring ranges +/- 8g to +/- 64g. Support the ROHM KX134-1211. Signed-off-by: Matti Vaittinen --- Revision history: v1 => v2: - new patch --- drivers/iio/accel/kionix-kx022a-i2c.c | 2 ++ drivers/iio/accel/kionix-kx022a-spi.c | 2 ++ drivers/iio/accel/kionix-kx022a.c | 30 +++++++++++++++++++++++++++ drivers/iio/accel/kionix-kx022a.h | 2 ++ 4 files changed, 36 insertions(+) diff --git a/drivers/iio/accel/kionix-kx022a-i2c.c b/drivers/iio/accel/kionix-kx022a-i2c.c index 9fd049c2b62e..7359073ae0c0 100644 --- a/drivers/iio/accel/kionix-kx022a-i2c.c +++ b/drivers/iio/accel/kionix-kx022a-i2c.c @@ -38,6 +38,7 @@ static int kx022a_i2c_probe(struct i2c_client *i2c) static const struct i2c_device_id kx022a_i2c_id[] = { { .name = "kx022a", .driver_data = (kernel_ulong_t)&kx022a_chip_info }, { .name = "kx132-1211", .driver_data = (kernel_ulong_t)&kx132_chip_info }, + { .name = "kx134-1211", .driver_data = (kernel_ulong_t)&kx134_chip_info }, { .name = "kx132acr-lbz", .driver_data = (kernel_ulong_t)&kx132acr_chip_info }, { .name = "kx134acr-lbz", .driver_data = (kernel_ulong_t)&kx134acr_chip_info }, { } @@ -47,6 +48,7 @@ MODULE_DEVICE_TABLE(i2c, kx022a_i2c_id); static const struct of_device_id kx022a_of_match[] = { { .compatible = "kionix,kx022a", .data = &kx022a_chip_info }, { .compatible = "kionix,kx132-1211", .data = &kx132_chip_info }, + { .compatible = "kionix,kx134-1211", .data = &kx134_chip_info }, { .compatible = "rohm,kx132acr-lbz", .data = &kx132acr_chip_info }, { .compatible = "rohm,kx134acr-lbz", .data = &kx134acr_chip_info }, { } diff --git a/drivers/iio/accel/kionix-kx022a-spi.c b/drivers/iio/accel/kionix-kx022a-spi.c index b20978afc565..50aeaafc56ec 100644 --- a/drivers/iio/accel/kionix-kx022a-spi.c +++ b/drivers/iio/accel/kionix-kx022a-spi.c @@ -38,6 +38,7 @@ static int kx022a_spi_probe(struct spi_device *spi) static const struct spi_device_id kx022a_id[] = { { .name = "kx022a", .driver_data = (kernel_ulong_t)&kx022a_chip_info }, { .name = "kx132-1211", .driver_data = (kernel_ulong_t)&kx132_chip_info }, + { .name = "kx134-1211", .driver_data = (kernel_ulong_t)&kx134_chip_info }, { .name = "kx132acr-lbz", .driver_data = (kernel_ulong_t)&kx132acr_chip_info }, { .name = "kx134acr-lbz", .driver_data = (kernel_ulong_t)&kx134acr_chip_info }, { } @@ -47,6 +48,7 @@ MODULE_DEVICE_TABLE(spi, kx022a_id); static const struct of_device_id kx022a_of_match[] = { { .compatible = "kionix,kx022a", .data = &kx022a_chip_info }, { .compatible = "kionix,kx132-1211", .data = &kx132_chip_info }, + { .compatible = "kionix,kx134-1211", .data = &kx134_chip_info }, { .compatible = "rohm,kx132acr-lbz", .data = &kx132acr_chip_info }, { .compatible = "rohm,kx134acr-lbz", .data = &kx134acr_chip_info }, { } diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c index 9fe16802c125..e3986dd65337 100644 --- a/drivers/iio/accel/kionix-kx022a.c +++ b/drivers/iio/accel/kionix-kx022a.c @@ -1209,6 +1209,36 @@ const struct kx022a_chip_info kx132_chip_info = { }; EXPORT_SYMBOL_NS_GPL(kx132_chip_info, IIO_KX022A); +const struct kx022a_chip_info kx134_chip_info = { + .name = "kx134-1211", + .regmap_config = &kx132_regmap_config, + .channels = kx132_channels, + .num_channels = ARRAY_SIZE(kx132_channels), + .scale_table = kx134acr_lbz_scale_table, + .scale_table_size = ARRAY_SIZE(kx134acr_lbz_scale_table) * + ARRAY_SIZE(kx134acr_lbz_scale_table[0]), + .fifo_length = KX132_FIFO_LENGTH, + .who = KX132_REG_WHO, + .id = KX134_1211_ID, + .cntl = KX132_REG_CNTL, + .cntl2 = KX132_REG_CNTL2, + .odcntl = KX132_REG_ODCNTL, + .buf_cntl1 = KX132_REG_BUF_CNTL1, + .buf_cntl2 = KX132_REG_BUF_CNTL2, + .buf_clear = KX132_REG_BUF_CLEAR, + .buf_status1 = KX132_REG_BUF_STATUS_1, + .buf_smp_lvl_mask = KX132_MASK_BUF_SMP_LVL, + .buf_read = KX132_REG_BUF_READ, + .inc1 = KX132_REG_INC1, + .inc4 = KX132_REG_INC4, + .inc5 = KX132_REG_INC5, + .inc6 = KX132_REG_INC6, + .xout_l = KX132_REG_XOUT_L, + .get_fifo_bytes_available = kx132_get_fifo_bytes_available, +}; +EXPORT_SYMBOL_NS_GPL(kx134_chip_info, IIO_KX022A); + + /* * Despite the naming, KX132ACR-LBZ is not similar to KX132-1211 but it is * exact subset of KX022A. KX132ACR-LBZ is meant to be used for industrial diff --git a/drivers/iio/accel/kionix-kx022a.h b/drivers/iio/accel/kionix-kx022a.h index ea32fd252a38..142652ff4b22 100644 --- a/drivers/iio/accel/kionix-kx022a.h +++ b/drivers/iio/accel/kionix-kx022a.h @@ -78,6 +78,7 @@ #define KX132_REG_WHO 0x13 #define KX132_ID 0x3d +#define KX134_1211_ID 0x46 #define KX132_FIFO_LENGTH 86 @@ -190,6 +191,7 @@ int kx022a_probe_internal(struct device *dev, const struct kx022a_chip_info *chi extern const struct kx022a_chip_info kx022a_chip_info; extern const struct kx022a_chip_info kx132_chip_info; +extern const struct kx022a_chip_info kx134_chip_info; extern const struct kx022a_chip_info kx132acr_chip_info; extern const struct kx022a_chip_info kx134acr_chip_info;