usb: typec: ucsi: add get_fw_info function
Greg Kroah-Hartman
maintainerPATCH v2 1/6 usb: typec: ucsi: add get_fw_info function
Quoted 20 lines · Ajay Gupta
Function is to get the details of ccg firmware and device version. It will be useful in debugging and also during firmware update.
Signed-off-by Ajay Gupta <[email protected]>---
Changes from v1:
- Updated commit message
- Dropped uses of bitfield
- Removeddev_dbgprintsdrivers/usb/typec/ucsi/ucsi_ccg.c | 58 +++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-)drivers/usb/typec/ucsi/ucsi_ccg.c +0
-0@@ -17,15 +17,46 @@#include <asm/unaligned.h> #include "ucsi.h"
drivers/usb/typec/ucsi/ucsi_ccg.c line 28
Quoted 10 lines
drivers/usb/typec/ucsi/ucsi_ccg.c +9
-0+struct ccg_dev_info { +#define CCG_DEVINFO_FWMODE_SHIFT (0) +#define CCG_DEVINFO_FWMODE_MASK (0x3 << CCG_DEVINFO_FWMODE_SHIFT) +#define CCG_DEVINFO_PDPORTS_SHIFT (2) +#define CCG_DEVINFO_PDPORTS_MASK (0x3 << CCG_DEVINFO_PDPORTS_SHIFT) +u8 mode; +u8 bl_mode; +u16 silicon_id; +u16 bl_last_row;
__le16 I am guessing for both of these?
drivers/usb/typec/ucsi/ucsi_ccg.c line 29
Quoted 1 line
drivers/usb/typec/ucsi/ucsi_ccg.c +1
-0+};
Should this be a packed structure?
drivers/usb/typec/ucsi/ucsi_ccg.c line 32
Quoted 3 lines
drivers/usb/typec/ucsi/ucsi_ccg.c +3
-0+ +struct version_format { +u16 build;
__le16?
drivers/usb/typec/ucsi/ucsi_ccg.c line 39
Quoted 7 lines
drivers/usb/typec/ucsi/ucsi_ccg.c +7
-0+u8 patch; +u8 ver; +#define CCG_VERSION_MIN_SHIFT (0) +#define CCG_VERSION_MIN_MASK (0xf << CCG_VERSION_MIN_SHIFT) +#define CCG_VERSION_MAJ_SHIFT (4) +#define CCG_VERSION_MAJ_MASK (0xf << CCG_VERSION_MAJ_SHIFT) +};
Also, packed?
drivers/usb/typec/ucsi/ucsi_ccg.c line 52
Quoted 13 lines
drivers/usb/typec/ucsi/ucsi_ccg.c +8
-0+ +struct version_info { +struct version_format base; +struct version_format app; +}; +struct ucsi_ccg {struct device *dev;struct ucsi *ucsi;struct ucsi_ppm ppm;struct i2c_client *client; +struct ccg_dev_info info; +struct version_info version[3 ];
3 versions? Any hint as to what they are all "called"?
thanks,
greg k-h