public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] power: add PFUZE100 PMIC driver
Date: Mon, 03 Feb 2014 13:05:14 +0100	[thread overview]
Message-ID: <52EF85FA.4040302@denx.de> (raw)
In-Reply-To: <1391284192-8440-2-git-send-email-tharvey@gateworks.com>

Hi Tim,

On 01/02/2014 20:49, Tim Harvey wrote:
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  drivers/power/pmic/Makefile        |  1 +
>  drivers/power/pmic/pmic_pfuze100.c | 42 +++++++++++++++++
>  include/power/pfuze100_pmic.h      | 96 ++++++++++++++++++++++++++++++++++++++
>  3 files changed, 139 insertions(+)
>  create mode 100644 drivers/power/pmic/pmic_pfuze100.c
>  create mode 100644 include/power/pfuze100_pmic.h
> 
> diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
> index 0b45ffa..4129bda 100644
> --- a/drivers/power/pmic/Makefile
> +++ b/drivers/power/pmic/Makefile
> @@ -9,5 +9,6 @@ obj-$(CONFIG_POWER_MAX8998) += pmic_max8998.o
>  obj-$(CONFIG_POWER_MAX8997) += pmic_max8997.o
>  obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
>  obj-$(CONFIG_POWER_MAX77686) += pmic_max77686.o
> +obj-$(CONFIG_POWER_PFUZE100) += pmic_pfuze100.o
>  obj-$(CONFIG_POWER_TPS65217) += pmic_tps65217.o
>  obj-$(CONFIG_POWER_TPS65910) += pmic_tps65910.o
> diff --git a/drivers/power/pmic/pmic_pfuze100.c b/drivers/power/pmic/pmic_pfuze100.c
> new file mode 100644
> index 0000000..c382921
> --- /dev/null
> +++ b/drivers/power/pmic/pmic_pfuze100.c
> @@ -0,0 +1,42 @@
> +/*
> + * Copyright (C) 2014 Gateworks Corporation
> + * Tim Harvey <tharvey@gateworks.com>
> + *
> + * SPDX-License-Identifier:      GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <errno.h>
> +#include <i2c.h>
> +#include <power/pmic.h>
> +#include <power/pfuze100_pmic.h>
> +
> +int pmic_init(unsigned char bus)
> +{
> +	static const char name[] = "PFUZE100_PMIC";
> +	int ret;
> +	struct pmic *p = pmic_alloc();
> +
> +	if (!p) {
> +		printf("%s: POWER allocation error!\n", __func__);
> +		return -ENOMEM;
> +	}
> +
> +	p->name = name;
> +	p->interface = PMIC_I2C;
> +	p->number_of_regs = PMIC_NUM_OF_REGS;
> +	p->hw.i2c.addr = CONFIG_POWER_PFUZE100_I2C_ADDR;
> +	p->hw.i2c.tx_num = 1;
> +	p->bus = bus;
> +
> +	ret = i2c_set_bus_num(p->bus);
> +	if (ret)
> +		return ret;
> +	if (!i2c_probe(p->hw.i2c.addr)) {
> +		unsigned char dev_id, rev_id;
> +		i2c_read(p->hw.i2c.addr, PFUZE100_DEVICEID, 1, &dev_id, 1);
> +		i2c_read(p->hw.i2c.addr, PFUZE100_REVID, 1, &rev_id, 1);
> +		printf("PMIC:  PFUZE100 0x%02x/0x%02x\n", dev_id, rev_id);

This is always printed, not only on your board - even from other board,
if any, that will use this pmic. If you want that your board always
prints the pmic revision, move this output to your board file - maybe in
checkboard().

> +	}
> +	return 0;

If i2c_probe() returns with error, why does this function returns with
zero (= no error) ?

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
=====================================================================

  reply	other threads:[~2014-02-03 12:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-01 19:49 [U-Boot] [PATCH 0/2] IMX6: Add Gateworks Ventana support Tim Harvey
2014-02-01 19:49 ` [U-Boot] [PATCH 1/2] power: add PFUZE100 PMIC driver Tim Harvey
2014-02-03 12:05   ` Stefano Babic [this message]
2014-02-03 19:30     ` Tim Harvey
2014-02-04  9:04       ` Stefano Babic
2014-02-03 19:34   ` Michael Trimarchi
2014-02-01 19:49 ` [U-Boot] [PATCH 2/2] ventana: Add Gateworks Ventana family support Tim Harvey
2014-02-03 17:39   ` Stefano Babic
2014-02-05  8:17     ` Tim Harvey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52EF85FA.4040302@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox