Re: [PATCH] k10temp: update documentation

2019-09-21 Thread Guenter Roeck
On Thu, Sep 19, 2019 at 11:25:03AM +0200, Lukas Zapletal wrote:
> It's been a while since the k10temp documentation has been updated.
> There are new CPU families supported as well as Tdie temp was added.
> This patch adds all missing families which I was able to find from git
> history and provides more info about Tctl vs Tdie exported temps.
> 
> Signed-off-by: Lukas Zapletal 

Your patch does not apply to the curent mainline kernel.
What is the parent branch ?

> ---
>  Documentation/hwmon/k10temp.rst | 19 +--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> 
>Addresses scanned: PCI space
> @@ -110,3 +116,12 @@ The maximum value for Tctl is available in the
> file temp1_max.
>  If the BIOS has enabled hardware temperature control, the threshold at
>  which the processor will throttle itself to avoid damage is available in
>  temp1_crit and temp1_crit_hyst.
> +
> +On some AMD CPUs, there is a difference between the die temperature (Tdie) 
> and
> +the reported temperature (Tctl). Tdie is the real measured temperature, and
> +Tctl is used for fan control. While Tctl is always available as temp1_input,
> +the driver exports Tdie temperature as temp2_input for those CPUs which 
> support
> +it.
> +
> +Models from 17h family report relative temperature, the driver aims to
> +compensate and report the real temperature.
> 
> diff --git a/Documentation/hwmon/k10temp.rst b/Documentation/hwmon/k10temp.rst
> index 12a86ba17de9..bb2d0a02dc45 100644
> --- a/Documentation/hwmon/k10temp.rst
> +++ b/Documentation/hwmon/k10temp.rst
> @@ -1,7 +1,7 @@
>  Kernel driver k10temp
>  =
> 
> -Supported chips:
> +Although the driver is named k10temp, it supports wide range of AMD CPUs:

The above does not add any value. Many drivers support more than one chip,
but are named after the first supported chip. Please drop this change.

Guenter

> 
>  * AMD Family 10h processors:
> 
> @@ -21,10 +21,16 @@ Supported chips:
> 
>  * AMD Family 14h processors: "Brazos" (C/E/G/Z-Series)
> 
> -* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity",
> "Kaveri", "Carrizo"
> +* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity",
> "Kaveri", "Carrizo", "Stoney Ridge", "Bristol Ridge"
> 
>  * AMD Family 16h processors: "Kabini", "Mullins"
> 
> +* AMD Family 17h processors: "Zen", "Zen 2"
> +
> +* AMD Family 18h processors: "Hygon Dhyana"
> +
> +* AMD Family 19h processors: "Zen 3"
> +
>Prefix: 'k10temp'


Re: [PATCH 5/5] lib/math: remove int_pow()

2019-09-21 Thread kbuild test robot
Hi Rasmus,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3 next-20190918]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:
https://github.com/0day-ci/linux/commits/Rasmus-Villemoes/backlight-pwm_bl-fix-cie1913-comments-and-constant/20190919-225123
config: x86_64-randconfig-s0-201937 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 
:: branch date: 2 hours ago
:: commit date: 2 hours ago

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

   drivers/iio/common/hid-sensors/hid-sensor-attributes.c: In function 
'simple_div':
>> drivers/iio/common/hid-sensors/hid-sensor-attributes.c:94:35: error: 
>> implicit declaration of function 'int_pow' 
>> [-Werror=implicit-function-declaration]
  *micro_frac = (rem / divisor) * int_pow(10, 6 - exp);
  ^
   Cyclomatic Complexity 3 
include/linux/hid-sensor-hub.h:hid_sensor_convert_exponent
   Cyclomatic Complexity 1 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_convert_timestamp
   Cyclomatic Complexity 3 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_batch_mode_supported
   Cyclomatic Complexity 4 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_read_poll_value
   Cyclomatic Complexity 2 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_get_report_latency
   Cyclomatic Complexity 4 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:simple_div
   Cyclomatic Complexity 5 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_read_samp_freq_value
   Cyclomatic Complexity 1 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:split_micro_fraction
   Cyclomatic Complexity 4 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:convert_from_vtf_format
   Cyclomatic Complexity 3 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_read_raw_hyst_value
   Cyclomatic Complexity 4 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:convert_to_vtf_format
   Cyclomatic Complexity 7 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:adjust_exponent_nano
   Cyclomatic Complexity 4 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_format_scale
   Cyclomatic Complexity 9 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_write_samp_freq_value
   Cyclomatic Complexity 6 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_write_raw_hyst_value
   Cyclomatic Complexity 1 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_set_report_latency
   Cyclomatic Complexity 2 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_get_reporting_interval
   Cyclomatic Complexity 2 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_get_report_latency_info
   Cyclomatic Complexity 6 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_parse_common_attributes
   cc1: some warnings being treated as errors

