mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
pwm: meson: Simplify get_state() callback
In .get_state() callback meson_pwm_channel struct are used to store lo and hi reg values but they are never reused after that so for clearness use local variable instead. Signed-off-by: George Stark <gnstark@salutedevices.com> Link: https://lore.kernel.org/r/20241119125318.3492261-2-gnstark@salutedevices.com Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
This commit is contained in:
parent
8ffd015db8
commit
8c22e89040
|
|
@ -309,21 +309,20 @@ static int meson_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
|
|||
{
|
||||
struct meson_pwm *meson = to_meson_pwm(chip);
|
||||
struct meson_pwm_channel_data *channel_data;
|
||||
struct meson_pwm_channel *channel;
|
||||
unsigned int hi, lo;
|
||||
u32 value;
|
||||
|
||||
channel = &meson->channels[pwm->hwpwm];
|
||||
channel_data = &meson_pwm_per_channel_data[pwm->hwpwm];
|
||||
|
||||
value = readl(meson->base + REG_MISC_AB);
|
||||
state->enabled = value & channel_data->pwm_en_mask;
|
||||
|
||||
value = readl(meson->base + channel_data->reg_offset);
|
||||
channel->lo = FIELD_GET(PWM_LOW_MASK, value);
|
||||
channel->hi = FIELD_GET(PWM_HIGH_MASK, value);
|
||||
lo = FIELD_GET(PWM_LOW_MASK, value);
|
||||
hi = FIELD_GET(PWM_HIGH_MASK, value);
|
||||
|
||||
state->period = meson_pwm_cnt_to_ns(chip, pwm, channel->lo + channel->hi);
|
||||
state->duty_cycle = meson_pwm_cnt_to_ns(chip, pwm, channel->hi);
|
||||
state->period = meson_pwm_cnt_to_ns(chip, pwm, lo + hi);
|
||||
state->duty_cycle = meson_pwm_cnt_to_ns(chip, pwm, hi);
|
||||
|
||||
state->polarity = PWM_POLARITY_NORMAL;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user