Commit Graph

4 Commits

Author SHA1 Message Date
Dan Carpenter
8f8e9b7388 power: supply: mm8013: Fix an error checking issue in mm8013_checkdevice()
There is a missing "ret = " assignment so this checks the same "ret"
value twice.

Fixes: c75f4bf680 ("power: supply: Introduce MM8013 fuel gauge driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/c46b4408-bf1d-408d-9e6b-16b0ad272532@moroto.mountain
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-09-30 21:19:16 +02:00
Harshit Mogalapalli
43ee22422d power: supply: mm8013: Fix error code in mm8013_probe()
The value of ret is zero when passed to dev_error_probe(), we are passing
zero to dev_err_probe() is a success which is incorrect.

Fix this by getting the error code using PTR_ERR().

Fixes: c75f4bf680 ("power: supply: Introduce MM8013 fuel gauge driver")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202309190838.eu8WS6sz-lkp@intel.com/
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://lore.kernel.org/r/20230923114807.2829188-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-09-24 22:51:55 +02:00
Konrad Dybcio
e39257cde7 power: supply: mm8013: Add more properties
While scanning the internet for MM8013 PDFs, I found one for a different
IC from Mitsumi, MM8118 at [1]. It turned out however, that when you
search through the PDF, the MM8118 text has an invsible text layer
containing "MM8013" underneath..

With some elbow grease, I was able to confirm that most of the registers
match between the two ICs. Based on that finding, introduce live battery
voltage readout, hw-decided charge behavior readout and max current
readout. Also, expand the existing POWER_SUPPLY_HEALTH reporting.

[1] https://product.minebeamitsumi.com/en/product/category/ics/battery/fuel_gauge/parts/download/__icsFiles/afieldfile/2023/07/12/1_download_01_12.pdf

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230916-topic-mm8013_2-v1-1-02495e07fca0@linaro.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-09-17 00:42:12 +02:00
Konrad Dybcio
c75f4bf680 power: supply: Introduce MM8013 fuel gauge driver
Add a driver for the Mitsumi MM8013 fuel gauge. The driver is a vastly
cleaned up and improved version of the one that shipped in some obscure
Lenovo downstream kernel [1], with some register definitions borrowed from
ChromeOS EC platform code [2].

[1] b6b346427a
[2] https://chromium.googlesource.com/chromiumos/platform/ec/+/master/driver/battery/mm8013.h

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230621-topic-mm8013-v4-3-975aecd173ed@linaro.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-09-15 21:27:33 +02:00