Skip to contentSkip to conversation

DA906x PMIC driver

RFC PATCH In review Krystian Garbaciak 6 participants 24 messages Aug 24, 2012 – May 9, 2013

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

cover DA906x PMIC driver

Greetings,

The following patch set adds new multifunction device providing support for DA906x PMIC chips.

I am resending this as it looks, the first send failed.

Please add some comments to the driver patch, which targets Linux Kernel v3.6.

Thank you,

---
Krystian Garbaciak (8):
mfd: Add Dialog DA906x core driver.
regulator: Add Dialog DA906x voltage regulators support.
rtc: Add RTC driver for DA906x PMIC.
hwmon: Add DA906x hardware monitoring support.
input: Add support for DA906x PMIC OnKey detection.
input: Add support for DA906x vibration motor driver.
watchdog: Add DA906x PMIC watchdog driver.
leds: Add DA906x PMIC LED driver.

 drivers/hwmon/Kconfig                 |    6 +
 drivers/hwmon/Makefile                |    1 +
 drivers/hwmon/da906x-hwmon.c          |  393 ++++++++++++
 drivers/input/misc/Kconfig            |   13 +
 drivers/input/misc/Makefile           |    2 +
 drivers/input/misc/da906x-onkey.c     |  139 +++++
 drivers/input/misc/da906x-vibration.c |  153 +++++
 drivers/leds/Kconfig                  |    8 +
 drivers/leds/Makefile                 |    1 +
 drivers/leds/leds-da906x.c            |  438 +++++++++++++
 drivers/mfd/Kconfig                   |   11 +
 drivers/mfd/Makefile                  |    4 +
 drivers/mfd/da906x-core.c             |  228 +++++++
 drivers/mfd/da906x-i2c.c              |  389 ++++++++++++
 drivers/mfd/da906x-irq.c              |  192 ++++++
 drivers/regulator/Kconfig             |    6 +
 drivers/regulator/Makefile            |    1 +
 drivers/regulator/da906x-regulator.c  | 1018 ++++++++++++++++++++++++++++++
 drivers/rtc/Kconfig                   |    7 +
 drivers/rtc/Makefile                  |    1 +
 drivers/rtc/rtc-da906x.c              |  379 ++++++++++++
 drivers/watchdog/Kconfig              |   27 +
 drivers/watchdog/Makefile             |    1 +
 drivers/watchdog/da906x_wdt.c         |  276 +++++++++
 include/linux/mfd/da906x/core.h       |  121 ++++
 include/linux/mfd/da906x/pdata.h      |  114 ++++
 include/linux/mfd/da906x/registers.h  | 1093 +++++++++++++++++++++++++++++++++
 27 files changed, 5022 insertions(+), 0 deletions(-)
 create mode 100644 drivers/hwmon/da906x-hwmon.c
 create mode 100644 drivers/input/misc/da906x-onkey.c
 create mode 100644 drivers/input/misc/da906x-vibration.c
 create mode 100644 drivers/leds/leds-da906x.c
 create mode 100644 drivers/mfd/da906x-core.c
 create mode 100644 drivers/mfd/da906x-i2c.c
 create mode 100644 drivers/mfd/da906x-irq.c
 create mode 100644 drivers/regulator/da906x-regulator.c
 create mode 100644 drivers/rtc/rtc-da906x.c
 create mode 100644 drivers/watchdog/da906x_wdt.c
 create mode 100644 include/linux/mfd/da906x/core.h
 create mode 100644 include/linux/mfd/da906x/pdata.h
 create mode 100644 include/linux/mfd/da906x/registers.h

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw

PATCH 1/8 mfd: Add Dialog DA906x core driver.

This is MFD module providing access to registers and interrupts of DA906x series PMIC. It is used by other functional modules, registered as MFD cells. Driver uses regmap with paging to access extended register list. Register map is divided into two pages, where the second page is used during initialisation.

This module provides support to following functional cells:
- Regulators
- RTC
- HWMON
- OnKey (power key misc input device)
- Vibration (force-feedback input device)
- Watchdog
- LEDs

---
 drivers/mfd/Kconfig                  |   11 +
 drivers/mfd/Makefile                 |    4 +
 drivers/mfd/da906x-core.c            |  228 +++++++
 drivers/mfd/da906x-i2c.c             |  389 ++++++++++++
 drivers/mfd/da906x-irq.c             |  192 ++++++
 include/linux/mfd/da906x/core.h      |  121 ++++
 include/linux/mfd/da906x/pdata.h     |  114 ++++
 include/linux/mfd/da906x/registers.h | 1093 ++++++++++++++++++++++++++++++++++
 8 files changed, 2152 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/da906x-core.c
 create mode 100644 drivers/mfd/da906x-i2c.c
 create mode 100644 drivers/mfd/da906x-irq.c
 create mode 100644 include/linux/mfd/da906x/core.h
 create mode 100644 include/linux/mfd/da906x/pdata.h
 create mode 100644 include/linux/mfd/da906x/registers.h
drivers/mfd/Kconfig +11 -0
index b1a1462..bf2a766 100644
@@ -441,6 +441,17 @@ config MFD_DA9052_I2C
 	  for accessing the device, additional drivers must be enabled in
 	  order to use the functionality of the device.
 
+config MFD_DA906X
+	bool "Dialog Semiconductor DA906X PMIC Support"
+	depends on I2C=y
+	select MFD_CORE
+	select REGMAP_I2C
+	select REGMAP_IRQ
+	help
+	  Support for the Dialog Semiconductor DA906X PMIC. This includes
+	  I2C driver and core APIs, additional drivers must be enabled in
+	  order to use the functionality of the device.
+
 config PMIC_ADP5520
 	bool "Analog Devices ADP5520/01 MFD PMIC Core Support"
 	depends on I2C=y
drivers/mfd/Makefile +4 -0
index 79dd22d..f5a8432 100644
@@ -90,8 +90,12 @@ obj-$(CONFIG_PMIC_DA9052)	+= da9052-core.o
 obj-$(CONFIG_MFD_DA9052_SPI)	+= da9052-spi.o
 obj-$(CONFIG_MFD_DA9052_I2C)	+= da9052-i2c.o
 
+da906x-objs			:= da906x-core.o da906x-irq.o da906x-i2c.o
+obj-$(CONFIG_MFD_DA906X)	+= da906x.o
+
 obj-$(CONFIG_MFD_MAX77686)	+= max77686.o max77686-irq.o
 obj-$(CONFIG_MFD_MAX77693)	+= max77693.o max77693-irq.o
+
 max8925-objs			:= max8925-core.o max8925-i2c.o
 obj-$(CONFIG_MFD_MAX8925)	+= max8925.o
 obj-$(CONFIG_MFD_MAX8997)	+= max8997.o max8997-irq.o
drivers/mfd/da906x-core.c new file +228 -0

228 lines not on this page · raw message

drivers/mfd/da906x-i2c.c new file +389 -0

389 lines not on this page · raw message

drivers/mfd/da906x-irq.c new file +192 -0

192 lines not on this page · raw message

include/linux/mfd/da906x/core.h new file +121 -0

121 lines not on this page · raw message

include/linux/mfd/da906x/pdata.h new file +114 -0

114 lines not on this page · raw message

include/linux/mfd/da906x/registers.h new file +1093 -0

1,093 lines not on this page · raw message

Signature · 7 lines
1.7.0.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw

RFC PATCH 2/8 regulator: Add Dialog DA906x voltage regulators support.

The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
- 1x power switch to switch on/off 32 KHz oscilator output (32K_OUT).

Regulators provide following operations:
- REGULATOR_CHANGE_STATUS for all regulators,
- REGULATOR_CHANGE_VOLTAGE for LDOs and buck converters,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).

The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8 and LDO11.

Internally, PMIC provides two voltage configurations for normal and suspend system state for each regulator. The driver switches between those on suspend/wake-up to provide quick and fluent output voltage change.

This driver requires MFD core driver for operation.

---
 drivers/regulator/Kconfig            |    6 +
 drivers/regulator/Makefile           |    1 +
 drivers/regulator/da906x-regulator.c | 1018 ++++++++++++++++++++++++++++++++++
 3 files changed, 1025 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/da906x-regulator.c
drivers/regulator/Kconfig +6 -0
index 4e932cc..b57b6c6 100644
@@ -110,6 +110,12 @@ config REGULATOR_DA9052
 	  This driver supports the voltage regulators of DA9052-BC and
 	  DA9053-AA/Bx PMIC.
 
+config REGULATOR_DA906X
+	bool "Dialog DA906X Regulator family chip"
+	depends on MFD_DA906X
+	help
+	  Support for Dialog Semiconductor DA906x chip.
+
 config REGULATOR_ANATOP
 	tristate "Freescale i.MX on-chip ANATOP LDO regulators"
 	depends on MFD_ANATOP
drivers/regulator/Makefile +1 -0
index 3342615..46a503a 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
 obj-$(CONFIG_REGULATOR_DA903X)	+= da903x.o
 obj-$(CONFIG_REGULATOR_DA9052)	+= da9052-regulator.o
+obj-$(CONFIG_REGULATOR_DA906X) += da906x-regulator.o
 obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
drivers/regulator/da906x-regulator.c new file +1018 -0

1,018 lines not on this page · raw message

Signature · 7 lines
1.7.0.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#3 lore raw

RFC PATCH 3/8 rtc: Add RTC driver for DA906x PMIC.

DA906x RTC driver supports date/time and alarm.

In hardware, PMIC supports alarm setting with a resolution of one minute and tick event (every second update event). The driver combines it, providing alarm with one second resolution.

The driver requires MFD core driver for operation.

---
 drivers/rtc/Kconfig      |    7 +
 drivers/rtc/Makefile     |    1 +
 drivers/rtc/rtc-da906x.c |  379 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 387 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/rtc-da906x.c
drivers/rtc/Kconfig +7 -0
index fabc99a..e6037cd 100644
@@ -571,6 +571,13 @@ config RTC_DRV_DA9052
 	  Say y here to support the RTC driver for Dialog Semiconductor
 	  DA9052-BC and DA9053-AA/Bx PMICs.
 
+config RTC_DRV_DA906X
+	tristate "Dialog DA906X RTC"
+	depends on MFD_DA906X
+	help
+	  Say y here to support the RTC driver for
+	  Dialog Semiconductor DA906x PMIC.
+
 config RTC_DRV_EFI
 	tristate "EFI RTC"
 	depends on IA64
drivers/rtc/Makefile +1 -0
index 0d5b2b6..d9c1e9f 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_RTC_DRV_BQ4802)	+= rtc-bq4802.o
 obj-$(CONFIG_RTC_DRV_CMOS)	+= rtc-cmos.o
 obj-$(CONFIG_RTC_DRV_COH901331)	+= rtc-coh901331.o
 obj-$(CONFIG_RTC_DRV_DA9052)	+= rtc-da9052.o
+obj-$(CONFIG_RTC_DRV_DA906X)	+= rtc-da906x.o
 obj-$(CONFIG_RTC_DRV_DAVINCI)	+= rtc-davinci.o
 obj-$(CONFIG_RTC_DRV_DM355EVM)	+= rtc-dm355evm.o
 obj-$(CONFIG_RTC_DRV_VRTC)	+= rtc-mrst.o
drivers/rtc/rtc-da906x.c new file +379 -0

379 lines not on this page · raw message

Signature · 7 lines
1.7.0.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#4 lore raw

RFC PATCH 4/8 hwmon: Add DA906x hardware monitoring support.

DA906x PMIC provides ADC for voltage and temperature monitoring.

The driver provides results of following ADC channels:
- in0 - system voltage (2500 - 5500 mV)
- in1 - universal voltage channel #1 (0 - 2500 mV)
- in2 - universal voltage channel #2 (0 - 2500 mV)
- in3 - universal voltage channel #3 (0 - 2500 mV)
- in4 - backup battery voltage (0 - 5000 mV)
- temp1 - PMIC internal junction temperature (-88 - 333 Celcius degrees)

---
 drivers/hwmon/Kconfig        |    6 +
 drivers/hwmon/Makefile       |    1 +
 drivers/hwmon/da906x-hwmon.c |  393 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 400 insertions(+), 0 deletions(-)
 create mode 100644 drivers/hwmon/da906x-hwmon.c
drivers/hwmon/Kconfig +6 -0
index b0a2e4c..7abc9a0 100644
@@ -1373,6 +1373,12 @@ config SENSORS_WM8350
 	  This driver can also be built as a module.  If so, the module
 	  will be called wm8350-hwmon.
 
+config SENSORS_DA906X
+	tristate "DA906X HWMON device drivers"
+	depends on MFD_DA906X
+	help
+	  Support for the HWMON DA906X device driver.
+
 config SENSORS_ULTRA45
 	tristate "Sun Ultra45 PIC16F747"
 	depends on SPARC64
drivers/hwmon/Makefile +1 -0
index 7aa9811..ffbe151 100644
@@ -43,6 +43,7 @@ obj-$(CONFIG_SENSORS_ASC7621)	+= asc7621.o
 obj-$(CONFIG_SENSORS_ATXP1)	+= atxp1.o
 obj-$(CONFIG_SENSORS_CORETEMP)	+= coretemp.o
 obj-$(CONFIG_SENSORS_DA9052_ADC)+= da9052-hwmon.o
+obj-$(CONFIG_SENSORS_DA906X)	+= da906x-hwmon.o
 obj-$(CONFIG_SENSORS_DME1737)	+= dme1737.o
 obj-$(CONFIG_SENSORS_DS620)	+= ds620.o
 obj-$(CONFIG_SENSORS_DS1621)	+= ds1621.o
drivers/hwmon/da906x-hwmon.c new file +393 -0

393 lines not on this page · raw message

Signature · 7 lines
1.7.0.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#5 lore raw

RFC PATCH 5/8 input: Add support for DA906x PMIC OnKey detection.

This driver creates input device that reports a key event on an OnKey button release. The reported key code depends on the time, the button was holded for. If holding time < 2 seconds - KEY_SLEEP is reported on button release, otherwise KEY_POWER is reported after 2 seconds.

---
 drivers/input/misc/Kconfig        |    6 ++
 drivers/input/misc/Makefile       |    1 +
 drivers/input/misc/da906x-onkey.c |  139 +++++++++++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/misc/da906x-onkey.c
drivers/input/misc/Kconfig +6 -0
index 7c0f1ec..fd8d951 100644
@@ -486,6 +486,12 @@ config INPUT_DA9052_ONKEY
 	  To compile this driver as a module, choose M here: the
 	  module will be called da9052_onkey.
 
+config INPUT_DA906X_ONKEY
+	tristate "Dialog DA906x OnKey"
+	depends on MFD_DA906X
+	help
+	  Support for Dialog Semiconductor input onkey device.
+
 config INPUT_DM355EVM
 	tristate "TI DaVinci DM355 EVM Keypad and IR Remote"
 	depends on MFD_DM355EVM_MSP
drivers/input/misc/Makefile +1 -0
index 83fe6f5..73406ac 100644
@@ -23,6 +23,7 @@ obj-$(CONFIG_INPUT_CMA3000)		+= cma3000_d0x.o
 obj-$(CONFIG_INPUT_CMA3000_I2C)		+= cma3000_d0x_i2c.o
 obj-$(CONFIG_INPUT_COBALT_BTNS)		+= cobalt_btns.o
 obj-$(CONFIG_INPUT_DA9052_ONKEY)	+= da9052_onkey.o
+obj-$(CONFIG_INPUT_DA906X_ONKEY)	+= da906x-onkey.o
 obj-$(CONFIG_INPUT_DM355EVM)		+= dm355evm_keys.o
 obj-$(CONFIG_INPUT_GP2A)		+= gp2ap002a00f.o
 obj-$(CONFIG_INPUT_GPIO_TILT_POLLED)	+= gpio_tilt_polled.o
drivers/input/misc/da906x-onkey.c new file +139 -0

139 lines not on this page · raw message

Signature · 7 lines
1.7.0.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#6 lore raw

RFC PATCH 6/8 input: Add support for DA906x vibration motor driver.

This driver is registers (memless) force-feedback input device with capability of FF_RUMBLE effect.

---
 drivers/input/misc/Kconfig            |    7 ++
 drivers/input/misc/Makefile           |    1 +
 drivers/input/misc/da906x-vibration.c |  153 +++++++++++++++++++++++++++++++++
 3 files changed, 161 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/misc/da906x-vibration.c
drivers/input/misc/Kconfig +7 -0
index fd8d951..b8a5fac 100644
@@ -492,6 +492,13 @@ config INPUT_DA906X_ONKEY
 	help
 	  Support for Dialog Semiconductor input onkey device.
 
+config INPUT_DA906X_VIBRATION
+	tristate "Dialog DA906x Vibration"
+	depends on MFD_DA906X
+	select INPUT_FF_MEMLESS
+	help
+	  Support for Dialog Semiconductor vibration motor driver.
+
 config INPUT_DM355EVM
 	tristate "TI DaVinci DM355 EVM Keypad and IR Remote"
 	depends on MFD_DM355EVM_MSP
drivers/input/misc/Makefile +1 -0
index 73406ac..7b284ef 100644
@@ -24,6 +24,7 @@ obj-$(CONFIG_INPUT_CMA3000_I2C)		+= cma3000_d0x_i2c.o
 obj-$(CONFIG_INPUT_COBALT_BTNS)		+= cobalt_btns.o
 obj-$(CONFIG_INPUT_DA9052_ONKEY)	+= da9052_onkey.o
 obj-$(CONFIG_INPUT_DA906X_ONKEY)	+= da906x-onkey.o
+obj-$(CONFIG_INPUT_DA906X_VIBRATION)	+= da906x-vibration.o
 obj-$(CONFIG_INPUT_DM355EVM)		+= dm355evm_keys.o
 obj-$(CONFIG_INPUT_GP2A)		+= gp2ap002a00f.o
 obj-$(CONFIG_INPUT_GPIO_TILT_POLLED)	+= gpio_tilt_polled.o
drivers/input/misc/da906x-vibration.c new file +153 -0

153 lines not on this page · raw message

Signature · 7 lines
1.7.0.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#7 lore raw

RFC PATCH 7/8 watchdog: Add DA906x PMIC watchdog driver.

This driver supports watchdog device inside DA906x PMIC.

---
 drivers/watchdog/Kconfig      |   27 ++++
 drivers/watchdog/Makefile     |    1 +
 drivers/watchdog/da906x_wdt.c |  276 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 304 insertions(+), 0 deletions(-)
 create mode 100644 drivers/watchdog/da906x_wdt.c
drivers/watchdog/Kconfig +27 -0
index 53d7571..ef07575 100644
@@ -76,6 +76,33 @@ config DA9052_WATCHDOG
           Alternatively say M to compile the driver as a module,
           which will be called da9052_wdt.
 
