regulator: max8649 - fix setting extclk_freq
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
@@ -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
Quoted 6 lines · Axel Lin
The SYNC bits are BIT6 and BIT7 of
MAX8649_SYNCregister.pdata->extclk_freqcould be [0|1|2]. (MAX8649_EXTCLK_26MHZ|MAX8649_EXTCLK_13MHZ|MAX8649_EXTCLK_19MHZ) It requires to left shift 6 bits to properly setextclk_freq.Signed-off-by Axel Lin <[email protected]>
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.
2010/10/1 Mark Brown <[email protected]>:
Quoted 6 lines · Axel Lin
Quoted 5 lines
The SYNC bits are BIT6 and BIT7 of
MAX8649_SYNCregister.pdata->extclk_freqcould be [0|1|2]. (MAX8649_EXTCLK_26MHZ|MAX8649_EXTCLK_13MHZ|MAX8649_EXTCLK_19MHZ) It requires to left shift 6 bits to properly setextclk_freq.
Quoted 7 lines
Quoted 1 line
Signed-off-by Axel Lin <[email protected]>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.hextclk_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
2010/10/1 Mark Brown <[email protected]>:
Quoted 6 lines · Axel Lin
Quoted 5 lines
The SYNC bits are BIT6 and BIT7 of
MAX8649_SYNCregister.pdata->extclk_freqcould be [0|1|2]. (MAX8649_EXTCLK_26MHZ|MAX8649_EXTCLK_13MHZ|MAX8649_EXTCLK_19MHZ) It requires to left shift 6 bits to properly setextclk_freq.
Quoted 7 lines
Quoted 1 line
Signed-off-by Axel Lin <[email protected]>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 setextclk_freq = MAX8649_EXTCLK_26MHZ;
but notextclk_freq = (MAX8649_EXTCLK_26MHZ << 6);
Regards,
Axel
Mark Brown
Acked-byQuoted 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 haveenum { 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.
Liam Girdwood
AppliedQuoted 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 haveenum { 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.
Acked-by Mark Brown <[email protected]>--
Applied.
Thanks
Liam
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk