Skip to contentSkip to conversation

DA9058 HWMON driver

PATCH Superseded Anthony Olech 2 participants 4 messages Aug 5, 2012 – Aug 7, 2012

Subsystems (2)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 6/7 DA9058 HWMON driver

This is the HWMON component driver of the Dialog DA9058 PMIC. This driver is just one component of the whole DA9058 PMIC driver. It depends on the core DA9058 MFD driver.

---
 drivers/hwmon/Kconfig        |   10 +
 drivers/hwmon/Makefile       |    1 +
 drivers/hwmon/da9058-hwmon.c |  390 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 401 insertions(+), 0 deletions(-)
 create mode 100644 drivers/hwmon/da9058-hwmon.c
drivers/hwmon/Kconfig +10 -0
index 6f1d167..0986f43 100644
@@ -294,6 +294,16 @@ config SENSORS_ATXP1
 	  This driver can also be built as a module.  If so, the module
 	  will be called atxp1.
 
+config SENSORS_DA9058
+	tristate "Dialog Semiconductor DA9058 ADC"
+	depends on I2C
+	help
+	  If you say yes here you get support for ADC on the Dialog
+	  Semiconductor DA9058 PMIC.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called da9058-hwmon.
+
 config SENSORS_DS620
 	tristate "Dallas Semiconductor DS620"
 	depends on I2C
drivers/hwmon/Makefile +1 -0
index e1eeac1..be99572 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_DME1737)	+= dme1737.o
+obj-$(CONFIG_SENSORS_DA9058)	+= da9058-hwmon.o
 obj-$(CONFIG_SENSORS_DS620)	+= ds620.o
 obj-$(CONFIG_SENSORS_DS1621)	+= ds1621.o
 obj-$(CONFIG_SENSORS_EMC1403)	+= emc1403.o
drivers/hwmon/da9058-hwmon.c new file +390 -0

390 lines not on this page · raw message

Signature · 7 lines
end-of-patch for NEW DRIVER V2


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
maintainer
#1 lore raw
Quoted 6 lines · Anthony Olech

This is the HWMON component driver of the Dialog DA9058 PMIC. This driver is just one component of the whole DA9058 PMIC driver. It depends on the core DA9058 MFD driver.

[ ... ]

drivers/hwmon/da9058-hwmon.c line 253

Quoted 9 lines
drivers/hwmon/da9058-hwmon.c new file +9 -0
+static SENSOR_DEVICE_ATTR(vbat_mV, S_IRUGO, da9058_read_vbat, NULL, 0);
+static SENSOR_DEVICE_ATTR(adc_mV, S_IRUGO, da9058_read_misc_channel, NULL,
+				DA9058_ADCMAN_MUXSEL_ADCIN);
+static SENSOR_DEVICE_ATTR(vfpin_mV, S_IRUGO, da9058_read_vfpin, NULL, 0);
+static SENSOR_DEVICE_ATTR(vfpin_mode, S_IRUGO, da9058_vfpin_mode, NULL, 0);
+static SENSOR_DEVICE_ATTR(tbat_mV, S_IRUGO, da9058_read_tbat, NULL, 0);
+static SENSOR_DEVICE_ATTR(tjunc_in, S_IRUGO, da9058_read_tjunc, NULL, 0);
+static SENSOR_DEVICE_ATTR(adc_mode, S_IWUSR | S_IRUGO, da9058_get_adc_mode,
+				da9058_set_adc_mode, 0);

Please use standard sysfs attribute names for temperature and voltage attributes. For configuration (XXX_mode), please use devicetreee and/or platform data, not sysfs attributes.

Thanks,
Guenter

#2 lore raw
Quoted 21 lines

-----Original Message-----
From: Guenter Roeck [mailto:[email protected]]
Sent: 06 August 2012 18:40
To: Opensource [Anthony Olech]
Cc: Guenter Roeck; Jean Delvare; Randy Dunlop; Mark Brown; David Dajun Chen; LKML; [email protected]
Subject: Re: [lm-sensors] [NEW DRIVER V2 6/7] DA9058 HWMON driver

Quoted 5 lines · Anthony Olech

This is the HWMON component driver of the Dialog DA9058 PMIC. This driver is just one component of the whole DA9058 PMIC driver. It depends on the core DA9058 MFD driver.

[ ... ]

Quoted 2 lines

