Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1582410 > unrolled thread
| Started by | Mariusz Bialonczyk <manio@skyboo.net> |
|---|---|
| First post | 2017-02-16 10:30 +0100 |
| Last post | 2017-02-17 10:00 +0100 |
| Articles | 4 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 1/4] Documentation: w1_therm: clearly state about binary value for precision Mariusz Bialonczyk <manio@skyboo.net> - 2017-02-16 10:30 +0100
[PATCH 2/4] w1: add missing DS2413 documentation Mariusz Bialonczyk <manio@skyboo.net> - 2017-02-16 10:30 +0100
[PATCH 4/4] w1: add documentation for w1_ds2438 Mariusz Bialonczyk <manio@skyboo.net> - 2017-02-16 10:30 +0100
Re: [PATCH 1/4] Documentation: w1_therm: clearly state about binary value for precision Mariusz Bialonczyk <manio@skyboo.net> - 2017-02-17 10:00 +0100
| From | Mariusz Bialonczyk <manio@skyboo.net> |
|---|---|
| Date | 2017-02-16 10:30 +0100 |
| Subject | [PATCH 1/4] Documentation: w1_therm: clearly state about binary value for precision |
| Message-ID | <tbqxY-4dp-13@gated-at.bofh.it> |
Signed-off-by: Mariusz Bialonczyk <manio@skyboo.net> --- Documentation/w1/slaves/w1_therm | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/w1/slaves/w1_therm b/Documentation/w1/slaves/w1_therm index d1f93af..e10cd91 100644 --- a/Documentation/w1/slaves/w1_therm +++ b/Documentation/w1/slaves/w1_therm @@ -42,6 +42,7 @@ SRAM, so it is reset when the sensor gets power-cycled. To store the current precision configuration into EEPROM, the value 0 has to be written to the sysfs w1_slave file. Since the EEPROM has a limited amount of writes (>50k), this command should be used wisely. +Note: this precision value has to be a binary one-byte value, not ASCII. The module parameter strong_pullup can be set to 0 to disable the strong pullup, 1 to enable autodetection or 2 to force strong pullup. -- 2.9.3
[toc] | [next] | [standalone]
| From | Mariusz Bialonczyk <manio@skyboo.net> |
|---|---|
| Date | 2017-02-16 10:30 +0100 |
| Subject | [PATCH 2/4] w1: add missing DS2413 documentation |
| Message-ID | <tbqxY-4dp-17@gated-at.bofh.it> |
| In reply to | #1582410 |
Signed-off-by: Mariusz Bialonczyk <manio@skyboo.net> --- Documentation/w1/slaves/00-INDEX | 2 ++ Documentation/w1/slaves/w1_ds2413 | 50 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Documentation/w1/slaves/w1_ds2413 diff --git a/Documentation/w1/slaves/00-INDEX b/Documentation/w1/slaves/00-INDEX index 6e18c70..cbcca1d 100644 --- a/Documentation/w1/slaves/00-INDEX +++ b/Documentation/w1/slaves/00-INDEX @@ -2,6 +2,8 @@ - This file w1_therm - The Maxim/Dallas Semiconductor ds18*20 temperature sensor. +w1_ds2413 + - The Maxim/Dallas Semiconductor ds2413 dual channel addressable switch. w1_ds2423 - The Maxim/Dallas Semiconductor ds2423 counter device. w1_ds28e04 diff --git a/Documentation/w1/slaves/w1_ds2413 b/Documentation/w1/slaves/w1_ds2413 new file mode 100644 index 0000000..936263a --- /dev/null +++ b/Documentation/w1/slaves/w1_ds2413 @@ -0,0 +1,50 @@ +Kernel driver w1_ds2413 +======================= + +Supported chips: + * Maxim DS2413 1-Wire Dual Channel Addressable Switch + +supported family codes: + W1_FAMILY_DS2413 0x3A + +Author: Mariusz Bialonczyk <manio@skyboo.net> + +Description +----------- + +The DS2413 chip has two open-drain outputs (PIO A and PIO B). +Support is provided through the sysfs files "output" and "state". + +Reading state +------------- +The "state" file provides one-byte value which is in the same format as for +the chip PIO_ACCESS_READ command (refer the datasheet for details): + +Bit 0: PIOA Pin State +Bit 1: PIOA Output Latch State +Bit 2: PIOB Pin State +Bit 3: PIOB Output Latch State +Bit 4-7: Complement of Bit 3 to Bit 0 (verified by the kernel module) + +This file is readonly. + +Writing output +-------------- +You can set the PIO pins using the "output" file. +It is writable, you can write one-byte value to this sysfs file. +Similarly the byte format is the same as for the PIO_ACCESS_WRITE command: + +Bit 0: PIOA +Bit 1: PIOB +Bit 2-7: No matter (driver will set it to "1"s) + + +The chip has some kind of basic protection against transmission errors. +When reading the state, there is a four complement bits. +The driver is checking this complement, and when it is wrong then it is +returning I/O error. + +When writing output, the master must repeat the PIO Output Data byte in +its inverted form and it is waiting for a confirmation. +If the write is unsuccessful for three times, the write also returns +I/O error. -- 2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Mariusz Bialonczyk <manio@skyboo.net> |
|---|---|
| Date | 2017-02-16 10:30 +0100 |
| Subject | [PATCH 4/4] w1: add documentation for w1_ds2438 |
| Message-ID | <tbqxY-4dp-19@gated-at.bofh.it> |
| In reply to | #1582410 |
Signed-off-by: Mariusz Bialonczyk <manio@skyboo.net> --- Documentation/w1/slaves/00-INDEX | 2 ++ Documentation/w1/slaves/w1_ds2438 | 63 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 Documentation/w1/slaves/w1_ds2438 diff --git a/Documentation/w1/slaves/00-INDEX b/Documentation/w1/slaves/00-INDEX index cbcca1d..8d76718 100644 --- a/Documentation/w1/slaves/00-INDEX +++ b/Documentation/w1/slaves/00-INDEX @@ -6,5 +6,7 @@ w1_ds2413 - The Maxim/Dallas Semiconductor ds2413 dual channel addressable switch. w1_ds2423 - The Maxim/Dallas Semiconductor ds2423 counter device. +w1_ds2438 + - The Maxim/Dallas Semiconductor ds2438 smart battery monitor. w1_ds28e04 - The Maxim/Dallas Semiconductor ds28e04 eeprom. diff --git a/Documentation/w1/slaves/w1_ds2438 b/Documentation/w1/slaves/w1_ds2438 new file mode 100644 index 0000000..b99f367 --- /dev/null +++ b/Documentation/w1/slaves/w1_ds2438 @@ -0,0 +1,63 @@ +Kernel driver w1_ds2438 +======================= + +Supported chips: + * Maxim DS2438 Smart Battery Monitor + +supported family codes: + W1_FAMILY_DS2438 0x26 + +Author: Mariusz Bialonczyk <manio@skyboo.net> + +Description +----------- + +The DS2438 chip provides several functions that are desirable to carry in +a battery pack. It also has a 40 bytes of nonvolatile EEPROM. +Because the ability of temperature, current and voltage measurement, the chip +is also often used in weather stations and applications such as: rain gauge, +wind speed/direction measuring, humidity sensing, etc. + +Current support is provided through the following sysfs files (all files +except "iad" are readonly): + +"iad" +----- +This file controls the 'Current A/D Control Bit' (IAD) in the +Status/Configuration Register. +Writing a zero value will clear the IAD bit and disables the current +measurements. +Writing value "1" is setting the IAD bit (enables the measurements). +The IAD bit is enabled by default in the DS2438. + +When writing to sysfs file bits 2-7 are ignored, so it's safe to write ASCII. +An I/O error is returned when there is a problem setting the new value. + +"page0" +------- +This file provides full 8 bytes of the chip Page 0 (00h). +This page contains the most frequently accessed information of the DS2438. +Internally when this file is read, the additional CRC byte is also obtained +from the slave device. If it is correct, the 8 bytes page data are passed +to userspace, otherwise an I/O error is returned. + +"temperature" +------------- +Opening and reading this file initiates the CONVERT_T (temperature conversion) +command of the chip, afterwards the temperature is read from the device +registers and provided as an ASCII decimal value. + +Important: The returned value has to be divided by 256 to get a real +temperature in degrees Celsius. + +"vad", "vdd" +------------ +Opening and reading this file initiates the CONVERT_V (voltage conversion) +command of the chip. + +Depending on a sysfs filename a different input for the A/D will be selected: +vad: general purpose A/D input (VAD) +vdd: battery input (VDD) + +After the voltage conversion the value is returned as decimal ASCII. +Note: The value is in mV, so to get a volts the value has to be divided by 10. -- 2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Mariusz Bialonczyk <manio@skyboo.net> |
|---|---|
| Date | 2017-02-17 10:00 +0100 |
| Subject | Re: [PATCH 1/4] Documentation: w1_therm: clearly state about binary value for precision |
| Message-ID | <tbMyt-21X-3@gated-at.bofh.it> |
| In reply to | #1582410 |
On Thu, 16 Feb 2017 10:05:36 +0100 Mariusz Bialonczyk <manio@skyboo.net> wrote: > Signed-off-by: Mariusz Bialonczyk <manio@skyboo.net> > --- > Documentation/w1/slaves/w1_therm | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/w1/slaves/w1_therm b/Documentation/w1/slaves/w1_therm > index d1f93af..e10cd91 100644 > --- a/Documentation/w1/slaves/w1_therm > +++ b/Documentation/w1/slaves/w1_therm > @@ -42,6 +42,7 @@ SRAM, so it is reset when the sensor gets power-cycled. > To store the current precision configuration into EEPROM, the value 0 > has to be written to the sysfs w1_slave file. Since the EEPROM has a limited > amount of writes (>50k), this command should be used wisely. > +Note: this precision value has to be a binary one-byte value, not ASCII. > > The module parameter strong_pullup can be set to 0 to disable the > strong pullup, 1 to enable autodetection or 2 to force strong pullup. > -- > 2.9.3 > Please skip this single patch. I was wrong about it. w1_slave_store is using kstrtoint() so it is currently ok. regards, -- Mariusz Białończyk | xmpp/e-mail: manio@skyboo.net http://manio.skyboo.net | https://github.com/manio
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web