linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ye, Xiang" <xiang.ye@intel.com>
To: Jonathan Cameron <jic23@kernel.org>
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 v2] iio: hid-sensor-prox: Fix scale not correct issue
Date: Sun, 31 Jan 2021 15:35:14 +0800	[thread overview]
Message-ID: <20210131073514.GA16368@host> (raw)
In-Reply-To: <20210130191429.2c485212@archlinux>

On Sat, Jan 30, 2021 at 07:14:29PM +0000, Jonathan Cameron wrote:
> On Sat, 30 Jan 2021 18:25:30 +0800
> Ye Xiang <xiang.ye@intel.com> wrote:
> 
> > Currently, the proxy sensor scale is zero because it just return the
> > exponent directly. To fix this issue, this patch use
> > hid_sensor_format_scale to process the scale first then return the
> > output.
> > 
> > Fixes: 39a3a0138f61 ("iio: hid-sensors: Added Proximity Sensor Driver")
> > Signed-off-by: Ye Xiang <xiang.ye@intel.com>
> 
> Hi Ye Xiang,
> 
> There was a bit of fuzz on this so please take a look at
> my fixes-togreg branch and check it went in cleanly.
Have checked fixes-toreg branch, the patch it's correct.

Thanks
Ye Xiang

> 
> 
> > ---
> > v2:
> >   - Add Fixes tag
> > 
> > ---
> >  drivers/iio/light/hid-sensor-prox.c | 13 +++++++++++--
> >  1 file changed, 11 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
> > index 4ab285a418d5..4abcfe48f1d4 100644
> > --- a/drivers/iio/light/hid-sensor-prox.c
> > +++ b/drivers/iio/light/hid-sensor-prox.c
> > @@ -23,6 +23,9 @@ struct prox_state {
> >  	struct hid_sensor_common common_attributes;
> >  	struct hid_sensor_hub_attribute_info prox_attr;
> >  	u32 human_presence;
> > +	int scale_pre_decml;
> > +	int scale_post_decml;
> > +	int scale_precision;
> >  };
> >  
> >  static const u32 prox_sensitivity_addresses[] = {
> > @@ -98,8 +101,9 @@ static int prox_read_raw(struct iio_dev *indio_dev,
> >  		ret_type = IIO_VAL_INT;
> >  		break;
> >  	case IIO_CHAN_INFO_SCALE:
> > -		*val = prox_state->prox_attr.units;
> > -		ret_type = IIO_VAL_INT;
> > +		*val = prox_state->scale_pre_decml;
> > +		*val2 = prox_state->scale_post_decml;
> > +		ret_type = prox_state->scale_precision;
> >  		break;
> >  	case IIO_CHAN_INFO_OFFSET:
> >  		*val = hid_sensor_convert_exponent(
> > @@ -221,6 +225,11 @@ static int prox_parse_report(struct platform_device *pdev,
> >  	dev_dbg(&pdev->dev, "prox %x:%x\n", st->prox_attr.index,
> >  			st->prox_attr.report_id);
> >  
> > +	st->scale_precision = hid_sensor_format_scale(
> > +				hsdev->usage,
> > +				&st->prox_attr,
> > +				&st->scale_pre_decml, &st->scale_post_decml);
> > +
> >  	return ret;
> >  }
> >  
> 

      parent reply	other threads:[~2021-01-31  7:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-30 10:25 [PATCH v2] iio: hid-sensor-prox: Fix scale not correct issue Ye Xiang
2021-01-30 19:14 ` Jonathan Cameron
2021-01-31  7:16   ` Ye, Xiang
2021-01-31  7:35   ` Ye, Xiang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210131073514.GA16368@host \
    --to=xiang.ye@intel.com \
    --cc=jic23@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).