Re: [PATCH V4 09/10] drm/bridge: Add ps8622/ps8625 bridge driver

2014-06-24 Thread Ajay kumar
Hi Javier,

Thanks for the review.

On Mon, Jun 23, 2014 at 12:05 PM, Javier Martinez Canillas
jav...@dowhile0.org wrote:
 Hello Ajay,

 On Wed, Jun 11, 2014 at 8:27 PM, Ajay Kumar ajaykumar...@samsung.com wrote:
 From: Vincent Palatin vpala...@chromium.org

 This patch adds drm_bridge driver for parade DisplayPort
 to LVDS bridge chip.

 Signed-off-by: Vincent Palatin vpala...@chromium.org
 Signed-off-by: Andrew Bresticker abres...@chromium.org
 Signed-off-by: Sean Paul seanp...@chromium.org
 Signed-off-by: Rahul Sharma rahul.sha...@samsung.com
 Signed-off-by: Ajay Kumar ajaykumar...@samsung.com
 ---
  .../devicetree/bindings/drm/bridge/ps8622.txt  |   21 +
  drivers/gpu/drm/bridge/Kconfig |8 +
  drivers/gpu/drm/bridge/Makefile|1 +
  drivers/gpu/drm/bridge/ps8622.c|  475 
 
  include/drm/bridge/ps8622.h|   41 ++
  5 files changed, 546 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/drm/bridge/ps8622.txt
  create mode 100644 drivers/gpu/drm/bridge/ps8622.c
  create mode 100644 include/drm/bridge/ps8622.h

 diff --git a/Documentation/devicetree/bindings/drm/bridge/ps8622.txt 
 b/Documentation/devicetree/bindings/drm/bridge/ps8622.txt
 new file mode 100644
 index 000..1afbd9c
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/drm/bridge/ps8622.txt
 @@ -0,0 +1,21 @@
 +ps8622-bridge bindings
 +
 +Required properties:
 +   - compatible: parade,ps8622
 +   - reg: first i2c address of the bridge
 +   - sleep-gpio: OF device-tree gpio specification
 +   - reset-gpio: OF device-tree gpio specification
 +
 +Optional properties:
 +   - lane-count: number of DP lanes to use
 +   - use-external-pwm: backlight will be controlled by an external PWM
 +
 +Example:
 +   ps8622-bridge@48 {
 +   compatible = parade,ps8622;
 +   reg = 0x48;
 +   sleep-gpio = gpc3 6 1 0 0;
 +   reset-gpio = gpc3 1 1 0 0;
 +   display-timings = lcd_display_timings;
 +   lane-count = 1
 +   };
 diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
 index e3fb487..7b843c8 100644
 --- a/drivers/gpu/drm/bridge/Kconfig
 +++ b/drivers/gpu/drm/bridge/Kconfig
 @@ -10,3 +10,11 @@ config DRM_PANEL_BINDER
 select DRM_KMS_HELPER
 select DRM_PANEL
 ---help---
 +
 +config DRM_PS8622
 +   tristate Parade eDP/LVDS bridge
 +   depends on DRM
 +   select DRM_KMS_HELPER
 +   select BACKLIGHT_LCD_SUPPORT
 +   select BACKLIGHT_CLASS_DEVICE
 +   ---help---
 diff --git a/drivers/gpu/drm/bridge/Makefile 
 b/drivers/gpu/drm/bridge/Makefile
 index ba8b5b8..b494d4b 100644
 --- a/drivers/gpu/drm/bridge/Makefile
 +++ b/drivers/gpu/drm/bridge/Makefile
 @@ -2,3 +2,4 @@ ccflags-y := -Iinclude/drm

  obj-$(CONFIG_DRM_PTN3460) += ptn3460.o
  obj-$(CONFIG_DRM_PANEL_BINDER) += panel_binder.o
 +obj-$(CONFIG_DRM_PS8622) += ps8622.o
 diff --git a/drivers/gpu/drm/bridge/ps8622.c 
 b/drivers/gpu/drm/bridge/ps8622.c
 new file mode 100644
 index 000..387d332
 --- /dev/null
 +++ b/drivers/gpu/drm/bridge/ps8622.c
 @@ -0,0 +1,475 @@
 +/*
 + * Parade PS8622 eDP/LVDS bridge driver
 + *
 + * Copyright (C) 2014 Google, Inc.
 + *
 + * This software is licensed under the terms of the GNU General Public
 + * License version 2, as published by the Free Software Foundation, and
 + * may be copied, distributed, and modified under those terms.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + */
 +
 +#include linux/module.h
 +#include linux/backlight.h
 +#include linux/delay.h
 +#include linux/err.h
 +#include linux/fb.h
 +#include linux/gpio.h
 +#include linux/i2c.h
 +#include linux/of.h
 +#include linux/of_gpio.h
 +#include linux/pm.h
 +#include linux/regulator/consumer.h
 +
 +#include drmP.h
 +#include drm_crtc.h
 +#include drm_crtc_helper.h
 +
 +struct ps8622_bridge {
 +   struct drm_bridge *bridge;
 +   struct drm_encoder *encoder;
 +   struct i2c_client *client;
 +   struct regulator *v12;
 +   struct backlight_device *bl;
 +   struct mutex enable_mutex;
 +
 +   int gpio_slp_n;
 +   int gpio_rst_n;
 +
 +   u8 max_lane_count;
 +   u8 lane_count;
 +
 +   bool enabled;
 +};
 +
 +struct ps8622_device_data {
 +   u8 max_lane_count;
 +};
 +
 +static const struct ps8622_device_data ps8622_data = {
 +   .max_lane_count = 1,
 +};
 +
 +static const struct ps8622_device_data ps8625_data = {
 +   .max_lane_count = 2,
 +};
 +
 +/* Brightness scale on the Parade chip */
 +#define PS8622_MAX_BRIGHTNESS 0xff
 +
 +/* Timings taken from the version 1.7 datasheet for the PS8622/PS8625 */
 +#define PS8622_POWER_RISE_T1_MIN_US 10
 

