Skip to contentSkip to conversation

wire: export w1_touch_bit

PATCH Superseded Jan Kandziora 2 participants 6 messages Sep 18, 2017 – Sep 20, 2017

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/2 wire: export w1_touch_bit

The w1_ds28e17 driver from the next part of this patch needs to emit single-bit read timeslots to the DS28E17. The w1 subsystem already has this function but it is not exported outside drivers/w1/w1_io.c

This subpatch exports the w1_touch_bit symbol with EXPORT_SYMBOL_GPL, same as the other exported symbols in drivers/w1/w1_io.c

May be also useful later for writing drivers for other Onewire chips which do single-bit communication.

---
Changes in v4 against v3 in this subpatch:
- adapted to linux-4.12.0

No changes in v3 against v2,v1 in this subpatch.

 drivers/w1/w1.h    | 1 +
 drivers/w1/w1_io.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/w1/w1.h +1 -0
index 758a7a6..e7af855 100644
@@ -295,6 +295,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn);
 int w1_slave_detach(struct w1_slave *sl);
 
 u8 w1_triplet(struct w1_master *dev, int bdir);
+u8 w1_touch_bit(struct w1_master *dev, int bit);
 void w1_write_8(struct w1_master *, u8);
 u8 w1_read_8(struct w1_master *);
 int w1_reset_bus(struct w1_master *);
drivers/w1/w1_io.c +2 -1
index 1134e6b..4bb77a1 100644
@@ -58,7 +58,7 @@ static u8 w1_read_bit(struct w1_master *dev);
  * @dev:	the master device
  * @bit:	0 - write a 0, 1 - write a 0 read the level
  */
-static u8 w1_touch_bit(struct w1_master *dev, int bit)
+u8 w1_touch_bit(struct w1_master *dev, int bit)
 {
 	if (dev->bus_master->touch_bit)
 		return dev->bus_master->touch_bit(dev->bus_master->data, bit);
@@ -69,6 +69,7 @@ static u8 w1_touch_bit(struct w1_master *dev, int bit)
 		return 0;
 	}
 }
