* [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function
@ 2012-03-28 8:45 Lukasz Majewski
2012-03-28 8:45 ` [U-Boot] [PATCH 2/3] misc:pmic:max8997 MAX8997 support for PMIC driver Lukasz Majewski
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Lukasz Majewski @ 2012-03-28 8:45 UTC (permalink / raw)
To: u-boot
Support for voltage (in uV) to proper register value is added.
The function tied to this callback is often PMIC dependent
and shall be defined for each device.
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Stefano Babic <sbabic@denx.de>
---
drivers/misc/pmic_core.c | 10 ++++++++++
include/pmic.h | 2 ++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/pmic_core.c b/drivers/misc/pmic_core.c
index 5d62a56..4366bf0 100644
--- a/drivers/misc/pmic_core.c
+++ b/drivers/misc/pmic_core.c
@@ -89,6 +89,16 @@ struct pmic *get_pmic(void)
return &pmic;
}
+int pmic_vol_to_reg(struct pmic *p, int uV)
+{
+ if (p->voltage_to_reg_conv == NULL) {
+ puts("PMIC: Voltage to register value function not defined\n");
+ return 0;
+ }
+
+ return p->voltage_to_reg_conv(uV);
+}
+
int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
u32 ret, reg, val;
diff --git a/include/pmic.h b/include/pmic.h
index 52a1526..f8594a9 100644
--- a/include/pmic.h
+++ b/include/pmic.h
@@ -52,12 +52,14 @@ struct pmic {
struct p_i2c i2c;
struct p_spi spi;
} hw;
+ int (*voltage_to_reg_conv) (int uV);
};
int pmic_init(void);
int check_reg(u32 reg);
struct pmic *get_pmic(void);
int pmic_probe(struct pmic *p);
+int pmic_vol_to_reg(struct pmic *p, int uV);
int pmic_reg_read(struct pmic *p, u32 reg, u32 *val);
int pmic_reg_write(struct pmic *p, u32 reg, u32 val);
int pmic_set_output(struct pmic *p, u32 reg, int ldo, int on);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 11+ messages in thread* [U-Boot] [PATCH 2/3] misc:pmic:max8997 MAX8997 support for PMIC driver 2012-03-28 8:45 [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function Lukasz Majewski @ 2012-03-28 8:45 ` Lukasz Majewski 2012-03-28 8:45 ` [U-Boot] [PATCH 3/3] misc:pmic:samsung Convert TRATS target to use MAX8997 instead of MAX8998 Lukasz Majewski 2012-03-28 10:26 ` [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function Stefano Babic 2 siblings, 0 replies; 11+ messages in thread From: Lukasz Majewski @ 2012-03-28 8:45 UTC (permalink / raw) To: u-boot This commit adds support for MAX8997 PMIC driver. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Stefano Babic <sbabic@denx.de> --- drivers/misc/Makefile | 1 + drivers/misc/pmic_max8997.c | 60 ++++++++++++++ include/max8997_pmic.h | 190 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 251 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/pmic_max8997.c create mode 100644 include/max8997_pmic.h diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index a709707..30c7f8d 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -39,6 +39,7 @@ COBJS-$(CONFIG_PMIC_FSL) += pmic_fsl.o COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o +COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/misc/pmic_max8997.c b/drivers/misc/pmic_max8997.c new file mode 100644 index 0000000..506162f --- /dev/null +++ b/drivers/misc/pmic_max8997.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011 Samsung Electronics + * Lukasz Majewski <l.majewski@samsung.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <pmic.h> +#include <max8997_pmic.h> + +int voltage_to_reg(int uV) +{ + unsigned char ret; + if (uV <= 800000) + return 0; + if (uV >= 3950000) + return 0x3f; + ret = (uV - 800000) / 50000; + if (ret > 0x3f) { + printf("MAX8997 LDO SETTING ERROR (%duV) -> %u\n", uV, ret); + ret = 0x3f; + } + + return ret; +} + +int pmic_init(void) +{ + struct pmic *p = get_pmic(); + static const char name[] = "MAX8997_PMIC"; + + puts("Board PMIC init\n"); + + p->name = name; + p->interface = PMIC_I2C; + p->number_of_regs = PMIC_NUM_OF_REGS; + p->hw.i2c.addr = MAX8997_I2C_ADDR; + p->hw.i2c.tx_num = 1; + p->bus = I2C_PMIC; + p->voltage_to_reg_conv = voltage_to_reg; + + return 0; +} diff --git a/include/max8997_pmic.h b/include/max8997_pmic.h new file mode 100644 index 0000000..17ae24e --- /dev/null +++ b/include/max8997_pmic.h @@ -0,0 +1,190 @@ +/* + * Copyright (C) 2011 Samsung Electronics + * Lukasz Majewski <l.majewski@samsung.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __MAX8997_PMIC_H_ +#define __MAX8997_PMIC_H_ + +/* MAX 8997 registers */ +enum { + MAX8997_REG_PMIC_ID0 = 0x00, + MAX8997_REG_PMIC_ID1 = 0x01, + MAX8997_REG_INTSRC = 0x02, + MAX8997_REG_INT1 = 0x03, + MAX8997_REG_INT2 = 0x04, + MAX8997_REG_INT3 = 0x05, + MAX8997_REG_INT4 = 0x06, + + MAX8997_REG_INT1MSK = 0x08, + MAX8997_REG_INT2MSK = 0x09, + MAX8997_REG_INT3MSK = 0x0a, + MAX8997_REG_INT4MSK = 0x0b, + + MAX8997_REG_STATUS1 = 0x0d, + MAX8997_REG_STATUS2 = 0x0e, + MAX8997_REG_STATUS3 = 0x0f, + MAX8997_REG_STATUS4 = 0x10, + + MAX8997_REG_MAINCON1 = 0x13, + MAX8997_REG_MAINCON2 = 0x14, + MAX8997_REG_BUCKRAMP = 0x15, + + MAX8997_REG_BUCK1CTRL = 0x18, + MAX8997_REG_BUCK1DVS1 = 0x19, + MAX8997_REG_BUCK1DVS2 = 0x1a, + MAX8997_REG_BUCK1DVS3 = 0x1b, + MAX8997_REG_BUCK1DVS4 = 0x1c, + MAX8997_REG_BUCK1DVS5 = 0x1d, + MAX8997_REG_BUCK1DVS6 = 0x1e, + MAX8997_REG_BUCK1DVS7 = 0x1f, + MAX8997_REG_BUCK1DVS8 = 0x20, + MAX8997_REG_BUCK2CTRL = 0x21, + MAX8997_REG_BUCK2DVS1 = 0x22, + MAX8997_REG_BUCK2DVS2 = 0x23, + MAX8997_REG_BUCK2DVS3 = 0x24, + MAX8997_REG_BUCK2DVS4 = 0x25, + MAX8997_REG_BUCK2DVS5 = 0x26, + MAX8997_REG_BUCK2DVS6 = 0x27, + MAX8997_REG_BUCK2DVS7 = 0x28, + MAX8997_REG_BUCK2DVS8 = 0x29, + MAX8997_REG_BUCK3CTRL = 0x2a, + MAX8997_REG_BUCK3DVS = 0x2b, + MAX8997_REG_BUCK4CTRL = 0x2c, + MAX8997_REG_BUCK4DVS = 0x2d, + MAX8997_REG_BUCK5CTRL = 0x2e, + MAX8997_REG_BUCK5DVS1 = 0x2f, + MAX8997_REG_BUCK5DVS2 = 0x30, + MAX8997_REG_BUCK5DVS3 = 0x31, + MAX8997_REG_BUCK5DVS4 = 0x32, + MAX8997_REG_BUCK5DVS5 = 0x33, + MAX8997_REG_BUCK5DVS6 = 0x34, + MAX8997_REG_BUCK5DVS7 = 0x35, + MAX8997_REG_BUCK5DVS8 = 0x36, + MAX8997_REG_BUCK6CTRL = 0x37, + MAX8997_REG_BUCK6BPSKIPCTRL = 0x38, + MAX8997_REG_BUCK7CTRL = 0x39, + MAX8997_REG_BUCK7DVS = 0x3a, + MAX8997_REG_LDO1CTRL = 0x3b, + MAX8997_REG_LDO2CTRL = 0x3c, + MAX8997_REG_LDO3CTRL = 0x3d, + MAX8997_REG_LDO4CTRL = 0x3e, + MAX8997_REG_LDO5CTRL = 0x3f, + MAX8997_REG_LDO6CTRL = 0x40, + MAX8997_REG_LDO7CTRL = 0x41, + MAX8997_REG_LDO8CTRL = 0x42, + MAX8997_REG_LDO9CTRL = 0x43, + MAX8997_REG_LDO10CTRL = 0x44, + MAX8997_REG_LDO11CTRL = 0x45, + MAX8997_REG_LDO12CTRL = 0x46, + MAX8997_REG_LDO13CTRL = 0x47, + MAX8997_REG_LDO14CTRL = 0x48, + MAX8997_REG_LDO15CTRL = 0x49, + MAX8997_REG_LDO16CTRL = 0x4a, + MAX8997_REG_LDO17CTRL = 0x4b, + MAX8997_REG_LDO18CTRL = 0x4c, + MAX8997_REG_LDO21CTRL = 0x4d, + + MAX8997_REG_MBCCTRL1 = 0x50, + MAX8997_REG_MBCCTRL2 = 0x51, + MAX8997_REG_MBCCTRL3 = 0x52, + MAX8997_REG_MBCCTRL4 = 0x53, + MAX8997_REG_MBCCTRL5 = 0x54, + MAX8997_REG_MBCCTRL6 = 0x55, + MAX8997_REG_OTPCGHCVS = 0x56, + + MAX8997_REG_SAFEOUTCTRL = 0x5a, + + MAX8997_REG_LBCNFG1 = 0x5e, + MAX8997_REG_LBCNFG2 = 0x5f, + MAX8997_REG_BBCCTRL = 0x60, + + MAX8997_REG_FLASH1_CUR = 0x63, /* 0x63 ~ 0x6e for FLASH */ + MAX8997_REG_FLASH2_CUR = 0x64, + MAX8997_REG_MOVIE_CUR = 0x65, + MAX8997_REG_GSMB_CUR = 0x66, + MAX8997_REG_BOOST_CNTL = 0x67, + MAX8997_REG_LEN_CNTL = 0x68, + MAX8997_REG_FLASH_CNTL = 0x69, + MAX8997_REG_WDT_CNTL = 0x6a, + MAX8997_REG_MAXFLASH1 = 0x6b, + MAX8997_REG_MAXFLASH2 = 0x6c, + MAX8997_REG_FLASHSTATUS = 0x6d, + MAX8997_REG_FLASHSTATUSMASK = 0x6e, + + MAX8997_REG_GPIOCNTL1 = 0x70, + MAX8997_REG_GPIOCNTL2 = 0x71, + MAX8997_REG_GPIOCNTL3 = 0x72, + MAX8997_REG_GPIOCNTL4 = 0x73, + MAX8997_REG_GPIOCNTL5 = 0x74, + MAX8997_REG_GPIOCNTL6 = 0x75, + MAX8997_REG_GPIOCNTL7 = 0x76, + MAX8997_REG_GPIOCNTL8 = 0x77, + MAX8997_REG_GPIOCNTL9 = 0x78, + MAX8997_REG_GPIOCNTL10 = 0x79, + MAX8997_REG_GPIOCNTL11 = 0x7a, + MAX8997_REG_GPIOCNTL12 = 0x7b, + + MAX8997_REG_LDO1CONFIG = 0x80, + MAX8997_REG_LDO2CONFIG = 0x81, + MAX8997_REG_LDO3CONFIG = 0x82, + MAX8997_REG_LDO4CONFIG = 0x83, + MAX8997_REG_LDO5CONFIG = 0x84, + MAX8997_REG_LDO6CONFIG = 0x85, + MAX8997_REG_LDO7CONFIG = 0x86, + MAX8997_REG_LDO8CONFIG = 0x87, + MAX8997_REG_LDO9CONFIG = 0x88, + MAX8997_REG_LDO10CONFIG = 0x89, + MAX8997_REG_LDO11CONFIG = 0x8a, + MAX8997_REG_LDO12CONFIG = 0x8b, + MAX8997_REG_LDO13CONFIG = 0x8c, + MAX8997_REG_LDO14CONFIG = 0x8d, + MAX8997_REG_LDO15CONFIG = 0x8e, + MAX8997_REG_LDO16CONFIG = 0x8f, + MAX8997_REG_LDO17CONFIG = 0x90, + MAX8997_REG_LDO18CONFIG = 0x91, + MAX8997_REG_LDO21CONFIG = 0x92, + + MAX8997_REG_DVSOKTIMER1 = 0x97, + MAX8997_REG_DVSOKTIMER2 = 0x98, + MAX8997_REG_DVSOKTIMER4 = 0x99, + MAX8997_REG_DVSOKTIMER5 = 0x9a, + + PMIC_NUM_OF_REGS = 0x9b, +}; + +#define ENSAFEOUT1 (1 << 6) +#define ENSAFEOUT2 (1 << 7) + +#define MAX8997_I2C_ADDR (0xCC >> 1) +#define MAX8997_RTC_ADDR (0x0C >> 1) +#define MAX8997_MUIC_ADDR (0x4A >> 1) +#define MAX8997_FG_ADDR (0x6C >> 1) + +enum { + LDO_OFF = 0, + LDO_ON = 1, + + DIS_LDO = (0x00 << 6), + EN_LDO = (0x3 << 6), +}; + +#endif /* __MAX8997_PMIC_H_ */ -- 1.7.2.3 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH 3/3] misc:pmic:samsung Convert TRATS target to use MAX8997 instead of MAX8998 2012-03-28 8:45 [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function Lukasz Majewski 2012-03-28 8:45 ` [U-Boot] [PATCH 2/3] misc:pmic:max8997 MAX8997 support for PMIC driver Lukasz Majewski @ 2012-03-28 8:45 ` Lukasz Majewski 2012-03-28 10:19 ` Minkyu Kang 2012-03-28 10:26 ` [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function Stefano Babic 2 siblings, 1 reply; 11+ messages in thread From: Lukasz Majewski @ 2012-03-28 8:45 UTC (permalink / raw) To: u-boot TRATS target uses MAX8997 PMIC device instead of MAX8998. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Minkyu Kang <mk7.kang@samsung.com> Cc: Stefano Babic <sbabic@denx.de> --- board/samsung/trats/trats.c | 27 ++++++++++----------------- include/configs/trats.h | 2 +- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c index aa4291d..a7b4e4a 100644 --- a/board/samsung/trats/trats.c +++ b/board/samsung/trats/trats.c @@ -32,7 +32,7 @@ #include <asm/arch/power.h> #include <pmic.h> #include <usb/s3c_udc.h> -#include <max8998_pmic.h> +#include <max8997_pmic.h> #include "setup.h" @@ -216,26 +216,19 @@ static int s5pc210_phy_control(int on) return -1; if (on) { - ret |= pmic_set_output(p, - MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, - MAX8998_SAFEOUT1, LDO_ON); - ret |= pmic_set_output(p, MAX8998_REG_ONOFF1, - MAX8998_LDO3, LDO_ON); - ret |= pmic_set_output(p, MAX8998_REG_ONOFF2, - MAX8998_LDO8, LDO_ON); - + ret |= pmic_set_output(p, MAX8997_REG_SAFEOUTCTRL, + ENSAFEOUT1, LDO_ON); + ret |= pmic_reg_write(p, MAX8997_REG_LDO3CTRL, EN_LDO); + ret |= pmic_reg_write(p, MAX8997_REG_LDO8CTRL, EN_LDO); } else { - ret |= pmic_set_output(p, MAX8998_REG_ONOFF2, - MAX8998_LDO8, LDO_OFF); - ret |= pmic_set_output(p, MAX8998_REG_ONOFF1, - MAX8998_LDO3, LDO_OFF); - ret |= pmic_set_output(p, - MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, - MAX8998_SAFEOUT1, LDO_OFF); + ret |= pmic_reg_write(p, MAX8997_REG_LDO8CTRL, DIS_LDO); + ret |= pmic_reg_write(p, MAX8997_REG_LDO3CTRL, DIS_LDO); + ret |= pmic_set_output(p, MAX8997_REG_SAFEOUTCTRL, + ENSAFEOUT1, LDO_OFF); } if (ret) { - puts("MAX8998 LDO setting error!\n"); + puts("MAX8997 LDO setting error!\n"); return -1; } diff --git a/include/configs/trats.h b/include/configs/trats.h index 10f11d9..585fd71 100644 --- a/include/configs/trats.h +++ b/include/configs/trats.h @@ -208,7 +208,7 @@ #define CONFIG_PMIC #define CONFIG_PMIC_I2C -#define CONFIG_PMIC_MAX8998 +#define CONFIG_PMIC_MAX8997 #define CONFIG_USB_GADGET #define CONFIG_USB_GADGET_S3C_UDC_OTG -- 1.7.2.3 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH 3/3] misc:pmic:samsung Convert TRATS target to use MAX8997 instead of MAX8998 2012-03-28 8:45 ` [U-Boot] [PATCH 3/3] misc:pmic:samsung Convert TRATS target to use MAX8997 instead of MAX8998 Lukasz Majewski @ 2012-03-28 10:19 ` Minkyu Kang 0 siblings, 0 replies; 11+ messages in thread From: Minkyu Kang @ 2012-03-28 10:19 UTC (permalink / raw) To: u-boot On 28 March 2012 17:45, Lukasz Majewski <l.majewski@samsung.com> wrote: > TRATS target uses MAX8997 PMIC device instead of MAX8998. > > Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> > Cc: Minkyu Kang <mk7.kang@samsung.com> > Cc: Stefano Babic <sbabic@denx.de> > --- > ?board/samsung/trats/trats.c | ? 27 ++++++++++----------------- > ?include/configs/trats.h ? ? | ? ?2 +- > ?2 files changed, 11 insertions(+), 18 deletions(-) > Acked-by: Minkyu Kang <mk7.kang@samsung.com> -- from. prom. www.promsoft.net ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function 2012-03-28 8:45 [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function Lukasz Majewski 2012-03-28 8:45 ` [U-Boot] [PATCH 2/3] misc:pmic:max8997 MAX8997 support for PMIC driver Lukasz Majewski 2012-03-28 8:45 ` [U-Boot] [PATCH 3/3] misc:pmic:samsung Convert TRATS target to use MAX8997 instead of MAX8998 Lukasz Majewski @ 2012-03-28 10:26 ` Stefano Babic 2012-03-28 11:26 ` Lukasz Majewski 2 siblings, 1 reply; 11+ messages in thread From: Stefano Babic @ 2012-03-28 10:26 UTC (permalink / raw) To: u-boot On 28/03/2012 10:45, Lukasz Majewski wrote: > Support for voltage (in uV) to proper register value is added. > The function tied to this callback is often PMIC dependent > and shall be defined for each device. > > Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> > Cc: Stefano Babic <sbabic@denx.de> > --- Hi Lukasz, > > +int pmic_vol_to_reg(struct pmic *p, int uV) You added a new entry point to pmic, but you do not use it...I have not found in your patchset why it is necessary for you. I am not sure if we require to add this to the PMIC API or hide in the pmic specific code. Other PMICs has not a a register for different voltages, but only a bit inside the same register (this is the case for the Freescale's PMICs we currently support in u-boot). Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de ===================================================================== ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function 2012-03-28 10:26 ` [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function Stefano Babic @ 2012-03-28 11:26 ` Lukasz Majewski 2012-03-28 11:41 ` Stefano Babic 0 siblings, 1 reply; 11+ messages in thread From: Lukasz Majewski @ 2012-03-28 11:26 UTC (permalink / raw) To: u-boot Hi Stefano, On Wed, 28 Mar 2012 12:26:46 +0200 Stefano Babic <sbabic@denx.de> wrote: > On 28/03/2012 10:45, Lukasz Majewski wrote: > > Support for voltage (in uV) to proper register value is added. > > The function tied to this callback is often PMIC dependent > > and shall be defined for each device. > > > > Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> > > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> > > Cc: Stefano Babic <sbabic@denx.de> > > --- > > Hi Lukasz, > > > > > +int pmic_vol_to_reg(struct pmic *p, int uV) > > You added a new entry point to pmic, but you do not use it...I have > not found in your patchset why it is necessary for you. > Rationale for this change is in commits following this one. For trats Samsung target it is necessary to change the default voltage. I think, that providing access to such a function as a pointer is the best possible solution. For example the MAX8997 and MAX8998 PMICs have different way of calculating the value, which represents the LDO output value. > I am not sure if we require to add this to the PMIC API or hide in the > pmic specific code. Other PMICs has not a a register for different > voltages, but only a bit inside the same register (this is the case > for the Freescale's PMICs we currently support in u-boot). I think, that it is easier to define function pointer in the pmic structure, than separate functions and handling them in target platform data. > Best regards, > Stefano Babic > -- Best regards, Lukasz Majewski Samsung Poland R&D Center Platform Group ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function 2012-03-28 11:26 ` Lukasz Majewski @ 2012-03-28 11:41 ` Stefano Babic [not found] ` <20120328143820.44ca652c@lmajewski.digital.local> 0 siblings, 1 reply; 11+ messages in thread From: Stefano Babic @ 2012-03-28 11:41 UTC (permalink / raw) To: u-boot On 28/03/2012 13:26, Lukasz Majewski wrote: Hi Lukasz, >> >>> >>> +int pmic_vol_to_reg(struct pmic *p, int uV) >> >> You added a new entry point to pmic, but you do not use it...I have >> not found in your patchset why it is necessary for you. >> > > Rationale for this change is in commits following this one. > For trats Samsung target it is necessary to change the default voltage. Yes, I was expecting that you call pmic_vol_to_reg() in your following patches, but I cannot find it. Am I missing something ? > > I think, that providing access to such a function as a pointer is the > best possible solution. > > For example the MAX8997 and MAX8998 PMICs have different way of > calculating the value, which represents the LDO output value. > > >> I am not sure if we require to add this to the PMIC API or hide in the >> pmic specific code. Other PMICs has not a a register for different >> voltages, but only a bit inside the same register (this is the case >> for the Freescale's PMICs we currently support in u-boot). > > I think, that it is easier to define function pointer in the pmic > structure, than separate functions and handling them in target platform > data. Ok, understood. Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de ===================================================================== ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20120328143820.44ca652c@lmajewski.digital.local>]
* [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function [not found] ` <20120328143820.44ca652c@lmajewski.digital.local> @ 2012-03-28 12:50 ` Stefano Babic 2012-03-28 13:13 ` Lukasz Majewski 0 siblings, 1 reply; 11+ messages in thread From: Stefano Babic @ 2012-03-28 12:50 UTC (permalink / raw) To: u-boot On 28/03/2012 14:38, Lukasz Majewski wrote: > Hi Stefano, > Hi Lucasz, > I've already forwarded those patches to you. > They are also available on the mailing list, so I don't know what has > happened. Really nothing, I got all e-mails, I was only not able to explain my doubt. I try again: - In patch 1/3 you add voltage_to_reg to the pmic struct ==> Ok - in patch 2/3 you add voltage_to_reg to MAX8997. ==> Ok Everything clear. The consequence for me is that PATCH 3/3 shows the reason to add voltage_to_reg(), and calls the new function pmic_vol_to_reg(), because you need it, as you have already explained. But I see only pmic_set_output() and pmic_reg_write() in your patch. What have I not yet understood ? (maybe I need a coffe to wake up my brain...) Stefano -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de ===================================================================== ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function 2012-03-28 12:50 ` Stefano Babic @ 2012-03-28 13:13 ` Lukasz Majewski 2012-03-28 14:43 ` Stefano Babic 0 siblings, 1 reply; 11+ messages in thread From: Lukasz Majewski @ 2012-03-28 13:13 UTC (permalink / raw) To: u-boot On Wed, 28 Mar 2012 14:50:35 +0200 Stefano Babic <sbabic@denx.de> wrote: > On 28/03/2012 14:38, Lukasz Majewski wrote: > > > Hi Stefano, > > > > Hi Lucasz, > > > I've already forwarded those patches to you. > > They are also available on the mailing list, so I don't know what > > has happened. > > Really nothing, I got all e-mails, I was only not able to explain my > doubt. I try again: > > - In patch 1/3 you add voltage_to_reg to the pmic struct > ==> Ok > - in patch 2/3 you add voltage_to_reg to MAX8997. > ==> Ok > > Everything clear. > > The consequence for me is that PATCH 3/3 shows the reason to add > voltage_to_reg(), and calls the new function pmic_vol_to_reg(), > because you need it, as you have already explained. But I see only > pmic_set_output() and pmic_reg_write() in your patch. > > Stefano > Hi Stefano, I've looked on patches which I've posted and for patches from 1 do 3 there isn't usage for this function. However I'm using this functionality in a code on which I'm working on (Trats), so posting it to the list is only a matter of time. > What have I not yet understood ? (maybe I need a coffe to wake up my > brain...) You understood everything :-), it was my fault. I thought, that patches 2/3 and 3/3 were missing (or by some mishap I didn't send them properly). Now, I think, that everything is clear. -- Best regards, Lukasz Majewski Samsung Poland R&D Center Platform Group ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function 2012-03-28 13:13 ` Lukasz Majewski @ 2012-03-28 14:43 ` Stefano Babic 2012-03-29 7:39 ` Lukasz Majewski 0 siblings, 1 reply; 11+ messages in thread From: Stefano Babic @ 2012-03-28 14:43 UTC (permalink / raw) To: u-boot On 28/03/2012 15:13, Lukasz Majewski wrote: > Hi Stefano, > Hi Lucasz, > I've looked on patches which I've posted and for patches from 1 do > 3 there isn't usage for this function. > > However I'm using this functionality in a code on which I'm working on > (Trats), so posting it to the list is only a matter of time. ok, understood. Then I will suggest you resubmit patches 1 and 2 with your work on Trats, because the patches belong together and they should be in the same patchset. And Patch 3 can be already applied as it is, because it has no dependecies with the other ones. > Now, I think, that everything is clear. Yes, everythg clear ;-) Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de ===================================================================== ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function 2012-03-28 14:43 ` Stefano Babic @ 2012-03-29 7:39 ` Lukasz Majewski 0 siblings, 0 replies; 11+ messages in thread From: Lukasz Majewski @ 2012-03-29 7:39 UTC (permalink / raw) To: u-boot Hi Stefano, On Wed, 28 Mar 2012 16:43:51 +0200 Stefano Babic <sbabic@denx.de> wrote: > ok, understood. Then I will suggest you resubmit patches 1 and 2 with > your work on Trats, because the patches belong together and they > should be in the same patchset. Hmm, I'm not the only one who is working on this board. Moreover some other targets are using this PMIC as well :-). > And Patch 3 can be already applied as it is, because it has no > dependecies with the other ones. The patch 3/3 depends on patch 2, which defines data for MAX8997 PMIC. And patch 2 depends on patch 1, since patch 1 provides: + int (*voltage_to_reg_conv) (int uV); which function is defined in patch 2 :-). -- Best regards, Lukasz Majewski Samsung Poland R&D Center Platform Group ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-03-29 7:39 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-28 8:45 [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function Lukasz Majewski
2012-03-28 8:45 ` [U-Boot] [PATCH 2/3] misc:pmic:max8997 MAX8997 support for PMIC driver Lukasz Majewski
2012-03-28 8:45 ` [U-Boot] [PATCH 3/3] misc:pmic:samsung Convert TRATS target to use MAX8997 instead of MAX8998 Lukasz Majewski
2012-03-28 10:19 ` Minkyu Kang
2012-03-28 10:26 ` [U-Boot] [PATCH 1/3] misc:pmic: Support for voltage to register value conversion function Stefano Babic
2012-03-28 11:26 ` Lukasz Majewski
2012-03-28 11:41 ` Stefano Babic
[not found] ` <20120328143820.44ca652c@lmajewski.digital.local>
2012-03-28 12:50 ` Stefano Babic
2012-03-28 13:13 ` Lukasz Majewski
2012-03-28 14:43 ` Stefano Babic
2012-03-29 7:39 ` Lukasz Majewski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox