From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Ondrej Zary <linux@rainbow-software.org>
Cc: linux-fbdev@vger.kernel.org,
Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3 v2] cyber2000fb: add I2C support
Date: Sun, 01 Aug 2010 08:44:15 +0000 [thread overview]
Message-ID: <20100801084415.GA10608@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <201008010013.39287.linux@rainbow-software.org>
On Sun, Aug 01, 2010 at 12:13:37AM +0200, Ondrej Zary wrote:
> Add I2C support for the DDC bus to cyber2000fb driver. This is only bus
> support, driver does not use EDID.
> Tested on two different CyberPro 2000 cards with i2cdetect and decode-edid.
>
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
> ---
> This is v2 with added locking and ddc things properly named.
>
> diff -urp linux-2.6.35-rc3-/drivers/video/cyber2000fb.c linux-2.6.35-rc3/drivers/video/cyber2000fb.c
> --- linux-2.6.35-rc3-/drivers/video/cyber2000fb.c 2010-07-31 21:58:35.000000000 +0200
> +++ linux-2.6.35-rc3/drivers/video/cyber2000fb.c 2010-08-01 00:02:59.000000000 +0200
> @@ -48,6 +48,10 @@
> #include <linux/init.h>
> #include <linux/io.h>
>
> +#include <linux/i2c.h>
> +#include <linux/i2c-id.h>
> +#include <linux/i2c-algo-bit.h>
> +
> #include <asm/pgtable.h>
> #include <asm/system.h>
>
> @@ -88,6 +92,12 @@ struct cfb_info {
> u_char ramdac_powerdown;
>
> u32 pseudo_palette[16];
> +#ifdef CONFIG_FB_CYBER2000_I2C
CONFIG_FB_CYBER2000_DDC please.
> + bool ddc_registered;
> + struct i2c_adapter ddc_adapter;
> + struct i2c_algo_bit_data ddc_algo;
> + struct mutex reg_b0_lock;
Does the weight of a mutex really matter here, or would a spinlock be
lighter weight?
> +static void cyber2000fb_enable_ddc(struct cfb_info *cfb)
> +{
> + mutex_lock(&cfb->reg_b0_lock);
> + cyber2000fb_writew(0x1bf, 0x3ce, cfb);
> +}
> +
> +static void cyber2000fb_disable_ddc(struct cfb_info *cfb)
> +{
> + cyber2000fb_writew(0x0bf, 0x3ce, cfb);
> + mutex_unlock(&cfb->reg_b0_lock);
> +}
> +
> +
> +static void cyber2000fb_setscl(void *data, int val)
cyber2000fb_ddc_setscl
> +{
> + struct cfb_info *cfb = data;
> + unsigned char reg;
> +
> + cyber2000fb_enable_ddc(cfb);
> + reg = cyber2000_grphr(DDC_REG, cfb);
> + if (!val) /* bit is inverted */
> + reg |= DDC_SCL_OUT;
> + else
> + reg &= ~DDC_SCL_OUT;
> + cyber2000_grphw(DDC_REG, reg, cfb);
> + cyber2000fb_disable_ddc(cfb);
> +}
> +
> +static void cyber2000fb_setsda(void *data, int val)
cyber2000fb_ddc_setsda
> +{
> + struct cfb_info *cfb = data;
> + unsigned char reg;
> +
> + cyber2000fb_enable_ddc(cfb);
> + reg = cyber2000_grphr(DDC_REG, cfb);
> + if (!val) /* bit is inverted */
> + reg |= DDC_SDA_OUT;
> + else
> + reg &= ~DDC_SDA_OUT;
> + cyber2000_grphw(DDC_REG, reg, cfb);
> + cyber2000fb_disable_ddc(cfb);
> +}
> +
> +static int cyber2000fb_getscl(void *data)
cyber2000fb_ddc_getscl
> +{
> + struct cfb_info *cfb = data;
> + int retval;
> +
> + cyber2000fb_enable_ddc(cfb);
> + retval = !!(cyber2000_grphr(DDC_REG, cfb) & DDC_SCL_IN);
> + cyber2000fb_disable_ddc(cfb);
> +
> + return retval;
> +}
> +
> +static int cyber2000fb_getsda(void *data)
cyber2000fb_ddc_getsda
next prev parent reply other threads:[~2010-08-01 8:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-31 20:55 [PATCH 3/3] cyber2000fb: add I2C support Ondrej Zary
2010-07-31 21:42 ` Russell King - ARM Linux
2010-07-31 22:13 ` [PATCH 3/3 v2] " Ondrej Zary
2010-08-01 8:44 ` Russell King - ARM Linux [this message]
2010-08-01 10:07 ` [PATCH 3/3 v3] " Ondrej Zary
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=20100801084415.GA10608@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rainbow-software.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).