Skip to contentSkip to conversation

drivers: power: Add support for BATTERY_ARIESVE

PATCH In review Balint Czobor 2 participants 2 messages Jul 24, 2013 – Aug 9, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 drivers: power: Add support for BATTERY_ARIESVE

Add initial support for the battery in Samsung ARIESVE.

---
 arch/arm/mach-msm/include/mach/msm_battery.h   |   31 +
 arch/arm/mach-msm/include/mach/msm_rpcrouter.h |  376 ++++
 drivers/power/Kconfig                          |   14 +
 drivers/power/Makefile                         |    1 +
 drivers/power/ariesve_battery.c                | 2710 ++++++++++++++++++++++++
 drivers/power/fuelgauge_max17043.c             |  434 ++++
 drivers/power/power_supply_sysfs.c             |   19 +-
 include/linux/earlysuspend.h                   |   56 +
 include/linux/leds-pmic8058.h                  |   40 +
 include/linux/mfd/pm8xxx/batt-alarm.h          |  201 ++
 include/linux/mfd/pm8xxx/gpio.h                |  162 ++
 include/linux/mfd/pm8xxx/misc.h                |  284 +++
 include/linux/mfd/pm8xxx/mpp.h                 |  263 +++
 include/linux/mfd/pm8xxx/nfc.h                 |   79 +
 include/linux/mfd/pm8xxx/tm.h                  |   42 +
 include/linux/mfd/pm8xxx/upl.h                 |   65 +
 include/linux/mfd/pm8xxx/vibrator.h            |   39 +
 include/linux/mfd/pmic8058.h                   |  137 ++
 include/linux/pmic8058-othc.h                  |  146 ++
 include/linux/pmic8058-pwm.h                   |  148 ++
 include/linux/pmic8058-xoadc.h                 |  121 ++
 include/linux/power_supply.h                   |   13 +-
 include/linux/regulator/pm8058-xo.h            |   31 +
 include/linux/regulator/pmic8058-regulator.h   |   89 +
 include/linux/wakelock.h                       |   90 +
 25 files changed, 5588 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-msm/include/mach/msm_battery.h
 create mode 100644 arch/arm/mach-msm/include/mach/msm_rpcrouter.h
 create mode 100644 drivers/power/ariesve_battery.c
 create mode 100644 drivers/power/fuelgauge_max17043.c
 create mode 100644 include/linux/earlysuspend.h
 create mode 100644 include/linux/leds-pmic8058.h
 create mode 100644 include/linux/mfd/pm8xxx/batt-alarm.h
 create mode 100644 include/linux/mfd/pm8xxx/gpio.h
 create mode 100644 include/linux/mfd/pm8xxx/misc.h
 create mode 100644 include/linux/mfd/pm8xxx/mpp.h
 create mode 100644 include/linux/mfd/pm8xxx/nfc.h
 create mode 100644 include/linux/mfd/pm8xxx/tm.h
 create mode 100644 include/linux/mfd/pm8xxx/upl.h
 create mode 100644 include/linux/mfd/pm8xxx/vibrator.h
 create mode 100644 include/linux/mfd/pmic8058.h
 create mode 100644 include/linux/pmic8058-othc.h
 create mode 100644 include/linux/pmic8058-pwm.h
 create mode 100644 include/linux/pmic8058-xoadc.h
 create mode 100644 include/linux/regulator/pm8058-xo.h
 create mode 100644 include/linux/regulator/pmic8058-regulator.h
 create mode 100644 include/linux/wakelock.h
arch/arm/mach-msm/include/mach/msm_battery.h new file +31 -0
new file mode 100644
index 0000000..dfa8097
@@ -0,0 +1,31 @@
+/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+
+
+#ifndef __MSM_BATTERY_H__
+#define __MSM_BATTERY_H__
+
+#define NO_CHG     0x00000000
+#define AC_CHG     0x00000001
+#define USB_CHG    0x00000002
+
+struct msm_psy_batt_pdata {
+	u32 voltage_max_design;
+	u32 voltage_min_design;
+	u32 voltage_fail_safe;
+	u32 avail_chg_sources;
+	u32 batt_technology;
+	u32 (*calculate_capacity)(u32 voltage);
+};
+
+#endif
arch/arm/mach-msm/include/mach/msm_rpcrouter.h new file +376 -0

376 lines not on this page · raw message

drivers/power/Kconfig +14 -0
index 7b8979c..847a77e 100644
@@ -75,6 +75,12 @@ config BATTERY_88PM860X
 	help
 	  Say Y here to enable battery monitor for Marvell 88PM860x chip.
 
+config BATTERY_ARIESVE
+	tristate "Ariesve battery driver"
+	depends on MACH_ARIESVE
+	help
+	  Say Y to enable support for the battery in Samsung ARIESVE.
+
 config BATTERY_DS2760
 	tristate "DS2760 battery driver (HP iPAQ & others)"
 	depends on W1 && W1_SLAVE_DS2760
@@ -362,6 +368,14 @@ config BATTERY_GOLDFISH
 	  Say Y to enable support for the battery and AC power in the
 	  Goldfish emulator.
 
+config MAX17043_FUEL_GAUGE
+	tristate "Maxim MAX17043 Fuel Gauge"
+	depends on I2C
+	help
+	  MAX17043 is fuel-gauge systems for lithium-ion (Li+) batteries
+	  in handheld and portable equipment. The MAX17043 is configured
+	  to operate with a single lithium cell.
+
 source "drivers/power/reset/Kconfig"
 
 endif # POWER_SUPPLY
