linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] remove auto exit of production and added sysfs interface
@ 2015-12-16 15:28 Andreas Werner
  2015-12-16 15:29 ` [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add " Andreas Werner
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Andreas Werner @ 2015-12-16 15:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: lee.jones, sameo

This patch set introduces new sysfs entries for BMC status information
as well as the ABI documention.

The mfd core driver now does not exit the production mode automatically.
The new sysfs entry allows the userland to exit the production mode
if required.

Andreas Werner (4):
  mfd/menf21bmc: remove auto exiting of production mode and add sysfs
    interface
  doc/ABI: added sysfs description for the menf21bmc MFD driver
  mfd/menf21bmc.c: add additional sysfs entries for BMC status
    information
  doc/ABI: add documentation for the additional sysfs status information

 .../ABI/testing/sysfs-bus-i2c-devices-menf21bmc    |  40 ++++++
 drivers/mfd/menf21bmc.c                            | 158 ++++++++++++++++++---
 2 files changed, 177 insertions(+), 21 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc

-- 
2.6.2


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

* [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add sysfs interface
  2015-12-16 15:28 [PATCH 0/4] remove auto exit of production and added sysfs interface Andreas Werner
@ 2015-12-16 15:29 ` Andreas Werner
  2016-01-11 10:32   ` Lee Jones
  2015-12-16 15:29 ` [PATCH 2/4] doc/ABI: added sysfs description for the menf21bmc MFD driver Andreas Werner
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: Andreas Werner @ 2015-12-16 15:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: lee.jones, sameo

Changed "exit production mode" from automatic exiting to
manually using the sysfs interface.

If the driver exit the production mode automatically, the board will
not start anymore if the bootloader does not already have the "BIOS life sign"
feature.

This patch remove the auto mechanism and add a sysfs interface to manually
exiting the production e.g. during the EOL test of the board.

Signed-off-by: Andreas Werner <andreas.werner@men.de>
---
 drivers/mfd/menf21bmc.c | 65 +++++++++++++++++++++++++++++++++----------------
 1 file changed, 44 insertions(+), 21 deletions(-)

diff --git a/drivers/mfd/menf21bmc.c b/drivers/mfd/menf21bmc.c
index 1c27434..742ffe7 100644
--- a/drivers/mfd/menf21bmc.c
+++ b/drivers/mfd/menf21bmc.c
@@ -27,31 +27,57 @@ static struct mfd_cell menf21bmc_cell[] = {
 	{ .name = "menf21bmc_hwmon", }
 };
 
-static int menf21bmc_wdt_exit_prod_mode(struct i2c_client *client)
+static ssize_t menf21bmc_mode_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
 {
-	int val, ret;
+	struct i2c_client *client = to_i2c_client(dev);
+	int val;
 
 	val = i2c_smbus_read_byte_data(client, BMC_CMD_WDT_PROD_STAT);
 	if (val < 0)
 		return val;
 
+	return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t menf21bmc_mode_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t size)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	unsigned long mode_val;
+	int ret;
+
+	if (kstrtoul(buf, 0, &mode_val))
+		return -EINVAL;
+
 	/*
-	 * Production mode should be not active after delivery of the Board.
-	 * To be sure we check it, inform the user and exit the mode
-	 * if active.
+	 * We cannot set the production mode (0).
+	 * This is the default mode. If exited once,
+	 * it cannot be set anymore.
 	 */
-	if (val == 0x00) {
-		dev_info(&client->dev,
-			"BMC in production mode. Exit production mode\n");
+	if (!mode_val)
+		return -EINVAL;
 
-		ret = i2c_smbus_write_byte(client, BMC_CMD_WDT_EXIT_PROD);
-		if (ret < 0)
-			return ret;
-	}
+	ret = i2c_smbus_write_byte(client, BMC_CMD_WDT_EXIT_PROD);
+	if (ret < 0)
+		return ret;
 
-	return 0;
+	return size;
 }
 
+static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, menf21bmc_mode_show,
+		   menf21bmc_mode_store);
+
+static struct attribute *menf21bmc_attributes[] = {
+	&dev_attr_mode.attr,
+	NULL
+};
+
+static const struct attribute_group menf21bmc_attr_group = {
+	.attrs = menf21bmc_attributes,
+};
+
 static int
 menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)
 {
@@ -86,20 +112,15 @@ menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)
 	dev_info(&client->dev, "FW Revision: %02d.%02d.%02d\n",
 		 rev_major, rev_minor, rev_main);
 
-	/*
-	 * We have to exit the Production Mode of the BMC to activate the
-	 * Watchdog functionality and the BIOS life sign monitoring.
-	 */
-	ret = menf21bmc_wdt_exit_prod_mode(client);
-	if (ret < 0) {
-		dev_err(&client->dev, "failed to leave production mode\n");
+	ret = sysfs_create_group(&client->dev.kobj, &menf21bmc_attr_group);
+	if (ret)
 		return ret;
-	}
 
 	ret = mfd_add_devices(&client->dev, 0, menf21bmc_cell,
 			      ARRAY_SIZE(menf21bmc_cell), NULL, 0, NULL);
 	if (ret < 0) {
 		dev_err(&client->dev, "failed to add BMC sub-devices\n");
+		sysfs_remove_group(&client->dev.kobj, &menf21bmc_attr_group);
 		return ret;
 	}
 
@@ -108,7 +129,9 @@ menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)
 
 static int menf21bmc_remove(struct i2c_client *client)
 {
+	sysfs_remove_group(&client->dev.kobj, &menf21bmc_attr_group);
 	mfd_remove_devices(&client->dev);
+
 	return 0;
 }
 
-- 
2.6.2


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

* [PATCH 2/4] doc/ABI: added sysfs description for the menf21bmc MFD driver
  2015-12-16 15:28 [PATCH 0/4] remove auto exit of production and added sysfs interface Andreas Werner
  2015-12-16 15:29 ` [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add " Andreas Werner
@ 2015-12-16 15:29 ` Andreas Werner
  2016-01-11 10:28   ` Lee Jones
  2015-12-16 15:29 ` [PATCH 3/4] mfd/menf21bmc.c: add additional sysfs entries for BMC status information Andreas Werner
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: Andreas Werner @ 2015-12-16 15:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: lee.jones, sameo

This patch add the description of the "mode" sysfs interface
for the menf21bmc MFD driver.

Signed-off-by: Andreas Werner <andreas.werner@men.de>
---
 Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc

diff --git a/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
new file mode 100644
index 0000000..28d1fa2
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
@@ -0,0 +1,14 @@
+What:		/sys/bus/i2c/devices/.../mode
+Date:		December 2015
+KernelVersion:	4.4
+Contact:	Andreas Werner <andreas.werner@men.de>
+Description:	Set and get the mode of the device.
+		The production mode cannot be set again if the device
+		is set to active once.
+
+		In production mode the BMC does not wait for BIOS life sign,
+		did not reset the CPU board on Watchdog timeout and allow the
+		programming of the HW Variant.
+
+		0 = production mode
+		1 = active mode
-- 
2.6.2


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

* [PATCH 3/4] mfd/menf21bmc.c: add additional sysfs entries for BMC status information
  2015-12-16 15:28 [PATCH 0/4] remove auto exit of production and added sysfs interface Andreas Werner
  2015-12-16 15:29 ` [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add " Andreas Werner
  2015-12-16 15:29 ` [PATCH 2/4] doc/ABI: added sysfs description for the menf21bmc MFD driver Andreas Werner
@ 2015-12-16 15:29 ` Andreas Werner
  2016-01-11 10:30   ` Lee Jones
  2015-12-16 15:30 ` [PATCH 4/4] doc/ABI: add documentation for the additional sysfs " Andreas Werner
  2016-01-06 12:45 ` [PATCH 0/4] remove auto exit of production and added sysfs interface Andreas Werner
  4 siblings, 1 reply; 16+ messages in thread
From: Andreas Werner @ 2015-12-16 15:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: lee.jones, sameo

This patch adds additional sysfs entries to provide status
information to the userland.

The following informations are now provided:
        - Get operation hours counter
        - Get board slot address
        - Get powercycle counter
        - Set/get Hw Variant

Signed-off-by: Andreas Werner <andreas.werner@men.de>
---
 drivers/mfd/menf21bmc.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 96 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/menf21bmc.c b/drivers/mfd/menf21bmc.c
index 742ffe7..dd068c0 100644
--- a/drivers/mfd/menf21bmc.c
+++ b/drivers/mfd/menf21bmc.c
@@ -20,6 +20,10 @@
 #define BMC_CMD_REV_MAJOR	0x80
 #define BMC_CMD_REV_MINOR	0x81
 #define BMC_CMD_REV_MAIN	0x82
+#define BMC_CMD_SLOT_ADDRESS	0x8c
+#define BMC_CMD_HW_VARIANT	0x8f
+#define BMC_CMD_PWRCYCL_CNT	0x93
+#define BMC_CMD_OP_HRS_CNT	0x94
 
 static struct mfd_cell menf21bmc_cell[] = {
 	{ .name = "menf21bmc_wdt", },
@@ -28,7 +32,7 @@ static struct mfd_cell menf21bmc_cell[] = {
 };
 
 static ssize_t menf21bmc_mode_show(struct device *dev,
-				  struct device_attribute *attr, char *buf)
+				   struct device_attribute *attr, char *buf)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	int val;
@@ -41,8 +45,8 @@ static ssize_t menf21bmc_mode_show(struct device *dev,
 }
 
 static ssize_t menf21bmc_mode_store(struct device *dev,
-				   struct device_attribute *attr,
-				   const char *buf, size_t size)
+				    struct device_attribute *attr,
+				    const char *buf, size_t size)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	unsigned long mode_val;
@@ -66,11 +70,100 @@ static ssize_t menf21bmc_mode_store(struct device *dev,
 	return size;
 }
 
+static ssize_t menf21bmc_hw_variant_show(struct device *dev,
+					 struct device_attribute *attr,
+					 char *buf)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	int val;
+
+	val = i2c_smbus_read_word_data(client, BMC_CMD_HW_VARIANT);
+	if (val < 0)
+		return val;
+
+	return sprintf(buf, "0x%04x\n", val);
+
+}
+
+static ssize_t menf21bmc_hw_variant_store(struct device *dev,
+					  struct device_attribute *attr,
+					  const char *buf, size_t size)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	unsigned long hw_variant;
+	int ret;
+
+	if (kstrtoul(buf, 0, &hw_variant))
+		return -EINVAL;
+
+	if (hw_variant < 0 || hw_variant > 0xffff)
+		return -EINVAL;
+
+	ret = i2c_smbus_write_word_data(client, BMC_CMD_HW_VARIANT,
+					hw_variant);
+	if (ret < 0)
+		return ret;
+
+	return size;
+
+}
+
+static ssize_t menf21bmc_pwrcycl_cnt_show(struct device *dev,
+					  struct device_attribute *attr,
+					  char *buf)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	int val;
+
+	val = i2c_smbus_read_word_data(client, BMC_CMD_PWRCYCL_CNT);
+	if (val < 0)
+		return val;
+
+	return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t menf21bmc_op_hrs_cnt_show(struct device *dev,
+					 struct device_attribute *attr,
+					 char *buf)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	int val;
+
+	val = i2c_smbus_read_word_data(client, BMC_CMD_OP_HRS_CNT);
+	if (val < 0)
+		return val;
+
+	return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t menf21bmc_slot_address_show(struct device *dev,
+					   struct device_attribute *attr,
+					   char *buf)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	int val;
+
+	val = i2c_smbus_read_byte_data(client, BMC_CMD_SLOT_ADDRESS);
+	if (val < 0)
+		return val;
+
+	return sprintf(buf, "%d\n", val);
+}
+
 static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, menf21bmc_mode_show,
 		   menf21bmc_mode_store);
+static DEVICE_ATTR(hw_variant, S_IRUGO | S_IWUSR, menf21bmc_hw_variant_show,
+		   menf21bmc_hw_variant_store);
+static DEVICE_ATTR(pwrcycl_cnt, S_IRUGO, menf21bmc_pwrcycl_cnt_show, NULL);
+static DEVICE_ATTR(op_hrs_cnt, S_IRUGO, menf21bmc_op_hrs_cnt_show, NULL);
+static DEVICE_ATTR(slot_address, S_IRUGO, menf21bmc_slot_address_show, NULL);
 
 static struct attribute *menf21bmc_attributes[] = {
 	&dev_attr_mode.attr,
+	&dev_attr_hw_variant.attr,
+	&dev_attr_pwrcycl_cnt.attr,
+	&dev_attr_op_hrs_cnt.attr,
+	&dev_attr_slot_address.attr,
 	NULL
 };
 
