#include <linux/input/lis3dh.h>
#include <linux/ms5607.h>
#include <linux/a1026.h>
-
+#include <linux/i2c-gpio.h>
+#include <linux/lnw_gpio.h>
static struct lis3dh_acc_platform_data lis3dh_pdata = {
.poll_interval = 200,
}
device_initcall(platform_bkbpr2_subsys_init);
+static int hdmi_i2c_workaround(void)
+{
+ int ret;
+ struct platform_device *pdev;
+ struct i2c_gpio_platform_data *pdata;
+
+ /*
+ * Hard code a gpio controller platform device to take over
+ * the two gpio pins used to be controlled by i2c bus 3.
+ * This is to support HDMI EDID extension block read, which
+ * is not supported by the current i2c controller, so we use
+ * GPIO pin the simulate an i2c bus.
+ */
+ pdev = platform_device_alloc("i2c-gpio", 8);
+ if (!pdev) {
+ pr_err("i2c-gpio: failed to alloc platform device\n");
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ pdata = kzalloc(sizeof(struct i2c_gpio_platform_data), GFP_KERNEL);
+ if (!pdata) {
+ pr_err("i2c-gpio: failed to alloc platform data\n");
+ kfree(pdev);
+ ret = -ENOMEM;
+ goto out;
+ }
+ pdata->scl_pin = 35 + 96;
+ pdata->sda_pin = 36 + 96;
+ pdata->sda_is_open_drain = 0;
+ pdata->scl_is_open_drain = 0;
+ pdev->dev.platform_data = pdata;
+
+ platform_device_add(pdev);
+
+ lnw_gpio_set_alt(pdata->sda_pin, LNW_GPIO);
+ lnw_gpio_set_alt(pdata->scl_pin, LNW_GPIO);
+
+out:
+ return ret;
+}
+rootfs_initcall(hdmi_i2c_workaround);
/* Standard-mode */
hcnt = i2c_dw_scl_hcnt(input_clock_khz,
- 40, /* tHD;STA = tHIGH = 4.0 us */
+ 227, /* tHD;STA = tHIGH = 22.7 us */
3, /* tf = 0.3 us */
0, /* 0: DW default, 1: Ideal */
- 0); /* No offset */
+ 23); /* offset = 23 */
lcnt = i2c_dw_scl_lcnt(input_clock_khz,
- 47, /* tLOW = 4.7 us */
+ 227, /* tLOW = 22.7 us */
3, /* tf = 0.3 us */
- 0); /* No offset */
+ 28); /* offset = 28 */
dw_writel(dev, hcnt, DW_IC_SS_SCL_HCNT);
dw_writel(dev, lcnt, DW_IC_SS_SCL_LCNT);
dev_dbg(dev->dev, "Standard-mode HCNT:LCNT = %d:%d\n", hcnt, lcnt);
/* Fast-mode */
hcnt = i2c_dw_scl_hcnt(input_clock_khz,
- 6, /* tHD;STA = tHIGH = 0.6 us */
+ 52, /* tHD;STA = tHIGH = 5.2 us */
3, /* tf = 0.3 us */
0, /* 0: DW default, 1: Ideal */
- 0); /* No offset */
+ 11); /* offset = 11 */
lcnt = i2c_dw_scl_lcnt(input_clock_khz,
- 13, /* tLOW = 1.3 us */
+ 72, /* tLOW = 7.2 us */
3, /* tf = 0.3 us */
- 0); /* No offset */
+ 12); /* offset = 12 */
dw_writel(dev, hcnt, DW_IC_FS_SCL_HCNT);
dw_writel(dev, lcnt, DW_IC_FS_SCL_LCNT);
dev_dbg(dev->dev, "Fast-mode HCNT:LCNT = %d:%d\n", hcnt, lcnt);
.bus_cfg = INTEL_MID_STD_CFG | DW_IC_CON_SPEED_STD,
.tx_fifo_depth = 32,
.rx_fifo_depth = 32,
- .clk_khz = 17000,
+ .clk_khz = 20500,
},
[medfield_4] = {
.bus_num = 4,
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
-#include <linux/lnw_gpio.h>
#include <asm/gpio.h>
if (ret)
goto err_request_scl;
- lnw_gpio_set_alt(pdata->sda_pin, LNW_GPIO);
- lnw_gpio_set_alt(pdata->scl_pin, LNW_GPIO);
-
if (pdata->sda_is_open_drain) {
gpio_direction_output(pdata->sda_pin, 1);
bit_data->setsda = i2c_gpio_setsda_val;
static int __init i2c_gpio_init(void)
{
int ret;
- struct platform_device *pdev;
- struct i2c_gpio_platform_data *pdata;
-
- /*
- * Hard code a gpio controller platform device to take over
- * the two gpio pins used to be controlled by i2c bus 3.
- * This is to support HDMI EDID extension block read, which
- * is not supported by the current i2c controller, so we use
- * GPIO pin the simulate an i2c bus.
- */
- pdev = platform_device_alloc("i2c-gpio", 8);
- if (!pdev) {
- pr_err("i2c-gpio: failed to alloc platform device\n");
- ret = -ENOMEM;
- goto out;
- }
-
- pdata = kzalloc(sizeof(struct i2c_gpio_platform_data), GFP_KERNEL);
- if (!pdata) {
- pr_err("i2c-gpio: failed to alloc platform data\n");
- kfree(pdev);
- ret = -ENOMEM;
- goto out;
- }
- pdata->scl_pin = 35 + 96;
- pdata->sda_pin = 36 + 96;
- pdata->sda_is_open_drain = 1;
- pdata->scl_is_open_drain = 1;
- pdev->dev.platform_data = pdata;
-
- platform_device_add(pdev);
ret = platform_driver_register(&i2c_gpio_driver);
if (ret)
printk(KERN_ERR "i2c-gpio: probe failed: %d\n", ret);
-out:
return ret;
}
late_initcall(i2c_gpio_init);