From: Thierry Reding <thierry.reding@gmail.com>
To: Shobhit Kumar <shobhit.kumar@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>,
Daniel Vetter <daniel.vetter@intel.com>,
intel-gfx <intel-gfx@lists.freedesktop.org>,
dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [RFC v3 3/4] drm/i915: Add new panel driver based on crystal cove pmic
Date: Tue, 3 Feb 2015 14:16:53 +0100 [thread overview]
Message-ID: <20150203131651.GG15068@ulmo.nvidia.com> (raw)
In-Reply-To: <1421839093-7635-4-git-send-email-shobhit.kumar@intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 4672 bytes --]
On Wed, Jan 21, 2015 at 04:48:12PM +0530, Shobhit Kumar wrote:
> This driver provides support for the "crystal_cove_panel" cell device.
> On BYT-T pmic has to be used to enable/disable panel.
>
> v2: Addressed Jani's comments
> - Moved inside i915
> - Correct licensing
> - Remove unused stuff
> - Do not initialize prepare/unprepare as they are not needed as of now
> - Correct backlight off delay
>
> Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
> ---
> drivers/gpu/drm/i915/Kconfig | 12 ++
> drivers/gpu/drm/i915/Makefile | 3 +
> drivers/gpu/drm/i915/intel-panel-crystalcove.c | 159 +++++++++++++++++++++++++
> 3 files changed, 174 insertions(+)
> create mode 100644 drivers/gpu/drm/i915/intel-panel-crystalcove.c
>
> diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
> index 4e39ab3..0510ef0 100644
> --- a/drivers/gpu/drm/i915/Kconfig
> +++ b/drivers/gpu/drm/i915/Kconfig
> @@ -69,3 +69,15 @@ config DRM_I915_PRELIMINARY_HW_SUPPORT
> option changes the default for that module option.
>
> If in doubt, say "N".
> +
> +config DRM_I915_PANEL_CRYSTALCOVE_PMIC
> + bool "Enable drm panel for crystal cove pmic based control"
> + depends on DRM_I915
> + depends on DRM_PANEL
> + default n
n is the default default.
> diff --git a/drivers/gpu/drm/i915/intel-panel-crystalcove.c b/drivers/gpu/drm/i915/intel-panel-crystalcove.c
[...]
> +#define PMIC_PANEL_EN 0x52
> +#define PMIC_PWM_EN 0x51
> +#define PMIC_BKL_EN 0x4B
> +#define PMIC_PWM_LEVEL 0x4E
These look like they should be GPIOs/regulators and a PWM instead. So I
think you'd need to further split up the MFD device to accomodate for
this.
> +static inline struct crystalcove_panel *to_crystalcove_panel(struct drm_panel *panel)
Please wrap this so it doesn't cross the 80-character boundary.
> +static int crystalcove_panel_disable(struct drm_panel *panel)
> +{
> + struct crystalcove_panel *p = to_crystalcove_panel(panel);
> +
> + if (!p->enabled)
> + return 0;
> +
> + DRM_DEBUG_KMS("\n");
> +
> + /* invoke the pmic driver */
> + regmap_write(p->regmap, PMIC_PANEL_EN, 0x00);
A datasheet would be really good to determine whether this is the
correct place to write this. There are ->prepare() and ->unprepare()
callbacks that get the panel into a state where you can communicate
with it. This being a DSI panel I would assume that you need to enable
the panel to some degree so you can send DSI commands. So most likely
this enable "GPIO" should be set in ->unprepare().
> +static int crystalcove_panel_enable(struct drm_panel *panel)
> +{
> + struct crystalcove_panel *p = to_crystalcove_panel(panel);
> +
> + if (p->enabled)
> + return 0;
> +
> + DRM_DEBUG_KMS("\n");
> +
> + /* invoke the pmic driver */
> + regmap_write(p->regmap, PMIC_PANEL_EN, 0x01);
Similarly I'd expect this to go into ->prepare() to make sure that you
can communicate with the panel after ->prepare().
> + /* Enable BKL as well */
> + regmap_write(p->regmap, PMIC_BKL_EN, 0xFF);
Writing 0xff to an "enable" register seems weird. Again the datasheet
would help in determining the right thing to do here.
> + regmap_write(p->regmap, PMIC_PWM_EN, 0x01);
> + msleep(20);
> + regmap_write(p->regmap, PMIC_PWM_LEVEL, 255);
This definitely looks like it should be a PWM driver. Also how do you
handle backlight brightness control? You only set things to either full
off or full on in this driver.
> +
> + drm_panel_init(&panel->base);
> + panel->base.dev = dev;
> + panel->base.funcs = &crystalcove_panel_funcs;
> +
> + drm_panel_add(&panel->base);
This function can theoretically fail, although it doesn't (at present),
so checking the error might be a good idea.
> +static int crystalcove_panel_remove(struct platform_device *pdev)
> +{
> + struct crystalcove_panel *panel = platform_get_drvdata(pdev);
> +
> + DRM_DEBUG_KMS("\n");
> +
> + drm_panel_detach(&panel->base);
> + drm_panel_remove(&panel->base);
> +
> + crystalcove_panel_disable(&panel->base);
> +
> + return 0;
> +}
> +
> +static struct platform_driver crystalcove_panel_driver = {
> + .probe = crystalcove_panel_probe,
> + .remove = crystalcove_panel_remove,
> + .driver = {
> + .name = "crystal_cove_panel",
> + },
> +};
> +
> +module_platform_driver(crystalcove_panel_driver);
What's also weird here is that you claim this to be a DSI panel, yet you
use a platform driver. The right thing to do would be to instantiate the
device as mipi_dsi_device, with the DSI controller being the parent.
Thierry
[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-02-03 13:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-21 11:18 [RFC v3 0/4] Crystal Cove PMIC based Panel and Backlight Control Shobhit Kumar
2015-01-21 11:18 ` [RFC v3 1/4] drm: Add support to find drm_panel by name Shobhit Kumar
2015-02-03 13:00 ` Thierry Reding
2015-02-04 11:14 ` [PATCH] " Shobhit Kumar
2015-02-04 14:01 ` shuang.he
2015-01-21 11:18 ` [RFC v3 2/4] mfd: Add a new cell device for panel controlled by crystal cove pmic Shobhit Kumar
2015-02-03 13:05 ` Thierry Reding
2015-02-04 5:59 ` Shobhit Kumar
2015-01-21 11:18 ` [RFC v3 3/4] drm/i915: Add new panel driver based on " Shobhit Kumar
2015-02-03 13:16 ` Thierry Reding [this message]
2015-02-04 6:55 ` Shobhit Kumar
2015-02-05 9:46 ` [Intel-gfx] " Daniel Vetter
2015-01-21 11:18 ` [RFC v3 4/4] drm/i915: Enable DSI panel enable/disable based on PMIC Shobhit Kumar
-- strict thread matches above, loose matches on Subject: below --
2015-01-27 9:31 [RFC v3 0/4] Crystal Cove PMIC based Panel and Backlight Control Shobhit Kumar
2015-01-27 9:31 ` [RFC v3 3/4] drm/i915: Add new panel driver based on crystal cove pmic Shobhit Kumar
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=20150203131651.GG15068@ulmo.nvidia.com \
--to=thierry.reding@gmail.com \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=shobhit.kumar@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