mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Purdie <rpurdie@rpsys.net>
To: Kristoffer Ericson <kristoffer.ericson@gmail.com>
Cc: Roel Kluin <12o3l@tiscali.nl>,
	Russell King <linux@arm.linux.org.uk>,
	Linux-arm <linux-arm-kernel@lists.arm.linux.org.uk>,
	linux-main <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH/HP7XX] - Add combined LCD / BL driver for platform HP Jornada 7xx handhelds
Date: Wed, 06 Feb 2008 17:25:54 +0000	[thread overview]
Message-ID: <1202318754.8393.24.camel@dax.rpnet.com> (raw)
In-Reply-To: <20080206173341.619c52c8.Kristoffer.ericson@gmail.com>

On Wed, 2008-02-06 at 17:33 +0100, Kristoffer Ericson wrote:
> Oki, here is attempt #2 (btw, new mail or just keep thread?)

Apart from the issues Russell mentioned,

--- /dev/null
+++ b/drivers/video/backlight/jornada720_bllcd.c
@@ -0,0 +1,286 @@
+/*
+ * drivers/video/backlight/jornada720_bllcd.c
+ *

We already know which file this is...

> +/*
> + * BACKLIGHT HANDLING ROUTINES
> + */
> +static int jornada_bl_get_brightness(struct backlight_device *dev)
> +{
> +	int ret;
> +
> +	/* check if backlight is on */
> +	if (!(PPSR & PPC_LDD1))
> +		return JORNADA_BL_MAX_BRIGHTNESS;
> +
> +	jornada_ssp_start();
> +	if (jornada_ssp_inout(GETBRIGHTNESS) == -ETIMEDOUT) {
> +		printk(KERN_ERR "jornada720_bl: GetBrightness failed\n");
> +		ret = JORNADA_BL_MAX_BRIGHTNESS + 1;

You've informed the backlight class your brightness runs from 0 to
JORNADA_BL_MAX_BRIGHTNESS by setting max_brightness. Returning
JORNADA_BL_MAX_BRIGHTNESS + 1 is invalid and confusing. -1 would
probably be a better choice.

> +static int jornada_lcd_get_contrast(struct lcd_device *pdev)
> +{
> +	int ret;
> +
> +	/* Don't set contrast on off powerd LCD */
> +	if (jornada_lcd_get_power(pdev) != FB_BLANK_UNBLANK)
> +		return 0;
> +
> +	jornada_ssp_start();
> +
> +	ret = jornada_ssp_inout(GETCONTRAST);
> +	if (ret != -ETIMEDOUT)
> +		ret = jornada_ssp_inout(TXDUMMY);
> +	else {
> +		printk(KERN_ERR "jornada_lcd: getcontrast failed!\n");
> +		ret = JORNADA_BL_MAX_BRIGHTNESS + 1;

and again...

> +static int jornada_bl_probe(struct platform_device *pdev)
> +{
> +	struct jornada_bllcd_device *bllcd;
> +
> +	bllcd = kzalloc(sizeof(*bllcd), GFP_KERNEL);
> +	if (bllcd == NULL)
> +		return -ENOMEM;
> +
> +	/* bl driver - name must match fb driver name */
> +	bllcd->jorn_backlight_device = backlight_device_register(S1D_DEVICENAME,
> +		&pdev->dev, NULL, &jornada_bl_ops);
> +
> +	if (IS_ERR(bllcd->jorn_backlight_device)) {
> +		kfree(bllcd);
> +		return PTR_ERR(bllcd->jorn_backlight_device);
> +	}
> +
> +	/* lcd driver */
> +	bllcd->jorn_lcd_device = lcd_device_register(S1D_DEVICENAME,
> +				&pdev->dev, NULL, &jornada_lcd_ops);
> +	if (IS_ERR(bllcd->jorn_lcd_device)) {
> +		kfree(bllcd);
> +		return PTR_ERR(bllcd->jorn_lcd_device);
> +	}

Please go over these error paths carefully, there are several problems
there...

> +	jornada_lcd_set_contrast(bllcd->jorn_lcd_device,
> +			JORNADA_LCD_DEFAULT_CONTRAST);
> +	jornada_lcd_set_power(bllcd->jorn_lcd_device,
> +			FB_BLANK_UNBLANK);
> +
> +	msleep(100);

Why is this msleep needed? If it is needed, how does the driver manage
to suspend/resume?

Richard



  parent reply	other threads:[~2008-02-06 17:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-05 18:53 Kristoffer Ericson
2008-02-06 12:34 ` Roel Kluin
2008-02-06 12:38   ` Roel Kluin
2008-02-06 16:33     ` Kristoffer Ericson
2008-02-06 16:44       ` Russell King - ARM Linux
2008-02-06 19:21         ` Kristoffer Ericson
2008-02-06 19:31           ` Russell King - ARM Linux
2008-02-06 19:43             ` Kristoffer Ericson
2008-02-06 19:45               ` Russell King - ARM Linux
2008-02-07  7:19                 ` Uwe Kleine-König
2008-02-06 19:49             ` Kristoffer Ericson
2008-02-06 17:04       ` Roel Kluin
2008-02-06 17:22       ` Sam Ravnborg
2008-02-06 17:25       ` Richard Purdie [this message]
2008-02-06 16:26   ` Kristoffer Ericson

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=1202318754.8393.24.camel@dax.rpnet.com \
    --to=rpurdie@rpsys.net \
    --cc=12o3l@tiscali.nl \
    --cc=kristoffer.ericson@gmail.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /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

Powered by JetHome