]> git.ipfire.org Git - thirdparty/u-boot.git/blobdiff - arch/sandbox/include/asm/test.h
dm: sound: Create a uclass for sound
[thirdparty/u-boot.git] / arch / sandbox / include / asm / test.h
index d3c7851bb50c427f2296face2a38e1701d35f842..74f96188220ee85679e617922500468670b7211e 100644 (file)
@@ -1,9 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Test-related constants for sandbox
  *
  * Copyright (c) 2014 Google, Inc
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef __ASM_TEST_H
 #define SANDBOX_PCI_CLASS_CODE         PCI_CLASS_CODE_COMM
 #define SANDBOX_PCI_CLASS_SUB_CODE     PCI_CLASS_SUB_CODE_COMM_SERIAL
 
-#define SANDBOX_CLK_RATE               32768
+#define PCI_CAP_ID_PM_OFFSET           0x50
+#define PCI_CAP_ID_EXP_OFFSET          0x60
+#define PCI_CAP_ID_MSIX_OFFSET         0x70
 
-enum {
-       PERIPH_ID_FIRST = 0,
-       PERIPH_ID_SPI = PERIPH_ID_FIRST,
-       PERIPH_ID_I2C,
-       PERIPH_ID_PCI,
+#define PCI_EXT_CAP_ID_ERR_OFFSET      0x100
+#define PCI_EXT_CAP_ID_VC_OFFSET       0x200
+#define PCI_EXT_CAP_ID_DSN_OFFSET      0x300
 
-       PERIPH_ID_COUNT,
-};
+/* Useful for PCI_VDEVICE() macro */
+#define PCI_VENDOR_ID_SANDBOX          SANDBOX_PCI_VENDOR_ID
+#define SWAP_CASE_DRV_DATA             0x55aa
+
+#define SANDBOX_CLK_RATE               32768
 
 /* System controller driver data */
 enum {
@@ -86,4 +88,77 @@ long sandbox_i2c_rtc_set_offset(struct udevice *dev, bool use_system_time,
  */
 long sandbox_i2c_rtc_get_set_base_time(struct udevice *dev, long base_time);
 
+int sandbox_usb_keyb_add_string(struct udevice *dev, const char *str);
+
+/**
+ * sandbox_osd_get_mem() - get the internal memory of a sandbox OSD
+ *
+ * @dev:       OSD device for which to access the internal memory for
+ * @buf:       pointer to buffer to receive the OSD memory data
+ * @buflen:    length of buffer in bytes
+ */
+int sandbox_osd_get_mem(struct udevice *dev, u8 *buf, size_t buflen);
+
+/**
+ * sandbox_pwm_get_config() - get the PWM config for a channel
+ *
+ * @dev: Device to check
+ * @channel: Channel number to check
+ * @period_ns: Period of the PWM in nanoseconds
+ * @duty_ns: Current duty cycle of the PWM in nanoseconds
+ * @enable: true if the PWM is enabled
+ * @polarity: true if the PWM polarity is active high
+ * @return 0 if OK, -ENOSPC if the PWM number is invalid
+ */
+int sandbox_pwm_get_config(struct udevice *dev, uint channel, uint *period_nsp,
+                          uint *duty_nsp, bool *enablep, bool *polarityp);
+
+/**
+ * sandbox_sf_set_block_protect() - Set the BP bits of the status register
+ *
+ * @dev: Device to update
+ * @bp_mask: BP bits to set (bits 2:0, so a value of 0 to 7)
+ */
+void sandbox_sf_set_block_protect(struct udevice *dev, int bp_mask);
+
+/**
+ * sandbox_get_codec_params() - Read back codec parameters
+ *
+ * This reads back the parameters set by audio_codec_set_params() for the
+ * sandbox audio driver. Arguments are as for that function.
+ */
+void sandbox_get_codec_params(struct udevice *dev, int *interfacep, int *ratep,
+                             int *mclk_freqp, int *bits_per_samplep,
+                             uint *channelsp);
+
+/**
+ * sandbox_get_i2s_sum() - Read back the sum of the audio data so far
+ *
+ * This data is provided to the sandbox driver by the I2S tx_data() method.
+ *
+ * @dev: Device to check
+ * @return sum of audio data
+ */
+int sandbox_get_i2s_sum(struct udevice *dev);
+
+/**
+ * sandbox_get_setup_called() - Returns the number of times setup(*) was called
+ *
+ * This is used in the sound test
+ *
+ * @dev: Device to check
+ * @return call count for the setup() method
+ */
+int sandbox_get_setup_called(struct udevice *dev);
+
+/**
+ * sandbox_get_sound_sum() - Read back the sum of the sound data so far
+ *
+ * This data is provided to the sandbox driver by the sound play() method.
+ *
+ * @dev: Device to check
+ * @return sum of audio data
+ */
+int sandbox_get_sound_sum(struct udevice *dev);
+
 #endif