public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Anuj Aggarwal <anuj.aggarwal@ti.com>
Cc: broonie@sirena.org.uk, lrg@slimlogic.co.uk,
	linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/8] Regulator: Add board-omap35x-pmic.c to arch/arm/mach-omap2/
Date: Mon, 10 Aug 2009 10:32:55 +0300	[thread overview]
Message-ID: <20090810073255.GG2358@atomide.com> (raw)
In-Reply-To: <1249658966-11062-1-git-send-email-anuj.aggarwal@ti.com>

* Anuj Aggarwal <anuj.aggarwal@ti.com> [090807 18:30]:
> Added arch/arm/mach-omap2/board-omap35x-pmic.c file which will
> have the board specific information for different regulators
> and will do the regulator initialization depending on the one
> which is available.
> 
> Signed-off-by: Anuj Aggarwal <anuj.aggarwal@ti.com>
> ---
>  arch/arm/mach-omap2/board-omap35x-pmic.c |  121 ++++++++++++++++++++++++++++++
>  1 files changed, 121 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/mach-omap2/board-omap35x-pmic.c
> 
> diff --git a/arch/arm/mach-omap2/board-omap35x-pmic.c b/arch/arm/mach-omap2/board-omap35x-pmic.c
> new file mode 100644
> index 0000000..11db66f
> --- /dev/null
> +++ b/arch/arm/mach-omap2/board-omap35x-pmic.c
> @@ -0,0 +1,121 @@
> +/*
> + * board-omap35x-pmic.c
> + *
> + * Board specific information for different regulators and platforms.
> + *
> + * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
> + *
> + * 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 version 2.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
> + * whether express or implied; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * General Public License for more details.
> + */
> +
> +#include <linux/regulator/driver.h>
> +#include <linux/regulator/machine.h>
> +#include <mach/common.h>
> +
> +/*
> + * Definitions specific to TWL4030
> + */
> +
> +/*
> + * Definitions specific to TPS6235x
> + */
> +
> +/*
> + * Definitions specific to TPS65023
> + */
> +
> +/*
> + * Definitions specific to TPS65073
> + */
> +
> +static int flag_pmic_twl4030;
> +static int flag_pmic_tps6235x;
> +static int flag_pmic_tps65023;
> +static int flag_pmic_tps65073;
> +
> +/*
> + * Detect the current PMIC, set one of the flags
> + */
> +static inline int detect_pmic(void)
> +{
> +#if defined(CONFIG_TWL4030_CORE)
> +	flag_pmic_twl4030 = 1;
> +#endif
> +
> +#if defined(CONFIG_OMAP3EVM_TPS6235X)
> +	flag_pmic_tps6235x = 1;
> +#endif
> +
> +#if defined(CONFIG_OMAP3EVM_TPS65023)
> +	flag_pmic_tps65023 = 1;
> +#endif
> +
> +#if defined(CONFIG_OMAP3EVM_TPS65073)
> +	flag_pmic_tps65073 = 1;
> +#endif
> +
> +	return 0;
> +}

This should be done without having to set the flags based on the
Kconfig. We already allow compiling all the boards into the same
kernel, and that should not be limited by device driver .config
options.

Please change this so you try to register various i2c devices,
and the one that does not fail is the PMIC you have.

Regards,

Tony


> +
> +/* Functions to detect which PMIC is present */
> +
> +int pmic_is_twl4030(void)
> +{
> +	return flag_pmic_twl4030;
> +}
> +
> +int pmic_is_tps6235x(void)
> +{
> +	return flag_pmic_tps6235x;
> +}
> +
> +int pmic_is_tps65020(void) { return 0; }
> +
> +int pmic_is_tps65021(void) { return 0; }
> +
> +int pmic_is_tps65022(void) { return 0; }
> +
> +int pmic_is_tps65023(void)
> +{
> +	return flag_pmic_tps65023;
> +}
> +
> +int pmic_is_tps65073(void)
> +{
> +	return flag_pmic_tps65073;
> +}
> +
> +int pmic_is_tps65950(void)
> +{
> +	return flag_pmic_twl4030;
> +}
> +
> +/* Detects the PMIC and initializes it accordingly */
> +int oma35x_pmic_init(void)
> +{
> +#if defined(CONFIG_TWL4030_CORE)
> +	/* do stuff specific to TWL4030 */
> +#endif
> +
> +#if defined(CONFIG_OMAP3EVM_TPS6235X)
> +	/* do stuff specific to TPS62350 */
> +#endif
> +
> +#if defined(CONFIG_OMAP3EVM_TPS65023)
> +	/* do stuff specific to TPS65023 */
> +#endif
> +
> +#if defined(CONFIG_OMAP3EVM_TPS65073)
> +	/* do stuff specific to TPS65073 */
> +#endif
> +
> +	return 0;
> +}
> +
> -- 
> 1.6.2.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2009-08-10  7:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07 15:29 [PATCH 6/8] Regulator: Add board-omap35x-pmic.c to arch/arm/mach-omap2/ Anuj Aggarwal
2009-08-08  7:41 ` Mark Brown
2009-08-10  7:32 ` Tony Lindgren [this message]

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=20090810073255.GG2358@atomide.com \
    --to=tony@atomide.com \
    --cc=anuj.aggarwal@ti.com \
    --cc=broonie@sirena.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    /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