Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: typec: tcpci_rt1711h: Drop unnecessary VID/PID/DID checks

Existing checks for VID/PID/DID in the driver are redundant since the
driver is already matched to the device via I2C device ID and OF
compatible strings, and they preclude the use of fallback compatibles.

Remove them to make the driver slimmer and adding new clones easier.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Alexey Charkov <alchark@flipper.net>
Link: https://patch.msgid.link/20260318-husb311-v4-4-69e029255430@flipper.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alexey Charkov and committed by
Greg Kroah-Hartman
b41470c6 aa9de45c

+2 -57
+2 -57
drivers/usb/typec/tcpm/tcpci_rt1711h.c
··· 18 18 #include <linux/regmap.h> 19 19 #include <linux/regulator/consumer.h> 20 20 21 - #define RT1711H_VID 0x29CF 22 - #define ET7304_VID 0x6DCF 23 - #define RT1711H_PID 0x1711 24 - #define RT1711H_DID 0x2171 25 - #define RT1715_DID 0x2173 26 - #define ET7304_DID 0x2173 27 - 28 21 #define RT1711H_PHYCTRL1 0x80 29 22 #define RT1711H_PHYCTRL2 0x81 30 23 ··· 50 57 51 58 struct rt1711h_chip_info { 52 59 u32 rxdz_sel; 53 - u16 vid; 54 - u16 did; 55 60 bool enable_pd30_extended_message; 56 61 }; 57 62 ··· 295 304 return 0; 296 305 } 297 306 298 - static int rt1711h_check_revision(struct i2c_client *i2c, struct rt1711h_chip *chip) 299 - { 300 - int ret; 301 - 302 - ret = i2c_smbus_read_word_data(i2c, TCPC_VENDOR_ID); 303 - if (ret < 0) 304 - return ret; 305 - if (ret != chip->info->vid) { 306 - dev_err(&i2c->dev, "vid is not correct, 0x%04x\n", ret); 307 - return -ENODEV; 308 - } 309 - ret = i2c_smbus_read_word_data(i2c, TCPC_PRODUCT_ID); 310 - if (ret < 0) 311 - return ret; 312 - if (ret != RT1711H_PID) { 313 - dev_err(&i2c->dev, "pid is not correct, 0x%04x\n", ret); 314 - return -ENODEV; 315 - } 316 - ret = i2c_smbus_read_word_data(i2c, TCPC_BCD_DEV); 317 - if (ret < 0) 318 - return ret; 319 - if (ret != chip->info->did) { 320 - dev_err(&i2c->dev, "did is not correct, 0x%04x\n", ret); 321 - return -ENODEV; 322 - } 323 - dev_dbg(&i2c->dev, "did is 0x%04x\n", ret); 324 - return ret; 325 - } 326 - 327 307 static int rt1711h_probe(struct i2c_client *client) 328 308 { 329 309 int ret; ··· 310 348 return -ENOMEM; 311 349 312 350 chip->info = i2c_get_match_data(client); 313 - 314 - ret = rt1711h_check_revision(client, chip); 315 - if (ret < 0) { 316 - dev_err(&client->dev, "check vid/pid fail\n"); 317 - return ret; 318 - } 319 351 320 352 chip->data.regmap = devm_regmap_init_i2c(client, 321 353 &rt1711h_regmap_config); ··· 364 408 tcpci_unregister_port(chip->tcpci); 365 409 } 366 410 367 - static const struct rt1711h_chip_info et7304 = { 368 - .rxdz_sel = RT1711H_BMCIO_RXDZSEL, 369 - .vid = ET7304_VID, 370 - .did = ET7304_DID, 371 - .enable_pd30_extended_message = true, 372 - }; 373 - 374 411 static const struct rt1711h_chip_info rt1711h = { 375 - .vid = RT1711H_VID, 376 - .did = RT1711H_DID, 377 412 }; 378 413 379 414 static const struct rt1711h_chip_info rt1715 = { 380 415 .rxdz_sel = RT1711H_BMCIO_RXDZSEL, 381 - .vid = RT1711H_VID, 382 - .did = RT1715_DID, 383 416 .enable_pd30_extended_message = true, 384 417 }; 385 418 386 419 static const struct i2c_device_id rt1711h_id[] = { 387 - { "et7304", (kernel_ulong_t)&et7304 }, 420 + { "et7304", (kernel_ulong_t)&rt1715 }, 388 421 { "rt1711h", (kernel_ulong_t)&rt1711h }, 389 422 { "rt1715", (kernel_ulong_t)&rt1715 }, 390 423 {} ··· 381 436 MODULE_DEVICE_TABLE(i2c, rt1711h_id); 382 437 383 438 static const struct of_device_id rt1711h_of_match[] = { 384 - { .compatible = "etekmicro,et7304", .data = &et7304 }, 439 + { .compatible = "etekmicro,et7304", .data = &rt1715 }, 385 440 { .compatible = "richtek,rt1711h", .data = &rt1711h }, 386 441 { .compatible = "richtek,rt1715", .data = &rt1715 }, 387 442 {}