Skip to content

Commit

Permalink
Merge branch 'next' into for-linus
Browse files Browse the repository at this point in the history
Prepare input updates for 4.21 merge window.
  • Loading branch information
dtor committed Dec 29, 2018
2 parents 7db54c8 + 1e3c336 commit 592b15b
Show file tree
Hide file tree
Showing 19 changed files with 346 additions and 141 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Raspberry Pi firmware based 7" touchscreen
=====================================

Required properties:
- compatible: "raspberrypi,firmware-ts"

Optional properties:
- firmware: Reference to RPi's firmware device node
- touchscreen-size-x: See touchscreen.txt
- touchscreen-size-y: See touchscreen.txt
- touchscreen-inverted-x: See touchscreen.txt
- touchscreen-inverted-y: See touchscreen.txt
- touchscreen-swapped-x-y: See touchscreen.txt

Example:

firmware: firmware-rpi {
compatible = "raspberrypi,bcm2835-firmware";
mboxes = <&mailbox>;

ts: touchscreen {
compatible = "raspberrypi,firmware-ts";
touchscreen-size-x = <800>;
touchscreen-size-y = <480>;
};
};
4 changes: 4 additions & 0 deletions Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ Required properties:
- compatible : "olpc,ap-sp"
- reg : base address and length of SoC's WTM registers
- interrupts : SP-AP interrupt
- clocks : phandle + clock-specifier for the clock that drives the WTM
- clock-names: should be "sp"

Example:
ap-sp@d4290000 {
compatible = "olpc,ap-sp";
reg = <0xd4290000 0x1000>;
interrupts = <40>;
clocks = <&soc_clocks MMP2_CLK_SP>;
clock-names = "sp";
}
4 changes: 4 additions & 0 deletions drivers/clk/mmp/clk-of-mmp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#define APMU_DISP1 0x110
#define APMU_CCIC0 0x50
#define APMU_CCIC1 0xf4
#define APMU_SP 0x68
#define MPMU_UART_PLL 0x14

struct mmp2_clk_unit {
Expand Down Expand Up @@ -209,6 +210,8 @@ static struct mmp_clk_mix_config ccic1_mix_config = {
.reg_info = DEFINE_MIX_REG_INFO(4, 16, 2, 6, 32),
};

static DEFINE_SPINLOCK(sp_lock);

static struct mmp_param_mux_clk apmu_mux_clks[] = {
{MMP2_CLK_DISP0_MUX, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 2, 0, &disp0_lock},
{MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock},
Expand Down Expand Up @@ -239,6 +242,7 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = {
{MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock},
{MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock},
{MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock},
{MMP2_CLK_SP, "sp_clk", NULL, CLK_SET_RATE_PARENT, APMU_SP, 0x1b, 0x1b, 0x0, 0, &sp_lock},
};

static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit)
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/keyboard/nomadik-ske-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static int __init ske_keypad_chip_init(struct ske_keypad *keypad)
while ((readl(keypad->reg_base + SKE_RIS) != 0x00000000) && timeout--)
cpu_relax();

if (!timeout)
if (timeout == -1)
return -EINVAL;

/*
Expand Down
6 changes: 3 additions & 3 deletions drivers/input/misc/drv2667.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ static int drv2667_set_waveform_freq(struct drv2667_data *haptics)
error = regmap_write(haptics->regmap, DRV2667_PAGE, read_buf);
if (error) {
dev_err(&haptics->client->dev,
"Failed to set the page: %d\n", error);
return -EIO;
}
"Failed to set the page: %d\n", error);
return -EIO;
}
}

return error;
Expand Down
6 changes: 4 additions & 2 deletions drivers/input/misc/rotary_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,10 @@ static int rotary_encoder_probe(struct platform_device *pdev)

encoder->gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN);
if (IS_ERR(encoder->gpios)) {
dev_err(dev, "unable to get gpios\n");
return PTR_ERR(encoder->gpios);
err = PTR_ERR(encoder->gpios);
if (err != -EPROBE_DEFER)
dev_err(dev, "unable to get gpios: %d\n", err);
return err;
}
if (encoder->gpios->ndescs < 2) {
dev_err(dev, "not enough gpios found\n");
Expand Down
1 change: 0 additions & 1 deletion drivers/input/serio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ config SERIO_APBPS2

config SERIO_OLPC_APSP
tristate "OLPC AP-SP input support"
depends on OLPC || COMPILE_TEST
help
Say Y here if you want support for the keyboard and touchpad included
in the OLPC XO-1.75 and XO-4 laptops.
Expand Down
28 changes: 20 additions & 8 deletions drivers/input/serio/olpc_apsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/of.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/clk.h>

/*
* The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
Expand Down Expand Up @@ -74,6 +75,7 @@ struct olpc_apsp {
struct serio *kbio;
struct serio *padio;
void __iomem *base;
struct clk *clk;
int open_count;
int irq;
};
Expand Down Expand Up @@ -145,8 +147,21 @@ static int olpc_apsp_open(struct serio *port)
{
struct olpc_apsp *priv = port->port_data;
unsigned int tmp;
unsigned long l;
int error;

if (priv->open_count++ == 0) {
error = clk_prepare_enable(priv->clk);
if (error)
return error;

l = readl(priv->base + COMMAND_FIFO_STATUS);
if (!(l & CMD_STS_MASK)) {
dev_err(priv->dev, "SP cannot accept commands.\n");
clk_disable_unprepare(priv->clk);
return -EIO;
}

/* Enable interrupt 0 by clearing its bit */
tmp = readl(priv->base + PJ_INTERRUPT_MASK);
writel(tmp & ~INT_0, priv->base + PJ_INTERRUPT_MASK);
Expand All @@ -164,6 +179,8 @@ static void olpc_apsp_close(struct serio *port)
/* Disable interrupt 0 */
tmp = readl(priv->base + PJ_INTERRUPT_MASK);
writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK);

clk_disable_unprepare(priv->clk);
}
}

Expand All @@ -172,15 +189,12 @@ static int olpc_apsp_probe(struct platform_device *pdev)
struct serio *kb_serio, *pad_serio;
struct olpc_apsp *priv;
struct resource *res;
struct device_node *np;
unsigned long l;
int error;

priv = devm_kzalloc(&pdev->dev, sizeof(struct olpc_apsp), GFP_KERNEL);
if (!priv)
return -ENOMEM;

np = pdev->dev.of_node;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->base)) {
Expand All @@ -192,11 +206,9 @@ static int olpc_apsp_probe(struct platform_device *pdev)
if (priv->irq < 0)
return priv->irq;

l = readl(priv->base + COMMAND_FIFO_STATUS);
if (!(l & CMD_STS_MASK)) {
dev_err(&pdev->dev, "SP cannot accept commands.\n");
return -EIO;
}
priv->clk = devm_clk_get(&pdev->dev, "sp");
if (IS_ERR(priv->clk))
return PTR_ERR(priv->clk);

/* KEYBOARD */
kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
Expand Down
12 changes: 12 additions & 0 deletions drivers/input/touchscreen/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,18 @@ config TOUCHSCREEN_EDT_FT5X06
To compile this driver as a module, choose M here: the
module will be called edt-ft5x06.

config TOUCHSCREEN_RASPBERRYPI_FW
tristate "Raspberry Pi's firmware base touch screen support"
depends on RASPBERRYPI_FIRMWARE || COMPILE_TEST
help
Say Y here if you have the official Raspberry Pi 7 inch screen on
your system.

If unsure, say N.

To compile this driver as a module, choose M here: the
module will be called raspberrypi-ts.

config TOUCHSCREEN_MIGOR
tristate "Renesas MIGO-R touchscreen"
depends on (SH_MIGOR || COMPILE_TEST) && I2C
Expand Down
1 change: 1 addition & 0 deletions drivers/input/touchscreen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,4 @@ obj-$(CONFIG_TOUCHSCREEN_ZET6223) += zet6223.o
obj-$(CONFIG_TOUCHSCREEN_ZFORCE) += zforce_ts.o
obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50) += colibri-vf50-ts.o
obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o
obj-$(CONFIG_TOUCHSCREEN_RASPBERRYPI_FW) += raspberrypi-ts.o
109 changes: 34 additions & 75 deletions drivers/input/touchscreen/ad7879.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/gpio.h>
#include <linux/gpio/driver.h>

#include <linux/input/touchscreen.h>
#include <linux/platform_data/ad7879.h>
#include <linux/module.h>
#include "ad7879.h"

Expand Down Expand Up @@ -290,7 +289,7 @@ static int ad7879_open(struct input_dev *input)
return 0;
}

static void ad7879_close(struct input_dev* input)
static void ad7879_close(struct input_dev *input)
{
struct ad7879 *ts = input_get_drvdata(input);

Expand Down Expand Up @@ -452,47 +451,36 @@ static void ad7879_gpio_set_value(struct gpio_chip *chip,
mutex_unlock(&ts->mutex);
}

static int ad7879_gpio_add(struct ad7879 *ts,
const struct ad7879_platform_data *pdata)
static int ad7879_gpio_add(struct ad7879 *ts)
{
bool gpio_export;
int gpio_base;
int ret = 0;

if (pdata) {
gpio_export = pdata->gpio_export;
gpio_base = pdata->gpio_base;
} else {
gpio_export = device_property_read_bool(ts->dev,
"gpio-controller");
gpio_base = -1;
}

mutex_init(&ts->mutex);

if (gpio_export) {
ts->gc.direction_input = ad7879_gpio_direction_input;
ts->gc.direction_output = ad7879_gpio_direction_output;
ts->gc.get = ad7879_gpio_get_value;
ts->gc.set = ad7879_gpio_set_value;
ts->gc.can_sleep = 1;
ts->gc.base = gpio_base;
ts->gc.ngpio = 1;
ts->gc.label = "AD7879-GPIO";
ts->gc.owner = THIS_MODULE;
ts->gc.parent = ts->dev;

ret = devm_gpiochip_add_data(ts->dev, &ts->gc, ts);
if (ret)
dev_err(ts->dev, "failed to register gpio %d\n",
ts->gc.base);
}
/* Do not create a chip unless flagged for it */
if (!device_property_read_bool(ts->dev, "gpio-controller"))
return 0;

ts->gc.direction_input = ad7879_gpio_direction_input;
ts->gc.direction_output = ad7879_gpio_direction_output;
ts->gc.get = ad7879_gpio_get_value;
ts->gc.set = ad7879_gpio_set_value;
ts->gc.can_sleep = 1;
ts->gc.base = -1;
ts->gc.ngpio = 1;
ts->gc.label = "AD7879-GPIO";
ts->gc.owner = THIS_MODULE;
ts->gc.parent = ts->dev;

ret = devm_gpiochip_add_data(ts->dev, &ts->gc, ts);
if (ret)
dev_err(ts->dev, "failed to register gpio %d\n",
ts->gc.base);

return ret;
}
#else
static int ad7879_gpio_add(struct ad7879 *ts,
const struct ad7879_platform_data *pdata)
static int ad7879_gpio_add(struct ad7879 *ts)
{
return 0;
}
Expand Down Expand Up @@ -527,7 +515,6 @@ static int ad7879_parse_dt(struct device *dev, struct ad7879 *ts)
int ad7879_probe(struct device *dev, struct regmap *regmap,
int irq, u16 bustype, u8 devid)
{
struct ad7879_platform_data *pdata = dev_get_platdata(dev);
struct ad7879 *ts;
struct input_dev *input_dev;
int err;
Expand All @@ -542,22 +529,9 @@ int ad7879_probe(struct device *dev, struct regmap *regmap,
if (!ts)
return -ENOMEM;

if (pdata) {
/* Platform data use swapped axis (backward compatibility) */
ts->swap_xy = !pdata->swap_xy;

ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;

ts->first_conversion_delay = pdata->first_conversion_delay;
ts->acquisition_time = pdata->acquisition_time;
ts->averaging = pdata->averaging;
ts->pen_down_acc_interval = pdata->pen_down_acc_interval;
ts->median = pdata->median;
} else {
err = ad7879_parse_dt(dev, ts);
if (err)
return err;
}
err = ad7879_parse_dt(dev, ts);
if (err)
return err;

input_dev = devm_input_allocate_device(dev);
if (!input_dev) {
Expand Down Expand Up @@ -585,28 +559,13 @@ int ad7879_probe(struct device *dev, struct regmap *regmap,

input_set_capability(input_dev, EV_KEY, BTN_TOUCH);

if (pdata) {
input_set_abs_params(input_dev, ABS_X,
pdata->x_min ? : 0,
pdata->x_max ? : MAX_12BIT,
0, 0);
input_set_abs_params(input_dev, ABS_Y,
pdata->y_min ? : 0,
pdata->y_max ? : MAX_12BIT,
0, 0);
input_set_abs_params(input_dev, ABS_PRESSURE,
pdata->pressure_min,
pdata->pressure_max ? : ~0,
0, 0);
} else {
input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, 0, 0);
input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0);
input_set_capability(input_dev, EV_ABS, ABS_PRESSURE);
touchscreen_parse_properties(input_dev, false, NULL);
if (!input_abs_get_max(input_dev, ABS_PRESSURE)) {
dev_err(dev, "Touchscreen pressure is not specified\n");
return -EINVAL;
}
input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, 0, 0);
input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0);
input_set_capability(input_dev, EV_ABS, ABS_PRESSURE);
touchscreen_parse_properties(input_dev, false, NULL);
if (!input_abs_get_max(input_dev, ABS_PRESSURE)) {
dev_err(dev, "Touchscreen pressure is not specified\n");
return -EINVAL;
}

err = ad7879_write(ts, AD7879_REG_CTRL2, AD7879_RESET);
Expand Down Expand Up @@ -655,7 +614,7 @@ int ad7879_probe(struct device *dev, struct regmap *regmap,
if (err)
return err;

err = ad7879_gpio_add(ts, pdata);
err = ad7879_gpio_add(ts);
if (err)
return err;

Expand Down
4 changes: 2 additions & 2 deletions drivers/input/touchscreen/atmel_mxt_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1585,10 +1585,10 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *fw)
/* T7 config may have changed */
mxt_init_t7_power_cfg(data);

release_raw:
kfree(cfg.raw);
release_mem:
kfree(cfg.mem);
release_raw:
kfree(cfg.raw);
return ret;
}

Expand Down
Loading

0 comments on commit 592b15b

Please sign in to comment.