# 
https://github.com/0day-ci/linux/commit/d89cf2c7a3840d1691169c9e099c7def0dc16c46
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d89cf2c7a3840d1691169c9e099c7def0dc16c46
vim +/int_pow +94 drivers/iio/common/hid-sensors/hid-sensor-attributes.c

5d02edfc395744 Srinivas Pandruvada 2014-04-19  75  
73c6768b710a16 srinivas pandruvada 2012-09-05  76  static void simple_div(int 
dividend, int divisor, int *whole,
73c6768b710a16 srinivas pandruvada 2012-09-05  77   
int *micro_frac)
73c6768b710a16 srinivas pandruvada 2012-09-05  78  {
73c6768b710a16 srinivas pandruvada 2012-09-05  79   int rem;
73c6768b710a16 srinivas pandruvada 2012-09-05  80   int exp = 0;
73c6768b710a16 srinivas pandruvada 2012-09-05  81  
73c6768b710a16 srinivas pandruvada 2012-09-05  82   *micro_frac = 0;
73c6768b710a16 srinivas pandruvada 2012-09-05  83   if (divisor == 0) {
73c6768b710a16 srinivas pandruvada 2012-09-05  84   *whole = 0;
73c6768b710a16 srinivas pandruvada 2012-09-05  85   return;
73c6768b710a16 srinivas pandruvada 2012-09-05  86   }
73c6768b710a16 srinivas pandruvada 2012-09-05  87   *whole = 
dividend/divisor;
73c6768b710a16 srinivas pandruvada 2012-09-05  88   rem = dividend % 
divisor;
73c6768b710a16 srinivas pandruvada 2012-09-05  89   if (rem) {
73c6768b710a16 srinivas pandruvada 2012-09-05  90   while (rem <= 
divisor) {
73c6768b710a16 srinivas pandruvada 2012-09-05  91   rem *= 
10;
73c6768b710a16 srinivas pandruvada 2012-09-0

Re: [PATCH 5/5] lib/math: remove int_pow()

2019-09-21 Thread kbuild test robot
Hi Rasmus,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3 next-20190918]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:
https://github.com/0day-ci/linux/commits/Rasmus-Villemoes/backlight-pwm_bl-fix-cie1913-comments-and-constant/20190919-225123
config: x86_64-randconfig-s0-201937 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 
:: branch date: 2 hours ago
:: commit date: 2 hours ago

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

   drivers/iio/common/hid-sensors/hid-sensor-attributes.c: In function 
'simple_div':
>> drivers/iio/common/hid-sensors/hid-sensor-attributes.c:94:35: error: 
>> implicit declaration of function 'int_pow' 
>> [-Werror=implicit-function-declaration]
  *micro_frac = (rem / divisor) * int_pow(10, 6 - exp);
  ^
   Cyclomatic Complexity 3 
include/linux/hid-sensor-hub.h:hid_sensor_convert_exponent
   Cyclomatic Complexity 1 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_convert_timestamp
   Cyclomatic Complexity 3 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_batch_mode_supported
   Cyclomatic Complexity 4 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_read_poll_value
   Cyclomatic Complexity 2 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_get_report_latency
   Cyclomatic Complexity 4 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:simple_div
   Cyclomatic Complexity 5 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_read_samp_freq_value
   Cyclomatic Complexity 1 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:split_micro_fraction
   Cyclomatic Complexity 4 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:convert_from_vtf_format
   Cyclomatic Complexity 3 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_read_raw_hyst_value
   Cyclomatic Complexity 4 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:convert_to_vtf_format
   Cyclomatic Complexity 7 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:adjust_exponent_nano
   Cyclomatic Complexity 4 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_format_scale
   Cyclomatic Complexity 9 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_write_samp_freq_value
   Cyclomatic Complexity 6 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_write_raw_hyst_value
   Cyclomatic Complexity 1 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_set_report_latency
   Cyclomatic Complexity 2 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_get_reporting_interval
   Cyclomatic Complexity 2 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_get_report_latency_info
   Cyclomatic Complexity 6 
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:hid_sensor_parse_common_attributes
   cc1: some warnings being treated as errors

# 
https://github.com/0day-ci/linux/commit/d89cf2c7a3840d1691169c9e099c7def0dc16c46
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d89cf2c7a3840d1691169c9e099c7def0dc16c46
vim +/int_pow +94 drivers/iio/common/hid-sensors/hid-sensor-attributes.c

5d02edfc395744 Srinivas Pandruvada 2014-04-19  75  
73c6768b710a16 srinivas pandruvada 2012-09-05  76  static void simple_div(int 
dividend, int divisor, int *whole,
73c6768b710a16 srinivas pandruvada 2012-09-05  77   
int *micro_frac)
73c6768b710a16 srinivas pandruvada 2012-09-05  78  {
73c6768b710a16 srinivas pandruvada 2012-09-05  79   int rem;
73c6768b710a16 srinivas pandruvada 2012-09-05  80   int exp = 0;
73c6768b710a16 srinivas pandruvada 2012-09-05  81  
73c6768b710a16 srinivas pandruvada 2012-09-05  82   *micro_frac = 0;
73c6768b710a16 srinivas pandruvada 2012-09-05  83   if (divisor == 0) {
73c6768b710a16 srinivas pandruvada 2012-09-05  84   *whole = 0;
73c6768b710a16 srinivas pandruvada 2012-09-05  85   return;
73c6768b710a16 srinivas pandruvada 2012-09-05  86   }
73c6768b710a16 srinivas pandruvada 2012-09-05  87   *whole = 
dividend/divisor;
73c6768b710a16 srinivas pandruvada 2012-09-05  88   rem = dividend % 
divisor;
73c6768b710a16 srinivas pandruvada 2012-09-05  89   if (rem) {
73c6768b710a16 srinivas pandruvada 2012-09-05  90   while (rem <= 
divisor) {
73c6768b710a16 srinivas pandruvada 2012-09-05  91   rem *= 
10;
73c6768b710a16 srinivas pandruvada 2012-09-0

[PATCH 0/2] misc: add support for the cc1101 RF transceiver chip from TI

2019-09-21 Thread Heiko Schocher
This driver provides support for the Low-Power Sub-1 GHz RF
Transceiver chip from Texas Instruments. It provides a
simple message based protocol to set chip registers, send
and receive packets to/from the chip.


Heiko Schocher (2):
  misc: add cc1101 devicetree binding
  misc: add support for the cc1101 RF transceiver chip from TI

 .../devicetree/bindings/misc/cc1101.txt   |   27 +
 Documentation/misc-devices/cc1101.txt |  446 
 drivers/misc/Kconfig  |   11 +
 drivers/misc/Makefile |1 +
 drivers/misc/cc1101.c | 2004 +
 drivers/misc/cc1101.h |   89 +
 include/uapi/linux/cc1101_user.h  |  255 +++
 7 files changed, 2833 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/cc1101.txt
 create mode 100644 Documentation/misc-devices/cc1101.txt
 create mode 100644 drivers/misc/cc1101.c
 create mode 100644 drivers/misc/cc1101.h
 create mode 100644 include/uapi/linux/cc1101_user.h

-- 
2.21.0



[PATCH 2/2] misc: add support for the cc1101 RF transceiver chip from TI

2019-09-21 Thread Heiko Schocher
This driver provides support for the Low-Power Sub-1 GHz RF
Transceiver chip from Texas Instruments. It provides a
simple message based protocol to set chip registers, send
and receive packets to/from the chip. For more details
see Documentation/misc-devices/cc1101.txt and
Documentation/devicetree/bindings/misc/cc1101.txt

Signed-off-by: Heiko Schocher 
---

 Documentation/misc-devices/cc1101.txt |  446 ++
 drivers/misc/Kconfig  |   11 +
 drivers/misc/Makefile |1 +
 drivers/misc/cc1101.c | 2004 +
 drivers/misc/cc1101.h |   89 ++
 include/uapi/linux/cc1101_user.h  |  255 
 6 files changed, 2806 insertions(+)
 create mode 100644 Documentation/misc-devices/cc1101.txt
 create mode 100644 drivers/misc/cc1101.c
 create mode 100644 drivers/misc/cc1101.h
 create mode 100644 include/uapi/linux/cc1101_user.h

diff --git a/Documentation/misc-devices/cc1101.txt 
b/Documentation/misc-devices/cc1101.txt
new file mode 100644
index 0..61d11baa70dad
--- /dev/null
+++ b/Documentation/misc-devices/cc1101.txt
@@ -0,0 +1,446 @@
+=
+cc1101 driver
+=
+
+abstract
+
+
+This driver add support for the cc1101 Low-Power Sub-1 GHz RF Transceiver
+chip from Texas Instruments [1].
+
+The driver do not know anything about the data which is received
+or transmitted, beside the first byte is always a length byte, as
+this driver supports only variable packet length mode, see [1]
+chapter "0x08: PKTCTRL0 – Packet Automation Control"
+
+driver supports:
+
+- define different cc1101 register configurations. Each configuration
+  is referenced through a name.
+
+- define delay tables which are used for CSMA delay timeouts. Each
+  delay table is referenced through a name.
+
+- receive data from the cc1101 chip.
+
+- send data to the cc1101 chip
+
+  - optionally check if channel is free (CSMA). It is configurable
+which delay table is used for the current packet, and how many
+times the driver tries to get a free band.
+
+  - optionally send a preamble before the data, length of the preamble
+is configurable through module parameter preamble_timeout in msec.
+
+- communication with userspace is message based
+
+- userspace can define a job, which contains more than one message
+  the driver executes each message.
+
+- driver can generate events (if enabled in register configuration)
+  which means the driver calculates all 100 ms the current rssi value
+  and send it to userspace.
+
+module parameter
+
+
+preamble_timeout: timeout for sending preamble in msec
+  default: 360
+
+DTS
+===
+
+see:
+Documentation/devicetree/bindings/misc/cc1101.txt
+
+cc1101 register settings
+
+
+For correct working the driver needs some register settings,
+you cannot change. Without them it makes no sense to use the
+driver (for example, the GDOx pins are used as IRQ pins, and
+if they are not setup in IRQ mode you get unexpected behaviour.
+For example on GDO0 outputs a 24MHz clock ... which will stall
+your cpu when the driver enables the GDO0 pin as irq).
+
+Following the register settings the driver checks:
+
+GDO0 setting
+
+
+IOCFG0 (0x2) mode 0x6
+Asserts when sync word has been sent / received, and de-asserts
+at the end of the packet. In RX, the pin will also deassert when
+a packet is discarded due to address or maximum length filtering
+or when the radio enters RXFIFO_OVERFLOW state. In TX the pin
+will de-assert if the TX FIFO underflows.
+
+GDO2 setting
+
+
+IOCFG2 (0x0) mode 0xe
+Carrier sense. High if RSSI level is above threshold.
+Cleared when entering IDLE mode.
+
+set automatic rx mode
+.
+
+MCSM1 (0x17): RXOFF_MODE und TXOFF_MODE must be 0xf
+so the cc1101 chip go into rx mode after tx or rx finished.
+
+If this bits are not set, driver tries to set rx mode after
+successful rx or tx. But this is slow and may leads in missing
+rx packets.
+
+variable packet length mode
+...
+
+This driver supports variable packet length mode only,
+see [1] chapter "0x08: PKTCTRL0 – Packet Automation Control"
+
+packet format
+.
+
+only "normal" mode (use FIFOs for RX and TX) is supported.
+
+append status
+.
+
+This setting is optional.
+
+PKTCTRL1 (0x07) APPEND_STATUS
+-> cc1101 appends 2 bytes to each received packet
+
+
+userspace interface
+===
+
+The driver interface is message based, which means the Userspace
+has to setup messages and send them to the driver. Also, the driver
+use messages to communicate with the Userspace process.
+
+It could be needed to send more than one message to the driver
+at once, so messages can be grouped into one job, give the job an ID
+and send it to the driver, see "send a job". The driver than go through
+the single messages in the job and executes them. For example it is
+possible to set a register co