[haiku-development] RFC: common i2c / ddc / edid code -- Prob Axel?

  • From: Alexander von Gluck <kallisti5@xxxxxxxxxxx>
  • To: <haiku-development@xxxxxxxxxxxxx>
  • Date: Fri, 02 Sep 2011 16:03:38 -0500

I've been looking into adding per-connector edid support to the radeon_hd driver (as it is how radeon HD devices detect attached monitors)


I have hit a pretty large roadblock in the design of the common i2c / ddc code however.

RadeonHD specifies i2c bus information per connector...

  i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4;
  i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4;
  i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4;
  i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4;
  i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4;
  i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4;
  i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4;
  i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4;
  i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift);
  i2c.mask_data_mask = (1 << gpio->ucDataMaskShift);
  i2c.en_clk_mask = (1 << gpio->ucClkEnShift);
  i2c.en_data_mask = (1 << gpio->ucDataEnShift);
  i2c.y_clk_mask = (1 << gpio->ucClkY_Shift);
  i2c.y_data_mask = (1 << gpio->ucDataY_Shift);
  i2c.a_clk_mask = (1 << gpio->ucClkA_Shift);
  i2c.a_data_mask = (1 << gpio->ucDataA_Shift);


I really want to use the common i2c / ddc / edid code, however it is designed around static definitions of these masks:

http://dev.haiku-os.org/browser/haiku/trunk/src/add-ons/accelerants/intel_extreme/mode.cpp#L72 http://dev.haiku-os.org/browser/haiku/trunk/src/add-ons/accelerants/intel_extreme/mode.cpp#L85 http://dev.haiku-os.org/browser/haiku/trunk/src/add-ons/accelerants/intel_extreme/mode.cpp#L155

I feel the best solution is adding a common i2c bus information struct and passing it all the way down to the get_i2c_signals/set_i2c_signals functions... this would however require changes to:
   * The intel_extreme accelerant
   * The s3 accelerant
   * The radeon accelerant
   * The nvidia accelerant
   * common ddc.c
   * common i2c.c
   * common edid.c
   * maybe other common code.

another option is hacking around it with a bunch of global volatile uint16's or a global struct... however that would require mutex locking and would be pretty ugly.


I haven't had my hand in any of this common code, so I thought I would ping the ML (cough Axel) for thoughts.

Thanks!
 -- Alex

Other related posts: