All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Lindgren <simon-IfRblWqrl23QT0dZR+AlfA@public.gmane.org>
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Implementing bus recovery
Date: Fri, 22 Aug 2014 21:14:57 +0200	[thread overview]
Message-ID: <53F796B1.2000400@aqwary.com> (raw)

I would like to implement bus recovery support for the at91 driver, but 
there it is not clear how the core support is supposed to be used, and I 
could not find an existing adapter implementation using it.

First off, reading the old mailing list discussion here:
http://thread.gmane.org/gmane.linux.drivers.i2c/10225

It seems a pinctrl state should be used to switch the pins over to gpio 
mode. Now, I need a place to put this state switching. The 
i2c_bus_recovery_info struct looks like this:

struct i2c_bus_recovery_info {
	int (*recover_bus)(struct i2c_adapter *);

	int (*get_scl)(struct i2c_adapter *);
	void (*set_scl)(struct i2c_adapter *, int val);
	int (*get_sda)(struct i2c_adapter *);

	void (*prepare_recovery)(struct i2c_bus_recovery_info *bri);
	void (*unprepare_recovery)(struct i2c_bus_recovery_info *bri);

	/* gpio recovery */
	int scl_gpio;
	int sda_gpio;
};

There is no usable callback to do this, because {un,}prepare_recovery is 
only passed the bus recovery info and no driver data is reachable from that.

So next up, I thought I'd wrap i2c_generic_gpio_recovery and do the 
state switching there. But then I have to fill in the entire info struct 
by hand which definitely does not seem to be the intention given the 
special case in i2c_register_adapter. What am I missing?

             reply	other threads:[~2014-08-22 19:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-22 19:14 Simon Lindgren [this message]
     [not found] ` <53F796B1.2000400-IfRblWqrl23QT0dZR+AlfA@public.gmane.org>
2014-08-23  0:41   ` Implementing bus recovery Mark Roszko
     [not found]     ` <CAJjB1q+_KbLBKXNMvG6DWHcuVOvmJs3XmT3B8yb-_a0K12ZJtw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-25 10:43       ` Simon Lindgren
     [not found]         ` <53FB1369.802-IfRblWqrl23QT0dZR+AlfA@public.gmane.org>
2014-08-27  3:08           ` Mark Roszko
     [not found]             ` <CAJjB1qLO86mDntbnMZKWNycmuW4QGDuZVd_EhqB2XSenunzOxQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-27 11:02               ` Simon Lindgren

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=53F796B1.2000400@aqwary.com \
    --to=simon-ifrblwqrl23qt0dzr+alfa@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 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.