Re: [PATCH V4 09/10] drm/bridge: Add ps8622/ps8625 bridge driver

2014-06-23 Thread Javier Martinez Canillas
Hello Ajay,

On Wed, Jun 11, 2014 at 8:27 PM, Ajay Kumar ajaykumar...@samsung.com wrote:
 From: Vincent Palatin vpala...@chromium.org

 This patch adds drm_bridge driver for parade DisplayPort
 to LVDS bridge chip.

 Signed-off-by: Vincent Palatin vpala...@chromium.org
 Signed-off-by: Andrew Bresticker abres...@chromium.org
 Signed-off-by: Sean Paul seanp...@chromium.org
 Signed-off-by: Rahul Sharma rahul.sha...@samsung.com
 Signed-off-by: Ajay Kumar ajaykumar...@samsung.com
 ---
  .../devicetree/bindings/drm/bridge/ps8622.txt  |   21 +
  drivers/gpu/drm/bridge/Kconfig |8 +
  drivers/gpu/drm/bridge/Makefile|1 +
  drivers/gpu/drm/bridge/ps8622.c|  475 
 
  include/drm/bridge/ps8622.h|   41 ++
  5 files changed, 546 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/drm/bridge/ps8622.txt
  create mode 100644 drivers/gpu/drm/bridge/ps8622.c
  create mode 100644 include/drm/bridge/ps8622.h

 diff --git a/Documentation/devicetree/bindings/drm/bridge/ps8622.txt 
 b/Documentation/devicetree/bindings/drm/bridge/ps8622.txt
 new file mode 100644
 index 000..1afbd9c
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/drm/bridge/ps8622.txt
 @@ -0,0 +1,21 @@
 +ps8622-bridge bindings
 +
 +Required properties:
 +   - compatible: parade,ps8622
 +   - reg: first i2c address of the bridge
 +   - sleep-gpio: OF device-tree gpio specification
 +   - reset-gpio: OF device-tree gpio specification
 +
 +Optional properties:
 +   - lane-count: number of DP lanes to use
 +   - use-external-pwm: backlight will be controlled by an external PWM
 +
 +Example:
 +   ps8622-bridge@48 {
 +   compatible = parade,ps8622;
 +   reg = 0x48;
 +   sleep-gpio = gpc3 6 1 0 0;
 +   reset-gpio = gpc3 1 1 0 0;
 +   display-timings = lcd_display_timings;
 +   lane-count = 1
 +   };
 diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
 index e3fb487..7b843c8 100644
 --- a/drivers/gpu/drm/bridge/Kconfig
 +++ b/drivers/gpu/drm/bridge/Kconfig
 @@ -10,3 +10,11 @@ config DRM_PANEL_BINDER
 select DRM_KMS_HELPER
 select DRM_PANEL
 ---help---
 +
 +config DRM_PS8622
 +   tristate Parade eDP/LVDS bridge
 +   depends on DRM
 +   select DRM_KMS_HELPER
 +   select BACKLIGHT_LCD_SUPPORT
 +   select BACKLIGHT_CLASS_DEVICE
 +   ---help---
 diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
 index ba8b5b8..b494d4b 100644
 --- a/drivers/gpu/drm/bridge/Makefile
 +++ b/drivers/gpu/drm/bridge/Makefile
 @@ -2,3 +2,4 @@ ccflags-y := -Iinclude/drm

  obj-$(CONFIG_DRM_PTN3460) += ptn3460.o
  obj-$(CONFIG_DRM_PANEL_BINDER) += panel_binder.o
 +obj-$(CONFIG_DRM_PS8622) += ps8622.o
 diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
 new file mode 100644
 index 000..387d332
 --- /dev/null
 +++ b/drivers/gpu/drm/bridge/ps8622.c
 @@ -0,0 +1,475 @@
 +/*
 + * Parade PS8622 eDP/LVDS bridge driver
 + *
 + * Copyright (C) 2014 Google, Inc.
 + *
 + * This software is licensed under the terms of the GNU General Public
 + * License version 2, as published by the Free Software Foundation, and
 + * may be copied, distributed, and modified under those terms.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + */
 +
 +#include linux/module.h
 +#include linux/backlight.h
 +#include linux/delay.h
 +#include linux/err.h
 +#include linux/fb.h
 +#include linux/gpio.h
 +#include linux/i2c.h
 +#include linux/of.h
 +#include linux/of_gpio.h
 +#include linux/pm.h
 +#include linux/regulator/consumer.h
 +
 +#include drmP.h
 +#include drm_crtc.h
 +#include drm_crtc_helper.h
 +
 +struct ps8622_bridge {
 +   struct drm_bridge *bridge;
 +   struct drm_encoder *encoder;
 +   struct i2c_client *client;
 +   struct regulator *v12;
 +   struct backlight_device *bl;
 +   struct mutex enable_mutex;
 +
 +   int gpio_slp_n;
 +   int gpio_rst_n;
 +
 +   u8 max_lane_count;
 +   u8 lane_count;
 +
 +   bool enabled;
 +};
 +
 +struct ps8622_device_data {
 +   u8 max_lane_count;
 +};
 +
 +static const struct ps8622_device_data ps8622_data = {
 +   .max_lane_count = 1,
 +};
 +
 +static const struct ps8622_device_data ps8625_data = {
 +   .max_lane_count = 2,
 +};
 +
 +/* Brightness scale on the Parade chip */
 +#define PS8622_MAX_BRIGHTNESS 0xff
 +
 +/* Timings taken from the version 1.7 datasheet for the PS8622/PS8625 */
 +#define PS8622_POWER_RISE_T1_MIN_US 10
 +#define PS8622_POWER_RISE_T1_MAX_US 1
 +#define PS8622_RST_HIGH_T2_MIN_US 3000
 +#define PS8622_RST_HIGH_T2_MAX_US 3
 

