* Re: [PATCH V3 7/8] drm/bridge: Add ps8622/ps8625 bridge driver [not found] ` <CAEC9eQNy5CLtoVgdE23uJWrNBRx5C0v60fkwOEATpmz2=Q8N7A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-06-05 19:21 ` Ajay kumar 0 siblings, 0 replies; 3+ messages in thread From: Ajay kumar @ 2014-06-05 19:21 UTC (permalink / raw) To: devicetree-u79uwXL29TY76Z2rM5mHXA Cc: Ajay Kumar, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Dae, Sean Paul, Jingoo Han, Rob Clark, Daniel Vetter, Thierry Reding, sunil joshi, Prashanth G, Vincent Palatin, Andrew Bresticker, Sean Paul, Rahul Sharma On Fri, Jun 6, 2014 at 12:46 AM, Ajay kumar <ajaynumb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > + Device tree list > > > On Fri, Jun 6, 2014 at 12:40 AM, Ajay Kumar <ajaykumar.rs-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: >> From: Vincent Palatin <vpalatin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> >> >> This patch adds drm_bridge driver for parade DisplayPort >> to LVDS bridge chip. >> >> Signed-off-by: Vincent Palatin <vpalatin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> >> Signed-off-by: Andrew Bresticker <abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> >> Signed-off-by: Sean Paul <seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> >> Signed-off-by: Rahul Sharma <rahul.sharma-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> >> Signed-off-by: Ajay Kumar <ajaykumar.rs-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> >> --- >> .../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 0000000..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 0000000..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 10000 >> +#define PS8622_RST_HIGH_T2_MIN_US 3000 >> +#define PS8622_RST_HIGH_T2_MAX_US 30000 >> +#define PS8622_PWMO_END_T12_MS 200 >> +#define PS8622_POWER_FALL_T16_MAX_US 10000 >> +#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 >> + >> +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 = i2c_transfer(adap, &msg, 1); >> + if (ret != 1) >> + pr_warn("PS8622 I2C write (0x%02x,0x%02x,0x%02x) failed: %d\n", >> + client->addr + page, reg, val, ret); >> + return !(ret == 1); >> +} >> + >> +static int ps8622_send_config(struct ps8622_bridge *ps_bridge) >> +{ >> + struct i2c_client *cl = ps_bridge->client; >> + int err = 0; >> + >> + /* wait 20ms after power ON */ >> + usleep_range(20000, 30000); >> + >> + err |= ps8622_set(cl, 0x02, 0xa1, 0x01); /* HPD low */ >> + /* SW setting */ >> + err |= ps8622_set(cl, 0x04, 0x14, 0x01); /* [1:0] SW output 1.2V voltage >> + * is lower to 96% */ >> + /* RCO SS setting */ >> + err |= ps8622_set(cl, 0x04, 0xe3, 0x20); /* [5:4] = b01 0.5%, b10 1%, >> + * b11 1.5% */ >> + err |= ps8622_set(cl, 0x04, 0xe2, 0x80); /* [7] RCO SS enable */ >> + /* RPHY Setting */ >> + err |= ps8622_set(cl, 0x04, 0x8a, 0x0c); /* [3:2] CDR tune wait cycle >> + * before measure for fine tune >> + * b00: 1us b01: 0.5us b10:2us >> + * b11: 4us */ >> + err |= ps8622_set(cl, 0x04, 0x89, 0x08); /* [3] RFD always on */ >> + err |= ps8622_set(cl, 0x04, 0x71, 0x2d); /* CTN lock in/out: >> + * 20000ppm/80000ppm. >> + * Lock out 2 times. */ >> + /* 2.7G CDR settings */ >> + err |= ps8622_set(cl, 0x04, 0x7d, 0x07); /* NOF=40LSB for HBR CDR >> + * setting */ >> + err |= ps8622_set(cl, 0x04, 0x7b, 0x00); /* [1:0] Fmin=+4bands */ >> + err |= ps8622_set(cl, 0x04, 0x7a, 0xfd); /* [7:5] DCO_FTRNG=+-40% */ >> + /* 1.62G CDR settings */ >> + err |= ps8622_set(cl, 0x04, 0xc0, 0x12); /* [5:2]NOF=64LSB [1:0]DCO >> + * scale is 2/5 */ >> + err |= ps8622_set(cl, 0x04, 0xc1, 0x92); /* Gitune=-37% */ >> + err |= ps8622_set(cl, 0x04, 0xc2, 0x1c); /* Fbstep=100% */ >> + err |= ps8622_set(cl, 0x04, 0x32, 0x80); /* [7] LOS signal disable */ >> + /* RPIO Setting */ >> + err |= ps8622_set(cl, 0x04, 0x00, 0xb0); /* [7:4] LVDS driver bias >> + * current : 75% (250mV swing) >> + * */ >> + err |= ps8622_set(cl, 0x04, 0x15, 0x40); /* [7:6] Right-bar GPIO output >> + * strength is 8mA */ >> + /* EQ Training State Machine Setting */ >> + err |= ps8622_set(cl, 0x04, 0x54, 0x10); /* RCO calibration start */ >> + /* Logic, needs more than 10 I2C command */ >> + err |= ps8622_set(cl, 0x01, 0x02, 0x80 | ps_bridge->max_lane_count); >> + /* [4:0] MAX_LANE_COUNT set to >> + * max supported lanes */ >> + err |= ps8622_set(cl, 0x01, 0x21, 0x80 | ps_bridge->lane_count); >> + /* [4:0] LANE_COUNT_SET set to >> + * chosen lane count */ >> + err |= ps8622_set(cl, 0x00, 0x52, 0x20); >> + err |= ps8622_set(cl, 0x00, 0xf1, 0x03); /* HPD CP toggle enable */ >> + err |= ps8622_set(cl, 0x00, 0x62, 0x41); >> + err |= ps8622_set(cl, 0x00, 0xf6, 0x01); /* Counter number, add 1ms >> + * counter delay */ >> + err |= ps8622_set(cl, 0x00, 0x77, 0x06); /* [6]PWM function control by >> + * DPCD0040f[7], default is PWM >> + * block always works. */ >> + err |= ps8622_set(cl, 0x00, 0x4c, 0x04); /* 04h Adjust VTotal tolerance >> + * to fix the 30Hz no display >> + * issue */ >> + err |= ps8622_set(cl, 0x01, 0xc0, 0x00); /* DPCD00400='h00, Parade OUI = >> + * 'h001cf8 */ >> + err |= ps8622_set(cl, 0x01, 0xc1, 0x1c); /* DPCD00401='h1c */ >> + err |= ps8622_set(cl, 0x01, 0xc2, 0xf8); /* DPCD00402='hf8 */ >> + err |= ps8622_set(cl, 0x01, 0xc3, 0x44); /* DPCD403~408 = ASCII code >> + * D2SLV5='h4432534c5635 */ >> + err |= ps8622_set(cl, 0x01, 0xc4, 0x32); /* DPCD404 */ >> + err |= ps8622_set(cl, 0x01, 0xc5, 0x53); /* DPCD405 */ >> + err |= ps8622_set(cl, 0x01, 0xc6, 0x4c); /* DPCD406 */ >> + err |= ps8622_set(cl, 0x01, 0xc7, 0x56); /* DPCD407 */ >> + err |= ps8622_set(cl, 0x01, 0xc8, 0x35); /* DPCD408 */ >> + err |= ps8622_set(cl, 0x01, 0xca, 0x01); /* DPCD40A, Initial Code major >> + * revision '01' */ >> + err |= ps8622_set(cl, 0x01, 0xcb, 0x05); /* DPCD40B, Initial Code minor >> + * revision '05' */ >> + if (ps_bridge->bl) { >> + err |= ps8622_set(cl, 0x01, 0xa5, 0xa0); >> + /* DPCD720, internal PWM */ >> + err |= ps8622_set(cl, 0x01, 0xa7, >> + ps_bridge->bl->props.brightness); >> + /* FFh for 100% brightness, >> + * 0h for 0% brightness */ >> + } else { >> + err |= ps8622_set(cl, 0x01, 0xa5, 0x80); >> + /* DPCD720, external PWM */ >> + } >> + err |= ps8622_set(cl, 0x01, 0xcc, 0x13); /* Set LVDS output as 6bit-VESA >> + * mapping, single LVDS channel >> + * */ >> + err |= ps8622_set(cl, 0x02, 0xb1, 0x20); /* Enable SSC set by register >> + * */ >> + err |= ps8622_set(cl, 0x04, 0x10, 0x16); /* Set SSC enabled and +/-1% >> + * central spreading */ >> + /* Logic end */ >> + err |= ps8622_set(cl, 0x04, 0x59, 0x60); /* MPU Clock source: LC => RCO >> + * */ >> + err |= ps8622_set(cl, 0x04, 0x54, 0x14); /* LC -> RCO */ >> + err |= ps8622_set(cl, 0x02, 0xa1, 0x91); /* HPD high */ >> + >> + return err ? -EIO : 0; >> +} >> + >> +static int ps8622_backlight_update(struct backlight_device *bl) >> +{ >> + struct ps8622_bridge *ps_bridge = dev_get_drvdata(&bl->dev); >> + int ret, brightness = bl->props.brightness; >> + >> + if (bl->props.power != FB_BLANK_UNBLANK || >> + bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) >> + brightness = 0; >> + >> + mutex_lock(&ps_bridge->enable_mutex); >> + >> + if (!ps_bridge->enabled) { >> + ret = -EINVAL; >> + goto out; >> + } >> + >> + ret = ps8622_set(ps_bridge->client, 0x01, 0xa7, brightness); >> + >> +out: >> + mutex_unlock(&ps_bridge->enable_mutex); >> + return ret; >> +} >> + >> +static int ps8622_backlight_get(struct backlight_device *bl) >> +{ >> + return bl->props.brightness; >> +} >> + >> +static const struct backlight_ops ps8622_backlight_ops = { >> + .update_status = ps8622_backlight_update, >> + .get_brightness = ps8622_backlight_get, >> +}; >> + >> +static void ps8622_pre_enable(struct drm_bridge *bridge) >> +{ >> + struct ps8622_bridge *ps_bridge = bridge->driver_private; >> + int ret; >> + >> + mutex_lock(&ps_bridge->enable_mutex); >> + if (ps_bridge->enabled) >> + goto out; >> + >> + if (gpio_is_valid(ps_bridge->gpio_rst_n)) >> + gpio_set_value(ps_bridge->gpio_rst_n, 0); >> + >> + if (ps_bridge->v12) { >> + ret = regulator_enable(ps_bridge->v12); >> + if (ret) >> + DRM_ERROR("fails to enable ps_bridge->v12"); >> + } >> + >> + drm_next_bridge_pre_enable(bridge); >> + >> + if (gpio_is_valid(ps_bridge->gpio_slp_n)) >> + gpio_set_value(ps_bridge->gpio_slp_n, 1); >> + >> + /* >> + * T1 is the range of time that it takes for the power to rise after we >> + * enable the lcd fet. T2 is the range of time in which the data sheet >> + * specifies we should deassert the reset pin. >> + * >> + * If it takes T1.max for the power to rise, we need to wait atleast >> + * T2.min before deasserting the reset pin. If it takes T1.min for the >> + * power to rise, we need to wait at most T2.max before deasserting the >> + * reset pin. >> + */ >> + usleep_range(PS8622_RST_HIGH_T2_MIN_US + PS8622_POWER_RISE_T1_MAX_US, >> + PS8622_RST_HIGH_T2_MAX_US + PS8622_POWER_RISE_T1_MIN_US); >> + >> + if (gpio_is_valid(ps_bridge->gpio_rst_n)) >> + gpio_set_value(ps_bridge->gpio_rst_n, 1); >> + >> + ret = ps8622_send_config(ps_bridge); >> + if (ret) >> + DRM_ERROR("Failed to send config to bridge (%d)\n", ret); >> + >> + ps_bridge->enabled = true; >> + >> +out: >> + mutex_unlock(&ps_bridge->enable_mutex); >> +} >> + >> +static void ps8622_enable(struct drm_bridge *bridge) >> +{ >> + struct ps8622_bridge *ps_bridge = bridge->driver_private; >> + >> + mutex_lock(&ps_bridge->enable_mutex); >> + drm_next_bridge_enable(bridge); >> + mutex_unlock(&ps_bridge->enable_mutex); >> +} >> + >> +static void ps8622_disable(struct drm_bridge *bridge) >> +{ >> + struct ps8622_bridge *ps_bridge = bridge->driver_private; >> + >> + mutex_lock(&ps_bridge->enable_mutex); >> + >> + if (!ps_bridge->enabled) >> + goto out; >> + >> + ps_bridge->enabled = false; >> + >> + drm_next_bridge_disable(bridge); >> + msleep(PS8622_PWMO_END_T12_MS); >> + >> + /* >> + * This doesn't matter if the regulators are turned off, but something >> + * else might keep them on. In that case, we want to assert the slp gpio >> + * to lower power. >> + */ >> + if (gpio_is_valid(ps_bridge->gpio_slp_n)) >> + gpio_set_value(ps_bridge->gpio_slp_n, 0); >> + >> + if (ps_bridge->v12) >> + regulator_disable(ps_bridge->v12); >> + >> + /* >> + * Sleep for at least the amount of time that it takes the power rail to >> + * fall to prevent asserting the rst gpio from doing anything. >> + */ >> + usleep_range(PS8622_POWER_FALL_T16_MAX_US, >> + 2 * PS8622_POWER_FALL_T16_MAX_US); >> + if (gpio_is_valid(ps_bridge->gpio_rst_n)) >> + gpio_set_value(ps_bridge->gpio_rst_n, 0); >> + >> + msleep(PS8622_POWER_OFF_T17_MS); >> + >> +out: >> + mutex_unlock(&ps_bridge->enable_mutex); >> +} >> + >> +static void ps8622_post_disable(struct drm_bridge *bridge) >> +{ >> + drm_next_bridge_post_disable(bridge); >> +} >> + >> +static void ps8622_destroy(struct drm_bridge *bridge) >> +{ >> + struct ps8622_bridge *ps_bridge = bridge->driver_private; >> + >> + drm_bridge_cleanup(bridge); >> + if (ps_bridge->bl) >> + backlight_device_unregister(ps_bridge->bl); >> + >> + put_device(&ps_bridge->client->dev); >> +} >> + >> +static const struct drm_bridge_funcs ps8622_bridge_funcs = { >> + .pre_enable = ps8622_pre_enable, >> + .enable = ps8622_enable, >> + .disable = ps8622_disable, >> + .post_disable = ps8622_post_disable, >> + .destroy = ps8622_destroy, >> +}; >> + >> +static const struct of_device_id ps8622_devices[] = { >> + { >> + .compatible = "parade,ps8622", >> + .data = &ps8622_data, >> + }, { >> + .compatible = "parade,ps8625", >> + .data = &ps8625_data, >> + }, { >> + /* end node */ >> + } >> +}; >> + >> +struct drm_bridge *ps8622_init(struct drm_device *dev, >> + struct drm_encoder *encoder, >> + struct i2c_client *client, >> + struct device_node *node) >> +{ >> + int ret; >> + const struct of_device_id *match; >> + const struct ps8622_device_data *device_data; >> + struct drm_bridge *bridge; >> + struct ps8622_bridge *ps_bridge; >> + >> + node = of_find_matching_node_and_match(NULL, ps8622_devices, &match); >> + if (!node) >> + return NULL; >> + >> + bridge = devm_kzalloc(dev->dev, sizeof(*bridge), GFP_KERNEL); >> + if (!bridge) { >> + DRM_ERROR("Failed to allocate drm bridge\n"); >> + return NULL; >> + } >> + >> + ps_bridge = devm_kzalloc(dev->dev, sizeof(*ps_bridge), GFP_KERNEL); >> + if (!ps_bridge) { >> + DRM_ERROR("could not allocate ps bridge\n"); >> + return NULL; >> + } >> + >> + mutex_init(&ps_bridge->enable_mutex); >> + >> + device_data = match->data; >> + ps_bridge->client = client; >> + ps_bridge->encoder = encoder; >> + ps_bridge->bridge = bridge; >> + ps_bridge->v12 = devm_regulator_get(&client->dev, "vdd_bridge"); >> + if (IS_ERR(ps_bridge->v12)) { >> + DRM_INFO("no 1.2v regulator found for PS8622\n"); >> + ps_bridge->v12 = NULL; >> + } >> + >> + ps_bridge->gpio_slp_n = of_get_named_gpio(node, "sleep-gpio", 0); >> + if (gpio_is_valid(ps_bridge->gpio_slp_n)) { >> + ret = devm_gpio_request_one(&client->dev, ps_bridge->gpio_slp_n, >> + GPIOF_OUT_INIT_HIGH, >> + "PS8622_SLP_N"); >> + if (ret) >> + goto err_client; >> + } >> + >> + ps_bridge->gpio_rst_n = of_get_named_gpio(node, "reset-gpio", 0); >> + if (gpio_is_valid(ps_bridge->gpio_rst_n)) { >> + /* >> + * Assert the reset pin high to avoid the bridge being >> + * initialized prematurely >> + */ >> + ret = devm_gpio_request_one(&client->dev, ps_bridge->gpio_rst_n, >> + GPIOF_OUT_INIT_HIGH, >> + "PS8622_RST_N"); >> + if (ret) >> + goto err_client; >> + } >> + >> + ps_bridge->max_lane_count = device_data->max_lane_count; >> + >> + if (of_property_read_u8(node, "lane-count", &ps_bridge->lane_count)) >> + ps_bridge->lane_count = ps_bridge->max_lane_count; >> + else if (ps_bridge->lane_count > ps_bridge->max_lane_count) { >> + DRM_ERROR("lane-count property is too high for DP bridge\n"); >> + ps_bridge->lane_count = ps_bridge->max_lane_count; >> + } >> + >> + if (!of_find_property(node, "use-external-pwm", NULL)) { >> + ps_bridge->bl = backlight_device_register("ps8622-backlight", >> + dev->dev, ps_bridge, &ps8622_backlight_ops, >> + NULL); >> + if (IS_ERR(ps_bridge->bl)) { >> + DRM_ERROR("failed to register backlight\n"); >> + ret = PTR_ERR(ps_bridge->bl); >> + ps_bridge->bl = NULL; >> + goto err_client; >> + } >> + ps_bridge->bl->props.max_brightness = PS8622_MAX_BRIGHTNESS; >> + ps_bridge->bl->props.brightness = PS8622_MAX_BRIGHTNESS; >> + } >> + >> + ret = drm_bridge_init(dev, ps_bridge->bridge, &ps8622_bridge_funcs); >> + if (ret) { >> + DRM_ERROR("Failed to initialize bridge with drm\n"); >> + goto err_backlight; >> + } >> + >> + ps_bridge->bridge->driver_private = ps_bridge; >> + ps_bridge->enabled = false; >> + >> + if (!encoder->bridge) >> + /* First entry in the bridge chain */ >> + encoder->bridge = bridge; >> + >> + return bridge; >> + >> +err_backlight: >> + if (ps_bridge->bl) >> + backlight_device_unregister(ps_bridge->bl); >> +err_client: >> + put_device(&client->dev); >> + DRM_ERROR("device probe failed : %d\n", ret); >> + return NULL; >> +} >> +EXPORT_SYMBOL(ps8622_init); >> diff --git a/include/drm/bridge/ps8622.h b/include/drm/bridge/ps8622.h >> new file mode 100644 >> index 0000000..22f37b6 >> --- /dev/null >> +++ b/include/drm/bridge/ps8622.h >> @@ -0,0 +1,41 @@ >> +/* >> + * 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. >> + */ >> + >> +#ifndef _DRM_BRIDGE_PS8622_H_ >> +#define _DRM_BRIDGE_PS8622_H_ >> + >> +struct drm_device; >> +struct drm_encoder; >> +struct i2c_client; >> +struct device_node; >> + >> +#ifdef CONFIG_DRM_PS8622 >> + >> +struct drm_bridge *ps8622_init(struct drm_device *dev, >> + struct drm_encoder *encoder, >> + struct i2c_client *client, >> + struct device_node *node); >> + >> +#else >> + >> +static inline struct drm_bridge *ps8622_init(struct drm_device *dev, >> + struct drm_encoder *encoder, >> + struct i2c_client *client, >> + struct device_node *node) >> +{ >> + return -ENODEV; >> +} >> + >> +#endif >> + >> +#endif >> -- >> 1.7.9.5 >> -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <1401995452-15798-6-git-send-email-ajaykumar.rs@samsung.com>]
[parent not found: <CAEC9eQNamrF7G0kQ6J=R5DgvMn_zX1X6D2f7pegkRKxQ7LMfLQ@mail.gmail.com>]
[parent not found: <CAEC9eQNamrF7G0kQ6J=R5DgvMn_zX1X6D2f7pegkRKxQ7LMfLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH V3 5/8] drm/panel: Add driver for lvds/edp based panels [not found] ` <CAEC9eQNamrF7G0kQ6J=R5DgvMn_zX1X6D2f7pegkRKxQ7LMfLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-06-05 19:21 ` Ajay kumar 0 siblings, 0 replies; 3+ messages in thread From: Ajay kumar @ 2014-06-05 19:21 UTC (permalink / raw) To: devicetree-u79uwXL29TY76Z2rM5mHXA Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Ajay Kumar, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Dae, Sean Paul, Jingoo Han, Rob Clark, Daniel Vetter, Thierry Reding, sunil joshi, Prashanth G, Rahul Sharma On Fri, Jun 6, 2014 at 12:47 AM, Ajay kumar <ajaynumb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > +Device tree list > > On Fri, Jun 6, 2014 at 12:40 AM, Ajay Kumar <ajaykumar.rs-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: >> This patch adds a simple driver to handle all the LCD and LED >> powerup/down routines needed to support eDP/LVDS panels. >> >> The LCD and LED units are usually powered up via regulators, >> and almost on all boards, we will have a BACKLIGHT_EN pin to >> enable/ disable the backlight. >> Sometimes, we can have LCD_EN switches as well. >> >> The routines in this driver can be used to control >> panel power sequence on such boards. >> >> Signed-off-by: Ajay Kumar <ajaykumar.rs-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> >> Signed-off-by: Rahul Sharma <Rahul.Sharma-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> >> --- >> .../devicetree/bindings/panel/panel-lvds.txt | 50 ++++ >> drivers/gpu/drm/panel/Kconfig | 18 ++ >> drivers/gpu/drm/panel/Makefile | 2 + >> drivers/gpu/drm/panel/panel-lvds.c | 262 ++++++++++++++++++++ >> 4 files changed, 332 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/panel/panel-lvds.txt >> create mode 100644 drivers/gpu/drm/panel/panel-lvds.c >> >> diff --git a/Documentation/devicetree/bindings/panel/panel-lvds.txt b/Documentation/devicetree/bindings/panel/panel-lvds.txt >> new file mode 100644 >> index 0000000..465016d >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/panel/panel-lvds.txt >> @@ -0,0 +1,50 @@ >> +panel interface for eDP/lvds panels >> + >> +Required properties: >> + - compatible: "panel-lvds" >> + >> +Optional properties: >> + -lcd-en-gpio: >> + panel LCD poweron GPIO. >> + Indicates which GPIO needs to be powered up as output >> + to powerup/enable the switch to the LCD panel. >> + -led-en-gpio: >> + panel LED enable GPIO. >> + Indicates which GPIO needs to be powered up as output >> + to enable the backlight. >> + -panel-prepare-delay: >> + delay value in ms required for panel_prepare process >> + Delay in ms needed for the panel LCD unit to >> + powerup completely. >> + ex: delay needed till eDP panel throws HPD. >> + delay needed so that we cans tart reading edid. >> + -panel-enable-delay: >> + delay value in ms required for panel_enable process >> + Delay in ms needed for the panel backlight/LED unit >> + to powerup, and delay needed between video_enable and >> + backlight_enable. >> + -panel-disable-delay: >> + delay value in ms required for panel_disable process >> + Delay in ms needed for the panel backlight/LED unit >> + powerdown, and delay needed between backlight_disable >> + and video_disable. >> + -panel-unprepare-delay: >> + delay value in ms required for panel_post_disable process >> + Delay in ms needed for the panel LCD unit to >> + to powerdown completely, and the minimum delay needed >> + before powering it on again. >> + -panel-width-mm: physical panel width [mm] >> + -panel-height-mm: physical panel height [mm] >> + >> +Example: >> + >> + panel-lvds { >> + compatible = "panel-lvds"; >> + led-en-gpio = <&gpx3 0 1>; >> + panel-pre-enable-delay = <40>; >> + panel-enable-delay = <20>; >> + panel-disable-delay = <20>; >> + panel-post-disable-delay = <30>; >> + panel-width-mm = <256>; >> + panel-height-mm = <144>; >> + }; >> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig >> index 4ec874d..3743947 100644 >> --- a/drivers/gpu/drm/panel/Kconfig >> +++ b/drivers/gpu/drm/panel/Kconfig >> @@ -30,4 +30,22 @@ config DRM_PANEL_S6E8AA0 >> select DRM_MIPI_DSI >> select VIDEOMODE_HELPERS >> >> +config DRM_PANEL_LVDS >> + tristate "support for LVDS panels" >> + depends on OF && DRM_PANEL >> + help >> + DRM panel driver for LVDS connected via DP bridges that need at most >> + a regulator for LCD unit, a regulator for LED unit and/or enable >> + GPIOs for LCD or LED units. Delay values can also be >> + specified to support powerup and powerdown process. >> + >> +config DRM_PANEL_EDP >> + tristate "support for eDP panels" >> + depends on OF && DRM_PANEL >> + help >> + DRM panel driver for eDP panels that need at most a >> + regulator for LCD unit, a regulator for LED unit and/or enable >> + GPIOs for LCD or LED units. Delay values can also be >> + specified to support powerup and powerdown process. >> + >> endmenu >> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile >> index 8b92921..9c4f120 100644 >> --- a/drivers/gpu/drm/panel/Makefile >> +++ b/drivers/gpu/drm/panel/Makefile >> @@ -1,3 +1,5 @@ >> obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o >> obj-$(CONFIG_DRM_PANEL_LD9040) += panel-ld9040.o >> obj-$(CONFIG_DRM_PANEL_S6E8AA0) += panel-s6e8aa0.o >> +obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o >> +obj-$(CONFIG_DRM_PANEL_EDP) += panel-lvds.o >> diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c >> new file mode 100644 >> index 0000000..4dfb322 >> --- /dev/null >> +++ b/drivers/gpu/drm/panel/panel-lvds.c >> @@ -0,0 +1,262 @@ >> +/* >> + * panel driver for lvds and eDP panels >> + * >> + * Copyright (c) 2014 Samsung Electronics Co., Ltd >> + * >> + * Ajay Kumar <ajaykumar.rs-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License version 2 as >> + * published by the Free Software Foundation. >> + */ >> + >> +#include <linux/gpio.h> >> +#include <linux/module.h> >> +#include <linux/of_gpio.h> >> +#include <linux/of_platform.h> >> +#include <linux/platform_device.h> >> +#include <linux/regulator/consumer.h> >> + >> +#include <video/of_videomode.h> >> +#include <video/videomode.h> >> + >> +#include <drm/drmP.h> >> +#include <drm/drm_crtc.h> >> +#include <drm/drm_panel.h> >> + >> +struct panel_lvds { >> + struct drm_panel base; >> + struct regulator *backlight_fet; >> + struct regulator *lcd_fet; >> + struct videomode vm; >> + int width_mm; >> + int height_mm; >> + bool backlight_fet_enabled; >> + bool lcd_fet_enabled; >> + int led_en_gpio; >> + int lcd_en_gpio; >> + int panel_prepare_delay; >> + int panel_enable_delay; >> + int panel_disable_delay; >> + int panel_unprepare_delay; >> +}; >> + >> +static inline struct panel_lvds *to_panel(struct drm_panel *panel) >> +{ >> + return container_of(panel, struct panel_lvds, base); >> +} >> + >> +static int panel_lvds_prepare(struct drm_panel *panel) >> +{ >> + struct panel_lvds *lvds_panel = to_panel(panel); >> + >> + if (!IS_ERR_OR_NULL(lvds_panel->lcd_fet)) >> + if (!lvds_panel->lcd_fet_enabled) { >> + if (regulator_enable(lvds_panel->lcd_fet)) >> + DRM_ERROR("failed to enable LCD fet\n"); >> + lvds_panel->lcd_fet_enabled = true; >> + } >> + >> + if (gpio_is_valid(lvds_panel->lcd_en_gpio)) >> + gpio_set_value(lvds_panel->lcd_en_gpio, 1); >> + >> + msleep(lvds_panel->panel_prepare_delay); >> + >> + return 0; >> +} >> + >> +static int panel_lvds_enable(struct drm_panel *panel) >> +{ >> + struct panel_lvds *lvds_panel = to_panel(panel); >> + >> + if (!IS_ERR_OR_NULL(lvds_panel->backlight_fet)) >> + if (!lvds_panel->backlight_fet_enabled) { >> + if (regulator_enable(lvds_panel->backlight_fet)) >> + DRM_ERROR("failed to enable LED fet\n"); >> + lvds_panel->backlight_fet_enabled = true; >> + } >> + >> + msleep(lvds_panel->panel_enable_delay); >> + >> + if (gpio_is_valid(lvds_panel->led_en_gpio)) >> + gpio_set_value(lvds_panel->led_en_gpio, 1); >> + >> + return 0; >> +} >> + >> +static int panel_lvds_disable(struct drm_panel *panel) >> +{ >> + struct panel_lvds *lvds_panel = to_panel(panel); >> + >> + if (gpio_is_valid(lvds_panel->led_en_gpio)) >> + gpio_set_value(lvds_panel->led_en_gpio, 0); >> + >> + if (!IS_ERR_OR_NULL(lvds_panel->backlight_fet)) >> + if (lvds_panel->backlight_fet_enabled) { >> + regulator_disable(lvds_panel->backlight_fet); >> + lvds_panel->backlight_fet_enabled = false; >> + } >> + >> + msleep(lvds_panel->panel_disable_delay); >> + >> + return 0; >> +} >> + >> +static int panel_lvds_unprepare(struct drm_panel *panel) >> +{ >> + struct panel_lvds *lvds_panel = to_panel(panel); >> + >> + if (gpio_is_valid(lvds_panel->lcd_en_gpio)) >> + gpio_set_value(lvds_panel->lcd_en_gpio, 0); >> + >> + if (!IS_ERR_OR_NULL(lvds_panel->lcd_fet)) >> + if (lvds_panel->lcd_fet_enabled) { >> + regulator_disable(lvds_panel->lcd_fet); >> + lvds_panel->lcd_fet_enabled = false; >> + } >> + >> + msleep(lvds_panel->panel_unprepare_delay); >> + >> + return 0; >> +} >> + >> +static int panel_lvds_get_modes(struct drm_panel *panel) >> +{ >> + struct drm_connector *connector = panel->connector; >> + struct panel_lvds *lvds_panel = to_panel(panel); >> + struct drm_display_mode *mode; >> + >> + mode = drm_mode_create(connector->dev); >> + if (!mode) { >> + DRM_ERROR("failed to create a new display mode.\n"); >> + return 0; >> + } >> + >> + drm_display_mode_from_videomode(&lvds_panel->vm, mode); >> + mode->width_mm = lvds_panel->width_mm; >> + mode->height_mm = lvds_panel->height_mm; >> + connector->display_info.width_mm = mode->width_mm; >> + connector->display_info.height_mm = mode->height_mm; >> + >> + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; >> + drm_mode_set_name(mode); >> + drm_mode_probed_add(connector, mode); >> + >> + return 1; >> +} >> + >> +static const struct drm_panel_funcs panel_lvds_funcs = { >> + .unprepare = panel_lvds_unprepare, >> + .disable = panel_lvds_disable, >> + .prepare = panel_lvds_prepare, >> + .enable = panel_lvds_enable, >> + .get_modes = panel_lvds_get_modes, >> +}; >> + >> +static int panel_lvds_probe(struct platform_device *pdev) >> +{ >> + struct panel_lvds *panel; >> + struct device *dev = &pdev->dev; >> + struct device_node *node = dev->of_node; >> + int ret; >> + >> + panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL); >> + if (!panel) >> + return -ENOMEM; >> + >> + ret = of_get_videomode(node, &panel->vm, 0); >> + if (ret) { >> + DRM_ERROR("failed: of_get_videomode() : %d\n", ret); >> + return ret; >> + } >> + >> + panel->lcd_fet = devm_regulator_get_optional(dev, "lcd_vdd"); >> + if (IS_ERR(panel->lcd_fet)) >> + return -EPROBE_DEFER; >> + >> + panel->backlight_fet = devm_regulator_get_optional(dev, "vcd_led"); >> + if (IS_ERR(panel->backlight_fet)) >> + return -EPROBE_DEFER; >> + >> + panel->lcd_en_gpio = of_get_named_gpio(node, "lcd-en-gpio", 0); >> + panel->led_en_gpio = of_get_named_gpio(node, "led-en-gpio", 0); >> + >> + of_property_read_u32(node, "panel-width-mm", &panel->width_mm); >> + of_property_read_u32(node, "panel-height-mm", &panel->height_mm); >> + >> + of_property_read_u32(node, "panel-pre-enable-delay", >> + &panel->panel_prepare_delay); >> + of_property_read_u32(node, "panel-enable-delay", >> + &panel->panel_enable_delay); >> + of_property_read_u32(node, "panel-disable-delay", >> + &panel->panel_disable_delay); >> + of_property_read_u32(node, "panel-post-disable-delay", >> + &panel->panel_unprepare_delay); >> + >> + if (gpio_is_valid(panel->lcd_en_gpio)) { >> + ret = devm_gpio_request_one(dev, panel->lcd_en_gpio, >> + GPIOF_OUT_INIT_LOW, "lcd_en_gpio"); >> + if (ret) { >> + DRM_ERROR("failed to get lcd-en gpio [%d]\n", ret); >> + return 0; >> + } >> + } else { >> + panel->lcd_en_gpio = -ENODEV; >> + } >> + >> + if (gpio_is_valid(panel->led_en_gpio)) { >> + ret = devm_gpio_request_one(dev, panel->led_en_gpio, >> + GPIOF_OUT_INIT_LOW, "led_en_gpio"); >> + if (ret) { >> + DRM_ERROR("failed to get led-en gpio [%d]\n", ret); >> + return 0; >> + } >> + } else { >> + panel->led_en_gpio = -ENODEV; >> + } >> + >> + drm_panel_init(&panel->base); >> + panel->base.dev = dev; >> + panel->base.funcs = &panel_lvds_funcs; >> + >> + ret = drm_panel_add(&panel->base); >> + if (ret < 0) >> + return ret; >> + >> + dev_set_drvdata(dev, panel); >> + >> + return 0; >> +} >> + >> +static int panel_lvds_remove(struct platform_device *pdev) >> +{ >> + struct panel_lvds *panel = dev_get_drvdata(&pdev->dev); >> + >> + panel_lvds_disable(&panel->base); >> + panel_lvds_unprepare(&panel->base); >> + >> + drm_panel_remove(&panel->base); >> + >> + return 0; >> +} >> + >> +static const struct of_device_id lvds_panel_dt_match[] = { >> + { .compatible = "panel-lvds" }, >> + {}, >> +}; >> +MODULE_DEVICE_TABLE(of, lvds_panel_dt_match); >> + >> +struct platform_driver lvds_panel_driver = { >> + .driver = { >> + .name = "panel_lvds", >> + .owner = THIS_MODULE, >> + .of_match_table = lvds_panel_dt_match, >> + }, >> + .probe = panel_lvds_probe, >> + .remove = panel_lvds_remove, >> +}; >> +module_platform_driver(lvds_panel_driver); >> + >> +MODULE_AUTHOR("Ajay Kumar <ajaykumar.rs-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>"); >> +MODULE_DESCRIPTION("lvds/eDP panel driver"); >> +MODULE_LICENSE("GPL v2"); >> -- >> 1.7.9.5 >> -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <1401995452-15798-7-git-send-email-ajaykumar.rs@samsung.com>]
[parent not found: <CAEC9eQMqQe3Z5iLuURO6U34pONjrPd3cZ-Ehjaw8mQDKGPD8vg@mail.gmail.com>]
* Re: [PATCH V3 6/8] drm/exynos: dp: Modify driver to support bridge chaining [not found] ` <CAEC9eQMqQe3Z5iLuURO6U34pONjrPd3cZ-Ehjaw8mQDKGPD8vg@mail.gmail.com> @ 2014-06-05 19:22 ` Ajay kumar 0 siblings, 0 replies; 3+ messages in thread From: Ajay kumar @ 2014-06-05 19:22 UTC (permalink / raw) To: devicetree Cc: Ajay Kumar, dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Dae, Sean Paul, Jingoo Han, Rob Clark, Daniel Vetter, Thierry Reding, sunil joshi, Prashanth G On Fri, Jun 6, 2014 at 12:48 AM, Ajay kumar <ajaynumb@gmail.com> wrote: > +Device tree list > > On Fri, Jun 6, 2014 at 12:40 AM, Ajay Kumar <ajaykumar.rs@samsung.com> wrote: >> exynos_dp supports a simple bridge chain with ptn3460 bridge >> and an LVDS panel attached to it. >> This patch creates the bridge chain with ptn3460 as the head >> of the list and panel_binder being the tail. >> >> Also, DERER_PROBE for exynos_dp is tested with this patch. >> >> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com> >> --- >> .../devicetree/bindings/video/exynos_dp.txt | 2 + >> drivers/gpu/drm/exynos/Kconfig | 1 + >> drivers/gpu/drm/exynos/exynos_dp_core.c | 39 +++++++++++++++----- >> drivers/gpu/drm/exynos/exynos_dp_core.h | 1 + >> 4 files changed, 34 insertions(+), 9 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt b/Documentation/devicetree/bindings/video/exynos_dp.txt >> index 53dbccf..0c118ff 100644 >> --- a/Documentation/devicetree/bindings/video/exynos_dp.txt >> +++ b/Documentation/devicetree/bindings/video/exynos_dp.txt >> @@ -51,6 +51,8 @@ Required properties for dp-controller: >> LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4 >> - display-timings: timings for the connected panel as described by >> Documentation/devicetree/bindings/video/display-timing.txt >> + -edp-panel: >> + phandle for the drm_panel node required by panel_binder. >> >> Optional properties for dp-controller: >> -interlaced: >> diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig >> index 178d2a9..fd1c070 100644 >> --- a/drivers/gpu/drm/exynos/Kconfig >> +++ b/drivers/gpu/drm/exynos/Kconfig >> @@ -52,6 +52,7 @@ config DRM_EXYNOS_DP >> bool "EXYNOS DRM DP driver support" >> depends on DRM_EXYNOS_FIMD && ARCH_EXYNOS && (DRM_PTN3460=n || DRM_PTN3460=y || DRM_PTN3460=DRM_EXYNOS) >> default DRM_EXYNOS >> + select DRM_PANEL >> help >> This enables support for DP device. >> >> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c >> index 414f5e5..a608f5c 100644 >> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c >> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c >> @@ -28,7 +28,9 @@ >> #include <drm/drmP.h> >> #include <drm/drm_crtc.h> >> #include <drm/drm_crtc_helper.h> >> +#include <drm/drm_panel.h> >> #include <drm/bridge/ptn3460.h> >> +#include <drm/bridge/panel_binder.h> >> >> #include "exynos_drm_drv.h" >> #include "exynos_dp_core.h" >> @@ -983,7 +985,7 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, >> struct drm_encoder *encoder) >> { >> struct bridge_init bridge; >> - struct drm_bridge *bridge_chain = NULL; >> + struct drm_bridge *bridge_chain = NULL, *next = NULL; >> bool connector_created = false; >> >> if (find_bridge("nxp,ptn3460", &bridge)) { >> @@ -991,6 +993,14 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, >> bridge.node); >> } >> >> + if (dp->edp_panel) { >> + next = panel_binder_init(dp->drm_dev, encoder, bridge.client, >> + bridge.node, dp->edp_panel, DRM_CONNECTOR_POLL_HPD); >> + if (next) >> + connector_created = true; >> + drm_bridge_add_to_chain(bridge_chain, next); >> + } >> + >> return connector_created; >> } >> >> @@ -1215,16 +1225,10 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) >> struct platform_device *pdev = to_platform_device(dev); >> struct drm_device *drm_dev = data; >> struct resource *res; >> - struct exynos_dp_device *dp; >> + struct exynos_dp_device *dp = exynos_dp_display.ctx; >> unsigned int irq_flags; >> - >> int ret = 0; >> >> - dp = devm_kzalloc(&pdev->dev, sizeof(struct exynos_dp_device), >> - GFP_KERNEL); >> - if (!dp) >> - return -ENOMEM; >> - >> dp->dev = &pdev->dev; >> dp->dpms_mode = DRM_MODE_DPMS_OFF; >> >> @@ -1298,7 +1302,6 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) >> disable_irq(dp->irq); >> >> dp->drm_dev = drm_dev; >> - exynos_dp_display.ctx = dp; >> >> platform_set_drvdata(pdev, &exynos_dp_display); >> >> @@ -1325,6 +1328,9 @@ static const struct component_ops exynos_dp_ops = { >> >> static int exynos_dp_probe(struct platform_device *pdev) >> { >> + struct device *dev = &pdev->dev; >> + struct device_node *panel_node; >> + struct exynos_dp_device *dp; >> int ret; >> >> ret = exynos_drm_component_add(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR, >> @@ -1332,6 +1338,21 @@ static int exynos_dp_probe(struct platform_device *pdev) >> if (ret) >> return ret; >> >> + dp = devm_kzalloc(&pdev->dev, sizeof(struct exynos_dp_device), >> + GFP_KERNEL); >> + if (!dp) >> + return -ENOMEM; >> + >> + panel_node = of_parse_phandle(dev->of_node, "edp-panel", 0); >> + if (panel_node) { >> + dp->edp_panel = of_drm_find_panel(panel_node); >> + of_node_put(panel_node); >> + if (!dp->edp_panel) >> + return -EPROBE_DEFER; >> + } >> + >> + exynos_dp_display.ctx = dp; >> + >> ret = component_add(&pdev->dev, &exynos_dp_ops); >> if (ret) >> exynos_drm_component_del(&pdev->dev, >> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h >> index 02cc4f9..26a64d3 100644 >> --- a/drivers/gpu/drm/exynos/exynos_dp_core.h >> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h >> @@ -149,6 +149,7 @@ struct exynos_dp_device { >> struct drm_device *drm_dev; >> struct drm_connector connector; >> struct drm_encoder *encoder; >> + struct drm_panel *edp_panel; >> struct clk *clock; >> unsigned int irq; >> void __iomem *reg_base; >> -- >> 1.7.9.5 >> ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-05 19:22 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1401995452-15798-1-git-send-email-ajaykumar.rs@samsung.com> [not found] ` <1401995452-15798-8-git-send-email-ajaykumar.rs@samsung.com> [not found] ` <CAEC9eQNy5CLtoVgdE23uJWrNBRx5C0v60fkwOEATpmz2=Q8N7A@mail.gmail.com> [not found] ` <CAEC9eQNy5CLtoVgdE23uJWrNBRx5C0v60fkwOEATpmz2=Q8N7A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2014-06-05 19:21 ` [PATCH V3 7/8] drm/bridge: Add ps8622/ps8625 bridge driver Ajay kumar [not found] ` <1401995452-15798-6-git-send-email-ajaykumar.rs@samsung.com> [not found] ` <CAEC9eQNamrF7G0kQ6J=R5DgvMn_zX1X6D2f7pegkRKxQ7LMfLQ@mail.gmail.com> [not found] ` <CAEC9eQNamrF7G0kQ6J=R5DgvMn_zX1X6D2f7pegkRKxQ7LMfLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2014-06-05 19:21 ` [PATCH V3 5/8] drm/panel: Add driver for lvds/edp based panels Ajay kumar [not found] ` <1401995452-15798-7-git-send-email-ajaykumar.rs@samsung.com> [not found] ` <CAEC9eQMqQe3Z5iLuURO6U34pONjrPd3cZ-Ehjaw8mQDKGPD8vg@mail.gmail.com> 2014-06-05 19:22 ` [PATCH V3 6/8] drm/exynos: dp: Modify driver to support bridge chaining Ajay kumar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).