Skip to contentSkip to conversation

imanager2: rename io functions and remove no used functions

PATCH In review Wei-Chun Pan 2 participants 2 messages Aug 7, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 imanager2: rename io functions and remove no used functions

---
 drivers/hwmon/imanager2_hwm.c    | 27 +++++------
 drivers/mfd/imanager2_core.c     | 64 +++++++++++---------------
 drivers/mfd/imanager2_ec.c       | 99 ++++++++--------------------------------
 include/linux/mfd/imanager2_ec.h | 24 ++++------
 4 files changed, 67 insertions(+), 147 deletions(-)
drivers/hwmon/imanager2_hwm.c +12 -15
index 335bffb..ab63296 100644
@@ -119,17 +119,17 @@ static int imanager2_volt_get_value_by_io(struct imanager2 *ec, int index,
 	u8 portnum;
 	int ret;
 
-	ret = imanager2_mbox_io_read(EC_CMD_ADC_INDEX, pin, &portnum, 1);
+	ret = imanager2_io_read_data(EC_CMD_ADC_INDEX, pin, &portnum, 1);
 	if (ret)
 		return ret;
 	if (portnum == EC_ERROR)
 		return -ENXIO;
 
-	ret = imanager2_mbox_io_simple_read(EC_CMD_ADC_READ_LSB, &buf[1]);
+	ret = imanager2_io_nooffset_readbyte(EC_CMD_ADC_READ_LSB, &buf[1]);
 	if (ret)
 		return ret;
 
-	return imanager2_mbox_io_simple_read(EC_CMD_ADC_READ_MSB, &buf[0]);
+	return imanager2_io_nooffset_readbyte(EC_CMD_ADC_READ_MSB, &buf[0]);
 }
 
 static int imanager2_volt_get_value(struct imanager2 *ec, int index,
@@ -468,7 +468,7 @@ static void imanager2_temp_init(struct imanager2 *ec)
 							      (u8 *)&zone,
 							      &len);
 		} else {
-			ret = imanager2_mbox_io_read(
+			ret = imanager2_io_read_data(
 				EC_CMD_HWRAM_READ,
 				EC_HWRAM_ADDR_THERMAL_SOURCE_SMB_STATUS(thm),
 				&zone.status, 1);
@@ -566,20 +566,17 @@ static struct fan_item ec_fan_table[] = {
 	{
 		.did = tacho0,
 		.name = "Fan CPU",
-		.fspeed_acpireg = 0,
-		.visible = false
+		.visible = false,
 	},
 	{
 		.did = tacho1,
 		.name = "Fan SYS",
-		.fspeed_acpireg = 0,
-		.visible = false
+		.visible = false,
 	},
 	{
 		.did = tacho2,
 		.name = "Fan SYS2",
-		.fspeed_acpireg = 0,
-		.visible = false
+		.visible = false,
 	},
 };
 
@@ -596,7 +593,7 @@ static int imanager2_fan_get_value(struct imanager2 *ec, int index,
 					       EC_CMD_MAILBOX_READ_HW_PIN,
 					       ec_fan_table[index].did, tmp, 2);
 	else
-		ret = imanager2_mbox_io_read(EC_CMD_ACPIRAM_READ,
+		ret = imanager2_io_read_data(EC_CMD_ACPIRAM_READ,
 					     ec_fan_table[index].fspeed_acpireg,
 					     tmp, 2);
 
@@ -605,11 +602,11 @@ static int imanager2_fan_get_value(struct imanager2 *ec, int index,
 	if (ret)
 		return ret;
 
-	if (tmp[0] == 0xFF && tmp[1] == 0xFF)
-		return -ENODEV;
-
 	*speed_rpm = (tmp[0] << 8) | tmp[1];
 
+	if (*speed_rpm == 0xFFFF)
+		*speed_rpm = 0;
+
 	return 0;
 }
 
@@ -621,7 +618,7 @@ static int imanager2_fan_item_init_by_io(struct imanager2 *ec, int fnum)
 	u8 tmp;
 
 	mutex_lock(&ec->lock);
-	ret = imanager2_mbox_io_read(EC_CMD_HWRAM_READ,
+	ret = imanager2_io_read_data(EC_CMD_HWRAM_READ,
 				     EC_HWRAM_ADDR_FAN_CONTROL(fnum), &tmp, 1);
 	mutex_unlock(&ec->lock);
 
drivers/mfd/imanager2_core.c +27 -37

153 lines not on this page · raw message

drivers/mfd/imanager2_ec.c +18 -81

143 lines not on this page · raw message

include/linux/mfd/imanager2_ec.h +10 -14
index bf7d70e..47baa6e 100644
@@ -22,8 +22,8 @@
 #include <linux/mutex.h>
 
 #define EC_FLAG_IO		0
-#define EC_FLAG_IO_MAILBOX	(1 << 0)
-#define EC_FLAG_MAILBOX		(1 << 1)
+#define EC_FLAG_MAILBOX		(1 << 0)
+#define EC_FLAG_IO_MAILBOX	(1 << 1)
 
 #define EC_MAX_DEVICE_ID_NUM	0xFF
 #define EC_MAX_ITEM_NUM		32
@@ -65,9 +65,6 @@ struct imanager2 {
 #define EC_RAM_BANK_SIZE	32	/* 32 bytes size for each bank. */
 #define EC_RAM_BUFFER_SIZE	256	/* 32 bytes * 8 banks = 256 bytes */
 
-#define EC_SIO_CMD		0x29C
-#define EC_SIO_DATA		0x29D
-
 /* Access Mailbox */
 #define EC_IO_PORT_CMD		0x29A
 #define EC_IO_PORT_DATA		0x299
@@ -90,6 +87,8 @@ struct imanager2 {
 #define EC_CMD_HWCTRLTABLE_GET_PIN_NUM			0x21
 #define EC_CMD_HWCTRLTABLE_GET_DEVICE_ID		0x22
 #define EC_CMD_HWCTRLTABLE_GET_PIN_ACTIVE_POLARITY	0x23
+/* Authentication */
+#define EC_CMD_AUTHENTICATION				0x30
 /* ACPI RAM */
 #define EC_CMD_ACPIRAM_READ				0x80
 #define EC_CMD_ACPIRAM_WRITE				0x81
@@ -217,28 +216,25 @@ int imanager2_mbox_read_ram_across_banks(u32 ecflag, u8 *data, int len);
 int imanager2_mbox_read_ram(u32 ecflag, u8 bank, u8 offset, u8 *buf, u8 len);
 /* command = 0x1F */
 int imanager2_mbox_write_ram(u32 ecflag, u8 bank, u8 offset, u8 *buf, u8 len);
-/* command = 0xF0 */
-int imanager2_mbox_get_project_information(u32 ecflag, u8 *prj_name,
-					   u16 *kernel_ver, u16 *chip_code,
-					   u16 *prj_id, u16 *prj_ver);
 
 /*
  * Functions - basic
  */
-#define IO_FLAG_OBF	(1 << 0)	/* output buffer full */
-#define IO_FLAG_IBF	(1 << 1)	/* input buffer full  */
+void ec_clear_obf(void);
 int ec_inb_after_obf1(u8 *data);
 int ec_outb_after_ibc0(u16 port, u8 data);
 /* ITE mailbox access */
 int imanager2_mbox_read_data(u32 ecflag, u8 cmd, u8 para, u8 *data, int len);
 int imanager2_mbox_write_data(u32 ecflag, u8 cmd, u8 para, u8 *data, int len);
 /* only IO access */
-int imanager2_mbox_io_read(u8 command, u8 offset, u8 *buf, u8 len);
-int imanager2_mbox_io_write(u8 command, u8 offset, u8 *buf, u8 len);
-int imanager2_mbox_io_simple_read(u8 command, u8 *value);
+int imanager2_io_read_data(u8 command, u8 offset, u8 *buf, u8 len);
+int imanager2_io_write_data(u8 command, u8 offset, u8 *buf, u8 len);
+int imanager2_io_nooffset_readbyte(u8 command, u8 *value);
 /* ITE Mailbox & IO access */
 int imanager2_mbox_read_ram_support_io(u32 ecflag, u8 bank, u8 addr, u8 *buf,
 				       u8 len);
+int imanager2_mbox_write_ram_support_io(u32 ecflag, u8 bank, u8 addr, u8 *buf,
+					u8 len);
 
 /*
  * Device ID
Signature · 1 line
1.9.1
#1 lore raw

There should be a commit log here. Explain what you're doing and why.

Quoted 7 lines
---
 drivers/hwmon/imanager2_hwm.c    | 27 +++++------
 drivers/mfd/imanager2_core.c     | 64 +++++++++++---------------
 drivers/mfd/imanager2_ec.c       | 99 ++++++++--------------------------------
 include/linux/mfd/imanager2_ec.h | 24 ++++------
 4 files changed, 67 insertions(+), 147 deletions(-)

[...]

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog