aboutsummaryrefslogtreecommitdiffstats
path: root/hw/i2c.c
AgeCommit message (Collapse)AuthorFilesLines
2012-02-15qom: Unify type registrationAndreas Färber1-2/+2
Replace device_init() with generalized type_init(). While at it, unify naming convention: type_init([$prefix_]register_types) Also, type_init() is a function, so add preceding blank line where necessary and don't put a semicolon after the closing brace. Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Anthony Liguori <anthony@codemonkey.ws> Cc: malc <av1474@comtv.ru> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-03qdev: kill off DeviceInfoAnthony Liguori1-1/+1
It is no longer used in the tree since everything is done natively through QEMU Object Model. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-03qdev: register all types natively through QEMU Object ModelAnthony Liguori1-13/+8
This was done in a mostly automated fashion. I did it in three steps and then rebased it into a single step which avoids repeatedly touching every file in the tree. The first step was a sed-based addition of the parent type to the subclass registration functions. The second step was another sed-based removal of subclass registration functions while also adding virtual functions from the base class into a class_init function as appropriate. Finally, a python script was used to convert the DeviceInfo structures and qdev_register_subclass functions to TypeInfo structures, class_init functions, and type_register_static calls. We are almost fully converted to QOM after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27i2c: smbus: convert to QEMU Object ModelAnthony Liguori1-18/+65
This converts two types because smbus is implemented as a subclass of i2c. It's extremely difficult to convert these two independently. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27i2c: rename i2c_slave -> I2CSlaveAnthony Liguori1-15/+15
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-28qdev: switch children device list to QTAILQPaolo Bonzini1-1/+1
SCSI buses will need to read the children list first-to-last. This requires using a QTAILQ, because hell breaks loose if you just try inserting at the tail (thus reversing the order of all existing visits from last-to-first to first-to-tail). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-07-23Correct spelling of licensedMatthew Fernandez1-1/+1
Correct typos of "licenced" to "licensed". Reviewed-by: Stefan Weil <weil@mail.berlios.de> Reviewed-by: Andreas F=E4rber <andreas.faerber@web.de> Signed-off-by: Matthew Fernandez <matthew.fernandez@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06savevm: Add DeviceState paramAlex Williamson1-1/+1
When available, we'd like to be able to access the DeviceState when registering a savevm. For buses with a get_dev_path() function, this will allow us to create more unique savevm id strings. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-02fix I2C slave addressingJuha Riihimäki1-2/+4
With the recent device handling changes the I2C slave addressing code was broken. With current code, if a slave with the correct address is not found on the bus the last scanned slave on the bus will be addressed. This is wrong. Please find attached a patch to fix it. Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com> Acked-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-10-07New qdev_init_nofail()Markus Armbruster1-1/+1
Like qdev_init(), but terminate program via hw_error() instead of returning an error value. Use it instead of qdev_init() where terminating the program on failure is okay, either because it's during machine construction, or because we know that failure can't happen. Because relying in the latter is somewhat unclean, and the former is not always obvious, it would be nice to go back to qdev_init() in the not-so-obvious cases, only with proper error handling. I'm leaving that for another day, because it involves making sure that error values are properly checked by all callers. Patchworks-ID: 35168 Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05vmstate: remove i2c_slave_load/saveJuan Quintela1-11/+0
All its users moved to vmstate Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05vmstate: create VMSTATE_I2C_SLAVEJuan Quintela1-1/+1
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05vmstate: port i2c_slave deviceJuan Quintela1-7/+26
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05vmstate: port i2c_bus deviceJuan Quintela1-12/+19
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05i2c: addresses are load/save as uint8_t values, change types to reflect thisJuan Quintela1-10/+11
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-12Fix sys-queue.h conflict for goodBlue Swirl1-1/+1
Problem: Our file sys-queue.h is a copy of the BSD file, but there are some additions and it's not entirely compatible. Because of that, there have been conflicts with system headers on BSD systems. Some hacks have been introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896, f40d753718c72693c5f520f0d9899f6e50395e94, 96555a96d724016e13190b28cffa3bc929ac60dc and 3990d09adf4463eca200ad964cc55643c33feb50 but the fixes were fragile. Solution: Avoid the conflict entirely by renaming the functions and the file. Revert the previous hacks. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-08-27qdev: add return value to init() callbacks.Gerd Hoffmann1-2/+2
Sorry folks, but it has to be. One more of these invasive qdev patches. We have a serious design bug in the qdev interface: device init callbacks can't signal failure because the init() callback has no return value. This patch fixes it. We have already one case in-tree where this is needed: Try -device virtio-blk-pci (without drive= specified) and watch qemu segfault. This patch fixes it. With usb+scsi being converted to qdev we'll get more devices where the init callback can fail for various reasons. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-10qdev/prop: convert i2c.c to helper macros.Gerd Hoffmann1-6/+2
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
2009-07-16qdev: rework device properties.Gerd Hoffmann1-2/+9
This patch is a major overhaul of the device properties. The properties are saved directly in the device state struct now, the linked list of property values is gone. Advantages: * We don't have to maintain the list with the property values. * The value in the property list and the value actually used by the device can't go out of sync any more (used to happen for the pci.devfn == -1 case) because there is only one place where the value is stored. * A record describing the property is required now, you can't set random properties any more. There are bus-specific and device-specific properties. The former should be used for properties common to all bus drivers. Typical use case is bus addressing, i.e. pci.devfn and i2c.address. Properties have a PropertyInfo struct attached with name, size and function pointers to parse and print properties. A few common property types have PropertyInfos defined in qdev-properties.c. Drivers are free to implement their own very special property parsers if needed. Properties can have default values. If unset they are zero-filled. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-09qdev: replace bus_type enum with bus_info struct.Gerd Hoffmann1-3/+7
BusInfo is filled with name and size (pretty much like I did for DeviceInfo as well). There is also a function pointer to print bus-specific device information to the monitor. sysbus is hooked up there, I've also added a print function for PCI. Device creation is slightly modified as well: The device type search loop now also checks the bus type while scanning the list instead of complaining thereafter in case of a mismatch. This effectively gives each bus a private namespace for device names. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-11qdev: move name+size into DeviceInfo (v2)Gerd Hoffmann1-3/+3
Rationale: move device information from code to data structures. v2: Adapt the drivers missed in the first version. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-05-23Add common BusStatePaul Brook1-16/+19
Implement and use a common device bus state. The main side-effect is that creating a bus and attaching it to a parent device are no longer separate operations. For legacy code we allow a NULL parent, but that should go away eventually. Also tweak creation code to veriry theat a device in on the right bus. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14I2C cleanupPaul Brook1-21/+0
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14I2C qdev supportPaul Brook1-9/+45
Signed-off-by: Paul Brook <paul@codesourcery.com>
2008-07-29Fix load width for slave address in i2c_bus_load (Chris Lalancette).balrog1-1/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4966 c046a42c-6fe2-441c-8c8c-71466251a162
2008-07-01Fix i2c save/restore.pbrook1-22/+27
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4820 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-17Break up vl.h.pbrook1-2/+3
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3674 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-03Initial OMAP I^2C controller implementation (communication not tested).balrog1-2/+1
Correct an i2c_start_transfer comment. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3514 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-16find -type f | xargs sed -i 's/[\t ]$//g' # on most filesths1-1/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
2007-05-24Savevm/loadvm bits for ARM core, the PXA2xx peripherals and Spitz hardware.balrog1-0/+31
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2857 c046a42c-6fe2-441c-8c8c-71466251a162
2007-05-23I2C/SMBus framework.pbrook1-0/+117
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2845 c046a42c-6fe2-441c-8c8c-71466251a162