From: Matthias Kaehlcke <matthias@kaehlcke.net>
To: "AnilKumar, Chimata" <anilkumar@ti.com>
Cc: Richard Purdie <rpurdie@rpsys.net>,
Samuel Ortiz <sameo@linux.intel.com>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH] backlight: Add TPS65217 WLED driver
Date: Wed, 8 Aug 2012 22:29:17 +0200 [thread overview]
Message-ID: <20120808202917.GC30282@darwin> (raw)
In-Reply-To: <331ABD5ECB02734CA317220B2BBEABC13EA0E4D1@DBDE01.ent.ti.com>
Hi AnilKumar,
El Wed, Aug 08, 2012 at 09:25:29AM +0000 AnilKumar, Chimata ha dit:
> Cross check with mfd/master also.
ok
> > > > + if (!of_property_read_u32(np, "fdim", &val)) {
> > > > + if (val == 100) {
> > > > + pdata->bl_pdata->fdim = TPS65217_BL_FDIM_100HZ;
> > > > + } else if (val == 200) {
> > > > + pdata->bl_pdata->fdim = TPS65217_BL_FDIM_200HZ;
> > > > + } else if (val == 500) {
> > > > + pdata->bl_pdata->fdim = TPS65217_BL_FDIM_500HZ;
> > > > + } else if (val == 1000) {
> > > > + pdata->bl_pdata->fdim = TPS65217_BL_FDIM_1000HZ;
> > > > + } else {
> > > > + dev_err(&client->dev, "invalid value for backlight dimming frequency in the device tree\n");
> > > > + return NULL;
> > > > + }
> > > > + } else {
> > > > + pdata->bl_pdata->fdim = TPS65217_BL_FDIM_200HZ;
> > > > + }
> > > > + }
> > > > + }
> > >
> > > Same here.
> >
> > not exactly, the value specified in the device tree for the dimming
> > frequency will be a frequency, not a value corresponding to the enum,
> > so a range check + assignment isn't enough. if you'd like to see a
> > similar handling an option would be to set TPS65217_BL_FDIM_100HZ to
> > 100, TPS..._200HZ to 200, ..., and do:
> >
> > switch (val) {
> > case TPS65217_BL_FDIM_100HZ:
> > case TPS65217_BL_FDIM_200HZ:
> > ...
> > pdata->bl_pdata->fdim = val;
> > break;
> >
> > default:
> > /* error handling */
> > }
> >
>
> This looks better.
taking a closer look i noticed that unfortunately it won't work that
way, as the constants TPS65217_BL_FDIM_*HZ are the values which are
written to the WLEDCTRL1 registers
so the outcome will be:
switch (val) {
case 100:
pdata->bl_pdata->fdim = TPS65217_BL_FDIM_100HZ;
break;
case 200:
...
default:
/* error handling */
}
or the initial solution, which is slightly shorter, but i
think you prefer the switch construct
regards
--
Matthias Kaehlcke
Embedded Linux Developer
Amsterdam
Programming is not just an act of telling a computer what to do:
it is also an act of telling other programmers what you wished the
computer to do. Both are important, and the latter deserves care
(Andrew Morton)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
prev parent reply other threads:[~2012-08-08 20:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 19:48 [PATCH] backlight: Add TPS65217 WLED driver Matthias Kaehlcke
2012-08-07 8:59 ` AnilKumar, Chimata
2012-08-07 20:43 ` Matthias Kaehlcke
2012-08-08 9:25 ` AnilKumar, Chimata
2012-08-08 20:29 ` Matthias Kaehlcke [this message]
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=20120808202917.GC30282@darwin \
--to=matthias@kaehlcke.net \
--cc=anilkumar@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=rpurdie@rpsys.net \
--cc=sameo@linux.intel.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 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.