[U-Boot] [PATCH] pmic: ltc3676: add regulator config function
Jaehoon Chung
jh80.chung at samsung.com
Tue Mar 21 22:09:18 UTC 2017
Hi,
On 03/21/2017 11:47 PM, Tim Harvey wrote:
> Add a convenience function for configuring the most common characteristics
> of an LTC3676 buck regulator.
I didn't know where this is used.
>
> Signed-off-by: Tim Harvey <tharvey at gateworks.com>
> ---
> drivers/power/pmic/pmic_ltc3676.c | 16 ++++++++++++++++
> include/power/ltc3676_pmic.h | 40 +++++++++++++++++++++++++++++++++++++++
> 2 files changed, 56 insertions(+)
>
> diff --git a/drivers/power/pmic/pmic_ltc3676.c b/drivers/power/pmic/pmic_ltc3676.c
> index 9b874cb..af795ea 100644
> --- a/drivers/power/pmic/pmic_ltc3676.c
> +++ b/drivers/power/pmic/pmic_ltc3676.c
> @@ -30,3 +30,19 @@ int power_ltc3676_init(unsigned char bus)
>
> return 0;
> }
> +
> +void power_ltc3676_swconfig(struct pmic *p, enum ltc3676_sw sw,
> + enum ltc3676_mode mode, enum ltc3676_phase phase,
> + enum ltc3676_freq freq)
As i mentioned above, this function doesn't call anywhere..
Well, if i missed some your patches, let me know, plz.
> +{
> + u32 reg;
> +
> + pmic_reg_read(p, LTC3676_BUCK1 + sw, ®);
> + reg &= ~LTC3676_MODE_MASK;
> + reg |= (mode << LTC3676_MODE);
> + reg &= ~(1 << LTC3676_PHASE);
For clearing bit, use the macro..
> + reg |= (phase << LTC3676_PHASE);
> + reg &= ~(1 << LTC3676_FREQ);
> + reg |= (freq << LTC3676_FREQ);
> + pmic_reg_write(p, LTC3676_BUCK1 + sw, reg);
> +}
> diff --git a/include/power/ltc3676_pmic.h b/include/power/ltc3676_pmic.h
> index dcaa985..f5b0f3c 100644
> --- a/include/power/ltc3676_pmic.h
> +++ b/include/power/ltc3676_pmic.h
> @@ -42,10 +42,50 @@ enum {
> * SW Configuration
> */
>
> +/* DVB<x> registers */
> #define LTC3676_DVB_MASK 0x1f
> #define LTC3676_PGOOD_MASK (1<<5)
> #define LTC3676_REF_SELA (0<<5)
> #define LTC3676_REF_SELB (1<<5)
>
> +/* BUCK<x> registers */
> +#define LTC3676_MODE_MASK 0x60
> +#define LTC3676_MODE 5
> +#define LTC3676_STARTUP 4
> +#define LTC3676_PHASE 3
> +#define LTC3676_FREQ 2
> +#define LTC3676_KEEPALIVE 1
> +#define LTC3676_RATE 0
Use the bit API..
#define LTC3676_MODE BIT(5)
#define LTC3676_STARTUP BIT(4)
...
Then you can change the code in power_ltc3676_swconfig().
Best Regards,
Jaehoon Chung
> +
> +enum ltc3676_sw {
> + SW1 = 0,
> + SW2 = 1,
> + SW3 = 2,
> + SW4 = 3
> +};
> +
> +enum ltc3676_mode {
> + PFM = 0, /* pulse-skipping */
> + APF = 1, /* burst - auto switches */
> + PWM = 2, /* forced continuous */
> +};
> +
> +enum ltc3676_phase {
> + PHASE1 = 0,
> + PHASE2 = 1,
> +};
> +
> +enum ltc3676_freq {
> + F2250KHZ = 0,
> + F1125KHZ = 1,
> +};
> +
> +enum ltc3676_rate {
> + SLOW = 0,
> + FAST = 1,
> +};
> +
> int power_ltc3676_init(unsigned char bus);
> +void power_ltc3676_swconfig(struct pmic *, enum ltc3676_sw, enum ltc3676_mode,
> + enum ltc3676_phase, enum ltc3676_freq);
> #endif
>
More information about the U-Boot
mailing list