From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Thierry Reding" <thierry.reding@gmail.com>,
"Daniel Vetter" <daniel.vetter@intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: linux-pwm@vger.kernel.org,
intel-gfx <intel-gfx@lists.freedesktop.org>,
dri-devel@lists.freedesktop.org,
Hans de Goede <hdegoede@redhat.com>
Subject: Re: [PATCH 1/2] pwm: lpss: Make builtin and add lookup-table so that i915 can find the pwm_backlight
Date: Fri, 02 Dec 2016 12:55:57 +0200 [thread overview]
Message-ID: <87inr2zjk2.fsf@intel.com> (raw)
In-Reply-To: <20161202101736.12236-1-hdegoede@redhat.com>
On Fri, 02 Dec 2016, Hans de Goede <hdegoede@redhat.com> wrote:
> The primary consumer of the lpss pwm is the i915 kms driver, but
> currently that driver cannot get the pwm because i915 platforms are
> not using devicetree and pwm-lpss does not call pwm_add_table.
>
> Another problem is that i915 does not support get_pwm returning
> -EPROBE_DEFER and i915's init is very complex and this is almost
> impossible to fix.
>
> This commit changes the PWM_LPSS Kconfig from a tristate to a bool, so
> that when the i915 driver loads the lpss pwm will be available avoiding
> the -EPROBE_DEFER issue. Note that this is identical to how the same
> problem was solved for the pwm-crc driver.
Arguably this solution was worse for pwm-crc than pwm-lpss here, because
bool CONFIG_PWM_CRC depends on INTEL_SOC_PMIC which depends on I2C being
built-in. This one doesn't have all that bad dependencies.
FWIW, both patches are
Acked-by: Jani Nikula <jani.nikula@intel.com>
>
> Being builtin also allows calling pwm_add_table directly from the
> pwm-lpss code, otherwise the pwm_add_table call would need to be put
> somewhere else to ensure it happens before i915 calls pwm_get,
> even if i915 would support -EPROBE_DEFER.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/pwm/Kconfig | 12 +++---------
> drivers/pwm/pwm-lpss.c | 11 +++++++++++
> 2 files changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> index bf01288..cda31ea 100644
> --- a/drivers/pwm/Kconfig
> +++ b/drivers/pwm/Kconfig
> @@ -240,28 +240,22 @@ config PWM_LPC32XX
> will be called pwm-lpc32xx.
>
> config PWM_LPSS
> - tristate
> + bool
>
> config PWM_LPSS_PCI
> - tristate "Intel LPSS PWM PCI driver"
> + bool "Intel LPSS PWM PCI driver"
> depends on X86 && PCI
> select PWM_LPSS
> help
> The PCI driver for Intel Low Power Subsystem PWM controller.
>
> - To compile this driver as a module, choose M here: the module
> - will be called pwm-lpss-pci.
> -
> config PWM_LPSS_PLATFORM
> - tristate "Intel LPSS PWM platform driver"
> + bool "Intel LPSS PWM platform driver"
> depends on X86 && ACPI
> select PWM_LPSS
> help
> The platform driver for Intel Low Power Subsystem PWM controller.
>
> - To compile this driver as a module, choose M here: the module
> - will be called pwm-lpss-platform.
> -
> config PWM_MESON
> tristate "Amlogic Meson PWM driver"
> depends on ARCH_MESON
> diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c
> index 72c0bce..b4d8835 100644
> --- a/drivers/pwm/pwm-lpss.c
> +++ b/drivers/pwm/pwm-lpss.c
> @@ -161,6 +161,12 @@ static const struct pwm_ops pwm_lpss_ops = {
> .owner = THIS_MODULE,
> };
>
> +/* PWM consumed by the Intel GFX */
> +static struct pwm_lookup pwm_lpss_lookup[] = {
> + PWM_LOOKUP("pwm-lpss", 0, "0000:00:02.0", "pwm_backlight", 0,
> + PWM_POLARITY_NORMAL),
> +};
> +
> struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r,
> const struct pwm_lpss_boardinfo *info)
> {
> @@ -193,12 +199,17 @@ struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r,
> return ERR_PTR(ret);
> }
>
> + /* Add lookup table for pwm_backlight */
> + pwm_lpss_lookup[0].provider = dev_name(dev);
> + pwm_add_table(pwm_lpss_lookup, ARRAY_SIZE(pwm_lpss_lookup));
> +
> return lpwm;
> }
> EXPORT_SYMBOL_GPL(pwm_lpss_probe);
>
> int pwm_lpss_remove(struct pwm_lpss_chip *lpwm)
> {
> + pwm_remove_table(pwm_lpss_lookup, ARRAY_SIZE(pwm_lpss_lookup));
> return pwmchip_remove(&lpwm->chip);
> }
> EXPORT_SYMBOL_GPL(pwm_lpss_remove);
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-12-02 10:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-02 10:17 [PATCH 1/2] pwm: lpss: Make builtin and add lookup-table so that i915 can find the pwm_backlight Hans de Goede
2016-12-02 10:17 ` [PATCH 2/2] pwm: lpss: Add get_state callback Hans de Goede
2016-12-05 7:36 ` Thierry Reding
2016-12-02 10:55 ` Jani Nikula [this message]
2016-12-05 7:46 ` [PATCH 1/2] pwm: lpss: Make builtin and add lookup-table so that i915 can find the pwm_backlight Thierry Reding
2016-12-05 8:18 ` Hans de Goede
2016-12-05 10:59 ` Thierry Reding
2016-12-05 13:23 ` Hans de Goede
2016-12-12 11:54 ` Hans de Goede
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=87inr2zjk2.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hdegoede@redhat.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=ville.syrjala@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox