Lines Matching refs:rk618
52 static int rk618_power_on(struct rk618 *rk618) in rk618_power_on() argument
57 ret = regulator_enable(rk618->supply); in rk618_power_on()
59 dev_err(rk618->dev, "failed to enable supply: %d\n", ret); in rk618_power_on()
63 if (rk618->enable_gpio) in rk618_power_on()
64 gpiod_direction_output(rk618->enable_gpio, 1); in rk618_power_on()
68 ret = regmap_read(rk618->regmap, 0x0000, ®); in rk618_power_on()
70 gpiod_direction_output(rk618->reset_gpio, 0); in rk618_power_on()
72 gpiod_direction_output(rk618->reset_gpio, 1); in rk618_power_on()
74 gpiod_direction_output(rk618->reset_gpio, 0); in rk618_power_on()
80 static void rk618_power_off(struct rk618 *rk618) in rk618_power_off() argument
82 gpiod_direction_output(rk618->reset_gpio, 1); in rk618_power_off()
84 if (rk618->enable_gpio) in rk618_power_off()
85 gpiod_direction_output(rk618->enable_gpio, 0); in rk618_power_off()
87 regulator_disable(rk618->supply); in rk618_power_off()
104 struct rk618 *rk618; in rk618_probe() local
107 rk618 = devm_kzalloc(dev, sizeof(*rk618), GFP_KERNEL); in rk618_probe()
108 if (!rk618) in rk618_probe()
111 rk618->dev = dev; in rk618_probe()
112 rk618->client = client; in rk618_probe()
113 i2c_set_clientdata(client, rk618); in rk618_probe()
115 rk618->supply = devm_regulator_get(dev, "power"); in rk618_probe()
116 if (IS_ERR(rk618->supply)) in rk618_probe()
117 return PTR_ERR(rk618->supply); in rk618_probe()
119 rk618->enable_gpio = devm_gpiod_get_optional(dev, "enable", 0); in rk618_probe()
120 if (IS_ERR(rk618->enable_gpio)) { in rk618_probe()
121 ret = PTR_ERR(rk618->enable_gpio); in rk618_probe()
126 rk618->reset_gpio = devm_gpiod_get(dev, "reset", 0); in rk618_probe()
127 if (IS_ERR(rk618->reset_gpio)) { in rk618_probe()
128 ret = PTR_ERR(rk618->reset_gpio); in rk618_probe()
133 rk618->clkin = devm_clk_get(dev, "clkin"); in rk618_probe()
134 if (IS_ERR(rk618->clkin)) { in rk618_probe()
136 return PTR_ERR(rk618->clkin); in rk618_probe()
139 ret = clk_prepare_enable(rk618->clkin); in rk618_probe()
145 rk618->regmap = devm_regmap_init_i2c(client, &rk618_regmap_config); in rk618_probe()
146 if (IS_ERR(rk618->regmap)) { in rk618_probe()
147 ret = PTR_ERR(rk618->regmap); in rk618_probe()
152 ret = rk618_power_on(rk618); in rk618_probe()
166 clk_disable_unprepare(rk618->clkin); in rk618_probe()
172 struct rk618 *rk618 = i2c_get_clientdata(client); in rk618_remove() local
174 mfd_remove_devices(rk618->dev); in rk618_remove()
175 rk618_power_off(rk618); in rk618_remove()
176 clk_disable_unprepare(rk618->clkin); in rk618_remove()
183 struct rk618 *rk618 = i2c_get_clientdata(client); in rk618_shutdown() local
185 rk618_power_off(rk618); in rk618_shutdown()
186 clk_disable_unprepare(rk618->clkin); in rk618_shutdown()