Re: [PATCH 4/5] Input: zinitix - Read and cache device version numbers

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

 



On Sun, Apr 10, 2022 at 02:00:58PM +0200, Linus Walleij wrote:
>  static int zinitix_init_touch(struct bt541_ts_data *bt541)
>  {
>  	struct i2c_client *client = bt541->client;
>  	int i;
>  	int error;
> +	static bool read_static = false;

This needs to be per-device state.

>  
>  	error = zinitix_write_cmd(client, ZINITIX_SWRESET_CMD);
>  	if (error) {
> @@ -203,6 +222,24 @@ static int zinitix_init_touch(struct bt541_ts_data *bt541)
>  		return error;
>  	}
>  
> +	/*
> +	 * Read and cache the chip revision and firmware version the first time
> +	 * we get here.
> +	 */
> +	if (!read_static) {
> +		bt541->chip_revision = zinitix_get_u16_reg(bt541,
> +					ZINITIX_CHIP_REVISION);
> +		bt541->firmware_version = zinitix_get_u16_reg(bt541,
> +					ZINITIX_FIRMWARE_VERSION);
> +		bt541->regdata_version = zinitix_get_u16_reg(bt541,
> +					ZINITIX_DATA_VERSION_REG);
> +		dev_info(bt541->dev,
> +			 "chip revision %04x firmware version %04x regdata version %04x\n",
> +			 bt541->chip_revision, bt541->firmware_version,
> +			 bt541->regdata_version);

Is this only for bringup efforts?

> +		read_static = true;
> +	}
> +
>  	error = zinitix_write_u16(client, ZINITIX_INT_ENABLE_FLAG, 0x0);
>  	if (error) {
>  		dev_err(bt541->dev,
> -- 
> 2.35.1
> 

Thanks.

-- 
Dmitry



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux