All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: richard.dorsch@gmail.com, linux-kernel@vger.kernel.org,
	lm-sensors@lm-sensors.org, linux-i2c@vger.kernel.org,
	linux-watchdog@vger.kernel.org, linux-gpio@vger.kernel.org,
	jdelvare@suse.com, wim@iguana.be, jo.sunga@advantech.com
Subject: Re: [PATCH v3 3/6] Add Advantech iManager HWmon driver
Date: Mon, 18 Jan 2016 07:40:38 +0000	[thread overview]
Message-ID: <20160118074038.GH28745@x1> (raw)
In-Reply-To: <569BE312.4010609@roeck-us.net>

On Sun, 17 Jan 2016, Guenter Roeck wrote:

> On 01/10/2016 03:31 PM, richard.dorsch@gmail.com wrote:
> >From: Richard Vidal-Dorsch <richard.dorsch@gmail.com>

Tell us about the device.

> >Signed-off-by: Richard Vidal-Dorsch <richard.dorsch@gmail.com>
> >---
> >  Documentation/hwmon/imanager       |   59 ++
> >  drivers/hwmon/Kconfig              |   12 +
> >  drivers/hwmon/Makefile             |    2 +
> >  drivers/hwmon/imanager-ec-hwmon.c  |  606 +++++++++++++++++++++
> >  drivers/hwmon/imanager-hwmon.c     | 1057 ++++++++++++++++++++++++++++++++++++
> >  include/linux/mfd/imanager/hwmon.h |  120 ++++

I'm not keen on stuffing header files in /include/linux/mfd/.  Please
re-locate them to somewhere specific to hwmon.


[...]

> >diff --git a/include/linux/mfd/imanager/hwmon.h b/include/linux/mfd/imanager/hwmon.h
> >new file mode 100644
> >index 0000000..2a7e191
> >--- /dev/null
> >+++ b/include/linux/mfd/imanager/hwmon.h
> >@@ -0,0 +1,120 @@
> >+/*
> >+ * Advantech iManager Hardware Monitoring core
> >+ *
> >+ * Copyright (C) 2016 Advantech Co., Ltd., Irvine, CA, USA
> >+ * Author: Richard Vidal-Dorsch <richard.dorsch@advantech.com>
> >+ *
> >+ * This program is free software; you can redistribute  it and/or modify it
> >+ * under  the terms of  the GNU General  Public License as published by the
> >+ * Free Software Foundation;  either version 2 of the  License, or (at your
> >+ * option) any later version.
> >+ */
> >+
> >+#ifndef __HWMON_H__
> >+#define __HWMON_H__

Less generic.

> >+#include <linux/types.h>
> >+
> >+#define HWM_MAX_ADC	5
> >+#define HWM_MAX_FAN	3
> >+
> >+/* Voltage computation (10-bit ADC, 0..3V input) */
> >+#define SCALE_IN	2933	/* (3000mV / (2^10 - 1)) * 1000 */
> >+
> >+/* Default Voltage Sensors */
> >+struct hwm_voltage {
> >+	bool valid;	/* if set, below values are valid */
> >+
> >+	int value;
> >+	int min;
> >+	int max;
> >+	int average;
> >+	int lowest;
> >+	int highest;
> >+
> >+};
> >+
> >+struct hwm_fan_temp_limit {
> >+	int stop;
> >+	int min;
> >+	int max;
> >+};
> >+
> >+struct hwm_fan_limit {
> >+	int min;
> >+	int max;
> >+};
> >+
> >+struct hwm_fan_alert {
> >+	int min;
> >+	int max;
> >+	int min_alarm;
> >+	int max_alarm;
> >+};
> >+
> >+struct hwm_sensors_limit {
> >+	struct hwm_fan_temp_limit temp;
> >+	struct hwm_fan_limit	  pwm;
> >+	struct hwm_fan_limit	  rpm;
> >+};
> >+
> >+struct hwm_smartfan {
> >+	bool valid;	/* if set, below values are valid */
> >+
> >+	int mode;
> >+	int type;
> >+	int pwm;
> >+	int speed;
> >+	int pulse;
> >+	int alarm;
> >+	int temp;
> >+
> >+	struct hwm_sensors_limit limit;
> >+	struct hwm_fan_alert	 alert;
> >+};
> >+
> >+struct hwm_data {
> >+	struct hwm_voltage	volt[HWM_MAX_ADC];
> >+	struct hwm_smartfan	fan[HWM_MAX_FAN];
> >+};
> >+
> >+enum fan_unit {
> >+	FAN_CPU,
> >+	FAN_SYS1,
> >+	FAN_SYS2,
> >+};
> >+
> >+enum fan_ctrl_type {
> >+	CTRL_PWM,
> >+	CTRL_RPM,
> >+};
> >+
> >+enum fan_mode {
> >+	MODE_OFF,
> >+	MODE_FULL,
> >+	MODE_MANUAL,
> >+	MODE_AUTO,
> >+};

