From ecfe4e99003b02b256ae30e53c075bc00b6d0273 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 20 Jan 2011 20:02:41 -0800 Subject: [PATCH] siihdmi: add siihdmi_platform_data SII9022 requires some platform specific data that was previously hardcoded into the driver. Create a new siihdmi_platform_data struct to actually get this information. This allows a particular vendor to supply the IRQ vector, the reset method, the framebuffer id, as well as the vendor/description for the SPD block currently. --- arch/arm/mach-mx5/mx51_efikamx_i2c.c | 15 ++++++++++ drivers/video/mxc/mxcfb_siihdmi.c | 41 +++++++++++++++------------- include/linux/i2c/sii_hdmi.h | 17 ++++++++++++ 3 files changed, 54 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-mx5/mx51_efikamx_i2c.c b/arch/arm/mach-mx5/mx51_efikamx_i2c.c index 676e8b2a6df..dcc9b8ac1c0 100644 --- a/arch/arm/mach-mx5/mx51_efikamx_i2c.c +++ b/arch/arm/mach-mx5/mx51_efikamx_i2c.c @@ -23,6 +23,8 @@ #include #include +#include + #include "devices.h" #include "mx51_pins.h" #include "iomux.h" @@ -62,12 +64,25 @@ static struct mxc_lcd_platform_data mx51_efikamx_cs8556_data = { .reset = mx51_efikamx_display_reset, }; +#if 0 static struct mxc_lcd_platform_data mx51_efikamx_sii9022_data = { .core_reg = "VGEN1", .io_reg = "VGEN3", .reset = mx51_efikamx_display_reset, .hotplug_irq = IOMUX_TO_IRQ(MX51_PIN_DISPB2_SER_DIO), }; +#endif + +static struct siihdmi_platform_data mx51_efikamx_sii9022_data = { + .reset = mx51_efikamx_display_reset, + + .vendor = "Genesi", + .description = "Efika MX", + + .framebuffer = "DISP3 BG", + + .hotplug_irq = IOMUX_TO_IRQ(MX51_PIN_DISPB2_SER_DIO), +}; static struct i2c_board_info mx51_efikamx_i2c_board_info[] __initdata = { { diff --git a/drivers/video/mxc/mxcfb_siihdmi.c b/drivers/video/mxc/mxcfb_siihdmi.c index a26fcc59ca2..1638657fc4c 100644 --- a/drivers/video/mxc/mxcfb_siihdmi.c +++ b/drivers/video/mxc/mxcfb_siihdmi.c @@ -493,14 +493,16 @@ static int siihdmi_set_spd_info_frame(struct siihdmi_tx *tx) .length = sizeof(packet.info_frame) - sizeof(packet.info_frame.header), }, - /* TODO this should be in platform data */ - .vendor = "Genesi", - .description = "Efika MX", - .source_device_info = SPD_SOURCE_PC_GENERAL, }, }; + strncpy(packet.info_frame.vendor, tx->platform->vendor, + sizeof(packet.info_frame.vendor)); + + strncpy(packet.info_frame.description, tx->platform->description, + sizeof(packet.info_frame.description)); + cea861_checksum_hdmi_info_frame((u8 *) &packet.info_frame); BUILD_BUG_ON(sizeof(packet) != SIIHDMI_TPI_REG_MISC_INFO_FRAME_LENGTH); @@ -933,9 +935,6 @@ static void siihdmi_hotplug_event(struct work_struct *work) static int __devinit siihdmi_probe(struct i2c_client *client, const struct i2c_device_id *id) { -#ifdef CONFIG_SIIHDMI_HOTPLUG - struct mxc_lcd_platform_data *plat = client->dev.platform_data; -#endif struct siihdmi_tx *tx; int i, ret; @@ -944,18 +943,20 @@ static int __devinit siihdmi_probe(struct i2c_client *client, return -ENOMEM; tx->client = client; - - i2c_set_clientdata(client, tx); + tx->platform = client->dev.platform_data; #ifdef CONFIG_SIIHDMI_HOTPLUG - tx->irq = plat->hotplug_irq; + tx->irq = tx->platform->hotplug_irq; + PREPARE_DELAYED_WORK(&tx->hotplug, siihdmi_hotplug_event); - ret = request_irq(tx->irq, siihdmi_irq_handler, IRQF_TRIGGER_RISING, "hdmi_hotplug", (void *) tx); - if (ret) { + + if (request_irq(tx->irq, siihdmi_irq_handler, + IRQF_TRIGGER_RISING, "hdmi_hotplug", tx) < 0) DEBUG("could not register display hotplug irq\n"); - } #endif + i2c_set_clientdata(client, tx); + #if defined(CONFIG_MACH_MX51_EFIKAMX) msleep(MX51_IPU_SETTLE_TIME_MS); #endif @@ -967,12 +968,14 @@ static int __devinit siihdmi_probe(struct i2c_client *client, if (siihdmi_sink_present(tx)) { /* enable any existing framebuffers */ DEBUG("%d registered framebuffers\n", num_registered_fb); - for (i = 0; i < num_registered_fb; i++) - { - /* hack: only init the background framebuffer */ - if (!strncmp("DISP3 BG", registered_fb[i]->fix.id, 8)) - if ((ret = siihdmi_init_fb(tx, registered_fb[i])) < 0) - goto error; + + for (i = 0; i < num_registered_fb; i++) { + if (strcmp(registered_fb[i]->fix.id, + tx->platform->framebuffer)) + continue; + + if ((ret = siihdmi_init_fb(tx, registered_fb[i])) < 0) + goto error; } } else { /* diff --git a/include/linux/i2c/sii_hdmi.h b/include/linux/i2c/sii_hdmi.h index c8b2f44cdaa..1dd0d893083 100644 --- a/include/linux/i2c/sii_hdmi.h +++ b/include/linux/i2c/sii_hdmi.h @@ -311,8 +311,25 @@ struct siihdmi_audio_info_frame { struct audio_info_frame info_frame; }; +struct siihdmi_platform_data { + /* reset function */ + void (*reset)(void); + + /* HDMI SPD InfoFrame Data */ + char *vendor; + char *description; + + /* framebuffer fixed id */ + char *framebuffer; + + /* hotplug IRQ */ + int hotplug_irq; +}; + struct siihdmi_tx { struct i2c_client *client; + struct siihdmi_platform_data *platform; + struct notifier_block nb; struct delayed_work hotplug;