linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shobhit Kumar <shobhit.kumar@intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	linux-pwm@vger.kernel.org
Cc: Daniel Vetter <daniel.vetter@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v5 45/46] drm: i915: switch to the atomic PWM API
Date: Thu, 31 Mar 2016 14:14:54 +0530	[thread overview]
Message-ID: <56FCE386.6060703@intel.com> (raw)
In-Reply-To: <87io03nokg.fsf@intel.com>

On Thursday 31 March 2016 12:04 PM, Jani Nikula wrote:
>
> [aggressively trimmed the recipient list, can't seem to be able to send
> this otherwise]
>
> On Wed, 30 Mar 2016, Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
>> pwm_config/enable/disable() have been deprecated and should be replaced
>> by pwm_apply_state().
>>
>> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
> Cc: Shobhit, any additional comments?

Looks good to me.

Reviewed-by: Shobhit Kumar <shobhit.kumar@intel.com>

>
>> ---
>>   drivers/gpu/drm/i915/intel_panel.c | 39 +++++++++++++++++++++++++-------------
>>   1 file changed, 26 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
>> index 21ee647..b86bd20 100644
>> --- a/drivers/gpu/drm/i915/intel_panel.c
>> +++ b/drivers/gpu/drm/i915/intel_panel.c
>> @@ -538,10 +538,10 @@ static u32 bxt_get_backlight(struct intel_connector *connector)
>>   static u32 pwm_get_backlight(struct intel_connector *connector)
>>   {
>>   	struct intel_panel *panel = &connector->panel;
>> -	int duty_ns;
>> +	struct pwm_state pstate;
>>
>> -	duty_ns = pwm_get_duty_cycle(panel->backlight.pwm);
>> -	return DIV_ROUND_UP(duty_ns * 100, CRC_PMIC_PWM_PERIOD_NS);
>> +	pwm_get_state(panel->backlight.pwm, &pstate);
>> +	return DIV_ROUND_UP(pstate.duty_cycle * 100, CRC_PMIC_PWM_PERIOD_NS);
>>   }
>>
>>   static u32 intel_panel_get_backlight(struct intel_connector *connector)
>> @@ -630,9 +630,12 @@ static void bxt_set_backlight(struct intel_connector *connector, u32 level)
>>   static void pwm_set_backlight(struct intel_connector *connector, u32 level)
>>   {
>>   	struct intel_panel *panel = &connector->panel;
>> -	int duty_ns = DIV_ROUND_UP(level * CRC_PMIC_PWM_PERIOD_NS, 100);
>> +	struct pwm_state pstate;
>>
>> -	pwm_config(panel->backlight.pwm, duty_ns, CRC_PMIC_PWM_PERIOD_NS);
>> +	pwm_get_state(panel->backlight.pwm, &pstate);
>> +	pstate.duty_cycle = DIV_ROUND_UP(level * CRC_PMIC_PWM_PERIOD_NS, 100);
>> +	pstate.period = CRC_PMIC_PWM_PERIOD_NS;
>> +	pwm_apply_state(panel->backlight.pwm, &pstate);
>>   }
>>
>>   static void
>> @@ -801,11 +804,15 @@ static void bxt_disable_backlight(struct intel_connector *connector)
>>   static void pwm_disable_backlight(struct intel_connector *connector)
>>   {
>>   	struct intel_panel *panel = &connector->panel;
>> +	struct pwm_state pstate;
>>
>>   	/* Disable the backlight */
>> -	pwm_config(panel->backlight.pwm, 0, CRC_PMIC_PWM_PERIOD_NS);
>> +	pwm_get_state(panel->backlight.pwm, &pstate);
>> +	pstate.duty_cycle = 0;
>> +	pwm_apply_state(panel->backlight.pwm, &pstate);
>>   	usleep_range(2000, 3000);
>> -	pwm_disable(panel->backlight.pwm);
>> +	pstate.enabled = false;
>> +	pwm_apply_state(panel->backlight.pwm, &pstate);
>>   }
>>
>>   void intel_panel_disable_backlight(struct intel_connector *connector)
>> @@ -1068,8 +1075,11 @@ static void bxt_enable_backlight(struct intel_connector *connector)
>>   static void pwm_enable_backlight(struct intel_connector *connector)
>>   {
>>   	struct intel_panel *panel = &connector->panel;
>> +	struct pwm_state pstate;
>>
>> -	pwm_enable(panel->backlight.pwm);
>> +	pwm_get_state(panel->backlight.pwm, &pstate);
>> +	pstate.enabled = true;
>> +	pwm_apply_state(panel->backlight.pwm, &pstate);
>>   	intel_panel_actually_set_backlight(connector, panel->backlight.level);
>>   }
>>
>> @@ -1630,6 +1640,7 @@ static int pwm_setup_backlight(struct intel_connector *connector,
>>   {
>>   	struct drm_device *dev = connector->base.dev;
>>   	struct intel_panel *panel = &connector->panel;
>> +	struct pwm_state pstate;
>>   	int retval;
>>
>>   	/* Get the PWM chip for backlight control */
>> @@ -1640,8 +1651,10 @@ static int pwm_setup_backlight(struct intel_connector *connector,
>>   		return -ENODEV;
>>   	}
>>
>> -	retval = pwm_config(panel->backlight.pwm, CRC_PMIC_PWM_PERIOD_NS,
>> -			    CRC_PMIC_PWM_PERIOD_NS);
>> +	pwm_get_state(panel->backlight.pwm, &pstate);
>> +	pstate.period = CRC_PMIC_PWM_PERIOD_NS;
>> +	pstate.duty_cycle = CRC_PMIC_PWM_PERIOD_NS;
>> +	retval = pwm_apply_state(panel->backlight.pwm, &pstate);
>>   	if (retval < 0) {
>>   		DRM_ERROR("Failed to configure the pwm chip\n");
>>   		pwm_put(panel->backlight.pwm);
>> @@ -1651,9 +1664,9 @@ static int pwm_setup_backlight(struct intel_connector *connector,
>>
>>   	panel->backlight.min = 0; /* 0% */
>>   	panel->backlight.max = 100; /* 100% */
>> -	panel->backlight.level = DIV_ROUND_UP(
>> -				 pwm_get_duty_cycle(panel->backlight.pwm) * 100,
>> -				 CRC_PMIC_PWM_PERIOD_NS);
>> +	pwm_get_state(panel->backlight.pwm, &pstate);
>> +	panel->backlight.level = DIV_ROUND_UP(pstate.duty_cycle * 100,
>> +					      pstate.period);
>>   	panel->backlight.enabled = panel->backlight.level != 0;
>>
>>   	return 0;
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-03-31  8:44 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30 20:03 [PATCH v5 00/46] pwm: add support for atomic update Boris Brezillon
2016-03-30 20:03 ` [PATCH v5 02/46] backlight: pwm_bl: remove useless call to pwm_set_period() Boris Brezillon
2016-04-12 11:03   ` Thierry Reding
     [not found]     ` <20160412110350.GH18882-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-04-12 14:16       ` Lee Jones
2016-04-12 14:25         ` Thierry Reding
2016-03-30 20:03 ` [PATCH v5 03/46] backlight: lm3630a_bl: stop messing with the pwm->period field Boris Brezillon
2016-04-12 11:08   ` Thierry Reding
2016-04-12 14:16     ` Lee Jones
2016-04-12 14:26       ` Thierry Reding
2016-04-13  8:25         ` Lee Jones
2016-04-13  8:26           ` Lee Jones
2016-03-30 20:03 ` [PATCH v5 08/46] hwmon: pwm-fan: use pwm_get_args() where appropriate Boris Brezillon
2016-03-30 22:52   ` Guenter Roeck
2016-03-31  7:07     ` Boris Brezillon
2016-04-04 15:20       ` Thierry Reding
2016-04-01  8:29   ` Kamil Debski
2016-03-30 20:03 ` [PATCH v5 12/46] fbdev: ssd1307fb: " Boris Brezillon
     [not found] ` <1459368249-13241-1-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-03-30 20:03   ` [PATCH v5 01/46] pwm: rcar: make use of pwm_is_enabled() Boris Brezillon
2016-04-12 11:01     ` Thierry Reding
     [not found]       ` <20160412110152.GG18882-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-04-14 11:05         ` Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 04/46] pwm: get rid of pwm->lock Boris Brezillon
     [not found]     ` <1459368249-13241-5-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-04-12 11:22       ` Thierry Reding
     [not found]         ` <20160412112246.GJ18882-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-04-12 11:32           ` Boris Brezillon
2016-04-12 11:46             ` Thierry Reding
2016-03-30 20:03   ` [PATCH v5 05/46] pwm: introduce the pwm_args concept Boris Brezillon
     [not found]     ` <1459368249-13241-6-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-03-30 21:55       ` Stephen Boyd
     [not found]         ` <20160330215510.GS18567-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-03-31  7:09           ` Boris Brezillon
2016-03-31  7:57         ` Boris Brezillon
2016-04-12 11:39       ` Thierry Reding
     [not found]         ` <20160412113912.GK18882-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-04-12 12:04           ` Boris Brezillon
2016-04-12 12:20             ` Thierry Reding
     [not found]               ` <20160412122029.GO18882-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-04-12 12:55                 ` Boris Brezillon
2016-04-12 13:06           ` Boris Brezillon
2016-04-12 13:15             ` Thierry Reding
2016-03-30 20:03   ` [PATCH v5 06/46] pwm: use pwm_get/set_xxx() helpers where appropriate Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 07/46] clk: pwm: use pwm_get_args() " Boris Brezillon
     [not found]     ` <1459368249-13241-8-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-03-30 21:58       ` Stephen Boyd
2016-03-30 20:03   ` [PATCH v5 09/46] misc: max77693-haptic: " Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 10/46] leds: pwm: " Boris Brezillon
2016-03-31  7:13     ` Jacek Anaszewski
2016-03-30 20:03   ` [PATCH v5 11/46] regulator: " Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 13/46] backlight: pwm_bl: " Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 14/46] pwm: keep PWM state in sync with hardware state Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 15/46] pwm: introduce the pwm_state concept Boris Brezillon
2016-04-12 11:49     ` Thierry Reding
2016-04-12 12:17       ` Boris Brezillon
2016-04-12 12:21         ` Thierry Reding
2016-04-12 12:45           ` Boris Brezillon
2016-04-12 13:11             ` Thierry Reding
     [not found]               ` <20160412131118.GQ18882-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-04-12 13:26                 ` Boris Brezillon
2016-04-12 14:05                   ` Thierry Reding
2016-04-12 14:13                     ` Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 16/46] pwm: move the enabled/disabled info into pwm_state Boris Brezillon
     [not found]     ` <1459368249-13241-17-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-04-12 11:51       ` Thierry Reding
2016-03-30 20:03   ` [PATCH v5 17/46] pwm: add the PWM initial state retrieval infra Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 18/46] pwm: add the core infrastructure to allow atomic update Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 19/46] pwm: switch to the atomic API Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 20/46] pwm: add information about polarity, duty cycle and period to debugfs Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 21/46] pwm: rockchip: add initial state retrieval Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 22/46] pwm: rockchip: avoid glitches on already running PWMs Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 23/46] pwm: rockchip: add support for atomic update Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 24/46] pwm: sti: add support for initial state retrieval Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 25/46] pwm: sti: avoid glitches on already running PWMs Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 26/46] pwm: sun4i: implement hardware readout Boris Brezillon
     [not found]     ` <1459368249-13241-27-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-03-31  8:00       ` Alexandre Belloni
2016-03-30 20:03   ` [PATCH v5 27/46] regulator: pwm: adjust PWM config at probe time Boris Brezillon
     [not found]     ` <1459368249-13241-28-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-03-30 21:22       ` Mark Brown
2016-03-30 20:03   ` [PATCH v5 28/46] regulator: pwm: swith to the atomic PWM API Boris Brezillon
     [not found]     ` <1459368249-13241-29-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-03-30 21:23       ` Mark Brown
2016-03-30 20:03   ` [PATCH v5 29/46] regulator: pwm: properly initialize the ->state field Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 30/46] regulator: pwm: retrieve correct voltage Boris Brezillon
     [not found]     ` <1459368249-13241-31-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-03-30 21:24       ` Mark Brown
     [not found]         ` <20160330212410.GX2350-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-04-07 21:54           ` Boris Brezillon
2016-04-12  4:42             ` Mark Brown
     [not found]               ` <20160412044203.GW3351-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-04-12  8:37                 ` Boris Brezillon
2016-04-12 10:09                   ` Mark Brown
     [not found]                     ` <20160412100938.GA14664-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-04-12 10:31                       ` Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 31/46] pwm: update documentation Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 32/46] pwm: deprecate pwm_config(), pwm_enable() and pwm_disable() Boris Brezillon
2016-03-31 17:38     ` Dmitry Torokhov
2016-03-31 18:54       ` Boris Brezillon
2016-04-04 15:22         ` Thierry Reding
2016-03-30 20:03   ` [PATCH v5 33/46] pwm: replace pwm_disable() by pwm_apply_state() Boris Brezillon
2016-03-30 20:03   ` [PATCH v5 34/46] clk: pwm: switch to the atomic API Boris Brezillon
2016-03-30 22:01     ` Stephen Boyd
     [not found]       ` <20160330220149.GU18567-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-03-31  6:57         ` Boris Brezillon
2016-04-04 15:30           ` Thierry Reding
2016-03-30 20:03   ` [PATCH v5 35/46] hwmon: pwm-fan: " Boris Brezillon
2016-04-01  8:29     ` Kamil Debski
2016-03-30 20:03   ` [PATCH v5 36/46] input: misc: max77693: " Boris Brezillon
2016-03-31 17:48     ` Dmitry Torokhov
2016-03-31 18:57       ` Boris Brezillon
2016-04-04 15:34         ` Thierry Reding
2016-03-30 20:04   ` [PATCH v5 37/46] input: misc: max8997: switch to the atomic PWM API Boris Brezillon
2016-03-30 20:04   ` [PATCH v5 38/46] input: misc: pwm-beeper: " Boris Brezillon
2016-03-30 20:04   ` [PATCH v5 39/46] leds: pwm: " Boris Brezillon
2016-03-30 20:04   ` [PATCH v5 40/46] backlight: lm3630a: " Boris Brezillon
2016-03-30 20:04   ` [PATCH v5 42/46] backlight: lp8788: " Boris Brezillon
2016-03-30 20:04   ` [PATCH v5 43/46] backlight: pwm_bl: " Boris Brezillon
2016-03-30 20:04   ` [PATCH v5 44/46] video: ssd1307fb: " Boris Brezillon
2016-03-30 20:04   ` [PATCH v5 45/46] drm: i915: " Boris Brezillon
2016-03-31  6:34     ` Jani Nikula
2016-03-31  8:44       ` Shobhit Kumar [this message]
2016-03-30 20:04   ` [PATCH v5 46/46] ARM: s3c24xx: rx1950: " Boris Brezillon
2016-03-30 20:18   ` [PATCH v5 00/46] pwm: add support for atomic update Boris Brezillon
2016-04-11 22:42   ` Boris Brezillon
2016-03-30 20:04 ` [PATCH v5 41/46] backlight: lp855x: switch to the atomic PWM API Boris Brezillon

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=56FCE386.6060703@intel.com \
    --to=shobhit.kumar@intel.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.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).