Welcome! Log In Create A New Profile

Advanced

DLink DNS-325 fancontrol

Posted by t96 
t96
DLink DNS-325 fancontrol
November 01, 2018 08:45AM
Hi everybody

Anybody knows how to configure fancontrol for DNS-325

pwmconfig replies

'There are no pwm-capable sensor modules installed'
Re: DLink DNS-325 fancontrol
November 01, 2018 03:01PM
Hi,

I run alt-f firmware on my DNS325. It may be worth looking through the source code or asking on their forum.

Koen

https://sites.google.com/site/altfirmware/home
Re: DLink DNS-325 fancontrol
November 01, 2018 05:54PM
For a NAS you may want fancontrol to be driven by HDD temperature instead of CPU temperature. See https://linuxconfig.org/fan-control-and-hard-drive-temperature-on-thecus-n2100-with-debian-lenny for an example of how it was done on a Thecus N2100 NAS.

Ray
t96
Re: DLink DNS-325 fancontrol
November 05, 2018 03:24PM
Actually fancotrol package itself is not what I really need.

I hoped that its configuration could help help me to find out how to control fan speed, because I don't know how
to use device tree information for this case.

May be some modules are not loaded automatically in order to get pwm or fan devices, but I don't know which one are required.
Re: DLink DNS-325 fancontrol
November 05, 2018 04:02PM
t96,

> May be some modules are not loaded automatically
> in order to get pwm or fan devices, but I don't
> know which one are required.

This one seems to have GPIO fan control. Do you have the DTS that you are using to run this kernel?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
t96
Re: DLink DNS-325 fancontrol
November 05, 2018 04:24PM
bodhi Wrote:
-------------------------------------------------------

>Do you have the DTS that you are using to run this kernel?

I'm using exact kirkwood-dns325.dtb from linux-dtb-4.19.0-kirkwood-tld-1.tar

I could see that gpio_fan node is defined there with gpio-fan compatible device

	gpio_fan {
		/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
		compatible = "gpio-fan";
		pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>;
		pinctrl-names = "default";
		gpios = <&gpio1 14 GPIO_ACTIVE_LOW
			 &gpio1 13 GPIO_ACTIVE_LOW>;
		gpio-fan,speed-map = <0    0
				      3000 1
				      6000 2>;
	};

but I don't know what to do next with this information :)
Re: DLink DNS-325 fancontrol
November 05, 2018 05:48PM
t96,

> I'm using exact kirkwood-dns325.dtb from
> linux-dtb-4.19.0-kirkwood-tld-1.tar

:) that'd make it easy.

> but I don't know what to do next with this
> information :)

I forgot to put this post up in the Wiki thread!

Here is how to control GPIO in Linux:
https://forum.doozan.com/read.php?2,12096,35663#msg-35663

Basically there 3 speeds here: 0, 3000, 6000.

So you setup the GPIO and echo 1 or 0 to activate/deactivate that GPIO in the directory

/sys/class/gpio/

Note the GPIO bank is bank 1 here, so you need to add 32 to the value to get the number, therefore:

46 for highspeed GPIO
35 for lowspeed GPIO

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 2 time(s). Last edit at 11/05/2018 05:50PM by bodhi.
t96
Re: DLink DNS-325 fancontrol
November 06, 2018 03:44AM
Thank you very much, I will try it

From the other hand, it looks that gpio-fan driver is not included neither into kernel nor to modules.
It seems to me that this is why additional sensors are not created and fancontrol package couldn't find it.

Is there any reason for that?
Re: DLink DNS-325 fancontrol
November 06, 2018 04:22AM
t96,

You meant the sensor driver is not in the kernel?

Quick peek: It is in the kernel.

CONFIG_SENSORS_LM75=m

Try
modprobe lm75

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 2 time(s). Last edit at 11/06/2018 04:26AM by bodhi.
t96
Re: DLink DNS-325 fancontrol
November 06, 2018 04:50AM
LM75 driver is there and works.

I mean driver for gpio-fan, this node is present in device tree as I mentioned before
If I'm not mistaken it is
# CONFIG_SENSORS_GPIO_FAN is not set
Re: DLink DNS-325 fancontrol
November 06, 2018 05:11AM
t96,

> LM75 driver is there and works.
>
> I mean driver for gpio-fan, this node is present
> in device tree as I mentioned before
> If I'm not mistaken it is
>
> # CONFIG_SENSORS_GPIO_FAN is not set
>

Ah! you're right, of course :) none of the Kirkwood boxes that I've been supporting here has GPIO control fan. I guess users in this forum who have this DNS-325 must have been running mainline kernel from Debian on this box.

Will add this to the Kirkwood kernel 4.19.0+. This driver is should be configured in but I did not notice it's missing.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
t96
Re: DLink DNS-325 fancontrol
November 06, 2018 06:38AM
Great

Could you compile gpio-fan.ko for me for linux-4.19.0-kirkwood-tld-1.
I will test it, may be some other problems will appear.

Thank you in advance
t96
Re: DLink DNS-325 fancontrol
November 06, 2018 01:33PM
GPIO control works, but

bodhi Wrote:
-------------------------------------------------------
> 46 for highspeed GPIO
> 35 for lowspeed GPIO

46 for lowspeed
45 for highspeed
Re: DLink DNS-325 fancontrol
November 06, 2018 03:32PM
t96,

> GPIO control works, but

> 46 for lowspeed
> 45 for highspeed

Yes, that was a typo!

So did you compile or found gpio-fan driver and modprobe it and it is working?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
t96
Re: DLink DNS-325 fancontrol
November 06, 2018 03:57PM
bodhi Wrote:
-------------------------------------------------------
> So did you compile or found gpio-fan driver and
> modprobe it and it is working?

No, I don't know where to find kernel sources for 4.19, latest git label is 4.18-rc1
Re: DLink DNS-325 fancontrol
November 06, 2018 04:22PM
t96 Wrote:
-------------------------------------------------------
> bodhi Wrote:
> -------------------------------------------------------
> > So did you compile or found gpio-fan driver and
> > modprobe it and it is working?
>
> No, I don't know where to find kernel sources for
> 4.19, latest git label is 4.18-rc1

OK. Let me compile it for you.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: DLink DNS-325 fancontrol
November 07, 2018 04:52AM
Here attached is the gpio-fan.ko module. Copy this to your rootfs folder

/lib/modules/4.19.0-kirkwood-tld-1/kernel/drivers/hwmon/

and try modprobe it.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Attachments:
open | download - gpio-fan.ko (13.8 KB)
t96
Re: DLink DNS-325 fancontrol
November 07, 2018 05:44AM
Thank you

Something not ok

Kernel output
gpio-fan gpio_fan: missing speed array entry for GPIO value 0x3

Kernel code
static int get_fan_speed_index(struct gpio_fan_data *fan_data)
{
	int ctrl_val = __get_fan_ctrl(fan_data);
	int i;

	for (i = 0; i < fan_data->num_speed; i++)
		if (fan_data->speed.ctrl_val == ctrl_val)
			return i;

	dev_warn(fan_data->dev,
		 "missing speed array entry for GPIO value 0x%x\n", ctrl_val);

	return -ENODEV;
}
Re: DLink DNS-325 fancontrol
November 09, 2018 04:57PM
t96,

Let's wait unitl I release a stable version 4.19.x-kirkwood-tld-y. I think I will do that before kernel 4.20.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: