From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B4BD17B425 for ; Sun, 12 Jul 2026 02:11:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783822271; cv=none; b=G7avEZZEK8K+eK28AhEIMXUsWYXKWQiQYKRHvG5HpIt86RC4Mct82l7LgXjINE6rQlM8xR7BmLSfapeok6y+BJuXoCoMvlBTlqtYD26mu9y03rv7SX/UJVeVDLR7rRfnFiBCaX1deLPf5cEIXbF1Y0bDZJ8alqr1x8GUaRIaySw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783822271; c=relaxed/simple; bh=1r1GbZzZlZfrk+m6SazeIRJ1GWrUC0qiAmiHu1U5UtA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PY7GrnxDocpo1PRhbfs9uYKgIuDSBEAccWXThD/KBvd+abOgKP7G998jbayKaEGIJ0hZVUEY3/Yxw6eoXFnmznfdIg4oyhmVX3R6lgCcxbKty6iyI/ys0ydAbu50ajUey7tKaDvMlSV5cM0utdnJgS2WBHmN1UqiPbzW+Lqp5OQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=W1alN7n1; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Ng8/Ewm1; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="W1alN7n1"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Ng8/Ewm1" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66C0XdCA1169958 for ; Sun, 12 Jul 2026 02:11:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= nXRDhEOOT6Gk7wxRd9wpTs6cwfxluhggpMpIIq7eaNo=; b=W1alN7n16aO974oW n0cBQDcTrFVnJ6e239dWqEw3nvJuDEpS3yPqg+Yux5Zer0m+ZRiNe62GkQd3m0A+ 2jopTMz4TRTyy3GVcls63Z4PVosJDvcfh1szBYqpHsUy85TmhlEr9pAJXL0Qjre1 kepLF/5bA43trh1zBNNq10LSEDuxxG20xIm4PoGJQhjyzscWoCCvcMJRbuHoFCsl cCjF3A9TWCUe1NGofzNdcK8nfwuTqjwXmLiIyK5Y3vpcKxRHNRNwljhJ0StxEigq M2HdMklnzaJycQOu6Jy//i831j/vvvsOdvS8jnuoSC1YR1XlZ7wFyppNouQh2dwn 9hJOeA== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fbe9hj16t-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 12 Jul 2026 02:11:07 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-c88fc985a65so560941a12.2 for ; Sat, 11 Jul 2026 19:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1783822267; x=1784427067; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:organization :references:in-reply-to:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to:content-type; bh=nXRDhEOOT6Gk7wxRd9wpTs6cwfxluhggpMpIIq7eaNo=; b=Ng8/Ewm1Xx+n6xPbSBIlteqOi/LZkRYrd6NseBOmgqM/gfbSk4y/E7uWDlPMAJmfMh x0rF1DdWRAxQheE7Vdv+V/lDH5bBbNm8Yvm1bt5d8ismxJ38D+2z9irgztI92cAa0ilX zVXoOIXwdIwTJn4a7a/6664W+phsfEDrY+L+ow+hhpSYm6I64gLT0OlUBUfHijUVWZr1 b0BISbHiuOxj6mqbSDpszfWMzYQfpsKtEJgxhT4KT5+DLHKZzgkKMI59qGP7T4pW2ASQ UM8gj/788Htjpos/ez+EFpE72phrPgUFYfkZYm3uDPeNnQxIQYybaTEcPTev+6Gpi9/G fOmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783822267; x=1784427067; h=content-transfer-encoding:content-type:mime-version:organization :references:in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=nXRDhEOOT6Gk7wxRd9wpTs6cwfxluhggpMpIIq7eaNo=; b=bLidlyWI90QUHZdz63LEa8t8cXk2Pu/3FNIj0W3V8l27P9EJ7hzqfJBNo2gj8Vkzv+ mksq1+anJQvxQUK0SG4+ApaaHCaUfpzq8iWYEhka7VbpLaYsEsOg7dC15orM107VBLap C51eKaqVa5UfC+PzLGNNKAf5+wIpb99/NjBUN0KmLnywNWuCs59BdKE23sEeeQj5ybH6 Dw04oqVcJWP7gRRsjsE+G5WLdKzbnm586yZ6ckxGFznZ6Dd4LTKnBlqMPukgbhF+kwae 7v/2xNpANr+sbUKm6u6NEdGzZTmlMY7/cQra5yPHWLctmmNIGqDOp5jo5U3AoN2Lm75p iZGw== X-Forwarded-Encrypted: i=1; AHgh+RqUDC9jhukQjIdw5quo1Y7XRECIhI8FR2Xaurq9zy27WxxJdwZfr7CJFsUg2nYpp/CMlz+GM1VHOb+5Jkk=@vger.kernel.org X-Gm-Message-State: AOJu0Yy5TlT0+lmQweNiYOJotjMExeqWWXmp3WoVKrIbC97WU/sbMpRW lIhbyuqnU5JAQcho28UtKGpIhLWrGCQv8Mx5IWlZxBKhv4vWBqhgVwmK0G7fh4nVL4/+Y+YpGtw E7oxKPBtmUAS+6I8S+qJ6GrmgXtH3tpns1taboqFo5PPqV+PELwkzzf22AKWwZladX81XTPFuIM o= X-Gm-Gg: AfdE7cknwMN3AwcpiZ6fwQkiOssJvz96Zsg+7lzljcGR4z0wQtCbP9j6Iv/nxWtsgut d6xNvnsHqFCdBjlyv6wp2KhPGgNgiVyn/mtCOQEu5p4mQRdwRk4iZDTFjsuoUuBeqzqnyCyWL0F g5KCmK+xZojRx6IBu65C+wNzVt6YbVOGnpywFs65kE6G0Q+pQpyVn0qNS07/cFfCfcNJDyT/8Ox 0OXa+/2Nh9m2ymRtWPkY7vNfOCI+h2gkEFX20WeGOI2L+l50yvqB+i9vLUvGyEisv/Pqvny9ala RA+i1yx3p5RyIE0wZegtz1eWVq2B8A2ddwvWeYmWjKXi4sU28OXY99VzUUCF+zxV+Yxz1znnH2c mXA1GxuIo1GCiMLXCJe3n5rUp7HY= X-Received: by 2002:a05:6a20:3d07:b0:3b4:b276:3650 with SMTP id adf61e73a8af0-3c110289537mr6246968637.26.1783822266689; Sat, 11 Jul 2026 19:11:06 -0700 (PDT) X-Received: by 2002:a05:6a20:3d07:b0:3b4:b276:3650 with SMTP id adf61e73a8af0-3c110289537mr6246938637.26.1783822266135; Sat, 11 Jul 2026 19:11:06 -0700 (PDT) Received: from jic23-huawei ([50.35.46.84]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ca5af6e04fcsm6793483a12.4.2026.07.11.19.11.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jul 2026 19:11:05 -0700 (PDT) Date: Sun, 12 Jul 2026 03:11:01 +0100 From: Jonathan Cameron To: Joshua Crofts Cc: Mert Seftali , David Lechner , Nuno =?UTF-8?B?U8Oh?= , Andy Shevchenko , Jelle van der Waa , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] iio: accel: dmard09: Implement IIO_CHAN_INFO_SCALE Message-ID: <20260712031033.11639ec8@jic23-huawei> In-Reply-To: <20260710105109.000047c5@gmail.com> References: <20260710083623.84243-1-mertsftl@gmail.com> <20260710105109.000047c5@gmail.com> Organization: Qualcomm X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: nXug43HOpSmC3bd776TecRybvr9VHxns X-Authority-Analysis: v=2.4 cv=SajHsPRu c=1 sm=1 tr=0 ts=6a52f7bb cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=qC1CW/w66vtJz1P9yTJxNA==:17 a=kj9zAlcOel0A:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=QroGHPVtAAAA:20 a=pGLkceISAAAA:8 a=3LJn6HzHc33MJYVoLt8A:9 a=CjuIK1q_8ugA:10 a=bFCP_H2QrGi7Okbo017w:22 a=bA3UWDv6hWIuX7UZL3qL:22 X-Proofpoint-ORIG-GUID: nXug43HOpSmC3bd776TecRybvr9VHxns X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEyMDAxOSBTYWx0ZWRfX3AdWlG6+8rgP cdIwuBTOQSMvkUJ62nJfdLOuAo8IQah0HvNca3LhcRnBPT6pHwHGKohgK0fHtOVLoWRHmmxV3PE APrxUKGJYqP43OrrmIYpzgg7DNoEScTi9dy6vq/MFM0FSMJDn31516EBq3Hqq1tv/Y60mNr+e/W CoI/dWY2Wp1tR3dzqyqsIfO5KL52mVdwDBn8VTp7L5hUXrNHWle45UleYjhnrp8LgRSUZQEj9oj sgsmeUkBSddBU+rNqq/BvAHoxAF30FTNfQyDyAt1vqtN+qRfxCT3iSxbsteMhDHVXeruItPGPuP pyG+YjM+MX48dd7PiT1GT1ZkSR0c+m9kSMJtB7BorxuFk+vmW9JFQcJQQoZ+SnNDMWsVwQR4pn1 YCnXN/pia+UJaWLdkTQatZo+ypxHvkVxqe7CeEgdSE9jDwbWWSj39evFsjTJMpboIUX/pUGodME Y6QAAeObIa4mMATMU5Q== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEyMDAxOSBTYWx0ZWRfX4J9qDTUn4Dd3 CWTX8p3kxnYu0jyabb+dw+Q2+YcfF9+U8TzU2b3W9+43nY4KOuc0ShqiXj+fjNT9DjvGen95qnv setCBiiSD3UfTEU3WQ6lDwPOE8AGyJ0= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-12_01,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 bulkscore=0 phishscore=0 clxscore=1015 suspectscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607120019 On Fri, 10 Jul 2026 10:51:09 +0200 Joshua Crofts wrote: > On Fri, 10 Jul 2026 10:36:23 +0200 > Mert Seftali wrote: > > > Reading the in_accel_scale attribute on the DMARD09 has always returned > > -EINVAL: the channels advertise scale via info_mask_shared_by_type so the > > IIO core exposes the attribute, but dmard09_read_raw() only handles > > IIO_CHAN_INFO_RAW, so a SCALE read falls through to 'default: return > > -EINVAL': > > > > $ cat .../iio:deviceX/in_accel_scale > > cat: in_accel_scale: Invalid argument > > > > leaving userspace with raw counts it cannot convert to m/s^2. > > > > The driver was written from a vendor source [1] without a datasheet, and > > the scale was declared but never implemented. The vendor source carries > > the sensitivity: its conversion is > > > > acc = raw * GRAVITY_EARTH_1000 / sensitivity (then / 1000 -> m/s^2) > > > > with sensitivity = 32 and GRAVITY_EARTH_1000 = 9807 ("about > > (9.80665)*1000"), i.e. 32 counts correspond to 1 g. > > > > That sensitivity applies to the value this driver already reports as raw: > > the vendor reduces each 16-bit sample to a signed 9-bit value, and the > > preparation in dmard09_read_raw() yields the same value. It is > > self-consistent: 256 counts / 32 = 8 g full scale, matching the +/-8g > > range. > > > > Implement the scale derived from that sensitivity using standard gravity: > > > > scale = 9.80665 / 32 = 0.3064578125 m/s^2 per LSB > > > > Link: https://github.com/minstrelsy/mediatek/blob/1f49d8c87b839651bc89afc870277e8e0f2e2d55/custom/common/kernel/accelerometer/dmard09/dmard09.c [1] > > Fixes: a4fa6509dda4 ("iio: accel: add support for the Domintech DMARD09 3-axis accelerometer") > > Signed-off-by: Mert Seftali > > --- > > Good thing that Jelle sent the vendor driver, LGTM. Indeed > > Reviewed-by: Joshua Crofts > Applied to the testing branch of iio.git. It's been broken from the start, so whilst it is a fix, I'm not rushing to get it upstream! Thanks, Jonathan