diff --git a/backend/genesys_gl843.cc b/backend/genesys_gl843.cc index 81263039b..63796cf1f 100644 --- a/backend/genesys_gl843.cc +++ b/backend/genesys_gl843.cc @@ -2860,6 +2860,10 @@ static void gl843_offset_calibration(Genesys_Device* dev, const Genesys_Sensor& Genesys_Register_Set& regs) { DBG_HELPER(dbg); + + if (dev->frontend.layout.type == FrontendType::UNKNOWN) + return; + unsigned int channels, bpp; int pass, total_size, i, resolution, lines; int topavg[3], bottomavg[3], avg[3]; @@ -3091,6 +3095,9 @@ static void gl843_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen int resolution; int bpp; + if (dev->frontend.layout.type == FrontendType::UNKNOWN) + return; + dpihw = sensor.get_logical_hwdpi(dpi); factor=sensor.optical_res/dpihw; diff --git a/backend/genesys_sensor.h b/backend/genesys_sensor.h index 6717064a7..65c6464ba 100644 --- a/backend/genesys_sensor.h +++ b/backend/genesys_sensor.h @@ -65,14 +65,24 @@ struct AssignableArray : public std::array { } }; +enum class FrontendType : unsigned +{ + UNKNOWN, + WOLFSON, + ANALOG_DEVICES +}; + struct GenesysFrontendLayout { + FrontendType type = FrontendType::UNKNOWN; std::array offset_addr = {}; std::array gain_addr = {}; bool operator==(const GenesysFrontendLayout& other) const { - return offset_addr == other.offset_addr && gain_addr == other.gain_addr; + return type == other.type && + offset_addr == other.offset_addr && + gain_addr == other.gain_addr; } }; diff --git a/backend/genesys_tables_frontend.cc b/backend/genesys_tables_frontend.cc index 7f7c63557..c5bbf6bfa 100644 --- a/backend/genesys_tables_frontend.cc +++ b/backend/genesys_tables_frontend.cc @@ -52,6 +52,7 @@ void genesys_init_frontend_tables() s_frontends.init(); GenesysFrontendLayout wolfson_layout; + wolfson_layout.type = FrontendType::WOLFSON; wolfson_layout.offset_addr = { 0x20, 0x21, 0x22 }; wolfson_layout.gain_addr = { 0x28, 0x29, 0x2a };