genesys: scaler: Allow to specify Cfi

This allows to specify the Cfi device via the GenesysScalerCfiFlashId
quirk key.
This commit is contained in:
Gaël PORTAY 2022-06-03 13:23:14 +02:00 committed by Gaël PORTAY
parent 6f7c4bb195
commit 882ab0812f
3 changed files with 24 additions and 1 deletions

View File

@ -126,6 +126,15 @@ Scaler GPIO value.
Since 1.7.6.
### GenesysScalerCfiFlashId
CFI Flash Id.
* HP M24fd USB-C Monitor: `0xC22016`
* HP M27fd USB-C Monitor: `0xC84016`
Since 1.8.2.
## Runtime Requirement
The USB Hub devices and its attached Scaler require libgusb version [0.3.8][1] or later to be detected.

View File

@ -63,6 +63,7 @@ struct _FuGenesysScalerDevice {
FuDevice parent_instance;
guint8 level;
FuGenesysPublicKey public_key;
guint32 cfi_flash_id;
FuCfiDevice *cfi_device;
FuGenesysVendorCommand vc;
guint32 sector_size;
@ -1643,8 +1644,10 @@ fu_genesys_scaler_device_setup(FuDevice *device, GError **error)
guint64 size;
guint32 sector_size;
guint32 page_size;
g_autofree gchar *flash_id = NULL;
self->cfi_device = fu_cfi_device_new(fu_device_get_context(FU_DEVICE(self)), "C84016");
flash_id = g_strdup_printf("%06X", self->cfi_flash_id);
self->cfi_device = fu_cfi_device_new(fu_device_get_context(FU_DEVICE(self)), flash_id);
if (!fu_device_setup(FU_DEVICE(self->cfi_device), error))
return FALSE;
@ -1915,6 +1918,7 @@ fu_genesys_scaler_device_to_string(FuDevice *device, guint idt, GString *str)
fu_common_string_append_kx(str, idt, "GpioOutputRegister", self->gpio_out_reg);
fu_common_string_append_kx(str, idt, "GpioEnableRegister", self->gpio_en_reg);
fu_common_string_append_kx(str, idt, "GpioValue", self->gpio_val);
fu_common_string_append_kx(str, idt, "CfiFlashId", self->cfi_flash_id);
}
static gboolean
@ -1958,6 +1962,14 @@ fu_genesys_scaler_device_set_quirk_kv(FuDevice *device,
/* success */
return TRUE;
}
if (g_strcmp0(key, "GenesysScalerCfiFlashId") == 0) {
if (!fu_common_strtoull_full(value, &tmp, 0, 0x00ffffffU, error))
return FALSE;
self->cfi_flash_id = tmp;
/* success */
return TRUE;
}
/* failure */
g_set_error_literal(error,

View File

@ -41,6 +41,7 @@ Flags = use-i2c-ch0
GenesysScalerGpioOutputRegister = 0x0426
GenesysScalerGpioEnableRegister = 0x0428
GenesysScalerGpioValue = 0x01
GenesysScalerCfiFlashId = 0xC22016
[GENESYS_SCALER\MSTAR_TSUM_G&PUBKEY_847A3650-8648-586B-83C8-8B53714F37E3&PANELREV_RIM101]
Name = HP M27fd USB-C Monitor
@ -48,3 +49,4 @@ Flags = use-i2c-ch0
GenesysScalerGpioOutputRegister = 0x0426
GenesysScalerGpioEnableRegister = 0x0428
GenesysScalerGpioValue = 0x01
GenesysScalerCfiFlashId = 0xC84016