···11+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause22+%YAML 1.233+---44+$id: http://devicetree.org/schemas/sound/realtek,rt5575.yaml#55+$schema: http://devicetree.org/meta-schemas/core.yaml#66+77+title: ALC5575 audio CODEC88+99+maintainers:1010+ - Oder Chiou <oder_chiou@realtek.com>1111+1212+description:1313+ The device supports both I2C and SPI. I2C is mandatory, while SPI is1414+ optional depending on the hardware configuration. SPI is used for1515+ firmware loading if present.1616+1717+allOf:1818+ - $ref: dai-common.yaml#1919+2020+properties:2121+ compatible:2222+ const: realtek,rt55752323+2424+ reg:2525+ maxItems: 12626+2727+ spi-parent:2828+ description:2929+ Optional phandle reference to the SPI controller used for firmware3030+ loading. The argument specifies the chip select.3131+ $ref: /schemas/types.yaml#/definitions/phandle-array3232+3333+required:3434+ - compatible3535+ - reg3636+3737+unevaluatedProperties: false3838+3939+examples:4040+ # I2C-only node4141+ - |4242+ i2c {4343+ #address-cells = <1>;4444+ #size-cells = <0>;4545+ codec@57 {4646+ compatible = "realtek,rt5575";4747+ reg = <0x57>;4848+ };4949+ };5050+5151+ # I2C + optional SPI node5252+ - |5353+ i2c {5454+ #address-cells = <1>;5555+ #size-cells = <0>;5656+ codec@57 {5757+ compatible = "realtek,rt5575";5858+ reg = <0x57>;5959+ spi-parent = <&spi0 0>; /* chip-select 0 */6060+ };6161+ };
+13-10
drivers/spi/spi.c
···4761476147624762/*-------------------------------------------------------------------------*/4763476347644764-#if IS_ENABLED(CONFIG_OF_DYNAMIC)47654765-/* Must call put_device() when done with returned spi_device device */47664766-static struct spi_device *of_find_spi_device_by_node(struct device_node *node)47674767-{47684768- struct device *dev = bus_find_device_by_of_node(&spi_bus_type, node);47694769-47704770- return dev ? to_spi_device(dev) : NULL;47714771-}47724772-47644764+#if IS_ENABLED(CONFIG_OF)47734765/* The spi controllers are not using spi_bus, so we find it with another way */47744774-static struct spi_controller *of_find_spi_controller_by_node(struct device_node *node)47664766+struct spi_controller *of_find_spi_controller_by_node(struct device_node *node)47754767{47764768 struct device *dev;47774769···4775478347764784 /* Reference got in class_find_device */47774785 return container_of(dev, struct spi_controller, dev);47864786+}47874787+EXPORT_SYMBOL_GPL(of_find_spi_controller_by_node);47884788+#endif47894789+47904790+#if IS_ENABLED(CONFIG_OF_DYNAMIC)47914791+/* Must call put_device() when done with returned spi_device device */47924792+static struct spi_device *of_find_spi_device_by_node(struct device_node *node)47934793+{47944794+ struct device *dev = bus_find_device_by_of_node(&spi_bus_type, node);47954795+47964796+ return dev ? to_spi_device(dev) : NULL;47784797}4779479847804799static int of_spi_notify(struct notifier_block *nb, unsigned long action,