Skip to content
Snippets Groups Projects
Select Git revision
  • f1f0f330b1d0ac1bcc38d7c84d439f4fde341a9c
  • master default
  • radxa-v6.1-vendor-kernel
  • b4/fusb302-race-condition-fix
  • b4/phy-realtek-clock-fix
  • b4/rk3576-rock4d-phy-handling-fixes
  • b4/rk3588-evb1-hdmi-rx
  • b4/rk3576-fix-fspi-pmdomain
  • b4/usbc-for-rock5bp
  • b4/rock5bp-for-upstream
  • rockchip-devel
  • rk3588-test
  • rk3588-test-vendor-cam
  • lf-6.6.y_6.6.23-2.0.0_var01-panfrost
  • rk3588-linked-clk-gate-for-upstream
  • rk3588-gpu-pwr-domain-for-upstream
  • rk3588-rock5b-usbc-for-upstream
  • rk3588-evb1-for-upstream
  • imx95-upstream-with-vendor-display-stack
  • rk3588
  • memory-profiling-v6.1.25
  • v5.17
  • v5.17-rc8
  • v5.17-rc7
  • v5.17-rc6
  • v5.17-rc5
  • v5.17-rc4
  • v5.17-rc3
  • v5.17-rc2
  • v5.17-rc1
  • v5.16
  • v5.16-rc8
  • v5.16-rc7
  • v5.16-rc6
  • v5.16-rc5
  • v5.16-rc4
  • v5.16-rc3
  • v5.16-rc2
  • v5.16-rc1
  • v5.15
  • v5.15-rc7
41 results

dice.c

Blame
  • dice.c 10.20 KiB
    /*
     * TC Applied Technologies Digital Interface Communications Engine driver
     *
     * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
     * Licensed under the terms of the GNU General Public License, version 2.
     */
    
    #include "dice.h"
    
    MODULE_DESCRIPTION("DICE driver");
    MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
    MODULE_LICENSE("GPL v2");
    
    #define OUI_WEISS		0x001c6a
    #define OUI_LOUD		0x000ff2
    #define OUI_FOCUSRITE		0x00130e
    #define OUI_TCELECTRONIC	0x000166
    
    #define DICE_CATEGORY_ID	0x04
    #define WEISS_CATEGORY_ID	0x00
    #define LOUD_CATEGORY_ID	0x10
    
    /*
     * Some models support several isochronous channels, while these streams are not
     * always available. In this case, add the model name to this list.
     */
    static bool force_two_pcm_support(struct fw_unit *unit)
    {
    	static const char *const models[] = {
    		/* TC Electronic models. */
    		"StudioKonnekt48",
    		/* Focusrite models. */
    		"SAFFIRE_PRO_40",
    		"LIQUID_SAFFIRE_56",
    		"SAFFIRE_PRO_40_1",
    	};
    	char model[32];
    	unsigned int i;
    	int err;
    
    	err = fw_csr_string(unit->directory, CSR_MODEL, model, sizeof(model));
    	if (err < 0)
    		return false;
    
    	for (i = 0; i < ARRAY_SIZE(models); i++) {
    		if (strcmp(models[i], model) == 0)
    			break;
    	}
    
    	return i < ARRAY_SIZE(models);
    }
    
    static int check_dice_category(struct fw_unit *unit)
    {
    	struct fw_device *device = fw_parent_device(unit);
    	struct fw_csr_iterator it;
    	int key, val, vendor = -1, model = -1;
    	unsigned int category;
    
    	/*
    	 * Check that GUID and unit directory are constructed according to DICE
    	 * rules, i.e., that the specifier ID is the GUID's OUI, and that the
    	 * GUID chip ID consists of the 8-bit category ID, the 10-bit product
    	 * ID, and a 22-bit serial number.
    	 */
    	fw_csr_iterator_init(&it, unit->directory);
    	while (fw_csr_iterator_next(&it, &key, &val)) {
    		switch (key) {
    		case CSR_SPECIFIER_ID:
    			vendor = val;