diff options
-rw-r--r-- | Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt | 1 | ||||
-rw-r--r-- | drivers/clk/tegra/clk-tegra-periph.c | 2 | ||||
-rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 95 | ||||
-rw-r--r-- | drivers/video/backlight/pwm_bl.c | 8 | ||||
-rw-r--r-- | include/linux/pwm_backlight.h | 2 | ||||
-rw-r--r-- | kernel/irq/Kconfig | 1 |
6 files changed, 105 insertions, 4 deletions
diff --git a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt index 764db86d441a..65e001a1733d 100644 --- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt +++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt @@ -17,6 +17,7 @@ Optional properties: "pwms" property (see PWM binding[0]) - enable-gpios: contains a single GPIO specifier for the GPIO which enables and disables the backlight (see GPIO binding[1]) + - backlight-boot-off: keep the backlight disabled on boot [0]: Documentation/devicetree/bindings/pwm/pwm.txt [1]: Documentation/devicetree/bindings/gpio/gpio.txt diff --git a/drivers/clk/tegra/clk-tegra-periph.c b/drivers/clk/tegra/clk-tegra-periph.c index 5c35885f4a7c..3744a6fe589e 100644 --- a/drivers/clk/tegra/clk-tegra-periph.c +++ b/drivers/clk/tegra/clk-tegra-periph.c @@ -492,7 +492,7 @@ static struct tegra_periph_init_data periph_clks[] = { UART("uartb", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, tegra_clk_uartb), UART("uartc", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, tegra_clk_uartc), UART("uartd", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, tegra_clk_uartd), - UART("uarte", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTE, 65, tegra_clk_uarte), + UART("uarte", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTE, 66, tegra_clk_uarte), XUSB("xusb_host_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_host_src), XUSB("xusb_falcon_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_falcon_src), XUSB("xusb_fs_src", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_fs_src), diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index a70400754e92..29743bc4fe92 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -14,10 +14,13 @@ #include <linux/module.h> #include <linux/delay.h> #include <linux/firmware.h> +#include <linux/gpio.h> #include <linux/i2c.h> #include <linux/i2c/atmel_mxt_ts.h> #include <linux/input/mt.h> #include <linux/interrupt.h> +#include <linux/of_gpio.h> +#include <linux/of_irq.h> #include <linux/slab.h> /* Version */ @@ -851,7 +854,7 @@ static int mxt_initialize(struct mxt_data *data) /* Soft reset */ mxt_write_object(data, MXT_GEN_COMMAND_T6, MXT_COMMAND_RESET, 1); - msleep(MXT_RESET_TIME); + msleep(MXT_RESET_TIME + 50); /* Update matrix size at info struct */ error = mxt_read_reg(client, MXT_MATRIX_X_SIZE, &val); @@ -1126,6 +1129,78 @@ static void mxt_input_close(struct input_dev *dev) mxt_stop(data); } +static const u8 config[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0x32, 0x0A, 0x00, 0x14, 0x14, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x00, 0x00, + 0x1B, 0x2A, 0x00, 0x20, 0x3C, 0x04, 0x05, 0x00, + 0x02, 0x01, 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0xFF, + 0x02, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x64, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, + 0x00, 0x00, 0x00, 0x05, 0x0A, 0x15, 0x1E, 0x00, + 0x00, 0x04, 0xFF, 0x03, 0x3F, 0x64, 0x64, 0x01, + 0x0A, 0x14, 0x28, 0x4B, 0x00, 0x02, 0x00, 0x64, + 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x10, 0x3C, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static struct mxt_platform_data *mxt_parse_dt(struct i2c_client *client) +{ + struct device_node *np = client->dev.of_node; + struct mxt_platform_data *pdata; + enum of_gpio_flags flags; + unsigned int irq; + int err, gpio; + + pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return ERR_PTR(-ENOMEM); + + pdata->x_line = 27; + pdata->y_line = 42; + pdata->x_size = 768; + pdata->y_size = 1366; + pdata->blen = 0x20; + pdata->threshold = 0x3c; + pdata->voltage = 3300000; + pdata->orient = 5; + pdata->config = config; + pdata->config_length = 157; + + irq = irq_of_parse_and_map(np, 0); + if (!irq) + return ERR_PTR(-EINVAL); + + pdata->irqflags = IRQF_TRIGGER_FALLING; + + client->irq = irq; + + gpio = of_get_named_gpio_flags(np, "reset-gpios", 0, &flags); + if (gpio_is_valid(gpio)) { + err = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, "reset"); + if (err < 0) { + dev_err(&client->dev, "failed to request GPIO#%03u: %d\n", + gpio, err); + goto skip; + } + + msleep(100); + gpio_set_value(gpio, 1); + msleep(200); + } + +skip: + return pdata; +} + static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -1135,8 +1210,13 @@ static int mxt_probe(struct i2c_client *client, int error; unsigned int num_mt_slots; - if (!pdata) - return -EINVAL; + if (!pdata) { + if (IS_ENABLED(CONFIG_OF) && client->dev.of_node) + pdata = mxt_parse_dt(client); + + if (!pdata) + return -EINVAL; + } data = kzalloc(sizeof(struct mxt_data), GFP_KERNEL); input_dev = input_allocate_device(); @@ -1322,11 +1402,20 @@ static const struct i2c_device_id mxt_id[] = { }; MODULE_DEVICE_TABLE(i2c, mxt_id); +#ifdef CONFIG_OF +static const struct of_device_id mxt_of_match[] = { + { .compatible = "atmel,mxt-ts", }, + { } +}; +MODULE_DEVICE_TABLE(of, mxt_of_match); +#endif + static struct i2c_driver mxt_driver = { .driver = { .name = "atmel_mxt_ts", .owner = THIS_MODULE, .pm = &mxt_pm_ops, + .of_match_table = of_match_ptr(mxt_of_match), }, .probe = mxt_probe, .remove = mxt_remove, diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index b75201ff46f6..a1697f630c68 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -197,6 +197,8 @@ static int pwm_backlight_parse_dt(struct device *dev, if (gpio_is_valid(data->enable_gpio) && (flags & OF_GPIO_ACTIVE_LOW)) data->enable_gpio_flags |= PWM_BACKLIGHT_GPIO_ACTIVE_LOW; + data->boot_off = of_property_read_bool(node, "backlight-boot-off"); + return 0; } @@ -331,6 +333,12 @@ static int pwm_backlight_probe(struct platform_device *pdev) } bl->props.brightness = data->dft_brightness; + + if (data->boot_off) + bl->props.power = FB_BLANK_POWERDOWN; + else + bl->props.power = FB_BLANK_UNBLANK; + backlight_update_status(bl); platform_set_drvdata(pdev, bl); diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h index 2de2e275b2cb..ea4a2399fd87 100644 --- a/include/linux/pwm_backlight.h +++ b/include/linux/pwm_backlight.h @@ -18,6 +18,8 @@ struct platform_pwm_backlight_data { unsigned int *levels; int enable_gpio; unsigned long enable_gpio_flags; + bool boot_off; + int (*init)(struct device *dev); int (*notify)(struct device *dev, int brightness); void (*notify_after)(struct device *dev, int brightness); diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig index 4a1fef09f658..07cbdfea9ae2 100644 --- a/kernel/irq/Kconfig +++ b/kernel/irq/Kconfig @@ -40,6 +40,7 @@ config IRQ_EDGE_EOI_HANDLER # Generic configurable interrupt chip implementation config GENERIC_IRQ_CHIP bool + select IRQ_DOMAIN # Generic irq_domain hw <--> linux irq number translation config IRQ_DOMAIN |