Re: [PATCH v3 2/2] USB: typec: Add TI TPS25750 USB Type-C controller
From: Krzysztof Kozlowski
Date: Sun Aug 20 2023 - 02:31:57 EST
On 20/08/2023 07:23, Abdel Alkuor wrote:
> From: Abdel Alkuor <abdelalkuor@xxxxxxxxxx>
>
> TPS25750 is USB Type-C controller and Power Delivery controller.
>
> TPS25750 needs to be configured after a cold reset. The configuration
> can be applied either from an external EEPROM connected to the
> controller or by a host using I2C. TI provides an online GUI that
> can be used to generate the configuration binary.
> Tool link: https://tinyurl.com/2s3watcm
> P.S. It requires a TI account to be able to use the tool.
>
...
> +
> +static void tps25750_remove(struct i2c_client *client)
> +{
> + struct tps25750 *tps = i2c_get_clientdata(client);
> +
> + tps25750_disconnect(tps, 0);
> + typec_unregister_port(tps->port);
> + usb_role_switch_put(tps->role_sw);
> +
> + /* clear the patch by a hard reset */
> + tps25750_exec_normal_cmd(tps, TPS_4CC_GAID);
> +}
> +
> +static int __maybe_unused tps25750_suspend(struct device *dev)
> +{
> + /* TODO: should we remove the patch? */
> + return 0;
> +}
> +
> +static int __maybe_unused tps25750_resume(struct device *dev)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + struct tps25750 *tps = i2c_get_clientdata(client);
> +
> + /* The controller needs to be reinitialized again
Format is:
/*
* The....
> + * if it is powered off as config is not persisted
> + */
> + return tps25750_init(tps);
> +}
> +
> +static const struct dev_pm_ops tps25750_pm_ops = {
> + SET_SYSTEM_SLEEP_PM_OPS(tps25750_suspend, tps25750_resume)
> +};
> +
> +static const struct of_device_id tps25750_of_match[] = {
> + { .compatible = "ti,tps25750", },
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, tps25750_of_match);
> +
> +static const struct i2c_device_id tps25750_id[] = {
> + { "tps25750" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, tps25750_id);
> +
> +static struct i2c_driver tps25750_i2c_driver = {
> + .driver = {
> + .name = "tps25750",
> + .pm = pm_ptr(&tps25750_pm_ops),
> + .of_match_table = of_match_ptr(tps25750_of_match),
Drop of_match_ptr(). It will cause warnings.
> + },
> + .probe_new = tps25750_probe,
> + .remove = tps25750_remove,
> + .id_table = tps25750_id,
> +};
> +module_i2c_driver(tps25750_i2c_driver);
Best regards,
Krzysztof