On Thu, Nov 18, 2021 at 02:58:50PM -0600, Bjorn Andersson wrote: > On Thu 18 Nov 04:45 CST 2021, Stephan Gerhold wrote: > > > On Wed, Nov 17, 2021 at 07:00:58PM -0600, Bjorn Andersson wrote: > > > On Mon 18 Oct 06:08 CDT 2021, Stephan Gerhold wrote: > > > > > > > Not all RPM firmware versions have the dynamic sleep stats offset > > > > available. Older versions use a fixed offset of 0xdba0. > > > > > > > > Add support for this using a new qcom,rpm-legacy-stats compatible > > > > that can be used for older SoCs like MSM8916. > > > > > > > > Suggested-by: Maulik Shah <mkshah@xxxxxxxxxxxxxx> > > > > Signed-off-by: Stephan Gerhold <stephan@xxxxxxxxxxx> > > > > --- > > > > drivers/soc/qcom/qcom_stats.c | 10 ++++++++++ > > > > 1 file changed, 10 insertions(+) > > > > > > > > diff --git a/drivers/soc/qcom/qcom_stats.c b/drivers/soc/qcom/qcom_stats.c > > > > index 817505bd99b5..67728de718fd 100644 > > > > --- a/drivers/soc/qcom/qcom_stats.c > > > > +++ b/drivers/soc/qcom/qcom_stats.c > > > > @@ -237,6 +237,15 @@ static const struct stats_config rpm_data = { > > > > .subsystem_stats_in_smem = false, > > > > }; > > > > > > > > +/* Older RPM firmwares have the stats at a fixed offset instead */ > > > > +static const struct stats_config rpm_legacy_data = { > > > > + .stats_offset = 0xdba0, > > > > + .num_records = 2, > > > > + .appended_stats_avail = true, > > > > + .dynamic_offset = false, > > > > + .subsystem_stats_in_smem = false, > > > > +}; > > > > > > Is this the only variation that existed back in the "legacy" days? Will > > > we end up with multiple "legacy" variants? > > > > > > > I think most old platforms that are still somewhat maintained use 0xdba0 > > (e.g. MSM8916, MSM8974, APQ8084, MSM8226). > > I found a different offset for APQ8064, MSM8960, but they also seem to > > use a different stats format ("v1" instead of "v2") which is not > > currently supported by the qcom_stats driver here. > > > > Okay, so there's an even more legacy format as well... > We could use qcom,rpm-even-more-legacy-stats for those. ;D (just kidding) > > I guess I could add SoC-specific compatibles if you prefer (e.g. > > "qcom,rpm-stats-msm8916"), or do you have any other suggestion? > > > > Yes, as we have examples of another "legacy format" I would prefer that > we sprinkle some platform names in there; and as newer platforms all > seems to use the same format this effort should be bound to whatever old > platforms we end up supporting. > > Nit. I would prefer the qcom,msm8916-rpm-stats format though. > Both sound good to me, I will send a v2 with the "qcom,msm8916-rpm-stats" compatible instead. Thanks, Stephan