All of lore.kernel.org
 help / color / mirror / Atom feed
* adt7411: external thermal diode support
@ 2016-07-22 11:09 Michael Walle
  2016-07-22 13:21 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Walle @ 2016-07-22 11:09 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-hwmon

Hi,

I'm looking into adding support for the external thermal diode. On the 
ADT7411 you can either use AIN1 and AIN2 to measure voltages or use the 
two input to measure temperature via a thermal diode. As far as I 
understand it, the sysfs attributes have to be created dynamically, eg. 
either create the in1_input and in2_input or temp2_input depending on 
the mode. All current drivers (besides coretemp) use 
devm_hwmon_device_register_with_groups() which has a static set of 
groups, but registers its attributes in 
/sys/class/hwmon/hwmonN/<attribute>. Drivers which use some kind of 
dynamic attributes use sysfs_create_group(<underlying device>) and 
hwmon_device_register(), where the attributes are visible at 
/sys/class/hwmon/hwmonN/device/<attribute>.

/sys/class/hwmon/<attribute> is the preferred/new method, isn't it? If I 
add support for the the thermal diode I would have to switch the adt7411 
driver to the old method, right? So, I guess this is a bad way to do it. 
Do you have any hints for me?

What entity should configure the external mode? Eg. the bootloader might 
set the EXT_TDM bit or the linux kernel could enable it depending on 
some DTS property.

Thanks,
-michael

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: adt7411: external thermal diode support
  2016-07-22 11:09 adt7411: external thermal diode support Michael Walle
@ 2016-07-22 13:21 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2016-07-22 13:21 UTC (permalink / raw)
  To: Michael Walle; +Cc: linux-hwmon

On 07/22/2016 04:09 AM, Michael Walle wrote:
> Hi,
>
> I'm looking into adding support for the external thermal diode. On the ADT7411 you can either use AIN1 and AIN2 to measure voltages or use the two input to measure temperature via a thermal diode. As far as I understand it, the sysfs attributes have to be created dynamically, eg. either create the in1_input and in2_input or temp2_input depending on the mode. All current drivers (besides coretemp) use devm_hwmon_device_register_with_groups() which has a static set of groups, but registers its attributes in /sys/class/hwmon/hwmonN/<attribute>. Drivers which use some kind of dynamic attributes use sysfs_create_group(<underlying device>) and hwmon_device_register(), where the attributes are visible at /sys/class/hwmon/hwmonN/device/<attribute>.

Do not use hwmon_device_register().

>
> /sys/class/hwmon/<attribute> is the preferred/new method, isn't it? If I add support for the the thermal diode I would have to switch the adt7411 driver to the old method, right? So, I guess this is a bad way to do it. Do you have any hints for me?

Either use multiple groups, and select the groups to use in the probe function,
or one group and the is_visible() callback.

>
> What entity should configure the external mode? Eg. the bootloader might set the EXT_TDM bit or the linux kernel could enable it depending on some DTS property.
>
Both are fine, though it would not normally be the bootloader but the BIOS or ROMMON.
Other possible methods would be to use platform data or ACPI.

Guenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-22 13:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-22 11:09 adt7411: external thermal diode support Michael Walle
2016-07-22 13:21 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.