-- 
2.6.2


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

* [PATCH 4/4] doc/ABI: add documentation for the additional sysfs status information
  2015-12-16 15:28 [PATCH 0/4] remove auto exit of production and added sysfs interface Andreas Werner
                   ` (2 preceding siblings ...)
  2015-12-16 15:29 ` [PATCH 3/4] mfd/menf21bmc.c: add additional sysfs entries for BMC status information Andreas Werner
@ 2015-12-16 15:30 ` Andreas Werner
  2016-01-11 10:28   ` Lee Jones
  2016-01-06 12:45 ` [PATCH 0/4] remove auto exit of production and added sysfs interface Andreas Werner
  4 siblings, 1 reply; 16+ messages in thread
From: Andreas Werner @ 2015-12-16 15:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: lee.jones, sameo

Signed-off-by: Andreas Werner <andreas.werner@men.de>
---
 .../ABI/testing/sysfs-bus-i2c-devices-menf21bmc    | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
index 28d1fa2..6defdd3 100644
--- a/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
+++ b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
@@ -12,3 +12,29 @@ Description:	Set and get the mode of the device.
 
 		0 = production mode
 		1 = active mode
+
+What:		/sys/bus/i2c/devices/.../hw_variant
+Date:		December 2015
+KernelVersion:	4.4
+Contact:	Andreas Werner <andreas.werner@men.de>
+Description:	Set and get the hardware variant ID.
+
+What:		/sys/bus/i2c/devices/.../pwrcycl_cnt
+Date:		December 2015
+KernelVersion:	4.4
+Contact:	Andreas Werner <andreas.werner@men.de>
+Description:	Read the BMC powercycle counter.
+
+What:		/sys/bus/i2c/devices/.../op_hrs_cnt
+Date:		December 2015
+KernelVersion:	4.4
+Contact:	Andreas Werner <andreas.werner@men.de>
+Description:	Read the operation hours counter
+
+What:		/sys/bus/i2c/devices/.../slot_address
+Date:		December 2015
+KernelVersion:	4.4
+Contact:	Andreas Werner <andreas.werner@men.de>
+Description:	Read the slot address of the board.
+		Slot address is the geographical address
+		in a CPCI rack/backplane.
-- 
2.6.2


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

* Re: [PATCH 0/4] remove auto exit of production and added sysfs interface
  2015-12-16 15:28 [PATCH 0/4] remove auto exit of production and added sysfs interface Andreas Werner
                   ` (3 preceding siblings ...)
  2015-12-16 15:30 ` [PATCH 4/4] doc/ABI: add documentation for the additional sysfs " Andreas Werner
@ 2016-01-06 12:45 ` Andreas Werner
  4 siblings, 0 replies; 16+ messages in thread
From: Andreas Werner @ 2016-01-06 12:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: lee.jones, sameo, andreas.werner

Regards
Andy

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

* Re: [PATCH 4/4] doc/ABI: add documentation for the additional sysfs status information
  2015-12-16 15:30 ` [PATCH 4/4] doc/ABI: add documentation for the additional sysfs " Andreas Werner
@ 2016-01-11 10:28   ` Lee Jones
  2016-01-11 10:36     ` [PATCH 4/4] doc/ABI: add documentation for the additional sysfs status informationj Andreas Werner
  0 siblings, 1 reply; 16+ messages in thread
From: Lee Jones @ 2016-01-11 10:28 UTC (permalink / raw)
  To: Andreas Werner; +Cc: linux-kernel, sameo

On Wed, 16 Dec 2015, Andreas Werner wrote:

> Signed-off-by: Andreas Werner <andreas.werner@men.de>
> ---
>  .../ABI/testing/sysfs-bus-i2c-devices-menf21bmc    | 26 ++++++++++++++++++++++
>  1 file changed, 26 insertions(+)

These look like I2C changes, so you need to CC the I2C Maintainer.

> diff --git a/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
> index 28d1fa2..6defdd3 100644
> --- a/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
> +++ b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
> @@ -12,3 +12,29 @@ Description:	Set and get the mode of the device.
>  
>  		0 = production mode
>  		1 = active mode
> +
> +What:		/sys/bus/i2c/devices/.../hw_variant
> +Date:		December 2015
> +KernelVersion:	4.4
> +Contact:	Andreas Werner <andreas.werner@men.de>
> +Description:	Set and get the hardware variant ID.
> +
> +What:		/sys/bus/i2c/devices/.../pwrcycl_cnt
> +Date:		December 2015
> +KernelVersion:	4.4
> +Contact:	Andreas Werner <andreas.werner@men.de>
> +Description:	Read the BMC powercycle counter.
> +
> +What:		/sys/bus/i2c/devices/.../op_hrs_cnt
> +Date:		December 2015
> +KernelVersion:	4.4
> +Contact:	Andreas Werner <andreas.werner@men.de>
> +Description:	Read the operation hours counter
> +
> +What:		/sys/bus/i2c/devices/.../slot_address
> +Date:		December 2015
> +KernelVersion:	4.4
> +Contact:	Andreas Werner <andreas.werner@men.de>
> +Description:	Read the slot address of the board.
> +		Slot address is the geographical address
> +		in a CPCI rack/backplane.

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

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

* Re: [PATCH 2/4] doc/ABI: added sysfs description for the menf21bmc MFD driver
  2015-12-16 15:29 ` [PATCH 2/4] doc/ABI: added sysfs description for the menf21bmc MFD driver Andreas Werner
@ 2016-01-11 10:28   ` Lee Jones
  2016-01-11 10:37     ` Andreas Werner
  0 siblings, 1 reply; 16+ messages in thread
From: Lee Jones @ 2016-01-11 10:28 UTC (permalink / raw)
  To: Andreas Werner; +Cc: linux-kernel, sameo

On Wed, 16 Dec 2015, Andreas Werner wrote:

> This patch add the description of the "mode" sysfs interface
> for the menf21bmc MFD driver.
> 
> Signed-off-by: Andreas Werner <andreas.werner@men.de>
> ---
>  Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc | 14 ++++++++++++++

These look like I2C changes, so you need to CC the I2C Maintainer.

>  1 file changed, 14 insertions(+)
>  create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
> 
> diff --git a/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
> new file mode 100644
> index 0000000..28d1fa2
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
> @@ -0,0 +1,14 @@
> +What:		/sys/bus/i2c/devices/.../mode
> +Date:		December 2015
> +KernelVersion:	4.4
> +Contact:	Andreas Werner <andreas.werner@men.de>
> +Description:	Set and get the mode of the device.
> +		The production mode cannot be set again if the device
> +		is set to active once.
> +
> +		In production mode the BMC does not wait for BIOS life sign,
> +		did not reset the CPU board on Watchdog timeout and allow the
> +		programming of the HW Variant.
> +
> +		0 = production mode
> +		1 = active mode

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

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

* Re: [PATCH 3/4] mfd/menf21bmc.c: add additional sysfs entries for BMC status information
  2015-12-16 15:29 ` [PATCH 3/4] mfd/menf21bmc.c: add additional sysfs entries for BMC status information Andreas Werner
@ 2016-01-11 10:30   ` Lee Jones
  2016-01-11 10:38     ` Andreas Werner
  0 siblings, 1 reply; 16+ messages in thread
From: Lee Jones @ 2016-01-11 10:30 UTC (permalink / raw)
  To: Andreas Werner; +Cc: linux-kernel, sameo

On Wed, 16 Dec 2015, Andreas Werner wrote:

> This patch adds additional sysfs entries to provide status
> information to the userland.
> 
> The following informations are now provided:
>         - Get operation hours counter
>         - Get board slot address
>         - Get powercycle counter
>         - Set/get Hw Variant
> 
> Signed-off-by: Andreas Werner <andreas.werner@men.de>
> ---
>  drivers/mfd/menf21bmc.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 96 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mfd/menf21bmc.c b/drivers/mfd/menf21bmc.c
> index 742ffe7..dd068c0 100644
> --- a/drivers/mfd/menf21bmc.c
> +++ b/drivers/mfd/menf21bmc.c
> @@ -20,6 +20,10 @@
>  #define BMC_CMD_REV_MAJOR	0x80
>  #define BMC_CMD_REV_MINOR	0x81
>  #define BMC_CMD_REV_MAIN	0x82
> +#define BMC_CMD_SLOT_ADDRESS	0x8c
> +#define BMC_CMD_HW_VARIANT	0x8f
> +#define BMC_CMD_PWRCYCL_CNT	0x93
> +#define BMC_CMD_OP_HRS_CNT	0x94
>  
>  static struct mfd_cell menf21bmc_cell[] = {
>  	{ .name = "menf21bmc_wdt", },
> @@ -28,7 +32,7 @@ static struct mfd_cell menf21bmc_cell[] = {
>  };
>  
>  static ssize_t menf21bmc_mode_show(struct device *dev,
> -				  struct device_attribute *attr, char *buf)
> +				   struct device_attribute *attr, char *buf)

This is an irrelevant change.  Please split it out.

>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  	int val;
> @@ -41,8 +45,8 @@ static ssize_t menf21bmc_mode_show(struct device *dev,
>  }
>  
>  static ssize_t menf21bmc_mode_store(struct device *dev,
> -				   struct device_attribute *attr,
> -				   const char *buf, size_t size)
> +				    struct device_attribute *attr,
> +				    const char *buf, size_t size)

This is an irrelevant change.  Please split it out.

>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  	unsigned long mode_val;
> @@ -66,11 +70,100 @@ static ssize_t menf21bmc_mode_store(struct device *dev,
>  	return size;
>  }
>  
> +static ssize_t menf21bmc_hw_variant_show(struct device *dev,
> +					 struct device_attribute *attr,
> +					 char *buf)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);
> +	int val;
> +
> +	val = i2c_smbus_read_word_data(client, BMC_CMD_HW_VARIANT);
> +	if (val < 0)
> +		return val;
> +
> +	return sprintf(buf, "0x%04x\n", val);
> +
> +}
> +
> +static ssize_t menf21bmc_hw_variant_store(struct device *dev,
> +					  struct device_attribute *attr,
> +					  const char *buf, size_t size)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);
> +	unsigned long hw_variant;
> +	int ret;
> +
> +	if (kstrtoul(buf, 0, &hw_variant))
> +		return -EINVAL;
> +
> +	if (hw_variant < 0 || hw_variant > 0xffff)
> +		return -EINVAL;
> +
> +	ret = i2c_smbus_write_word_data(client, BMC_CMD_HW_VARIANT,
> +					hw_variant);
> +	if (ret < 0)
> +		return ret;
> +
> +	return size;
> +
> +}
> +
> +static ssize_t menf21bmc_pwrcycl_cnt_show(struct device *dev,
> +					  struct device_attribute *attr,
> +					  char *buf)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);
> +	int val;
> +
> +	val = i2c_smbus_read_word_data(client, BMC_CMD_PWRCYCL_CNT);
> +	if (val < 0)
> +		return val;
> +
> +	return sprintf(buf, "%d\n", val);
> +}
> +
> +static ssize_t menf21bmc_op_hrs_cnt_show(struct device *dev,
> +					 struct device_attribute *attr,
> +					 char *buf)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);
> +	int val;
> +
> +	val = i2c_smbus_read_word_data(client, BMC_CMD_OP_HRS_CNT);
> +	if (val < 0)
> +		return val;
> +
> +	return sprintf(buf, "%d\n", val);
> +}
> +
> +static ssize_t menf21bmc_slot_address_show(struct device *dev,
> +					   struct device_attribute *attr,
> +					   char *buf)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);
> +	int val;
> +
> +	val = i2c_smbus_read_byte_data(client, BMC_CMD_SLOT_ADDRESS);
> +	if (val < 0)
> +		return val;
> +
> +	return sprintf(buf, "%d\n", val);
> +}
> +
>  static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, menf21bmc_mode_show,
>  		   menf21bmc_mode_store);
> +static DEVICE_ATTR(hw_variant, S_IRUGO | S_IWUSR, menf21bmc_hw_variant_show,
> +		   menf21bmc_hw_variant_store);
> +static DEVICE_ATTR(pwrcycl_cnt, S_IRUGO, menf21bmc_pwrcycl_cnt_show, NULL);
> +static DEVICE_ATTR(op_hrs_cnt, S_IRUGO, menf21bmc_op_hrs_cnt_show, NULL);
> +static DEVICE_ATTR(slot_address, S_IRUGO, menf21bmc_slot_address_show, NULL);
>  
>  static struct attribute *menf21bmc_attributes[] = {
>  	&dev_attr_mode.attr,
> +	&dev_attr_hw_variant.attr,
> +	&dev_attr_pwrcycl_cnt.attr,
> +	&dev_attr_op_hrs_cnt.attr,
> +	&dev_attr_slot_address.attr,
>  	NULL
>  };
>  

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

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

* Re: [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add sysfs interface
  2015-12-16 15:29 ` [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add " Andreas Werner
@ 2016-01-11 10:32   ` Lee Jones
  2016-01-11 10:33     ` Lee Jones
  0 siblings, 1 reply; 16+ messages in thread
From: Lee Jones @ 2016-01-11 10:32 UTC (permalink / raw)
  To: Andreas Werner; +Cc: linux-kernel, sameo

On Wed, 16 Dec 2015, Andreas Werner wrote:

> Changed "exit production mode" from automatic exiting to
> manually using the sysfs interface.
> 
> If the driver exit the production mode automatically, the board will
> not start anymore if the bootloader does not already have the "BIOS life sign"
> feature.
> 
> This patch remove the auto mechanism and add a sysfs interface to manually
> exiting the production e.g. during the EOL test of the board.
> 
> Signed-off-by: Andreas Werner <andreas.werner@men.de>
> ---
>  drivers/mfd/menf21bmc.c | 65 +++++++++++++++++++++++++++++++++----------------
>  1 file changed, 44 insertions(+), 21 deletions(-)

Acked-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/drivers/mfd/menf21bmc.c b/drivers/mfd/menf21bmc.c
> index 1c27434..742ffe7 100644
> --- a/drivers/mfd/menf21bmc.c
> +++ b/drivers/mfd/menf21bmc.c
> @@ -27,31 +27,57 @@ static struct mfd_cell menf21bmc_cell[] = {
>  	{ .name = "menf21bmc_hwmon", }
>  };
>  
> -static int menf21bmc_wdt_exit_prod_mode(struct i2c_client *client)
> +static ssize_t menf21bmc_mode_show(struct device *dev,
> +				  struct device_attribute *attr, char *buf)
>  {
> -	int val, ret;
> +	struct i2c_client *client = to_i2c_client(dev);
> +	int val;
>  
>  	val = i2c_smbus_read_byte_data(client, BMC_CMD_WDT_PROD_STAT);
>  	if (val < 0)
>  		return val;
>  
> +	return sprintf(buf, "%d\n", val);
> +}
> +
> +static ssize_t menf21bmc_mode_store(struct device *dev,
> +				   struct device_attribute *attr,
> +				   const char *buf, size_t size)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);
> +	unsigned long mode_val;
> +	int ret;
> +
> +	if (kstrtoul(buf, 0, &mode_val))
> +		return -EINVAL;
> +
>  	/*
> -	 * Production mode should be not active after delivery of the Board.
> -	 * To be sure we check it, inform the user and exit the mode
> -	 * if active.
> +	 * We cannot set the production mode (0).
> +	 * This is the default mode. If exited once,
> +	 * it cannot be set anymore.
>  	 */
> -	if (val == 0x00) {
> -		dev_info(&client->dev,
> -			"BMC in production mode. Exit production mode\n");
> +	if (!mode_val)
> +		return -EINVAL;
>  
> -		ret = i2c_smbus_write_byte(client, BMC_CMD_WDT_EXIT_PROD);
> -		if (ret < 0)
> -			return ret;
> -	}
> +	ret = i2c_smbus_write_byte(client, BMC_CMD_WDT_EXIT_PROD);
> +	if (ret < 0)
> +		return ret;
>  
> -	return 0;
> +	return size;
>  }
>  
> +static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, menf21bmc_mode_show,
> +		   menf21bmc_mode_store);
> +
> +static struct attribute *menf21bmc_attributes[] = {
> +	&dev_attr_mode.attr,
> +	NULL
> +};
> +
> +static const struct attribute_group menf21bmc_attr_group = {
> +	.attrs = menf21bmc_attributes,
> +};
> +
>  static int
>  menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)
>  {
> @@ -86,20 +112,15 @@ menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)
>  	dev_info(&client->dev, "FW Revision: %02d.%02d.%02d\n",
>  		 rev_major, rev_minor, rev_main);
>  
> -	/*
> -	 * We have to exit the Production Mode of the BMC to activate the
> -	 * Watchdog functionality and the BIOS life sign monitoring.
> -	 */
> -	ret = menf21bmc_wdt_exit_prod_mode(client);
> -	if (ret < 0) {
> -		dev_err(&client->dev, "failed to leave production mode\n");
> +	ret = sysfs_create_group(&client->dev.kobj, &menf21bmc_attr_group);
> +	if (ret)
>  		return ret;
> -	}
>  
>  	ret = mfd_add_devices(&client->dev, 0, menf21bmc_cell,
>  			      ARRAY_SIZE(menf21bmc_cell), NULL, 0, NULL);
>  	if (ret < 0) {
>  		dev_err(&client->dev, "failed to add BMC sub-devices\n");
> +		sysfs_remove_group(&client->dev.kobj, &menf21bmc_attr_group);
>  		return ret;
>  	}
>  
> @@ -108,7 +129,9 @@ menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)
>  
>  static int menf21bmc_remove(struct i2c_client *client)
>  {
> +	sysfs_remove_group(&client->dev.kobj, &menf21bmc_attr_group);
>  	mfd_remove_devices(&client->dev);
> +
>  	return 0;
>  }
>  

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

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

