linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: Brian Masney <masneyb@onstation.org>
Cc: robh+dt@kernel.org, mark.rutland@arm.com, andy.gross@linaro.org,
	david.brown@linaro.org, linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org,
	jonathan@marek.ca, jmaneyrol@invensense.com, knaack.h@gmx.de,
	lars@metafoo.de, pmeerw@pmeerw.net, mkelly@xevo.com,
	fischerdouglasc@gmail.com, bshah@kde.org, ctatlor97@gmail.com
Subject: Re: [PATCH v3 7/9] iio: tsl2772: add support for avago,apds9930
Date: Sat, 18 Aug 2018 18:07:32 +0100	[thread overview]
Message-ID: <20180818180724.2a489d07@archlinux> (raw)
In-Reply-To: <20180803225336.6cb5d581@archlinux>

On Fri, 3 Aug 2018 22:53:36 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Thu,  2 Aug 2018 20:18:58 -0400
> Brian Masney <masneyb@onstation.org> wrote:
> 
> > The Avago APDS9930 has the same register set as the TAOS/AMS TSL2772 so
> > this patch adds the correct bindings and the appropriate LUX table
> > values derived from the values in the datasheet. Driver was tested on a
> > LG Nexus 5 (hammerhead) phone.
> > 
> > avago,apds9930 datasheet:
> > https://www.mouser.com/datasheet/2/678/avago_AV02-3190EN_DS_APDS-9930_2014-03-25[1]-1217273.pdf
> > 
> > tsl2772 datasheet:
> > https://ams.com/eng/content/download/291503/1066377/file/TSL2772_DS000181_2-00.pdf
> > 
> > Signed-off-by: Brian Masney <masneyb@onstation.org>  
> Glad you noticed they were the same.  will apply once precursors are in.
> 
Applied to the togreg branch of iio.git and pushed out as testing for the
autobuilders to play with it.

Thanks,

Jonathan

> Thanks,
> 
> Jonathan
> 
> > ---
> >  drivers/iio/light/tsl2772.c | 18 ++++++++++++++++--
> >  1 file changed, 16 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c
> > index 4a11bf77a4d0..83cece921843 100644
> > --- a/drivers/iio/light/tsl2772.c
> > +++ b/drivers/iio/light/tsl2772.c
> > @@ -124,7 +124,8 @@ enum {
> >  	tsl2672,
> >  	tmd2672,
> >  	tsl2772,
> > -	tmd2772
> > +	tmd2772,
> > +	apds9930,
> >  };
> >  
> >  enum {
> > @@ -213,6 +214,12 @@ static const struct tsl2772_lux tmd2x72_lux_table[TSL2772_DEF_LUX_TABLE_SZ] = {
> >  	{     0,      0 },
> >  };
> >  
> > +static const struct tsl2772_lux apds9930_lux_table[TSL2772_DEF_LUX_TABLE_SZ] = {
> > +	{ 52000,  96824 },
> > +	{ 38792,  67132 },
> > +	{     0,      0 },
> > +};
> > +
> >  static const struct tsl2772_lux *tsl2772_default_lux_table_group[] = {
> >  	[tsl2571] = tsl2x71_lux_table,
> >  	[tsl2671] = tsl2x71_lux_table,
> > @@ -224,6 +231,7 @@ static const struct tsl2772_lux *tsl2772_default_lux_table_group[] = {
> >  	[tmd2672] = tmd2x72_lux_table,
> >  	[tsl2772] = tsl2x72_lux_table,
> >  	[tmd2772] = tmd2x72_lux_table,
> > +	[apds9930] = apds9930_lux_table,
> >  };
> >  
> >  static const struct tsl2772_settings tsl2772_default_settings = {
> > @@ -274,6 +282,7 @@ static const int tsl2772_int_time_avail[][6] = {
> >  	[tmd2672] = { 0, 2730, 0, 2730, 0, 699000 },
> >  	[tsl2772] = { 0, 2730, 0, 2730, 0, 699000 },
> >  	[tmd2772] = { 0, 2730, 0, 2730, 0, 699000 },
> > +	[apds9930] = { 0, 2730, 0, 2730, 0, 699000 },
> >  };
> >  
> >  static int tsl2772_int_calibscale_avail[] = { 1, 8, 16, 120 };
> > @@ -299,7 +308,8 @@ static const u8 device_channel_config[] = {
> >  	[tsl2672] = PRX2,
> >  	[tmd2672] = PRX2,
> >  	[tsl2772] = ALSPRX2,
> > -	[tmd2772] = ALSPRX2
> > +	[tmd2772] = ALSPRX2,
> > +	[apds9930] = ALSPRX2,
> >  };
> >  
> >  static int tsl2772_read_status(struct tsl2772_chip *chip)
> > @@ -513,6 +523,7 @@ static int tsl2772_get_prox(struct iio_dev *indio_dev)
> >  	case tmd2672:
> >  	case tsl2772:
> >  	case tmd2772:
> > +	case apds9930:
> >  		if (!(ret & TSL2772_STA_PRX_VALID)) {
> >  			ret = -EINVAL;
> >  			goto prox_poll_err;
> > @@ -1393,6 +1404,7 @@ static int tsl2772_device_id_verif(int id, int target)
> >  	case tmd2672:
> >  	case tsl2772:
> >  	case tmd2772:
> > +	case apds9930:
> >  		return (id & 0xf0) == SWORDFISH_ID;
> >  	}
> >  
> > @@ -1932,6 +1944,7 @@ static const struct i2c_device_id tsl2772_idtable[] = {
> >  	{ "tmd2672", tmd2672 },
> >  	{ "tsl2772", tsl2772 },
> >  	{ "tmd2772", tmd2772 },
> > +	{ "apds9930", apds9930},
> >  	{}
> >  };
> >  
> > @@ -1948,6 +1961,7 @@ static const struct of_device_id tsl2772_of_match[] = {
> >  	{ .compatible = "amstaos,tmd2672" },
> >  	{ .compatible = "amstaos,tsl2772" },
> >  	{ .compatible = "amstaos,tmd2772" },
> > +	{ .compatible = "avago,apds9930" },
> >  	{}
> >  };
> >  MODULE_DEVICE_TABLE(of, tsl2772_of_match);  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2018-08-18 17:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03  0:18 [PATCH v3 0/9] treewide: add support for various sensors on the LG Nexus 5 (hammerhead) Brian Masney
2018-08-03  0:18 ` [PATCH v3 1/9] iio: imu: mpu6050: add support for regulator framework Brian Masney
2018-08-03 21:44   ` Jonathan Cameron
2018-08-03  0:18 ` [PATCH v3 2/9] ARM: dts: qcom: msm8974-hammerhead: add device tree bindings for mpu6515 Brian Masney
2018-08-03 21:46   ` Jonathan Cameron
2018-08-03  0:18 ` [PATCH v3 3/9] iio: tsl2772: add support for reading proximity led settings from device tree Brian Masney
2018-08-18 17:04   ` Jonathan Cameron
2018-08-03  0:18 ` [PATCH v3 4/9] dt-bindings: iio: tsl2772: add new bindings Brian Masney
2018-08-03 21:48   ` Jonathan Cameron
2018-08-07 16:54     ` Rob Herring
2018-08-18 17:01       ` Jonathan Cameron
2018-08-03  0:18 ` [PATCH v3 5/9] iio: tsl2772: add support for regulator framework Brian Masney
2018-08-03 21:50   ` Jonathan Cameron
2018-08-03  0:18 ` [PATCH v3 6/9] dt-bindings: iio: tsl2772: add bindings " Brian Masney
2018-08-03 21:51   ` Jonathan Cameron
2018-08-07 17:20     ` Rob Herring
2018-08-18 17:02       ` Jonathan Cameron
2018-08-03  0:18 ` [PATCH v3 7/9] iio: tsl2772: add support for avago,apds9930 Brian Masney
2018-08-03 21:53   ` Jonathan Cameron
2018-08-18 17:07     ` Jonathan Cameron [this message]
2018-08-03  0:18 ` [PATCH v3 8/9] dt-bindings: iio: tsl2772: add binding " Brian Masney
2018-08-03 21:54   ` Jonathan Cameron
2018-08-07 17:21   ` Rob Herring
2018-08-18 17:06     ` Jonathan Cameron
2018-08-03  0:19 ` [PATCH v3 9/9] ARM: dts: qcom: msm8974-hammerhead: add device tree bindings for ALS / proximity Brian Masney
2018-08-18 17:09   ` Jonathan Cameron

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=20180818180724.2a489d07@archlinux \
    --to=jic23@jic23.retrosnub.co.uk \
    --cc=andy.gross@linaro.org \
    --cc=bshah@kde.org \
    --cc=ctatlor97@gmail.com \
    --cc=david.brown@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fischerdouglasc@gmail.com \
    --cc=jmaneyrol@invensense.com \
    --cc=jonathan@marek.ca \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=masneyb@onstation.org \
    --cc=mkelly@xevo.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    /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).