Commit f84f9ae3 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Greg Kroah-Hartman
Browse files

usb: misc: usb3503: Add system sleep support in non-I2C mode



USB3503 chip can be used without any I2C connection, what is handled by
a simple platform device driver. Add support for resetting the chip (via
GPIO lines) during system suspend/resume cycle by adding calls to existing
suspend/resume functions used for E2C device.

Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2c904963
Loading
Loading
Loading
Loading
+30 −8
Original line number Original line Diff line number Diff line
@@ -355,11 +355,8 @@ static int usb3503_platform_remove(struct platform_device *pdev)
}
}


#ifdef CONFIG_PM_SLEEP
#ifdef CONFIG_PM_SLEEP
static int usb3503_i2c_suspend(struct device *dev)
static int usb3503_suspend(struct usb3503 *hub)
{
{
	struct i2c_client *client = to_i2c_client(dev);
	struct usb3503 *hub = i2c_get_clientdata(client);

	usb3503_switch_mode(hub, USB3503_MODE_STANDBY);
	usb3503_switch_mode(hub, USB3503_MODE_STANDBY);


	if (hub->clk)
	if (hub->clk)
@@ -368,11 +365,8 @@ static int usb3503_i2c_suspend(struct device *dev)
	return 0;
	return 0;
}
}


static int usb3503_i2c_resume(struct device *dev)
static int usb3503_resume(struct usb3503 *hub)
{
{
	struct i2c_client *client = to_i2c_client(dev);
	struct usb3503 *hub = i2c_get_clientdata(client);

	if (hub->clk)
	if (hub->clk)
		clk_prepare_enable(hub->clk);
		clk_prepare_enable(hub->clk);


@@ -380,11 +374,38 @@ static int usb3503_i2c_resume(struct device *dev)


	return 0;
	return 0;
}
}

static int usb3503_i2c_suspend(struct device *dev)
{
	struct i2c_client *client = to_i2c_client(dev);

	return usb3503_suspend(i2c_get_clientdata(client));
}

static int usb3503_i2c_resume(struct device *dev)
{
	struct i2c_client *client = to_i2c_client(dev);

	return usb3503_resume(i2c_get_clientdata(client));
}

static int usb3503_platform_suspend(struct device *dev)
{
	return usb3503_suspend(dev_get_drvdata(dev));
}

static int usb3503_platform_resume(struct device *dev)
{
	return usb3503_resume(dev_get_drvdata(dev));
}
#endif
#endif


static SIMPLE_DEV_PM_OPS(usb3503_i2c_pm_ops, usb3503_i2c_suspend,
static SIMPLE_DEV_PM_OPS(usb3503_i2c_pm_ops, usb3503_i2c_suspend,
		usb3503_i2c_resume);
		usb3503_i2c_resume);


static SIMPLE_DEV_PM_OPS(usb3503_platform_pm_ops, usb3503_platform_suspend,
		usb3503_platform_resume);

static const struct i2c_device_id usb3503_id[] = {
static const struct i2c_device_id usb3503_id[] = {
	{ USB3503_I2C_NAME, 0 },
	{ USB3503_I2C_NAME, 0 },
	{ }
	{ }
@@ -415,6 +436,7 @@ static struct platform_driver usb3503_platform_driver = {
	.driver = {
	.driver = {
		.name = USB3503_I2C_NAME,
		.name = USB3503_I2C_NAME,
		.of_match_table = of_match_ptr(usb3503_of_match),
		.of_match_table = of_match_ptr(usb3503_of_match),
		.pm = &usb3503_platform_pm_ops,
	},
	},
	.probe		= usb3503_platform_probe,
	.probe		= usb3503_platform_probe,
	.remove		= usb3503_platform_remove,
	.remove		= usb3503_platform_remove,