+EXPORT_SYMBOL_GPL(w1_touch_bit);
 
 /**
  * w1_write_bit() - Generates a write-0 or write-1 cycle.
Signature · 1 line
2.13.3
#1 lore raw

PATCH v4 2/2 add w1_ds28e17 driver for the DS28E17 Onewire to I2C master bridge

This subpatch adds a driver for the DS28E17 Onewire to I2C master bridge.

---
Changes in v4 against v3 in this subpatch:
- adapted to linux-4.12.0

Changes in v3 against v2 in this subpatch:
- fixed a bug in using the i2c_adapter_quirks structure

Changes in v2 against v1 in this subpatch:
- added error handling in w1_f19_error()
- added struct i2c_adapter_quirks
- removed unnecessary checks of I2C address and read count
- cleaned up error codes
+ EOPNOTSUPP for read/write count == 0
+ ETIMEDOUT for busy timeout
+ ENXIO for no reply of I2C slave
+ EAGAIN for I2C invalid start condition
+ EIO for all w1 errors
- devm_kzalloc() instead of kzalloc()
- i2c speed to be set as 100, 400, 900 instead of 0, 1, 2
- added driver parameter documentation
- added sysfs documentation
- Kconfig fixed

 Documentation/ABI/testing/sysfs-driver-w1_ds28e17 |  21 +
 Documentation/w1/slaves/00-INDEX                  |   2 +
 Documentation/w1/slaves/w1_ds28e17                |  68 ++
 drivers/w1/slaves/Kconfig                         |  15 +
 drivers/w1/slaves/Makefile                        |   1 +
 drivers/w1/slaves/w1_ds28e17.c                    | 772 ++++++++++++++++++++++
 drivers/w1/w1_family.h                            |   1 +
 7 files changed, 880 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-w1_ds28e17
 create mode 100644 Documentation/w1/slaves/w1_ds28e17
 create mode 100644 drivers/w1/slaves/w1_ds28e17.c
Documentation/ABI/testing/sysfs-driver-w1_ds28e17 new file +21 -0
new file mode 100644
index 0000000..b97b101
@@ -0,0 +1,21 @@
+What:		/sys/bus/w1/devices/19-<id>/speed
+Date:		Jul 2016
+KernelVersion:	4.7
+Contact:	Jan Kandziora <[email protected]>
+Description:	When written, this file sets the I2C speed on the connected
+		DS28E17 chip. When read, it reads the current setting from
+		the DS28E17 chip.
+		Valid values: 100, 400, 900 [kBaud].
+		Default 100, can be set by w1_ds28e17.speed= module parameter.
+Users:		w1_ds28e17 driver
+
+What:		/sys/bus/w1/devices/19-<id>/stretch
+Date:		Jul 2016
+KernelVersion:	4.7
+Contact:	Jan Kandziora <[email protected]>
+Description:	When written, this file sets the multiplier used to calculate
+		the busy timeout for I2C operations on the connected DS28E17
+		chip. When read, returns the current setting.
+		Valid values: 1 to 9.
+		Default 1, can be set by w1_ds28e17.stretch= module parameter.
+Users:		w1_ds28e17 driver
Documentation/w1/slaves/00-INDEX +2 -0
index 8d76718..68946f8 100644
@@ -10,3 +10,5 @@ w1_ds2438
 	- The Maxim/Dallas Semiconductor ds2438 smart battery monitor.
 w1_ds28e04
 	- The Maxim/Dallas Semiconductor ds28e04 eeprom.
+w1_ds28e17
+	- The Maxim/Dallas Semiconductor ds28e17 1-Wire-to-I2C Master Bridge.
Documentation/w1/slaves/w1_ds28e17 new file +68 -0

68 lines not on this page · raw message

drivers/w1/slaves/Kconfig +15 -0
index fb68465..b94c55c 100644
@@ -140,6 +140,21 @@ config W1_SLAVE_DS28E04
 
 	  If you are unsure, say N.
 
+config W1_SLAVE_DS28E17
+	tristate "1-wire-to-I2C master bridge (DS28E17)"
+	select CRC16
+	depends on I2C
+	help
+	  Say Y here if you want to use the DS28E17 1-wire-to-I2C master bridge.
+	  For each DS28E17 detected, a new I2C adapter is created within the
+	  kernel. I2C devices on that bus can be configured to be used by the
+	  kernel and userspace tools as on any other "native" I2C bus.
+
+	  This driver is also available as a module. If so, the module
+	  will be called w1_ds28e17.
+
+	  If you are unsure, say N.
+
 config W1_SLAVE_BQ27000
 	tristate "BQ27000 slave support"
 	help
drivers/w1/slaves/Makefile +1 -0
index 54c63e4..5ec927b 100644
@@ -17,3 +17,4 @@ obj-$(CONFIG_W1_SLAVE_DS2780)	+= w1_ds2780.o
 obj-$(CONFIG_W1_SLAVE_DS2781)	+= w1_ds2781.o
 obj-$(CONFIG_W1_SLAVE_BQ27000)	+= w1_bq27000.o
 obj-$(CONFIG_W1_SLAVE_DS28E04)	+= w1_ds28e04.o
+obj-$(CONFIG_W1_SLAVE_DS28E17)	+= w1_ds28e17.o
drivers/w1/slaves/w1_ds28e17.c new file +772 -0

772 lines not on this page · raw message

drivers/w1/w1_family.h +1 -0
index 869a3ff..f675638 100644
@@ -25,6 +25,7 @@
 #define W1_FAMILY_SMEM_81	0x81
 #define W1_FAMILY_DS2405	0x05
 #define W1_THERM_DS18S20 	0x10
+#define W1_FAMILY_DS28E17	0x19
 #define W1_FAMILY_DS28E04	0x1C
 #define W1_COUNTER_DS2423	0x1D
 #define W1_THERM_DS1822  	0x22
Signature · 1 line
2.13.3
#2 lore raw
In reply to Jan Kandziora
Quoted 10 lines · Jan Kandziora

The w1_ds28e17 driver from the next part of this patch needs to emit single-bit read timeslots to the DS28E17. The w1 subsystem already has this function but it is not exported outside drivers/w1/w1_io.c

This subpatch exports the w1_touch_bit symbol with EXPORT_SYMBOL_GPL, same as the other exported symbols in drivers/w1/w1_io.c

May be also useful later for writing drivers for other Onewire chips which do single-bit communication.

Quoted 7 lines

---
Changes in v4 against v3 in this subpatch:
- adapted to linux-4.12.0

No changes in v3 against v2,v1 in this subpatch.

You should change it as it does not apply to 4.14-rc1 :(

Please rebase your patches and resend them, with Evgeniy's acks added to them.

thanks,

greg k-h

#3 lore raw

Am 18.09.2017 um 16:19 schrieb GregKH:

Quoted 17 lines · Jan Kandziora
Quoted 16 lines

The w1_ds28e17 driver from the next part of this patch needs to emit single-bit read timeslots to the DS28E17. The w1 subsystem already has this function but it is not exported outside drivers/w1/w1_io.c

This subpatch exports the w1_touch_bit symbol with EXPORT_SYMBOL_GPL, same as the other exported symbols in drivers/w1/w1_io.c

May be also useful later for writing drivers for other Onewire chips which do single-bit communication.

---
Changes in v4 against v3 in this subpatch:
- adapted to linux-4.12.0

Quoted 4 lines
Quoted 1 line

No changes in v3 against v2,v1 in this subpatch.

You should change it as it does not apply to 4.14-rc1 :(

Okay, I will review them again.

Quoted 3 lines

Please rebase your patches and resend them, with Evgeniy's acks added to them.

Now you caught me. I don't know how to do that. What's required? The
Acked-by: line? Am I allowed to simply add these lines to my patches or is there a procedure to follow?

Kind regards

Jan

#4 lore raw
Quoted 25 lines · Jan Kandziora

Am 18.09.2017 um 16:19 schrieb GregKH:

Quoted 17 lines · Jan Kandziora
Quoted 16 lines

The w1_ds28e17 driver from the next part of this patch needs to emit single-bit read timeslots to the DS28E17. The w1 subsystem already has this function but it is not exported outside drivers/w1/w1_io.c

This subpatch exports the w1_touch_bit symbol with EXPORT_SYMBOL_GPL, same as the other exported symbols in drivers/w1/w1_io.c

May be also useful later for writing drivers for other Onewire chips which do single-bit communication.

---
Changes in v4 against v3 in this subpatch:
- adapted to linux-4.12.0

Quoted 4 lines
Quoted 1 line

No changes in v3 against v2,v1 in this subpatch.

You should change it as it does not apply to 4.14-rc1 :(

Okay, I will review them again.

Quoted 6 lines
Quoted 3 lines

Please rebase your patches and resend them, with Evgeniy's acks added to them.

Now you caught me. I don't know how to do that. What's required? The
Acked-by: line? Am I allowed to simply add these lines to my patches or is there a procedure to follow?

Just add the acked-by line, like I did above, and all should be fine.

thanks,

greg k-h

#5 lore raw
In reply to GregKH

Am 18.09.2017 um 16:19 schrieb GregKH:

Quoted 17 lines · Jan Kandziora
Quoted 16 lines

The w1_ds28e17 driver from the next part of this patch needs to emit single-bit read timeslots to the DS28E17. The w1 subsystem already has this function but it is not exported outside drivers/w1/w1_io.c

This subpatch exports the w1_touch_bit symbol with EXPORT_SYMBOL_GPL, same as the other exported symbols in drivers/w1/w1_io.c

May be also useful later for writing drivers for other Onewire chips which do single-bit communication.

---
Changes in v4 against v3 in this subpatch:
- adapted to linux-4.12.0

Quoted 4 lines
Quoted 1 line

No changes in v3 against v2,v1 in this subpatch.

You should change it as it does not apply to 4.14-rc1 :(

I revised it and just sent it to you and now I hope for the best.

Kind regards

Jan