The first releases of LP3974 have a large delay in RTC registers, which requires 2 seconds of delay after writing to a rtc register (recommended by National Semiconductor's engineers) before reading it. If "rtc_delay" field of the platform data is true, the rtc driver assumes that such delays are required. Although we have not seen LP3974s without requiring such delays, we assume that such LP3974s will be released soon (or they have done so already) and they are supported by "lp3974" without setting "rtc_delay" at the platform data. This patch adds delays with msleep when writing values to RTC registers if the platform data has rtc_delay set. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
98 lines
2.8 KiB
C
98 lines
2.8 KiB
C
/*
|
|
* max8998.h - Voltage regulator driver for the Maxim 8998
|
|
*
|
|
* Copyright (C) 2009-2010 Samsung Electrnoics
|
|
* Kyungmin Park <kyungmin.park@samsung.com>
|
|
* Marek Szyprowski <m.szyprowski@samsung.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; 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 __LINUX_MFD_MAX8998_H
|
|
#define __LINUX_MFD_MAX8998_H
|
|
|
|
#include <linux/regulator/machine.h>
|
|
|
|
/* MAX 8998 regulator ids */
|
|
enum {
|
|
MAX8998_LDO2 = 2,
|
|
MAX8998_LDO3,
|
|
MAX8998_LDO4,
|
|
MAX8998_LDO5,
|
|
MAX8998_LDO6,
|
|
MAX8998_LDO7,
|
|
MAX8998_LDO8,
|
|
MAX8998_LDO9,
|
|
MAX8998_LDO10,
|
|
MAX8998_LDO11,
|
|
MAX8998_LDO12,
|
|
MAX8998_LDO13,
|
|
MAX8998_LDO14,
|
|
MAX8998_LDO15,
|
|
MAX8998_LDO16,
|
|
MAX8998_LDO17,
|
|
MAX8998_BUCK1,
|
|
MAX8998_BUCK2,
|
|
MAX8998_BUCK3,
|
|
MAX8998_BUCK4,
|
|
MAX8998_EN32KHZ_AP,
|
|
MAX8998_EN32KHZ_CP,
|
|
MAX8998_ENVICHG,
|
|
MAX8998_ESAFEOUT1,
|
|
MAX8998_ESAFEOUT2,
|
|
};
|
|
|
|
/**
|
|
* max8998_regulator_data - regulator data
|
|
* @id: regulator id
|
|
* @initdata: regulator init data (contraints, supplies, ...)
|
|
*/
|
|
struct max8998_regulator_data {
|
|
int id;
|
|
struct regulator_init_data *initdata;
|
|
};
|
|
|
|
/**
|
|
* struct max8998_board - packages regulator init data
|
|
* @regulators: array of defined regulators
|
|
* @num_regulators: number of regultors used
|
|
* @irq_base: base IRQ number for max8998, required for IRQs
|
|
* @ono: power onoff IRQ number for max8998
|
|
* @buck1_max_voltage1: BUCK1 maximum alowed voltage register 1
|
|
* @buck1_max_voltage2: BUCK1 maximum alowed voltage register 2
|
|
* @buck2_max_voltage: BUCK2 maximum alowed voltage
|
|
* @buck1_set1: BUCK1 gpio pin 1 to set output voltage
|
|
* @buck1_set2: BUCK1 gpio pin 2 to set output voltage
|
|
* @buck2_set3: BUCK2 gpio pin to set output voltage
|
|
* @wakeup: Allow to wake up from suspend
|
|
* @rtc_delay: LP3974 RTC chip bug that requires delay after a register
|
|
* write before reading it.
|
|
*/
|
|
struct max8998_platform_data {
|
|
struct max8998_regulator_data *regulators;
|
|
int num_regulators;
|
|
int irq_base;
|
|
int ono;
|
|
int buck1_max_voltage1;
|
|
int buck1_max_voltage2;
|
|
int buck2_max_voltage;
|
|
int buck1_set1;
|
|
int buck1_set2;
|
|
int buck2_set3;
|
|
bool wakeup;
|
|
bool rtc_delay;
|
|
};
|
|
|
|
#endif /* __LINUX_MFD_MAX8998_H */
|