Re: [PATCH v2 1/5] soundwire: qcom: add support to missing transport params

From: Pierre-Louis Bossart
Date: Tue Mar 02 2021 - 13:47:48 EST



      for (i = 0; i < nports; i++) {
          ctrl->pconfig[i].si = si[i];
          ctrl->pconfig[i].off1 = off1[i];
          ctrl->pconfig[i].off2 = off2[i];
          ctrl->pconfig[i].bp_mode = bp_mode[i];
+        ctrl->pconfig[i].hstart = hstart[i];
+        ctrl->pconfig[i].hstop = hstop[i];
+        ctrl->pconfig[i].word_length = word_length[i];
+        ctrl->pconfig[i].blk_group_count = blk_group_count[i];
+        ctrl->pconfig[i].lane_control = lane_control[i];
      }

I don't get why you test the values parsed from DT before writing the registers. Why do test them here? if some values are incorrect it's much better to provide an error log instead of writing a partially valid setup to hardware, no?

from DT we pass parameters for all the master ports, however some of these parameters are not really applicable for some of the ports! so the way we handle this is by marking them as 0xFF which means these values are not applicable for those ports! Having said that I think I should probably redefine SWR_INVALID_PARAM to QCOM_SWR_PARAM_NA or something on those lines!

Humm, do you have an example here? It's a bit odd to define DT properties that may or may not be valid. If this is intentional and desired, this should still be captured somehow, e.g. in the bindings documentation or in the code with a comment, no?