Re: [PATCH v2 7/7] Input: iqs7222 - add support for IQS7222A v1.13+

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 15, 2022 at 23:32, Jeff LaBundy <jeff@xxxxxxxxxxx> wrote:

> IQS7222A revisions 1.13 and later widen the gesture multiplier from
> x4 ms to x16 ms. Add a means to scale the gesture timings specified
> in the device tree based on the revision of the device.
>
> Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C")
> Signed-off-by: Jeff LaBundy <jeff@xxxxxxxxxxx>
> ---
> Changes in v2:
>  - Rebased to account for changes earlier in series
>
>  drivers/input/misc/iqs7222.c | 111 +++++++++++++++++++++++++++++++++++
>  1 file changed, 111 insertions(+)

Reviewed-by: Mattijs Korpershoek <mkorpershoek@xxxxxxxxxxxx>

>
> diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c
> index 0a592b90f471..3340de51fb2d 100644
> --- a/drivers/input/misc/iqs7222.c
> +++ b/drivers/input/misc/iqs7222.c
> @@ -86,7 +86,9 @@ enum iqs7222_reg_key_id {
>  	IQS7222_REG_KEY_TOUCH,
>  	IQS7222_REG_KEY_DEBOUNCE,
>  	IQS7222_REG_KEY_TAP,
> +	IQS7222_REG_KEY_TAP_LEGACY,
>  	IQS7222_REG_KEY_AXIAL,
> +	IQS7222_REG_KEY_AXIAL_LEGACY,
>  	IQS7222_REG_KEY_WHEEL,
>  	IQS7222_REG_KEY_NO_WHEEL,
>  	IQS7222_REG_KEY_RESERVED
> @@ -202,10 +204,68 @@ struct iqs7222_dev_desc {
>  	int allow_offset;
>  	int event_offset;
>  	int comms_offset;
> +	bool legacy_gesture;
>  	struct iqs7222_reg_grp_desc reg_grps[IQS7222_NUM_REG_GRPS];
>  };
>  
>  static const struct iqs7222_dev_desc iqs7222_devs[] = {
> +	{
> +		.prod_num = IQS7222_PROD_NUM_A,
> +		.fw_major = 1,
> +		.fw_minor = 13,
> +		.sldr_res = U8_MAX * 16,
> +		.touch_link = 1768,
> +		.allow_offset = 9,
> +		.event_offset = 10,
> +		.comms_offset = 12,
> +		.reg_grps = {
> +			[IQS7222_REG_GRP_STAT] = {
> +				.base = IQS7222_SYS_STATUS,
> +				.num_row = 1,
> +				.num_col = 8,
> +			},
> +			[IQS7222_REG_GRP_CYCLE] = {
> +				.base = 0x8000,
> +				.num_row = 7,
> +				.num_col = 3,
> +			},
> +			[IQS7222_REG_GRP_GLBL] = {
> +				.base = 0x8700,
> +				.num_row = 1,
> +				.num_col = 3,
> +			},
> +			[IQS7222_REG_GRP_BTN] = {
> +				.base = 0x9000,
> +				.num_row = 12,
> +				.num_col = 3,
> +			},
> +			[IQS7222_REG_GRP_CHAN] = {
> +				.base = 0xA000,
> +				.num_row = 12,
> +				.num_col = 6,
> +			},
> +			[IQS7222_REG_GRP_FILT] = {
> +				.base = 0xAC00,
> +				.num_row = 1,
> +				.num_col = 2,
> +			},
> +			[IQS7222_REG_GRP_SLDR] = {
> +				.base = 0xB000,
> +				.num_row = 2,
> +				.num_col = 11,
> +			},
> +			[IQS7222_REG_GRP_GPIO] = {
> +				.base = 0xC000,
> +				.num_row = 1,
> +				.num_col = 3,
> +			},
> +			[IQS7222_REG_GRP_SYS] = {
> +				.base = IQS7222_SYS_SETUP,
> +				.num_row = 1,
> +				.num_col = 13,
> +			},
> +		},
> +	},
>  	{
>  		.prod_num = IQS7222_PROD_NUM_A,
>  		.fw_major = 1,
> @@ -215,6 +275,7 @@ static const struct iqs7222_dev_desc iqs7222_devs[] = {
>  		.allow_offset = 9,
>  		.event_offset = 10,
>  		.comms_offset = 12,
> +		.legacy_gesture = true,
>  		.reg_grps = {
>  			[IQS7222_REG_GRP_STAT] = {
>  				.base = IQS7222_SYS_STATUS,
> @@ -874,6 +935,16 @@ static const struct iqs7222_prop_desc iqs7222_props[] = {
>  		.reg_offset = 9,
>  		.reg_shift = 8,
>  		.reg_width = 8,
> +		.val_pitch = 16,
> +		.label = "maximum gesture time",
> +	},
> +	{
> +		.name = "azoteq,gesture-max-ms",
> +		.reg_grp = IQS7222_REG_GRP_SLDR,
> +		.reg_key = IQS7222_REG_KEY_TAP_LEGACY,
> +		.reg_offset = 9,
> +		.reg_shift = 8,
> +		.reg_width = 8,
>  		.val_pitch = 4,
>  		.label = "maximum gesture time",
>  	},
> @@ -884,6 +955,16 @@ static const struct iqs7222_prop_desc iqs7222_props[] = {
>  		.reg_offset = 9,
>  		.reg_shift = 3,
>  		.reg_width = 5,
> +		.val_pitch = 16,
> +		.label = "minimum gesture time",
> +	},
> +	{
> +		.name = "azoteq,gesture-min-ms",
> +		.reg_grp = IQS7222_REG_GRP_SLDR,
> +		.reg_key = IQS7222_REG_KEY_TAP_LEGACY,
> +		.reg_offset = 9,
> +		.reg_shift = 3,
> +		.reg_width = 5,
>  		.val_pitch = 4,
>  		.label = "minimum gesture time",
>  	},
> @@ -897,6 +978,16 @@ static const struct iqs7222_prop_desc iqs7222_props[] = {
>  		.val_pitch = 16,
>  		.label = "gesture distance",
>  	},
> +	{
> +		.name = "azoteq,gesture-dist",
> +		.reg_grp = IQS7222_REG_GRP_SLDR,
> +		.reg_key = IQS7222_REG_KEY_AXIAL_LEGACY,
> +		.reg_offset = 10,
> +		.reg_shift = 8,
> +		.reg_width = 8,
> +		.val_pitch = 16,
> +		.label = "gesture distance",
> +	},
>  	{
>  		.name = "azoteq,gesture-max-ms",
>  		.reg_grp = IQS7222_REG_GRP_SLDR,
> @@ -904,6 +995,16 @@ static const struct iqs7222_prop_desc iqs7222_props[] = {
>  		.reg_offset = 10,
>  		.reg_shift = 0,
>  		.reg_width = 8,
> +		.val_pitch = 16,
> +		.label = "maximum gesture time",
> +	},
> +	{
> +		.name = "azoteq,gesture-max-ms",
> +		.reg_grp = IQS7222_REG_GRP_SLDR,
> +		.reg_key = IQS7222_REG_KEY_AXIAL_LEGACY,
> +		.reg_offset = 10,
> +		.reg_shift = 0,
> +		.reg_width = 8,
>  		.val_pitch = 4,
>  		.label = "maximum gesture time",
>  	},
> @@ -2133,8 +2234,18 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222,
>  		if (!event_node)
>  			continue;
>  
> +		/*
> +		 * Depending on the device, gestures are either offered using
> +		 * one of two timing resolutions, or are not supported at all.
> +		 */
>  		if (reg_offset)
>  			reg_key = IQS7222_REG_KEY_RESERVED;
> +		else if (dev_desc->legacy_gesture &&
> +			 iqs7222_sl_events[i].reg_key == IQS7222_REG_KEY_TAP)
> +			reg_key = IQS7222_REG_KEY_TAP_LEGACY;
> +		else if (dev_desc->legacy_gesture &&
> +			 iqs7222_sl_events[i].reg_key == IQS7222_REG_KEY_AXIAL)
> +			reg_key = IQS7222_REG_KEY_AXIAL_LEGACY;
>  		else
>  			reg_key = iqs7222_sl_events[i].reg_key;
>  
> -- 
> 2.34.1



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux