From: Daniel Mack <zonque@gmail.com>
To: Daniel Mack <zonque@gmail.com>
Cc: linux-kernel@vger.kernel.org, Evgeniy Polyakov <zbr@ioremap.net>,
Ville Syrjala <syrjala@sci.fi>
Subject: Re: [PATCH 1/2] onewire: w1-gpio: add ext_pullup_enable pin in platform data
Date: Mon, 30 Jul 2012 19:26:31 +0200 [thread overview]
Message-ID: <5016C3C7.7090207@gmail.com> (raw)
In-Reply-To: <1343249670-14985-1-git-send-email-zonque@gmail.com>
Ping.
On 25.07.2012 22:54, Daniel Mack wrote:
> 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 <zonque@gmail.com>
> Cc: Evgeniy Polyakov <zbr@ioremap.net>
> Cc: Ville Syrjala <syrjala@sci.fi>
> ---
> drivers/w1/masters/w1-gpio.c | 18 +++++++++++++++++-
> include/linux/w1-gpio.h | 1 +
> 2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
> index df600d1..dac88ff 100644
> --- a/drivers/w1/masters/w1-gpio.c
> +++ b/drivers/w1/masters/w1-gpio.c
> @@ -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);
> diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h
> index 3adeff8..065e3ae 100644
> --- a/include/linux/w1-gpio.h
> +++ b/include/linux/w1-gpio.h
> @@ -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 */
>
next prev parent reply other threads:[~2012-07-30 17:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-25 20:54 [PATCH 1/2] onewire: w1-gpio: add ext_pullup_enable pin in platform data Daniel Mack
2012-07-25 20:54 ` [PATCH 2/2] onewire: w1-gpio: add DT bindings Daniel Mack
2012-07-30 17:26 ` Daniel Mack [this message]
2012-07-30 17:32 ` [PATCH 1/2] onewire: w1-gpio: add ext_pullup_enable pin in platform data Evgeniy Polyakov
2012-07-30 17:35 ` Daniel Mack
2012-07-30 18:12 ` Evgeniy Polyakov
2012-07-31 0:59 ` Ville Syrjälä
2012-07-31 6:19 ` Daniel Mack
2012-08-01 16:57 ` Ville Syrjälä
2012-08-05 16:18 ` Daniel Mack
2012-08-16 16:57 ` GregKH
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=5016C3C7.7090207@gmail.com \
--to=zonque@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syrjala@sci.fi \
--cc=zbr@ioremap.net \
/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.