The regmap_config struct may be const because it is not modified by the
driver and regmap_init() accepts pointer to const.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
This patch adds IRQF_ONESHOT flag to max17042's irq since it uses primary
default handler. Without this flag, requesting irq will be denied with
returning error.
Signed-off-by: Jonghwa Lee <[email protected]>
Signed-off-by: MyungJoo Ham <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
This patch makes max17042 fuelguage driver uses regmap API to access its
device's registers.
Signed-off-by: Jonghwa Lee <[email protected]>
Signed-off-by: Myungjoo Ham <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
Use the SIMPLE_DEV_PM_OPS macro to declare the driver's pm_ops.
Signed-off-by: Manish Badarkhe <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
The merge is merely to fix conflicts before sending a pull request.
Conflicts:
drivers/power/ab8500_btemp.c
drivers/power/ab8500_charger.c
drivers/power/ab8500_fg.c
drivers/power/abx500_chargalg.c
drivers/power/max8925_power.c
Signed-off-by: Anton Vorontsov <[email protected]>
The second error check is unreachable because the lock function isn't
assigned to ret.
Signed-off-by: Alan Cox <[email protected]>
Acked-by: Ramakrishna Pallala <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
This patch adds the support for CHARGE_COUNTER power supply attribute
to max17042/47 driver.
Note:QH(Charge Counter) register is not documented in max17042 the Spec.
Signed-off-by: Ramakrishna Pallala <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
max17047 is improved version of max17042 chip. It has few HW bug
fixes with minor changes in register set.
max17050 is same as max17047 chip except its silicon packging. So from
driver's point of view there is no difference btw max1047 and max1050.
This patch adds the support to dynamically detect the chip type and
adds steps to initialize the max17047 chip.
Signed-off-by: Ramakrishna Pallala <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
suspend/resume functions take action based upon the fuel gauge
interrupt. If the rquest irq fails we should assign 0 to client->irq.
Signed-off-by: Ramakrishna Pallala <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
IRQ registration should happen only after power supply object usable.
This patch fixes the ordering of power supply and irq registration
calls.
Signed-off-by: Ramakrishna Pallala <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
This adds a new sysfs file called 'voltage_ocv' which gives the
Open Circuit Voltage of the battery.
This property can be used for platform shutdown policies and
can be useful for initial capacity estimations.
Note: This patch is generated against linux-next branch.
Signed-off-by: Ramakrishna Pallala <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
This is what we do for the rest of the drivers, saves some bytes.
Plus a small style change while at it.
Signed-off-by: Anton Vorontsov <[email protected]>
This patch adds suspend/resume methods to the driver.
In suspend method irq line is disabled to avoid i2c
read/write errors from the interrupt handler as the
i2c bus itself could be in suspend state.
In resume function irq line will be re-enabled.
Signed-off-by: Ramakrishna Pallala <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
This patch fixes driver's remove function: it should free the IRQ.
Signed-off-by: Ramakrishna Pallala <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
There are a couple issues here caused by confusion between sizeof()
and ARRAY_SIZE(). "table_size" should be the number of elements, but we
should allocate it with kcalloc() so that we allocate the correct number
of bytes.
In max17042_init_model() we don't allocate enough space so we go past
the end of the array in max17042_read_model_data() and
max17042_model_data_compare().
In max17042_verify_model_lock() we allocate the right amount of space
but we call max17042_read_model_data() with the wrong number of elements
and also in the for loop we go past the end of the array.
Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Dirk Brandewie <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
Max17042 driver has dummy hardIRQ function which
does nothing but waking the threaded handler.
This patch removes the hardIRQ function and also
modifies the interrupt type to falling edge. While
we are there, change the macros to comply with the
Data sheet.
Signed-off-by: Ramakrishna Pallala <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
CHARGE_FULL should represent the full capacity of the battery in uAh.
The 0x10 (FullCAP) register shows the compensated full capacity in
mAh * 2; e.g., reg(0x10) = 0xBB8 means that it is 1500mAh.
Signed-off-by: MyungJoo Ham <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
Allow both device tree (preferred) and platform data-based driver
instantiation.
Signed-off-by: Karol Lewandowski <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
This allows us to simplify probe and exit function.
Signed-off-by: Karol Lewandowski <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
The SOC register (0dh) reports the state of charge before empty
compensation adjustments are applied. The max value reported by this
register will decrease as the battery ages.
Use the RepSOC register (06h) to report the capacity of the
battery. RepSOC contains a filtered version of the battery capacity
after empty compensation adjustments have been applied.
Reported-by: Gary Keyes <[email protected]>
Signed-off-by: Dirk Brandewie <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
If platform has the alert pin attached to an interrupt source have the
driver signal a change in the SOC every 1 percent.
Signed-off-by: Ramakrishna Pallala <[email protected]>
Signed-off-by: Dirk Brandewie <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
Add power on reset (POR) init procedure defined by the maxim
appnote. Using this procedure ensures that the part is
configured/initialized correctly at POR and improves early accuracy of
the fuel gauge and informs the fuel gauge with the battery
characterization parameters. The battery characterization parameters
come from the maxim characterization procedure.
Signed-off-by: Ramakrishna Pallala <[email protected]>
Signed-off-by: Dirk Brandewie <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
In max17042_get_property(...), the values returned by
max17042_read_reg are directly assigned to the variables,
even if the read results in an error.
This patch checks for the return code from max17042_read_reg and
exits the function if there is any error.
Signed-off-by: Ramakrishna Pallala <[email protected]>
Acked-by: MyungJoo Ham <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
The module.h header is no longer going to be implicitly present
everywhere. So real modular users need to call out its use
explicitly in advance.
[v2: add new users reported by Randy Dunlap <[email protected]>]
Signed-off-by: Paul Gortmaker <[email protected]>
The calculation had error in getting voltage values from
MAX17042 registers. The least bit denotes 78.125uV (625/8).
Signed-off-by: MyungJoo Ham <[email protected]>
Signed-off-by: Philip Rakity <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
PROP_CURRENT_NOW value is first divided then multiplied up
causing a lose of accuracy. Use the same method as
PROP_CURRENT_AVG to do the calculation.
Signed-off-by: Philip Rakity <[email protected]>
Acked-by: MyungJoo Ham <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
On MMP2 brownstone divide by 0 error since probe sets r_sns
after calling power_supply_register.
Move the code up a few lines. r_sns comes from the platform
data.
PROP_CURRENT_AVG and PROP_CURRENT divide the result by r_sns.
Signed-off-by: Philip Rakity <[email protected]>
Acked-by: MyungJoo Ham <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
A few new i2c-drivers came into the kernel which clear the
clientdata-pointer on exit or error. This is obsolete meanwhile,
the core will do it.
Signed-off-by: Wolfram Sang <[email protected]>
Cc: MyungJoo Ham <[email protected]>
Cc: Kyungmin Park <[email protected]>
Acked-by: Jean Delvare <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
The MAX17042 is a fuel gauge with an I2C interface for lithium-ion
betteries. Unlike its predecessor MAX17040, MAX17042 uses 16bit
registers. Besides, MAX17042 has much more features than MAX17040; e.g.,
a thermistor, current and current accumulation measurement, battery
internal resistance estimate, average values of measurement, and others.
This patch implements a driver for MAX17042.
In this initial release, we have implemented the most basic features of
a fuel gauge: measure the battery capacity and voltage.
Signed-off-by: MyungJoo Ham <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>