On Fri, 2012-08-17 at 14:33 +0200, Laurent Pinchart wrote: > > But first, the data type should be byte, not unsigned long. How would > > you write 8 bits or 16 bits with your API? > > u8 and u16 both fit in an unsigned long :-) Please see below. Ah, I see, so the driver would just discard 24 bits or 16 bits from the ulong. I somehow thought that if you have 8 bit bus, and you call the write with ulong, 4 bytes will be written. > > Then again, I'd hope to have DCS somehow as a separate library, which would > > then use DBI/DSI/whatnot to actually send the data. > > > > I'm not quite sure how easy that is because of the differences between > > the busses. > > > > > Is DBI limited to 8-bit data transfers for commands ? Pixels can be > > > transferred 16-bit at a time, commands might as well. While DCS only > > > specifies 8-bit command/data, DBI panels that are not DCS compliant can > > > use 16-bit command/data (the R61505 panel, albeit a SYS-80 panel, does > > > so). > > > > I have to say I don't remember much about DBI =). Looking at OMAP's > > driver, which was made for omap2 and hasn't been much updated since, I > > see that there are 4 modes, 8/9/12/16 bits. I think that defines how > > many of the parallel data lines are used. > > SYS-80 also has an 18-bits mode, where bits 0 and 9 are always ignored when > transferring instructions and data other than pixels (for pixels the 18-bits > bus width can be used to transfer RGB666 in a single clock cycle). > > See page 87 of > http://read.pudn.com/downloads91/sourcecode/others/348230/e61505_103a.pdf. > > > However, I don't think that matters for the panel driver when it wants > > to send data. The panel driver should just call dbi_write(buf, buf_len), > > and the dbi driver would send the data in the buffer according to the > > bus width. > > According to the DCS specification, commands and parameters are transferred > using 8-bit data. Non-DCS panels can however use wider commands and parameters > (all commands and parameters are 16-bits wide for the R61505 for instance). > > We can add an API to switch the DBI bus width on the fly. For Renesas hardware > this would "just" require shifting bits around to output the 8-bit or 16-bit > commands on the right data lines (the R61505 uses D17-D9 in 8-bit mode, while > the DCS specification mentions D7-D0) based on how the panel is connected and > on which lines the panel expects data. > > As commands can be expressed on either 8 or 16 bits I would use a 16 type for > them. I won't put my head on the block, but I don't think DBI has any restriction on the size of the command. A "command" just means a data transfer while keeping the D/CX line low, and "data" when the line is high. Similar transfers for n bytes can be done in both modes. > For parameters, we can either express everything as u8 * in the DBI bus > operations, or use a union similar to i2c_smbus_data > > union i2c_smbus_data { > __u8 byte; > __u16 word; > __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ > /* and one more for user-space compatibility */ > }; There's no DBI_BLOCK_MAX, so at least identical union won't work. I think it's simplest to have u8 * function as a base, and then a few helpers to write the most common datatypes. So we could have on the lowest level something like: dbi_write_command(u8 *buf, size_t size); dbi_write_data(u8 *buf, size_t size); And possible helpers: dbi_write_data(u8 *cmd_buf, size_t cmd_size, u8 *data_buf, size_t data_size); dbi_write_dcs(u8 cmd, u8 *data, size_t size); And variations: dbi_write_dcs_0(u8 cmd); dbi_write_dcs_1(u8 cmd, u8 data); etc. So a simple helper to send 16 bits would be: dbi_write_data(u16 data) { // or are the bytes the other way around... u8 buf[2] = { data & 0xff, (data >> 8) & 0xff }; return dbi_write_data(buf, 2); } > Helper functions would be available to perform 8-bit, 16-bit or n*8 bits > transfers. > > Would that work for your use cases ? > > > Also note that some chips need to change the bus width on the fly. The > > chip used on N800 wants configuration to be done with 8-bits, and pixel > > transfers with 16-bits. Who knows why... > > On which data lines is configuration performed ? D7-D0 ? I guess so, but does it matter? All the bus driver needs to know is how to send 8/16/.. bit data. On OMAP we just write the data to a 32 bit register, and the HW takes the lowest n bits. Do the bits represent the data lines directly on Renesans? The omap driver actually only implements 8 and 16 bit modes, not the 9 and 12 bit modes. I'm not sure what kind of shifting is needed for those. > > > We might just need to provide fake timings. Video mode timings are at the > > > core of display support in all drivers so we can't just get rid of them. > > > The h/v front/back porch and sync won't be used by display drivers for > > > DBI/DSI panels anyway. > > > > Right. But we should probably think if we can, at the panel level, easily > > separate conventional panels and smart panels. Then this framework wouldn't > > need to fake the timings, and it'd be up to the higher level to decide if > > and how to fake them. Then again, this is no biggie. Just thought that at > > the lowest level it'd be nice to be "correct" and leave faking to upper > > layers =). > > But we would then have two different APIs at the lower level depending on the > panel type. I'm not sure that's a good thing. Different API for what? Why anyway need panel type specific functions. In the panel struct we could just have an union of the different types of parameters for different types of panels. But if this complicates things, it's not a biggie. Just something that has been in my mind when dealing with smart panels and assigning dummy video timings for them =). Tomi
Attachment:
signature.asc
Description: This is a digitally signed message part
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel