public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] r8152: Add MAPT for lg laptops
@ 2024-10-02  2:10 mike Seo
  2024-10-02  6:32 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: mike Seo @ 2024-10-02  2:10 UTC (permalink / raw)
  To: linux-usb

LG gram laptops support mac address pass-thru with its usb lan adapter
using Realtek USB ethernet Vendor and Product IDs, rtl8153b-2.
ACPI objects of the gram laptops are safisfied to -AD.
Signed-off-by: mike Seo <mikeseohyungjin@gmail.com>
---
 drivers/net/usb/r8152.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index a5612c799f5e..990e43e3def9 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -29,6 +29,7 @@
 #include <crypto/hash.h>
 #include <linux/usb/r8152.h>
 #include <net/gso.h>
+#include <linux/dmi.h>
 
 /* Information for net-next */
 #define NETNEXT_VERSION		"12"
@@ -949,6 +950,7 @@ struct r8152 {
 
 	u32 support_2500full:1;
 	u32 lenovo_macpassthru:1;
+	u32 lg_macpassthru:1;
 	u32 dell_tb_rx_agg_bug:1;
 	u16 ocp_base;
 	u16 speed;
@@ -1724,7 +1726,7 @@ static int vendor_mac_passthru_addr_read(struct r8152 *tp, struct sockaddr *sa)
 	} else {
 		/* test for -AD variant of RTL8153 */
 		ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_MISC_0);
-		if ((ocp_data & AD_MASK) == 0x1000) {
+		if ((ocp_data & AD_MASK) == 0x1000 || tp->lg_macpassthru) {
 			/* test for MAC address pass-through bit */
 			ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, EFUSE);
 			if ((ocp_data & PASS_THRU_MASK) != 1) {
@@ -9798,6 +9800,22 @@ static bool rtl8152_supports_lenovo_macpassthru(struct usb_device *udev)
 	return 0;
 }
 
+static bool rtl8152_supports_lg_macpassthru(struct usb_device *udev)
+{
+	int product_id = le16_to_cpu(udev->descriptor.idProduct);
+	int vendor_id = le16_to_cpu(udev->descriptor.idVendor);
+	const char *board = dmi_get_system_info(DMI_BOARD_VENDOR);
+
+	if (!strlen(board))
+		return 0;
+
+	if (!strncmp("LG Electronics", board, sizeof("LG Electronics"))) {
+		if (vendor_id == VENDOR_ID_REALTEK && product_id == 0x8153)
+			return 1;
+	}
+	return 0;
+}
+
 static int rtl8152_probe_once(struct usb_interface *intf,
 			      const struct usb_device_id *id, u8 version)
 {
@@ -9872,6 +9890,7 @@ static int rtl8152_probe_once(struct usb_interface *intf,
 	}
 
 	tp->lenovo_macpassthru = rtl8152_supports_lenovo_macpassthru(udev);
+	tp->lg_macpassthru = rtl8152_supports_lg_macpassthru(udev);
 
 	if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial &&
 	    (!strcmp(udev->serial, "000001000000") ||
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] r8152: Add MAPT for lg laptops
  2024-10-02  2:10 [PATCH] r8152: Add MAPT for lg laptops mike Seo
@ 2024-10-02  6:32 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2024-10-02  6:32 UTC (permalink / raw)
  To: mike Seo; +Cc: linux-usb

On Wed, Oct 02, 2024 at 11:10:05AM +0900, mike Seo wrote:
> LG gram laptops support mac address pass-thru with its usb lan adapter
> using Realtek USB ethernet Vendor and Product IDs, rtl8153b-2.
> ACPI objects of the gram laptops are safisfied to -AD.
> Signed-off-by: mike Seo <mikeseohyungjin@gmail.com>

We need a blank line between your signed-off-by and the changelog text.
Please always use scripts/checkpatch.pl before sending a patch out.

Also use scripts/get_maintainer.pl to determine who to send it to.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-02  6:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-02  2:10 [PATCH] r8152: Add MAPT for lg laptops mike Seo
2024-10-02  6:32 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox