* [PATCH 0/3] OMAPDSS: HDMI: HDMI Hot-plug detect support. @ 2012-01-06 12:44 mythripk 2012-01-06 12:44 ` [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile mythripk 0 siblings, 1 reply; 8+ messages in thread From: mythripk @ 2012-01-06 12:44 UTC (permalink / raw) To: tomi.valkeinen, linux-omap; +Cc: Mythri P K From: Mythri P K <mythripk@ti.com> HDMI phy should be in the LDO_ON state when cable is not connected. Only when cable is connected and transmission is possible HDMI Phy should move to TX_ON state. This is supported by the Hot-plug feature. Now when HDMI is enabled the following steps are followed: -It registers to the GPIO irq handler -If an HPD interrupt is received the corresponding IRQ handler is called where it checks if it is a connect / disconnect based on which PHY is moved to appropriate state. Mythri P K (3): OMAPDSS: HDMI: HPD support in boardfile OMAPDSS: HDMI: Handle HPD event in ip OMAPDSS: HDMI: HPD support added to HDMI driver arch/arm/mach-omap2/board-4430sdp.c | 37 +++++----------- arch/arm/mach-omap2/board-omap4panda.c | 37 +++++----------- arch/arm/mach-omap2/display.c | 21 ++++++++-- drivers/video/omap2/dss/dss_features.c | 1 + drivers/video/omap2/dss/hdmi.c | 65 ++++++++++++++++++++++------- drivers/video/omap2/dss/ti_hdmi.h | 4 ++ drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 31 +++++++++++-- include/video/omapdss.h | 6 ++- 8 files changed, 126 insertions(+), 76 deletions(-) -- 1.7.5.4 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile 2012-01-06 12:44 [PATCH 0/3] OMAPDSS: HDMI: HDMI Hot-plug detect support mythripk @ 2012-01-06 12:44 ` mythripk 2012-01-06 12:44 ` [PATCH v2 2/3] OMAPDSS: HDMI: Handle HPD event in ip mythripk 2012-01-10 7:37 ` [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile Tomi Valkeinen 0 siblings, 2 replies; 8+ messages in thread From: mythripk @ 2012-01-06 12:44 UTC (permalink / raw) To: tomi.valkeinen, linux-omap; +Cc: Mythri P K From: Mythri P K <mythripk@ti.com> Add support for HPD GPIO configuration in board file. Also remove the enabling of GPIO's required for HDMI from hdmi driver file to display.c based on the GPIO #'s sent from board file. Signed-off-by: Mythri P K <mythripk@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> --- arch/arm/mach-omap2/board-4430sdp.c | 37 ++++++++++--------------------- arch/arm/mach-omap2/board-omap4panda.c | 37 +++++++++---------------------- arch/arm/mach-omap2/display.c | 21 ++++++++++++++--- drivers/video/omap2/dss/hdmi.c | 16 +------------- include/video/omapdss.h | 6 ++++- 5 files changed, 46 insertions(+), 71 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 4af874a..d6b647d 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -52,8 +52,9 @@ #define ETH_KS8851_QUART 138 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184 #define OMAP4_SFH7741_ENABLE_GPIO 188 -#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */ +#define HDMI_GPIO_CT_CP_HPD 60 /* Hot plug pin for HDMI */ #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ +#define HDMI_GPIO_HPD 63 #define DISPLAY_SEL_GPIO 59 /* LCD2/PicoDLP switch */ #define DLP_POWER_ON_GPIO 40 @@ -596,27 +597,11 @@ static void __init omap_sfh7741prox_init(void) } static struct gpio sdp4430_hdmi_gpios[] = { - { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" }, - { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, + { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" }, + { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, + { HDMI_GPIO_HPD, GPIOF_DIR_IN, "hdmi_gpio_hpd" }, }; -static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev) -{ - int status; - - status = gpio_request_array(sdp4430_hdmi_gpios, - ARRAY_SIZE(sdp4430_hdmi_gpios)); - if (status) - pr_err("%s: Cannot request HDMI GPIOs\n", __func__); - - return status; -} - -static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev) -{ - gpio_free(HDMI_GPIO_LS_OE); - gpio_free(HDMI_GPIO_HPD); -} static struct nokia_dsi_panel_data dsi1_panel = { .name = "taal", @@ -735,9 +720,8 @@ static struct omap_dss_device sdp4430_hdmi_device = { .name = "hdmi", .driver_name = "hdmi_panel", .type = OMAP_DISPLAY_TYPE_HDMI, - .platform_enable = sdp4430_panel_enable_hdmi, - .platform_disable = sdp4430_panel_disable_hdmi, .channel = OMAP_DSS_CHANNEL_DIGIT, + .hpd_gpio = 63, }; static struct picodlp_panel_data sdp4430_picodlp_pdata = { @@ -830,10 +814,13 @@ static void omap_4430sdp_display_init(void) * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and * later have external pull up on the HDMI I2C lines */ - if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2) - omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP); + if (cpu_is_omap446x() || (omap_rev() > OMAP4430_REV_ES2_2)) + omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP, HDMI_GPIO_HPD, + sdp4430_hdmi_gpios, + ARRAY_SIZE(sdp4430_hdmi_gpios)); else - omap_hdmi_init(0); + omap_hdmi_init(0, HDMI_GPIO_HPD, sdp4430_hdmi_gpios, + ARRAY_SIZE(sdp4430_hdmi_gpios)); } #ifdef CONFIG_OMAP_MUX diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index 00103e3..d60c674 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c @@ -51,8 +51,9 @@ #define GPIO_HUB_NRESET 62 #define GPIO_WIFI_PMENA 43 #define GPIO_WIFI_IRQ 53 -#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */ +#define HDMI_GPIO_CT_CP_HPD 60 /* Hot plug pin for HDMI */ #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ +#define HDMI_GPIO_HPD 63 /* wl127x BT, FM, GPS connectivity chip */ static int wl1271_gpios[] = {46, -1, -1}; @@ -479,35 +480,17 @@ int __init omap4_panda_dvi_init(void) } static struct gpio panda_hdmi_gpios[] = { - { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" }, - { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, + { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" }, + { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, + { HDMI_GPIO_HPD, GPIOF_DIR_IN, "hdmi_gpio_hpd" }, }; -static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev) -{ - int status; - - status = gpio_request_array(panda_hdmi_gpios, - ARRAY_SIZE(panda_hdmi_gpios)); - if (status) - pr_err("Cannot request HDMI GPIOs\n"); - - return status; -} - -static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev) -{ - gpio_free(HDMI_GPIO_LS_OE); - gpio_free(HDMI_GPIO_HPD); -} - static struct omap_dss_device omap4_panda_hdmi_device = { .name = "hdmi", .driver_name = "hdmi_panel", .type = OMAP_DISPLAY_TYPE_HDMI, - .platform_enable = omap4_panda_panel_enable_hdmi, - .platform_disable = omap4_panda_panel_disable_hdmi, .channel = OMAP_DSS_CHANNEL_DIGIT, + .hpd_gpio = 63, }; static struct omap_dss_device *omap4_panda_dss_devices[] = { @@ -546,10 +529,12 @@ void omap4_panda_display_init(void) * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and * later have external pull up on the HDMI I2C lines */ - if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2) - omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP); + if (cpu_is_omap446x() || (omap_rev() > OMAP4430_REV_ES2_2)) + omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP, HDMI_GPIO_HPD, + panda_hdmi_gpios, ARRAY_SIZE(panda_hdmi_gpios)); else - omap_hdmi_init(0); + omap_hdmi_init(0, HDMI_GPIO_HPD, panda_hdmi_gpios, + ARRAY_SIZE(panda_hdmi_gpios)); } static void __init omap4_panda_init(void) diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index ffd9bd9..7fdd0d3 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c @@ -29,6 +29,7 @@ #include <plat/omap-pm.h> #include <plat/common.h> +#include <linux/gpio.h> #include "mux.h" #include "control.h" #include "display.h" @@ -97,14 +98,14 @@ static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initdata = { { "dss_hdmi", "omapdss_hdmi", -1 }, }; -static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags) +static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags, int hpd_gpio) { u32 reg; u16 control_i2c_1; /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */ omap_mux_init_signal("hdmi_hpd", - OMAP_PIN_INPUT_PULLUP); + OMAP_PIN_INPUT_PULLDOWN); omap_mux_init_signal("hdmi_cec", OMAP_PIN_INPUT_PULLUP); /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */ @@ -112,6 +113,10 @@ static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags) OMAP_PIN_INPUT_PULLUP); omap_mux_init_signal("hdmi_ddc_sda", OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal("gpmc_wait2.gpio_100", + OMAP_PIN_INPUT_PULLDOWN); + /* HPD GPIO needs to be muxed*/ + omap_mux_init_gpio(hpd_gpio, OMAP_PIN_INPUT | OMAP_PULL_ENA); /* * CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and @@ -160,10 +165,18 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes) return 0; } -int omap_hdmi_init(enum omap_hdmi_flags flags) +int omap_hdmi_init(enum omap_hdmi_flags flags, int hpd_gpio, + struct gpio hdmi_gpios[], int size) { + int status; + + status = gpio_request_array(hdmi_gpios, size); + if (status) { + pr_err("%s: Cannot request HDMI GPIOs\n", __func__); + return status; + } if (cpu_is_omap44xx()) - omap4_hdmi_mux_pads(flags); + omap4_hdmi_mux_pads(flags, hpd_gpio); return 0; } diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 65397f7..29de79f 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -515,26 +515,15 @@ int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) goto err0; } - if (dssdev->platform_enable) { - r = dssdev->platform_enable(dssdev); - if (r) { - DSSERR("failed to enable GPIO's\n"); - goto err1; - } - } - r = hdmi_power_on(dssdev); if (r) { DSSERR("failed to power on device\n"); - goto err2; + goto err1; } mutex_unlock(&hdmi.lock); return 0; -err2: - if (dssdev->platform_disable) - dssdev->platform_disable(dssdev); err1: omap_dss_stop_device(dssdev); err0: @@ -550,9 +539,6 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev) hdmi_power_off(dssdev); - if (dssdev->platform_disable) - dssdev->platform_disable(dssdev); - omap_dss_stop_device(dssdev); mutex_unlock(&hdmi.lock); diff --git a/include/video/omapdss.h b/include/video/omapdss.h index 29f4e78..a0aa12a 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -21,6 +21,7 @@ #include <linux/list.h> #include <linux/kobject.h> #include <linux/device.h> +#include <linux/gpio.h> #define DISPC_IRQ_FRAMEDONE (1 << 0) #define DISPC_IRQ_VSYNC (1 << 1) @@ -319,7 +320,8 @@ struct omap_dss_board_info { /* Init with the board info */ extern int omap_display_init(struct omap_dss_board_info *board_data); /* HDMI mux init*/ -extern int omap_hdmi_init(enum omap_hdmi_flags flags); +extern int omap_hdmi_init(enum omap_hdmi_flags flags, int hpd_gpio, + struct gpio hdmi_gpios[], int size); struct omap_display_platform_data { struct omap_dss_board_info *board_data; @@ -568,6 +570,8 @@ struct omap_dss_device { int reset_gpio; + int hpd_gpio; + int max_backlight_level; const char *name; -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/3] OMAPDSS: HDMI: Handle HPD event in ip 2012-01-06 12:44 ` [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile mythripk @ 2012-01-06 12:44 ` mythripk 2012-01-06 12:44 ` [PATCH v2 3/3] OMAPDSS: HDMI: HPD support added to HDMI driver mythripk 2012-01-10 7:37 ` [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile Tomi Valkeinen 1 sibling, 1 reply; 8+ messages in thread From: mythripk @ 2012-01-06 12:44 UTC (permalink / raw) To: tomi.valkeinen, linux-omap; +Cc: Mythri P K From: Mythri P K <mythripk@ti.com> HPD event is notified to ip file and based on the notification appropriate action is taken. As the PHY should be in LDO_ON state and not TX_ON (transmission), this transition is handled in ip file. Signed-off-by: Mythri P K <mythripk@ti.com> --- drivers/video/omap2/dss/ti_hdmi.h | 4 +++ drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 31 ++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h index 9a31683..eba2ed4 100644 --- a/drivers/video/omap2/dss/ti_hdmi.h +++ b/drivers/video/omap2/dss/ti_hdmi.h @@ -113,6 +113,8 @@ struct ti_hdmi_ip_ops { int (*configure_range)(struct hdmi_ip_data *ip_data); + int (*notify_hpd)(struct hdmi_ip_data *ip_data, int hpd_state); + }; /* @@ -167,6 +169,7 @@ struct hdmi_ip_data { struct hdmi_pll_info pll_data; struct hdmi_core_infoframe_avi avi_cfg; enum hdmi_range range; + bool hdmi_phy_tx_enabled; }; int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data); void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data); @@ -185,4 +188,5 @@ void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s); void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable); #endif int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data); +int ti_hdmi_4xxx_notify_hpd(struct hdmi_ip_data *ip_data, bool hpd_state); #endif diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c index 58c5782..10c845d 100644 --- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c +++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c @@ -223,15 +223,11 @@ void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data) hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF); } -int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data) +int ti_hdmi_4xxx_phy_poweron(struct hdmi_ip_data *ip_data) { u16 r = 0; void __iomem *phy_base = hdmi_phy_base(ip_data); - r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON); - if (r) - return r; - r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON); if (r) return r; @@ -260,11 +256,36 @@ int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data) return 0; } +int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data) +{ + int r = 0; + + r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON); + + return r; +} + void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data) { hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF); } +int ti_hdmi_4xxx_notify_hpd(struct hdmi_ip_data *ip_data, bool hpd_state) +{ + int r = 0; + + if (hpd_state != ip_data->hdmi_phy_tx_enabled) { + if (hpd_state) + r = ti_hdmi_4xxx_phy_poweron(ip_data); + else + r = ti_hdmi_4xxx_phy_enable(ip_data); + if (!r) + ip_data->hdmi_phy_tx_enabled = hpd_state; + } + + return r; +} + static int hdmi_core_ddc_init(struct hdmi_ip_data *ip_data) { void __iomem *base = hdmi_core_sys_base(ip_data); -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/3] OMAPDSS: HDMI: HPD support added to HDMI driver 2012-01-06 12:44 ` [PATCH v2 2/3] OMAPDSS: HDMI: Handle HPD event in ip mythripk @ 2012-01-06 12:44 ` mythripk 2012-01-10 7:58 ` Shubhrajyoti 0 siblings, 1 reply; 8+ messages in thread From: mythripk @ 2012-01-06 12:44 UTC (permalink / raw) To: tomi.valkeinen, linux-omap; +Cc: Mythri P K From: Mythri P K <mythripk@ti.com> GPIO based handling of connect/disconnect of the HDMI cable (Hot-plug detect)is added to the HDMI driver. Signed-off-by: Mythri P K <mythripk@ti.com> --- drivers/video/omap2/dss/dss_features.c | 1 + drivers/video/omap2/dss/hdmi.c | 49 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 0 deletions(-) diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c index 544b172..ef3f666 100644 --- a/drivers/video/omap2/dss/dss_features.c +++ b/drivers/video/omap2/dss/dss_features.c @@ -477,6 +477,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = { .audio_enable = ti_hdmi_4xxx_wp_audio_enable, #endif .configure_range = ti_hdmi_4xxx_configure_range, + .notify_hpd = ti_hdmi_4xxx_notify_hpd, }; diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 29de79f..4c3110d 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -66,6 +66,9 @@ static struct { struct omap_display_platform_data *pdata; struct platform_device *pdev; struct hdmi_ip_data ip_data; + struct omap_dss_device *dssdev; + + bool hpd; struct clk *sys_clk; } hdmi; @@ -461,6 +464,29 @@ void hdmi_dump_regs(struct seq_file *s) mutex_unlock(&hdmi.lock); } +static int hdmi_get_current_hpd(void) +{ + return gpio_get_value(hdmi.dssdev->hpd_gpio); +} + +static irqreturn_t hpd_enable_handler(int irq, void *ptr) +{ + DSSDBG("hpd enable %d\n", hdmi.hpd); + + hdmi.ip_data.ops->notify_hpd(&hdmi.ip_data, hdmi.hpd); + + return IRQ_HANDLED; +} + +static irqreturn_t hpd_irq_handler(int irq, void *ptr) +{ + if (hdmi.dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { + hdmi.hpd = hdmi_get_current_hpd(); + return IRQ_WAKE_THREAD; + } + return IRQ_HANDLED; +} + int omapdss_hdmi_read_edid(u8 *buf, int len) { int r; @@ -782,11 +808,22 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) { struct resource *hdmi_mem; int r; + struct omap_dss_board_info *board_data; hdmi.pdata = pdev->dev.platform_data; hdmi.pdev = pdev; mutex_init(&hdmi.lock); + /* save reference to HDMI device */ + board_data = hdmi.pdata->board_data; + for (r = 0; r < board_data->num_devices; r++) { + if (board_data->devices[r]->type == OMAP_DISPLAY_TYPE_HDMI) + hdmi.dssdev = board_data->devices[r]; + } + if (!hdmi.dssdev) { + DSSERR("can't get HDMI device\n"); + return -EINVAL; + } hdmi_mem = platform_get_resource(hdmi.pdev, IORESOURCE_MEM, 0); if (!hdmi_mem) { @@ -810,6 +847,16 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); + r = request_threaded_irq(gpio_to_irq(hdmi.dssdev->hpd_gpio), + hpd_irq_handler, hpd_enable_handler, + IRQF_DISABLED | IRQF_TRIGGER_RISING | + IRQF_TRIGGER_FALLING, "hpd", NULL); + if (r < 0) { + pr_err("hdmi: request_irq %d failed\n", + gpio_to_irq(hdmi.dssdev->hpd_gpio)); + return -EINVAL; + } + hdmi.ip_data.core_sys_offset = HDMI_CORE_SYS; hdmi.ip_data.core_av_offset = HDMI_CORE_AV; hdmi.ip_data.pll_offset = HDMI_PLLCTRL; @@ -840,6 +887,8 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev) snd_soc_unregister_codec(&pdev->dev); #endif + free_irq(gpio_to_irq(hdmi.dssdev->hpd_gpio), hpd_irq_handler); + pm_runtime_disable(&pdev->dev); hdmi_put_clocks(); -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 3/3] OMAPDSS: HDMI: HPD support added to HDMI driver 2012-01-06 12:44 ` [PATCH v2 3/3] OMAPDSS: HDMI: HPD support added to HDMI driver mythripk @ 2012-01-10 7:58 ` Shubhrajyoti 0 siblings, 0 replies; 8+ messages in thread From: Shubhrajyoti @ 2012-01-10 7:58 UTC (permalink / raw) To: mythripk; +Cc: tomi.valkeinen, linux-omap Hi Mythri, On Friday 06 January 2012 06:14 PM, mythripk@ti.com wrote: > From: Mythri P K <mythripk@ti.com> > > GPIO based handling of connect/disconnect of the HDMI cable > (Hot-plug detect)is added to the HDMI driver. > > Signed-off-by: Mythri P K <mythripk@ti.com> > --- > drivers/video/omap2/dss/dss_features.c | 1 + > drivers/video/omap2/dss/hdmi.c | 49 ++++++++++++++++++++++++++++++++ > 2 files changed, 50 insertions(+), 0 deletions(-) > > diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c > index 544b172..ef3f666 100644 > --- a/drivers/video/omap2/dss/dss_features.c > +++ b/drivers/video/omap2/dss/dss_features.c > @@ -477,6 +477,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = { > .audio_enable = ti_hdmi_4xxx_wp_audio_enable, > #endif > .configure_range = ti_hdmi_4xxx_configure_range, > + .notify_hpd = ti_hdmi_4xxx_notify_hpd, > > }; > > diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c > index 29de79f..4c3110d 100644 > --- a/drivers/video/omap2/dss/hdmi.c > +++ b/drivers/video/omap2/dss/hdmi.c > @@ -66,6 +66,9 @@ static struct { > struct omap_display_platform_data *pdata; > struct platform_device *pdev; > struct hdmi_ip_data ip_data; > + struct omap_dss_device *dssdev; > + > + bool hpd; > > struct clk *sys_clk; > } hdmi; > @@ -461,6 +464,29 @@ void hdmi_dump_regs(struct seq_file *s) > mutex_unlock(&hdmi.lock); > } > > +static int hdmi_get_current_hpd(void) > +{ > + return gpio_get_value(hdmi.dssdev->hpd_gpio); > +} > + > +static irqreturn_t hpd_enable_handler(int irq, void *ptr) > +{ > + DSSDBG("hpd enable %d\n", hdmi.hpd); > + > + hdmi.ip_data.ops->notify_hpd(&hdmi.ip_data, hdmi.hpd); > + > + return IRQ_HANDLED; > +} > + > +static irqreturn_t hpd_irq_handler(int irq, void *ptr) > +{ > + if (hdmi.dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { > + hdmi.hpd = hdmi_get_current_hpd(); > + return IRQ_WAKE_THREAD; > + } > + return IRQ_HANDLED; > +} > + > int omapdss_hdmi_read_edid(u8 *buf, int len) > { > int r; > @@ -782,11 +808,22 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) > { > struct resource *hdmi_mem; > int r; > + struct omap_dss_board_info *board_data; > > hdmi.pdata = pdev->dev.platform_data; > hdmi.pdev = pdev; > > mutex_init(&hdmi.lock); > + /* save reference to HDMI device */ > + board_data = hdmi.pdata->board_data; > + for (r = 0; r < board_data->num_devices; r++) { > + if (board_data->devices[r]->type == OMAP_DISPLAY_TYPE_HDMI) > + hdmi.dssdev = board_data->devices[r]; > + } > + if (!hdmi.dssdev) { > + DSSERR("can't get HDMI device\n"); > + return -EINVAL; > + } > > hdmi_mem = platform_get_resource(hdmi.pdev, IORESOURCE_MEM, 0); > if (!hdmi_mem) { > @@ -810,6 +847,16 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) > > pm_runtime_enable(&pdev->dev); > > + r = request_threaded_irq(gpio_to_irq(hdmi.dssdev->hpd_gpio), > + hpd_irq_handler, hpd_enable_handler, > + IRQF_DISABLED | IRQF_TRIGGER_RISING | Why is IRQF_DISABLED needed? > + IRQF_TRIGGER_FALLING, "hpd", NULL); > + if (r < 0) { > + pr_err("hdmi: request_irq %d failed\n", > + gpio_to_irq(hdmi.dssdev->hpd_gpio)); > + return -EINVAL; Could we return the error from request_threaded_irq instead of masking with EINVAL. > + } > + > hdmi.ip_data.core_sys_offset = HDMI_CORE_SYS; > hdmi.ip_data.core_av_offset = HDMI_CORE_AV; > hdmi.ip_data.pll_offset = HDMI_PLLCTRL; > @@ -840,6 +887,8 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev) > snd_soc_unregister_codec(&pdev->dev); > #endif > > + free_irq(gpio_to_irq(hdmi.dssdev->hpd_gpio), hpd_irq_handler); > + > pm_runtime_disable(&pdev->dev); > > hdmi_put_clocks(); ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile 2012-01-06 12:44 ` [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile mythripk 2012-01-06 12:44 ` [PATCH v2 2/3] OMAPDSS: HDMI: Handle HPD event in ip mythripk @ 2012-01-10 7:37 ` Tomi Valkeinen 2012-01-10 7:43 ` Tomi Valkeinen 1 sibling, 1 reply; 8+ messages in thread From: Tomi Valkeinen @ 2012-01-10 7:37 UTC (permalink / raw) To: mythripk; +Cc: linux-omap [-- Attachment #1: Type: text/plain, Size: 3389 bytes --] On Fri, 2012-01-06 at 18:14 +0530, mythripk@ti.com wrote: > From: Mythri P K <mythripk@ti.com> > > Add support for HPD GPIO configuration in board file. > Also remove the enabling of GPIO's required for HDMI from > hdmi driver file to display.c based on the GPIO #'s sent from > board file. > > Signed-off-by: Mythri P K <mythripk@ti.com> > Acked-by: Tony Lindgren <tony@atomide.com> > --- You are doing too much in this patch. This changes the HPD gpio to CT_CP_HPD, changes how gpios are allocated, moves gpio allocation into another file, changes the pulls of the gpios, introduces a new field into dss device... You should do just one logical thing in a patch. > -static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags) > +static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags, int hpd_gpio) > { > u32 reg; > u16 control_i2c_1; > > /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */ > omap_mux_init_signal("hdmi_hpd", > - OMAP_PIN_INPUT_PULLUP); > + OMAP_PIN_INPUT_PULLDOWN); Is the "hdmi_hpd" always the same pin? If so, it can be handled in display.c, no need to handle it in the board files. > omap_mux_init_signal("hdmi_cec", > OMAP_PIN_INPUT_PULLUP); > /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */ > @@ -112,6 +113,10 @@ static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags) > OMAP_PIN_INPUT_PULLUP); > omap_mux_init_signal("hdmi_ddc_sda", > OMAP_PIN_INPUT_PULLUP); > + omap_mux_init_signal("gpmc_wait2.gpio_100", > + OMAP_PIN_INPUT_PULLDOWN); Hmm, what is "gpmc_wait2.gpio_100"? > + /* HPD GPIO needs to be muxed*/ > + omap_mux_init_gpio(hpd_gpio, OMAP_PIN_INPUT | OMAP_PULL_ENA); Isn't this the same as the "hdmi_hpd" case above? Why are both needed? > /* > * CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and > @@ -160,10 +165,18 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes) > return 0; > } > > -int omap_hdmi_init(enum omap_hdmi_flags flags) > +int omap_hdmi_init(enum omap_hdmi_flags flags, int hpd_gpio, > + struct gpio hdmi_gpios[], int size) > { > + int status; > + > + status = gpio_request_array(hdmi_gpios, size); > + if (status) { > + pr_err("%s: Cannot request HDMI GPIOs\n", __func__); > + return status; > + } I don't see much point in this. The GPIOs are still declared in the board files, and this function doesn't use the GPIOs for anything. It's better to request them in the board file. > @@ -319,7 +320,8 @@ struct omap_dss_board_info { > /* Init with the board info */ > extern int omap_display_init(struct omap_dss_board_info *board_data); > /* HDMI mux init*/ > -extern int omap_hdmi_init(enum omap_hdmi_flags flags); > +extern int omap_hdmi_init(enum omap_hdmi_flags flags, int hpd_gpio, > + struct gpio hdmi_gpios[], int size); > > struct omap_display_platform_data { > struct omap_dss_board_info *board_data; > @@ -568,6 +570,8 @@ struct omap_dss_device { > > int reset_gpio; > > + int hpd_gpio; The hpd_gpio is for the hdmi device, not for all dss devices. So it shouldn't be in the omap_dss_device. Did you check the example patch I made to fix the phy issue? I still think we should try to fix the bug at hand, not try to implement proper HPD support. Was there something wrong with the example patch I gave? (other than it needs some splitting up). Tomi [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile 2012-01-10 7:37 ` [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile Tomi Valkeinen @ 2012-01-10 7:43 ` Tomi Valkeinen 0 siblings, 0 replies; 8+ messages in thread From: Tomi Valkeinen @ 2012-01-10 7:43 UTC (permalink / raw) To: mythripk; +Cc: linux-omap [-- Attachment #1: Type: text/plain, Size: 756 bytes --] On Tue, 2012-01-10 at 09:37 +0200, Tomi Valkeinen wrote: > I still think we should try to fix the bug at hand, not try to implement > proper HPD support. Was there something wrong with the example patch I > gave? (other than it needs some splitting up). And one reason I'm saying we shouldn't try to implement HPD properly is that with device tree the handling of the GPIOs will change, and if you now make the driver handle the HPD in the generic hdmi layer, it may well be that with dev tree it will change (I'm not sure yet how the GPIOs will be managed there, but most likely they will be passed to the IP driver). So I think we should make the simplest possible implementation to handle the PHY bug, inside the IP driver. Tomi [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 0/3] OMAPDSS: HDMI: HDMI Hot-plug detect support. @ 2011-12-13 13:24 mythripk 0 siblings, 0 replies; 8+ messages in thread From: mythripk @ 2011-12-13 13:24 UTC (permalink / raw) To: tomi.valkeinen, linux-omap; +Cc: Mythri P K From: Mythri P K <mythripk@ti.com> HDMI even if enabled by default should be powered on only when the cable is connected. This is supported by the Hot-plug feature. Now when HDMI is enabled the following steps are followed: -Display enable for HDMI is based on Hot-plug-detect(HPD). -It registers to the GPIO irq handler and checks if cable is connected, -If yes then it turns on HDMI -If an HPD interrupt is received the corresponding IRQ handler is called where it checks if it is a connect / disconnect based on which appropriate action is taken. Mythri P K (3): OMAPDSS: HDMI: HPD support in boardfile OMAPDSS: HDMI: HPD support added to HDMI driver OMAPDSS: HDMI: Add option to enable HDMI in HPD mode arch/arm/mach-omap2/board-4430sdp.c | 35 ++++-------- arch/arm/mach-omap2/board-omap4panda.c | 35 ++++--------- arch/arm/mach-omap2/display.c | 20 ++++++-- drivers/video/omap2/dss/dss.h | 2 + drivers/video/omap2/dss/hdmi.c | 92 ++++++++++++++++++++++++++----- drivers/video/omap2/dss/hdmi_panel.c | 54 ++++++++++++++++++- include/video/omapdss.h | 10 +++- 7 files changed, 176 insertions(+), 72 deletions(-) -- 1.7.5.4 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-01-10 7:59 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-01-06 12:44 [PATCH 0/3] OMAPDSS: HDMI: HDMI Hot-plug detect support mythripk 2012-01-06 12:44 ` [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile mythripk 2012-01-06 12:44 ` [PATCH v2 2/3] OMAPDSS: HDMI: Handle HPD event in ip mythripk 2012-01-06 12:44 ` [PATCH v2 3/3] OMAPDSS: HDMI: HPD support added to HDMI driver mythripk 2012-01-10 7:58 ` Shubhrajyoti 2012-01-10 7:37 ` [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile Tomi Valkeinen 2012-01-10 7:43 ` Tomi Valkeinen -- strict thread matches above, loose matches on Subject: below -- 2011-12-13 13:24 [PATCH 0/3] OMAPDSS: HDMI: HDMI Hot-plug detect support mythripk
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).