* Re: [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add sysfs interface
  2016-01-11 10:32   ` Lee Jones
@ 2016-01-11 10:33     ` Lee Jones
  2016-01-11 10:49       ` Andreas Werner
  0 siblings, 1 reply; 16+ messages in thread
From: Lee Jones @ 2016-01-11 10:33 UTC (permalink / raw)
  To: Andreas Werner; +Cc: linux-kernel, sameo

When you re-submit this set, with the correct Maintainers CC'ed,
please also update the patch subject lines, so they match the format
of the subsystem.

On Mon, 11 Jan 2016, Lee Jones wrote:
> On Wed, 16 Dec 2015, Andreas Werner wrote:
> 
> > Changed "exit production mode" from automatic exiting to
> > manually using the sysfs interface.
> > 
> > If the driver exit the production mode automatically, the board will
> > not start anymore if the bootloader does not already have the "BIOS life sign"
> > feature.
> > 
> > This patch remove the auto mechanism and add a sysfs interface to manually
> > exiting the production e.g. during the EOL test of the board.
> > 
> > Signed-off-by: Andreas Werner <andreas.werner@men.de>
> > ---
> >  drivers/mfd/menf21bmc.c | 65 +++++++++++++++++++++++++++++++++----------------
> >  1 file changed, 44 insertions(+), 21 deletions(-)
> 
> Acked-by: Lee Jones <lee.jones@linaro.org>
> 
> > diff --git a/drivers/mfd/menf21bmc.c b/drivers/mfd/menf21bmc.c
> > index 1c27434..742ffe7 100644
> > --- a/drivers/mfd/menf21bmc.c
> > +++ b/drivers/mfd/menf21bmc.c
> > @@ -27,31 +27,57 @@ static struct mfd_cell menf21bmc_cell[] = {
> >  	{ .name = "menf21bmc_hwmon", }
> >  };
> >  
> > -static int menf21bmc_wdt_exit_prod_mode(struct i2c_client *client)
> > +static ssize_t menf21bmc_mode_show(struct device *dev,
> > +				  struct device_attribute *attr, char *buf)
> >  {
> > -	int val, ret;
> > +	struct i2c_client *client = to_i2c_client(dev);
> > +	int val;
> >  
> >  	val = i2c_smbus_read_byte_data(client, BMC_CMD_WDT_PROD_STAT);
> >  	if (val < 0)
> >  		return val;
> >  
> > +	return sprintf(buf, "%d\n", val);
> > +}
> > +
> > +static ssize_t menf21bmc_mode_store(struct device *dev,
> > +				   struct device_attribute *attr,
> > +				   const char *buf, size_t size)
> > +{
> > +	struct i2c_client *client = to_i2c_client(dev);
> > +	unsigned long mode_val;
> > +	int ret;
> > +
> > +	if (kstrtoul(buf, 0, &mode_val))
> > +		return -EINVAL;
> > +
> >  	/*
> > -	 * Production mode should be not active after delivery of the Board.
> > -	 * To be sure we check it, inform the user and exit the mode
> > -	 * if active.
> > +	 * We cannot set the production mode (0).
> > +	 * This is the default mode. If exited once,
> > +	 * it cannot be set anymore.
> >  	 */
> > -	if (val == 0x00) {
> > -		dev_info(&client->dev,
> > -			"BMC in production mode. Exit production mode\n");
> > +	if (!mode_val)
> > +		return -EINVAL;
> >  
> > -		ret = i2c_smbus_write_byte(client, BMC_CMD_WDT_EXIT_PROD);
> > -		if (ret < 0)
> > -			return ret;
> > -	}
> > +	ret = i2c_smbus_write_byte(client, BMC_CMD_WDT_EXIT_PROD);
> > +	if (ret < 0)
> > +		return ret;
> >  
> > -	return 0;
> > +	return size;
> >  }
> >  
> > +static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, menf21bmc_mode_show,
> > +		   menf21bmc_mode_store);
> > +
> > +static struct attribute *menf21bmc_attributes[] = {
> > +	&dev_attr_mode.attr,
> > +	NULL
> > +};
> > +
> > +static const struct attribute_group menf21bmc_attr_group = {
> > +	.attrs = menf21bmc_attributes,
> > +};
> > +
> >  static int
> >  menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)
> >  {
> > @@ -86,20 +112,15 @@ menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)
> >  	dev_info(&client->dev, "FW Revision: %02d.%02d.%02d\n",
> >  		 rev_major, rev_minor, rev_main);
> >  
> > -	/*
> > -	 * We have to exit the Production Mode of the BMC to activate the
> > -	 * Watchdog functionality and the BIOS life sign monitoring.
> > -	 */
> > -	ret = menf21bmc_wdt_exit_prod_mode(client);
> > -	if (ret < 0) {
> > -		dev_err(&client->dev, "failed to leave production mode\n");
> > +	ret = sysfs_create_group(&client->dev.kobj, &menf21bmc_attr_group);
> > +	if (ret)
> >  		return ret;
> > -	}
> >  
> >  	ret = mfd_add_devices(&client->dev, 0, menf21bmc_cell,
> >  			      ARRAY_SIZE(menf21bmc_cell), NULL, 0, NULL);
> >  	if (ret < 0) {
> >  		dev_err(&client->dev, "failed to add BMC sub-devices\n");
> > +		sysfs_remove_group(&client->dev.kobj, &menf21bmc_attr_group);
> >  		return ret;
> >  	}
> >  
> > @@ -108,7 +129,9 @@ menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)
> >  
> >  static int menf21bmc_remove(struct i2c_client *client)
> >  {
> > +	sysfs_remove_group(&client->dev.kobj, &menf21bmc_attr_group);
> >  	mfd_remove_devices(&client->dev);
> > +
> >  	return 0;
> >  }
> >  
> 

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

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

* Re: [PATCH 4/4] doc/ABI: add documentation for the additional sysfs status informationj
  2016-01-11 10:28   ` Lee Jones
@ 2016-01-11 10:36     ` Andreas Werner
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas Werner @ 2016-01-11 10:36 UTC (permalink / raw)
  To: Lee Jones; +Cc: Andreas Werner, linux-kernel, sameo

On Mon, Jan 11, 2016 at 10:28:03AM +0000, Lee Jones wrote:
> On Wed, 16 Dec 2015, Andreas Werner wrote:
> 
> > Signed-off-by: Andreas Werner <andreas.werner@men.de>
> > ---
> >  .../ABI/testing/sysfs-bus-i2c-devices-menf21bmc    | 26 ++++++++++++++++++++++
> >  1 file changed, 26 insertions(+)
> 
> These look like I2C changes, so you need to CC the I2C Maintainer.

Ah ok, i sent it only to you because I thought it is related to the mfd
and therefore you are responsible.

But I agree, it is a mfd i2c device which should also go to the i2c maintainer.
I will resend this one.


Regards
Andy

> 
> > diff --git a/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
> > index 28d1fa2..6defdd3 100644
> > --- a/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
> > +++ b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
> > @@ -12,3 +12,29 @@ Description:	Set and get the mode of the device.
> >  
> >  		0 = production mode
> >  		1 = active mode
> > +
> > +What:		/sys/bus/i2c/devices/.../hw_variant
> > +Date:		December 2015
> > +KernelVersion:	4.4
> > +Contact:	Andreas Werner <andreas.werner@men.de>
> > +Description:	Set and get the hardware variant ID.
> > +
> > +What:		/sys/bus/i2c/devices/.../pwrcycl_cnt
> > +Date:		December 2015
> > +KernelVersion:	4.4
> > +Contact:	Andreas Werner <andreas.werner@men.de>
> > +Description:	Read the BMC powercycle counter.
> > +
> > +What:		/sys/bus/i2c/devices/.../op_hrs_cnt
> > +Date:		December 2015
> > +KernelVersion:	4.4
> > +Contact:	Andreas Werner <andreas.werner@men.de>
> > +Description:	Read the operation hours counter
> > +
> > +What:		/sys/bus/i2c/devices/.../slot_address
> > +Date:		December 2015
> > +KernelVersion:	4.4
> > +Contact:	Andreas Werner <andreas.werner@men.de>
> > +Description:	Read the slot address of the board.
> > +		Slot address is the geographical address
> > +		in a CPCI rack/backplane.
> 
> -- 
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/4] doc/ABI: added sysfs description for the menf21bmc MFD driver
  2016-01-11 10:28   ` Lee Jones
@ 2016-01-11 10:37     ` Andreas Werner
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas Werner @ 2016-01-11 10:37 UTC (permalink / raw)
  To: Lee Jones; +Cc: Andreas Werner, linux-kernel, sameo

On Mon, Jan 11, 2016 at 10:28:27AM +0000, Lee Jones wrote:
> On Wed, 16 Dec 2015, Andreas Werner wrote:
> 
> > This patch add the description of the "mode" sysfs interface
> > for the menf21bmc MFD driver.
> > 
> > Signed-off-by: Andreas Werner <andreas.werner@men.de>
> > ---
> >  Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc | 14 ++++++++++++++
> 
> These look like I2C changes, so you need to CC the I2C Maintainer.

Agree, will resend this one.

Regards
Andy

> 
> >  1 file changed, 14 insertions(+)
> >  create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
> > 
> > diff --git a/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
> > new file mode 100644
> > index 0000000..28d1fa2
> > --- /dev/null
> > +++ b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
> > @@ -0,0 +1,14 @@
> > +What:		/sys/bus/i2c/devices/.../mode
> > +Date:		December 2015
> > +KernelVersion:	4.4
> > +Contact:	Andreas Werner <andreas.werner@men.de>
> > +Description:	Set and get the mode of the device.
> > +		The production mode cannot be set again if the device
> > +		is set to active once.
> > +
> > +		In production mode the BMC does not wait for BIOS life sign,
> > +		did not reset the CPU board on Watchdog timeout and allow the
> > +		programming of the HW Variant.
> > +
> > +		0 = production mode
> > +		1 = active mode
> 
> -- 
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 3/4] mfd/menf21bmc.c: add additional sysfs entries for BMC status information
  2016-01-11 10:30   ` Lee Jones
@ 2016-01-11 10:38     ` Andreas Werner
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas Werner @ 2016-01-11 10:38 UTC (permalink / raw)
  To: Lee Jones; +Cc: Andreas Werner, linux-kernel, sameo

On Mon, Jan 11, 2016 at 10:30:39AM +0000, Lee Jones wrote:
> On Wed, 16 Dec 2015, Andreas Werner wrote:
> 
> > This patch adds additional sysfs entries to provide status
> > information to the userland.
> > 
> > The following informations are now provided:
> >         - Get operation hours counter
> >         - Get board slot address
> >         - Get powercycle counter
> >         - Set/get Hw Variant
> > 
> > Signed-off-by: Andreas Werner <andreas.werner@men.de>
> > ---
> >  drivers/mfd/menf21bmc.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 96 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/mfd/menf21bmc.c b/drivers/mfd/menf21bmc.c
> > index 742ffe7..dd068c0 100644
> > --- a/drivers/mfd/menf21bmc.c
> > +++ b/drivers/mfd/menf21bmc.c
> > @@ -20,6 +20,10 @@
> >  #define BMC_CMD_REV_MAJOR	0x80
> >  #define BMC_CMD_REV_MINOR	0x81
> >  #define BMC_CMD_REV_MAIN	0x82
> > +#define BMC_CMD_SLOT_ADDRESS	0x8c
> > +#define BMC_CMD_HW_VARIANT	0x8f
> > +#define BMC_CMD_PWRCYCL_CNT	0x93
> > +#define BMC_CMD_OP_HRS_CNT	0x94
> >  
> >  static struct mfd_cell menf21bmc_cell[] = {
> >  	{ .name = "menf21bmc_wdt", },
> > @@ -28,7 +32,7 @@ static struct mfd_cell menf21bmc_cell[] = {
> >  };
> >  
> >  static ssize_t menf21bmc_mode_show(struct device *dev,
> > -				  struct device_attribute *attr, char *buf)
> > +				   struct device_attribute *attr, char *buf)
> 
> This is an irrelevant change.  Please split it out.

Argh, my mistake. I will fix it and resend this patch.

> 
> >  {
> >  	struct i2c_client *client = to_i2c_client(dev);
> >  	int val;
> > @@ -41,8 +45,8 @@ static ssize_t menf21bmc_mode_show(struct device *dev,
> >  }
> >  
> >  static ssize_t menf21bmc_mode_store(struct device *dev,
> > -				   struct device_attribute *attr,
> > -				   const char *buf, size_t size)
> > +				    struct device_attribute *attr,
> > +				    const char *buf, size_t size)
> 
> This is an irrelevant change.  Please split it out.
> 
> >  {
> >  	struct i2c_client *client = to_i2c_client(dev);
> >  	unsigned long mode_val;
> > @@ -66,11 +70,100 @@ static ssize_t menf21bmc_mode_store(struct device *dev,
> >  	return size;
> >  }
> >  
> > +static ssize_t menf21bmc_hw_variant_show(struct device *dev,
> > +					 struct device_attribute *attr,
> > +					 char *buf)
> > +{
> > +	struct i2c_client *client = to_i2c_client(dev);
> > +	int val;
> > +
> > +	val = i2c_smbus_read_word_data(client, BMC_CMD_HW_VARIANT);
> > +	if (val < 0)
> > +		return val;
> > +
> > +	return sprintf(buf, "0x%04x\n", val);
> > +
> > +}
> > +
> > +static ssize_t menf21bmc_hw_variant_store(struct device *dev,
> > +					  struct device_attribute *attr,
> > +					  const char *buf, size_t size)
> > +{
> > +	struct i2c_client *client = to_i2c_client(dev);
> > +	unsigned long hw_variant;
> > +	int ret;
> > +
> > +	if (kstrtoul(buf, 0, &hw_variant))
> > +		return -EINVAL;
> > +
> > +	if (hw_variant < 0 || hw_variant > 0xffff)
> > +		return -EINVAL;
> > +
> > +	ret = i2c_smbus_write_word_data(client, BMC_CMD_HW_VARIANT,
> > +					hw_variant);
> > +	if (ret < 0)
> > +		return ret;
> > +
> > +	return size;
> > +
> > +}
> > +
> > +static ssize_t menf21bmc_pwrcycl_cnt_show(struct device *dev,
> > +					  struct device_attribute *attr,
> > +					  char *buf)
> > +{
> > +	struct i2c_client *client = to_i2c_client(dev);
> > +	int val;
> > +
> > +	val = i2c_smbus_read_word_data(client, BMC_CMD_PWRCYCL_CNT);
> > +	if (val < 0)
> > +		return val;
> > +
> > +	return sprintf(buf, "%d\n", val);
> > +}
> > +
> > +static ssize_t menf21bmc_op_hrs_cnt_show(struct device *dev,
> > +					 struct device_attribute *attr,
> > +					 char *buf)
> > +{
> > +	struct i2c_client *client = to_i2c_client(dev);
> > +	int val;
> > +
> > +	val = i2c_smbus_read_word_data(client, BMC_CMD_OP_HRS_CNT);
> > +	if (val < 0)
> > +		return val;
> > +
> > +	return sprintf(buf, "%d\n", val);
> > +}
> > +
> > +static ssize_t menf21bmc_slot_address_show(struct device *dev,
> > +					   struct device_attribute *attr,
> > +					   char *buf)
> > +{
> > +	struct i2c_client *client = to_i2c_client(dev);
> > +	int val;
> > +
> > +	val = i2c_smbus_read_byte_data(client, BMC_CMD_SLOT_ADDRESS);
> > +	if (val < 0)
> > +		return val;
> > +
> > +	return sprintf(buf, "%d\n", val);
> > +}
> > +
> >  static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, menf21bmc_mode_show,
> >  		   menf21bmc_mode_store);
> > +static DEVICE_ATTR(hw_variant, S_IRUGO | S_IWUSR, menf21bmc_hw_variant_show,
> > +		   menf21bmc_hw_variant_store);
> > +static DEVICE_ATTR(pwrcycl_cnt, S_IRUGO, menf21bmc_pwrcycl_cnt_show, NULL);
> > +static DEVICE_ATTR(op_hrs_cnt, S_IRUGO, menf21bmc_op_hrs_cnt_show, NULL);
> > +static DEVICE_ATTR(slot_address, S_IRUGO, menf21bmc_slot_address_show, NULL);
> >  
> >  static struct attribute *menf21bmc_attributes[] = {
> >  	&dev_attr_mode.attr,
> > +	&dev_attr_hw_variant.attr,
> > +	&dev_attr_pwrcycl_cnt.attr,
> > +	&dev_attr_op_hrs_cnt.attr,
> > +	&dev_attr_slot_address.attr,
> >  	NULL
> >  };
> >  
> 
> -- 
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add sysfs interface
  2016-01-11 10:33     ` Lee Jones
@ 2016-01-11 10:49       ` Andreas Werner
  2016-01-11 11:24         ` Lee Jones
  0 siblings, 1 reply; 16+ messages in thread
From: Andreas Werner @ 2016-01-11 10:49 UTC (permalink / raw)
  To: Lee Jones; +Cc: Andreas Werner, linux-kernel, sameo

On Mon, Jan 11, 2016 at 10:33:54AM +0000, Lee Jones wrote:
> When you re-submit this set, with the correct Maintainers CC'ed,
> please also update the patch subject lines, so they match the format
> of the subsystem.

Just to be sure, do you mean I should update the following.

mfd/menf21bmc: -> mfd: menf21bmc: 

Or do you mean I should update the subject lines of the ABI patches?

Regards
Andy

> 
...

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

* Re: [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add sysfs interface
  2016-01-11 10:49       ` Andreas Werner
@ 2016-01-11 11:24         ` Lee Jones
  0 siblings, 0 replies; 16+ messages in thread
From: Lee Jones @ 2016-01-11 11:24 UTC (permalink / raw)
  To: Andreas Werner; +Cc: linux-kernel, sameo

On Mon, 11 Jan 2016, Andreas Werner wrote:

> On Mon, Jan 11, 2016 at 10:33:54AM +0000, Lee Jones wrote:
> > When you re-submit this set, with the correct Maintainers CC'ed,
> > please also update the patch subject lines, so they match the format
> > of the subsystem.
> 
> Just to be sure, do you mean I should update the following.
> 
> mfd/menf21bmc: -> mfd: menf21bmc: 

This please.  Then start your summary with an upper case letter.

> Or do you mean I should update the subject lines of the ABI patches?
> 
> Regards
> Andy
> 
> > 
> ...

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

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

end of thread, other threads:[~2016-01-11 11:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-16 15:28 [PATCH 0/4] remove auto exit of production and added sysfs interface Andreas Werner
2015-12-16 15:29 ` [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add " Andreas Werner
2016-01-11 10:32   ` Lee Jones
2016-01-11 10:33     ` Lee Jones
2016-01-11 10:49       ` Andreas Werner
2016-01-11 11:24         ` Lee Jones
2015-12-16 15:29 ` [PATCH 2/4] doc/ABI: added sysfs description for the menf21bmc MFD driver Andreas Werner
2016-01-11 10:28   ` Lee Jones
2016-01-11 10:37     ` Andreas Werner
2015-12-16 15:29 ` [PATCH 3/4] mfd/menf21bmc.c: add additional sysfs entries for BMC status information Andreas Werner
2016-01-11 10:30   ` Lee Jones
2016-01-11 10:38     ` Andreas Werner
2015-12-16 15:30 ` [PATCH 4/4] doc/ABI: add documentation for the additional sysfs " Andreas Werner
2016-01-11 10:28   ` Lee Jones
2016-01-11 10:36     ` [PATCH 4/4] doc/ABI: add documentation for the additional sysfs status informationj Andreas Werner
2016-01-06 12:45 ` [PATCH 0/4] remove auto exit of production and added sysfs interface Andreas Werner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).