Lines Matching refs:drvdata

56 	struct pwm_regulator_data *drvdata = rdev_get_drvdata(rdev);  in pwm_regulator_init_state()  local
61 pwm_get_state(drvdata->pwm, &pwm_state); in pwm_regulator_init_state()
65 if (dutycycle == drvdata->duty_cycle_table[i].dutycycle) { in pwm_regulator_init_state()
66 drvdata->state = i; in pwm_regulator_init_state()
74 struct pwm_regulator_data *drvdata = rdev_get_drvdata(rdev); in pwm_regulator_get_voltage_sel() local
76 if (drvdata->state < 0) in pwm_regulator_get_voltage_sel()
79 return drvdata->state; in pwm_regulator_get_voltage_sel()
85 struct pwm_regulator_data *drvdata = rdev_get_drvdata(rdev); in pwm_regulator_set_voltage_sel() local
89 pwm_init_state(drvdata->pwm, &pstate); in pwm_regulator_set_voltage_sel()
91 drvdata->duty_cycle_table[selector].dutycycle, 100); in pwm_regulator_set_voltage_sel()
93 ret = pwm_apply_might_sleep(drvdata->pwm, &pstate); in pwm_regulator_set_voltage_sel()
99 drvdata->state = selector; in pwm_regulator_set_voltage_sel()
107 struct pwm_regulator_data *drvdata = rdev_get_drvdata(rdev); in pwm_regulator_list_voltage() local
112 return drvdata->duty_cycle_table[selector].uV; in pwm_regulator_list_voltage()
117 struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev); in pwm_regulator_enable() local
119 gpiod_set_value_cansleep(drvdata->enb_gpio, 1); in pwm_regulator_enable()
121 return pwm_enable(drvdata->pwm); in pwm_regulator_enable()
126 struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev); in pwm_regulator_disable() local
128 pwm_disable(drvdata->pwm); in pwm_regulator_disable()
130 gpiod_set_value_cansleep(drvdata->enb_gpio, 0); in pwm_regulator_disable()
137 struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev); in pwm_regulator_is_enabled() local
139 if (drvdata->enb_gpio && !gpiod_get_value_cansleep(drvdata->enb_gpio)) in pwm_regulator_is_enabled()
142 return pwm_is_enabled(drvdata->pwm); in pwm_regulator_is_enabled()
147 struct pwm_regulator_data *drvdata = rdev_get_drvdata(rdev); in pwm_regulator_get_voltage() local
148 unsigned int min_uV_duty = drvdata->continuous.min_uV_dutycycle; in pwm_regulator_get_voltage()
149 unsigned int max_uV_duty = drvdata->continuous.max_uV_dutycycle; in pwm_regulator_get_voltage()
150 unsigned int duty_unit = drvdata->continuous.dutycycle_unit; in pwm_regulator_get_voltage()
158 pwm_get_state(drvdata->pwm, &pstate); in pwm_regulator_get_voltage()
187 struct pwm_regulator_data *drvdata = rdev_get_drvdata(rdev); in pwm_regulator_set_voltage() local
188 unsigned int min_uV_duty = drvdata->continuous.min_uV_dutycycle; in pwm_regulator_set_voltage()
189 unsigned int max_uV_duty = drvdata->continuous.max_uV_dutycycle; in pwm_regulator_set_voltage()
190 unsigned int duty_unit = drvdata->continuous.dutycycle_unit; in pwm_regulator_set_voltage()
199 pwm_init_state(drvdata->pwm, &pstate); in pwm_regulator_set_voltage()
222 ret = pwm_apply_might_sleep(drvdata->pwm, &pstate); in pwm_regulator_set_voltage()
257 struct pwm_regulator_data *drvdata) in pwm_regulator_init_table() argument
285 drvdata->state = -ENOTRECOVERABLE; in pwm_regulator_init_table()
286 drvdata->duty_cycle_table = duty_cycle_table; in pwm_regulator_init_table()
287 drvdata->desc.ops = &pwm_regulator_voltage_table_ops; in pwm_regulator_init_table()
288 drvdata->desc.n_voltages = length / sizeof(*duty_cycle_table); in pwm_regulator_init_table()
294 struct pwm_regulator_data *drvdata) in pwm_regulator_init_continuous() argument
299 drvdata->desc.ops = &pwm_regulator_voltage_continuous_ops; in pwm_regulator_init_continuous()
300 drvdata->desc.continuous_voltage_range = true; in pwm_regulator_init_continuous()
312 drvdata->continuous.dutycycle_unit = dutycycle_unit; in pwm_regulator_init_continuous()
313 drvdata->continuous.min_uV_dutycycle = dutycycle_range[0]; in pwm_regulator_init_continuous()
314 drvdata->continuous.max_uV_dutycycle = dutycycle_range[1]; in pwm_regulator_init_continuous()
322 struct pwm_regulator_data *drvdata; in pwm_regulator_probe() local
334 drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); in pwm_regulator_probe()
335 if (!drvdata) in pwm_regulator_probe()
338 memcpy(&drvdata->desc, &pwm_regulator_desc, sizeof(drvdata->desc)); in pwm_regulator_probe()
341 ret = pwm_regulator_init_table(pdev, drvdata); in pwm_regulator_probe()
343 ret = pwm_regulator_init_continuous(pdev, drvdata); in pwm_regulator_probe()
348 &drvdata->desc); in pwm_regulator_probe()
354 config.driver_data = drvdata; in pwm_regulator_probe()
357 drvdata->pwm = devm_pwm_get(&pdev->dev, NULL); in pwm_regulator_probe()
358 if (IS_ERR(drvdata->pwm)) in pwm_regulator_probe()
359 return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->pwm), in pwm_regulator_probe()
366 drvdata->enb_gpio = devm_gpiod_get_optional(&pdev->dev, "enable", in pwm_regulator_probe()
368 if (IS_ERR(drvdata->enb_gpio)) { in pwm_regulator_probe()
369 ret = PTR_ERR(drvdata->enb_gpio); in pwm_regulator_probe()
374 ret = pwm_adjust_config(drvdata->pwm); in pwm_regulator_probe()
379 &drvdata->desc, &config); in pwm_regulator_probe()
383 drvdata->desc.name, ret); in pwm_regulator_probe()