<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">> 2018-04-05 13:39 GMT+02:00 Laurent Pinchart <span dir="ltr"><<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">laurent.pinchart@ideasonboard.com</a>></span>:</div><div class="gmail_quote">> Hi Andrzej,</div><div class="gmail_quote">></div><div class="gmail_quote">> On Thursday, 5 April 2018 14:28:51 EEST Andrzej Hajda wrote:</div><div class="gmail_quote">>> On 05.04.2018 12:28, Laurent Pinchart wrote:</div><div class="gmail_quote">><span style="color:rgb(80,0,80)">>> On Wednesday, 4 April 2018 11:41:05 EEST Carsten Behling wrote:</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>>> Hi,</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>>></span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>>> I would like to write a DRM bridge driver that is an I2C device and a</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>>> DRM MIPI DSI device.</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>>></span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>>> It looks like that both - 'i2c-core.c: of_i2c_register_devices' and</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>>> 'drm_mipi_dsi.c: mipi_dsi_host_register'  are registering their devices</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>>> by iterating over devicetree child nodes with</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>>> for_each_available_child_of_</span><wbr style="color:rgb(80,0,80)"><span style="color:rgb(80,0,80)">node.</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>>></span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>>>> Since I can't make the bridge a child node of both, I don't know how to</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>>> resolve it.</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>></span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>> Found the answer myself. adv7533 driver is a good example. Devicetree</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>> exists for qcom apq8016-sbc. No need to make the bridge a MIPI DSI child</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>>> node.</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>></span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>> This is an issue that has largely been ignored so far in Linux. Both DT</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>> and the Linux kernel device model organize devices in a tree structure</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>> based on the control buses. Devices that are connected to multiple control</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>> buses haven't been taken into account in the design and are thus hard to</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>> support.</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>></span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>> As you may know, DSI can work in command mode or data mode. In data mode</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>> the DSI bus is only use to transfer video data, while in command mode it</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>>> is also used to control the device (reading and writing registers).</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>></span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>> I am not sure what you mean by data and command mode. MIPI DSI specs</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>> says about video and command mode - modes to transfer video data. In</span></div><div class="gmail_quote"><span style="color:rgb(80,0,80)">>> both cases DSI can be used to control the device.</span></div><div class="gmail_quote"><font color="#500050">></font></div><div class="gmail_quote">> Sorry, I meant pure video mode, when a panel only uses DSI to receive video</div><div class="gmail_quote">> data but handles all control communication through a separate control bus.</div><div class="gmail_quote">></div><div class="gmail_quote">>>> A DSI device operating in data mode and controlled through I2C isn't a</div><div class="gmail_quote">>>> problem, as there's a single control bus in that case. The device should</div><div class="gmail_quote">>>> be a child of the I2C controller in DT, and will be instantiated through</div><div class="gmail_quote">>>> of_i2c_register_devices(). A DSI device operating in command mode without</div><div class="gmail_quote">>>> any other control bus isn't a problem either, it will be a child of the</div><div class="gmail_quote">>>> DSI master in DT, and will bee instantiated through</div><div class="gmail_quote">>>> mipi_dsi_host_register().</div><div class="gmail_quote">>>></div><div class="gmail_quote">>>> A DSI device operating in command mode that also require configuration</div><div class="gmail_quote">>>> through a separate control bus (such as I2C, but also SPI) is much more</div><div class="gmail_quote">>>> problematic to support. Fortunately those devices are rare. Hopefully</div><div class="gmail_quote">>>> your device won't fall in this category. If it does, we can discuss how</div><div class="gmail_quote">>>> to best support it.</div><div class="gmail_quote">>></div><div class="gmail_quote">>> As you have already found adv bridge is a good example. It is not clear</div><div class="gmail_quote">>> from the emails if DSI is used only to send video, or also to control?</div><div class="gmail_quote">>> And if to control, is it used to pass only specific commands</div><div class="gmail_quote">>> or can be used as alternative to i2c interface?</div><div class="gmail_quote">></div><div class="gmail_quote">>Carsten, could you please provide more information about the panel you're</div><div class="gmail_quote">>using ?</div><div class="gmail_quote"><br></div><div class="gmail_quote">Sure, it's an TI SN65DSI84. It is just receiving pixel data on the input lines.</div><div class="gmail_quote">I got an incomplete driver from Variscite that just writes a hardcoded  I2C regmap from</div><div class="gmail_quote">DTS. I'm currently writing a real DRM bridge driver based on that. I didn't find</div><div class="gmail_quote">a better one.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Regards</div><div class="gmail_quote">-Carsten</div><br></div></div>