linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Daniel Vetter <daniel.vetter-/w4YWyX8dFk@public.gmane.org>
Cc: Intel Graphics Development
	<intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	DRI Development
	<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] i2c: export bit-banging algo functions
Date: Tue, 28 Feb 2012 09:08:17 +0100	[thread overview]
Message-ID: <20120228090817.1a95c28b@endymion.delvare> (raw)
In-Reply-To: <1330385979-19406-1-git-send-email-daniel.vetter-/w4YWyX8dFk@public.gmane.org>

On Tue, 28 Feb 2012 00:39:39 +0100, Daniel Vetter wrote:
> i915 has a hw i2c controller (gmbus) but for a bunch of stupid reasons
> we need to be able to fall back to the bit-banging algo on gpio pins.
> 
> The current code sets up a 2nd i2c controller for the same i2c bus using
> the bit-banging algo. This has a bunch of issues, the major one being
> that userspace can directly access this fallback i2c adaptor behind
> the drivers back.
> 
> But we need to frob a few registers before and after using fallback
> gpio bit-banging, so this horribly fails.
> 
> The new plan is to only set up one i2c adaptor and transparently fall
> back to bit-banging by directly calling the xfer function of the bit-
> banging algo in the i2c core.
> 
> To make that possible, export the 2 i2c algo functions.
> 
> v2: As suggested by Jean Delvare, simply export the i2c_bit_algo
> vtable instead of the individual functions.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter-/w4YWyX8dFk@public.gmane.org>
> ---
>  drivers/i2c/algos/i2c-algo-bit.c |    3 ++-
>  include/linux/i2c-algo-bit.h     |    1 +
>  2 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
> index 525c734..ad0459c 100644
> --- a/drivers/i2c/algos/i2c-algo-bit.c
> +++ b/drivers/i2c/algos/i2c-algo-bit.c
> @@ -610,10 +610,11 @@ static u32 bit_func(struct i2c_adapter *adap)
>  
>  /* -----exported algorithm data: -------------------------------------	*/
>  
> -static const struct i2c_algorithm i2c_bit_algo = {
> +const struct i2c_algorithm i2c_bit_algo = {
>  	.master_xfer	= bit_xfer,
>  	.functionality	= bit_func,
>  };
> +EXPORT_SYMBOL(i2c_bit_algo);
>  
>  /*
>   * registering functions to load algorithms at runtime
> diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
> index 4f98148..584ffa0 100644
> --- a/include/linux/i2c-algo-bit.h
> +++ b/include/linux/i2c-algo-bit.h
> @@ -49,5 +49,6 @@ struct i2c_algo_bit_data {
>  
>  int i2c_bit_add_bus(struct i2c_adapter *);
>  int i2c_bit_add_numbered_bus(struct i2c_adapter *);
> +extern const struct i2c_algorithm i2c_bit_algo;
>  
>  #endif /* _LINUX_I2C_ALGO_BIT_H */

Acked-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>

-- 
Jean Delvare

  parent reply	other threads:[~2012-02-28  8:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-14 21:37 [PATCH 1/7] drm/i915: add dev_priv to intel_gmbus Daniel Vetter
     [not found] ` <1329255445-6312-1-git-send-email-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2012-02-14 21:37   ` [PATCH 2/7] drm/nouveau: do a better job at hiding the NIH i2c bit-banging algo Daniel Vetter
     [not found]     ` <1329255445-6312-2-git-send-email-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2012-02-27 17:25       ` Daniel Vetter
2012-02-14 21:37   ` [PATCH 3/7] i2c: export bit-banging algo functions Daniel Vetter
     [not found]     ` <1329255445-6312-3-git-send-email-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2012-02-27 17:27       ` Daniel Vetter
2012-02-27 22:20       ` Jean Delvare
     [not found]         ` <20120227232040.0476d508-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-02-27 22:52           ` Daniel Vetter
     [not found]             ` <20120227225223.GB1050-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2012-02-27 23:39               ` [PATCH] " Daniel Vetter
     [not found]                 ` <1330385979-19406-1-git-send-email-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2012-02-28  8:08                   ` Jean Delvare [this message]
     [not found]                     ` <20120228090817.1a95c28b-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-02-29 19:48                       ` Daniel Vetter
2012-02-28  8:06             ` [PATCH 3/7] " Jean Delvare
2012-02-14 21:37   ` [PATCH 4/7] drm/i915: merge struct intel_gpio into struct intel_gmbus Daniel Vetter
2012-02-14 21:37   ` [PATCH 5/7] drm/i915: merge gmbus and gpio i2c adpater into one Daniel Vetter
2012-02-14 21:37   ` [PATCH 6/7] drm/i915: i2c: unconditionally set up gpio fallback Daniel Vetter
     [not found]     ` <1329255445-6312-6-git-send-email-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2012-02-14 22:53       ` [PATCH] " Daniel Vetter
2012-02-14 23:47     ` [PATCH 6/7] " Eugeni Dodonov
     [not found]       ` <CAC7LmnvP0wUroQq6VJ3QeoWDy=WEk_UcfkKiuYx=hWZ8WT6tMQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-02-27 18:22         ` [PATCH] " Daniel Vetter
2012-02-27 18:29           ` Eugeni Dodonov
2012-02-14 21:37   ` [PATCH 7/7] drm/i915: reenable gmbus on gen3+ again Daniel Vetter
2012-02-27 17:53 ` [Intel-gfx] [PATCH 1/7] drm/i915: add dev_priv to intel_gmbus Eugeni Dodonov
     [not found]   ` <CAC7LmnupmYAs-+pUQw-wYh7+rzeK5wowDQKrmE7hh3j=pvHdvA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-02-29 19:56     ` Daniel Vetter

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=20120228090817.1a95c28b@endymion.delvare \
    --to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
    --cc=daniel.vetter-/w4YWyX8dFk@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).