Lines Matching refs:iqs620_pwm

48 static int iqs620_pwm_init(struct iqs620_pwm_private *iqs620_pwm,  in iqs620_pwm_init()  argument
51 struct iqs62x_core *iqs62x = iqs620_pwm->iqs62x; in iqs620_pwm_init()
70 struct iqs620_pwm_private *iqs620_pwm; in iqs620_pwm_apply() local
81 iqs620_pwm = iqs620_pwm_from_chip(chip); in iqs620_pwm_apply()
101 mutex_lock(&iqs620_pwm->lock); in iqs620_pwm_apply()
103 ret = iqs620_pwm_init(iqs620_pwm, duty_scale); in iqs620_pwm_apply()
105 iqs620_pwm->duty_scale = duty_scale; in iqs620_pwm_apply()
107 mutex_unlock(&iqs620_pwm->lock); in iqs620_pwm_apply()
115 struct iqs620_pwm_private *iqs620_pwm; in iqs620_pwm_get_state() local
117 iqs620_pwm = iqs620_pwm_from_chip(chip); in iqs620_pwm_get_state()
119 mutex_lock(&iqs620_pwm->lock); in iqs620_pwm_get_state()
127 state->enabled = iqs620_pwm->duty_scale > 0; in iqs620_pwm_get_state()
128 state->duty_cycle = DIV_ROUND_UP(iqs620_pwm->duty_scale * in iqs620_pwm_get_state()
131 mutex_unlock(&iqs620_pwm->lock); in iqs620_pwm_get_state()
142 struct iqs620_pwm_private *iqs620_pwm; in iqs620_pwm_notifier() local
148 iqs620_pwm = container_of(notifier, struct iqs620_pwm_private, in iqs620_pwm_notifier()
151 mutex_lock(&iqs620_pwm->lock); in iqs620_pwm_notifier()
158 ret = iqs620_pwm_init(iqs620_pwm, iqs620_pwm->duty_scale); in iqs620_pwm_notifier()
160 mutex_unlock(&iqs620_pwm->lock); in iqs620_pwm_notifier()
163 dev_err(iqs620_pwm->dev, in iqs620_pwm_notifier()
178 struct iqs620_pwm_private *iqs620_pwm = context; in iqs620_pwm_notifier_unregister() local
181 ret = blocking_notifier_chain_unregister(&iqs620_pwm->iqs62x->nh, in iqs620_pwm_notifier_unregister()
182 &iqs620_pwm->notifier); in iqs620_pwm_notifier_unregister()
184 dev_err(iqs620_pwm->dev, in iqs620_pwm_notifier_unregister()
192 struct iqs620_pwm_private *iqs620_pwm; in iqs620_pwm_probe() local
196 chip = devm_pwmchip_alloc(&pdev->dev, 1, sizeof(*iqs620_pwm)); in iqs620_pwm_probe()
200 iqs620_pwm = iqs620_pwm_from_chip(chip); in iqs620_pwm_probe()
201 iqs620_pwm->dev = &pdev->dev; in iqs620_pwm_probe()
202 iqs620_pwm->iqs62x = iqs62x; in iqs620_pwm_probe()
213 iqs620_pwm->duty_scale = val + 1; in iqs620_pwm_probe()
218 mutex_init(&iqs620_pwm->lock); in iqs620_pwm_probe()
220 iqs620_pwm->notifier.notifier_call = iqs620_pwm_notifier; in iqs620_pwm_probe()
221 ret = blocking_notifier_chain_register(&iqs620_pwm->iqs62x->nh, in iqs620_pwm_probe()
222 &iqs620_pwm->notifier); in iqs620_pwm_probe()
230 iqs620_pwm); in iqs620_pwm_probe()