+config DA906X_WATCHDOG
+	tristate "Dialog DA906X Watchdog"
+	depends on MFD_DA906X
+	select WATCHDOG_CORE
+	help
+	  Support for the watchdog in the DA906X PMIC.
+
+config DA906X_WDT_DEFAULT_TIMEOUT
+	int "Watchdog timeout in seconds <2, 4, 8, 16, 32, 65, 131>"
+	depends on DA906X_WATCHDOG
+	default 8
+	range 2 131
+	help
+	  Select the default watchdog timer period to be used by the
+	  Dialog DA906x watchdog driver. Supported values are:
+	  2, 4, 8, 16, 32, 65, 131 seconds.
+
+config DA906X_WDT_FLEXIBLE_TIMEOUT
+	bool "Flexible watchdog timeout (when requested value is unsupported)"
+	depends on DA906X_WATCHDOG
+	default y
+	help
+	  Say Y here to allow to select longer watchdog timer period to be
+	  used when requested value is not supported. The lowest available
+	  value higher than requested will be used (watchdog will never
+	  expire before requested timeout).
+
 config WM831X_WATCHDOG
 	tristate "WM831x watchdog"
 	depends on MFD_WM831X
drivers/watchdog/Makefile +1 -0
index 572b39b..0746a87 100644
@@ -164,6 +164,7 @@ obj-$(CONFIG_XEN_WDT) += xen_wdt.o
 
 # Architecture Independent
 obj-$(CONFIG_DA9052_WATCHDOG) += da9052_wdt.o
+obj-$(CONFIG_DA906X_WATCHDOG) += da906x_wdt.o
 obj-$(CONFIG_WM831X_WATCHDOG) += wm831x_wdt.o
 obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o
 obj-$(CONFIG_MAX63XX_WATCHDOG) += max63xx_wdt.o
drivers/watchdog/da906x_wdt.c new file +276 -0

276 lines not on this page · raw message

Signature · 7 lines
1.7.0.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#8 lore raw

RFC PATCH 8/8 leds: Add DA906x PMIC LED driver.

PMIC can control three LEDs, devoted to work as RGB LED.

Beside standard brightness setting, the driver provides some hardware blinking functionality. Driver brings access to blinking register fields inside PMIC with LED attributes: hw_blink_dur_regval and hw_blink_frq_regval. When the latter is not 0, hardware blinking is enabled. As long as hardware blinking is enabled, brightness is set to its maximum.

---
 drivers/leds/Kconfig       |    8 +
 drivers/leds/Makefile      |    1 +
 drivers/leds/leds-da906x.c |  438 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 447 insertions(+), 0 deletions(-)
 create mode 100644 drivers/leds/leds-da906x.c
drivers/leds/Kconfig +8 -0
index c96bbaa..46dc3dd 100644
@@ -287,6 +287,14 @@ config LEDS_DA9052
 	  This option enables support for on-chip LED drivers found
 	  on Dialog Semiconductor DA9052-BC and DA9053-AA/Bx PMICs.
 
+config LEDS_DA906X
+        tristate "Dialog DA906x LEDS"
+        depends on LEDS_CLASS
+        depends on MFD_DA906X
+        help
+          This option enables support for on-chip LED drivers found
+          on Dialog Semiconductor DA906x PMICs
+
 config LEDS_DAC124S085
 	tristate "LED Support for DAC124S085 SPI DAC"
 	depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
index a4429a9..1601366 100644
@@ -34,6 +34,7 @@ obj-$(CONFIG_LEDS_PCA955X)		+= leds-pca955x.o
 obj-$(CONFIG_LEDS_PCA9633)		+= leds-pca9633.o
 obj-$(CONFIG_LEDS_DA903X)		+= leds-da903x.o
 obj-$(CONFIG_LEDS_DA9052)		+= leds-da9052.o
+obj-$(CONFIG_LEDS_DA906X)		+= leds-da906x.o
 obj-$(CONFIG_LEDS_WM831X_STATUS)	+= leds-wm831x-status.o
 obj-$(CONFIG_LEDS_WM8350)		+= leds-wm8350.o
 obj-$(CONFIG_LEDS_PWM)			+= leds-pwm.o
drivers/leds/leds-da906x.c new file +438 -0

438 lines not on this page · raw message

Signature · 7 lines
1.7.0.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
maintainer
#9 lore raw

Re: [RFC PATCH 4/8] hwmon: Add DA906x hardware monitoring support.

In reply to Krystian Garbaciak
Quoted 2 lines · Krystian Garbaciak

DA906x PMIC provides ADC for voltage and temperature monitoring.

Hi Krystian,

DA906x seems to be a bad choice for a name. It covers DA906[0-9] and possibly even DA906[A-Z]. The only chip really in existence seems to be DA9064.

I personally think it is a bad idea to have an 'x' in a driver name. What if DA9069 shows up at some point and is completely different ? I think the driver should be named for the first supported chip; reference the others in the code and documentation.

Worse, I find no information anywhere in your patch set indicating which chips are actually supported. I don't know how other subsystems handle this, but for hwmon this is a no-go.

Quoted 8 lines

The driver provides results of following ADC channels:
- in0 - system voltage (2500 - 5500 mV)
- in1 - universal voltage channel #1 (0 - 2500 mV)
- in2 - universal voltage channel #2 (0 - 2500 mV)
- in3 - universal voltage channel #3 (0 - 2500 mV)
- in4 - backup battery voltage (0 - 5000 mV)
- temp1 - PMIC internal junction temperature (-88 - 333 Celcius degrees)

Quoted 5 lines
---
 drivers/hwmon/Kconfig        |    6 +
 drivers/hwmon/Makefile       |    1 +
 drivers/hwmon/da906x-hwmon.c |  393 ++++++++++++++++++++++++++++++++++++++++++

Also please provide Documentation/hwmon/da906x-hwmon.

Quoted 8 lines
 3 files changed, 400 insertions(+), 0 deletions(-)
 create mode 100644 drivers/hwmon/da906x-hwmon.c
drivers/hwmon/Kconfig +0 -0
index b0a2e4c..7abc9a0 100644

drivers/hwmon/Kconfig config SENSORS_WM8350 · line 1381

Quoted 9 lines
drivers/hwmon/Kconfig +6 -0
@@ -1373,6 +1373,12 @@ config SENSORS_WM8350
 	  This driver can also be built as a module.  If so, the module
 	  will be called wm8350-hwmon.
 
+config SENSORS_DA906X
+	tristate "DA906X HWMON device drivers"
+	depends on MFD_DA906X
+	help
+	  Support for the HWMON DA906X device driver.
+

Alphabetical order, please, and describe which chip(s) are supported. And you don't really support a device driver, the device driver presumably supports a chip. Since it is tristate, we also expect you to provide the module name if the driver is built as module.

Quoted 91 lines
drivers/hwmon/Kconfig +0 -0
 config SENSORS_ULTRA45
 	tristate "Sun Ultra45 PIC16F747"
 	depends on SPARC64
drivers/hwmon/Makefile +1 -0
index 7aa9811..ffbe151 100644
@@ -43,6 +43,7 @@ obj-$(CONFIG_SENSORS_ASC7621)	+= asc7621.o
 obj-$(CONFIG_SENSORS_ATXP1)	+= atxp1.o
 obj-$(CONFIG_SENSORS_CORETEMP)	+= coretemp.o
 obj-$(CONFIG_SENSORS_DA9052_ADC)+= da9052-hwmon.o
+obj-$(CONFIG_SENSORS_DA906X)	+= da906x-hwmon.o
 obj-$(CONFIG_SENSORS_DME1737)	+= dme1737.o
 obj-$(CONFIG_SENSORS_DS620)	+= ds620.o
 obj-$(CONFIG_SENSORS_DS1621)	+= ds1621.o
drivers/hwmon/da906x-hwmon.c new file +70 -0
new file mode 100644
index 0000000..8ece931
@@ -0,0 +1,393 @@
+/*
+ * HW Monitor support for Dialog DA906X PMIC series
+ *
+ * Copyright 2012 Dialog Semiconductor Ltd.
+ *
+ * Author: Krystian Garbaciak <[email protected]>,
+ *         Michal Hajduk <[email protected]>
+ *
+ *  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.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+#include <linux/mfd/da906x/core.h>
+#include <linux/mfd/da906x/pdata.h>
+
+/* ADC resolutions for manual and auto modes */
+#define DA906X_ADC_RES		\
+		(1 << (DA906X_ADC_RES_L_BITS + DA906X_ADC_RES_M_BITS))
+#define DA906X_ADC_MAX		(DA906X_ADC_RES - 1)
+#define	DA906X_ADC_AUTO_RES	(1 << DA906X_ADC_RES_M_BITS)
+#define	DA906X_ADC_AUTO_MAX	(DA906X_ADC_AUTO_RES - 1)
+
+/* Define interpolation table to calculate ADC values  */
+struct i_table {
+	int x0;
+	int a;
+	int b;
+};
+#define ILINE(x1, x2, y1, y2)	{ \
+		.x0 = (x1), \
+		.a = ((y2) - (y1)) * DA906X_ADC_RES / ((x2) - (x1)), \
+		.b = (y1) - ((y2) - (y1)) * (x1) / ((x2) - (x1)), \
+	}
+
+struct channel_info {
+	const char *name;
+	const struct i_table *tbl;
+	int tbl_max;
+	u16 reg_auto_en;
+};
+
+enum da906x_adc {
+	DA906X_VSYS,
+	DA906X_ADCIN1,
+	DA906X_ADCIN2,
+	DA906X_ADCIN3,
+	DA906X_TJUNC,
+	DA906X_VBBAT,
+
+	DA906X_CHAN_NUM
+};
+
+static const struct i_table vsys_tbl[] = {
+	ILINE(0, DA906X_ADC_MAX, 2500, 5500)
+};
+
+static const struct i_table adcin_tbl[] = {

drivers/hwmon/da906x-hwmon.c line 80

Quoted 10 lines
drivers/hwmon/da906x-hwmon.c new file +10 -0
+	ILINE(0, DA906X_ADC_MAX, 0, 2500)
+};
+
+static const struct i_table tjunc_tbl[] = {
+	ILINE(0, DA906X_ADC_MAX, 333, -86)
+};
+
+static const struct i_table vbbat_tbl[] = {
+	ILINE(0, DA906X_ADC_MAX, 0, 5000)
+};

Since the first parameter to ILINE is always 0, it is not needed. This means that x0 in itable is also always 0 and thus not needed.

Quoted 8 lines
drivers/hwmon/da906x-hwmon.c new file +8 -0
+
+static const struct channel_info da906x_channels[] = {
+	[DA906X_VSYS]	= { "VSYS",
+			    vsys_tbl, ARRAY_SIZE(vsys_tbl) - 1,
+			    DA906X_REG_VSYS_RES },
+	[DA906X_ADCIN1]	= { "ADCIN1",
+			    adcin_tbl,	ARRAY_SIZE(adcin_tbl) - 1,
+			    DA906X_REG_ADCIN1_RES },

drivers/hwmon/da906x-hwmon.c line 98

Quoted 10 lines
drivers/hwmon/da906x-hwmon.c new file +10 -0
+	[DA906X_ADCIN2]	= { "ADCIN2",
+			    adcin_tbl,	ARRAY_SIZE(adcin_tbl) - 1,
+			    DA906X_REG_ADCIN2_RES },
+	[DA906X_ADCIN3]	= { "ADCIN3",
+			    adcin_tbl,	ARRAY_SIZE(adcin_tbl) - 1,
+			    DA906X_REG_ADCIN3_RES },
+	[DA906X_TJUNC]	= { "TJUNC",
+			    tjunc_tbl,	ARRAY_SIZE(tjunc_tbl) - 1 },
+	[DA906X_VBBAT]	= { "VBBAT",
+			    vbbat_tbl,	ARRAY_SIZE(vbbat_tbl) - 1}
	s/1}/1 }/

drivers/hwmon/da906x-hwmon.c line 99

Quoted 1 line
drivers/hwmon/da906x-hwmon.c new file +1 -0
+};

You lost me here a bit (I am missing something ?).

Seems to be each table has exactly one entry. Since the table size is 1, ARRAY_SIZE(vbbat_tbl) - 1 is 0, and ...

Quoted 13 lines
drivers/hwmon/da906x-hwmon.c new file +13 -0
+#define DA906X_ADC_AUTO_MODE_SUPPORT_MASK	(DA906X_ADC_AUTO_VSYS_EN | \
+						 DA906X_ADC_AUTO_AD1_EN | \
+						 DA906X_ADC_AUTO_AD2_EN | \
+						 DA906X_ADC_AUTO_AD3_EN)
+
+struct da906x_hwmon {
+	struct da906x *da906x;
+	struct device *class_dev;
+	struct completion man_adc_rdy;	/* Manual read completion flag */
+	struct mutex hwmon_mutex;	/* Queue concurent manual reads */
+	int irq;
+	u8 adc_auto_en;     /* Bitmask of channels with auto mode enabled */
+	s8 tjunc_offset;    /* Calibration offset for junction temperature */

drivers/hwmon/da906x-hwmon.c line 122

Quoted 10 lines
drivers/hwmon/da906x-hwmon.c new file +10 -0
+};
+
+int da906x_adc_convert(int channel, int x)
+{
+	const struct channel_info *info = &da906x_channels[channel];
+	int i, ret;
+
+	for (i = info->tbl_max; i > 0; i--)
+		if (info->tbl[i].x0 <= x)
+			break;

... this loop never does anything because info->tbl_max is always 0. Besides, even if the loop was used, x0 is always 0 anyway, so you might well compare against 0 instead which doesn't make sense.

So what is the point for making the code that complex ? For me it just adds a lot of confusion.

drivers/hwmon/da906x-hwmon.c line 129

Quoted 7 lines
drivers/hwmon/da906x-hwmon.c new file +7 -0
+
+	ret = info->tbl[i].a * x;
+	if (ret >= 0)
+		ret += DA906X_ADC_RES / 2;
+	else
+		ret -= DA906X_ADC_RES / 2;
+	ret = ret / DA906X_ADC_RES + info->tbl[i].b;
	ret = DIV_ROUND_CLOSEST(ret, DA906X_ADC_RES) + info->tbl[i].b;

has the same effect as the 5 lines above and is simpler.

Quoted 15 lines
drivers/hwmon/da906x-hwmon.c new file +15 -0
+	return ret;
+}
+
+static int da906x_adc_manual_read(struct da906x_hwmon *hwmon, int channel)
+{
+	int ret;
+	u8 data[2];
+
+	mutex_lock(&hwmon->hwmon_mutex);
+
+	init_completion(&hwmon->man_adc_rdy);
+
+	/* Start measurment on selected channel */
+	data[0] = (channel << DA906X_ADC_MUX_SHIFT) & DA906X_ADC_MUX_MASK;
+	data[0] |= DA906X_ADC_MAN;

drivers/hwmon/da906x-hwmon.c line 154

Quoted 10 lines
drivers/hwmon/da906x-hwmon.c new file +10 -0
+	ret = da906x_reg_update(hwmon->da906x, DA906X_REG_ADC_MAN,
+				DA906X_ADC_MUX_MASK | DA906X_ADC_MAN, data[0]);
+	if (ret < 0)
+		goto out;
+
+	/* Wait for interrupt from ADC */
+	ret = wait_for_completion_timeout(&hwmon->man_adc_rdy,
+					  msecs_to_jiffies(1000));
+	if (ret = 0) {
+		ret = -EBUSY;

Should this be -ETIMEDOUT ?

Quoted 42 lines
drivers/hwmon/da906x-hwmon.c new file +42 -0
+		goto out;
+	}
+
+	/* Get results */
+	ret = da906x_block_read(hwmon->da906x, DA906X_REG_ADC_RES_L, 2, data);
+	if (ret < 0)
+		goto out;
+	ret = (data[0] & DA906X_ADC_RES_L_MASK) >> DA906X_ADC_RES_L_SHIFT;
+	ret |= data[1] << DA906X_ADC_RES_L_BITS;
+out:
+	mutex_unlock(&hwmon->hwmon_mutex);
+	return ret;
+}
+
+static int da906x_adc_auto_read(struct da906x *da906x, int channel)
+{
+	const struct channel_info *info = &da906x_channels[channel];
+
+	return da906x_reg_read(da906x, info->reg_auto_en);
+}
+
+static irqreturn_t da906x_hwmon_irq_handler(int irq, void *irq_data)
+{
+	struct da906x_hwmon *hwmon = irq_data;
+
+	complete(&hwmon->man_adc_rdy);
+
+	return IRQ_HANDLED;
+}
+
+static ssize_t da906x_adc_read(struct device *dev,
+			       struct device_attribute *devattr, char *buf)
+{
+	struct da906x_hwmon *hwmon = dev_get_drvdata(dev);
+	int channel = to_sensor_dev_attr(devattr)->index;
+	int val;
+
+	if (hwmon->adc_auto_en & (1 << channel)) {
+		val = da906x_adc_auto_read(hwmon->da906x, channel);
+		if (val < 0)
+			return val;
+

drivers/hwmon/da906x-hwmon.c line 206

Quoted 10 lines
drivers/hwmon/da906x-hwmon.c new file +10 -0
+		val *= DA906X_ADC_RES / DA906X_ADC_AUTO_RES;
+		val = da906x_adc_convert(channel, val);
+	} else {
+		val = da906x_adc_manual_read(hwmon, channel);
+		if (val < 0)
+			return val;
+
+		if (channel = DA906X_TJUNC)
+			val += hwmon->tjunc_offset;
+		val = da906x_adc_convert(channel, val);

This call is really the same for both the if and else path. Might as well put it after the conditional code.

drivers/hwmon/da906x-hwmon.c line 213

Quoted 7 lines
drivers/hwmon/da906x-hwmon.c new file +7 -0
+	}
+
+	return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t da906x_show_name(struct device *dev,
+	struct device_attribute *attr, char *buf)

Please align all multi-line function parameters with the opening (.

Quoted 87 lines
drivers/hwmon/da906x-hwmon.c new file +87 -0
+{
+	return sprintf(buf, DA906X_DRVNAME_HWMON "\n");
+}
+
+static ssize_t da906x_show_label(struct device *dev,
+				 struct device_attribute *devattr, char *buf)
+{
+	const struct channel_info *info;
+
+	info = &da906x_channels[to_sensor_dev_attr(devattr)->index];
+	return sprintf(buf, "%s\n", info->name);
+}
+
+/* Vsys voltage */
+static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO,
+			  da906x_adc_read, NULL, DA906X_VSYS);
+static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO,
+			  da906x_show_label, NULL, DA906X_VSYS);
+
+/* Universal ADC channel #1 */
+static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO,
+			  da906x_adc_read, NULL, DA906X_ADCIN1);
+static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO,
+			  da906x_show_label, NULL, DA906X_ADCIN1);
+
+/* Universal ADC channel #2 */
+static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO,
+			  da906x_adc_read, NULL,
+			  DA906X_ADCIN2);
+static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO,
+			  da906x_show_label, NULL, DA906X_ADCIN2);
+
+/* Universal ADC channel #3 */
+static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO,
+			  da906x_adc_read, NULL, DA906X_ADCIN3);
+static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO,
+			  da906x_show_label, NULL, DA906X_ADCIN3);
+
+/* Backup battery voltage */
+static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO,
+			  da906x_adc_read, NULL, DA906X_VBBAT);
+static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO,
+			  da906x_show_label, NULL, DA906X_VBBAT);
+
+/* Junction temperature */
+static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
+			  da906x_adc_read, NULL, DA906X_TJUNC);
+
+static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO,
+			  da906x_show_label, NULL, DA906X_TJUNC);
+
+/* Device name */
+static DEVICE_ATTR(name, S_IRUGO, da906x_show_name, NULL);
+
+static struct attribute *da906x_attributes[] = {
+	&dev_attr_name.attr,
+	&sensor_dev_attr_in0_input.dev_attr.attr,
+	&sensor_dev_attr_in0_label.dev_attr.attr,
+	&sensor_dev_attr_in1_input.dev_attr.attr,
+	&sensor_dev_attr_in1_label.dev_attr.attr,
+	&sensor_dev_attr_in2_input.dev_attr.attr,
+	&sensor_dev_attr_in2_label.dev_attr.attr,
+	&sensor_dev_attr_in3_input.dev_attr.attr,
+	&sensor_dev_attr_in3_label.dev_attr.attr,
+	&sensor_dev_attr_in4_input.dev_attr.attr,
+	&sensor_dev_attr_in4_label.dev_attr.attr,
+	&sensor_dev_attr_temp1_input.dev_attr.attr,
+	&sensor_dev_attr_temp1_label.dev_attr.attr,
+	NULL
+};
+
+static const struct attribute_group da906x_attr_group = {
+	.attrs = da906x_attributes,
+};
+
+static int __devinit da906x_hwmon_probe(struct platform_device *pdev)
+{
+	struct da906x *da906x = dev_get_drvdata(pdev->dev.parent);
+	struct da906x_pdata *da906x_pdata = dev_get_platdata(da906x->dev);
+	struct da906x_hwmon *hwmon;
+	int ret;
+
+	hwmon = devm_kzalloc(&pdev->dev, sizeof(struct da906x_hwmon),
+			     GFP_KERNEL);
+	if (!hwmon)
+		return -ENOMEM;
+

drivers/hwmon/da906x-hwmon.c line 310

Quoted 10 lines
drivers/hwmon/da906x-hwmon.c new file +10 -0
+	mutex_init(&hwmon->hwmon_mutex);
+	init_completion(&hwmon->man_adc_rdy);
+	hwmon->da906x = da906x;
+
+	ret = da906x_reg_read(da906x, DA906X_REG_ADC_CONT);
+	if (ret < 0)
+		return ret;
+	hwmon->adc_auto_en = ret & DA906X_ADC_AUTO_MODE_SUPPORT_MASK;
+
+	if (da906x_pdata->flags & DA906X_FLG_FORCE_IN0_MANUAL_MODE)

You should check if da906x_pdata is NULL before using it.

Quoted 19 lines
drivers/hwmon/da906x-hwmon.c new file +19 -0
+		hwmon->adc_auto_en &= ~DA906X_ADC_AUTO_VSYS_EN;
+	else if (da906x_pdata->flags & DA906X_FLG_FORCE_IN0_AUTO_MODE)
+		hwmon->adc_auto_en |= DA906X_ADC_AUTO_VSYS_EN;
+
+	if (da906x_pdata->flags & DA906X_FLG_FORCE_IN1_MANUAL_MODE)
+		hwmon->adc_auto_en &= ~DA906X_ADC_AUTO_AD1_EN;
+	else if (da906x_pdata->flags & DA906X_FLG_FORCE_IN1_AUTO_MODE)
+		hwmon->adc_auto_en |= DA906X_ADC_AUTO_AD1_EN;
+
+	if (da906x_pdata->flags & DA906X_FLG_FORCE_IN2_MANUAL_MODE)
+		hwmon->adc_auto_en &= ~DA906X_ADC_AUTO_AD2_EN;
+	else if (da906x_pdata->flags & DA906X_FLG_FORCE_IN2_AUTO_MODE)
+		hwmon->adc_auto_en |= DA906X_ADC_AUTO_AD2_EN;
+
+	if (da906x_pdata->flags & DA906X_FLG_FORCE_IN3_MANUAL_MODE)
+		hwmon->adc_auto_en &= ~DA906X_ADC_AUTO_AD3_EN;
+	else if (da906x_pdata->flags & DA906X_FLG_FORCE_IN3_AUTO_MODE)
+		hwmon->adc_auto_en |= DA906X_ADC_AUTO_AD3_EN;
+

drivers/hwmon/da906x-hwmon.c line 339

Quoted 10 lines
drivers/hwmon/da906x-hwmon.c new file +10 -0
+	ret = da906x_reg_update(da906x, DA906X_REG_ADC_CONT,
+				DA906X_ADC_AUTO_MODE_SUPPORT_MASK,
+				hwmon->adc_auto_en);
+	if (ret < 0)
+		return ret;
+
+	hwmon->class_dev = hwmon_device_register(&pdev->dev);
+	if (IS_ERR(hwmon->class_dev))
+		return PTR_ERR(hwmon->class_dev);
+

hwmon registration has to be the last call, after sysfs attributes exist. sysfs entries are expected to exist when the hwmon device is registered.

drivers/hwmon/da906x-hwmon.c line 340

Quoted 1 line
drivers/hwmon/da906x-hwmon.c new file +1 -0
+	hwmon->irq = platform_get_irq_byname(pdev, DA906X_DRVNAME_HWMON);

This function can return an error (-ENXIO).

Quoted 4 lines
drivers/hwmon/da906x-hwmon.c new file +4 -0
+	ret = devm_request_threaded_irq(&pdev->dev, hwmon->irq, NULL,
+					da906x_hwmon_irq_handler,
+					IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+					"HWMON", hwmon);

drivers/hwmon/da906x-hwmon.c line 354

Quoted 10 lines
drivers/hwmon/da906x-hwmon.c new file +10 -0
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to request IRQ.\n");
+		goto err;
+	}
+
+	platform_set_drvdata(pdev, hwmon);
+
+	ret = da906x_reg_read(da906x, DA906X_REG_T_OFFSET);
+	if (ret < 0)
+		dev_warn(&pdev->dev, "Could not read temp1 callibration offset.\n");

s/callibration/calibration/

Quoted 29 lines
drivers/hwmon/da906x-hwmon.c new file +29 -0
+	else
+		hwmon->tjunc_offset = (s8)ret;
+
+	ret = sysfs_create_group(&pdev->dev.kobj, &da906x_attr_group);
+	if (ret)
+		goto err;
+
+	return 0;
+
+err:
+	hwmon_device_unregister(hwmon->class_dev);
+	return ret;
+}
+
+static int __devexit da906x_hwmon_remove(struct platform_device *pdev)
+{
+	struct da906x_hwmon *hwmon = platform_get_drvdata(pdev);
+
+	hwmon_device_unregister(hwmon->class_dev);
+	sysfs_remove_group(&pdev->dev.kobj, &da906x_attr_group);
+
+	return 0;
+}
+
+static struct platform_driver da906x_hwmon_driver = {
+	.probe = da906x_hwmon_probe,
+	.remove = __devexit_p(da906x_hwmon_remove),
+	.driver = {
+		.name = DA906X_DRVNAME_HWMON,

drivers/hwmon/da906x-hwmon.c line 393

Quoted 10 lines
drivers/hwmon/da906x-hwmon.c new file +10 -0
+		.owner = THIS_MODULE,
+	},
+};
+
+module_platform_driver(da906x_hwmon_driver);
+
+MODULE_DESCRIPTION("DA906X Hardware monitoring");
+MODULE_AUTHOR("Krystian Garbaciak <[email protected]>, Michal Hajduk <[email protected]>");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("paltform:" DA906X_DRVNAME_HWMON);

s/paltform/platform/

Quoted 4 lines
Signature · 1 line
1.7.0.4

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#11 lore raw

Re: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

In reply to Krystian Garbaciak
Quoted 9 lines · Krystian Garbaciak
drivers/regulator/da906x-regulator.c new file +9 -0
+static int da906x_set_voltage(struct regulator_dev *rdev,
+				int min_uV, int max_uV, unsigned *selector)
+{
+	struct da906x_regulator *regl = rdev_get_drvdata(rdev);
+	const struct field *fvol = &regl->info->voltage;
+	int ret;
+	unsigned val;
+
+	val = regulator_map_voltage_linear(rdev, min_uV, max_uV);

drivers/regulator/da906x-regulator.c line 576

Quoted 10 lines
drivers/regulator/da906x-regulator.c new file +10 -0
+	if (val < 0)
+		return -EINVAL;
+
+	val = (val + fvol->offset) << fvol->shift;
+	ret = da906x_reg_update(regl->hw, fvol->addr, fvol->mask, val);
+	if (ret >= 0)
+		*selector = val;
+
+	return ret;
+}

This is just set_voltage_sel_regmap().

Quoted 9 lines
drivers/regulator/da906x-regulator.c new file +9 -0
+static int da906x_enable(struct regulator_dev *rdev)
+{
+	struct da906x_regulator *regl = rdev_get_drvdata(rdev);
+	int ret;
+
+	if (regl->info->suspend.mask) {
+		/* Make sure to exit from suspend mode on enable */
+		ret = da906x_reg_clear_bits(regl->hw, regl->info->suspend.addr,
+					    regl->info->suspend.mask);

drivers/regulator/da906x-regulator.c line 664

Quoted 10 lines
drivers/regulator/da906x-regulator.c new file +10 -0
+		if (ret < 0)
+			return ret;
+
+		/* BUCKs need mode update after wake-up from suspend state. */
+		ret = da906x_update_mode_internal(regl, SYS_STATE_NORMAL);
+		if (ret < 0)
+			return ret;
+	}
+
+	return regulator_enable_regmap(rdev);

If suspend_mask is optional the regulators using it should just use the standard operation.

drivers/regulator/da906x-regulator.c line 744

Quoted 2 lines
drivers/regulator/da906x-regulator.c new file +2 -0
+/* Regulator event handlers */
+irqreturn_t da906x_ldo_lim_event(int irq, void *data)

By "event handler" you mean "interrupt"

drivers/regulator/da906x-regulator.c line 754

Quoted 3 lines
drivers/regulator/da906x-regulator.c new file +3 -0
+	bits = da906x_reg_read(hw, DA906X_REG_STATUS_D);
+	if (bits < 0)
+		return IRQ_HANDLED;

If you fail to detect an interrupt you report that you handled one...?

drivers/regulator/da906x-regulator.c line 804

Quoted 4 lines
drivers/regulator/da906x-regulator.c new file +4 -0
+	if (!da906x_pdata) {
+		dev_err(&pdev->dev, "No platform init data supplied\n");
+		return -ENODEV;
+	}

Platform data should be totally optional.

drivers/regulator/da906x-regulator.c line 831

Quoted 2 lines
drivers/regulator/da906x-regulator.c new file +2 -0
+	bcores_merged = (ret & DA906X_BCORE_MERGE) ? true : false;
+	bmem_bio_merged = (ret & DA906X_BUCK_MERGE) ? true : false;

The use of the ternery operation here is even worse than normal, you can assign the values directly.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#20 lore raw

Re: [PATCH 1/8] mfd: Add Dialog DA906x core driver.

In reply to Krystian Garbaciak
Quoted 4 lines · Krystian Garbaciak

This is MFD module providing access to registers and interrupts of DA906x series PMIC. It is used by other functional modules, registered as MFD cells. Driver uses regmap with paging to access extended register list. Register map is divided into two pages, where the second page is used during initialisation.

Your selection of people to CC here appears both large and random...

drivers/mfd/da906x-core.c line 112

Quoted 4 lines
drivers/mfd/da906x-core.c new file +4 -0
+inline unsigned int da906x_to_range_reg(u16 reg)
+{
+	return reg + DA906X_MAPPING_BASE;
+}

I've no real idea what this stuff is all about, it at least needs some comments somewhere. The fact that you're just adding a constant offset to all registers is at best odd.

drivers/mfd/da906x-i2c.c line 335

Quoted 2 lines
drivers/mfd/da906x-i2c.c new file +2 -0
+	if (pdata->flags & DA906X_FLG_NO_CACHE)
+		config = &da906x_no_cache_regmap_config;

No, why would anyone ever want this and why would this not apply to all other drivers?

drivers/mfd/da906x-i2c.c line 361

Quoted 5 lines
drivers/mfd/da906x-i2c.c new file +5 -0
+static const struct i2c_device_id da906x_i2c_id[] = {
+	{"da906x", PMIC_DA9063},
+	{},
+};
+MODULE_DEVICE_TABLE(i2c, da906x_i2c_id);

List the actual devices here.

Quoted 1 line

+#define DA906X_IRQ_BASE_OFFSET 0

Hrm?

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#10 lore raw

Re: [PATCH] regulator: Fix bug in regulator_mode_to_status() core function.

In reply to Guenter Roeck
Quoted 40 lines

+static const struct i_table vsys_tbl[] = {

Quoted 4 lines
drivers/hwmon/da906x-hwmon.c new file +4 -0
+	ILINE(0, DA906X_ADC_MAX, 2500, 5500)
+};
+
+static const struct i_table adcin_tbl[] = {

drivers/hwmon/da906x-hwmon.c line 80

Quoted 10 lines
drivers/hwmon/da906x-hwmon.c new file +10 -0
+	ILINE(0, DA906X_ADC_MAX, 0, 2500)
+};
+
+static const struct i_table tjunc_tbl[] = {
+	ILINE(0, DA906X_ADC_MAX, 333, -86)
+};
+
+static const struct i_table vbbat_tbl[] = {
+	ILINE(0, DA906X_ADC_MAX, 0, 5000)
+};

Since the first parameter to ILINE is always 0, it is not needed. This means that x0 in itable is also always 0 and thus not needed.

Quoted 8 lines
drivers/hwmon/da906x-hwmon.c new file +8 -0
+
+static const struct channel_info da906x_channels[] = {
+	[DA906X_VSYS]	= { "VSYS",
+			    vsys_tbl, ARRAY_SIZE(vsys_tbl) - 1,
+			    DA906X_REG_VSYS_RES },
+	[DA906X_ADCIN1]	= { "ADCIN1",
+			    adcin_tbl,	ARRAY_SIZE(adcin_tbl) - 1,
+			    DA906X_REG_ADCIN1_RES },

drivers/hwmon/da906x-hwmon.c line 98

Quoted 10 lines
drivers/hwmon/da906x-hwmon.c new file +10 -0
+	[DA906X_ADCIN2]	= { "ADCIN2",
+			    adcin_tbl,	ARRAY_SIZE(adcin_tbl) - 1,
+			    DA906X_REG_ADCIN2_RES },
+	[DA906X_ADCIN3]	= { "ADCIN3",
+			    adcin_tbl,	ARRAY_SIZE(adcin_tbl) - 1,
+			    DA906X_REG_ADCIN3_RES },
+	[DA906X_TJUNC]	= { "TJUNC",
+			    tjunc_tbl,	ARRAY_SIZE(tjunc_tbl) - 1 },
+	[DA906X_VBBAT]	= { "VBBAT",
+			    vbbat_tbl,	ARRAY_SIZE(vbbat_tbl) - 1}
	s/1}/1 }/
Quoted 6 lines
Quoted 1 line

+};

You lost me here a bit (I am missing something ?).

Seems to be each table has exactly one entry. Since the table size is 1, ARRAY_SIZE(vbbat_tbl) - 1 is 0, and ...

An initial idea was to make the interpolation of the channel values using more ILINE segments. Eventually, it ended up with one linear segment for every channel, so it makes sense to reduce the code as you propose.

As suggested, driver name will be changed from "da906x" to "da9063". I will adapt proposed changes and fixes.

Thank you for your comments,
Krystian

#12 lore raw

Re: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

In reply to Mark Brown
Quoted 13 lines
Quoted 13 lines
drivers/regulator/da906x-regulator.c new file +13 -0
+static int da906x_set_voltage(struct regulator_dev *rdev,
+				int min_uV, int max_uV, unsigned *selector)
+{
+	struct da906x_regulator *regl = rdev_get_drvdata(rdev);
+	const struct field *fvol = &regl->info->voltage;
+	int ret;
+	unsigned val;
+
+	val = regulator_map_voltage_linear(rdev, min_uV, max_uV);
+	if (val < 0)
+		return -EINVAL;
+
+	val = (val + fvol->offset) << fvol->shift;
Quoted 8 lines

drivers/regulator/da906x-regulator.c line 576

Quoted 6 lines
drivers/regulator/da906x-regulator.c new file +6 -0
+	ret = da906x_reg_update(regl->hw, fvol->addr, fvol->mask, val);
+	if (ret >= 0)
+		*selector = val;
+
+	return ret;
+}

This is just set_voltage_sel_regmap().

Because, for some regulators, this is required: val += fvol->offset, I was only able to reduce it to the following form.

+static int da9063_set_voltage(struct regulator_dev *rdev,
+ int min_uV, int max_uV, unsigned *selector)
+{
+ struct da9063_regulator *regl = rdev_get_drvdata(rdev);
+ const struct field *fvol = &regl->info->voltage;
+ int ret;
+ unsigned val;
+
+ val = regulator_map_voltage_linear(rdev, min_uV, max_uV);
+ if (val < 0)
+ return -EINVAL;
+
+ val += fvol->offset;
+
+ ret = regulator_set_voltage_sel_regmap(rdev, val);
+ if (ret >= 0)
+ *selector = val;
+
+ return ret;
+}

Quoted 14 lines
Quoted 14 lines
drivers/regulator/da906x-regulator.c new file +14 -0
+static int da906x_enable(struct regulator_dev *rdev)
+{
+	struct da906x_regulator *regl = rdev_get_drvdata(rdev);
+	int ret;
+
+	if (regl->info->suspend.mask) {
+		/* Make sure to exit from suspend mode on enable */
+		ret = da906x_reg_clear_bits(regl->hw, regl->info->suspend.addr,
+					    regl->info->suspend.mask);
+		if (ret < 0)
+			return ret;
+
+		/* BUCKs need mode update after wake-up from suspend state. */
+		ret = da906x_update_mode_internal(regl, SYS_STATE_NORMAL);
Quoted 8 lines

drivers/regulator/da906x-regulator.c line 664

Quoted 5 lines
drivers/regulator/da906x-regulator.c new file +5 -0
+		if (ret < 0)
+			return ret;
+	}
+
+	return regulator_enable_regmap(rdev);

If suspend_mask is optional the regulators using it should just use the standard operation.

I guess, you meant here to call regulator_enable_regmap() directly for regulators NOT using suspend.mask. Then, I will do it.

Quoted 4 lines

drivers/regulator/da906x-regulator.c line 744

Quoted 2 lines
drivers/regulator/da906x-regulator.c new file +2 -0
+/* Regulator event handlers */
+irqreturn_t da906x_ldo_lim_event(int irq, void *data)

By "event handler" you mean "interrupt"

Yes. I think, I will update the comment line.

Quoted 5 lines

drivers/regulator/da906x-regulator.c line 754

Quoted 3 lines
drivers/regulator/da906x-regulator.c new file +3 -0
+	bits = da906x_reg_read(hw, DA906X_REG_STATUS_D);
+	if (bits < 0)
+		return IRQ_HANDLED;

If you fail to detect an interrupt you report that you handled one...?

For me there is no sensible return value for this case.
However, I consider changing the reaction on read failure by reporting event for all regulators, that might cause this interrupt:
+ bits = da9063_reg_read(hw, DA9063_REG_STATUS_D);
+ if (bits < 0)
+ bits = ~0;

I will update the driver according to your remaining comments.

Thank you for your comments,
Krystian

#13 lore raw

Re: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

Quoted 2 lines · Krystian Garbaciak

Because, for some regulators, this is required: val += fvol->offset, I was only able to reduce it to the following form.

What on earth makes you say this? The above is obviously linear.

Besides, you're missing several points here. One is that you should be using the framework features, another is that you should be implementing _sel.

Quoted 7 lines
Quoted 5 lines

drivers/regulator/da906x-regulator.c line 754

Quoted 3 lines
drivers/regulator/da906x-regulator.c new file +3 -0
+	bits = da906x_reg_read(hw, DA906X_REG_STATUS_D);
+	if (bits < 0)
+		return IRQ_HANDLED;

If you fail to detect an interrupt you report that you handled one...?

For me there is no sensible return value for this case.

IRQ_NONE.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#14 lore raw

Re: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

Quoted 10 lines · Krystian Garbaciak
Quoted 3 lines

Because, for some regulators, this is required: val += fvol->offset, I was only able to reduce it to the following form.

What on earth makes you say this? The above is obviously linear.

Besides, you're missing several points here. One is that you should be using the framework features, another is that you should be implementing _sel.

Sorry, I've missed an obvious thing here. Instead of adding selector offset at runtime, I can substract apropriate voltage from .min_uV. Thanks for pointing this out.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#21 lore raw

Re: [PATCH 1/8] mfd: Add Dialog DA906x core driver.

In reply to Mark Brown
Quoted 8 lines · Krystian Garbaciak
Quoted 5 lines

This is MFD module providing access to registers and interrupts of DA906x series PMIC. It is used by other functional modules, registered as MFD cells. Driver uses regmap with paging to access extended register list. Register map is divided into two pages, where the second page is used during initialisation.

Your selection of people to CC here appears both large and random...

I've added any maintainer for my modules from maintainer list.

Quoted 8 lines

drivers/mfd/da906x-core.c line 112

Quoted 4 lines
drivers/mfd/da906x-core.c new file +4 -0
+inline unsigned int da906x_to_range_reg(u16 reg)
+{
+	return reg + DA906X_MAPPING_BASE;
+}

I've no real idea what this stuff is all about, it at least needs some comments somewhere. The fact that you're just adding a constant offset to all registers is at best odd.

I will comment it precisely for next version:

+/* Adding virtual register range starting from address DA9063_MAPPING_BASE.

+   It will be used for registers requiring page switching, which in our case
+   are virtually all PMIC registers.
+   Registers from 0 to 255 are used only as a page window and are volatile,
+   except DA9063_REG_PAGE_CON register (page selector), which is cachable. */

+static const struct regmap_range_cfg da9063_range_cfg[] = {
+ {
+ .range_min = DA9063_MAPPING_BASE,
+ .range_max = DA9063_MAPPING_BASE +
+ ARRAY_SIZE(da9063_reg_flg) - 1,
+ .selector_reg = DA9063_REG_PAGE_CON,
+ .selector_mask = 1 << DA9063_I2C_PAGE_SEL_SHIFT,
+ .selector_shift = DA9063_I2C_PAGE_SEL_SHIFT,
+ .window_start = 0,
+ .window_len = 256,
+ }
+};

.. and here:

+/* Access to any PMIC register is passed through virtual register range,
+ starting at DA9063_MAPPING_BASE. For those registers, paging is required. */
+inline unsigned int da9063_to_range_reg(u16 reg)
+{
+ return reg + DA9063_MAPPING_BASE;
+}

#22 lore raw

Re: [PATCH 1/8] mfd: Add Dialog DA906x core driver.

Quoted 10 lines · Le vendredi 31 août 2012 12:20:00 Krystian Garbaciak a écrit :
Quoted 8 lines · Krystian Garbaciak
Quoted 6 lines

This is MFD module providing access to registers and interrupts of DA906x
series PMIC. It is used by other functional modules, registered as MFD cells. Driver uses regmap with paging to access extended register list. Register map is divided into two pages, where the second page is used during initialisation.>

Your selection of people to CC here appears both large and random...

I've added any maintainer for my modules from maintainer list.

You should filter manually what get_maintainer.pl tells you, sometimes it's too verbose.

I'm not maintainer of any of the files/tree this patch is touching.

Anyways, it's quite pleasing to see that get_maintainer knows me :)

Regards,

Philippe

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#23 lore raw

Re: [PATCH 1/8] mfd: Add Dialog DA906x core driver.

In reply to Krystian Garbaciak
Quoted 5 lines · Krystian Garbaciak
Quoted 3 lines · Krystian Garbaciak

Your selection of people to CC here appears both large and random...

I've added any maintainer for my modules from maintainer list.

You don't need to CC every single persojn on every single patch, and quite a few of these people are clearly not active in development.

Quoted 10 lines
Quoted 8 lines

drivers/mfd/da906x-core.c line 112

Quoted 4 lines
drivers/mfd/da906x-core.c new file +4 -0
+inline unsigned int da906x_to_range_reg(u16 reg)
+{
+	return reg + DA906X_MAPPING_BASE;
+}

I've no real idea what this stuff is all about, it at least needs some comments somewhere. The fact that you're just adding a constant offset to all registers is at best odd.

I will comment it precisely for next version:

This still makes very little sense - this function appears to be accomplishing very little. You're adding a constant offset to every single register address that gets used. Why are we doing this dynamically at runtime?

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#15 lore raw

Re: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

In reply to Krystian Garbaciak

(trimmed the CC a bit)

Hi Krystian

Quoted 1 line · Krystian Garbaciak
Quoted 1 line · Krystian Garbaciak

Sorry for picking up a random mail from this old thread, unfortunately, I don't have "0/8" in my archive.

I have to write a driver for the da9063 PMIC. Do you have an idea, whether it'd be compatible with this driver? Do you plan to continue your work on this driver or would you mind if I try to use these your patches and mainline them, preserving your authorship and copyright, of course?

Thanks
Guennadi

Quoted 13 lines
Quoted 8 lines
Quoted 2 lines

Because, for some regulators, this is required: val += fvol->offset, I was only able to reduce it to the following form.

What on earth makes you say this? The above is obviously linear.

Besides, you're missing several points here. One is that you should be using the framework features, another is that you should be implementing _sel.

Sorry, I've missed an obvious thing here. Instead of adding selector offset at runtime, I can substract apropriate voltage from .min_uV. Thanks for pointing this out.

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#16 lore raw

RE: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

Hi Guennadi Liakhovetski,

Now that Krystian no longer works for Dialog I think that I might be your best contact. As far as I am aware without doing any checking, the DA906x driver should possibly cover the DA9063.

If you need a driver, that would imply that you have some chips. Have you tried our marketting department?

Best regards,

Tony Olech

Quoted 48 lines

-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: 09 May 2013 15:06
To: Krystian Garbaciak
Cc: Mark Brown; [email protected]; Samuel Ortiz; Alessandro Zummo; Jean Delvare; Dmitry Torokhov; Richard Purdie; Anthony Olech
Subject: Re: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

(trimmed the CC a bit)

Hi Krystian

Quoted 1 line · Krystian Garbaciak
Quoted 1 line · Krystian Garbaciak

Sorry for picking up a random mail from this old thread, unfortunately, I don't have "0/8" in my archive.

I have to write a driver for the da9063 PMIC. Do you have an idea, whether it'd be compatible with this driver? Do you plan to continue your work on this driver or would you mind if I try to use these your patches and mainline them, preserving your authorship and copyright, of course?

Thanks
Guennadi

Quoted 13 lines
Quoted 8 lines
Quoted 2 lines

Because, for some regulators, this is required: val += fvol->offset, I was only able to reduce it to the following form.

What on earth makes you say this? The above is obviously linear.

Besides, you're missing several points here. One is that you should be using the framework features, another is that you should be implementing _sel.

Sorry, I've missed an obvious thing here. Instead of adding selector offset at runtime, I can substract apropriate voltage from .min_uV. Thanks for pointing this out.

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Quoted 3 lines

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer http://www.open-technology.de/

Legal Disclaimer: This e-mail communication (and any attachment/s) is confidential and contains proprietary information, some or all of which may be legally privileged. It is intended solely for the use of the individual or entity to which it is addressed. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.

Please consider the environment before printing this e-mail

#17 lore raw

RE: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

Hi Tony

Quoted 6 lines · Anthony Olech

Hi Guennadi Liakhovetski,

Now that Krystian no longer works for Dialog I think that I might be your best contact.
As far as I am aware without doing any checking, the DA906x driver should possibly cover the DA9063.

Good!

Quoted 2 lines

If you need a driver, that would imply that you have some chips. Have you tried our marketting department?

Yes, this (and a da9210) PMICs are used on one of the boards, I'm working with. I asked your marketing department for a da9210 datasheet, they tried to check with the board vendor, who is also my customer for this project, and so far they haven't been able to establish my involvement in this development. Have you also got a da9210 Linux driver? Do I have to wait for your marketing department clarifying my affiliation or could you make that driver available to me too? Or do you mean you might have a newer version of this driver available internally too?

Thanks
Guennadi

Quoted 56 lines

Best regards,

Tony Olech

Quoted 48 lines

-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: 09 May 2013 15:06
To: Krystian Garbaciak
Cc: Mark Brown; [email protected]; Samuel Ortiz; Alessandro Zummo; Jean Delvare; Dmitry Torokhov; Richard Purdie; Anthony Olech
Subject: Re: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

(trimmed the CC a bit)

Hi Krystian

Quoted 1 line · Krystian Garbaciak
Quoted 1 line · Krystian Garbaciak

Sorry for picking up a random mail from this old thread, unfortunately, I don't have "0/8" in my archive.

I have to write a driver for the da9063 PMIC. Do you have an idea, whether it'd be compatible with this driver? Do you plan to continue your work on this driver or would you mind if I try to use these your patches and mainline them, preserving your authorship and copyright, of course?

Thanks
Guennadi

Quoted 13 lines
Quoted 8 lines
Quoted 2 lines

Because, for some regulators, this is required: val += fvol->offset, I was only able to reduce it to the following form.

What on earth makes you say this? The above is obviously linear.

Besides, you're missing several points here. One is that you should be using the framework features, another is that you should be implementing _sel.

Sorry, I've missed an obvious thing here. Instead of adding selector offset at runtime, I can substract apropriate voltage from .min_uV. Thanks for pointing this out.

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Quoted 3 lines

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer http://www.open-technology.de/

Quoted 7 lines

Legal Disclaimer: This e-mail communication (and any attachment/s) is confidential and contains proprietary information, some or all of which may be legally privileged. It is intended solely for the use of the individual or entity to which it is addressed. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.

Please consider the environment before printing this e-mail

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#18 lore raw

RE: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

Hi Guennadi,

without trying to step on our marketing department's toes, I can only suggest that you slurp the online archives of the LKML and ALSA mailing list. The Linux Kernel Mailing List archive that I use is: http://lkml.indiana.edu/hypermail/linux/kernel
The ALSA mailing list archive that I use is: http://mailman.alsa-project.org/pipermail/alsa-devel

I usually run a perl/bash/wget script to download stuff of interest.

I can answer questions about our Open Source submission (because they are open source), but for definitive product information our marketing department is the first place to try.

Do you mean the da7210 (audio CODEC)? I don't offhand recognise the da9210 part number.

Best regards,

Tony Olech

Quoted 107 lines

-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: 09 May 2013 15:29
To: Anthony Olech
Cc: Krystian Garbaciak; Mark Brown; [email protected]; Samuel Ortiz; Alessandro Zummo; Jean Delvare; Dmitry Torokhov; Richard Purdie
Subject: RE: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

Hi Tony

Quoted 6 lines · Anthony Olech

Hi Guennadi Liakhovetski,

Now that Krystian no longer works for Dialog I think that I might be your best contact.
As far as I am aware without doing any checking, the DA906x driver should possibly cover the DA9063.

Good!

Quoted 2 lines

If you need a driver, that would imply that you have some chips. Have you tried our marketting department?

Yes, this (and a da9210) PMICs are used on one of the boards, I'm working with. I asked your marketing department for a da9210 datasheet, they tried to check with the board vendor, who is also my customer for this project, and so far they haven't been able to establish my involvement in this development. Have you also got a da9210 Linux driver? Do I have to wait for your marketing department clarifying my affiliation or could you make that driver available to me too? Or do you mean you might have a newer version of this driver available internally too?

Thanks
Guennadi

Quoted 12 lines

Best regards,

Tony Olech

Quoted 7 lines

-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: 09 May 2013 15:06
To: Krystian Garbaciak
Cc: Mark Brown; [email protected]; Samuel Ortiz; Alessandro Zummo; Jean Delvare; Dmitry Torokhov; Richard Purdie; Anthony Olech
Subject: Re: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage

regulators

Quoted 11 lines
Quoted 11 lines

support.

(trimmed the CC a bit)

Hi Krystian

Quoted 1 line · Krystian Garbaciak
Quoted 1 line · Krystian Garbaciak

Sorry for picking up a random mail from this old thread, unfortunately, I

don't

Quoted 3 lines
Quoted 3 lines

have "0/8" in my archive.

I have to write a driver for the da9063 PMIC. Do you have an idea, whether

it'd

Quoted 1 line
Quoted 1 line

be compatible with this driver? Do you plan to continue your work on this

driver

Quoted 26 lines
Quoted 26 lines

or would you mind if I try to use these your patches and mainline them, preserving your authorship and copyright, of course?

Thanks
Guennadi

Quoted 19 lines
Quoted 8 lines
Quoted 2 lines

Because, for some regulators, this is required: val += fvol->offset, I was only able to reduce it to the following form.

What on earth makes you say this? The above is obviously linear.

Besides, you're missing several points here. One is that you should be using the framework features, another is that you should be implementing _sel.

Sorry, I've missed an obvious thing here. Instead of adding selector offset at runtime, I can substract apropriate voltage from .min_uV. Thanks for pointing this out.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Quoted 3 lines
Quoted 3 lines

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer http://www.open-

technology.de/

Quoted 1 line

Legal Disclaimer: This e-mail communication (and any attachment/s) is

confidential and contains proprietary information,

Quoted 1 line

some or all of which may be legally privileged. It is intended solely for the use

of the individual or entity to which it

Quoted 1 line

is addressed. Access to this email by anyone else is unauthorized. If you are

not the intended recipient, any disclosure,

Quoted 1 line

copying, distribution or any action taken or omitted to be taken in reliance on

it, is prohibited and may be unlawful.

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

Please consider the environment before printing this e-mail

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

Legal Disclaimer: This e-mail communication (and any attachment/s) is confidential and contains proprietary information, some or all of which may be legally privileged. It is intended solely for the use of the individual or entity to which it is addressed. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.

Please consider the environment before printing this e-mail

#19 lore raw

RE: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

Quoted 9 lines · Anthony Olech

Hi Guennadi,

without trying to step on our marketing department's toes, I can only
suggest that you slurp the online archives of the LKML and ALSA mailing
list.
The Linux Kernel Mailing List archive that I use is: http://lkml.indiana.edu/hypermail/linux/kernel
The ALSA mailing list archive that I use is: http://mailman.alsa-project.org/pipermail/alsa-devel

I usually run a perl/bash/wget script to download stuff of interest.

I've got these patches from an online archive, thanks.

Quoted 5 lines

I can answer questions about our Open Source submission (because they are open source), but for definitive product information our marketing department is the first place to try.

Do you mean the da7210 (audio CODEC)? I don't offhand recognise the da9210 part number.

No, my task description says "a da9210 PMIC." I think this one is meant:

http://www.dialog-semiconductor.com/products/power-management/DA9210

Thanks
Guennadi

Quoted 119 lines

Best regards,

Tony Olech

Quoted 107 lines

-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: 09 May 2013 15:29
To: Anthony Olech
Cc: Krystian Garbaciak; Mark Brown; [email protected]; Samuel Ortiz; Alessandro Zummo; Jean Delvare; Dmitry Torokhov; Richard Purdie
Subject: RE: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support.

Hi Tony

Quoted 6 lines · Anthony Olech

Hi Guennadi Liakhovetski,

Now that Krystian no longer works for Dialog I think that I might be your best contact.
As far as I am aware without doing any checking, the DA906x driver should possibly cover the DA9063.

Good!

Quoted 2 lines

If you need a driver, that would imply that you have some chips. Have you tried our marketting department?

Yes, this (and a da9210) PMICs are used on one of the boards, I'm working with. I asked your marketing department for a da9210 datasheet, they tried to check with the board vendor, who is also my customer for this project, and so far they haven't been able to establish my involvement in this development. Have you also got a da9210 Linux driver? Do I have to wait for your marketing department clarifying my affiliation or could you make that driver available to me too? Or do you mean you might have a newer version of this driver available internally too?

Thanks
Guennadi

Quoted 12 lines

Best regards,

Tony Olech

Quoted 7 lines

-----Original Message-----
From: Guennadi Liakhovetski [mailto:[email protected]]
Sent: 09 May 2013 15:06
To: Krystian Garbaciak
Cc: Mark Brown; [email protected]; Samuel Ortiz; Alessandro Zummo; Jean Delvare; Dmitry Torokhov; Richard Purdie; Anthony Olech
Subject: Re: [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage

regulators

Quoted 11 lines
Quoted 11 lines

support.

(trimmed the CC a bit)

Hi Krystian

Quoted 1 line · Krystian Garbaciak
Quoted 1 line · Krystian Garbaciak

Sorry for picking up a random mail from this old thread, unfortunately, I

don't

Quoted 3 lines
Quoted 3 lines

have "0/8" in my archive.

I have to write a driver for the da9063 PMIC. Do you have an idea, whether

it'd

Quoted 1 line
Quoted 1 line

be compatible with this driver? Do you plan to continue your work on this

driver

Quoted 26 lines
Quoted 26 lines

or would you mind if I try to use these your patches and mainline them, preserving your authorship and copyright, of course?

Thanks
Guennadi

Quoted 19 lines
Quoted 8 lines
Quoted 2 lines

Because, for some regulators, this is required: val += fvol->offset, I was only able to reduce it to the following form.

What on earth makes you say this? The above is obviously linear.

Besides, you're missing several points here. One is that you should be using the framework features, another is that you should be implementing _sel.

Sorry, I've missed an obvious thing here. Instead of adding selector offset at runtime, I can substract apropriate voltage from .min_uV. Thanks for pointing this out.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Quoted 3 lines
Quoted 3 lines

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer http://www.open-

technology.de/

Quoted 1 line

Legal Disclaimer: This e-mail communication (and any attachment/s) is

confidential and contains proprietary information,

Quoted 1 line

some or all of which may be legally privileged. It is intended solely for the use

of the individual or entity to which it

Quoted 1 line

is addressed. Access to this email by anyone else is unauthorized. If you are

not the intended recipient, any disclosure,

Quoted 1 line

copying, distribution or any action taken or omitted to be taken in reliance on

it, is prohibited and may be unlawful.

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

Please consider the environment before printing this e-mail

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

Quoted 7 lines

Legal Disclaimer: This e-mail communication (and any attachment/s) is confidential and contains proprietary information, some or all of which may be legally privileged. It is intended solely for the use of the individual or entity to which it is addressed. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.

Please consider the environment before printing this e-mail

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/