1. 11 Aug, 2023 6 commits
    • Rafael J. Wysocki's avatar
      thermal: intel: intel_soc_dts_iosf: Rework critical trip setup · 02a49aac
      Rafael J. Wysocki authored
      Critical trip points appear in the DTS thermal zones only after those
      thermal zones have been registered via intel_soc_dts_iosf_init().
      Moreover, they are "created" by changing the type of an existing trip
      point from THERMAL_TRIP_PASSIVE to THERMAL_TRIP_CRITICAL via
      intel_soc_dts_iosf_add_read_only_critical_trip(), the caller of which
      has to be careful enough to pass at least 1 as the number of read-only
      trip points to intel_soc_dts_iosf_init() beforehand.
      
      This is questionable, because user space may have started to use the
      trips at the time when intel_soc_dts_iosf_add_read_only_critical_trip()
      runs and there is no synchronization between it and sys_set_trip_temp().
      
      To address it, use the observation that nonzero number of read-only
      trip points is only passed to intel_soc_dts_iosf_init() when critical
      trip points are going to be used, so in fact that function may get all
      of the information regarding the critical trip points upfront and it
      can configure them before registering the corresponding thermal zones.
      
      Accordingly, replace the read_only_trip_count argument of
      intel_soc_dts_iosf_init() with a pair of new arguments related to
      critical trip points: a bool one indicating whether or not critical
      trip points are to be used at all and an int one representing the
      critical trip point temperature offset relative to Tj_max.  Use these
      arguments to configure the critical trip points before the registration
      of the thermal zones and to compute the number of writeable trip points
      in add_dts_thermal_zone().
      
      Modify both callers of intel_soc_dts_iosf_init() to take these changes
      into account and drop the intel_soc_dts_iosf_add_read_only_critical_trip()
      call, that is not necessary any more, from intel_soc_thermal_init(),
      which also allows it to return success right after requesting the IRQ.
      
      Finally, drop intel_soc_dts_iosf_add_read_only_critical_trip()
      altogether, because it does not have any more users.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      02a49aac
    • Rafael J. Wysocki's avatar
      thermal: intel: intel_soc_dts_iosf: Add helper for resetting trip points · 5bc3da35
      Rafael J. Wysocki authored
      Because trip points are reset for each sensor in two places in the
      same way, add a helper function for that to reduce code duplication
      a bit.
      
      No intentional functional impact.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      5bc3da35
    • Rafael J. Wysocki's avatar
      thermal: intel: intel_soc_dts_iosf: Change initialization ordering · 51f2aaf0
      Rafael J. Wysocki authored
      The initial configuration of trip points in intel_soc_dts_iosf_init()
      takes place after registering the sensor thermal zones which is
      potentially problematic, because it may race with the setting of trip
      point temperatures via sysfs, as there is no synchronization between it
      and sys_set_trip_temp().
      
      To address this, change the initialization ordering so that the trip
      points are configured prior to the registration of thermal zones.
      
      Accordingly, change the cleanup ordering in intel_soc_dts_iosf_exit()
      to remove the thermal zones before resetting the trip points.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      51f2aaf0
    • Rafael J. Wysocki's avatar
      thermal: intel: intel_soc_dts_iosf: Pass sensors to update_trip_temp() · cbc28057
      Rafael J. Wysocki authored
      After previous changes, update_trip_temp() only uses its dts argument to
      get to the sensors field in the struct intel_soc_dts_sensor_entry object
      pointed to by that argument, so pass the value of that field directly to
      it instead.
      
      No intentional functional impact.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      cbc28057
    • Rafael J. Wysocki's avatar
      thermal: intel: intel_soc_dts_iosf: Untangle update_trip_temp() · 0b28ba27
      Rafael J. Wysocki authored
      Function update_trip_temp() is currently used for the initialization
      of trip points as well as for changing trip point temperatures in
      sys_set_trip_temp().
      
      This is quite confusing and passing the value of dts->trip_types[trip]
      to it so that it can store that value in the same memory location is
      not particularly useful, because it only is necessary to set the
      trip point type once, at the initialization time.
      
      For this reason, drop the last argument from update_trip_temp() and
      introduce configure_trip() calling the former internally for the
      initial configuration of trip points.
      
      Modify the majority of update_trip_temp() callers to use
      configure_trip() instead of it.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      0b28ba27
    • Rafael J. Wysocki's avatar
      thermal: intel: intel_soc_dts_iosf: Always assume notification support · 4f164435
      Rafael J. Wysocki authored
      None of the existing callers of intel_soc_dts_iosf_init() passes
      INTEL_SOC_DTS_INTERRUPT_NONE as the first argument to it, so the
      notification local variable in it is always true and the
      notification_support argument of add_dts_thermal_zone() is always
      true either.
      
      For this reason, drop the notification local variable from
      intel_soc_dts_iosf_init() and the notification_support argument from
      add_dts_thermal_zone() and rearrange the latter to always set
      writable_trip_cnt and trip_mask.
      
      No intentional functional impact.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      4f164435
  2. 10 Aug, 2023 2 commits
  3. 14 Jul, 2023 2 commits
  4. 09 Jul, 2023 10 commits
  5. 08 Jul, 2023 20 commits