RE: [PATCH] mfd: tps6586x: add api to power off tps6586x

From: Wei Ni
Date: Sun Aug 21 2011 - 23:47:25 EST


Hi, Samuel
Thanks for your comments.
Please check the following lines with [Wei Ni]

Thanks
Wei.


>-----Original Message-----
>From: Samuel Ortiz [mailto:sameo@xxxxxxxxxxxxxxx]
>Sent: Monday, August 22, 2011 7:05 AM
>To: Wei Ni
>Cc: mike@xxxxxxxxxxxxxx; gking@xxxxxxxxxx; Nitin Kumbhar; linux-kernel@xxxxxxxxxxxxxxx
>Subject: Re: [PATCH] mfd: tps6586x: add api to power off tps6586x
>
>Hi Wei,
>
>On Thu, Jul 28, 2011 at 02:30:36PM +0800, wni@xxxxxxxxxx wrote:
>> +static struct i2c_client *tps6586x_i2c_client;
>That's not vey nice. By doing so, you're preventing anyone to have more than
>one of those chips in their boards.
[Wei Ni] oh yes, I didnât consider this issue. We use i2c_register_board_info()
to register the tps6586x in the board file, but it didn't return the handle.
Do you have any ideas?
>
>
>> +int tps6586x_power_off(void)
>> +{
>> + struct device *dev = NULL;
>> + int ret = -EINVAL;
>> +
>> + if (!tps6586x_i2c_client)
>> + return ret;
>> +
>> + dev = &tps6586x_i2c_client->dev;
>> +
>> + ret = tps6586x_clr_bits(dev, TPS6586X_SUPPLYENE, EXITSLREQ_BIT);
>> + if (ret)
>> + return ret;
>> +
>> + ret = tps6586x_set_bits(dev, TPS6586X_SUPPLYENE, SLEEP_MODE_BIT);
>> + if (ret)
>> + return ret;
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(tps6586x_power_off);
>Who is going to call this one ?
[Wei Ni] the tegra board will call this function to power off system.
It will put tps6586x in sleep mode by resetting EXITSLREQ and
setting SLEEP_MODE in SUPPLYENE register. It will power off ldos.
>
>Cheers,
>Samuel.
>
>--
>Intel Open Source Technology Centre
>http://oss.intel.com/
N‹§²æìr¸›yúèšØb²X¬¶ÇvØ^–)Þ{.nÇ+‰·¥Š{±‘êçzX§¶›¡Ü}©ž²ÆzÚ&j:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ßf”ù^jÇy§m…á@A«a¶Úÿ 0¶ìh®å’i