All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: 'Leela Krishna Amudala' <l.krishna@samsung.com>
Cc: devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org, kgene.kim@samsung.com,
	jg1.han@samsung.com, joshi@samsung.com,
	grant.likely@secretlab.ca, linux-samsung-soc@vger.kernel.org,
	thomas.ab@samsung.com, olofj@google.com
Subject: RE: [PATCH V2 3/7] ARM: EXYNOS5: add machine specific support for LCD
Date: Fri, 20 Jul 2012 08:31:32 +0200	[thread overview]
Message-ID: <018c01cd6641$5182dad0$f4889070$%szyprowski@samsung.com> (raw)
In-Reply-To: <CAL1wa8c1Ty2xz7qsTWixTqvmHc1LC+nEahd7wUgQEHWUPHY9UQ@mail.gmail.com>

Hello,

On Thursday, July 19, 2012 3:22 PM Leela Krishna Amudala wrote:

> Hello Marek,
> 
> On Wed, Jul 18, 2012 at 12:15 PM, Marek Szyprowski
> <m.szyprowski@samsung.com> wrote:
> > Hello,
> >
> > On Wednesday, July 18, 2012 7:57 AM Leela Krishna Amudala wrote:
> >
> >> This patch adds machine specific support for LCD controller like setting power to LCD
> >> and adding LCD platform device.
> >>
> >> Signed-off-by: Prathyush K <prathyush.k@samsung.com>
> >> Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
> >> ---
> >>  arch/arm/mach-exynos/mach-exynos5-dt.c |   56 ++++++++++++++++++++++++++++++++
> >>  1 files changed, 56 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-
> dt.c
> >> index e7113cc..02a0e68 100644
> >> --- a/arch/arm/mach-exynos/mach-exynos5-dt.c
> >> +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
> >> @@ -13,6 +13,7 @@
> >>  #include <linux/serial_core.h>
> >>  #include <linux/pwm_backlight.h>
> >>  #include <linux/gpio.h>
> >> +#include <linux/delay.h>
> >>
> >>  #include <asm/mach/arch.h>
> >>  #include <asm/hardware/gic.h>
> >> @@ -24,6 +25,7 @@
> >>  #include <plat/gpio-cfg.h>
> >>
> >>  #include "common.h"
> >> +#include <video/platform_lcd.h>
> >>
> >>  static int smdk5250_bl_notify(struct device *unused, int brightness)
> >>  {
> >> @@ -47,6 +49,55 @@ static struct platform_pwm_backlight_data smdk5250_bl_data = {
> >>       .notify         = smdk5250_bl_notify,
> >>  };
> >>
> >> +static void lcd_set_power(struct plat_lcd_data *pd,
> >> +                     unsigned int power)
> >> +{
> >> +
> >> +     /* reset */
> >> +     gpio_request_one(EXYNOS5_GPX1(5), GPIOF_OUT_INIT_HIGH, "GPX1");
> >> +
> >> +     mdelay(20);
> >> +     if (power) {
> >> +             /* fire nRESET on power up */
> >> +             gpio_set_value(EXYNOS5_GPX1(5), 0);
> >> +             mdelay(20);
> >> +             gpio_set_value(EXYNOS5_GPX1(5), 1);
> >> +             mdelay(20);
> >> +             gpio_free(EXYNOS5_GPX1(5));
> >> +     } else {
> >> +             /* fire nRESET on power off */
> >> +             gpio_set_value(EXYNOS5_GPX1(5), 0);
> >> +             mdelay(20);
> >> +             gpio_set_value(EXYNOS5_GPX1(5), 1);
> >> +             mdelay(20);
> >> +             gpio_free(EXYNOS5_GPX1(5));
> >> +     }
> >> +     mdelay(20);
> >> +
> >> +     /*
> >> +      * Request lcd_bl_en GPIO for smdk5250_bl_notify().
> >> +      * TODO: Fix this so we are not at risk of requesting the GPIO
> >> +      * multiple times, this should be done with device tree, and
> >> +      * likely integrated into the plat-samsung/dev-backlight.c init.
> >> +      */
> >> +     gpio_request_one(EXYNOS5_GPX3(0), GPIOF_OUT_INIT_LOW, "GPX3");
> >> +}
> >> +
> >> +static int smdk5250_match_fb(struct plat_lcd_data *pd, struct fb_info *info)
> >> +{
> >> +     /* Don't call .set_power callback while unblanking */
> >> +     return 0;
> >> +}
> >> +
> >> +static struct plat_lcd_data smdk5250_lcd_data = {
> >> +     .set_power      = lcd_set_power,
> >> +     .match_fb       = smdk5250_match_fb,
> >> +};
> >> +
> >> +static struct platform_device smdk5250_lcd = {
> >> +     .name                   = "platform-lcd",
> >> +     .dev.platform_data      = &smdk5250_lcd_data,
> >> +};
> >>  /*
> >>   * The following lookup table is used to override device names when devices
> >>   * are registered from device tree. This is temporarily added to enable
> >> @@ -85,6 +136,10 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[]
> __initconst
> >> = {
> >>       {},
> >>  };
> >>
> >> +static struct platform_device *smdk5250_devices[] __initdata = {
> >> +     &smdk5250_lcd, /* for platform_lcd device */
> >> +};
> >> +
> >>  static void __init exynos5250_dt_map_io(void)
> >>  {
> >>       exynos_init_io(NULL, 0);
> >> @@ -96,6 +151,7 @@ static void __init exynos5250_dt_machine_init(void)
> >>       samsung_bl_set(&smdk5250_bl_gpio_info, &smdk5250_bl_data);
> >>       of_platform_populate(NULL, of_default_bus_match_table,
> >>                               exynos5250_auxdata_lookup, NULL);
> >> +     platform_add_devices(smdk5250_devices, ARRAY_SIZE(smdk5250_devices));
> >>  }
> >>
> >>  static char const *exynos5250_dt_compat[] __initdata = {
> >
> > Sorry, but this patch looks completely weird to me. exynos5-dt machine is aimed to
> > operate on ANY Exynos5 based board with proper device tree bindings, not only SMDK5250.
> > Please add DT support to platform lcd driver and create required bindings for it
> > instead of hardcoding the platform data and gpio numbers in mach-exynos5-dt.c
> >
> 
> Yes true, that GPIO numbers will vary for boards.
> Can you please confirm that platform lcd driver means the core
> "drivers/video/backlight/platform_lcd.c" file.

Yes, by lcd driver I meant that driver.

> But platform lcd driver is used by other(non samsung) platforms also.
> So, If I add the DT suppot to that file, I have to test the changes on
> other platforms also.
> Can you please kindly suggest me some other way to overcome this situation.

Just check that you don't break existing code. For some examples please refer to the DT
changes in drivers/input/keyboard/gpio_keys.c (see commit fd05d08920). You can also check
if the driver works fine after your changes by setting it up from platform data instead of
DT.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

WARNING: multiple messages have this Message-ID (diff)
From: m.szyprowski@samsung.com (Marek Szyprowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 3/7] ARM: EXYNOS5: add machine specific support for LCD
Date: Fri, 20 Jul 2012 08:31:32 +0200	[thread overview]
Message-ID: <018c01cd6641$5182dad0$f4889070$%szyprowski@samsung.com> (raw)
In-Reply-To: <CAL1wa8c1Ty2xz7qsTWixTqvmHc1LC+nEahd7wUgQEHWUPHY9UQ@mail.gmail.com>

Hello,

On Thursday, July 19, 2012 3:22 PM Leela Krishna Amudala wrote:

> Hello Marek,
> 
> On Wed, Jul 18, 2012 at 12:15 PM, Marek Szyprowski
> <m.szyprowski@samsung.com> wrote:
> > Hello,
> >
> > On Wednesday, July 18, 2012 7:57 AM Leela Krishna Amudala wrote:
> >
> >> This patch adds machine specific support for LCD controller like setting power to LCD
> >> and adding LCD platform device.
> >>
> >> Signed-off-by: Prathyush K <prathyush.k@samsung.com>
> >> Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
> >> ---
> >>  arch/arm/mach-exynos/mach-exynos5-dt.c |   56 ++++++++++++++++++++++++++++++++
> >>  1 files changed, 56 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-
> dt.c
> >> index e7113cc..02a0e68 100644
> >> --- a/arch/arm/mach-exynos/mach-exynos5-dt.c
> >> +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
> >> @@ -13,6 +13,7 @@
> >>  #include <linux/serial_core.h>
> >>  #include <linux/pwm_backlight.h>
> >>  #include <linux/gpio.h>
> >> +#include <linux/delay.h>
> >>
> >>  #include <asm/mach/arch.h>
> >>  #include <asm/hardware/gic.h>
> >> @@ -24,6 +25,7 @@
> >>  #include <plat/gpio-cfg.h>
> >>
> >>  #include "common.h"
> >> +#include <video/platform_lcd.h>
> >>
> >>  static int smdk5250_bl_notify(struct device *unused, int brightness)
> >>  {
> >> @@ -47,6 +49,55 @@ static struct platform_pwm_backlight_data smdk5250_bl_data = {
> >>       .notify         = smdk5250_bl_notify,
> >>  };
> >>
> >> +static void lcd_set_power(struct plat_lcd_data *pd,
> >> +                     unsigned int power)
> >> +{
> >> +
> >> +     /* reset */
> >> +     gpio_request_one(EXYNOS5_GPX1(5), GPIOF_OUT_INIT_HIGH, "GPX1");
> >> +
> >> +     mdelay(20);
> >> +     if (power) {
> >> +             /* fire nRESET on power up */
> >> +             gpio_set_value(EXYNOS5_GPX1(5), 0);
> >> +             mdelay(20);
> >> +             gpio_set_value(EXYNOS5_GPX1(5), 1);
> >> +             mdelay(20);
> >> +             gpio_free(EXYNOS5_GPX1(5));
> >> +     } else {
> >> +             /* fire nRESET on power off */
> >> +             gpio_set_value(EXYNOS5_GPX1(5), 0);
> >> +             mdelay(20);
> >> +             gpio_set_value(EXYNOS5_GPX1(5), 1);
> >> +             mdelay(20);
> >> +             gpio_free(EXYNOS5_GPX1(5));
> >> +     }
> >> +     mdelay(20);
> >> +
> >> +     /*
> >> +      * Request lcd_bl_en GPIO for smdk5250_bl_notify().
> >> +      * TODO: Fix this so we are not at risk of requesting the GPIO
> >> +      * multiple times, this should be done with device tree, and
> >> +      * likely integrated into the plat-samsung/dev-backlight.c init.
> >> +      */
> >> +     gpio_request_one(EXYNOS5_GPX3(0), GPIOF_OUT_INIT_LOW, "GPX3");
> >> +}
> >> +
> >> +static int smdk5250_match_fb(struct plat_lcd_data *pd, struct fb_info *info)
> >> +{
> >> +     /* Don't call .set_power callback while unblanking */
> >> +     return 0;
> >> +}
> >> +
> >> +static struct plat_lcd_data smdk5250_lcd_data = {
> >> +     .set_power      = lcd_set_power,
> >> +     .match_fb       = smdk5250_match_fb,
> >> +};
> >> +
> >> +static struct platform_device smdk5250_lcd = {
> >> +     .name                   = "platform-lcd",
> >> +     .dev.platform_data      = &smdk5250_lcd_data,
> >> +};
> >>  /*
> >>   * The following lookup table is used to override device names when devices
> >>   * are registered from device tree. This is temporarily added to enable
> >> @@ -85,6 +136,10 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[]
> __initconst
> >> = {
> >>       {},
> >>  };
> >>
> >> +static struct platform_device *smdk5250_devices[] __initdata = {
> >> +     &smdk5250_lcd, /* for platform_lcd device */
> >> +};
> >> +
> >>  static void __init exynos5250_dt_map_io(void)
> >>  {
> >>       exynos_init_io(NULL, 0);
> >> @@ -96,6 +151,7 @@ static void __init exynos5250_dt_machine_init(void)
> >>       samsung_bl_set(&smdk5250_bl_gpio_info, &smdk5250_bl_data);
> >>       of_platform_populate(NULL, of_default_bus_match_table,
> >>                               exynos5250_auxdata_lookup, NULL);
> >> +     platform_add_devices(smdk5250_devices, ARRAY_SIZE(smdk5250_devices));
> >>  }
> >>
> >>  static char const *exynos5250_dt_compat[] __initdata = {
> >
> > Sorry, but this patch looks completely weird to me. exynos5-dt machine is aimed to
> > operate on ANY Exynos5 based board with proper device tree bindings, not only SMDK5250.
> > Please add DT support to platform lcd driver and create required bindings for it
> > instead of hardcoding the platform data and gpio numbers in mach-exynos5-dt.c
> >
> 
> Yes true, that GPIO numbers will vary for boards.
> Can you please confirm that platform lcd driver means the core
> "drivers/video/backlight/platform_lcd.c" file.

Yes, by lcd driver I meant that driver.

> But platform lcd driver is used by other(non samsung) platforms also.
> So, If I add the DT suppot to that file, I have to test the changes on
> other platforms also.
> Can you please kindly suggest me some other way to overcome this situation.

Just check that you don't break existing code. For some examples please refer to the DT
changes in drivers/input/keyboard/gpio_keys.c (see commit fd05d08920). You can also check
if the driver works fine after your changes by setting it up from platform data instead of
DT.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

  reply	other threads:[~2012-07-20  6:31 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18  5:57 [PATCH V2 0/7] Add device tree based discovery support for drm-fimd Leela Krishna Amudala
2012-07-18  5:57 ` Leela Krishna Amudala
2012-07-18  5:57 ` [PATCH V2 1/7] ARM: SAMSUNG: add additional registers and SFR definitions for writeback Leela Krishna Amudala
2012-07-18  5:57   ` Leela Krishna Amudala
2012-07-18  6:51   ` Marek Szyprowski
2012-07-18  6:51     ` Marek Szyprowski
2012-07-18  7:09     ` Ajay kumar
2012-07-18  7:09       ` Ajay kumar
     [not found]       ` <CAEC9eQP01q+ddhA9Q4VQcm8wuvJXmR5KvAVZgX6MEdFLstST0g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-20 10:09         ` Sylwester Nawrocki
2012-07-20 10:09           ` Sylwester Nawrocki
2012-07-19 12:43     ` Leela Krishna Amudala
2012-07-19 12:43       ` Leela Krishna Amudala
2012-07-20  6:45       ` Marek Szyprowski
2012-07-20  6:45         ` Marek Szyprowski
2012-07-18 11:05   ` Tomasz Figa
2012-07-18 11:05     ` Tomasz Figa
2012-07-19 13:00     ` Leela Krishna Amudala
2012-07-19 13:00       ` Leela Krishna Amudala
2012-07-19 13:35       ` Tomasz Figa
2012-07-19 13:35         ` Tomasz Figa
2012-07-20  2:21         ` Jingoo Han
2012-07-20  2:21           ` Jingoo Han
2012-07-20  2:59           ` Leela Krishna Amudala
2012-07-20  2:59             ` Leela Krishna Amudala
2012-07-20  9:49             ` Tomasz Figa
2012-07-20  9:49               ` Tomasz Figa
2012-07-20 10:00             ` Sylwester Nawrocki
2012-07-20 10:00               ` Sylwester Nawrocki
2012-07-20 11:07               ` Leela Krishna Amudala
2012-07-20 11:07                 ` Leela Krishna Amudala
2012-07-20 12:54                 ` Sylwester Nawrocki
2012-07-20 12:54                   ` Sylwester Nawrocki
2012-07-22 22:35               ` Jingoo Han
2012-07-22 22:35                 ` Jingoo Han
2012-07-18  5:57 ` [PATCH V2 2/7] ARM: EXYNOS5: add machine specific support for backlight Leela Krishna Amudala
2012-07-18  5:57   ` Leela Krishna Amudala
2012-07-18  5:57 ` [PATCH V2 3/7] ARM: EXYNOS5: add machine specific support for LCD Leela Krishna Amudala
2012-07-18  5:57   ` Leela Krishna Amudala
2012-07-18  6:45   ` Marek Szyprowski
2012-07-18  6:45     ` Marek Szyprowski
2012-07-19 13:21     ` Leela Krishna Amudala
2012-07-19 13:21       ` Leela Krishna Amudala
2012-07-20  6:31       ` Marek Szyprowski [this message]
2012-07-20  6:31         ` Marek Szyprowski
2012-07-24 16:02         ` Leela Krishna Amudala
2012-07-24 16:02           ` Leela Krishna Amudala
2012-07-20  7:17       ` Joonyoung Shim
2012-07-20  7:17         ` Joonyoung Shim
2012-07-18  5:57 ` [PATCH V2 4/7] ARM: EXYNOS: Adding DRM platform device Leela Krishna Amudala
2012-07-18  5:57   ` Leela Krishna Amudala
2012-07-20  7:33   ` Joonyoung Shim
2012-07-20  7:33     ` Joonyoung Shim
2012-07-18  5:57 ` [PATCH V2 5/7] ARM: EXYNOS: add device tree based discovery support for FIMD Leela Krishna Amudala
2012-07-18  5:57   ` Leela Krishna Amudala
2012-07-20  7:39   ` Joonyoung Shim
2012-07-20  7:39     ` Joonyoung Shim
2012-07-18  5:57 ` [PATCH V2 6/7] ARM: EXYNOS5: Add the bus clock " Leela Krishna Amudala
2012-07-18  5:57   ` Leela Krishna Amudala
2012-07-23  8:34   ` Joonyoung Shim
2012-07-23  8:34     ` Joonyoung Shim
2012-07-23  9:54     ` Joonyoung Shim
2012-07-23  9:54       ` Joonyoung Shim
2012-07-23 23:14       ` Jingoo Han
2012-07-23 23:14         ` Jingoo Han
2012-07-23 23:45         ` Joonyoung Shim
2012-07-23 23:45           ` Joonyoung Shim
2012-07-23 23:48           ` Jingoo Han
2012-07-23 23:48             ` Jingoo Han
     [not found]           ` <500DE22F.5010006-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2012-07-23 23:55             ` Jingoo Han
2012-07-23 23:55               ` Jingoo Han
2012-07-24  1:55               ` Joonyoung Shim
2012-07-24  1:55                 ` Joonyoung Shim
     [not found]                 ` <500E00A3.8080203-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2012-07-24  2:15                   ` Jingoo Han
2012-07-24  2:15                     ` Jingoo Han
2012-07-24  3:06                     ` Joonyoung Shim
2012-07-24  3:06                       ` Joonyoung Shim
2012-07-24  4:02                       ` Jingoo Han
2012-07-24  4:02                         ` Jingoo Han
2012-07-24  9:13                         ` Sylwester Nawrocki
2012-07-24  9:13                           ` Sylwester Nawrocki
2012-07-18  5:57 ` [PATCH V2 7/7] ARM: EXYNOS5: Set parent clock to fimd Leela Krishna Amudala
2012-07-18  5:57   ` Leela Krishna Amudala
2012-07-23  8:41   ` Joonyoung Shim
2012-07-23  8:41     ` Joonyoung Shim

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='018c01cd6641$5182dad0$f4889070$%szyprowski@samsung.com' \
    --to=m.szyprowski@samsung.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jg1.han@samsung.com \
    --cc=joshi@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=l.krishna@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=olofj@google.com \
    --cc=thomas.ab@samsung.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.