All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] board/ls2088ardb: set rear fan speed to reduce noise
@ 2016-11-21  8:30 ying.zhang22455 at nxp.com
  2016-11-30 18:20 ` york sun
  0 siblings, 1 reply; 2+ messages in thread
From: ying.zhang22455 at nxp.com @ 2016-11-21  8:30 UTC (permalink / raw)
  To: u-boot

From: Ying Zhang <ying.zhang22455@nxp.com>

Fan settings(PWM signal set to ~50% duty cycle for all three rear)
fans provide good thermal air flow with considerable reduction of
fan noise.

Signed-off-by: Ying Zhang <ying.zhang22455@nxp.com>
---
[changed from v1]: make the function static.

 board/freescale/ls2080ardb/ls2080ardb.c | 31 +++++++++++++++++++++++++++++++
 include/configs/ls2080ardb.h            |  6 ++++++
 2 files changed, 37 insertions(+)

diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index 83d9e7e..bc5dd53 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -151,6 +151,36 @@ int config_board_mux(int ctrl_type)
 	return 0;
 }
 
+static void set_fan_speed(void)
+{
+	int ret, i;
+	u8 value;
+
+	select_i2c_ch_pca9547(I2C_MUX_CH_FAN);
+	value = 0x80;
+	ret = i2c_write(I2C_FAN_CONTROLLER_ADDR, 0x0, 1, &value, 1);
+	if (ret) {
+		printf("Fan: Failed to set fan speed\n");
+		return;
+	}
+	value = 1;
+	ret = i2c_write(I2C_FAN_CONTROLLER_ADDR, 0x58, 1, &value, 1);
+	if (ret) {
+		printf("Fan: Failed to set fan speed\n");
+		return;
+	}
+
+	/* set PWM = ~50% DCyc for all rear PWM fans */
+	value = 0x20;
+	for (i = 0xb4; i < 0xb9; i++) {
+		ret = i2c_write(I2C_FAN_CONTROLLER_ADDR, i, 1, &value, 1);
+		if (ret) {
+			printf("Fan: Failed to set fan speed\n");
+			return;
+		}
+	}
+}
+
 int board_init(void)
 {
 	char *env_hwconfig;
@@ -175,6 +205,7 @@ int board_init(void)
 #ifdef CONFIG_ENV_IS_NOWHERE
 	gd->env_addr = (ulong)&default_environment[0];
 #endif
+	set_fan_speed();
 	select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
 
 	QIXIS_WRITE(rst_ctl, QIXIS_RST_CTL_RESET_EN);
diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
index b9cb6d3..05f98c0 100644
--- a/include/configs/ls2080ardb.h
+++ b/include/configs/ls2080ardb.h
@@ -264,6 +264,7 @@ unsigned long get_board_sys_clk(void);
 
 /* I2C bus multiplexer */
 #define I2C_MUX_CH_DEFAULT      0x8
+#define	I2C_MUX_CH_FAN		0xd
 
 /* SPI */
 #ifdef CONFIG_FSL_DSPI
@@ -279,6 +280,11 @@ unsigned long get_board_sys_clk(void);
 #define CONFIG_SYS_I2C_RTC_ADDR         0x68
 #define CONFIG_CMD_DATE
 
+/*
+ * Winbond fan controller
+ */
+#define I2C_FAN_CONTROLLER_ADDR		0x2c
+
 /* EEPROM */
 #define CONFIG_ID_EEPROM
 #define CONFIG_CMD_EEPROM
-- 
2.1.0.27.g96db324

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

* [U-Boot] [PATCH v2] board/ls2088ardb: set rear fan speed to reduce noise
  2016-11-21  8:30 [U-Boot] [PATCH v2] board/ls2088ardb: set rear fan speed to reduce noise ying.zhang22455 at nxp.com
@ 2016-11-30 18:20 ` york sun
  0 siblings, 0 replies; 2+ messages in thread
From: york sun @ 2016-11-30 18:20 UTC (permalink / raw)
  To: u-boot

Ying,

There is no ls2088ardb board. It is ls2080ardb target supporting all 
three variants.

