Return-Path: Message-ID: <2491411A39C64F138396EE9BC26AF60E@GustyD430> From: "Kevin Tsai" To: "Shubhrajyoti Datta" Cc: "Jonathan Cameron" , "Grant Likely" , "Rob Herring" , "Peter Meerwald" , "Alexander Holler" , "srinivas pandruvada" , "Linux Kernel Mailing List" , , References: <1375813453-2290-1-git-send-email-ktsai@capellamicro.com> Subject: Re: [PATCH 1/1] Added Capella CM3218 Ambient Light Sensor IIO driver. Date: Wed, 7 Aug 2013 10:29:12 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000D_01CE9358.F5BF4080" List-ID: This is a multi-part message in MIME format. ------=_NextPart_000_000D_01CE9358.F5BF4080 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi sir, This sensor doesn't have power on reset. It's necessary to re-initialize = device after resume power. Thanks. Kevin Tsai 08/06/13 ----- Original Message -----=20 From: Shubhrajyoti Datta=20 To: Kevin Tsai=20 Cc: Jonathan Cameron ; Grant Likely ; Rob Herring ; Peter Meerwald ; = Alexander Holler ; srinivas pandruvada ; Linux Kernel Mailing List ; = linux-iio@vger.kernel.org ; devicetree@vger.kernel.org=20 Sent: Tuesday, August 06, 2013 23:31 Subject: Re: [PATCH 1/1] Added Capella CM3218 Ambient Light Sensor IIO = driver. + chip->suspended =3D true; + + mutex_unlock(&chip->lock); + return 0; +} + +static int cm3218_resume(struct device *dev) +{ + struct iio_dev *indio_dev =3D dev_get_drvdata(dev); + struct cm3218_chip *chip =3D iio_priv(indio_dev); + struct i2c_client *client =3D chip->client; + int err; + + mutex_lock(&chip->lock); + + err =3D cm3218_chip_init(client); We do a reinit every time is there a way to know if the context was = lost? =20 + if (!err) + chip->suspended =3D false; + + mutex_unlock(&chip->lock); + return err; +} + -- 1.8.3.1 -- 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 ------=_NextPart_000_000D_01CE9358.F5BF4080 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi sir,
 
This sensor doesn't have power on = reset. It's=20 necessary to re-initialize device after resume power.
 
Thanks.
 
Kevin Tsai
08/06/13
----- Original Message -----
From:=20 Shubhrajyoti Datta =
Cc: Jonathan Cameron ; Grant=20 Likely ; Rob Herring ; Peter = Meerwald ;=20 Alexander=20 Holler ; srinivas pandruvada = ; Linux Kernel Mailing = List ; linux-iio@vger.kernel.org = ; devicetree@vger.kernel.org=
Sent: Tuesday, August 06, 2013=20 23:31
Subject: Re: [PATCH 1/1] Added = Capella=20 CM3218 Ambient Light Sensor IIO driver.


<snip>
+       chip->suspended =3D=20 true;
+
+       = mutex_unlock(&chip->lock);
+=20       return 0;
+}
+
+static int=20 cm3218_resume(struct device *dev)
+{
+       = struct=20 iio_dev *indio_dev =3D dev_get_drvdata(dev);
+     =   struct=20 cm3218_chip *chip =3D iio_priv(indio_dev);
+       = struct=20 i2c_client *client =3D chip->client;
+       = int=20 err;
+
+      =20 mutex_lock(&chip->lock);
+
+       err = =3D=20 cm3218_chip_init(client);
We do a reinit every time is there a way to know if the context = was=20 lost?
 
+       if (!err)
+   =    =20         chip->suspended =3D false;
+
+ =  =20     mutex_unlock(&chip->lock);
+     =  =20 return err;
+}
+

--
1.8.3.1

--
To unsubscribe from this = list: send=20 the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.orgMore=20 majordomo info at  http://vger.kernel.org/majordomo-info.html
=

------=_NextPart_000_000D_01CE9358.F5BF4080--