From: arno@natisbad.org (Arnaud Ebalard)
To: Simon Guinot <simon.guinot@sequanux.org>
Cc: Andrew Lunn <andrew@lunn.ch>,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
Jason Cooper <jason@lakedaemon.net>,
linux-doc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org,
Olivier Mouchet <olivier.mouchet@gmail.com>,
Rob Herring <rob.herring@calxeda.com>,
lm-sensors@lm-sensors.org,
Grant Likely <grant.likely@secretlab.ca>,
Linux ARM Kernel Mailing List
<linux-arm-kernel@lists.infradead.org>,
Rob Landley <rob@landley.net>, Jean Delvare <khali@linux-fr.org>,
Nicolas Perrin <nperrin@lacie.com>,
Guenter Roeck <linux@roeck-us.net>
Subject: Re: [lm-sensors] [PATCHv2 1/3] Add support for GMT G762/G763 PWM fan controller
Date: Sat, 15 Jun 2013 16:13:29 +0000 [thread overview]
Message-ID: <87sj0jmjx2.fsf@natisbad.org> (raw)
In-Reply-To: 20130604212306.GL7626@kw.sim.vm.gnt
Hi Simon,
spoiler: end of the story below ;-)
Simon Guinot <simon.guinot@sequanux.org> writes:
> OK you are lucky. Your bootloader initialize set_cnt with 0x5a. Mine
> don't and it is precisely the issue: set_cnt is still 0xff (the default
> value) when the driver controls the fan.
>
> Please, could you try open-loop mode with set_cnt set to 0xff ? Maybe
> you can enforce this value for the test purpose ?
>
> If you observe the same behaviour than me, then could modify the driver
> to ensure that set_cnt is not 0xff when open-loop mode is selected ?
> Maybe by systematically setting a different value (as 0) ?
Here we go:
# cd /sys/bus/i2c/drivers/g762/0-003e
# for k in fan* pwm* ; do echo -n "$k:" ; echo `cat $k `; done
fan1_alarm:0
fan1_div:1
fan1_fault:0
fan1_input:1365
fan1_pulses:2
fan1_target:1365
pwm1:0
pwm1_enable:2 /* closed-loop */
pwm1_mode:0 /* DC mode */
# echo 0 > fan1_target /* set set_cnt to 0, fan stops rotating */
# echo 1 > pwm1_enable /* switch to open-loop, fan does not rotate yet
* as default value for set_out is 0 and it has
* neither been touched by bootloader or driver */
# for k in fan* pwm* ; do echo -n "$k:" ; echo `cat $k `; done
fan1_alarm:0
fan1_div:1
fan1_fault:0
fan1_input:0
fan1_pulses:2
fan1_target:0
pwm1:0
pwm1_enable:1
pwm1_mode:0
# echo 100 > pwm1 /* set set_out to 100, fan rotates */
I don't get the issue in DC mode but ...
# echo 1 > pwm1_mode /* switch to PWM mode, fan stops rotating
* even though set_out is still set to
* 100: */
# for k in fan* pwm* ; do echo -n "$k:" ; echo `cat $k `; done
fan1_alarm:0
fan1_div:1
fan1_fault:1
fan1_input:0
fan1_pulses:2
fan1_target:0
pwm1:100
pwm1_enable:1
pwm1_mode:1
# echo 1000 > fan1_target
At that point, fan starts rotating again and its speed can be controlled
using pwm1 (i.e. set_out). But, as you pointed, if set_cnt is set to 255
then, it stop rotating: with my hardware, I tried and set fan1_target to
481 (set_cnt is 255) and fan stops. Then setting fan1_target to 482
gives set_cnt a value of 254 and make the fan run again.
So, as a conclusion, I think I get the behavior you described i.e. in
PWM mode + open-loop, if set_cnt is 255, then the fan will not rotate,
no matter the value of set_out (which is supposed to control the
rotation w/ open-loop). The problem does not appear in DC mode
(i.e. set_cnt can be 255 in DC mode + open-loop and the fan will rotate
as expected based on set_out value).
In v4 version to come, I have implemented the following fix:
switch (val) {
case G762_FAN_MODE_OPEN_LOOP:
data->fan_cmd1 &= ~G762_REG_FAN_CMD1_FAN_MODE;
/*
* BUG FIX: if SET_CNT register value is 255 then, for some
* unknown reason, fan will not rotate as expected, no matter
* the value of SET_OUT (to be specific, this seems to happen
* only in PWM mode). To workaround this bug, we give SET_CNT
* value of 254 if it is 255 when switching to open-loop.
*/
if (data->set_cnt = 0xff)
i2c_smbus_write_byte_data(client, G762_REG_SET_CNT,
254);
break;
case G762_FAN_MODE_CLOSED_LOOP:
data->fan_cmd1 |= G762_REG_FAN_CMD1_FAN_MODE;
break;
default:
goto out;
}
I tested it and it fixe the issue. Can you confirm it also does on your
side Simon by testing v4?
Cheers,
a+
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
WARNING: multiple messages have this Message-ID (diff)
From: arno@natisbad.org (Arnaud Ebalard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 1/3] Add support for GMT G762/G763 PWM fan controller
Date: Sat, 15 Jun 2013 18:13:29 +0200 [thread overview]
Message-ID: <87sj0jmjx2.fsf@natisbad.org> (raw)
In-Reply-To: 20130604212306.GL7626@kw.sim.vm.gnt
Hi Simon,
spoiler: end of the story below ;-)
Simon Guinot <simon.guinot@sequanux.org> writes:
> OK you are lucky. Your bootloader initialize set_cnt with 0x5a. Mine
> don't and it is precisely the issue: set_cnt is still 0xff (the default
> value) when the driver controls the fan.
>
> Please, could you try open-loop mode with set_cnt set to 0xff ? Maybe
> you can enforce this value for the test purpose ?
>
> If you observe the same behaviour than me, then could modify the driver
> to ensure that set_cnt is not 0xff when open-loop mode is selected ?
> Maybe by systematically setting a different value (as 0) ?
Here we go:
# cd /sys/bus/i2c/drivers/g762/0-003e
# for k in fan* pwm* ; do echo -n "$k:" ; echo `cat $k `; done
fan1_alarm:0
fan1_div:1
fan1_fault:0
fan1_input:1365
fan1_pulses:2
fan1_target:1365
pwm1:0
pwm1_enable:2 /* closed-loop */
pwm1_mode:0 /* DC mode */
# echo 0 > fan1_target /* set set_cnt to 0, fan stops rotating */
# echo 1 > pwm1_enable /* switch to open-loop, fan does not rotate yet
* as default value for set_out is 0 and it has
* neither been touched by bootloader or driver */
# for k in fan* pwm* ; do echo -n "$k:" ; echo `cat $k `; done
fan1_alarm:0
fan1_div:1
fan1_fault:0
fan1_input:0
fan1_pulses:2
fan1_target:0
pwm1:0
pwm1_enable:1
pwm1_mode:0
# echo 100 > pwm1 /* set set_out to 100, fan rotates */
I don't get the issue in DC mode but ...
# echo 1 > pwm1_mode /* switch to PWM mode, fan stops rotating
* even though set_out is still set to
* 100: */
# for k in fan* pwm* ; do echo -n "$k:" ; echo `cat $k `; done
fan1_alarm:0
fan1_div:1
fan1_fault:1
fan1_input:0
fan1_pulses:2
fan1_target:0
pwm1:100
pwm1_enable:1
pwm1_mode:1
# echo 1000 > fan1_target
At that point, fan starts rotating again and its speed can be controlled
using pwm1 (i.e. set_out). But, as you pointed, if set_cnt is set to 255
then, it stop rotating: with my hardware, I tried and set fan1_target to
481 (set_cnt is 255) and fan stops. Then setting fan1_target to 482
gives set_cnt a value of 254 and make the fan run again.
So, as a conclusion, I think I get the behavior you described i.e. in
PWM mode + open-loop, if set_cnt is 255, then the fan will not rotate,
no matter the value of set_out (which is supposed to control the
rotation w/ open-loop). The problem does not appear in DC mode
(i.e. set_cnt can be 255 in DC mode + open-loop and the fan will rotate
as expected based on set_out value).
In v4 version to come, I have implemented the following fix:
switch (val) {
case G762_FAN_MODE_OPEN_LOOP:
data->fan_cmd1 &= ~G762_REG_FAN_CMD1_FAN_MODE;
/*
* BUG FIX: if SET_CNT register value is 255 then, for some
* unknown reason, fan will not rotate as expected, no matter
* the value of SET_OUT (to be specific, this seems to happen
* only in PWM mode). To workaround this bug, we give SET_CNT
* value of 254 if it is 255 when switching to open-loop.
*/
if (data->set_cnt == 0xff)
i2c_smbus_write_byte_data(client, G762_REG_SET_CNT,
254);
break;
case G762_FAN_MODE_CLOSED_LOOP:
data->fan_cmd1 |= G762_REG_FAN_CMD1_FAN_MODE;
break;
default:
goto out;
}
I tested it and it fixe the issue. Can you confirm it also does on your
side Simon by testing v4?
Cheers,
a+
WARNING: multiple messages have this Message-ID (diff)
From: arno@natisbad.org (Arnaud Ebalard)
To: Simon Guinot <simon.guinot@sequanux.org>
Cc: Andrew Lunn <andrew@lunn.ch>,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
Jason Cooper <jason@lakedaemon.net>,
linux-doc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org,
Olivier Mouchet <olivier.mouchet@gmail.com>,
Rob Herring <rob.herring@calxeda.com>,
lm-sensors@lm-sensors.org,
Grant Likely <grant.likely@secretlab.ca>,
Linux ARM Kernel Mailing List
<linux-arm-kernel@lists.infradead.org>,
Rob Landley <rob@landley.net>, Jean Delvare <khali@linux-fr.org>,
Nicolas Perrin <nperrin@lacie.com>,
Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCHv2 1/3] Add support for GMT G762/G763 PWM fan controller
Date: Sat, 15 Jun 2013 18:13:29 +0200 [thread overview]
Message-ID: <87sj0jmjx2.fsf@natisbad.org> (raw)
In-Reply-To: 20130604212306.GL7626@kw.sim.vm.gnt
Hi Simon,
spoiler: end of the story below ;-)
Simon Guinot <simon.guinot@sequanux.org> writes:
> OK you are lucky. Your bootloader initialize set_cnt with 0x5a. Mine
> don't and it is precisely the issue: set_cnt is still 0xff (the default
> value) when the driver controls the fan.
>
> Please, could you try open-loop mode with set_cnt set to 0xff ? Maybe
> you can enforce this value for the test purpose ?
>
> If you observe the same behaviour than me, then could modify the driver
> to ensure that set_cnt is not 0xff when open-loop mode is selected ?
> Maybe by systematically setting a different value (as 0) ?
Here we go:
# cd /sys/bus/i2c/drivers/g762/0-003e
# for k in fan* pwm* ; do echo -n "$k:" ; echo `cat $k `; done
fan1_alarm:0
fan1_div:1
fan1_fault:0
fan1_input:1365
fan1_pulses:2
fan1_target:1365
pwm1:0
pwm1_enable:2 /* closed-loop */
pwm1_mode:0 /* DC mode */
# echo 0 > fan1_target /* set set_cnt to 0, fan stops rotating */
# echo 1 > pwm1_enable /* switch to open-loop, fan does not rotate yet
* as default value for set_out is 0 and it has
* neither been touched by bootloader or driver */
# for k in fan* pwm* ; do echo -n "$k:" ; echo `cat $k `; done
fan1_alarm:0
fan1_div:1
fan1_fault:0
fan1_input:0
fan1_pulses:2
fan1_target:0
pwm1:0
pwm1_enable:1
pwm1_mode:0
# echo 100 > pwm1 /* set set_out to 100, fan rotates */
I don't get the issue in DC mode but ...
# echo 1 > pwm1_mode /* switch to PWM mode, fan stops rotating
* even though set_out is still set to
* 100: */
# for k in fan* pwm* ; do echo -n "$k:" ; echo `cat $k `; done
fan1_alarm:0
fan1_div:1
fan1_fault:1
fan1_input:0
fan1_pulses:2
fan1_target:0
pwm1:100
pwm1_enable:1
pwm1_mode:1
# echo 1000 > fan1_target
At that point, fan starts rotating again and its speed can be controlled
using pwm1 (i.e. set_out). But, as you pointed, if set_cnt is set to 255
then, it stop rotating: with my hardware, I tried and set fan1_target to
481 (set_cnt is 255) and fan stops. Then setting fan1_target to 482
gives set_cnt a value of 254 and make the fan run again.
So, as a conclusion, I think I get the behavior you described i.e. in
PWM mode + open-loop, if set_cnt is 255, then the fan will not rotate,
no matter the value of set_out (which is supposed to control the
rotation w/ open-loop). The problem does not appear in DC mode
(i.e. set_cnt can be 255 in DC mode + open-loop and the fan will rotate
as expected based on set_out value).
In v4 version to come, I have implemented the following fix:
switch (val) {
case G762_FAN_MODE_OPEN_LOOP:
data->fan_cmd1 &= ~G762_REG_FAN_CMD1_FAN_MODE;
/*
* BUG FIX: if SET_CNT register value is 255 then, for some
* unknown reason, fan will not rotate as expected, no matter
* the value of SET_OUT (to be specific, this seems to happen
* only in PWM mode). To workaround this bug, we give SET_CNT
* value of 254 if it is 255 when switching to open-loop.
*/
if (data->set_cnt == 0xff)
i2c_smbus_write_byte_data(client, G762_REG_SET_CNT,
254);
break;
case G762_FAN_MODE_CLOSED_LOOP:
data->fan_cmd1 |= G762_REG_FAN_CMD1_FAN_MODE;
break;
default:
goto out;
}
I tested it and it fixe the issue. Can you confirm it also does on your
side Simon by testing v4?
Cheers,
a+
next prev parent reply other threads:[~2013-06-15 16:13 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-27 22:02 [lm-sensors] [PATCHv2 0/3] Add G762/G763 PWM fan controller Arnaud Ebalard
2013-05-27 22:02 ` Arnaud Ebalard
2013-05-27 22:02 ` Arnaud Ebalard
2013-05-27 22:03 ` [lm-sensors] [PATCHv2 1/3] Add support for GMT " Arnaud Ebalard
2013-05-27 22:03 ` Arnaud Ebalard
2013-05-27 22:03 ` Arnaud Ebalard
2013-05-31 22:16 ` [lm-sensors] " Simon Guinot
2013-05-31 22:16 ` Simon Guinot
2013-05-31 22:16 ` Simon Guinot
2013-06-01 17:26 ` [lm-sensors] " Arnaud Ebalard
2013-06-01 17:26 ` Arnaud Ebalard
2013-06-01 17:26 ` Arnaud Ebalard
2013-06-02 15:45 ` [lm-sensors] " Arnaud Ebalard
2013-06-02 15:45 ` Arnaud Ebalard
2013-06-02 15:45 ` Arnaud Ebalard
2013-06-02 20:35 ` [lm-sensors] " Guenter Roeck
2013-06-02 20:35 ` Guenter Roeck
2013-06-02 20:35 ` Guenter Roeck
2013-06-02 21:36 ` [lm-sensors] " Arnaud Ebalard
2013-06-02 21:36 ` Arnaud Ebalard
2013-06-02 21:36 ` Arnaud Ebalard
2013-06-02 21:59 ` [lm-sensors] " Simon Guinot
2013-06-02 21:59 ` Simon Guinot
2013-06-02 21:59 ` Simon Guinot
2013-06-04 6:52 ` [lm-sensors] " Arnaud Ebalard
2013-06-04 6:52 ` Arnaud Ebalard
2013-06-04 6:52 ` Arnaud Ebalard
2013-06-04 21:23 ` [lm-sensors] " Simon Guinot
2013-06-04 21:23 ` Simon Guinot
2013-06-04 21:23 ` Simon Guinot
2013-06-11 15:15 ` [lm-sensors] " Guenter Roeck
2013-06-11 15:15 ` Guenter Roeck
2013-06-11 15:15 ` Guenter Roeck
2013-06-15 16:13 ` Arnaud Ebalard [this message]
2013-06-15 16:13 ` Arnaud Ebalard
2013-06-15 16:13 ` Arnaud Ebalard
2013-06-04 6:51 ` [lm-sensors] " Arnaud Ebalard
2013-06-04 6:51 ` Arnaud Ebalard
2013-06-04 6:51 ` Arnaud Ebalard
2013-06-01 14:33 ` [lm-sensors] " Guenter Roeck
2013-06-01 14:33 ` Guenter Roeck
2013-06-01 14:33 ` Guenter Roeck
2013-06-02 15:39 ` [lm-sensors] " Arnaud Ebalard
2013-06-02 15:39 ` Arnaud Ebalard
2013-06-02 15:39 ` Arnaud Ebalard
2013-05-27 22:03 ` [lm-sensors] [PATCHv2 2/3] Add documentation for g762 driver Arnaud Ebalard
2013-05-27 22:03 ` Arnaud Ebalard
2013-05-27 22:03 ` Arnaud Ebalard
2013-05-27 22:03 ` [lm-sensors] [PATCHv2 3/3] Add DT bindings " Arnaud Ebalard
2013-05-27 22:03 ` Arnaud Ebalard
2013-05-27 22:03 ` Arnaud Ebalard
2013-05-27 22:15 ` [lm-sensors] [PATCHv2 0/3] Add G762/G763 PWM fan controller Arnd Bergmann
2013-05-27 22:15 ` Arnd Bergmann
2013-05-27 22:15 ` Arnd Bergmann
2013-05-28 10:15 ` [lm-sensors] " Arnaud Ebalard
2013-05-28 10:15 ` Arnaud Ebalard
2013-05-28 10:15 ` Arnaud Ebalard
2013-05-28 11:19 ` [lm-sensors] " Thierry Reding
2013-05-28 11:19 ` Thierry Reding
2013-05-28 11:19 ` Thierry Reding
2013-05-28 12:29 ` [lm-sensors] " Guenter Roeck
2013-05-28 12:29 ` Guenter Roeck
2013-05-28 12:29 ` Guenter Roeck
2013-05-28 13:47 ` [lm-sensors] " Thierry Reding
2013-05-28 13:47 ` Thierry Reding
2013-05-28 13:47 ` Thierry Reding
2013-05-28 15:42 ` [lm-sensors] " Guenter Roeck
2013-05-28 15:42 ` Guenter Roeck
2013-05-28 15:42 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sj0jmjx2.fsf@natisbad.org \
--to=arno@natisbad.org \
--cc=andrew@lunn.ch \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=jason@lakedaemon.net \
--cc=khali@linux-fr.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=linux@roeck-us.net \
--cc=lm-sensors@lm-sensors.org \
--cc=nperrin@lacie.com \
--cc=olivier.mouchet@gmail.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--cc=simon.guinot@sequanux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.