Re: [PATCH V4 09/10] drm/bridge: Add ps8622/ps8625 bridge driver

2014-06-20 Thread Ajay kumar
ping.

On Wed, Jun 11, 2014 at 11:57 PM, Ajay Kumar ajaykumar...@samsung.com wrote:
 From: Vincent Palatin vpala...@chromium.org

 This patch adds drm_bridge driver for parade DisplayPort
 to LVDS bridge chip.

 Signed-off-by: Vincent Palatin vpala...@chromium.org
 Signed-off-by: Andrew Bresticker abres...@chromium.org
 Signed-off-by: Sean Paul seanp...@chromium.org
 Signed-off-by: Rahul Sharma rahul.sha...@samsung.com
 Signed-off-by: Ajay Kumar ajaykumar...@samsung.com
 ---
  .../devicetree/bindings/drm/bridge/ps8622.txt  |   21 +
  drivers/gpu/drm/bridge/Kconfig |8 +
  drivers/gpu/drm/bridge/Makefile|1 +
  drivers/gpu/drm/bridge/ps8622.c|  475 
 
  include/drm/bridge/ps8622.h|   41 ++
  5 files changed, 546 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/drm/bridge/ps8622.txt
  create mode 100644 drivers/gpu/drm/bridge/ps8622.c
  create mode 100644 include/drm/bridge/ps8622.h

 diff --git a/Documentation/devicetree/bindings/drm/bridge/ps8622.txt 
 b/Documentation/devicetree/bindings/drm/bridge/ps8622.txt
 new file mode 100644
 index 000..1afbd9c
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/drm/bridge/ps8622.txt
 @@ -0,0 +1,21 @@
 +ps8622-bridge bindings
 +
 +Required properties:
 +   - compatible: parade,ps8622
 +   - reg: first i2c address of the bridge
 +   - sleep-gpio: OF device-tree gpio specification
 +   - reset-gpio: OF device-tree gpio specification
 +
 +Optional properties:
 +   - lane-count: number of DP lanes to use
 +   - use-external-pwm: backlight will be controlled by an external PWM
 +
 +Example:
 +   ps8622-bridge@48 {
 +   compatible = parade,ps8622;
 +   reg = 0x48;
 +   sleep-gpio = gpc3 6 1 0 0;
 +   reset-gpio = gpc3 1 1 0 0;
 +   display-timings = lcd_display_timings;
 +   lane-count = 1
 +   };
 diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
 index e3fb487..7b843c8 100644
 --- a/drivers/gpu/drm/bridge/Kconfig
 +++ b/drivers/gpu/drm/bridge/Kconfig
 @@ -10,3 +10,11 @@ config DRM_PANEL_BINDER
 select DRM_KMS_HELPER
 select DRM_PANEL
 ---help---
 +
 +config DRM_PS8622
 +   tristate Parade eDP/LVDS bridge
 +   depends on DRM
 +   select DRM_KMS_HELPER
 +   select BACKLIGHT_LCD_SUPPORT
 +   select BACKLIGHT_CLASS_DEVICE
 +   ---help---
 diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
 index ba8b5b8..b494d4b 100644
 --- a/drivers/gpu/drm/bridge/Makefile
 +++ b/drivers/gpu/drm/bridge/Makefile
 @@ -2,3 +2,4 @@ ccflags-y := -Iinclude/drm

  obj-$(CONFIG_DRM_PTN3460) += ptn3460.o
  obj-$(CONFIG_DRM_PANEL_BINDER) += panel_binder.o
 +obj-$(CONFIG_DRM_PS8622) += ps8622.o
 diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
 new file mode 100644
 index 000..387d332
 --- /dev/null
 +++ b/drivers/gpu/drm/bridge/ps8622.c
 @@ -0,0 +1,475 @@
 +/*
 + * Parade PS8622 eDP/LVDS bridge driver
 + *
 + * Copyright (C) 2014 Google, Inc.
 + *
 + * This software is licensed under the terms of the GNU General Public
 + * License version 2, as published by the Free Software Foundation, and
 + * may be copied, distributed, and modified under those terms.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + */
 +
 +#include linux/module.h
 +#include linux/backlight.h
 +#include linux/delay.h
 +#include linux/err.h
 +#include linux/fb.h
 +#include linux/gpio.h
 +#include linux/i2c.h
 +#include linux/of.h
 +#include linux/of_gpio.h
 +#include linux/pm.h
 +#include linux/regulator/consumer.h
 +
 +#include drmP.h
 +#include drm_crtc.h
 +#include drm_crtc_helper.h
 +
 +struct ps8622_bridge {
 +   struct drm_bridge *bridge;
 +   struct drm_encoder *encoder;
 +   struct i2c_client *client;
 +   struct regulator *v12;
 +   struct backlight_device *bl;
 +   struct mutex enable_mutex;
 +
 +   int gpio_slp_n;
 +   int gpio_rst_n;
 +
 +   u8 max_lane_count;
 +   u8 lane_count;
 +
 +   bool enabled;
 +};
 +
 +struct ps8622_device_data {
 +   u8 max_lane_count;
 +};
 +
 +static const struct ps8622_device_data ps8622_data = {
 +   .max_lane_count = 1,
 +};
 +
 +static const struct ps8622_device_data ps8625_data = {
 +   .max_lane_count = 2,
 +};
 +
 +/* Brightness scale on the Parade chip */
 +#define PS8622_MAX_BRIGHTNESS 0xff
 +
 +/* Timings taken from the version 1.7 datasheet for the PS8622/PS8625 */
 +#define PS8622_POWER_RISE_T1_MIN_US 10
 +#define PS8622_POWER_RISE_T1_MAX_US 1
 +#define PS8622_RST_HIGH_T2_MIN_US 3000
 +#define PS8622_RST_HIGH_T2_MAX_US 3
 +#define