On 11/21/2016 05:30 AM, ying.zhang22455 at nxp.com wrote:
> From: Ying Zhang <ying.zhang22455@nxp.com>
>
> Fan settings(PWM signal set to ~50% duty cycle for all three rear)
> fans provide good thermal air flow with considerable reduction of
> fan noise.

This grammar is wrong in this sentence.

>
> Signed-off-by: Ying Zhang <ying.zhang22455@nxp.com>
> ---
> [changed from v1]: make the function static.
>
>  board/freescale/ls2080ardb/ls2080ardb.c | 31 +++++++++++++++++++++++++++++++
>  include/configs/ls2080ardb.h            |  6 ++++++
>  2 files changed, 37 insertions(+)
>
> diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
> index 83d9e7e..bc5dd53 100644
> --- a/board/freescale/ls2080ardb/ls2080ardb.c
> +++ b/board/freescale/ls2080ardb/ls2080ardb.c
> @@ -151,6 +151,36 @@ int config_board_mux(int ctrl_type)
>  	return 0;
>  }
>
> +static void set_fan_speed(void)
> +{
> +	int ret, i;
> +	u8 value;
> +
> +	select_i2c_ch_pca9547(I2C_MUX_CH_FAN);
> +	value = 0x80;

What are these values 0x80. 1, 0x20? Can you put some comments here so 
others don't have to read through the reference manual of the i2c chip?

> +	ret = i2c_write(I2C_FAN_CONTROLLER_ADDR, 0x0, 1, &value, 1);
> +	if (ret) {
> +		printf("Fan: Failed to set fan speed\n");
> +		return;
> +	}
> +	value = 1;
> +	ret = i2c_write(I2C_FAN_CONTROLLER_ADDR, 0x58, 1, &value, 1);
> +	if (ret) {
> +		printf("Fan: Failed to set fan speed\n");
> +		return;
> +	}
> +
> +	/* set PWM = ~50% DCyc for all rear PWM fans */
> +	value = 0x20;
> +	for (i = 0xb4; i < 0xb9; i++) {
> +		ret = i2c_write(I2C_FAN_CONTROLLER_ADDR, i, 1, &value, 1);
> +		if (ret) {
> +			printf("Fan: Failed to set fan speed\n");
> +			return;
> +		}
> +	}

Do you want to skip the rest of fans if one fails?

York


> +}
> +
>  int board_init(void)
>  {
>  	char *env_hwconfig;
> @@ -175,6 +205,7 @@ int board_init(void)
>  #ifdef CONFIG_ENV_IS_NOWHERE
>  	gd->env_addr = (ulong)&default_environment[0];
>  #endif
> +	set_fan_speed();
>  	select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
>
>  	QIXIS_WRITE(rst_ctl, QIXIS_RST_CTL_RESET_EN);
> diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
> index b9cb6d3..05f98c0 100644
> --- a/include/configs/ls2080ardb.h
> +++ b/include/configs/ls2080ardb.h
> @@ -264,6 +264,7 @@ unsigned long get_board_sys_clk(void);
>
>  /* I2C bus multiplexer */
>  #define I2C_MUX_CH_DEFAULT      0x8
> +#define	I2C_MUX_CH_FAN		0xd
>
>  /* SPI */
>  #ifdef CONFIG_FSL_DSPI
> @@ -279,6 +280,11 @@ unsigned long get_board_sys_clk(void);
>  #define CONFIG_SYS_I2C_RTC_ADDR         0x68
>  #define CONFIG_CMD_DATE
>
> +/*
> + * Winbond fan controller
> + */
> +#define I2C_FAN_CONTROLLER_ADDR		0x2c
> +
>  /* EEPROM */
>  #define CONFIG_ID_EEPROM
>  #define CONFIG_CMD_EEPROM
>

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

end of thread, other threads:[~2016-11-30 18:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-21  8:30 [U-Boot] [PATCH v2] board/ls2088ardb: set rear fan speed to reduce noise ying.zhang22455 at nxp.com
2016-11-30 18:20 ` york sun

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.