The spmi-dev-container binding is intended for SPMI configurations that have multiple device nodes associated with only one spmi_device. By default, if this flag is not specified, each device node will create a new spmi_device. Sometimes having multiple spmi_devices for SPMI device nodes is superfluous. One example of this is gpios. In some architectures, a single gpio is treated as a unique device. But from a gpio_chip perspective, the chip is comprised of many gpios. Beyond wasting memory allocating a unique spmi_device per gpio, the implication of not coalescing spmi_devices is that the clients probe() routine would be called N number of times. But this sort of behavior makes it difficult to realize when a gpio_chip starts and stops. If we assume that one gpio_chip represents one call to probe(), then this problem is solved, since all gpios in that chip will be passed as resources. In order to support multiple device nodes per spmi_device, we also need to extend the data structures for spmi_resources. This change also makes an effort to cleanup some of the error handling for illegal combinations of device bindings, as well as adding some additional documentation. Change-Id: If3ce2aaaa07bdf79e0d9fdedf16419e74a00fbec Signed-off-by: Michael Bohan <mbohan@codeaurora.org> Signed-off-by: David Brown <davidb@codeaurora.org>
35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 and
|
|
* only version 2 as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#include <linux/spmi.h>
|
|
#include <linux/of_irq.h>
|
|
|
|
#ifdef CONFIG_OF_SPMI
|
|
/**
|
|
* of_spmi_register_devices() - Register devices in the SPMI Device Tree
|
|
* @ctrl: spmi_controller which devices should be registered to.
|
|
*
|
|
* This routine scans the SPMI Device Tree, allocating resources and
|
|
* creating spmi_devices according to the SPMI bus Device Tree
|
|
* hierarchy. Details of this hierarchy can be found in
|
|
* Documentation/devicetree/bindings/spmi. This routine is normally
|
|
* called from the probe routine of the driver registering as a
|
|
* spmi_controller.
|
|
*/
|
|
int of_spmi_register_devices(struct spmi_controller *ctrl);
|
|
#else
|
|
static int of_spmi_register_devices(struct spmi_controller *ctrl)
|
|
{
|
|
return -ENXIO;
|
|
}
|
|
#endif /* CONFIG_OF_SPMI */
|