Are these used outside of the driver?

If not, consider moving them into the *.c file.

> >+int hwm_core_init(void);
> >+
> >+int hwm_core_adc_is_available(int num);
> >+int hwm_core_adc_get_max_count(void);
> >+int hwm_core_adc_get_value(int num, struct hwm_voltage *volt);
> >+const char *hwm_core_adc_get_label(int num);
> >+
> >+int hwm_core_fan_is_available(int num);
> >+int hwm_core_fan_get_max_count(void);
> >+int hwm_core_fan_get_ctrl(int num, struct hwm_smartfan *fan);
> >+int hwm_core_fan_set_ctrl(int num, int fmode, int ftype, int pwm, int pulse,
> >+			  struct hwm_sensors_limit *limit,
> >+			  struct hwm_fan_alert *alert);
> >+
> >+int hwm_core_fan_set_rpm_limit(int num, int min, int max);
> >+int hwm_core_fan_set_pwm_limit(int num, int min, int max);
> >+int hwm_core_fan_set_temp_limit(int num, int stop, int min, int max);
> >+
> >+const char *hwm_core_fan_get_label(int num);
> >+const char *hwm_core_fan_get_temp_label(int num);

Are all of these exported somewhere?

> >+#endif
> >
> 

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

  reply	other threads:[~2016-01-18  7:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-10 23:31 [PATCH v3 0/6] Add Advantech iManager EC driver set richard.dorsch-Re5JQEeQqe8AvxtiuMwx3w
2016-01-10 23:31 ` richard.dorsch
2016-01-10 23:31 ` [PATCH v3 1/6] Add Advantech iManager MFD core driver richard.dorsch
2016-01-11  0:54   ` Krzysztof Kozlowski
2016-01-10 23:31 ` [PATCH v3 2/6] Add Advantech iManager GPIO driver richard.dorsch
2016-01-18  7:42   ` Lee Jones
2016-01-18  7:42     ` Lee Jones
2016-01-10 23:31 ` [PATCH v3 3/6] Add Advantech iManager HWmon driver richard.dorsch
2016-01-17 18:53   ` Guenter Roeck
2016-01-18  7:40     ` Lee Jones [this message]
2016-01-10 23:31 ` [PATCH v3 4/6] Add Advantech iManager I2C driver richard.dorsch
     [not found]   ` <1452468675-5827-5-git-send-email-richard.dorsch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-01-18  7:41     ` Lee Jones
2016-01-18  7:41       ` Lee Jones
2016-03-03 20:48     ` Wolfram Sang
2016-03-03 20:48       ` Wolfram Sang
2016-01-10 23:31 ` [PATCH v3 5/6] Add Advantech iManager Backlight driver richard.dorsch
2016-01-11 10:23   ` Lee Jones
2016-01-10 23:31 ` [PATCH v3 6/6] Add Advantech iManager Watchdog driver richard.dorsch
2016-01-17 19:15   ` Guenter Roeck
     [not found]   ` <1452468675-5827-7-git-send-email-richard.dorsch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-01-18  7:38     ` Lee Jones
2016-01-18  7:38       ` Lee Jones
2016-01-11  0:54 ` [PATCH v3 0/6] Add Advantech iManager EC driver set 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=20160118074038.GH28745@x1 \
    --to=lee.jones@linaro.org \
    --cc=jdelvare@suse.com \
    --cc=jo.sunga@advantech.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lm-sensors@lm-sensors.org \
    --cc=richard.dorsch@gmail.com \
    --cc=wim@iguana.be \
    /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.