linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	akpm@linux-foundation.org, linux-mips@linux-mips.org,
	linux-kernel@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	zhangfx@lemote.com, linux-laptop@vger.kernel.org,
	luming.yu@intel.com
Subject: Re: [PATCH v7 6/8] Loongson: YeeLoong: add video output driver
Date: Fri, 4 Dec 2009 09:11:25 +0100	[thread overview]
Message-ID: <20091204081124.GC1540@ucw.cz> (raw)
In-Reply-To: <5fd87c1f64a3c6d3e51fc6b0224cc1be3cb0d9d5.1259932036.git.wuzhangjin@gmail.com>

On Fri 2009-12-04 21:36:43, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This patch adds Video Output Driver, it provides standard
> interface(/sys/class/video_output) to turn on/off the video output of
> LCD, CRT.
> 

> diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
> index 9c8385c..4a89c01 100644
> --- a/drivers/platform/mips/Kconfig
> +++ b/drivers/platform/mips/Kconfig
> @@ -21,6 +21,7 @@ config LEMOTE_YEELOONG2F
>  	select SYS_SUPPORTS_APM_EMULATION
>  	select APM_EMULATION
>  	select HWMON
> +	select VIDEO_OUTPUT_CONTROL
>  	default m
>  	help
>  	  YeeLoong netbook is a mini laptop made by Lemote, which is basically

default m is evil.

> +	if (status == BIT_DISPLAY_LCD_ON) {
> +		/* Turn on LCD */
> +		outb(0x31, 0x3c4);
> +		value = inb(0x3c5);
> +		value = (value & 0xf8) | 0x03;
> +		outb(0x31, 0x3c4);
> +		outb(value, 0x3c5);
> +		/* Turn on backlight */
> +		ec_write(REG_BACKLIGHT_CTRL, BIT_BACKLIGHT_ON);
> +	} else {
> +		/* Turn off backlight */
> +		ec_write(REG_BACKLIGHT_CTRL, BIT_BACKLIGHT_OFF);
> +		/* Turn off LCD */
> +		outb(0x31, 0x3c4);
> +		value = inb(0x3c5);
> +		value = (value & 0xf8) | 0x02;
> +		outb(0x31, 0x3c4);
> +		outb(value, 0x3c5);
> +	}

IIRC this is opencoded in suspend support; should that get common
helpers?

> +	if (status == BIT_CRT_DETECT_PLUG) {
> +		if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_PLUG) {
> +			/* Turn on CRT */
> +			outb(0x21, 0x3c4);
> +			value = inb(0x3c5);
> +			value &= ~(1 << 7);
> +			outb(0x21, 0x3c4);
> +			outb(value, 0x3c5);
> +		}
> +	} else {
> +		/* Turn off CRT */
> +		outb(0x21, 0x3c4);
> +		value = inb(0x3c5);
> +		value |= (1 << 7);
> +		outb(0x21, 0x3c4);
> +		outb(value, 0x3c5);
> +	}

This looks suspiciously similar to one another and to code
above. Perhaps some more helpers?

								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2009-12-04 14:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-04 13:30 [PATCH v7 0/8] Loongson: YeeLoong: add platform specific driver Wu Zhangjin
2009-12-04 13:30 ` [PATCH v7 1/8] MIPS: add subdirectory for platform extension drivers Wu Zhangjin
2009-12-04 13:31 ` [PATCH v7 2/8] Loongson: YeeLoong: add platform driver Wu Zhangjin
2009-12-04 13:32 ` [PATCH v7 3/8] Loongson: YeeLoong: add backlight driver Wu Zhangjin
2009-12-04 13:34 ` [PATCH v7 4/8] Loongson: YeeLoong: add battery driver Wu Zhangjin
2009-12-04  8:04   ` Pavel Machek
2009-12-04 14:56     ` Wu Zhangjin
2009-12-08  6:57   ` Wu Zhangjin
2009-12-08  6:57     ` Wu Zhangjin
2009-12-04 13:35 ` [PATCH v7 5/8] Loongson: YeeLoong: add hardware monitoring driver Wu Zhangjin
2009-12-04  8:08   ` Pavel Machek
2009-12-04 16:29     ` Wu Zhangjin
2009-12-04 13:36 ` [PATCH v7 6/8] Loongson: YeeLoong: add video output driver Wu Zhangjin
2009-12-04  8:11   ` Pavel Machek [this message]
2009-12-04 15:04     ` Wu Zhangjin
2009-12-08  6:54   ` Wu Zhangjin
2009-12-04 13:37 ` [PATCH v7 7/8] Loongson: YeeLoong: add suspend support Wu Zhangjin
2009-12-04 13:39 ` [PATCH v7 8/8] Loongson: YeeLoong: add input/hotkey driver Wu Zhangjin
2009-12-04  8:14   ` Pavel Machek
2009-12-04 14:57     ` Wu Zhangjin

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=20091204081124.GC1540@ucw.cz \
    --to=pavel@ucw.cz \
    --cc=akpm@linux-foundation.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-laptop@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=luming.yu@intel.com \
    --cc=ralf@linux-mips.org \
    --cc=rjw@sisk.pl \
    --cc=wuzhangjin@gmail.com \
    --cc=zhangfx@lemote.com \
    /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).