From a7be84613acc4f732f3aa9ab28da7e2e3a6bab0b Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Tue, 29 Mar 2016 18:56:12 -0400 Subject: [PATCH] greybus: interface: add Ara serial-number support Add support for reading the Ara serial-number attributes. Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/interface.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c index d0542e5a9ac2..27dbd79d2e19 100644 --- a/drivers/staging/greybus/interface.c +++ b/drivers/staging/greybus/interface.c @@ -24,6 +24,8 @@ #define DME_TOSHIBA_ARA_VID 0x6000 #define DME_TOSHIBA_ARA_PID 0x6001 +#define DME_TOSHIBA_ARA_SN0 0x6002 +#define DME_TOSHIBA_ARA_SN1 0x6003 #define DME_TOSHIBA_ARA_INIT_STATUS 0x6101 /* DDBL1 Manufacturer and Product ids */ @@ -42,6 +44,7 @@ static int gb_interface_dme_attr_get(struct gb_interface *intf, static int gb_interface_read_ara_dme(struct gb_interface *intf) { + u32 sn0, sn1; int ret; /* @@ -64,8 +67,15 @@ static int gb_interface_read_ara_dme(struct gb_interface *intf) if (ret) return ret; - /* FIXME: serial number not implemented */ - intf->serial_number = 0; + ret = gb_interface_dme_attr_get(intf, DME_TOSHIBA_ARA_SN0, &sn0); + if (ret) + return ret; + + ret = gb_interface_dme_attr_get(intf, DME_TOSHIBA_ARA_SN1, &sn1); + if (ret) + return ret; + + intf->serial_number = (u64)sn1 << 32 | sn0; return 0; } -- 2.20.1