public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC/RFT] regulator: da903x: Don't read/write to DA9030_INVAL/DA9034_INVAL address
@ 2012-06-07  2:38 Axel Lin
  2012-06-07 23:27 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-06-07  2:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: Eric Miao, Mike Rapoport, Liam Girdwood, Mark Brown

For fixed voltage, DA9030_LDO13 and DA9034_LDO5, the info->vol_reg is
DA9030_INVAL/DA9034_INVAL.
It does not make sense to read/write to DA9030_INVAL/DA9034_INVAL address.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
Because we use [list|map]_voltage_linear for fixed voltage where uV_step is 0,
this patch also needs below patch:
[PATCH RFC 1/2] regulator: core: Allow uV_step to be 0 for linear mapping if fixed voltage

 drivers/regulator/da903x.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index 1005f5f..36c5b92 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -107,6 +107,9 @@ static int da903x_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
 	struct device *da9034_dev = to_da903x_dev(rdev);
 	uint8_t val, mask;
 
+	if (rdev->desc->n_voltages == 1)
+		return -EINVAL;
+
 	val = selector << info->vol_shift;
 	mask = ((1 << info->vol_nbits) - 1)  << info->vol_shift;
 
@@ -120,6 +123,9 @@ static int da903x_get_voltage_sel(struct regulator_dev *rdev)
 	uint8_t val, mask;
 	int ret;
 
+	if (rdev->desc->n_voltages == 1)
+		return 0;
+
 	ret = da903x_read(da9034_dev, info->vol_reg, &val);
 	if (ret)
 		return ret;
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RFC/RFT] regulator: da903x: Don't read/write to DA9030_INVAL/DA9034_INVAL address
  2012-06-07  2:38 [PATCH RFC/RFT] regulator: da903x: Don't read/write to DA9030_INVAL/DA9034_INVAL address Axel Lin
@ 2012-06-07 23:27 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-06-07 23:27 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Eric Miao, Mike Rapoport, Liam Girdwood

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

On Thu, Jun 07, 2012 at 10:38:30AM +0800, Axel Lin wrote:
> For fixed voltage, DA9030_LDO13 and DA9034_LDO5, the info->vol_reg is
> DA9030_INVAL/DA9034_INVAL.
> It does not make sense to read/write to DA9030_INVAL/DA9034_INVAL address.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-08  0:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-07  2:38 [PATCH RFC/RFT] regulator: da903x: Don't read/write to DA9030_INVAL/DA9034_INVAL address Axel Lin
2012-06-07 23:27 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox