Re: [RFC PATCH] regulator: palmas: enable all modes for SMPS10

From: Kishon Vijay Abraham I
Date: Thu May 30 2013 - 08:55:25 EST


Hi,

On Thursday 30 May 2013 05:02 PM, Mark Brown wrote:
On Thu, May 30, 2013 at 04:26:33PM +0530, Kishon Vijay Abraham I wrote:

Only compile tested. Just sent a patch to get some comments
/ideas on how to handle such one off regulators.
to handle

What's unclear or confusing? This all looks really basic...

For instance mapping of regulator modes to smps10 modes is unclear.

+ palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, &reg);
+ reg &= ~PALMAS_SMPS10_CTRL_MODE_ACTIVE_MODE_MASK;
+
+ if (mode == REGULATOR_MODE_NORMAL)
+ reg |= SMPS10_BOOST_EN;
+
+ if (mode == REGULATOR_MODE_FAST)
+ reg |= SMPS10_SWITCH_EN;
+
+ if (mode == REGULATOR_MODE_IDLE)
+ reg |= SMPS10_BYPASS_EN;
+
+ palmas_smps_write(pmic->palmas, palmas_regs_info[id].ctrl_addr, reg);
+ return 0;

This looks like a switch statement and isn't there an update bits
operation?

There can be multiple modes set at the same time. Having switch statement means we would need to call the same API multiple times to set the mode. There isn't a palmas wrapper to regmap_update_bits. I can send a patch to add a palmas wrapper.

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/