+static SENSOR_DEVICE_ATTR(vbat_mV, S_IRUGO, da9058_read_vbat, NULL, +0); static SENSOR_DEVICE_ATTR(adc_mV, S_IRUGO,

da9058_read_misc_channel, NULL,

Review

Quoted 2 lines
(quoted diff) +2 -0
+				DA9058_ADCMAN_MUXSEL_ADCIN);
+static SENSOR_DEVICE_ATTR(vfpin_mV, S_IRUGO, da9058_read_vfpin,

NULL,

Quoted 1 line

+0); static SENSOR_DEVICE_ATTR(vfpin_mode, S_IRUGO,

Quoted 8 lines

da9058_vfpin_mode,

Review

Quoted 3 lines
(quoted diff) +3 -0
+NULL, 0); static SENSOR_DEVICE_ATTR(tbat_mV, S_IRUGO,
+da9058_read_tbat, NULL, 0); static SENSOR_DEVICE_ATTR(tjunc_in,
+S_IRUGO, da9058_read_tjunc, NULL, 0); static

SENSOR_DEVICE_ATTR(adc_mode, S_IWUSR | S_IRUGO,
da9058_get_adc_mode,

drivers/hwmon/da9058-hwmon.c line 253

Quoted 1 line
drivers/hwmon/da9058-hwmon.c new file +1 -0
+				da9058_set_adc_mode, 0);

Please use standard sysfs attribute names for temperature and voltage attributes.

I could not find a naming convention, so I will try to abstract one from all the HWMON driver that have your name in them. I noted when searching that I missed out a file in also that Documentation/hwmon. I will correct both issues in my next submission attempt.

Quoted 2 lines

For configuration (XXX_mode), please use devicetreee and/or platform data, not sysfs attributes.

As far as I can see both devicetreee and platform data allow configuration data to be passed into the driver at "probe" time, they don't allow an operating mode to be changed dynamically. That is what I thought sysfs allowed. Thus your comments seem to imply that you do not want to allow the mode to be changed dynamically. If that is the case then I can remove the dynamic mode setting, leaving it fixed by platform data.

Thanks,
Tony Olech

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

maintainer
#3 lore raw
Quoted 27 lines · Opensource [Anthony Olech]
Quoted 27 lines

-----Original Message-----
From: Guenter Roeck [mailto:[email protected]]
Sent: 06 August 2012 18:40
To: Opensource [Anthony Olech]
Cc: Guenter Roeck; Jean Delvare; Randy Dunlop; Mark Brown; David Dajun Chen; LKML; [email protected]
Subject: Re: [lm-sensors] [NEW DRIVER V2 6/7] DA9058 HWMON driver

Quoted 5 lines · Anthony Olech

This is the HWMON component driver of the Dialog DA9058 PMIC. This driver is just one component of the whole DA9058 PMIC driver. It depends on the core DA9058 MFD driver.

[ ... ]

Quoted 2 lines

+static SENSOR_DEVICE_ATTR(vbat_mV, S_IRUGO, da9058_read_vbat, NULL, +0); static SENSOR_DEVICE_ATTR(adc_mV, S_IRUGO,

da9058_read_misc_channel, NULL,

Review

Quoted 2 lines
(quoted diff) +2 -0
+				DA9058_ADCMAN_MUXSEL_ADCIN);
+static SENSOR_DEVICE_ATTR(vfpin_mV, S_IRUGO, da9058_read_vfpin,

NULL,

Quoted 1 line

+0); static SENSOR_DEVICE_ATTR(vfpin_mode, S_IRUGO,

da9058_vfpin_mode,

Review

Quoted 3 lines
(quoted diff) +3 -0
+NULL, 0); static SENSOR_DEVICE_ATTR(tbat_mV, S_IRUGO,
+da9058_read_tbat, NULL, 0); static SENSOR_DEVICE_ATTR(tjunc_in,
+S_IRUGO, da9058_read_tjunc, NULL, 0); static

SENSOR_DEVICE_ATTR(adc_mode, S_IWUSR | S_IRUGO,
da9058_get_adc_mode,

Quoted 4 lines
Quoted 2 lines

drivers/hwmon/da9058-hwmon.c line 253

Quoted 1 line
drivers/hwmon/da9058-hwmon.c new file +1 -0
+				da9058_set_adc_mode, 0);

Please use standard sysfs attribute names for temperature and voltage attributes.

I could not find a naming convention, so I will try to abstract one from all the

Documentation/hwmon/sysfs-interface might be a good start.

Quoted 4 lines

HWMON driver that have your name in them. I noted when searching that I missed out a file in also that Documentation/hwmon. I will correct both issues in my next submission attempt.

Quoted 8 lines
Quoted 2 lines

For configuration (XXX_mode), please use devicetreee and/or platform data, not sysfs attributes.

As far as I can see both devicetreee and platform data allow configuration data to be passed into the driver at "probe" time, they don't allow an operating mode to be changed dynamically. That is what I thought sysfs allowed. Thus your comments seem to imply that you do not want to allow the mode to be changed dynamically. If that is the case then I can remove the dynamic mode

Correct.

Quoted 2 lines

setting, leaving it fixed by platform data.

I would also suggest to read and follow Documentation/hwmon/submitting-patches.

Thanks,
Guenter