Skip to contentSkip to conversation

regulator: max8649 - fix setting extclk_freq

PATCH Applied Axel Lin 3 participants 6 messages Oct 1, 2010 – Oct 2, 2010 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: max8649 - fix setting extclk_freq

The SYNC bits are BIT6 and BIT7 of MAX8649_SYNC register. pdata->extclk_freq could be [0|1|2]. (MAX8649_EXTCLK_26MHZ|MAX8649_EXTCLK_13MHZ|MAX8649_EXTCLK_19MHZ) It requires to left shift 6 bits to properly set extclk_freq.

---
 drivers/regulator/max8649.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/max8649.c +1 -1
index 4520ace..6b60a9c 100644
@@ -330,7 +330,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
 		/* set external clock frequency */
 		info->extclk_freq = pdata->extclk_freq;
 		max8649_set_bits(info->i2c, MAX8649_SYNC, MAX8649_EXT_MASK,
-				 info->extclk_freq);
+				 info->extclk_freq << 6);
 	}
 
 	if (pdata->ramp_timing) {
Signature · 1 line
1.7.2
#1 lore raw
Quoted 6 lines · Axel Lin

The SYNC bits are BIT6 and BIT7 of MAX8649_SYNC register. pdata->extclk_freq could be [0|1|2]. (MAX8649_EXTCLK_26MHZ|MAX8649_EXTCLK_13MHZ|MAX8649_EXTCLK_19MHZ) It requires to left shift 6 bits to properly set extclk_freq.

Are there existing users of the driver? It's not always 100% clear if people are expecting bitfield values that will be shifted in or values that can be ored directly in. I don't really mind either way but I'd rather be careful.

author
#2 lore raw

2010/10/1 Mark Brown <[email protected]>:

Quoted 6 lines · Axel Lin
Quoted 5 lines

The SYNC bits are BIT6 and BIT7 of MAX8649_SYNC register. pdata->extclk_freq could be [0|1|2]. (MAX8649_EXTCLK_26MHZ|MAX8649_EXTCLK_13MHZ|MAX8649_EXTCLK_19MHZ) It requires to left shift 6 bits to properly set extclk_freq.

Quoted 7 lines
Quoted 1 line

Are there existing users of the driver?  It's not always 100% clear if people are expecting bitfield values that will be shifted in or values that can be ored directly in.  I don't really mind either way but I'd rather be careful.

max8649 regulator is used in arch/arm/mach-mmp/jasper.c (Marvell Jasper Development Platform)

I checked include/linux/regulator/max8649.h
extclk_freq only takes 2 bits:
unsigned extclk_freq:2;

People should set extclk_freq to [MAX8649_EXTCLK_26MHZ|MAX8649_EXTCLK_13MHZ|MAX8649_EXTCLK_19MHZ], so we need to do 6 bits left shift to properly set extclk_freq.

Regards,
Axel

author
#3 lore raw
In reply to Mark Brown

2010/10/1 Mark Brown <[email protected]>:

Quoted 6 lines · Axel Lin
Quoted 5 lines

The SYNC bits are BIT6 and BIT7 of MAX8649_SYNC register. pdata->extclk_freq could be [0|1|2]. (MAX8649_EXTCLK_26MHZ|MAX8649_EXTCLK_13MHZ|MAX8649_EXTCLK_19MHZ) It requires to left shift 6 bits to properly set extclk_freq.

Quoted 7 lines
Quoted 1 line

Are there existing users of the driver?  It's not always 100% clear if people are expecting bitfield values that will be shifted in or values that can be ored directly in.  I don't really mind either way but I'd rather be careful.

I think I should explain this way:

In max8649.h , we have

enum {
        MAX8649_EXTCLK_26MHZ = 0,
        MAX8649_EXTCLK_13MHZ,
        MAX8649_EXTCLK_19MHZ,   /* 19.2MHz */
};

Thus, I think users will set
extclk_freq = MAX8649_EXTCLK_26MHZ;
but not
extclk_freq = (MAX8649_EXTCLK_26MHZ << 6);

Regards,
Axel

Acked-by
#4 lore raw
Quoted 7 lines · Axel Lin

2010/10/1 Mark Brown <[email protected]>:

Quoted 4 lines

Are there existing users of the driver?  It's not always 100% clear if people are expecting bitfield values that will be shifted in or values that can be ored directly in.  I don't really mind either way but I'd rather be careful.

Quoted 8 lines

I think I should explain this way:

In max8649.h , we have

enum {
        MAX8649_EXTCLK_26MHZ = 0,
        MAX8649_EXTCLK_13MHZ,
        MAX8649_EXTCLK_19MHZ,   /* 19.2MHz */
};

OK, that's clearer. When changing the interpretation of existing platform data like this it's good to note this sort of thing in the changelog since merge issues can be a real pain.

#5 lore raw
Quoted 17 lines · Mark Brown
Quoted 7 lines · Axel Lin

2010/10/1 Mark Brown <[email protected]>:

Quoted 4 lines

Are there existing users of the driver? It's not always 100% clear if people are expecting bitfield values that will be shifted in or values that can be ored directly in. I don't really mind either way but I'd rather be careful.

Quoted 8 lines

I think I should explain this way:

In max8649.h , we have

enum {
        MAX8649_EXTCLK_26MHZ = 0,
        MAX8649_EXTCLK_13MHZ,
        MAX8649_EXTCLK_19MHZ,   /* 19.2MHz */
};
Quoted 6 lines

OK, that's clearer. When changing the interpretation of existing platform data like this it's good to note this sort of thing in the changelog since merge issues can be a real pain.

--

Applied.

Thanks

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk