Message ID | 20240710162526.2341399-6-jbrunet@baylibre.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | reset: amlogic: move audio reset drivers out of CCF | expand |
Quoting Jerome Brunet (2024-07-10 09:25:14) > Add a callback to check the status of the level reset, as done in > the reset driver of the audio clock controller. Why? Presumably so that this driver has equivalent functionality to the reset code in the audio clk controller? > > Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> > --- > drivers/reset/reset-meson.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c > index 3e0447366ba6..65ba9190cb53 100644 > --- a/drivers/reset/reset-meson.c > +++ b/drivers/reset/reset-meson.c > @@ -69,6 +69,23 @@ static int meson_reset_level(struct reset_controller_dev *rcdev, > BIT(bit), assert ? BIT(bit) : 0); > } > > +static int meson_reset_status(struct reset_controller_dev *rcdev, > + unsigned long id) > +{ > + struct meson_reset *data = > + container_of(rcdev, struct meson_reset, rcdev); Nitpick: One line. > + unsigned int val, offset, bit; > + > + meson_reset_offset_and_bit(data, id, &offset, &bit); > + offset += data->param->level_offset; > + > + regmap_read(data->map, offset, &val); > + val = !!(BIT(bit) & val); > + > + Nitpick: Drop the extra newline? > + return val ^ data->param->level_low_reset; > +} > + > static int meson_reset_assert(struct reset_controller_dev *rcdev, > unsigned long id)
On Wed 10 Jul 2024 at 15:40, Stephen Boyd <sboyd@kernel.org> wrote: > Quoting Jerome Brunet (2024-07-10 09:25:14) >> Add a callback to check the status of the level reset, as done in >> the reset driver of the audio clock controller. > > Why? Presumably so that this driver has equivalent functionality to the > reset code in the audio clk controller? I thought the description was saying so. I'll be more explicit in v2 > >> >> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> >> --- >> drivers/reset/reset-meson.c | 18 ++++++++++++++++++ >> 1 file changed, 18 insertions(+) >> >> diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c >> index 3e0447366ba6..65ba9190cb53 100644 >> --- a/drivers/reset/reset-meson.c >> +++ b/drivers/reset/reset-meson.c >> @@ -69,6 +69,23 @@ static int meson_reset_level(struct reset_controller_dev *rcdev, >> BIT(bit), assert ? BIT(bit) : 0); >> } >> >> +static int meson_reset_status(struct reset_controller_dev *rcdev, >> + unsigned long id) >> +{ >> + struct meson_reset *data = >> + container_of(rcdev, struct meson_reset, rcdev); > > Nitpick: One line. > >> + unsigned int val, offset, bit; >> + >> + meson_reset_offset_and_bit(data, id, &offset, &bit); >> + offset += data->param->level_offset; >> + >> + regmap_read(data->map, offset, &val); >> + val = !!(BIT(bit) & val); >> + >> + > > Nitpick: Drop the extra newline? > >> + return val ^ data->param->level_low_reset; >> +} >> + >> static int meson_reset_assert(struct reset_controller_dev *rcdev, >> unsigned long id)
diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 3e0447366ba6..65ba9190cb53 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -69,6 +69,23 @@ static int meson_reset_level(struct reset_controller_dev *rcdev, BIT(bit), assert ? BIT(bit) : 0); } +static int meson_reset_status(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct meson_reset *data = + container_of(rcdev, struct meson_reset, rcdev); + unsigned int val, offset, bit; + + meson_reset_offset_and_bit(data, id, &offset, &bit); + offset += data->param->level_offset; + + regmap_read(data->map, offset, &val); + val = !!(BIT(bit) & val); + + + return val ^ data->param->level_low_reset; +} + static int meson_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) { @@ -85,6 +102,7 @@ static const struct reset_control_ops meson_reset_ops = { .reset = meson_reset_reset, .assert = meson_reset_assert, .deassert = meson_reset_deassert, + .status = meson_reset_status, }; static int meson_reset_probe(struct device *dev, struct regmap *map,
Add a callback to check the status of the level reset, as done in the reset driver of the audio clock controller. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> --- drivers/reset/reset-meson.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)