Re: [PATCH V9 12/14] drm/bridge: Add i2c based driver for ps8622/ps8625 bridge

2015-01-30 Thread Thierry Reding
On Thu, Jan 29, 2015 at 08:12:20PM +0530, Ajay kumar wrote:
 Hi Thierry,
 
 I think you forgot to take this patch!
 Can you check this?

Yes, I missed it somehow. It didn't build for me after applying it now,
but I fixed that up (and a few sparse warnings along with it). I'll send
out another pull request shortly.

Thierry


pgpRXBmwWcgjN.pgp
Description: PGP signature


Re: [PATCH V9 12/14] drm/bridge: Add i2c based driver for ps8622/ps8625 bridge

2015-01-29 Thread Ajay kumar
Hi Thierry,

I think you forgot to take this patch!
Can you check this?

Regards,
Ajay Kumar


On Tue, Jan 20, 2015 at 10:08 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
 Acked-by: Inki Dae inki@samsung.com
 Tested-by: Rahul Sharma rahul.sha...@samsung.com
 Tested-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 Tested-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
 Tested-by: Sjoerd Simons sjoerd.sim...@collabora.co.uk
 ---
  drivers/gpu/drm/bridge/Kconfig  |9 +
  drivers/gpu/drm/bridge/Makefile |1 +
  drivers/gpu/drm/bridge/ps8622.c |  684 
 +++
  3 files changed, 694 insertions(+)
  create mode 100644 drivers/gpu/drm/bridge/ps8622.c

 diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
 index 8b426e2..d06eda3 100644
 --- a/drivers/gpu/drm/bridge/Kconfig
 +++ b/drivers/gpu/drm/bridge/Kconfig
 @@ -6,3 +6,12 @@ config DRM_PTN3460
 select DRM_PANEL
 ---help---
   ptn3460 eDP-LVDS bridge chip driver.
 +
 +config DRM_PS8622
 +   tristate Parade eDP/LVDS bridge
 +   depends on OF  I2C
 +   select DRM_PANEL
 +   select BACKLIGHT_LCD_SUPPORT
 +   select BACKLIGHT_CLASS_DEVICE
 +   ---help---
 + parade eDP-LVDS bridge chip driver.
 diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
 index b4733e1..105da3e 100644
 --- a/drivers/gpu/drm/bridge/Makefile
 +++ b/drivers/gpu/drm/bridge/Makefile
 @@ -1,3 +1,4 @@
  ccflags-y := -Iinclude/drm

 +obj-$(CONFIG_DRM_PS8622) += ps8622.o
  obj-$(CONFIG_DRM_PTN3460) += ptn3460.o
 diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
 new file mode 100644
 index 000..5474a39
 --- /dev/null
 +++ b/drivers/gpu/drm/bridge/ps8622.c
 @@ -0,0 +1,684 @@
 +/*
 + * 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/backlight.h
 +#include linux/delay.h
 +#include linux/err.h
 +#include linux/fb.h
 +#include linux/gpio.h
 +#include linux/i2c.h
 +#include linux/module.h
 +#include linux/of.h
 +#include linux/of_device.h
 +#include linux/of_graph.h
 +#include linux/pm.h
 +#include linux/regulator/consumer.h
 +
 +#include drm/drm_panel.h
 +
 +#include drmP.h
 +#include drm_crtc.h
 +#include drm_crtc_helper.h
 +
 +/* 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 PS8622_PWMO_END_T12_MS 200
 +#define PS8622_POWER_FALL_T16_MAX_US 1
 +#define PS8622_POWER_OFF_T17_MS 500
 +
 +#if ((PS8622_RST_HIGH_T2_MIN_US + PS8622_POWER_RISE_T1_MAX_US)  \
 +   (PS8622_RST_HIGH_T2_MAX_US + PS8622_POWER_RISE_T1_MIN_US))
 +#error T2.min + T1.max must be less than T2.max + T1.min
 +#endif
 +
 +struct ps8622_bridge {
 +   struct drm_connector connector;
 +   struct i2c_client *client;
 +   struct drm_bridge bridge;
 +   struct drm_panel *panel;
 +   struct regulator *v12;
 +   struct backlight_device *bl;
 +
 +   struct gpio_desc *gpio_slp;
 +   struct gpio_desc *gpio_rst;
 +
 +   u32 max_lane_count;
 +   u32 lane_count;
 +
 +   bool enabled;
 +};
 +
 +static inline struct ps8622_bridge *
 +   bridge_to_ps8622(struct drm_bridge *bridge)
 +{
 +   return container_of(bridge, struct ps8622_bridge, bridge);
 +}
 +
 +static inline struct ps8622_bridge *
 +   connector_to_ps8622(struct drm_connector *connector)
 +{
 +   return container_of(connector, struct ps8622_bridge, connector);
 +}
 +
 +static int ps8622_set(struct i2c_client *client, u8 page, u8 reg, u8 val)
 +{
 +   int ret;
 +   struct i2c_adapter *adap = client-adapter;
 +   struct i2c_msg msg;
 +   u8 data[] = {reg, val};
 +
 +   msg.addr = client-addr + page;
 +   msg.flags = 0;
 +   msg.len = sizeof(data);
 +   msg.buf = data;
 +
 +   ret =