<commit_before>/*
 * Copyright (C) 2019 <NAME> <<EMAIL>>
 *
 * SPDX-License-Identifier: LGPL-2.1+
 */

#pragma once

#include "fu-synaptics-rmi-common.h"
#include "fu-udev-device.h"

#define FU_TYPE_SYNAPTICS_RMI_DEVICE (fu_synaptics_rmi_device_get_type ())
G_DECLARE_DERIVABLE_TYPE (FuSynapticsRmiDevice, fu_synaptics_rmi_device, FU, SYNAPTICS_RMI_DEVICE, FuUdevDevice)

typedef enum {
	FU_SYNAPTICS_RMI_DEVICE_FLAG_NONE		= 0,
	FU_SYNAPTICS_RMI_DEVICE_FLAG_ALLOW_FAILURE	= 1 << 0,
} FuSynapticsRmiDeviceFlags;

struct _FuSynapticsRmiDeviceClass
{
	FuUdevDeviceClass	parent_class;
	gboolean		 (*setup)			(FuSynapticsRmiDevice	*self,
								 GError			**error);
	gboolean		 (*query_status)		(FuSynapticsRmiDevice	*self,
								 GError			**error);
	gboolean		 (*write)			(FuSynapticsRmiDevice	*self,
								 guint16		 addr,
								 GByteArray		*req,
								 FuSynapticsRmiDeviceFlags flags,
								 GError			**error);
	GByteArray		*(*read)			(FuSynapticsRmiDevice	*self,
								 guint16		 addr,
								 gsize			 req_sz,
								 GError			**error);
	GByteArray		*(*read_packet_register)	(FuSynapticsRmiDevice	*self,
								 guint16		 addr,
								 gsize			 req_sz,
								 GError			**error);
	gboolean		 (*wait_for_attr)		(FuSynapticsRmiDevice	*self,
								 guint8			 source_mask,
								 guint			 timeout_ms,
								 GError			**error);
	gboolean		 (*set_page)			(FuSynapticsRmiDevice	*self,
								 guint8			 page,
								 GError			**error);
	gboolean		 (*disable_sleep)		(FuSynapticsRmiDevice	 *self,
								 GError			**error);
	gboolean		 (*write_bus_select)		(FuSynapticsRmiDevice	 *self,
								 guint8			 bus,
								 GError			**error);
	gboolean		 (*query_build_id)		(FuSynapticsRmiDevice	*self,
								 guint32		*build_id,
								 GError			**error);
	gboolean		 (*query_product_sub_id)	(FuSynapticsRmiDevice	 *self,
								 guint8			*product_sub_id,
								 GError			**error);
	gboolean		 (*enter_iep_mode)		(FuSynapticsRmiDevice	 *self,
								 GError			**error);
};

typedef struct {
	guint16			 block_count_cfg;
	guint16			 block_count_fw;
	guint16			 block_size;
	guint16			 config_length;
	guint16			 payload_length;
	guint32			 build_id;
	guint8			 bootloader_id[2];
	guint8			 status_addr;
} FuSynapticsRmiFlash;

#define RMI_F34_HAS_NEW_REG_MAP				(1 << 0)
#define RMI_F34_HAS_CONFIG_ID				(1 << 2)

#define RMI_F34_BLOCK_DATA_OFFSET			2
#define RMI_F34_BLOCK_DATA_V1_OFFSET			1

#define RMI_F34_ENABLE_WAIT_MS				300		/* ms */
#define RMI_F34_IDLE_WAIT_MS				500		/* ms */
<commit_msg>synaptics-rmi: Reduce the idle wait time<commit_after>/*
 * Copyright (C) 2019 <NAME> <<EMAIL>>
 *
 * SPDX-License-Identifier: LGPL-2.1+
 */

#pragma once

#include "fu-synaptics-rmi-common.h"
#include "fu-udev-device.h"

#define FU_TYPE_SYNAPTICS_RMI_DEVICE (fu_synaptics_rmi_device_get_type ())
G_DECLARE_DERIVABLE_TYPE (FuSynapticsRmiDevice, fu_synaptics_rmi_device, FU, SYNAPTICS_RMI_DEVICE, FuUdevDevice)

typedef enum {
	FU_SYNAPTICS_RMI_DEVICE_FLAG_NONE		= 0,
	FU_SYNAPTICS_RMI_DEVICE_FLAG_ALLOW_FAILURE	= 1 << 0,
} FuSynapticsRmiDeviceFlags;

struct _FuSynapticsRmiDeviceClass
{
	FuUdevDeviceClass	parent_class;
	gboolean		 (*setup)			(FuSynapticsRmiDevice	*self,
								 GError			**error);
	gboolean		 (*query_status)		(FuSynapticsRmiDevice	*self,
								 GError			**error);
	gboolean		 (*write)			(FuSynapticsRmiDevice	*self,
								 guint16		 addr,
								 GByteArray		*req,
								 FuSynapticsRmiDeviceFlags flags,
								 GError			**error);
	GByteArray		*(*read)			(FuSynapticsRmiDevice	*self,
								 guint16		 addr,
								 gsize			 req_sz,
								 GError			**error);
	GByteArray		*(*read_packet_register)	(FuSynapticsRmiDevice	*self,
								 guint16		 addr,
								 gsize			 req_sz,
								 GError			**error);
	gboolean		 (*wait_for_attr)		(FuSynapticsRmiDevice	*self,
								 guint8			 source_mask,
								 guint			 timeout_ms,
								 GError			**error);
	gboolean		 (*set_page)			(FuSynapticsRmiDevice	*self,
								 guint8			 page,
								 GError			**error);
	gboolean		 (*disable_sleep)		(FuSynapticsRmiDevice	 *self,
								 GError			**error);
	gboolean		 (*write_bus_select)		(FuSynapticsRmiDevice	 *self,
								 guint8			 bus,
								 GError			**error);
	gboolean		 (*query_build_id)		(FuSynapticsRmiDevice	*self,
								 guint32		*build_id,
								 GError			**error);
	gboolean		 (*query_product_sub_id)	(FuSynapticsRmiDevice	 *self,
								 guint8			*product_sub_id,
								 GError			**error);
	gboolean		 (*enter_iep_mode)		(FuSynapticsRmiDevice	 *self,
								 GError			**error);
};

typedef struct {
	guint16			 block_count_cfg;
	guint16			 block_count_fw;
	guint16			 block_size;
	guint16			 config_length;
	guint16			 payload_length;
	guint32			 build_id;
	guint8			 bootloader_id[2];
	guint8			 status_addr;
} FuSynapticsRmiFlash;

#define RMI_F34_HAS_NEW_REG_MAP				(1 << 0)
#define RMI_F34_HAS_CONFIG_ID				(1 << 2)

#define RMI_F34_BLOCK_DATA_OFFSET			2
#define RMI_F34_BLOCK_DATA_V1_OFFSET			1

#define RMI_F34_ENABLE_WAIT_MS				300		/* ms */
#define RMI_F34_IDLE_WAIT_MS				20		/* ms */

{'fraction_non_alphanumeric': 0.09305993690851735, 'fraction_numerical': 0.02385646687697161, 'mean_word_length': 3.154791154791155, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7651976', 'n_tokens_mistral': 2684, 'n_tokens_neox': 2000, 'n_words': 353}