All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com,
	lm-sensors@lm-sensors.org, linux-input@vger.kernel.org,
	linux-watchdog@vger.kernel.org, linux-leds@vger.kernel.org,
	"Samuel Ortiz" <sameo@linux.intel.com>,
	"Liam Girdwood" <lrg@ti.com>,
	"Mark Brown" <broonie@opensource.wolfsonmicro.com>,
	"Alessandro Zummo" <a.zummo@towertech.it>,
	"Jean Delvare" <khali@linux-fr.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Ashish Jangam" <ashish.jangam@kpitcummins.com>,
	"Andrew Jones" <drjones@redhat.com>,
	"Donggeun Kim" <dg77.kim@samsung.com>,
	"Philippe Rétornaz" <philippe.retornaz@epfl.ch>,
	"Wim Van Sebroeck" <wim@iguana.be>,
	"Bryan Wu" <bryan.wu@canonical.com>,
	"Richard Purdie" <rpurdie@rpsys.net>,
	"Anthony Olech" <anthony.olech@diasemi.com>
Subject: Re: [PATCH] regulator: Fix bug in regulator_mode_to_status() core function.
Date: Wed, 29 Aug 2012 14:25:00 +0100	[thread overview]
Message-ID: <201208291425@sw-eng-lt-dc-vm2> (raw)
In-Reply-To: <20120824184505.GA7275@roeck-us.net>

> +static const struct i_table vsys_tbl[] = {
> > +	ILINE(0, DA906X_ADC_MAX, 2500, 5500)
> > +};
> > +
> > +static const struct i_table adcin_tbl[] = {
> > +	ILINE(0, DA906X_ADC_MAX, 0, 2500)
> > +};
> > +
> > +static const struct i_table tjunc_tbl[] = {
> > +	ILINE(0, DA906X_ADC_MAX, 333, -86)
> > +};
> > +
> > +static const struct i_table vbbat_tbl[] = {
> > +	ILINE(0, DA906X_ADC_MAX, 0, 5000)
> > +};
> 
> Since the first parameter to ILINE is always 0, it is not needed. This means
> that x0 in itable is also always 0 and thus not needed.
> 
> > +
> > +static const struct channel_info da906x_channels[] = {
> > +	[DA906X_VSYS]	= { "VSYS",
> > +			    vsys_tbl, ARRAY_SIZE(vsys_tbl) - 1,
> > +			    DA906X_REG_VSYS_RES },
> > +	[DA906X_ADCIN1]	= { "ADCIN1",
> > +			    adcin_tbl,	ARRAY_SIZE(adcin_tbl) - 1,
> > +			    DA906X_REG_ADCIN1_RES },
> > +	[DA906X_ADCIN2]	= { "ADCIN2",
> > +			    adcin_tbl,	ARRAY_SIZE(adcin_tbl) - 1,
> > +			    DA906X_REG_ADCIN2_RES },
> > +	[DA906X_ADCIN3]	= { "ADCIN3",
> > +			    adcin_tbl,	ARRAY_SIZE(adcin_tbl) - 1,
> > +			    DA906X_REG_ADCIN3_RES },
> > +	[DA906X_TJUNC]	= { "TJUNC",
> > +			    tjunc_tbl,	ARRAY_SIZE(tjunc_tbl) - 1 },
> > +	[DA906X_VBBAT]	= { "VBBAT",
> > +			    vbbat_tbl,	ARRAY_SIZE(vbbat_tbl) - 1}
> 
> 	s/1}/1 }/
> 
> > +};
> 
> You lost me here a bit (I am missing something ?).
> 
> Seems to be each table has exactly one entry. Since the table size is 1,
> ARRAY_SIZE(vbbat_tbl) - 1 is 0, and ...

An initial idea was to make the interpolation of the channel values using more
ILINE segments. Eventually, it ended up with one linear segment for every
channel, so it makes sense to reduce the code as you propose.

As suggested, driver name will be changed from "da906x" to "da9063".
I will adapt proposed changes and fixes.

Thank you for your comments,
Krystian


WARNING: multiple messages have this Message-ID (diff)
From: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com,
	lm-sensors@lm-sensors.org, linux-input@vger.kernel.org,
	linux-watchdog@vger.kernel.org, linux-leds@vger.kernel.org,
	"Samuel Ortiz" <sameo@linux.intel.com>,
	"Liam Girdwood" <lrg@ti.com>,
	"Mark Brown" <broonie@opensource.wolfsonmicro.com>,
	"Alessandro Zummo" <a.zummo@towertech.it>,
	"Jean Delvare" <khali@linux-fr.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Ashish Jangam" <ashish.jangam@kpitcummins.com>,
	"Andrew Jones" <drjones@redhat.com>,
	"Donggeun Kim" <dg77.kim@samsung.com>,
	"Philippe Rétornaz" <philippe.retornaz@epfl.ch>,
	"Wim Van Sebroeck" <wim@iguana.be>,
	"Bryan Wu" <bryan.wu@canonical.com>,
	"Richard Purdie" <rpurdie@rpsys.net>,
	"Anthony Olech" <anthony.olech@diasemi.com>
Subject: Re: [lm-sensors] [PATCH] regulator: Fix bug in regulator_mode_to_status() core function.
Date: Wed, 29 Aug 2012 13:25:00 +0000	[thread overview]
Message-ID: <201208291425@sw-eng-lt-dc-vm2> (raw)
In-Reply-To: <20120824184505.GA7275@roeck-us.net>

> +static const struct i_table vsys_tbl[] = {
> > +	ILINE(0, DA906X_ADC_MAX, 2500, 5500)
> > +};
> > +
> > +static const struct i_table adcin_tbl[] = {
> > +	ILINE(0, DA906X_ADC_MAX, 0, 2500)
> > +};
> > +
> > +static const struct i_table tjunc_tbl[] = {
> > +	ILINE(0, DA906X_ADC_MAX, 333, -86)
> > +};
> > +
> > +static const struct i_table vbbat_tbl[] = {
> > +	ILINE(0, DA906X_ADC_MAX, 0, 5000)
> > +};
> 
> Since the first parameter to ILINE is always 0, it is not needed. This means
> that x0 in itable is also always 0 and thus not needed.
> 
> > +
> > +static const struct channel_info da906x_channels[] = {
> > +	[DA906X_VSYS]	= { "VSYS",
> > +			    vsys_tbl, ARRAY_SIZE(vsys_tbl) - 1,
> > +			    DA906X_REG_VSYS_RES },
> > +	[DA906X_ADCIN1]	= { "ADCIN1",
> > +			    adcin_tbl,	ARRAY_SIZE(adcin_tbl) - 1,
> > +			    DA906X_REG_ADCIN1_RES },
> > +	[DA906X_ADCIN2]	= { "ADCIN2",
> > +			    adcin_tbl,	ARRAY_SIZE(adcin_tbl) - 1,
> > +			    DA906X_REG_ADCIN2_RES },
> > +	[DA906X_ADCIN3]	= { "ADCIN3",
> > +			    adcin_tbl,	ARRAY_SIZE(adcin_tbl) - 1,
> > +			    DA906X_REG_ADCIN3_RES },
> > +	[DA906X_TJUNC]	= { "TJUNC",
> > +			    tjunc_tbl,	ARRAY_SIZE(tjunc_tbl) - 1 },
> > +	[DA906X_VBBAT]	= { "VBBAT",
> > +			    vbbat_tbl,	ARRAY_SIZE(vbbat_tbl) - 1}
> 
> 	s/1}/1 }/
> 
> > +};
> 
> You lost me here a bit (I am missing something ?).
> 
> Seems to be each table has exactly one entry. Since the table size is 1,
> ARRAY_SIZE(vbbat_tbl) - 1 is 0, and ...

An initial idea was to make the interpolation of the channel values using more
ILINE segments. Eventually, it ended up with one linear segment for every
channel, so it makes sense to reduce the code as you propose.

As suggested, driver name will be changed from "da906x" to "da9063".
I will adapt proposed changes and fixes.

Thank you for your comments,
Krystian


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  reply	other threads:[~2012-08-29 13:32 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-24 13:45 [RFC PATCH 0/8] DA906x PMIC driver Krystian Garbaciak
2012-08-24 13:45 ` [lm-sensors] " Krystian Garbaciak
2012-08-24 13:50 ` [PATCH 1/8] mfd: Add Dialog DA906x core driver Krystian Garbaciak
2012-08-24 13:50   ` [lm-sensors] " Krystian Garbaciak
2012-08-24 13:55   ` [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support Krystian Garbaciak
2012-08-24 13:55     ` [lm-sensors] " Krystian Garbaciak
2012-08-24 14:00     ` [RFC PATCH 3/8] rtc: Add RTC driver for DA906x PMIC Krystian Garbaciak
2012-08-24 14:00       ` [lm-sensors] " Krystian Garbaciak
2012-08-24 14:05       ` [RFC PATCH 4/8] hwmon: Add DA906x hardware monitoring support Krystian Garbaciak
2012-08-24 14:05         ` [lm-sensors] " Krystian Garbaciak
2012-08-24 14:10         ` [RFC PATCH 5/8] input: Add support for DA906x PMIC OnKey detection Krystian Garbaciak
2012-08-24 14:10           ` [lm-sensors] " Krystian Garbaciak
2012-08-24 14:15           ` [RFC PATCH 6/8] input: Add support for DA906x vibration motor driver Krystian Garbaciak
2012-08-24 14:15             ` [lm-sensors] " Krystian Garbaciak
2012-08-24 14:20             ` [RFC PATCH 7/8] watchdog: Add DA906x PMIC watchdog driver Krystian Garbaciak
2012-08-24 14:20               ` [lm-sensors] " Krystian Garbaciak
2012-08-24 14:25               ` [RFC PATCH 8/8] leds: Add DA906x PMIC LED driver Krystian Garbaciak
2012-08-24 14:25                 ` [lm-sensors] " Krystian Garbaciak
2012-08-24 18:45         ` [RFC PATCH 4/8] hwmon: Add DA906x hardware monitoring support Guenter Roeck
2012-08-24 18:45           ` [lm-sensors] " Guenter Roeck
2012-08-29 13:25           ` Krystian Garbaciak [this message]
2012-08-29 13:25             ` [lm-sensors] [PATCH] regulator: Fix bug in regulator_mode_to_status() core function Krystian Garbaciak
2012-08-25 15:10     ` [RFC PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support Mark Brown
2012-08-25 15:10       ` [lm-sensors] " Mark Brown
2012-08-29 14:50       ` Krystian Garbaciak
2012-08-29 14:50         ` [lm-sensors] " Krystian Garbaciak
2012-08-29 14:50         ` Krystian Garbaciak
2012-08-30 17:47         ` Mark Brown
2012-08-30 17:47           ` [lm-sensors] " Mark Brown
2012-08-31 10:00           ` Krystian Garbaciak
2012-08-31 10:00             ` [lm-sensors] " Krystian Garbaciak
2012-08-31 10:00             ` Krystian Garbaciak
2013-05-09 14:05             ` Guennadi Liakhovetski
2013-05-09 14:18               ` Anthony Olech
2013-05-09 14:28                 ` Guennadi Liakhovetski
2013-05-09 14:42                   ` Anthony Olech
2013-05-09 14:50                     ` Guennadi Liakhovetski
2012-08-25 18:31   ` [PATCH 1/8] mfd: Add Dialog DA906x core driver Mark Brown
2012-08-25 18:31     ` [lm-sensors] " Mark Brown
2012-08-31 11:20     ` Krystian Garbaciak
2012-08-31 11:20       ` [lm-sensors] " Krystian Garbaciak
2012-08-31 11:20       ` Krystian Garbaciak
2012-08-31 11:37       ` Philippe Rétornaz
2012-08-31 11:37         ` [lm-sensors] " Philippe Rétornaz
2012-08-31 11:37         ` Philippe Rétornaz
2012-08-31 11:37         ` Philippe Rétornaz
2012-08-31 17:16       ` Mark Brown
2012-08-31 17:16         ` [lm-sensors] " Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2012-08-24  8:32 [RFC PATCH 0/8] DA906x PMIC driver Krystian Garbaciak
2012-08-24  8:32 ` [lm-sensors] " Krystian Garbaciak
2012-08-24  8:32 ` [PATCH 1/8] mfd: Add Dialog DA906x core driver Krystian Garbaciak
2012-08-24  8:32   ` [lm-sensors] " Krystian Garbaciak
2012-08-24  8:32   ` [PATCH 2/8] regulator: Add Dialog DA906x voltage regulators support Krystian Garbaciak
2012-08-24  8:32     ` [lm-sensors] " Krystian Garbaciak
2012-08-24  8:32     ` [PATCH 3/8] rtc: Add RTC driver for DA906x PMIC Krystian Garbaciak
2012-08-24  8:32       ` [lm-sensors] " Krystian Garbaciak
2012-08-24  8:32       ` [PATCH 4/8] hwmon: Add DA906x hardware monitoring support Krystian Garbaciak
2012-08-24  8:32         ` [lm-sensors] " Krystian Garbaciak
2012-08-24  8:32         ` [PATCH 5/8] input: Add support for DA906x PMIC OnKey detection Krystian Garbaciak
2012-08-24  8:32           ` [lm-sensors] " Krystian Garbaciak
2012-07-11 12:10 [PATCH] regulator: Fix bug in regulator_mode_to_status() core function Krystian Garbaciak
2012-07-11 13:28 ` Mark Brown
2012-07-11 14:18   ` Krystian Garbaciak
2012-07-11 14:26     ` Mark Brown
2012-07-11 15:13     ` Krystian Garbaciak
2012-07-11 17:42       ` Mark Brown

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=201208291425@sw-eng-lt-dc-vm2 \
    --to=krystian.garbaciak@diasemi.com \
    --cc=a.zummo@towertech.it \
    --cc=anthony.olech@diasemi.com \
    --cc=ashish.jangam@kpitcummins.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=bryan.wu@canonical.com \
    --cc=dg77.kim@samsung.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=drjones@redhat.com \
    --cc=khali@linux-fr.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lm-sensors@lm-sensors.org \
    --cc=lrg@ti.com \
    --cc=philippe.retornaz@epfl.ch \
    --cc=rpurdie@rpsys.net \
    --cc=rtc-linux@googlegroups.com \
    --cc=sameo@linux.intel.com \
    --cc=wim@iguana.be \
    /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.