drivers/power/Makefile +1 -0
index 653bf6c..9ced370 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_WM8350_POWER)	+= wm8350_power.o
 obj-$(CONFIG_TEST_POWER)	+= test_power.o
 
 obj-$(CONFIG_BATTERY_88PM860X)	+= 88pm860x_battery.o
+obj-$(CONFIG_BATTERY_ARIESVE)	+= ariesve_battery.o
 obj-$(CONFIG_BATTERY_DS2760)	+= ds2760_battery.o
 obj-$(CONFIG_BATTERY_DS2780)	+= ds2780_battery.o
 obj-$(CONFIG_BATTERY_DS2781)	+= ds2781_battery.o
drivers/power/ariesve_battery.c new file +2710 -0

2,560 lines not on this page · raw message

drivers/power/fuelgauge_max17043.c new file +434 -0

434 lines not on this page · raw message

drivers/power/power_supply_sysfs.c +17 -2
index 29178f7..3d81e0d 100644

Lines of this file are not shown. View the raw message.

include/linux/earlysuspend.h new file +56 -0

56 lines not on this page · raw message

include/linux/leds-pmic8058.h new file +40 -0
new file mode 100644
index 0000000..cbfde9f

Lines of this file are not shown. View the raw message.

include/linux/mfd/pm8xxx/batt-alarm.h new file +201 -0

201 lines not on this page · raw message

include/linux/mfd/pm8xxx/gpio.h new file +162 -0

162 lines not on this page · raw message

include/linux/mfd/pm8xxx/misc.h new file +284 -0

284 lines not on this page · raw message

include/linux/mfd/pm8xxx/mpp.h new file +263 -0

263 lines not on this page · raw message

include/linux/mfd/pm8xxx/nfc.h new file +79 -0

79 lines not on this page · raw message

include/linux/mfd/pm8xxx/tm.h new file +42 -0

42 lines not on this page · raw message

include/linux/mfd/pm8xxx/upl.h new file +65 -0

65 lines not on this page · raw message

include/linux/mfd/pm8xxx/vibrator.h new file +39 -0
new file mode 100644
index 0000000..cfea1c9

Lines of this file are not shown. View the raw message.

include/linux/mfd/pmic8058.h new file +137 -0

137 lines not on this page · raw message

include/linux/pmic8058-othc.h new file +146 -0

146 lines not on this page · raw message

include/linux/pmic8058-pwm.h new file +148 -0

148 lines not on this page · raw message

include/linux/pmic8058-xoadc.h new file +121 -0

121 lines not on this page · raw message

include/linux/power_supply.h +12 -1
index 804b906..f10829c 100644

Lines of this file are not shown. View the raw message.

include/linux/regulator/pm8058-xo.h new file +31 -0
new file mode 100644
index 0000000..a2b8aeb

Lines of this file are not shown. View the raw message.

include/linux/regulator/pmic8058-regulator.h new file +89 -0

89 lines not on this page · raw message

include/linux/wakelock.h new file +90 -0

90 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.8.3.2

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 21 lines · Balint Czobor

Add initial support for the battery in Samsung ARIESVE.

---
 arch/arm/mach-msm/include/mach/msm_battery.h   |   31 +
 arch/arm/mach-msm/include/mach/msm_rpcrouter.h |  376 ++++
 drivers/power/Kconfig                          |   14 +
 drivers/power/Makefile                         |    1 +
 drivers/power/ariesve_battery.c                | 2710 ++++++++++++++++++++++++
 drivers/power/fuelgauge_max17043.c             |  434 ++++
 drivers/power/power_supply_sysfs.c             |   19 +-
 include/linux/earlysuspend.h                   |   56 +
 include/linux/leds-pmic8058.h                  |   40 +
 include/linux/mfd/pm8xxx/batt-alarm.h          |  201 ++
 include/linux/mfd/pm8xxx/gpio.h                |  162 ++
 include/linux/mfd/pm8xxx/misc.h                |  284 +++
 include/linux/mfd/pm8xxx/mpp.h                 |  263 +++
 include/linux/mfd/pm8xxx/nfc.h                 |   79 +
 include/linux/mfd/pm8xxx/tm.h                  |   42 +
 include/linux/mfd/pm8xxx/upl.h                 |   65 +
 include/linux/mfd/pm8xxx/vibrator.h            |   39 +
Quoted 8 lines
 include/linux/mfd/pmic8058.h                   |  137 ++
 include/linux/pmic8058-othc.h                  |  146 ++
 include/linux/pmic8058-pwm.h                   |  148 ++
 include/linux/pmic8058-xoadc.h                 |  121 ++
 include/linux/power_supply.h                   |   13 +-
 include/linux/regulator/pm8058-xo.h            |   31 +
 include/linux/regulator/pmic8058-regulator.h   |   89 +
 include/linux/wakelock.h                       |   90 +

Thanks for the driver! There are a lot of issues with the patch, though.

Most of the header files are not needed for this driver. The patch should also be split into several parts (i.e. power_supply_sysfs.c changes should be aside). In the patch there is a lot of dead (commented-out) code and code that completely violates Linux coding standards.

I would say that for now, drivers/staging/ is more appropriate place for the driver. Meanwhile, be sure to read Documentation/CodingStyle and Documentation/SubmittingPatches. And a special url about #ifdefs in .c files, typedefs, etc.:

http://kroah.com/linux/talks/ols_2002_kernel_codingstyle_talk/html/

Thanks,

Anton