public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <zbr@ioremap.net>
To: Evgeny Boger <eugenyboger@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Evgeny Boger <boger@contactless.ru>
Subject: Re: [PATCH 1/1] Add strong pullup emulation to w1-gpio master driver.
Date: Tue, 12 Nov 2013 03:09:36 +0400	[thread overview]
Message-ID: <10261384211376@web11j.yandex.ru> (raw)
In-Reply-To: <1384180614-9025-1-git-send-email-boger@contactless.ru>

Hi

11.11.2013, 18:37, "Evgeny Boger" <eugenyboger@gmail.com>:
>  Strong pullup is emulated by driving pin logic high after write command when
>  using tri-state push-pull GPIO.
>
> Signed-off-by: Evgeny Boger <boger@contactless.ru>
> ---
>  drivers/w1/masters/w1-gpio.c | 22 ++++++++++++++++++++++
>  drivers/w1/w1_int.c          | 12 ------------
>  include/linux/w1-gpio.h      |  1 +
>  3 files changed, 23 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
> index f54ece2..cb7f89b 100644
> --- a/drivers/w1/masters/w1-gpio.c
> +++ b/drivers/w1/masters/w1-gpio.c
> @@ -18,10 +18,31 @@
>  #include <linux/of_gpio.h>
>  #include <linux/err.h>
>  #include <linux/of.h>
> +#include <linux/delay.h>
>
>  #include "../w1.h"
>  #include "../w1_int.h"
>
> +static u8 w1_gpio_set_pullup(void *data, int delay)
> +{
> + struct w1_gpio_platform_data *pdata = data;
> +
> + if (delay) {
> + pdata->pullup_duration = delay;
> + } else {
> + if (pdata->pullup_duration) {
> + gpio_direction_output(pdata->pin, 1);
> +
> + msleep(pdata->pullup_duration);

This doesn't look like a good idea - kernel will sleep for that long not doing usual w1 job

> --- a/drivers/w1/w1_int.c
> +++ b/drivers/w1/w1_int.c
> @@ -117,18 +117,6 @@ int w1_add_master_device(struct w1_bus_master *master)
>                 printk(KERN_ERR "w1_add_master_device: invalid function set\n");
>                 return(-EINVAL);
>          }
> - /* While it would be electrically possible to make a device that
> - * generated a strong pullup in bit bang mode, only hardware that
> - * controls 1-wire time frames are even expected to support a strong
> - * pullup.  w1_io.c would need to support calling set_pullup before
> - * the last write_bit operation of a w1_write_8 which it currently
> - * doesn't.
> - */
> - if (!master->write_byte && !master->touch_bit && master->set_pullup) {
> - printk(KERN_ERR "w1_add_master_device: set_pullup requires "
> - "write_byte or touch_bit, disabling\n");
> - master->set_pullup = NULL;
> - }
>

Why did you drop this check? It has nothing with w1-gpio driver

  reply	other threads:[~2013-11-11 23:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-11 14:36 [PATCH 1/1] Add strong pullup emulation to w1-gpio master driver Evgeny Boger
2013-11-11 23:09 ` Evgeniy Polyakov [this message]
     [not found]   ` <5281691F.4060604@gmail.com>
2013-11-12  1:03     ` Evgeniy Polyakov
2013-11-12  1:07       ` Evgeny Boger
2013-11-12  8:01         ` David Fries
2013-11-13  1:15           ` Evgeny Boger
2013-11-13  4:07             ` David Fries
2013-11-13 22:42               ` Evgeniy Polyakov
  -- strict thread matches above, loose matches on Subject: below --
2013-11-10 23:27 Evgeny Boger

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=10261384211376@web11j.yandex.ru \
    --to=zbr@ioremap.net \
    --cc=boger@contactless.ru \
    --cc=eugenyboger@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox