Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40591517 authored by Shantanu Jain's avatar Shantanu Jain
Browse files

input: synaptics_dsx_2.6: Add support for clocks for secure touch



Because of a change in the underlying bus driver, the secure touch
layer in the input drivers is now required to control directly the
clocks which are needed during the touch sessions. The clocks which
are associated with the underlying I2C bus are clk_gcc_blsp1_ahb_clk
and clk_gcc_blsp1_qup3_i2c_apps_clk. These clocks are turned on/off
when the secure touch session is started/ended.

CRs-Fixed: 990820
Change-Id: Ie2f6f5b736b27792e6e4dc2c39064e0ebdc03d7b
Signed-off-by: default avatarShantanu Jain <shjain@codeaurora.org>
parent a75bcbc3
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ Optional property:
 - synaptics,y-flip		       : modify orientation of the y axis.
 - synaptics,reset-delay-ms	   : reset delay for controller (ms), default 100.
 - synaptics,max-y-for-2d	   : maximal y value of the panel.
 - clock-names			: Clock names used for secure touch. They are: "iface_clk", "core_clk"
 - clocks			: Defined if 'clock-names' DT property is defined. These clocks
				  are associated with the underlying I2C bus.

Example:
	i2c@78b7000 {
@@ -46,5 +49,9 @@ Example:
			synaptics,max-y-for-2d = <1919>; /* remove if no virtual buttons */
			synaptics,cap-button-codes = <139 172 158>;
			synaptics,vir-button-codes = <139 180 2000 320 160 172 540 2000 320 160 158 900 2000 320 160>;
			/* Underlying clocks used by secure touch */
			clock-names = "iface_clk", "core_clk";
			clocks = <&clock_gcc clk_gcc_blsp1_ahb_clk>,
				<&clock_gcc clk_gcc_blsp1_qup3_i2c_apps_clk>;
		};
	};
+0 −10
Original line number Diff line number Diff line
@@ -1128,14 +1128,4 @@ config TOUCHSCREEN_MAXIM_STI

source "drivers/input/touchscreen/gt9xx/Kconfig"

config SECURE_TOUCH_SYNAPTICS_DSX_V26
	bool "Secure Touch support for Synaptics V2.6 Touchscreen"
	depends on TOUCHSCREEN_SYNAPTICS_DSX_I2C_v26
	help
	  Say Y here
	  -Synaptics DSX V2.6 touch driver is connected
	  -To enable secure touch for Synaptics DSX V2.6 touch driver

	  If unsure, say N.

endif
+10 −0
Original line number Diff line number Diff line
@@ -114,4 +114,14 @@ config TOUCHSCREEN_SYNAPTICS_DSX_VIDEO_v26
	  To compile this driver as a module, choose M here: the
	  module will be called synaptics_dsx_video.

config SECURE_TOUCH_SYNAPTICS_DSX_V26
	bool "Secure Touch support for Synaptics V2.6 Touchscreen"
	depends on TOUCHSCREEN_SYNAPTICS_DSX_I2C_v26
	help
	  Say Y here
	  -Synaptics DSX V2.6 touch driver is connected
	  -To enable secure touch for Synaptics DSX V2.6 touch driver

	  If unsure, say N.

endif
+28 −0
Original line number Diff line number Diff line
@@ -651,8 +651,33 @@ static struct kobj_attribute virtual_key_map_attr = {
#if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26)
static void synaptics_secure_touch_init(struct synaptics_rmi4_data *data)
{
	int ret = 0;

	data->st_initialized = 0;
	init_completion(&data->st_powerdown);
	init_completion(&data->st_irq_processed);

	/* Get clocks */
	data->core_clk = devm_clk_get(data->pdev->dev.parent, "core_clk");
	if (IS_ERR(data->core_clk)) {
		ret = PTR_ERR(data->core_clk);
		data->core_clk = NULL;
		dev_warn(data->pdev->dev.parent,
			"%s: error on clk_get(core_clk): %d\n", __func__, ret);
		return;
	}

	data->iface_clk = devm_clk_get(data->pdev->dev.parent, "iface_clk");
	if (IS_ERR(data->iface_clk)) {
		ret = PTR_ERR(data->iface_clk);
		data->iface_clk = NULL;
		dev_warn(data->pdev->dev.parent,
			"%s: error on clk_get(iface_clk): %d\n", __func__, ret);
		return;
	}

	data->st_initialized = 1;
	return;
}

static void synaptics_secure_touch_notify(struct synaptics_rmi4_data *rmi4_data)
@@ -745,6 +770,9 @@ static ssize_t synaptics_rmi4_secure_touch_enable_store(struct device *dev,
	if (err != 0)
		return err;

	if (!rmi4_data->st_initialized)
		return -EIO;

	err = count;

	switch (value) {
+4 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@
#include <linux/completion.h>
#include <linux/atomic.h>
#include <linux/pm_runtime.h>
#include <linux/clk.h>
#endif

#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38))
@@ -385,6 +386,9 @@ struct synaptics_rmi4_data {
	atomic_t st_pending_irqs;
	struct completion st_powerdown;
	struct completion st_irq_processed;
	bool st_initialized;
	struct clk *core_clk;
	struct clk *iface_clk;
#endif
};

Loading