Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1-wire gpio driver (w1-gpio) issues #601

Closed
ajlennon opened this issue May 24, 2014 · 7 comments
Closed

1-wire gpio driver (w1-gpio) issues #601

ajlennon opened this issue May 24, 2014 · 7 comments

Comments

@ajlennon
Copy link

Hi,

I'm looking at support for a DS18B20 1-wire temp sensor and have run into a couple of issues with the implementation.

I'm using rpi-3.12.y branch building meta-raspberry with Yocto/OpenEmbedded but it looks as though this is current in newer branches.

(1) Driver doesn't de-allocate pullup GPIO

ref: https://github.com/raspberrypi/linux/blob/rpi-3.12.y/drivers/w1/masters/w1-gpio.c

w1_gpio_probe() calls gpio_request() for the 1-wire pin and an external pull-up logic pin if it is configured, however

w1_gpio_remove() frees the 1-wire pin, but does not free the pull-up logic pin

The failure mode can be replicated with w1-gpio built as a module and

modprobe w1-gpio

Driver for 1-wire Dallas network protocol.

rmmod w1-gpio
modprobe w1-gpio

w1-gpio w1-gpio: gpio_request_one (ext_pullup_enable_pin) failed
w1-gpio: probe of w1-gpio failed with error -16

(2) RPi BSP provides invalid pullup GPIO to w1_gpio driver

I believe (1) is an issue because the retrieved pull-up pin in the driver is a 0 which is a valid GPIO pin, and thus GPIO0 is requested and used

pdata->ext_pullup_enable_pin = of_get_gpio(np, 1);

I believe this is occurring because the board support code for bcm2708.c hardcodes the 1-wire GPIO GPIO4 but does not set the pullup pin. This means that the pullup pin will default to GPIO0 rather than an invalid value, say -1

static struct w1_gpio_platform_data w1_gpio_pdata = {
.pin = W1_GPIO,
+++ ext_pullup_enable_pin = WL_GPIO_PULLUP ( == -1)
.is_open_drain = 0,
};

(3) bcm2708.c doesn't enable pull-up configuration (e.g. kernel boot command line) and w1-gpio doesn't enable either gpio or pull-up configuration

Assuming I understand the above correctly I'd like to provide a patch to (1), (2), (3) if there would be interest.

Alex

@popcornmix
Copy link
Collaborator

Please submit a pull request.

@ajlennon
Copy link
Author

Will do.

@ajlennon
Copy link
Author

It looks like this may also relate to #545, #435

@ajlennon
Copy link
Author

@popcornmix No problem. Would you mind if I ask about the etiquette of applying patches into different branches? For example if a maintainer merges a pull request into a main branch like 3.12.y then would the maintainer or a.n.other usually plan to merge that into the head branch, if all goes well, or is that something a pull-requester like me should be thinking about? Thanks

@popcornmix
Copy link
Collaborator

For this repo I tend to maintain the default kernel (3.12.y) and the latest stable kernel (currently 3.14.y).
You should expect any pactches merged into 3.12.y to appear in 3.14.y (and later) kernels.

@ajlennon
Copy link
Author

Thanks

@popcornmix
Copy link
Collaborator

Should be resolved by #602

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants