onewire: w1-gpio: add ext_pullup_enable pin in platform data
Subsystems (2)
PATCH 1/2 onewire: w1-gpio: add ext_pullup_enable pin in platform data
In the process of porting boards to devicetree implemenation, we should keep information about external circuitry where they belong - the individual drivers.
This patch adds a way to specify a GPIO to drive the (optional) external pull-up logic, rather than using a function pointer for that.
--- drivers/w1/masters/w1-gpio.c | 18 +++++++++++++++++- include/linux/w1-gpio.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/w1/masters/w1-gpio.c +17 -1
@@ -59,6 +59,13 @@ static int __init w1_gpio_probe(struct platform_device *pdev)if (err) goto free_master; +if (gpio_is_valid (pdata->ext_pullup_enable_pin)) { + err =gpio_request_one (pdata->ext_pullup_enable_pin, +GPIOF_INIT_LOW ,"w1 pullup" ); +if (err <0 ) + goto free_gpio; + } + master->data = pdata; master->read_bit = w1_gpio_read_bit;
@@ -72,15 +79,21 @@ static int __init w1_gpio_probe(struct platform_device *pdev) err =w1_add_master_device (master);if (err) - goto free_gpio; + goto free_gpio_ext_pu;if (pdata->enable_external_pullup) pdata->enable_external_pullup (1 ); +if (gpio_is_valid (pdata->ext_pullup_enable_pin)) +gpio_set_value (pdata->ext_pullup_enable_pin,1 ); +platform_set_drvdata (pdev, master);return 0 ; + free_gpio_ext_pu: +if (gpio_is_valid (pdata->ext_pullup_enable_pin)) +gpio_free (pdata->ext_pullup_enable_pin); free_gpio:gpio_free (pdata->pin); free_master:
@@ -97,6 +110,9 @@ static int __exit w1_gpio_remove(struct platform_device *pdev)if (pdata->enable_external_pullup) pdata->enable_external_pullup (0 ); +if (gpio_is_valid (pdata->ext_pullup_enable_pin)) +gpio_set_value (pdata->ext_pullup_enable_pin,0 ); +w1_remove_master_device (master);gpio_free (pdata->pin);kfree (master);
include/linux/w1-gpio.h +1 -0
@@ -19,6 +19,7 @@ struct w1_gpio_platform_data {unsigned int pin; unsigned int is_open_drain:1;void (*enable_external_pullup)(int enable); + unsigned int ext_pullup_enable_pin; };#endif /* _LINUX_W1_GPIO_H */
Signature · 1 line
1.7.10.4
PATCH 2/2 onewire: w1-gpio: add DT bindings
This patch add DT bindings to the w1-gpio driver, along with some documentation on how to use them.
--- Documentation/devicetree/bindings/w1/w1-gpio.txt | 22 +++++++++++ drivers/w1/masters/w1-gpio.c | 46 ++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/w1/w1-gpio.txt
Documentation/devicetree/bindings/w1/w1-gpio.txt new file +22 -0
@@ -0,0 +1,22 @@ +w1-gpio devicetree bindings + +Required properties: + + - compatible: "w1-gpio" + - gpios: one or two GPIO specs: + - the first one is used as data I/O pin + - the second one is optional. If specified, it is used as + enable pin for an external pin pullup. + +Optional properties: + + - linux,open-drain: if specified, the data pin is considered in + open-drain mode. + +Examples: + + onewire@0 { + compatible = "w1-gpio"; + gpios = <&gpio 126 0>, <&gpio 105 0>; + }; +
drivers/w1/masters/w1-gpio.c +46 -0
70 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Ping.
Quoted 79 lines · Daniel Mack
In the process of porting boards to devicetree implemenation, we should keep information about external circuitry where they belong - the individual drivers.
This patch adds a way to specify a GPIO to drive the (optional) external pull-up logic, rather than using a function pointer for that.
Signed-off-by Daniel Mack <[email protected]>Cc Evgeniy Polyakov <[email protected]>Cc Ville Syrjala <[email protected]>--- drivers/w1/masters/w1-gpio.c | 18 +++++++++++++++++- include/linux/w1-gpio.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-)drivers/w1/masters/w1-gpio.c +17
-1@@ -59,6 +59,13 @@ static int __init w1_gpio_probe(struct platform_device *pdev)if (err) goto free_master; +if (gpio_is_valid (pdata->ext_pullup_enable_pin)) { + err =gpio_request_one (pdata->ext_pullup_enable_pin, +GPIOF_INIT_LOW ,"w1 pullup" ); +if (err <0 ) + goto free_gpio; + } + master->data = pdata; master->read_bit = w1_gpio_read_bit;@@ -72,15 +79,21 @@ static int __init w1_gpio_probe(struct platform_device *pdev) err =w1_add_master_device (master);if (err) - goto free_gpio; + goto free_gpio_ext_pu;if (pdata->enable_external_pullup) pdata->enable_external_pullup (1 ); +if (gpio_is_valid (pdata->ext_pullup_enable_pin)) +gpio_set_value (pdata->ext_pullup_enable_pin,1 ); +platform_set_drvdata (pdev, master);return 0 ; + free_gpio_ext_pu: +if (gpio_is_valid (pdata->ext_pullup_enable_pin)) +gpio_free (pdata->ext_pullup_enable_pin); free_gpio:gpio_free (pdata->pin); free_master:@@ -97,6 +110,9 @@ static int __exit w1_gpio_remove(struct platform_device *pdev)if (pdata->enable_external_pullup) pdata->enable_external_pullup (0 ); +if (gpio_is_valid (pdata->ext_pullup_enable_pin)) +gpio_set_value (pdata->ext_pullup_enable_pin,0 ); +w1_remove_master_device (master);gpio_free (pdata->pin);kfree (master);include/linux/w1-gpio.h +1
-0@@ -19,6 +19,7 @@ struct w1_gpio_platform_data {unsigned int pin; unsigned int is_open_drain:1;void (*enable_external_pullup)(int enable); + unsigned int ext_pullup_enable_pin; };#endif /* _LINUX_W1_GPIO_H */
Hi
Sorry for long delay
Quoted 6 lines · Daniel Mack
In the process of porting boards to devicetree implemenation, we should keep information about external circuitry where they belong - the individual drivers.
This patch adds a way to specify a GPIO to drive the (optional) external pull-up logic, rather than using a function pointer for that.
I do not object against this patch, but I have rather limited knowledge about gpio driver. Patch looks good, feel free to add my
Greg, please pull it into your tree, if Ville does not object. Thank you.
Signature · 1 line
Evgeniy Polyakov
Quoted 9 lines · Evgeniy Polyakov
Hi
Sorry for long delay
Quoted 4 lines · Daniel Mack
In the process of porting boards to devicetree implemenation, we should keep information about external circuitry where they belong - the individual drivers.
Quoted 5 lines
Quoted 2 lines
This patch adds a way to specify a GPIO to drive the (optional) external pull-up logic, rather than using a function pointer for that.
I do not object against this patch, but I have rather limited knowledge about gpio driver.
The first patch just offers a new way to drive an optional external pull-up and as nobody uses that feature currently, there can't be any breakage.
And the second patch doesn't change any functional behaviour of the driver, it simply offers a new way to instanciate it.
Quoted 2 lines
Patch looks good, feel free to add my
Acked-by Evgeniy Polyakov <[email protected]>
Thanks!
Quoted 4 lines
Greg, please pull it into your tree, if Ville does not object. Thank you.
Hi
Sorry for long delay
[resend with fixed Greg's address :)]
Quoted 6 lines · Daniel Mack
In the process of porting boards to devicetree implemenation, we should keep information about external circuitry where they belong - the individual drivers.
This patch adds a way to specify a GPIO to drive the (optional) external pull-up logic, rather than using a function pointer for that.
I do not object against this patch, but I have rather limited knowledge about gpio driver. Patch looks good, feel free to add my
Greg, please pull it into your tree, if Ville does not object. Thank you.
Signature · 1 line
Evgeniy Polyakov
Quoted 10 lines · Evgeniy Polyakov
Hi
Sorry for long delay
[resend with fixed Greg's address :)]Quoted 4 lines · Daniel Mack
In the process of porting boards to devicetree implemenation, we should keep information about external circuitry where they belong - the individual drivers.
Quoted 8 lines
Quoted 2 lines
This patch adds a way to specify a GPIO to drive the (optional) external pull-up logic, rather than using a function pointer for that.
I do not object against this patch, but I have rather limited knowledge about gpio driver. Patch looks good, feel free to add my
Acked-by Evgeniy Polyakov <[email protected]>Greg, please pull it into your tree, if Ville does not object.
No objections from me.
The only cosmetic issue I spotted was 'pdata' being assigned twice in w1_gpio_probe().
Signature · 3 lines
Ville Syrjälä [email protected] http://www.sci.fi/~syrjala/
Quoted 14 lines · Ville Syrjälä
Quoted 13 lines · Evgeniy Polyakov
Hi
Sorry for long delay
[resend with fixed Greg's address :)]Quoted 6 lines · Daniel Mack
In the process of porting boards to devicetree implemenation, we should keep information about external circuitry where they belong - the individual drivers.
This patch adds a way to specify a GPIO to drive the (optional) external pull-up logic, rather than using a function pointer for that.
Quoted 7 lines
Quoted 5 lines
I do not object against this patch, but I have rather limited knowledge about gpio driver. Patch looks good, feel free to add my
Acked-by Evgeniy Polyakov <[email protected]>Greg, please pull it into your tree, if Ville does not object.
No objections from me.
I take this as an Acked-by:?
Quoted 2 lines
The only cosmetic issue I spotted was 'pdata' being assigned twice in
w1_gpio_probe().
Right. Amended patch below.
Thanks a lot,
Daniel
Quoted 1 line
From
37385d15bbd9dbc637f1e46d962c90be5eeb1409Mon Sep 17 00:00:00 2001
From: Daniel Mack <[email protected]>
Date: Mon, 23 Jul 2012 16:36:35 +0200
Subject: [PATCH v2] onewire: w1-gpio: add DT bindings
This patch add DT bindings to the w1-gpio driver, along with some documentation on how to use them.
--- Documentation/devicetree/bindings/w1/w1-gpio.txt | 22 +++++++++++ drivers/w1/masters/w1-gpio.c | 48 +++++++++++++++++++++++- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/w1/w1-gpio.txt
Documentation/devicetree/bindings/w1/w1-gpio.txt new file +22 -0
@@ -0,0 +1,22 @@ +w1-gpio devicetree bindings + +Required properties: + + - compatible: "w1-gpio" + - gpios: one or two GPIO specs: + - the first one is used as data I/O pin + - the second one is optional. If specified, it is used as + enable pin for an external pin pullup. + +Optional properties: + + - linux,open-drain: if specified, the data pin is considered in + open-drain mode. + +Examples: + + onewire@0 { + compatible = "w1-gpio"; + gpios = <&gpio 126 0>, <&gpio 105 0>; + }; +
drivers/w1/masters/w1-gpio.c +47 -1
71 lines not on this page · raw message
Signature · 1 line
1.7.11.2
Ville Syrjälä
Acked-byQuoted 19 lines · Daniel Mack
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Evgeniy Polyakov
Hi
Sorry for long delay
[resend with fixed Greg's address :)]Quoted 6 lines · Daniel Mack
In the process of porting boards to devicetree implemenation, we should keep information about external circuitry where they belong - the individual drivers.
This patch adds a way to specify a GPIO to drive the (optional) external pull-up logic, rather than using a function pointer for that.
I do not object against this patch, but I have rather limited knowledge about gpio driver. Patch looks good, feel free to add my
Acked-by Evgeniy Polyakov <[email protected]>
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Greg, please pull it into your tree, if Ville does not object.
No objections from me.
I take this as an Acked-by:?
Sure, why not :)
Signature · 3 lines
Ville Syrjälä [email protected] http://www.sci.fi/~syrjala/
Quoted 22 lines · Ville Syrjälä
Quoted 21 lines · Daniel Mack
Quoted 20 lines · Ville Syrjälä
Quoted 18 lines · Evgeniy Polyakov
Hi
Sorry for long delay
[resend with fixed Greg's address :)]Quoted 6 lines · Daniel Mack
In the process of porting boards to devicetree implemenation, we should keep information about external circuitry where they belong - the individual drivers.
This patch adds a way to specify a GPIO to drive the (optional) external pull-up logic, rather than using a function pointer for that.
I do not object against this patch, but I have rather limited knowledge about gpio driver. Patch looks good, feel free to add my
Acked-by Evgeniy Polyakov <[email protected]>Greg, please pull it into your tree, if Ville does not object.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
No objections from me.
I take this as an Acked-by:?
Sure, why not :)
Acked-by Ville Syrjälä <[email protected]>
Greg, could you queue up these two patches somewhere?
Thanks,
Daniel
Quoted 25 lines · Daniel Mack
Quoted 24 lines · Ville Syrjälä
Quoted 23 lines · Daniel Mack
Quoted 21 lines · Ville Syrjälä
Quoted 10 lines · Evgeniy Polyakov
Hi
Sorry for long delay
[resend with fixed Greg's address :)]Quoted 4 lines · Daniel Mack
In the process of porting boards to devicetree implemenation, we should keep information about external circuitry where they belong - the individual drivers.
Quoted 8 lines
Quoted 2 lines
This patch adds a way to specify a GPIO to drive the (optional) external pull-up logic, rather than using a function pointer for that.
I do not object against this patch, but I have rather limited knowledge about gpio driver. Patch looks good, feel free to add my
Acked-by Evgeniy Polyakov <[email protected]>Greg, please pull it into your tree, if Ville does not object.
No objections from me.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
I take this as an Acked-by:?
Sure, why not :)
Acked-by Ville Syrjälä <[email protected]>Greg, could you queue up these two patches somewhere?
Yes, I now have them, thanks.
greg k-h