Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2824609pxb; Sat, 6 Feb 2021 08:56:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWgf80uMFd7b5GS7nnkg3Z2zJA6lWoGMiKTfMeffwmwQgIxtVIOSBlpjv/Oh2K47t4VNV9 X-Received: by 2002:a50:bc14:: with SMTP id j20mr9109381edh.381.1612630567213; Sat, 06 Feb 2021 08:56:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612630567; cv=none; d=google.com; s=arc-20160816; b=AQqHdQAqgb+wBrdSCSkhcWD8rCC8jzuXpkkrvKJinvbpgrtab0ET9tHcVSRcowI52T j/Vf1zSK+bKS6EE82SY/ugS+tjN//khVfLgPYOtKyKTJTqH3yU4SuTZXOfVvi5oXm8JW /K0OTT/ErI9kcxKBru9O0IPPrOqoT40n0RP7oy+Lx/E26ODMktra6tNgI/Dsid+mvQaz c+0OH8RsMMDn0foOQlP7bsvMfWpyfYQtSeQ/qwXBBrrpUs4TpB51QlGrVx39J1ftUquN B9Za2S+1IyAkaVaWUMiXO1iRs14dTwcCqyWDhXDpso41NzON82lajFXMXhmw5waBYpjp OlTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=h3Nsa0fwzZ9rqZVvR/v8HpJts7edXN/wzRDWJqFIQLg=; b=AUhjnDMCRDrsXdxsOMEujapEI/3/fnqBkvWgOfjVhvwELIr3DssZENpxhax9ieg2fc 3z8mkyr4bZi69832EedLAksx5PieVaw7oS8WQ46waENHZLhiJ31GI6vmVM1l81BHqEzn DMOqfBnR0X6ZL5QKc+4kF558vvmy0Sd3SqlN/iMDTm/Q/l/VO9uRzk8u3AVF4ZSmaFrK HPhFVRT0XV2GK3TQovpX9lo2Zu6O/qn8n7KbUK9bjn6AG7PNIE4VHoKyOQLfF2/2oYmN vBT8h1QR2INdowEkS5Wcb0hDMA3lsD/wxeBoG5U9mU4RSbwF7WAYMbtzuaA2aMp+T3cq 9iyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p26si7316778ejb.694.2021.02.06.08.55.42; Sat, 06 Feb 2021 08:56:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230206AbhBFQzC (ORCPT + 99 others); Sat, 6 Feb 2021 11:55:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:56136 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbhBFQxT (ORCPT ); Sat, 6 Feb 2021 11:53:19 -0500 Received: from archlinux (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 15D7264ECA; Sat, 6 Feb 2021 16:52:37 +0000 (UTC) Date: Sat, 6 Feb 2021 16:52:34 +0000 From: Jonathan Cameron To: Ye Xiang Cc: jikos@kernel.org, srinivas.pandruvada@linux.intel.com, linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] iio: hid-sensor-als: Add relative hysteresis support Message-ID: <20210206165234.26bf0421@archlinux> In-Reply-To: <20210201074358.18435-3-xiang.ye@intel.com> References: <20210201074358.18435-1-xiang.ye@intel.com> <20210201074358.18435-3-xiang.ye@intel.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 1 Feb 2021 15:43:57 +0800 Ye Xiang wrote: > Hid sensor als uses relative hysteresis, this patch adds the support. > > Signed-off-by: Ye Xiang Looks good to me. Jonathan > --- > drivers/iio/light/hid-sensor-als.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c > index afcdb424bfb8..85c8a05b73cb 100644 > --- a/drivers/iio/light/hid-sensor-als.c > +++ b/drivers/iio/light/hid-sensor-als.c > @@ -54,7 +54,8 @@ static const struct iio_chan_spec als_channels[] = { > .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | > BIT(IIO_CHAN_INFO_SCALE) | > BIT(IIO_CHAN_INFO_SAMP_FREQ) | > - BIT(IIO_CHAN_INFO_HYSTERESIS), > + BIT(IIO_CHAN_INFO_HYSTERESIS) | > + BIT(IIO_CHAN_INFO_HYSTERESIS_RELATIVE), > .scan_index = CHANNEL_SCAN_INDEX_INTENSITY, > }, > { > @@ -63,7 +64,8 @@ static const struct iio_chan_spec als_channels[] = { > .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | > BIT(IIO_CHAN_INFO_SCALE) | > BIT(IIO_CHAN_INFO_SAMP_FREQ) | > - BIT(IIO_CHAN_INFO_HYSTERESIS), > + BIT(IIO_CHAN_INFO_HYSTERESIS) | > + BIT(IIO_CHAN_INFO_HYSTERESIS_RELATIVE), > .scan_index = CHANNEL_SCAN_INDEX_ILLUM, > }, > IIO_CHAN_SOFT_TIMESTAMP(CHANNEL_SCAN_INDEX_TIMESTAMP) > @@ -141,6 +143,10 @@ static int als_read_raw(struct iio_dev *indio_dev, > ret_type = hid_sensor_read_raw_hyst_value( > &als_state->common_attributes, val, val2); > break; > + case IIO_CHAN_INFO_HYSTERESIS_RELATIVE: > + ret_type = hid_sensor_read_raw_hyst_rel_value( > + &als_state->common_attributes, val, val2); > + break; > default: > ret_type = -EINVAL; > break; > @@ -168,6 +174,10 @@ static int als_write_raw(struct iio_dev *indio_dev, > ret = hid_sensor_write_raw_hyst_value( > &als_state->common_attributes, val, val2); > break; > + case IIO_CHAN_INFO_HYSTERESIS_RELATIVE: > + ret = hid_sensor_write_raw_hyst_rel_value( > + &als_state->common_attributes, val, val2); > + break; > default: > ret = -EINVAL; > }