ftsTest.c 103 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * FTS Capacitive touch screen controller (FingerTipS)
  4. *
  5. * Copyright (C) 2016-2019, STMicroelectronics Limited.
  6. * Authors: AMG(Analog Mems Group) <[email protected]>
  7. *
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License version 2 as published by
  11. * the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but WITHOUT
  14. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  16. * more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along with
  19. * this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. /*
  22. *
  23. **************************************************************************
  24. ** STMicroelectronics **
  25. **************************************************************************
  26. ** [email protected] **
  27. **************************************************************************
  28. * *
  29. * FTS API for MP test ***
  30. * *
  31. **************************************************************************
  32. **************************************************************************
  33. *
  34. */
  35. #include <linux/init.h>
  36. #include <linux/errno.h>
  37. #include <linux/platform_device.h>
  38. #include <linux/kernel.h>
  39. #include <linux/module.h>
  40. #include <linux/slab.h>
  41. #include <linux/string.h>
  42. #include <stdarg.h>
  43. #include <linux/input.h>
  44. #include <linux/interrupt.h>
  45. #include <linux/serio.h>
  46. #include <linux/time.h>
  47. #include <linux/pm.h>
  48. #include <linux/delay.h>
  49. #include <linux/ctype.h>
  50. #include <linux/gpio.h>
  51. #include <linux/i2c.h>
  52. #include <linux/i2c-dev.h>
  53. #include <linux/fs.h>
  54. #include <linux/uaccess.h>
  55. #include <linux/power_supply.h>
  56. #include <linux/firmware.h>
  57. #include <linux/regulator/consumer.h>
  58. #include <linux/of_gpio.h>
  59. //#include <linux/sec_sysfs.h>
  60. #include "ftsCrossCompile.h"
  61. #include "ftsCompensation.h"
  62. #include "ftsError.h"
  63. #include "ftsFrame.h"
  64. #include "ftsHardware.h"
  65. #include "ftsIO.h"
  66. #include "ftsSoftware.h"
  67. #include "ftsTest.h"
  68. #include "ftsTime.h"
  69. #include "ftsTool.h"
  70. #include "../fts.h"
  71. #ifdef LIMITS_H_FILE
  72. #include <../fts_limits.h>
  73. #endif
  74. static char tag[8] = "[ FTS ]\0";
  75. int computeAdjHoriz(u8 *data, int row, int column, u8 **result)
  76. {
  77. int i, j;
  78. int size = row * (column - 1);
  79. if (column < 2) {
  80. logError(1, "%s %s: ERROR % 02X\n",
  81. tag, __func__, ERROR_OP_NOT_ALLOW);
  82. return ERROR_OP_NOT_ALLOW;
  83. }
  84. *result = (u8 *) kmalloc_array(size, sizeof(u8), GFP_KERNEL);
  85. if (*result == NULL) {
  86. logError(1, "%s %s: ERROR %02X\n",
  87. tag, __func__, ERROR_ALLOC);
  88. return ERROR_ALLOC;
  89. }
  90. for (i = 0; i < row; i++) {
  91. for (j = 1; j < column; j++) {
  92. *(*result + (i * (column - 1) + (j - 1))) =
  93. abs(data[i * column + j] -
  94. data[i * column + (j - 1)]);
  95. }
  96. }
  97. return OK;
  98. }
  99. int computeAdjHorizTotal(u16 *data, int row, int column, u16 **result)
  100. {
  101. int i, j;
  102. int size = row * (column - 1);
  103. if (column < 2) {
  104. logError(1, "%s %s: ERROR % 02X\n",
  105. tag, __func__, ERROR_OP_NOT_ALLOW);
  106. return ERROR_OP_NOT_ALLOW;
  107. }
  108. *result = (u16 *)kmalloc_array(size, sizeof(u16), GFP_KERNEL);
  109. if (*result == NULL) {
  110. logError(1, "%s %s: ERROR %02X\n",
  111. tag, __func__, ERROR_ALLOC);
  112. return ERROR_ALLOC;
  113. }
  114. for (i = 0; i < row; i++) {
  115. for (j = 1; j < column; j++) {
  116. *(*result + (i * (column - 1) + (j - 1))) =
  117. abs(data[i * column + j] -
  118. data[i * column + (j - 1)]);
  119. }
  120. }
  121. return OK;
  122. }
  123. int computeAdjVert(u8 *data, int row, int column, u8 **result)
  124. {
  125. int i, j;
  126. int size = (row - 1) * (column);
  127. if (row < 2) {
  128. logError(1, "%s %s: ERROR % 02X\n",
  129. tag, __func__, ERROR_OP_NOT_ALLOW);
  130. return ERROR_OP_NOT_ALLOW;
  131. }
  132. *result = (u8 *)kmalloc_array(size, sizeof(u8), GFP_KERNEL);
  133. if (*result == NULL) {
  134. logError(1, "%s %s: ERROR %02X\n",
  135. tag, __func__, ERROR_ALLOC);
  136. return ERROR_ALLOC;
  137. }
  138. for (i = 1; i < row; i++) {
  139. for (j = 0; j < column; j++) {
  140. *(*result + ((i - 1) * column + j)) =
  141. abs(data[i * column + j] -
  142. data[(i - 1) * column + j]);
  143. }
  144. }
  145. return OK;
  146. }
  147. int computeAdjVertTotal(u16 *data, int row, int column, u16 **result)
  148. {
  149. int i, j;
  150. int size = (row - 1) * (column);
  151. if (row < 2) {
  152. logError(1, "%s %s: ERROR % 02X\n",
  153. tag, __func__, ERROR_OP_NOT_ALLOW);
  154. return ERROR_OP_NOT_ALLOW;
  155. }
  156. *result = (u16 *)kmalloc_array(size, sizeof(u16), GFP_KERNEL);
  157. if (*result == NULL) {
  158. logError(1, "%s %s: ERROR %02X\n",
  159. tag, __func__, ERROR_ALLOC);
  160. return ERROR_ALLOC;
  161. }
  162. for (i = 1; i < row; i++) {
  163. for (j = 0; j < column; j++) {
  164. *(*result + ((i - 1) * column + j)) =
  165. abs(data[i * column + j] -
  166. data[(i - 1) * column + j]);
  167. }
  168. }
  169. return OK;
  170. }
  171. int computeTotal(u8 *data, u8 main, int row, int column,
  172. int m, int n, u16 **result)
  173. {
  174. int i, j;
  175. int size = (row) * (column);
  176. *result = (u16 *)kmalloc_array(size, sizeof(u16), GFP_KERNEL);
  177. if (*result == NULL) {
  178. logError(1, "%s %s : ERROR %02X\n",
  179. tag, __func__, ERROR_ALLOC);
  180. return ERROR_ALLOC;
  181. }
  182. for (i = 0; i < row; i++) {
  183. for (j = 0; j < column; j++) {
  184. *(*result + (i * column + j)) =
  185. m * main + n * data[i * column + j];
  186. }
  187. }
  188. return OK;
  189. }
  190. int checkLimitsMinMax(short *data, int row, int column, int min, int max)
  191. {
  192. int i, j;
  193. int count = 0;
  194. for (i = 0; i < row; i++) {
  195. for (j = 0; j < column; j++) {
  196. if (data[i * column + j] < min
  197. || data[i * column + j] > max) {
  198. logError(1, "%s %s:Node[%d,%d] = %d ", tag,
  199. __func__, i, j, data[i * column + j]);
  200. logError(1, "exceed limit [%d,%d]\n", min, max);
  201. count++;
  202. }
  203. }
  204. }
  205. return count;//if count is 0 = OK, test completed successfully
  206. }
  207. int checkLimitsGap(short *data, int row, int column, int threshold)
  208. {
  209. int i, j;
  210. int min_node;
  211. int max_node;
  212. if (row == 0 || column == 0) {
  213. logError(1, "%s %s:invalid number of rows = %d ",
  214. tag, __func__, row);
  215. logError(1, "or columns = %d %02\n",
  216. column, ERROR_OP_NOT_ALLOW);
  217. return ERROR_OP_NOT_ALLOW;
  218. }
  219. min_node = data[0];
  220. max_node = data[0];
  221. for (i = 0; i < row; i++) {
  222. for (j = 0; j < column; j++) {
  223. if (data[i * column + j] < min_node) {
  224. min_node = data[i * column + j];
  225. } else {
  226. if (data[i * column + j] > max_node)
  227. max_node = data[i * column + j];
  228. }
  229. }
  230. }
  231. if (max_node - min_node > threshold) {
  232. logError(1, "%s %s: GAP = %d exceed limit %d\n",
  233. tag, __func__, max_node - min_node, threshold);
  234. return ERROR_TEST_CHECK_FAIL;
  235. }
  236. return OK;
  237. }
  238. int checkLimitsMap(u8 *data, int row, int column, int *min, int *max)
  239. {
  240. int i, j;
  241. int count = 0;
  242. for (i = 0; i < row; i++) {
  243. for (j = 0; j < column; j++) {
  244. if (data[i * column + j] < min[i * column + j]
  245. || data[i * column + j] > max[i * column + j]) {
  246. logError(1, "%s %s: Node[%d,%d] = %d ",
  247. tag, __func__,
  248. i, j,
  249. data[i * column + j]);
  250. logError(1, "exceed limit [%d, %d]\n",
  251. min[i * column + j],
  252. max[i * column + j]);
  253. count++;
  254. }
  255. }
  256. }
  257. return count; //if count is 0 = OK, test completed successfully
  258. }
  259. int checkLimitsMapTotal(u16 *data, int row, int column, int *min, int *max)
  260. {
  261. int i, j;
  262. int count = 0;
  263. for (i = 0; i < row; i++) {
  264. for (j = 0; j < column; j++) {
  265. if (data[i * column + j] < min[i * column + j]
  266. || data[i * column + j] > max[i * column + j]) {
  267. logError(1, "%s %s:Node[%d,%d] = %d\n",
  268. tag, __func__, i, j,
  269. data[i * column + j]);
  270. logError(1, "exceed limit [%d, %d]\n",
  271. min[i * column + j],
  272. max[i * column + j]);
  273. count++;
  274. }
  275. }
  276. }
  277. return count; //if count is 0 = OK, test completed successfully
  278. }
  279. int checkLimitsMapAdj(u8 *data, int row, int column, int *max)
  280. {
  281. int i, j;
  282. int count = 0;
  283. for (i = 0; i < row; i++) {
  284. for (j = 0; j < column; j++) {
  285. if (data[i * column + j] > max[i * column + j]) {
  286. logError(1, "%s %s:Node[%d,%d] = %d ",
  287. tag, __func__, i, j);
  288. logError(1, "exceed limit > %d\n",
  289. data[i * column + j],
  290. max[i * column + j]);
  291. count++;
  292. }
  293. }
  294. }
  295. //if count is 0 = OK, test completed successfully
  296. return count;
  297. }
  298. int checkLimitsMapAdjTotal(u16 *data, int row, int column, int *max)
  299. {
  300. int i, j;
  301. int count = 0;
  302. for (i = 0; i < row; i++) {
  303. for (j = 0; j < column; j++) {
  304. if (data[i * column + j] > max[i * column + j]) {
  305. logError(1, "%s %s:Node[%d,%d] = %d ",
  306. tag, __func__, i, j);
  307. logError(1, "exceed limit > %d\n",
  308. data[i * column + j],
  309. max[i * column + j]);
  310. count++;
  311. }
  312. }
  313. }
  314. //if count is 0 = OK, test completed successfully
  315. return count;
  316. }
  317. int production_test_ito(void)
  318. {
  319. int res = OK;
  320. u8 cmd;
  321. u8 readData[FIFO_EVENT_SIZE] = {0};
  322. //look for ito event
  323. int eventToSearch[2] = {EVENTID_ERROR_EVENT, EVENT_TYPE_ITO};
  324. logError(0, "%s ITO Production test is starting...\n", tag);
  325. res = fts_system_reset();
  326. if (res < 0) {
  327. logError(1, "%s %s: ERROR %02X\n",
  328. tag, __func__, ERROR_PROD_TEST_ITO);
  329. return (res | ERROR_PROD_TEST_ITO);
  330. }
  331. cmd = FTS_CMD_ITO_CHECK;
  332. logError(0, "%s ITO Check command sent...\n", tag);
  333. if (fts_writeFwCmd(&cmd, 1) < 0) {
  334. logError(1, "%s %s: ERROR %02X\n",
  335. tag, __func__, (ERROR_I2C_W | ERROR_PROD_TEST_ITO));
  336. return (ERROR_I2C_W | ERROR_PROD_TEST_ITO);
  337. }
  338. logError(0, "%s Looking for ITO Event...\n", tag);
  339. res = pollForEvent(eventToSearch, 2,
  340. readData, TIMEOUT_ITO_TEST_RESULT);
  341. if (res < 0) {
  342. logError(1, "%s %s: ITO Production test failed ERROR %02X\n",
  343. tag, __func__, ERROR_PROD_TEST_ITO);
  344. return (res | ERROR_PROD_TEST_ITO);
  345. }
  346. if (readData[2] != 0x00 || readData[3] != 0x00) {
  347. logError(0, "%s ITO Production testes finished! ERROR %02X\n",
  348. tag, (ERROR_TEST_CHECK_FAIL | ERROR_PROD_TEST_ITO));
  349. res = (ERROR_TEST_CHECK_FAIL | ERROR_PROD_TEST_ITO);
  350. } else {
  351. logError(0, "%s ITO Production test finished!..OK\n", tag);
  352. res = OK;
  353. }
  354. res |= fts_system_reset();
  355. if (res < 0) {
  356. logError(1, "%s %s: ERROR %02X\n",
  357. tag, __func__, ERROR_PROD_TEST_ITO);
  358. res = (res | ERROR_PROD_TEST_ITO);
  359. }
  360. return res;
  361. }
  362. int production_test_initialization(void)
  363. {
  364. int res;
  365. u8 cmd;
  366. u8 readData[FIFO_EVENT_SIZE] = {0};
  367. int eventToSearch[2] = {EVENTID_STATUS_UPDATE,
  368. EVENT_TYPE_FULL_INITIALIZATION};
  369. logError(0, "%s INITIALIZATION Production test is starting\n", tag);
  370. res = fts_system_reset();
  371. if (res < 0) {
  372. logError(1, "%s %s: ERROR %02X\n",
  373. tag, __func__, ERROR_PROD_TEST_INITIALIZATION);
  374. return (res | ERROR_PROD_TEST_INITIALIZATION);
  375. }
  376. logError(0, "%s INITIALIZATION command sent...\n", tag);
  377. cmd = FTS_CMD_FULL_INITIALIZATION;
  378. if (fts_writeFwCmd(&cmd, 1) < 0) {
  379. logError(1, "%s %s: ERROR %02X\n", tag, __func__,
  380. (ERROR_I2C_W | ERROR_PROD_TEST_INITIALIZATION));
  381. return (ERROR_I2C_W | ERROR_PROD_TEST_INITIALIZATION);
  382. }
  383. logError(0, "%s Looking for INITIALIZATION Event...\n", tag);
  384. res = pollForEvent(eventToSearch, 2, readData,
  385. TIMEOUT_INITIALIZATION_TEST_RESULT);
  386. if (res < 0) {
  387. logError(1, "%s %s: INITIALIZATION Production ", tag, __func__);
  388. logError(1, "test failed %02X\n",
  389. ERROR_PROD_TEST_INITIALIZATION);
  390. return (res | ERROR_PROD_TEST_INITIALIZATION);
  391. }
  392. if (readData[2] != 0x00) {
  393. logError(0, "%sINITIALIZATION Production ", tag);
  394. logError(0, "testes finished! FAILED %02X\n",
  395. (ERROR_TEST_CHECK_FAIL | ERROR_PROD_TEST_INITIALIZATION));
  396. res = (ERROR_TEST_CHECK_FAIL | ERROR_PROD_TEST_INITIALIZATION);
  397. } else {
  398. logError(0, "%s INITIALIZATION Production test...OK\n", tag);
  399. res = OK;
  400. }
  401. logError(0, "%s Refresh Chip Info...\n", tag);
  402. //need to update the chipInfo in order to refresh the tuning_versione
  403. res |= readChipInfo(1);
  404. if (res < 0) {
  405. logError(1, "%s %s: read chip info ERROR %02X\n",
  406. tag, __func__, ERROR_PROD_TEST_INITIALIZATION);
  407. res = (res | ERROR_PROD_TEST_INITIALIZATION);
  408. }
  409. return res;
  410. }
  411. int ms_compensation_tuning(void)
  412. {
  413. int res;
  414. u8 cmd;
  415. u8 readData[FIFO_EVENT_SIZE] = {0};
  416. int eventToSearch[2] = {EVENTID_STATUS_UPDATE,
  417. EVENT_TYPE_MS_TUNING_CMPL};
  418. logError(0, "%s MS INITIALIZATION command sent...\n", tag);
  419. cmd = FTS_CMD_MS_COMP_TUNING;
  420. if (fts_writeFwCmd(&cmd, 1) < 0) {
  421. logError(1, "%s %s 2: ERROR %02X\n",
  422. tag, __func__, (ERROR_I2C_W | ERROR_MS_TUNING));
  423. return (ERROR_I2C_W | ERROR_MS_TUNING);
  424. }
  425. logError(0, "%s Looking for MS INITIALIZATION Event...\n", tag);
  426. res = pollForEvent(eventToSearch, 2, readData,
  427. TIMEOUT_INITIALIZATION_TEST_RESULT);
  428. if (res < 0) {
  429. logError(1, "%s %s:MS INITIALIZATION Production\n",
  430. tag, __func__);
  431. logError(1, "test failed %02X\n", ERROR_MS_TUNING);
  432. return (res | ERROR_MS_TUNING);
  433. }
  434. if (readData[2] != 0x00 || readData[3] != 0x00) {
  435. logError(0, "%s MS INITIALIZATION Production ", tag);
  436. logError(0, "test finished! FAILED %02X\n", ERROR_MS_TUNING);
  437. res = ERROR_MS_TUNING;
  438. } else {
  439. logError(0,
  440. "%s MS INITIALIZATION Production test finished! OK\n",
  441. tag);
  442. res = OK;
  443. }
  444. return res;
  445. }
  446. int ss_compensation_tuning(void)
  447. {
  448. int res;
  449. u8 cmd;
  450. u8 readData[FIFO_EVENT_SIZE] = {0};
  451. int eventToSearch[2] = {EVENTID_STATUS_UPDATE,
  452. EVENT_TYPE_SS_TUNING_CMPL};
  453. logError(0, "%s SS INITIALIZATION command sent...\n", tag);
  454. cmd = FTS_CMD_SS_COMP_TUNING;
  455. if (fts_writeFwCmd(&cmd, 1) < 0) {
  456. logError(1, "%s %s 2: ERROR %02X\n",
  457. tag, __func__, (ERROR_I2C_W | ERROR_SS_TUNING));
  458. return (ERROR_I2C_W | ERROR_SS_TUNING);
  459. }
  460. logError(0, "%s Looking for SS INITIALIZATION Event...\n", tag);
  461. res = pollForEvent(eventToSearch,
  462. 2,
  463. readData,
  464. TIMEOUT_INITIALIZATION_TEST_RESULT);
  465. if (res < 0) {
  466. logError(1, "%s %s:SS INITIALIZATION Production ",
  467. tag, __func__);
  468. logError(1, "test failed %02X\n", ERROR_SS_TUNING);
  469. return (res | ERROR_SS_TUNING);
  470. }
  471. logError(0, "%s SS INITIALIZATION Production test finished!", tag);
  472. if (readData[2] != 0x00 || readData[3] != 0x00) {
  473. logError(0, "%s.................FAILED ERROR %02X\n",
  474. tag, ERROR_SS_TUNING);
  475. res = ERROR_SS_TUNING;
  476. } else {
  477. logError(0, "%s.................OK\n", tag);
  478. res = OK;
  479. }
  480. return res;
  481. }
  482. int lp_timer_calibration(void)
  483. {
  484. int res;
  485. u8 cmd;
  486. u8 readData[FIFO_EVENT_SIZE] = {0};
  487. int eventToSearch[2] = {EVENTID_STATUS_UPDATE,
  488. EVENT_TYPE_LPTIMER_TUNING_CMPL};
  489. logError(0, "%s LP TIMER CALIBRATION command sent...\n", tag);
  490. cmd = FTS_CMD_LP_TIMER_CALIB;
  491. if (fts_writeFwCmd(&cmd, 1) < 0) {
  492. logError(1, "%s %s 2:ERROR %02X\n", tag, __func__,
  493. (ERROR_I2C_W | ERROR_LP_TIMER_TUNING));
  494. return (ERROR_I2C_W | ERROR_LP_TIMER_TUNING);
  495. }
  496. logError(0, "%s Looking for LP TIMER CALIBRATION Event...\n", tag);
  497. res = pollForEvent(eventToSearch,
  498. 2,
  499. readData,
  500. TIMEOUT_INITIALIZATION_TEST_RESULT);
  501. if (res < 0) {
  502. logError(1, "%s:LP TIMER CALIBRATION Production test failed\n",
  503. tag);
  504. logError(1, "%s %s: ERROR %02X\n",
  505. tag, __func__, ERROR_LP_TIMER_TUNING);
  506. return (res | ERROR_LP_TIMER_TUNING);
  507. }
  508. logError(0, "LP TIMER CALIBRATION Production test finished!");
  509. if (readData[2] != 0x00 || readData[3] != 0x01) {
  510. logError(0, "%s........FAILED ERROR %02X\n",
  511. tag, ERROR_LP_TIMER_TUNING);
  512. res = ERROR_LP_TIMER_TUNING;
  513. } else {
  514. logError(0, "%s.................OK\n", tag);
  515. res = OK;
  516. }
  517. return res;
  518. }
  519. int save_cx_tuning(void)
  520. {
  521. int res;
  522. u8 cmd;
  523. u8 readData[FIFO_EVENT_SIZE] = {0};
  524. int eventToSearch[2] = {EVENTID_STATUS_UPDATE,
  525. EVENT_TYPE_COMP_DATA_SAVED};
  526. logError(0, "%s SAVE CX command sent...\n", tag);
  527. cmd = FTS_CMD_SAVE_CX_TUNING;
  528. if (fts_writeCmd(&cmd, 1) < 0) {
  529. logError(1, "%s %s 2:ERROR %02X\n", tag, __func__,
  530. (ERROR_I2C_W | ERROR_SAVE_CX_TUNING));
  531. return (ERROR_I2C_W | ERROR_SAVE_CX_TUNING);
  532. }
  533. logError(0, "%s Looking for SAVE CX Event...\n", tag);
  534. res = pollForEvent(eventToSearch,
  535. 2,
  536. readData,
  537. TIMEOUT_INITIALIZATION_TEST_RESULT);
  538. if (res < 0) {
  539. logError(1, "%s %s: SAVE CX failed... ERROR %02X\n",
  540. tag, ERROR_SAVE_CX_TUNING);
  541. return (res | ERROR_SAVE_CX_TUNING);
  542. }
  543. if (readData[2] != 0x00 || readData[3] != 0x00) {
  544. logError(0, "%s SAVE CX finished! FAILED ERROR %02X\n",
  545. tag, ERROR_SAVE_CX_TUNING);
  546. res = ERROR_SAVE_CX_TUNING;
  547. } else {
  548. logError(0, "%s SAVE CX finished!.................OK\n", tag);
  549. res = OK;
  550. }
  551. return res;
  552. }
  553. int production_test_split_initialization(int saveToFlash)
  554. {
  555. int res;
  556. logError(0, "%s Split Initialization test is starting...\n", tag);
  557. res = fts_system_reset();
  558. if (res < 0) {
  559. logError(1, "%s %s: ERROR %02X\n", tag, __func__,
  560. ERROR_PROD_TEST_INITIALIZATION);
  561. return (res | ERROR_PROD_TEST_INITIALIZATION);
  562. }
  563. logError(0, "%s MS INITIALIZATION TEST:\n", tag);
  564. res = ms_compensation_tuning();
  565. if (res < 0) {
  566. logError(0, "%s %s:MS INITIALIZATION TEST FAILED! ERROR %02X\n",
  567. tag, __func__, ERROR_PROD_TEST_INITIALIZATION);
  568. return (res | ERROR_PROD_TEST_INITIALIZATION);
  569. }
  570. logError(0, "%s MS INITIALIZATION TEST OK!\n", tag);
  571. logError(0, "%s\n", tag);
  572. logError(0, "%s SS INITIALIZATION TEST:\n", tag);
  573. res = ss_compensation_tuning();
  574. if (res < 0) {
  575. logError(0, "%s %s: SS INITIALIZATION TEST FAILED! ",
  576. tag, __func__);
  577. logError(0, "ERROR %02X\n", ERROR_PROD_TEST_INITIALIZATION);
  578. return (res | ERROR_PROD_TEST_INITIALIZATION);
  579. }
  580. logError(0, "%s SS INITIALIZATION TEST OK!\n", tag);
  581. logError(0, "%s\n", tag);
  582. logError(0, "%s LP INITIALIZATION TEST:\n", tag);
  583. res = lp_timer_calibration();
  584. if (res < 0) {
  585. logError(0, "%s %s: LP INITIALIZATION TEST FAILED! ",
  586. tag, __func__);
  587. logError(0, "ERROR %02X\n", ERROR_PROD_TEST_INITIALIZATION);
  588. return (res | ERROR_PROD_TEST_INITIALIZATION);
  589. }
  590. logError(0, "%s LP INITIALIZATION TEST OK!\n", tag);
  591. if (saveToFlash) {
  592. logError(0, "%s\n", tag);
  593. logError(0, "%s SAVE CX TEST:\n", tag);
  594. res = save_cx_tuning();
  595. if (res < 0) {
  596. logError(0, "%s %s: SAVE CX TEST FAILED! ERROR %02X\n",
  597. tag, __func__, res);
  598. return (res | ERROR_PROD_TEST_INITIALIZATION);
  599. }
  600. logError(0, "%s SAVE CX TEST OK!\n", tag);
  601. }
  602. logError(0, "%s Refresh Chip Info...\n", tag);
  603. res |= readChipInfo(1);
  604. if (res < 0) {
  605. logError(1, "%s %s: read chip info ERROR %02X\n",
  606. tag, __func__, ERROR_PROD_TEST_INITIALIZATION);
  607. res = (res | ERROR_PROD_TEST_INITIALIZATION);
  608. } else {
  609. logError(0, "%s Split Initialization test finished! OK\n", tag);
  610. }
  611. return res;
  612. }
  613. int production_test_main(char *pathThresholds, int stop_on_fail, int saveInit,
  614. struct TestToDo *todo, u32 signature)
  615. {
  616. int res, ret;
  617. logError(0, "%s MAIN Production test is starting...\n", tag);
  618. logError(0, "%s\n", tag);
  619. logError(0, "%s ITO TEST:\n", tag);
  620. res = production_test_ito();
  621. if (res < 0) {
  622. logError(0, "%s Error during ITO TEST! ERROR %08X\n", tag, res);
  623. //in case of ITO TEST failure is no sense keep going
  624. goto END;
  625. }
  626. logError(0, "%s ITO TEST OK!\n", tag);
  627. logError(0, "%s:\n", tag);
  628. logError(0, "%s INITIALIZATION TEST:\n", tag);
  629. if (saveInit == 1) {
  630. res = production_test_initialization();
  631. if (res < 0) {
  632. logError(0, "%s Error during INITIALIZATION TEST!",
  633. tag);
  634. logError(0, "ERROR %08X\n", res);
  635. if (stop_on_fail)
  636. goto END;
  637. } else {
  638. logError(0, "%s INITIALIZATION TEST OK!\n", tag);
  639. }
  640. } else
  641. logError(0, "%s INITIALIZATION TEST:..SKIPPED\n", tag);
  642. logError(0, "%s\n", tag);
  643. if (saveInit == 1) {
  644. logError(0, "%s Cleaning up...\n", tag);
  645. ret = cleanUp(0);
  646. if (ret < 0) {
  647. logError(1, "%s %s: clean up ERROR %02X\n",
  648. tag, __func__, ret);
  649. res |= ret;
  650. if (stop_on_fail)
  651. goto END;
  652. }
  653. logError(0, "%s\n", tag);
  654. }
  655. logError(0, "%s PRODUCTION DATA TEST:\n", tag);
  656. ret = production_test_data(pathThresholds, stop_on_fail, todo);
  657. if (ret < 0) {
  658. logError(0, "%sError during PRODUCTION DATA TEST %08X\n",
  659. tag, ret);
  660. } else {
  661. logError(0, "%s PRODUCTION DATA TEST OK!\n", tag);
  662. }
  663. res |= ret;
  664. // the OR is important because if
  665. //the data test is OK but the inizialization
  666. //test fail, the main production
  667. //test result should = FAIL
  668. if (ret == OK && saveInit == 1) {
  669. logError(0, "%s SAVE FLAG:\n", tag);
  670. ret = save_mp_flag(signature);
  671. if (ret < OK)
  672. logError(0, "%s SAVE FLAG:FAIL! ERROR %08X\n",
  673. tag, ret);
  674. else
  675. logError(0, "%s SAVE FLAG:OK!\n", tag);
  676. res |= ret;
  677. // need to update the MP Flag
  678. ret = readChipInfo(1);
  679. if (ret < OK)
  680. logError(1, "%s %s:read chip info ERROR %08X\n",
  681. tag, __func__, ret);
  682. res |= ret;
  683. }
  684. logError(0, "%s\n", tag);
  685. END:
  686. if (res < 0) {
  687. logError(0, "%s MAIN Production test finished..FAILED\n", tag);
  688. return res;
  689. }
  690. logError(0, "%s MAIN Production test finished..OK\n", tag);
  691. return OK;
  692. }
  693. int production_test_ms_raw(char *path_limits, int stop_on_fail,
  694. struct TestToDo *todo)
  695. {
  696. int ret, count_fail = 0;
  697. struct MutualSenseFrame msRawFrame = {0};
  698. int *thresholds = NULL;
  699. int trows, tcolumns;
  700. //****** Mutual Sense Test ************/
  701. logError(0, "%s\n", tag);
  702. logError(0, "%s MS RAW DATA TEST is starting...\n", tag);
  703. if (todo->MutualRaw == 1 || todo->MutualRawGap == 1) {
  704. ret = getMSFrame2(MS_TOUCH_ACTIVE, &msRawFrame);
  705. if (ret < 0) {
  706. logError(1, "%s %s:getMSFrame failed... ERROR %02X\n",
  707. tag, __func__, ERROR_PROD_TEST_DATA);
  708. return (ret | ERROR_PROD_TEST_DATA);
  709. }
  710. logError(0, "%s MS RAW MIN MAX TEST:\n", tag);
  711. if (todo->MutualRaw == 1) {
  712. ret = parseProductionTestLimits(path_limits,
  713. MS_RAW_MIN_MAX,
  714. &thresholds,
  715. &trows,
  716. &tcolumns);
  717. if (ret < 0 || (trows != 1 || tcolumns != 2)) {
  718. logError(0, "%s %s:MS_RAW_MIN_MAX failed...",
  719. tag, __func__);
  720. logError(0, "ERROR %02X\n",
  721. ERROR_PROD_TEST_DATA);
  722. ret |= ERROR_PROD_TEST_DATA;
  723. goto ERROR_LIMITS;
  724. }
  725. ret = checkLimitsMinMax(msRawFrame.node_data,
  726. msRawFrame.header.force_node,
  727. msRawFrame.header.sense_node,
  728. thresholds[0],
  729. thresholds[1]);
  730. if (ret != OK) {
  731. logError(0, "%s %s:MS RAW failed...",
  732. tag, __func__);
  733. logError(0, "ERROR COUNT = %d\n", ret);
  734. logError(0, "%s MS RAW MIN MAX TEST:...", tag);
  735. logError(0, "FAIL\n\n", tag);
  736. count_fail += 1;
  737. if (stop_on_fail == 1)
  738. goto ERROR;
  739. } else
  740. logError(0, "%s MS RAW MIN MAX TEST:OK\n", tag);
  741. kfree(thresholds);
  742. thresholds = NULL;
  743. } else
  744. logError(0, "%s MS RAW MIN MAX TEST:SKIPPED\n", tag);
  745. logError(0, "%s\n", tag);
  746. logError(0, "%s MS RAW GAP TEST:\n", tag);
  747. if (todo->MutualRawGap == 1) {
  748. ret = parseProductionTestLimits(path_limits,
  749. MS_RAW_GAP,
  750. &thresholds,
  751. &trows,
  752. &tcolumns);
  753. if (ret < 0 || (trows != 1 || tcolumns != 1)) {
  754. logError(1, "%s %s: MS_RAW_GAP failed... ",
  755. tag, __func__);
  756. logError(1, "ERROR %02X\n",
  757. ERROR_PROD_TEST_DATA);
  758. ret |= ERROR_PROD_TEST_DATA;
  759. goto ERROR_LIMITS;
  760. }
  761. ret = checkLimitsGap(msRawFrame.node_data,
  762. msRawFrame.header.force_node,
  763. msRawFrame.header.sense_node,
  764. thresholds[0]);
  765. if (ret != OK) {
  766. logError(1, "%s %s:checkLimitsGap MS RAW ",
  767. tag, __func__);
  768. logError(1, "failed ERROR:%02X\n", ret);
  769. count_fail += 1;
  770. if (stop_on_fail == 1)
  771. goto ERROR;
  772. } else
  773. logError(0, "%s MS RAW GAP TEST:....OK\n\n",
  774. tag);
  775. kfree(thresholds);
  776. thresholds = NULL;
  777. } else
  778. logError(0, "%s MS RAW GAP TEST:..SKIPPED\n", tag);
  779. } else
  780. logError(0, "%s MS RAW FRAME TEST:.SKIPPED\n", tag);
  781. logError(0, "%s\n", tag);
  782. logError(0, "%s MS KEY RAW TEST:\n", tag);
  783. if (todo->MutualKeyRaw == 1) {
  784. ret = production_test_ms_key_raw(path_limits);
  785. if (ret < 0) {
  786. logError(1, "%s %s:production_test_ms_key_raw ",
  787. tag, __func__);
  788. logError(1, "failed ERROR:%02X\n", ret);
  789. count_fail += 1;
  790. if (count_fail == 1) {
  791. logError(0, "%s MS RAW DATA TEST:FAIL ", tag);
  792. logError(0, "fails_count:%d\n\n", count_fail);
  793. goto ERROR_LIMITS;
  794. }
  795. }
  796. } else
  797. logError(0, "%s MS KEY RAW TEST:....SKIPPED\n", tag);
  798. ERROR:
  799. logError(0, "%s\n", tag);
  800. if (count_fail == 0) {
  801. kfree(msRawFrame.node_data);
  802. msRawFrame.node_data = NULL;
  803. logError(0, "%s MS RAW DATA TEST finished!.OK\n", tag);
  804. return OK;
  805. }
  806. print_frame_short("MS Raw frame =",
  807. array1dTo2d_short(msRawFrame.node_data,
  808. msRawFrame.node_data_size,
  809. msRawFrame.header.sense_node),
  810. msRawFrame.header.force_node,
  811. msRawFrame.header.sense_node);
  812. kfree(msRawFrame.node_data);
  813. kfree(thresholds);
  814. logError(0, "%s MS RAW DATA TEST: FAIL fails_count = %d\n\n",
  815. tag, count_fail);
  816. return (ERROR_PROD_TEST_DATA | ERROR_TEST_CHECK_FAIL);
  817. ERROR_LIMITS:
  818. kfree(msRawFrame.node_data);
  819. kfree(thresholds);
  820. return ret;
  821. }
  822. int production_test_ms_key_raw(char *path_limits)
  823. {
  824. int ret;
  825. struct MutualSenseFrame msRawFrame;
  826. int *thresholds = NULL;
  827. int trows, tcolumns;
  828. //************* Mutual Sense Test ************/
  829. logError(0, "%s MS KEY RAW DATA TEST is starting...\n", tag);
  830. ret = getMSFrame2(MS_KEY, &msRawFrame);
  831. if (ret < 0) {
  832. logError(1, "%s %s:getMSKeyFrame failed...ERROR %02X\n",
  833. tag, __func__, ERROR_PROD_TEST_DATA);
  834. return (ret | ERROR_PROD_TEST_DATA);
  835. }
  836. ret = parseProductionTestLimits(path_limits,
  837. MS_KEY_RAW_MIN_MAX,
  838. &thresholds,
  839. &trows,
  840. &tcolumns);
  841. if (ret < 0 || (trows != 1 || tcolumns != 2)) {
  842. logError(1, "%s %s: MS_KEY_RAW_MIN_MAX failed...ERROR %02X\n",
  843. tag, __func__, ERROR_PROD_TEST_DATA);
  844. ret |= ERROR_PROD_TEST_DATA;
  845. goto ERROR_LIMITS;
  846. }
  847. ret = checkLimitsMinMax(msRawFrame.node_data,
  848. msRawFrame.header.force_node,
  849. msRawFrame.header.sense_node,
  850. thresholds[0],
  851. thresholds[1]);
  852. if (ret != OK) {
  853. logError(1, "%s %s:checkLimitsMinMax failed..ERROR COUNT:%d\n",
  854. tag, __func__, ret);
  855. goto ERROR;
  856. } else
  857. logError(0, "%s MS KEY RAW TEST:.................OK\n\n", tag);
  858. kfree(thresholds);
  859. thresholds = NULL;
  860. kfree(msRawFrame.node_data);
  861. msRawFrame.node_data = NULL;
  862. return OK;
  863. ERROR:
  864. print_frame_short("MS Key Raw frame =",
  865. array1dTo2d_short(msRawFrame.node_data,
  866. msRawFrame.node_data_size,
  867. msRawFrame.header.sense_node),
  868. msRawFrame.header.force_node,
  869. msRawFrame.header.sense_node);
  870. kfree(msRawFrame.node_data);
  871. kfree(thresholds);
  872. logError(0, "%s MS KEY RAW TEST:......FAIL\n\n", tag);
  873. return (ERROR_PROD_TEST_DATA | ERROR_TEST_CHECK_FAIL);
  874. ERROR_LIMITS:
  875. kfree(msRawFrame.node_data);
  876. kfree(thresholds);
  877. return ret;
  878. }
  879. int production_test_ms_cx(char *path_limits,
  880. int stop_on_fail, struct TestToDo *todo)
  881. {
  882. int ret;
  883. int count_fail = 0;
  884. int *thresholds = NULL;
  885. int *thresholds_min = NULL;
  886. int *thresholds_max = NULL;
  887. int trows, tcolumns;
  888. struct MutualSenseData msCompData;
  889. u8 *adjhor = NULL;
  890. u8 *adjvert = NULL;
  891. u16 container;
  892. u16 *total_cx = NULL;
  893. u16 *total_adjhor = NULL;
  894. u16 *total_adjvert = NULL;
  895. //MS CX TEST
  896. logError(0, "%s\n", tag);
  897. logError(0, "%s MS CX Testes are starting...\n", tag);
  898. //read MS compensation data
  899. ret = readMutualSenseCompensationData(MS_TOUCH_ACTIVE, &msCompData);
  900. if (ret < 0) {
  901. logError(1, "%s %s:readMutualSenseCompensationData ",
  902. tag, __func__);
  903. logError(1, "failed %02X\n", ERROR_PROD_TEST_DATA);
  904. return (ret | ERROR_PROD_TEST_DATA);
  905. }
  906. logError(0, "%s MS CX1 TEST:\n", tag);
  907. if (todo->MutualCx1 == 1) {
  908. ret = parseProductionTestLimits(path_limits,
  909. MS_CX1_MIN_MAX,
  910. &thresholds,
  911. &trows,
  912. &tcolumns);
  913. if (ret < 0 || (trows != 1 || tcolumns != 2)) {
  914. logError(1, "%s %s:parseProductionTestLimits failed ",
  915. tag, __func__);
  916. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  917. ret |= ERROR_PROD_TEST_DATA;
  918. goto ERROR_LIMITS;
  919. }
  920. container = (u16)msCompData.cx1;
  921. ret = checkLimitsMinMax(&container,
  922. 1,
  923. 1,
  924. thresholds[0],
  925. thresholds[1]); //check the limits
  926. if (ret != OK) {
  927. logError(1, "%s %s:checkLimitsMinMax MS CX1 failed ",
  928. tag, __func__);
  929. logError(1, "ERROR COUNT:%d\n", ret);
  930. logError(0, "%s MS CX1 TEST:.........FAIL\n\n", tag);
  931. count_fail += 1;
  932. if (stop_on_fail)
  933. goto ERROR;
  934. } else
  935. logError(0, "%s MS CX1 TEST:..........OK\n\n", tag);
  936. } else
  937. logError(0, "%s MS CX1 TEST:.......SKIPPED\n\n", tag);
  938. kfree(thresholds);
  939. thresholds = NULL;
  940. logError(0, "%s MS CX2 MIN MAX TEST:\n", tag);
  941. if (todo->MutualCx2 == 1) {
  942. ret = parseProductionTestLimits(path_limits,
  943. MS_CX2_MAP_MIN,
  944. &thresholds_min,
  945. &trows,
  946. &tcolumns); //load min thresholds
  947. if (ret < 0 || (trows != msCompData.header.force_node
  948. || tcolumns != msCompData.header.sense_node)) {
  949. logError(1, "%s %s:parseProductionTestLimits ",
  950. tag, __func__);
  951. logError(1, "failed %02X\n", ERROR_PROD_TEST_DATA);
  952. ret |= ERROR_PROD_TEST_DATA;
  953. goto ERROR_LIMITS;
  954. }
  955. ret = parseProductionTestLimits(path_limits,
  956. MS_CX2_MAP_MAX,
  957. &thresholds_max,
  958. &trows,
  959. &tcolumns); //load max thresholds
  960. if (ret < 0 || (trows != msCompData.header.force_node
  961. || tcolumns != msCompData.header.sense_node)) {
  962. logError(1, "%s %s: MS_CX2_MAP_MAX failed ERROR %02X\n",
  963. tag, __func__, ERROR_PROD_TEST_DATA);
  964. ret |= ERROR_PROD_TEST_DATA;
  965. goto ERROR_LIMITS;
  966. }
  967. ret = checkLimitsMap(msCompData.node_data,
  968. msCompData.header.force_node,
  969. msCompData.header.sense_node,
  970. thresholds_min,
  971. thresholds_max);//check the limits
  972. if (ret != OK) {
  973. logError(1, "%s %s:checkLimitsMap MS CX2 MIN MAX ",
  974. tag, __func__);
  975. logError(1, "failed ERR_COUNT:%d\n", ret);
  976. logError(0, "%s MS CX2 MIN MAX TEST:......FAIL\n\n",
  977. tag);
  978. count_fail += 1;
  979. if (stop_on_fail)
  980. goto ERROR;
  981. } else
  982. logError(0, "%s MS CX2 MIN MAX TEST:....OK\n\n", tag);
  983. kfree(thresholds_min);
  984. thresholds_min = NULL;
  985. kfree(thresholds_max);
  986. thresholds_max = NULL;
  987. } else
  988. logError(0, "%s MS CX2 MIN MAX TEST:....SKIPPED\n\n", tag);
  989. logError(0, "%s MS CX2 ADJ TEST:\n", tag);
  990. if (todo->MutualCx2Adj == 1) {
  991. //MS CX2 ADJ HORIZ
  992. logError(0, "%s MS CX2 ADJ HORIZ TEST:\n", tag);
  993. ret = computeAdjHoriz(msCompData.node_data,
  994. msCompData.header.force_node,
  995. msCompData.header.sense_node,
  996. &adjhor);
  997. if (ret < 0) {
  998. logError(1, "%s %s:computeAdjHoriz failed...",
  999. tag, __func__);
  1000. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1001. ret |= ERROR_PROD_TEST_DATA;
  1002. goto ERROR_LIMITS;
  1003. }
  1004. logError(0, "%s MS CX2 ADJ HORIZ computed!\n", tag);
  1005. ret = parseProductionTestLimits(path_limits,
  1006. MS_CX2_ADJH_MAP_MAX,
  1007. &thresholds_max, &trows,
  1008. &tcolumns);
  1009. if (ret < 0 || (trows != msCompData.header.force_node
  1010. || tcolumns != msCompData.header.sense_node - 1)) {
  1011. logError(1, "%s %s: MS_CX2_ADJH_MAP_MAX failed...",
  1012. tag, __func__);
  1013. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1014. ret |= ERROR_PROD_TEST_DATA;
  1015. goto ERROR_LIMITS;
  1016. }
  1017. ret = checkLimitsMapAdj(adjhor,
  1018. msCompData.header.force_node,
  1019. msCompData.header.sense_node - 1,
  1020. thresholds_max);
  1021. if (ret != OK) {
  1022. logError(1, "%s %s:checkLimitsMapAdj CX2 ADJH failed ",
  1023. tag, __func__);
  1024. logError(1, "ERROR COUNT:%d\n", ret);
  1025. logError(0, "%s MS CX2 ADJ HORIZ TEST:..FAIL\n\n", tag);
  1026. count_fail += 1;
  1027. if (stop_on_fail)
  1028. goto ERROR;
  1029. } else
  1030. logError(0, "%s MS CX2 ADJ HORIZ TEST:..OK\n\n", tag);
  1031. kfree(thresholds_max);
  1032. thresholds_max = NULL;
  1033. kfree(adjhor);
  1034. adjhor = NULL;
  1035. //MS CX2 ADJ VERT
  1036. logError(0, "%s MS CX2 ADJ VERT TEST:\n", tag);
  1037. ret = computeAdjVert(msCompData.node_data,
  1038. msCompData.header.force_node,
  1039. msCompData.header.sense_node,
  1040. &adjvert);
  1041. if (ret < 0) {
  1042. logError(1, "%s %s:computeAdjVert failed... ",
  1043. tag, __func__);
  1044. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1045. ret |= ERROR_PROD_TEST_DATA;
  1046. goto ERROR_LIMITS;
  1047. }
  1048. logError(0, "%s MS CX2 ADJ VERT computed!\n", tag);
  1049. ret = parseProductionTestLimits(path_limits,
  1050. MS_CX2_ADJV_MAP_MAX,
  1051. &thresholds_max,
  1052. &trows,
  1053. &tcolumns);
  1054. if (ret < 0 || (trows != msCompData.header.force_node - 1
  1055. || tcolumns != msCompData.header.sense_node)) {
  1056. logError(1, "%s %s:MS_CX2_ADJV_MAP_MAX failed ",
  1057. tag, __func__);
  1058. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1059. ret |= ERROR_PROD_TEST_DATA;
  1060. goto ERROR_LIMITS;
  1061. }
  1062. ret = checkLimitsMapAdj(adjvert,
  1063. msCompData.header.force_node - 1,
  1064. msCompData.header.sense_node - 1,
  1065. thresholds_max);
  1066. if (ret != OK) {
  1067. logError(1, "%s %s:checkLimitsMapAdj CX2 ADJV failed ",
  1068. tag, __func__);
  1069. logError(1, "COUNT:%d\n", ret);
  1070. logError(0, "%s MS CX2 ADJ HORIZ TEST:FAIL\n\n", tag);
  1071. count_fail += 1;
  1072. if (stop_on_fail)
  1073. goto ERROR;
  1074. } else
  1075. logError(0, "%s MS CX2 ADJ VERT TEST:OK\n\n", tag);
  1076. kfree(thresholds_max);
  1077. thresholds_max = NULL;
  1078. kfree(adjvert);
  1079. adjvert = NULL;
  1080. } else
  1081. logError(0, "%s MS CX2 ADJ TEST:SKIPPED\n\n", tag);
  1082. //START OF TOTAL CHECK
  1083. logError(0, "%s MS TOTAL CX TEST:\n", tag);
  1084. if (todo->MutualCxTotal == 1 || todo->MutualCxTotalAdj == 1) {
  1085. ret = computeTotal(msCompData.node_data,
  1086. msCompData.cx1,
  1087. msCompData.header.force_node,
  1088. msCompData.header.sense_node,
  1089. CX1_WEIGHT,
  1090. CX2_WEIGHT,
  1091. &total_cx);
  1092. if (ret < 0) {
  1093. logError(1, "%s %s:computeTotalCx failed...",
  1094. tag, __func__);
  1095. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1096. ret |= ERROR_PROD_TEST_DATA;
  1097. goto ERROR_LIMITS;
  1098. }
  1099. logError(0, "%s MS TOTAL CX MIN MAX TEST:\n", tag);
  1100. if (todo->MutualCxTotal == 1) {
  1101. ret = parseProductionTestLimits(path_limits,
  1102. MS_TOTAL_CX_MAP_MIN,
  1103. &thresholds_min,
  1104. &trows,
  1105. &tcolumns);//load min thresholds
  1106. if (ret < 0 || (trows != msCompData.header.force_node
  1107. || tcolumns != msCompData.header.sense_node)) {
  1108. logError(1, "%s %s:parseProductionTestLimits ",
  1109. tag, __func__);
  1110. logError(1, "failed %02X\n",
  1111. ERROR_PROD_TEST_DATA);
  1112. ret |= ERROR_PROD_TEST_DATA;
  1113. goto ERROR_LIMITS;
  1114. }
  1115. //load max thresholds
  1116. ret = parseProductionTestLimits(path_limits,
  1117. MS_TOTAL_CX_MAP_MAX,
  1118. &thresholds_max,
  1119. &trows,
  1120. &tcolumns);
  1121. if (ret < 0 || (trows != msCompData.header.force_node
  1122. || tcolumns != msCompData.header.sense_node)) {
  1123. logError(1, "%s %s:MS_TOTAL_CX_MAP_MAX failed",
  1124. tag, __func__);
  1125. logError(1, "...ERROR %02X\n",
  1126. ERROR_PROD_TEST_DATA);
  1127. ret |= ERROR_PROD_TEST_DATA;
  1128. goto ERROR_LIMITS;
  1129. }
  1130. ret = checkLimitsMapTotal(total_cx,
  1131. msCompData.header.force_node,
  1132. msCompData.header.sense_node,
  1133. thresholds_min,
  1134. thresholds_max);//check the limits
  1135. if (ret != OK) {
  1136. logError(1, "%s %s:MS TOTAL CX TEST failed ",
  1137. tag, __func__);
  1138. logError(1, "COUNT:%d\n", ret);
  1139. logError(0, "%s MS TOTAL CX MIN MAX ", tag);
  1140. logError(0, "TEST:FAIL\n\n");
  1141. count_fail += 1;
  1142. if (stop_on_fail)
  1143. goto ERROR;
  1144. } else {
  1145. logError(0, "%s MS TOTAL CX MIN MAX TEST", tag);
  1146. logError(0, ":OK\n\n");
  1147. }
  1148. kfree(thresholds_min);
  1149. thresholds_min = NULL;
  1150. kfree(thresholds_max);
  1151. thresholds_max = NULL;
  1152. } else
  1153. logError(0, "%s MS TOTAL CX MIN MAX TEST:SKIPPED\n\n",
  1154. tag);
  1155. logError(0, "%s MS TOTAL CX ADJ TEST:\n", tag);
  1156. if (todo->MutualCxTotalAdj == 1) {
  1157. //MS TOTAL CX ADJ HORIZ
  1158. logError(0, "%s MS TOTAL CX ADJ HORIZ TEST:\n", tag);
  1159. //thresholds_max = NULL;
  1160. ret = computeAdjHorizTotal(total_cx,
  1161. msCompData.header.force_node,
  1162. msCompData.header.sense_node,
  1163. &total_adjhor);
  1164. if (ret < 0) {
  1165. logError(1, "%s production_test_data: ", tag);
  1166. logError(1, "computeAdjHoriz failed... ");
  1167. logError(1, "ERROR %02X\n",
  1168. ERROR_PROD_TEST_DATA);
  1169. ret |= ERROR_PROD_TEST_DATA;
  1170. goto ERROR_LIMITS;
  1171. }
  1172. logError(0, "%s MS TOTAL CX ADJ HORIZ computed!\n",
  1173. tag);
  1174. ret = parseProductionTestLimits(path_limits,
  1175. MS_TOTAL_CX_ADJH_MAP_MAX,
  1176. &thresholds_max, &trows,
  1177. &tcolumns);
  1178. if (ret < 0 || (trows != msCompData.header.force_node
  1179. || tcolumns != msCompData.header.sense_node - 1)) {
  1180. logError(1, "%s production_test_data: ", tag);
  1181. logError(1, "parseProductionTestLimits ");
  1182. logError(1, "MS_TOTAL_CX_ADJH_MAP_MAX ");
  1183. logError(1, "failed...RROR %02X\n",
  1184. ERROR_PROD_TEST_DATA);
  1185. ret |= ERROR_PROD_TEST_DATA;
  1186. goto ERROR_LIMITS;
  1187. }
  1188. ret = checkLimitsMapAdjTotal(total_adjhor,
  1189. msCompData.header.force_node,
  1190. msCompData.header.sense_node - 1,
  1191. thresholds_max);
  1192. if (ret != OK) {
  1193. logError(1, "%s production_test_data: ", tag);
  1194. logError(1, "checkLimitsMapAdj MS TOTAL ");
  1195. logError(1, "CX ADJH failed... ");
  1196. logError(1, "ERROR COUNT = %d\n", ret);
  1197. logError(0, "%s MS TOTAL CX ADJ HORIZ ", tag);
  1198. logError(0, "TEST:.................FAIL\n\n");
  1199. count_fail += 1;
  1200. if (stop_on_fail)
  1201. goto ERROR;
  1202. } else {
  1203. logError(0, "%s MS TOTAL CX ADJ HORIZ ", tag);
  1204. logError(0, "TEST:.................OK\n\n");
  1205. }
  1206. kfree(thresholds_max);
  1207. thresholds_max = NULL;
  1208. kfree(total_adjhor);
  1209. total_adjhor = NULL;
  1210. //MS TOTAL CX ADJ VERT
  1211. logError(0, "%s MS TOTAL CX ADJ VERT TEST:\n", tag);
  1212. ret = computeAdjVertTotal(total_cx,
  1213. msCompData.header.force_node,
  1214. msCompData.header.sense_node,
  1215. &total_adjvert);
  1216. if (ret < 0) {
  1217. logError(1, "%s production_test_data: ", tag);
  1218. logError(1, "computeAdjVert failed... ");
  1219. logError(1, "ERROR %02X\n",
  1220. ERROR_PROD_TEST_DATA);
  1221. ret |= ERROR_PROD_TEST_DATA;
  1222. goto ERROR_LIMITS;
  1223. }
  1224. logError(0, "%s MS TOTAL CX ADJ VERT computed!\n",
  1225. tag);
  1226. ret = parseProductionTestLimits(path_limits,
  1227. MS_TOTAL_CX_ADJV_MAP_MAX,
  1228. &thresholds_max,
  1229. &trows,
  1230. &tcolumns);
  1231. if (ret < 0 ||
  1232. (trows != msCompData.header.force_node - 1
  1233. || tcolumns != msCompData.header.sense_node)) {
  1234. logError(1, "%s production_test_data: ", tag);
  1235. logError(1, "parseProductionTestLimits ");
  1236. logError(1, "MS_TOTAL_CX_ADJV_MAP_MAX failed");
  1237. logError(1, "... ERROR %02X\n",
  1238. ERROR_PROD_TEST_DATA);
  1239. ret |= ERROR_PROD_TEST_DATA;
  1240. goto ERROR_LIMITS;
  1241. }
  1242. ret = checkLimitsMapAdjTotal(total_adjvert,
  1243. msCompData.header.force_node - 1,
  1244. msCompData.header.sense_node - 1,
  1245. thresholds_max);
  1246. if (ret != OK) {
  1247. logError(1, "%s production_test_data: ", tag);
  1248. logError(1, "checkLimitsMapAdj MS TOTAL ");
  1249. logError(1, "CX ADJV failed... ");
  1250. logError(1, "ERROR COUNT = %d\n", ret);
  1251. logError(0, "%s MS TOTAL CX ADJ HORIZ ", tag);
  1252. logError(0, "TEST:.................FAIL\n");
  1253. count_fail += 1;
  1254. if (stop_on_fail)
  1255. goto ERROR;
  1256. } else {
  1257. logError(0, "%s MS TOTAL CX ADJ VERT ", tag);
  1258. logError(0, "TEST:.................OK\n");
  1259. }
  1260. kfree(thresholds_max);
  1261. thresholds_max = NULL;
  1262. kfree(total_adjvert);
  1263. total_adjvert = NULL;
  1264. } else {
  1265. logError(0, "%s MS TOTAL CX ADJ ", tag);
  1266. logError(0, "TEST:.................SKIPPED\n");
  1267. }
  1268. kfree(total_cx);
  1269. total_cx = NULL;
  1270. } else
  1271. logError(0, "%s MS TOTAL CX TEST:.................SKIPPED\n",
  1272. tag);
  1273. if ((todo->MutualKeyCx1
  1274. | todo->MutualKeyCx2 | todo->MutualKeyCxTotal) == 1) {
  1275. ret = production_test_ms_key_cx(path_limits,
  1276. stop_on_fail,
  1277. todo);
  1278. if (ret < 0) {
  1279. count_fail += 1;
  1280. logError(1, "%s production_test_data: ", tag);
  1281. logError(1, "production_test_ms_key_cx failed...");
  1282. logError(1, "ERROR = %02X\n", ret);
  1283. logError(0, "%s MS CX testes finished!", tag);
  1284. logError(0, ".................FAILED ");
  1285. logError(0, "fails_count = %d\n\n", count_fail);
  1286. return ret;
  1287. }
  1288. } else
  1289. logError(0, "%s MS KEY CX TEST:.................SKIPPED\n",
  1290. tag);
  1291. if ((todo->MutualKeyCx1 | todo->MutualKeyCx2
  1292. | todo->MutualKeyCxTotal) == 1) {
  1293. ret = production_test_ms_key_cx(path_limits,
  1294. stop_on_fail,
  1295. todo);
  1296. if (ret < 0) {
  1297. count_fail += 1;
  1298. logError(1, "%s %s:production_test_ms_key_cx ",
  1299. tag, __func__);
  1300. logError(1, "failed :%02X\n", ret);
  1301. logError(0, "%s MS CX testes finished! ", tag);
  1302. logError(0, "fails_count = %d\n\n", count_fail);
  1303. return ret;
  1304. }
  1305. } else
  1306. logError(0, "%s MS KEY CX TEST:..SKIPPED\n", tag);
  1307. ERROR:
  1308. logError(0, "%s\n", tag);
  1309. if (count_fail == 0) {
  1310. logError(0, "%s MS CX testes finished! OK\n", tag);
  1311. kfree(msCompData.node_data);
  1312. msCompData.node_data = NULL;
  1313. return OK;
  1314. }
  1315. print_frame_u8("MS Init Data (Cx2) =",
  1316. array1dTo2d_u8(msCompData.node_data,
  1317. msCompData.node_data_size,
  1318. msCompData.header.sense_node),
  1319. msCompData.header.force_node,
  1320. msCompData.header.sense_node);
  1321. logError(0, "%s MS CX testes finished! fails_count = %d\n\n",
  1322. tag, count_fail);
  1323. kfree(thresholds);
  1324. kfree(thresholds_min);
  1325. kfree(thresholds_max);
  1326. kfree(adjhor);
  1327. kfree(adjvert);
  1328. kfree(total_cx);
  1329. kfree(total_adjhor);
  1330. kfree(total_adjvert);
  1331. kfree(msCompData.node_data);
  1332. return (ERROR_TEST_CHECK_FAIL | ERROR_PROD_TEST_DATA);
  1333. ERROR_LIMITS:
  1334. kfree(thresholds);
  1335. kfree(thresholds_min);
  1336. kfree(thresholds_max);
  1337. kfree(adjhor);
  1338. kfree(adjvert);
  1339. kfree(total_cx);
  1340. kfree(total_adjhor);
  1341. kfree(total_adjvert);
  1342. kfree(msCompData.node_data);
  1343. return ret;
  1344. }
  1345. int production_test_ms_key_cx(char *path_limits, int stop_on_fail,
  1346. struct TestToDo *todo)
  1347. {
  1348. int ret;
  1349. int count_fail = 0;
  1350. int num_keys = 0;
  1351. int *thresholds = NULL;
  1352. int *thresholds_min = NULL;
  1353. int *thresholds_max = NULL;
  1354. int trows, tcolumns;
  1355. struct MutualSenseData msCompData;
  1356. u16 container;
  1357. u16 *total_cx = NULL;
  1358. //MS CX TEST
  1359. logError(0, "%s MS KEY CX Testes are starting...\n", tag);
  1360. //read MS compensation data
  1361. ret = readMutualSenseCompensationData(MS_KEY, &msCompData);
  1362. if (ret < 0) {
  1363. logError(0, "%s production_test_data: ", tag);
  1364. logError(0, "readMutualSenseCompensationData failed... ");
  1365. logError(0, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1366. return (ret | ERROR_PROD_TEST_DATA);
  1367. }
  1368. //the meaningful data are only in the first row, the other rows are
  1369. // only a copy of the first one
  1370. if (msCompData.header.force_node > msCompData.header.sense_node)
  1371. num_keys = msCompData.header.force_node;
  1372. else
  1373. num_keys = msCompData.header.sense_node;
  1374. logError(0, "%s MS KEY CX1 TEST:\n", tag);
  1375. if (todo->MutualKeyCx1 == 1) {
  1376. ret = parseProductionTestLimits(path_limits,
  1377. MS_KEY_CX1_MIN_MAX,
  1378. &thresholds,
  1379. &trows,
  1380. &tcolumns);
  1381. if (ret < 0 || (trows != 1 || tcolumns != 2)) {
  1382. logError(0, "%s production_test_data: ", tag);
  1383. logError(0, "parseProductionTestLimits ");
  1384. logError(0, "MS_KEY_CX1_MIN_MAX failed... ");
  1385. logError(0, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1386. ret |= ERROR_PROD_TEST_DATA;
  1387. goto ERROR_LIMITS;
  1388. }
  1389. container = (u16) msCompData.cx1;
  1390. ret = checkLimitsMinMax(&container,
  1391. 1,
  1392. 1,
  1393. thresholds[0],
  1394. thresholds[1]); //check the limits
  1395. if (ret != OK) {
  1396. logError(1, "%s production_test_data: ", tag);
  1397. logError(1, "checkLimitsMinMax MS CX1 failed... ");
  1398. logError(1, "ERROR COUNT = %d\n", ret);
  1399. logError(0, "%s MS KEY CX1 TEST:................", tag);
  1400. logError(0, ".FAIL\n\n");
  1401. count_fail += 1;
  1402. if (stop_on_fail)
  1403. goto ERROR;
  1404. } else {
  1405. logError(0, "%s MS KEY CX1 TEST:................", tag);
  1406. logError(0, ".OK\n\n");
  1407. }
  1408. } else
  1409. logError(0, "%s MS KEY CX1 TEST:.................SKIPPED\n\n",
  1410. tag);
  1411. kfree(thresholds);
  1412. thresholds = NULL;
  1413. logError(0, "%s MS KEY CX2 TEST:\n", tag);
  1414. if (todo->MutualKeyCx2 == 1) {
  1415. //load min thresholds
  1416. ret = parseProductionTestLimits(path_limits,
  1417. MS_KEY_CX2_MAP_MIN,
  1418. &thresholds_min,
  1419. &trows,
  1420. &tcolumns);
  1421. if (ret < 0 || (trows != 1 || tcolumns != num_keys)) {
  1422. logError(1, "%s production_test_data: ", tag);
  1423. logError(1, "parseProductionTestLimits ");
  1424. logError(1, "MS_KEY_CX2_MAP_MIN failed... ");
  1425. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1426. ret |= ERROR_PROD_TEST_DATA;
  1427. goto ERROR_LIMITS;
  1428. }
  1429. //load max thresholds
  1430. ret = parseProductionTestLimits(path_limits,
  1431. MS_KEY_CX2_MAP_MAX,
  1432. &thresholds_max,
  1433. &trows,
  1434. &tcolumns);
  1435. if (ret < 0 || (trows != 1 || tcolumns != num_keys)) {
  1436. logError(1, "%s production_test_data: ", tag);
  1437. logError(1, "parseProductionTestLimits ");
  1438. logError(1, "MS_KEY_CX2_MAP_MAX failed... ");
  1439. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1440. ret |= ERROR_PROD_TEST_DATA;
  1441. goto ERROR_LIMITS;
  1442. }
  1443. //check the limits
  1444. ret = checkLimitsMap(msCompData.node_data,
  1445. 1,
  1446. num_keys,
  1447. thresholds_min,
  1448. thresholds_max);
  1449. if (ret != OK) {
  1450. logError(1, "%s production_test_data: ", tag);
  1451. logError(1, "checkLimitsMap MS KEY CX2 failed... ");
  1452. logError(1, "ERROR COUNT = %d\n", ret);
  1453. logError(0, "%s MS KEY CX2 TEST:................", tag);
  1454. logError(0, ".FAIL\n\n");
  1455. count_fail += 1;
  1456. if (stop_on_fail)
  1457. goto ERROR;
  1458. } else {
  1459. logError(0, "%s MS KEY CX2 TEST:...............", tag);
  1460. logError(0, "..OK\n\n");
  1461. }
  1462. kfree(thresholds_min);
  1463. thresholds_min = NULL;
  1464. kfree(thresholds_max);
  1465. thresholds_max = NULL;
  1466. } else
  1467. logError(0, "%s MS CX2 TEST:.................SKIPPED\n\n",
  1468. tag);
  1469. //START OF TOTAL CHECK
  1470. logError(0, "%s MS KEY TOTAL CX TEST:\n", tag);
  1471. if (todo->MutualKeyCxTotal == 1) {
  1472. ret = computeTotal(msCompData.node_data,
  1473. msCompData.cx1, 1,
  1474. num_keys,
  1475. CX1_WEIGHT,
  1476. CX2_WEIGHT,
  1477. &total_cx);
  1478. if (ret < 0) {
  1479. logError(1, "%s production_test_data: ", tag);
  1480. logError(1, "computeTotalCx failed... ");
  1481. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1482. ret |= ERROR_PROD_TEST_DATA;
  1483. goto ERROR_LIMITS;
  1484. }
  1485. //load min thresholds
  1486. ret = parseProductionTestLimits(path_limits,
  1487. MS_KEY_TOTAL_CX_MAP_MIN,
  1488. &thresholds_min,
  1489. &trows,
  1490. &tcolumns);
  1491. if (ret < 0 || (trows != 1 || tcolumns != num_keys)) {
  1492. logError(1, "%s production_test_data: ", tag);
  1493. logError(1, "%parseProductionTestLimits ");
  1494. logError(1, "MS_KEY_TOTAL_CX_MAP_MIN failed... ");
  1495. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1496. ret |= ERROR_PROD_TEST_DATA;
  1497. goto ERROR_LIMITS;
  1498. }
  1499. //load max thresholds
  1500. ret = parseProductionTestLimits(path_limits,
  1501. MS_KEY_TOTAL_CX_MAP_MAX,
  1502. &thresholds_max,
  1503. &trows,
  1504. &tcolumns);
  1505. if (ret < 0 || (trows != 1 || tcolumns != num_keys)) {
  1506. logError(1, "%s production_test_data: ", tag);
  1507. logError(1, "parseProductionTestLimits ");
  1508. logError(1, "MS_KEY_TOTAL_CX_MAP_MAX failed... ");
  1509. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1510. ret |= ERROR_PROD_TEST_DATA;
  1511. goto ERROR_LIMITS;
  1512. }
  1513. //check the limits
  1514. ret = checkLimitsMapTotal(total_cx,
  1515. 1,
  1516. num_keys,
  1517. thresholds_min,
  1518. thresholds_max);
  1519. if (ret != OK) {
  1520. logError(1, "%s production_test_data: ", tag);
  1521. logError(1, "checkLimitsMap MS TOTAL ");
  1522. logError(1, "KEY CX TEST failed... ERROR COUNT = %d\n",
  1523. ret);
  1524. logError(0, "%s MS KEY TOTAL CX TEST:...........", tag);
  1525. logError(0, "......FAIL\n\n");
  1526. count_fail += 1;
  1527. if (stop_on_fail)
  1528. goto ERROR;
  1529. } else {
  1530. logError(0, "%s MS KEY TOTAL CX TEST:...........", tag);
  1531. logError(0, "......OK\n\n");
  1532. }
  1533. kfree(thresholds_min);
  1534. thresholds_min = NULL;
  1535. kfree(thresholds_max);
  1536. thresholds_max = NULL;
  1537. kfree(total_cx);
  1538. total_cx = NULL;
  1539. } else {
  1540. logError(0, "%s MS KEY TOTAL CX TEST:.................", tag);
  1541. logError(0, "SKIPPED\n");
  1542. }
  1543. ERROR:
  1544. logError(0, "%s\n", tag);
  1545. if (count_fail == 0) {
  1546. logError(0,
  1547. "%s MS KEY CX testes finished! OK\n", tag);
  1548. kfree(msCompData.node_data);
  1549. msCompData.node_data = NULL;
  1550. return OK;
  1551. }
  1552. print_frame_u8("MS Key Init Data (Cx2) =",
  1553. array1dTo2d_u8(msCompData.node_data,
  1554. msCompData.node_data_size,
  1555. msCompData.header.sense_node),
  1556. 1,
  1557. msCompData.header.sense_node);
  1558. logError(0, "%s MS Key CX testes finished!..............", tag);
  1559. logError(0, "...FAILED fails_count = %d\n\n", count_fail);
  1560. kfree(thresholds);
  1561. kfree(thresholds_min);
  1562. kfree(thresholds_max);
  1563. kfree(msCompData.node_data);
  1564. kfree(total_cx);
  1565. return (ERROR_TEST_CHECK_FAIL | ERROR_PROD_TEST_DATA);
  1566. ERROR_LIMITS:
  1567. kfree(thresholds);
  1568. kfree(thresholds_min);
  1569. kfree(thresholds_max);
  1570. kfree(msCompData.node_data);
  1571. kfree(total_cx);
  1572. return ret;
  1573. }
  1574. int production_test_ss_raw(char *path_limits,
  1575. int stop_on_fail, struct TestToDo *todo)
  1576. {
  1577. int ret;
  1578. int count_fail = 0;
  1579. int rows, columns;
  1580. //short *ssRawFrame = NULL;
  1581. struct SelfSenseFrame ssRawFrame;
  1582. int *thresholds = NULL;
  1583. int trows, tcolumns;
  1584. //MS SS TEST
  1585. logError(0, "%s\n", tag);
  1586. logError(0, "%s SS RAW Testes are starting...\n", tag);
  1587. //******* Self Sense Test ***************/
  1588. logError(0, "%s Getting SS Frame...\n", tag);
  1589. ret = getSSFrame2(SS_TOUCH, &ssRawFrame);
  1590. if (ret < 0) {
  1591. logError(1, "%s %s:getSSFrame failed...ERROR %02X\n",
  1592. tag, __func__, ERROR_PROD_TEST_DATA);
  1593. return (ret | ERROR_PROD_TEST_DATA);
  1594. }
  1595. //SS RAW (PROXIMITY) FORCE TEST
  1596. logError(0, "%s SS RAW (PROXIMITY) FORCE TEST:\n", tag);
  1597. if (todo->SelfForceRaw == 1 || todo->SelfForceRawGap == 1) {
  1598. //there are no data for the sense
  1599. //channels due to the fact that
  1600. //the force frame is analized
  1601. columns = 1;
  1602. rows = ssRawFrame.header.force_node;
  1603. logError(0, "%s SS RAW (PROXIMITY) FORCE MIN MAX TEST:\n", tag);
  1604. if (todo->SelfForceRaw == 1) {
  1605. ret = parseProductionTestLimits(path_limits,
  1606. SS_RAW_FORCE_MIN_MAX,
  1607. &thresholds,
  1608. &trows,
  1609. &tcolumns);
  1610. if (ret < 0 || (trows != 1 || tcolumns != 2)) {
  1611. logError(1, "%s %s:parseProductionTestLimits ",
  1612. tag, __func__);
  1613. logError(1, "failed %02X\n",
  1614. ERROR_PROD_TEST_DATA);
  1615. //return (ret | ERROR_PROD_TEST_DATA);
  1616. ret |= ERROR_PROD_TEST_DATA;
  1617. goto ERROR_LIMITS;
  1618. }
  1619. ret = checkLimitsMinMax(ssRawFrame.force_data,
  1620. rows, columns,
  1621. thresholds[0],
  1622. thresholds[1]);
  1623. if (ret != OK) {
  1624. logError(1, "%s %s:checkLimitsMinMax ",
  1625. tag, __func__);
  1626. logError(1, "failed ERROR COUNT:%d\n", ret);
  1627. logError(0, "%s SS RAW (PROXIMITY) FORCE", tag);
  1628. logError(0, " MIN MAX TEST:FAIL\n\n");
  1629. count_fail += 1;
  1630. print_frame_short("SS Raw force frame =",
  1631. array1dTo2d_short(ssRawFrame.force_data,
  1632. rows*columns, columns),
  1633. rows,
  1634. columns);
  1635. if (stop_on_fail) {
  1636. ret = ERROR_PROD_TEST_DATA
  1637. | ERROR_TEST_CHECK_FAIL;
  1638. goto ERROR_LIMITS;
  1639. }
  1640. } else {
  1641. logError(0, "%s SS RAW (PROXIMITY) ", tag);
  1642. logError(0, "FORCE MIN MAX TEST:.............");
  1643. logError(0, "....OK\n\n");
  1644. }
  1645. kfree(thresholds);
  1646. thresholds = NULL;
  1647. } else {
  1648. logError(0, "%s SS RAW (PROXIMITY) ", tag);
  1649. logError(0, "FORCE MIN MAX TEST:.................");
  1650. logError(0, "SKIPPED\n\n");
  1651. }
  1652. logError(0, "%s\n", tag);
  1653. logError(0, "%s SS RAW (PROXIMITY) FORCE GAP TEST:\n", tag);
  1654. if (todo->SelfForceRawGap == 1) {
  1655. ret = parseProductionTestLimits(path_limits,
  1656. SS_RAW_FORCE_GAP,
  1657. &thresholds,
  1658. &trows,
  1659. &tcolumns);
  1660. if (ret < 0 || (trows != 1 || tcolumns != 1)) {
  1661. logError(1, "%s production_test_data: ", tag);
  1662. logError(1, "parseProductionTestLimits ");
  1663. logError(1, "SS_RAW_FORCE_GAP failed... ");
  1664. logError(1, "ERROR %02X\n",
  1665. ERROR_PROD_TEST_DATA);
  1666. ret |= ERROR_PROD_TEST_DATA;
  1667. goto ERROR_LIMITS;
  1668. }
  1669. ret = checkLimitsGap(ssRawFrame.force_data,
  1670. rows,
  1671. columns,
  1672. thresholds[0]);
  1673. if (ret != OK) {
  1674. logError(1, "%s production_test_data: ", tag);
  1675. logError(1, "checkLimitsGap SS RAW ");
  1676. logError(1, "(PROXIMITY) FORCE GAP failed...");
  1677. logError(1, "ERROR = %02X\n", ret);
  1678. logError(0, "%s SS RAW (PROXIMITY) ", tag);
  1679. logError(0, "FORCE GAP TEST:.................");
  1680. logError(0, "FAIL\n\n");
  1681. count_fail += 1;
  1682. print_frame_short("SS Raw force frame =",
  1683. array1dTo2d_short(ssRawFrame.force_data,
  1684. rows*columns, columns),
  1685. rows,
  1686. columns);
  1687. if (stop_on_fail) {
  1688. ret = ERROR_PROD_TEST_DATA
  1689. | ERROR_TEST_CHECK_FAIL;
  1690. goto ERROR_LIMITS;
  1691. }
  1692. } else {
  1693. logError(0, "%s SS RAW (PROXIMITY) ", tag);
  1694. logError(0, "FORCE GAP TEST:.................");
  1695. logError(0, "OK\n\n");
  1696. }
  1697. kfree(thresholds);
  1698. thresholds = NULL;
  1699. } else {
  1700. logError(0, "%s SS RAW (PROXIMITY) ", tag);
  1701. logError(0, "FORCE GAP TEST:.................");
  1702. logError(0, "SKIPPED\n\n");
  1703. }
  1704. kfree(ssRawFrame.force_data);
  1705. ssRawFrame.force_data = NULL;
  1706. } else {
  1707. logError(0, "%s SS RAW (PROXIMITY) FORCE ", tag);
  1708. logError(0, "TEST:.................SKIPPED\n\n");
  1709. }
  1710. logError(0, "%s\n", tag);
  1711. //SS RAW (PROXIMITY) SENSE TEST
  1712. logError(0, "%s SS RAW (PROXIMITY) SENSE TEST:\n", tag);
  1713. if (todo->SelfSenseRaw == 1 || todo->SelfSenseRawGap == 1) {
  1714. columns = ssRawFrame.header.sense_node;
  1715. // there are no data for the force channels due
  1716. // to the fact that the sense frame is analized
  1717. rows = 1;
  1718. logError(0, "%s SS RAW (PROXIMITY) SENSE MIN MAX TEST:\n", tag);
  1719. if (todo->SelfSenseRaw == 1) {
  1720. ret = parseProductionTestLimits(path_limits,
  1721. SS_RAW_SENSE_MIN_MAX,
  1722. &thresholds,
  1723. &trows,
  1724. &tcolumns);
  1725. if (ret < 0 || (trows != 1 || tcolumns != 2)) {
  1726. logError(1, "%s production_test_data: ", tag);
  1727. logError(1, "parseProductionTestLimits ");
  1728. logError(1, "SS_RAW_SENSE_MIN_MAX failed... ");
  1729. logError(1, "ERROR %02X\n",
  1730. ERROR_PROD_TEST_DATA);
  1731. ret |= ERROR_PROD_TEST_DATA;
  1732. goto ERROR_LIMITS;
  1733. }
  1734. ret = checkLimitsMinMax(ssRawFrame.sense_data,
  1735. rows,
  1736. columns,
  1737. thresholds[0],
  1738. thresholds[1]);
  1739. if (ret != OK) {
  1740. logError(1, "%s production_test_data: ", tag);
  1741. logError(1, "checkLimitsMinMax SS RAW ");
  1742. logError(1, "(PROXIMITY) SENSE failed... ");
  1743. logError(1, "ERROR COUNT = %d\n", ret);
  1744. logError(0, "%s SS RAW (PROXIMITY) ", tag);
  1745. logError(0, "SENSE MIN MAX TEST:.............");
  1746. logError(0, "....FAIL\n");
  1747. count_fail += 1;
  1748. print_frame_short("SS Raw sense frame =",
  1749. array1dTo2d_short(ssRawFrame.sense_data,
  1750. rows*columns, columns),
  1751. rows,
  1752. columns);
  1753. if (stop_on_fail) {
  1754. ret = ERROR_PROD_TEST_DATA
  1755. | ERROR_TEST_CHECK_FAIL;
  1756. goto ERROR_LIMITS;
  1757. }
  1758. } else {
  1759. logError(0, "%s SS RAW (PROXIMITY) ", tag);
  1760. logError(0, "SENSE MIN MAX TEST:.............");
  1761. logError(0, "....OK\n");
  1762. }
  1763. kfree(thresholds);
  1764. thresholds = NULL;
  1765. } else {
  1766. logError(0, "%s SS RAW (PROXIMITY) SENSE MIN MAX", tag);
  1767. logError(0, " TEST:.................SKIPPED\n");
  1768. }
  1769. logError(0, "%s\n", tag);
  1770. logError(0, "%s SS RAW (PROXIMITY) SENSE GAP TEST:\n", tag);
  1771. if (todo->SelfSenseRawGap == 1) {
  1772. ret = parseProductionTestLimits(path_limits,
  1773. SS_RAW_SENSE_GAP,
  1774. &thresholds,
  1775. &trows,
  1776. &tcolumns);
  1777. if (ret < 0 || (trows != 1 || tcolumns != 1)) {
  1778. logError(1, "%s production_test_data: ", tag);
  1779. logError(1, "parseProductionTestLimits ");
  1780. logError(1, "SS_RAW_SENSE_GAP failed... ");
  1781. logError(1, "ERROR %02X\n",
  1782. ERROR_PROD_TEST_DATA);
  1783. ret |= ERROR_PROD_TEST_DATA;
  1784. goto ERROR_LIMITS;
  1785. }
  1786. ret = checkLimitsGap(ssRawFrame.sense_data,
  1787. rows,
  1788. columns,
  1789. thresholds[0]);
  1790. if (ret != OK) {
  1791. logError(1, "%s production_test_data: ", tag);
  1792. logError(1, "checkLimitsGap SS RAW ");
  1793. logError(1, "(PROXIMITY) SENSE GAP failed... ");
  1794. logError(1, "ERROR = %02X\n", ret);
  1795. logError(0, "%s SS RAW (PROXIMITY) ", tag);
  1796. logError(0, "SENSE GAP TEST:.................");
  1797. logError(0, "FAIL\n");
  1798. count_fail += 1;
  1799. print_frame_short("SS Raw sense frame =",
  1800. array1dTo2d_short(ssRawFrame.sense_data,
  1801. rows*columns, columns),
  1802. rows,
  1803. columns);
  1804. if (stop_on_fail) {
  1805. ret = ERROR_PROD_TEST_DATA
  1806. | ERROR_TEST_CHECK_FAIL;
  1807. goto ERROR_LIMITS;
  1808. }
  1809. } else {
  1810. logError(0, "%s SS RAW (PROXIMITY) SENSE", tag);
  1811. logError(0, " GAP TEST:.................OK\n");
  1812. }
  1813. kfree(thresholds);
  1814. thresholds = NULL;
  1815. } else {
  1816. logError(0, "%s SS RAW (PROXIMITY) SENSE GAP ", tag);
  1817. logError(0, "TEST:.................SKIPPED\n");
  1818. }
  1819. kfree(ssRawFrame.sense_data);
  1820. ssRawFrame.sense_data = NULL;
  1821. }
  1822. logError(0, "%s\n", tag);
  1823. if (count_fail == 0) {
  1824. logError(0, "%s SS RAW testes finished!.................OK\n\n",
  1825. tag);
  1826. return OK;
  1827. }
  1828. logError(0, "%s SS RAW testes finished!.................", tag);
  1829. logError(0, "FAILED fails_count = %d\n\n", count_fail);
  1830. return (ERROR_TEST_CHECK_FAIL | ERROR_PROD_TEST_DATA);
  1831. ERROR_LIMITS:
  1832. kfree(ssRawFrame.force_data);
  1833. kfree(ssRawFrame.sense_data);
  1834. kfree(thresholds);
  1835. return ret;
  1836. }
  1837. int production_test_ss_ix_cx(char *path_limits, int stop_on_fail,
  1838. struct TestToDo *todo)
  1839. {
  1840. int ret;
  1841. int count_fail = 0;
  1842. int *thresholds = NULL;
  1843. int trows, tcolumns;
  1844. int *thresholds_min = NULL;
  1845. int *thresholds_max = NULL;
  1846. struct SelfSenseData ssCompData;
  1847. u8 *adjhor = NULL;
  1848. u8 *adjvert = NULL;
  1849. u16 container;
  1850. int *ix1_w = NULL;
  1851. int *ix2_w = NULL;
  1852. u16 *total_ix = NULL;
  1853. u16 *total_cx = NULL;
  1854. u16 *total_adjhor = NULL;
  1855. u16 *total_adjvert = NULL;
  1856. logError(0, "%s\n", tag);
  1857. logError(0, "%s SS IX CX testes are starting...\n", tag);
  1858. //read the SS compensation data
  1859. ret = readSelfSenseCompensationData(SS_TOUCH, &ssCompData);
  1860. if (ret < 0) {
  1861. logError(1, "%s production_test_data: ", tag);
  1862. logError(1, "readSelfSenseCompensationData failed... ", tag);
  1863. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1864. return (ret | ERROR_PROD_TEST_DATA);
  1865. }
  1866. //********************** SS FORCE IX *********************************/
  1867. //SS IX1 FORCE TEST
  1868. logError(0, "%s SS IX1 FORCE TEST:\n", tag);
  1869. if (todo->SelfForceIx1 == 1) {
  1870. ret = parseProductionTestLimits(path_limits,
  1871. SS_IX1_FORCE_MIN_MAX,
  1872. &thresholds,
  1873. &trows,
  1874. &tcolumns);
  1875. if (ret < 0 || (trows != 1 || tcolumns != 2)) {
  1876. logError(1, "%s production_test_data: ", tag);
  1877. logError(1, "parseProductionTestLimits ");
  1878. logError(1, "SS_IX1_FORCE_MIN_MAX failed... ");
  1879. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1880. ret |= ERROR_PROD_TEST_DATA;
  1881. goto ERROR_LIMITS;
  1882. }
  1883. container = (u16) ssCompData.f_ix1;
  1884. //check the limits
  1885. ret = checkLimitsMinMax(&container,
  1886. 1,
  1887. 1,
  1888. thresholds[0],
  1889. thresholds[1]);
  1890. if (ret != OK) {
  1891. logError(1, "%s production_test_data: ", tag);
  1892. logError(1, "checkLimitsMinMax ");
  1893. logError(1, "SS IX1 FORCE TEST failed... ");
  1894. logError(1, "ERROR COUNT = %d\n", ret);
  1895. count_fail += 1;
  1896. if (stop_on_fail)
  1897. goto ERROR;
  1898. } else
  1899. logError(0, "%s SS IX1 FORCE TEST:......OK\n\n", tag);
  1900. }
  1901. kfree(thresholds);
  1902. thresholds = NULL;
  1903. //SS IX2 FORCE TEST
  1904. logError(0, "%s SS IX2 FORCE MIN MAX TEST:\n", tag);
  1905. if (todo->SelfForceIx2 == 1) {
  1906. //load the min thresholds
  1907. ret = parseProductionTestLimits(path_limits,
  1908. SS_IX2_FORCE_MAP_MIN,
  1909. &thresholds_min,
  1910. &trows,
  1911. &tcolumns);
  1912. if (ret < 0 || (trows != ssCompData.header.force_node
  1913. || tcolumns != 1)) {
  1914. logError(1, "%s production_test_data: ", tag);
  1915. logError(1, "parseProductionTestLimits ");
  1916. logError(1, "SS_IX2_FORCE_MAP_MIN ");
  1917. logError(1, "failed... ERROR %02X\n",
  1918. ERROR_PROD_TEST_DATA);
  1919. ret |= ERROR_PROD_TEST_DATA;
  1920. goto ERROR_LIMITS;
  1921. }
  1922. //load the max thresholds
  1923. ret = parseProductionTestLimits(path_limits,
  1924. SS_IX2_FORCE_MAP_MAX,
  1925. &thresholds_max,
  1926. &trows,
  1927. &tcolumns);
  1928. if (ret < 0 || (trows != ssCompData.header.force_node
  1929. || tcolumns != 1)) {
  1930. logError(1, "%s production_test_data: ", tag);
  1931. logError(1, "parseProductionTestLimits");
  1932. logError(1, "SS_IX2_FORCE_MAP_MAX failed... ");
  1933. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1934. ret |= ERROR_PROD_TEST_DATA;
  1935. goto ERROR_LIMITS;
  1936. }
  1937. //check the values with thresholds
  1938. ret = checkLimitsMap(ssCompData.ix2_fm,
  1939. ssCompData.header.force_node,
  1940. 1,
  1941. thresholds_min,
  1942. thresholds_max);
  1943. if (ret != OK) {
  1944. logError(1, "%s production_test_data: ", tag);
  1945. logError(1, "checkLimitsMap SS IX2 FORCE failed... ");
  1946. logError(1, "ERROR COUNT = %d\n", ret);
  1947. logError(0, "%s SS IX2 FORCE MIN MAX TEST:..........");
  1948. logError(0, "FAIL\n\n");
  1949. count_fail += 1;
  1950. if (stop_on_fail)
  1951. goto ERROR;
  1952. } else {
  1953. logError(0, "%s SS IX2 FORCE MIN MAX TEST:.....", tag);
  1954. logError(0, "OK\n\n");
  1955. }
  1956. kfree(thresholds_min);
  1957. thresholds_min = NULL;
  1958. kfree(thresholds_max);
  1959. thresholds_max = NULL;
  1960. } else {
  1961. logError(0, "%s SS IX2 FORCE MIN MAX TEST:...........", tag);
  1962. logError(0, "KIPPED\n\n");
  1963. }
  1964. logError(0, "%s SS IX2 FORCE ADJ TEST:\n", tag);
  1965. if (todo->SelfForceIx2Adj == 1) {
  1966. //SS IX2 FORCE ADJV TEST
  1967. logError(0, "%s SS IX2 FORCE ADJVERT TEST:\n", tag);
  1968. ret = computeAdjVert(ssCompData.ix2_fm,
  1969. ssCompData.header.force_node,
  1970. 1,
  1971. &adjvert);
  1972. if (ret < 0) {
  1973. logError(1, "%s production_test_data: ", tag);
  1974. logError(1, "computeAdjVert SS IX2 FORCE ADJV ");
  1975. logError(1, "failed... ERROR %02X\n",
  1976. ERROR_PROD_TEST_DATA);
  1977. ret |= ERROR_PROD_TEST_DATA;
  1978. goto ERROR_LIMITS;
  1979. }
  1980. logError(0, "%s SS IX2 FORCE ADJV computed!\n", tag);
  1981. //load the max thresholds
  1982. ret = parseProductionTestLimits(path_limits,
  1983. SS_IX2_FORCE_ADJV_MAP_MAX,
  1984. &thresholds_max,
  1985. &trows,
  1986. &tcolumns);
  1987. if (ret < 0 || (trows != ssCompData.header.force_node - 1
  1988. || tcolumns != 1)) {
  1989. logError(1, "%s production_test_data: ", tag);
  1990. logError(1, "parseProductionTestLimits ");
  1991. logError(1, "SS_IX2_FORCE_ADJV_MAP_MAX failed... ");
  1992. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  1993. ret |= ERROR_PROD_TEST_DATA;
  1994. goto ERROR_LIMITS;
  1995. }
  1996. //check the values with thresholds
  1997. ret = checkLimitsMapAdj(adjvert,
  1998. ssCompData.header.force_node - 1,
  1999. 1,
  2000. thresholds_max);
  2001. if (ret != OK) {
  2002. logError(1, "%s production_test_data: ", tag);
  2003. logError(1, "checkLimitsMap SS IX2 FORCE failed... ");
  2004. logError(0, "FAIL\n\n");
  2005. count_fail += 1;
  2006. if (stop_on_fail)
  2007. goto ERROR;
  2008. } else {
  2009. logError(0, "%s SS IX2 FORCE ADJV TEST:", tag);
  2010. logError(0, ".................OK\n\n");
  2011. }
  2012. kfree(thresholds_max);
  2013. thresholds_max = NULL;
  2014. kfree(adjvert);
  2015. adjvert = NULL;
  2016. } else {
  2017. logError(0, "%s SS IX2 FORCE ADJ TEST:", tag);
  2018. logError(0, ".................SKIPPED\n\n");
  2019. }
  2020. //SS TOTAL FORCE IX
  2021. logError(0, "%s SS TOTAL IX FORCE TEST:\n", tag);
  2022. if (todo->SelfForceIxTotal == 1 || todo->SelfForceIxTotalAdj == 1) {
  2023. logError(0, "%s Reading TOTAL IX FORCE Weights...\n", tag);
  2024. //load the IX1 weight
  2025. ret = parseProductionTestLimits(path_limits,
  2026. SS_IX1_FORCE_W,
  2027. &ix1_w,
  2028. &trows,
  2029. &tcolumns);
  2030. if (ret < 0 || (trows != 1 || tcolumns != 1)) {
  2031. logError(1, "%s production_test_data: ", tag);
  2032. logError(1, "parseProductionTestLimits ");
  2033. logError(1, "SS_IX1_FORCE_W failed... ERROR %02X\n",
  2034. tag, ERROR_PROD_TEST_DATA);
  2035. return (ret | ERROR_PROD_TEST_DATA);
  2036. }
  2037. //load the IX2 weight
  2038. ret = parseProductionTestLimits(path_limits,
  2039. SS_IX2_FORCE_W,
  2040. &ix2_w,
  2041. &trows,
  2042. &tcolumns);
  2043. if (ret < 0 || (trows != 1 || tcolumns != 1)) {
  2044. logError(1, "%s production_test_data: ", tag);
  2045. logError(1, "parseProductionTestLimits ");
  2046. logError(1, "SS_IX1_FORCE_W failed... ERROR %02X\n",
  2047. tag, ERROR_PROD_TEST_DATA);
  2048. return (ret | ERROR_PROD_TEST_DATA);
  2049. }
  2050. logError(0, "%s Weights: IX1_W = %d IX2_W = %d\n",
  2051. tag, *ix1_w, *ix2_w);
  2052. ret = computeTotal(ssCompData.ix2_fm, ssCompData.f_ix1,
  2053. ssCompData.header.force_node,
  2054. 1,
  2055. *ix1_w,
  2056. *ix2_w,
  2057. &total_ix);
  2058. if (ret < 0) {
  2059. logError(1, "%s production_test_data: ", tag);
  2060. logError(1, "computeTotal Ix Force failed... ");
  2061. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  2062. ret |= ERROR_PROD_TEST_DATA;
  2063. goto ERROR_LIMITS;
  2064. }
  2065. kfree(ix1_w);
  2066. ix1_w = NULL;
  2067. kfree(ix2_w);
  2068. ix2_w = NULL;
  2069. logError(0, "%s SS TOTAL IX FORCE MIN MAX TEST:\n", tag);
  2070. if (todo->SelfForceIxTotal == 1) {
  2071. //load the min thresholds
  2072. ret = parseProductionTestLimits(path_limits,
  2073. SS_TOTAL_IX_FORCE_MAP_MIN,
  2074. &thresholds_min,
  2075. &trows,
  2076. &tcolumns);
  2077. if (ret < 0 || (trows != ssCompData.header.force_node
  2078. || tcolumns != 1)) {
  2079. logError(1, "%s production_test_data: ", tag);
  2080. logError(1, "parseProductionTestLimits ");
  2081. logError(1, "SS_TOTAL_IX_FORCE_MAP_MIN ");
  2082. logError(1, "failed... ERROR %02X\n",
  2083. ERROR_PROD_TEST_DATA);
  2084. ret |= ERROR_PROD_TEST_DATA;
  2085. goto ERROR_LIMITS;
  2086. }
  2087. //load the max thresholds
  2088. ret = parseProductionTestLimits(path_limits,
  2089. SS_TOTAL_IX_FORCE_MAP_MAX,
  2090. &thresholds_max,
  2091. &trows,
  2092. &tcolumns);
  2093. if (ret < 0 || (trows != ssCompData.header.force_node
  2094. || tcolumns != 1)) {
  2095. logError(1, "%s production_test_data: ", tag);
  2096. logError(1, "parseProductionTestLimits ");
  2097. logError(1, "SS_TOTAL_IX_FORCE_MAP_MAX ");
  2098. logError(1, "failed... ERROR %02X\n",
  2099. ERROR_PROD_TEST_DATA);
  2100. ret |= ERROR_PROD_TEST_DATA;
  2101. goto ERROR_LIMITS;
  2102. }
  2103. //check the values with thresholds
  2104. ret = checkLimitsMapTotal(total_ix,
  2105. ssCompData.header.force_node,
  2106. 1,
  2107. thresholds_min,
  2108. thresholds_max);
  2109. if (ret != OK) {
  2110. logError(1, "%s production_test_data: ", tag);
  2111. logError(1, "checkLimitsMap SS TOTAL IX FORCE");
  2112. logError(1, "failed... ERROR COUNT = %d\n",
  2113. ret);
  2114. logError(0, "%s SS TOTAL IX FORCE MIN MAX ",
  2115. tag);
  2116. logError(0, "TEST:.................FAIL\n\n");
  2117. count_fail += 1;
  2118. if (stop_on_fail)
  2119. goto ERROR;
  2120. } else {
  2121. logError(0, "%s SS TOTAL IX FORCE MIN MAX ",
  2122. tag);
  2123. logError(0, "TEST:.................OK\n\n");
  2124. }
  2125. kfree(thresholds_min);
  2126. thresholds_min = NULL;
  2127. kfree(thresholds_max);
  2128. thresholds_max = NULL;
  2129. } else {
  2130. logError(0, "%s SS TOTAL IX FORCE MIN MAX TEST:", tag);
  2131. logError(0, ".................SKIPPED\n");
  2132. }
  2133. logError(0, "%s SS TOTAL IX FORCE ADJ TEST:\n", tag);
  2134. if (todo->SelfForceIxTotalAdj == 1) {
  2135. //SS TOTAL IX FORCE ADJV TEST
  2136. logError(0, "%s SS TOTAL IX FORCE ADJVERT TEST:\n",
  2137. tag);
  2138. ret = computeAdjVertTotal(total_ix,
  2139. ssCompData.header.force_node,
  2140. 1,
  2141. &total_adjvert);
  2142. if (ret < 0) {
  2143. logError(1, "%s production_test_data: ", tag);
  2144. logError(1, "computeAdjVert SS TOTAL IX ");
  2145. logError(1, "FORCE ADJV failed... ");
  2146. logError(1, "ERROR %02X\n",
  2147. ERROR_PROD_TEST_DATA);
  2148. ret |= ERROR_PROD_TEST_DATA;
  2149. goto ERROR_LIMITS;
  2150. }
  2151. logError(0, "%s SS TOTAL IX FORCE ADJV computed!\n",
  2152. tag);
  2153. //load the max thresholds
  2154. ret = parseProductionTestLimits(path_limits,
  2155. SS_TOTAL_IX_FORCE_ADJV_MAP_MAX,
  2156. &thresholds_max,
  2157. &trows,
  2158. &tcolumns);
  2159. if (ret < 0
  2160. || (trows != ssCompData.header.force_node - 1
  2161. || tcolumns != 1)) {
  2162. logError(1, "%s production_test_data: ", tag);
  2163. logError(1, "parseProductionTestLimits ");
  2164. logError(1, "SS_TOTAL_IX_FORCE_ADJV_MAP_MAX");
  2165. logError(1, "... ERROR %02X\n",
  2166. ERROR_PROD_TEST_DATA);
  2167. ret |= ERROR_PROD_TEST_DATA;
  2168. goto ERROR_LIMITS;
  2169. }
  2170. //check the values with thresholds
  2171. ret = checkLimitsMapAdjTotal(total_adjvert,
  2172. ssCompData.header.force_node - 1,
  2173. 1,
  2174. thresholds_max);
  2175. if (ret != OK) {
  2176. logError(1, "%s production_test_data: ", tag);
  2177. logError(1, "checkLimitsMap SS TOTAL IX ");
  2178. logError(1, "FORCE failed... ");
  2179. logError(1, "ERROR COUNT = %d\n", ret);
  2180. logError(0, "%s SS TOTAL IX FORCE ADJV TEST:",
  2181. tag);
  2182. logError(0, ".................FAIL\n\n");
  2183. count_fail += 1;
  2184. if (stop_on_fail)
  2185. goto ERROR;
  2186. } else {
  2187. logError(0, "%s SS TOTAL IX FORCE ADJV TEST:",
  2188. tag);
  2189. logError(0, ".................OK\n\n");
  2190. }
  2191. kfree(thresholds_max);
  2192. thresholds_max = NULL;
  2193. kfree(total_adjvert);
  2194. total_adjvert = NULL;
  2195. } else {
  2196. logError(0, "%s SS TOTAL IX FORCE ADJ TEST:");
  2197. logError(0, ".................SKIPPED\n");
  2198. }
  2199. kfree(total_ix);
  2200. total_ix = NULL;
  2201. } else {
  2202. logError(0, "%s SS TOTAL IX FORCE TEST:", tag);
  2203. logError(0, ".................SKIPPED\n\n");
  2204. }
  2205. //************** SS SENSE IX *******************/
  2206. //SS IX1 SENSE TEST
  2207. logError(0, "%s SS IX1 SENSE TEST:\n", tag);
  2208. if (todo->SelfSenseIx1 == 1) {
  2209. ret = parseProductionTestLimits(path_limits,
  2210. SS_IX1_SENSE_MIN_MAX,
  2211. &thresholds,
  2212. &trows,
  2213. &tcolumns);
  2214. if (ret < 0 || (trows != 1 || tcolumns != 2)) {
  2215. logError(1, "%s production_test_data: ", tag);
  2216. logError(1, "parseProductionTestLimits ");
  2217. logError(1, "SS_IX1_SENSE_MIN_MAX failed... ");
  2218. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  2219. ret |= ERROR_PROD_TEST_DATA;
  2220. goto ERROR_LIMITS;
  2221. }
  2222. container = (u16) ssCompData.s_ix1;
  2223. ret = checkLimitsMinMax(&container,
  2224. 1,
  2225. 1,
  2226. thresholds[0],
  2227. thresholds[1]); //check the limits
  2228. if (ret != OK) {
  2229. logError(1, "%s production_test_data: ", tag);
  2230. logError(1, "checkLimitsMinMax SS IX1 SENSE TEST ");
  2231. logError(1, "failed... ERROR COUNT = %d\n", ret);
  2232. count_fail += 1;
  2233. if (stop_on_fail)
  2234. goto ERROR;
  2235. } else {
  2236. logError(0, "%s SS IX1 SENSE TEST:..............", tag);
  2237. logError(0, "...OK\n\n");
  2238. }
  2239. } else {
  2240. logError(0, "%s SS IX1 SENSE TEST:.................", tag);
  2241. logError(0, "SKIPPED\n\n");
  2242. }
  2243. kfree(thresholds);
  2244. thresholds = NULL;
  2245. //SS IX2 SENSE TEST
  2246. logError(0, "%s SS IX2 SENSE MIN MAX TEST:\n", tag);
  2247. if (todo->SelfSenseIx2 == 1) {
  2248. ret = parseProductionTestLimits(path_limits,
  2249. SS_IX2_SENSE_MAP_MIN,
  2250. &thresholds_min,
  2251. &trows,
  2252. &tcolumns); //load the min thresholds
  2253. if (ret < 0 || (trows != 1
  2254. || tcolumns != ssCompData.header.sense_node)) {
  2255. logError(1, "%s production_test_data: ", tag);
  2256. logError(1, "parseProductionTestLimits ");
  2257. logError(1, "S_IX2_SENSE_MAP_MIN failed... ");
  2258. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  2259. ret |= ERROR_PROD_TEST_DATA;
  2260. goto ERROR_LIMITS;
  2261. }
  2262. ret = parseProductionTestLimits(path_limits,
  2263. SS_IX2_SENSE_MAP_MAX,
  2264. &thresholds_max,
  2265. &trows,
  2266. &tcolumns); //load the max thresholds
  2267. if (ret < 0 || (trows != 1
  2268. || tcolumns != ssCompData.header.sense_node)) {
  2269. logError(1, "%s production_test_data: ", tag);
  2270. logError(1, "parseProductionTestLimits ");
  2271. logError(1, "SS_IX2_SENSE_MAP_MAX failed... ");
  2272. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  2273. ret |= ERROR_PROD_TEST_DATA;
  2274. goto ERROR_LIMITS;
  2275. }
  2276. //check the values with thresholds
  2277. ret = checkLimitsMap(ssCompData.ix2_sn,
  2278. 1,
  2279. ssCompData.header.sense_node,
  2280. thresholds_min,
  2281. thresholds_max);
  2282. if (ret != OK) {
  2283. logError(1, "%s production_test_data: ", tag);
  2284. logError(1, "checkLimitsMap SS IX2 SENSE failed... ");
  2285. logError(1, "ERROR COUNT = %d\n", ret);
  2286. logError(0, "%s SS IX2 SENSE MIN MAX TEST:.....", tag);
  2287. logError(0, "............FAIL\n\n");
  2288. count_fail += 1;
  2289. if (stop_on_fail)
  2290. goto ERROR;
  2291. } else {
  2292. logError(0, "%s SS IX2 SENSE MIN MAX TEST:", tag);
  2293. logError(0, ".................OK\n\n");
  2294. }
  2295. kfree(thresholds_min);
  2296. thresholds_min = NULL;
  2297. kfree(thresholds_max);
  2298. thresholds_max = NULL;
  2299. } else {
  2300. logError(0, "%s SS IX2 SENSE MIN MAX TEST:..............", tag);
  2301. logError(0, "...SKIPPED\n\n");
  2302. }
  2303. logError(0, "%s SS IX2 SENSE ADJ TEST:\n", tag);
  2304. if (todo->SelfSenseIx2Adj == 1) {
  2305. //SS IX2 SENSE ADJH TEST
  2306. logError(0, "%s SS IX2 SENSE ADJHORIZ TEST:\n", tag);
  2307. ret = computeAdjHoriz(ssCompData.ix2_sn,
  2308. 1,
  2309. ssCompData.header.sense_node,
  2310. &adjhor);
  2311. if (ret < 0) {
  2312. logError(1, "%s production_test_data: ", tag);
  2313. logError(1, "computeAdjHoriz SS IX2 SENSE ADJH ");
  2314. logError(1, "failed... ERROR %02X\n",
  2315. ERROR_PROD_TEST_DATA);
  2316. ret |= ERROR_PROD_TEST_DATA;
  2317. goto ERROR_LIMITS;
  2318. }
  2319. logError(0, "%s SS IX2 SENSE ADJ HORIZ computed!\n", tag);
  2320. ret = parseProductionTestLimits(path_limits,
  2321. SS_IX2_SENSE_ADJH_MAP_MAX,
  2322. &thresholds_max,
  2323. &trows,
  2324. &tcolumns); //load the max thresholds
  2325. if (ret < 0 || (trows != 1
  2326. || tcolumns != ssCompData.header.sense_node - 1)) {
  2327. logError(1, "%s production_test_data: ", tag);
  2328. logError(1, "parseProductionTestLimits ");
  2329. logError(1, "SS_IX2_SENSE_ADJH_MAP_MAX ");
  2330. logError(1, "failed... ERROR %02X\n",
  2331. ERROR_PROD_TEST_DATA);
  2332. ret |= ERROR_PROD_TEST_DATA;
  2333. goto ERROR_LIMITS;
  2334. }
  2335. //check the values with thresholds
  2336. ret = checkLimitsMapAdj(adjhor,
  2337. 1,
  2338. ssCompData.header.sense_node - 1,
  2339. thresholds_max);
  2340. if (ret != OK) {
  2341. logError(1, "%s production_test_data: ", tag);
  2342. logError(1, "checkLimitsMapAdj SS IX2 SENSE ADJH ");
  2343. logError(1, "failed... ERROR COUNT = %d\n", ret);
  2344. logError(0, "%s SS IX2 SENSE ADJH TEST:.......", tag);
  2345. logError(0, "..........FAIL\n\n");
  2346. count_fail += 1;
  2347. if (stop_on_fail)
  2348. goto ERROR;
  2349. } else {
  2350. logError(0, "%s SS IX2 SENSE ADJH TEST:........", tag);
  2351. logError(0, ".........OK\n\n");
  2352. }
  2353. kfree(thresholds_max);
  2354. thresholds_max = NULL;
  2355. kfree(adjhor);
  2356. adjhor = NULL;
  2357. } else {
  2358. logError(0, "%s SS IX2 SENSE ADJ TEST:.................", tag);
  2359. logError(0, "SKIPPED\n", tag);
  2360. }
  2361. //SS TOTAL IX SENSE
  2362. logError(0, "%s SS TOTAL IX SENSE TEST:\n", tag);
  2363. if (todo->SelfSenseIxTotal == 1 || todo->SelfSenseIxTotalAdj == 1) {
  2364. logError(0, "%s Reading TOTAL IX SENSE Weights...\n", tag);
  2365. //load the IX1 weight
  2366. ret = parseProductionTestLimits(path_limits,
  2367. SS_IX1_SENSE_W,
  2368. &ix1_w,
  2369. &trows,
  2370. &tcolumns);
  2371. if (ret < 0 || (trows != 1 || tcolumns != 1)) {
  2372. logError(1, "%s production_test_data: ", tag);
  2373. logError(1, "parseProductionTestLimits ");
  2374. logError(1, "SS_IX1_SENSE_W failed... ERROR %02X\n",
  2375. ERROR_PROD_TEST_DATA);
  2376. ret |= ERROR_PROD_TEST_DATA;
  2377. goto ERROR_LIMITS;
  2378. }
  2379. //load the IX2 weight
  2380. ret = parseProductionTestLimits(path_limits,
  2381. SS_IX2_SENSE_W,
  2382. &ix2_w,
  2383. &trows,
  2384. &tcolumns);
  2385. if (ret < 0 || (trows != 1 || tcolumns != 1)) {
  2386. logError(1, "%s production_test_data: ", tag);
  2387. logError(1, "parseProductionTestLimits ");
  2388. logError(1, "SS_IX1_SENSE_W failed... ERROR %02X\n",
  2389. ERROR_PROD_TEST_DATA);
  2390. ret |= ERROR_PROD_TEST_DATA;
  2391. goto ERROR_LIMITS;
  2392. }
  2393. logError(0, "%s Weights: IX1_W = %d IX2_W = %d\n",
  2394. tag, *ix1_w, *ix2_w);
  2395. ret = computeTotal(ssCompData.ix2_sn,
  2396. ssCompData.s_ix1,
  2397. 1,
  2398. ssCompData.header.sense_node,
  2399. *ix1_w,
  2400. *ix2_w,
  2401. &total_ix);
  2402. if (ret < 0) {
  2403. logError(1, "%s production_test_data: ", tag);
  2404. logError(1, "computeTotal Ix Sense ");
  2405. logError(1, "failed... ERROR %02X\n",
  2406. ERROR_PROD_TEST_DATA);
  2407. ret |= ERROR_PROD_TEST_DATA;
  2408. goto ERROR_LIMITS;
  2409. }
  2410. kfree(ix1_w);
  2411. ix1_w = NULL;
  2412. kfree(ix2_w);
  2413. ix2_w = NULL;
  2414. logError(0, "%s SS TOTAL IX SENSE MIN MAX TEST:\n", tag);
  2415. //load the min thresholds
  2416. if (todo->SelfSenseIxTotal == 1) {
  2417. ret = parseProductionTestLimits(path_limits,
  2418. SS_TOTAL_IX_SENSE_MAP_MIN,
  2419. &thresholds_min,
  2420. &trows,
  2421. &tcolumns);
  2422. if (ret < 0 || (trows != 1
  2423. || tcolumns != ssCompData.header.sense_node)) {
  2424. logError(1, "%s production_test_data: ", tag);
  2425. logError(1, "parseProductionTestLimits ");
  2426. logError(1, "SS_TOTAL_IX_SENSE_MAP_MIN ");
  2427. logError(1, "failed... ERROR %02X\n",
  2428. ERROR_PROD_TEST_DATA);
  2429. ret |= ERROR_PROD_TEST_DATA;
  2430. goto ERROR_LIMITS;
  2431. }
  2432. //load the max thresholds
  2433. ret = parseProductionTestLimits(path_limits,
  2434. SS_TOTAL_IX_SENSE_MAP_MAX,
  2435. &thresholds_max,
  2436. &trows,
  2437. &tcolumns);
  2438. if (ret < 0 || (trows != 1 ||
  2439. tcolumns != ssCompData.header.sense_node)) {
  2440. logError(1, "%s production_test_data: ", tag);
  2441. logError(1, "parseProductionTestLimits ");
  2442. logError(1, "SS_TOTAL_IX_SENSE_MAP_MAX ");
  2443. logError(1, "failed... ERROR %02X\n",
  2444. ERROR_PROD_TEST_DATA);
  2445. ret |= ERROR_PROD_TEST_DATA;
  2446. goto ERROR_LIMITS;
  2447. }
  2448. //check the values with thresholds
  2449. ret = checkLimitsMapTotal(total_ix,
  2450. 1,
  2451. ssCompData.header.sense_node,
  2452. thresholds_min,
  2453. thresholds_max);
  2454. if (ret != OK) {
  2455. logError(1, "%s production_test_data: ", tag);
  2456. logError(1, "checkLimitsMap SS TOTAL IX SENSE");
  2457. logError(1, " failed... ERROR COUNT = %d\n",
  2458. ret);
  2459. logError(0, "%s SS TOTAL IX SENSE MIN MAX ",
  2460. tag);
  2461. logError(0, "TEST:.................FAIL\n\n");
  2462. count_fail += 1;
  2463. if (stop_on_fail)
  2464. goto ERROR;
  2465. } else {
  2466. logError(0, "%s SS TOTAL IX SENSE MIN MAX ",
  2467. tag);
  2468. logError(0, "TEST:.................OK\n\n");
  2469. }
  2470. kfree(thresholds_min);
  2471. thresholds_min = NULL;
  2472. kfree(thresholds_max);
  2473. thresholds_max = NULL;
  2474. } else {
  2475. logError(0, "%s SS TOTAL IX SENSE MIN MAX ", tag);
  2476. logError(0, "TEST:.................SKIPPED\n");
  2477. }
  2478. logError(0, "%s SS TOTAL IX SENSE ADJ TEST:\n", tag);
  2479. if (todo->SelfSenseIxTotalAdj == 1) {
  2480. //SS TOTAL IX SENSE ADJH TEST
  2481. logError(0, "%s SS TOTAL IX SENSE ADJHORIZ TEST:\n",
  2482. tag);
  2483. ret = computeAdjHorizTotal(total_ix,
  2484. 1,
  2485. ssCompData.header.sense_node,
  2486. &total_adjhor);
  2487. if (ret < 0) {
  2488. logError(1, "%s production_test_data: ", tag);
  2489. logError(1, "computeAdjHoriz SS TOTAL ");
  2490. logError(1, "IXSENSE ADJH failed... ");
  2491. logError(1, "ERROR %02X\n",
  2492. ERROR_PROD_TEST_DATA);
  2493. ret |= ERROR_PROD_TEST_DATA;
  2494. goto ERROR_LIMITS;
  2495. }
  2496. logError(0, "%s SS TOTAL IX SENSE ADJ HORIZ ", tag);
  2497. logError(0, "computed!\n");
  2498. //load the max thresholds
  2499. ret = parseProductionTestLimits(path_limits,
  2500. SS_TOTAL_IX_SENSE_ADJH_MAP_MAX,
  2501. &thresholds_max,
  2502. &trows,
  2503. &tcolumns);
  2504. if (ret < 0 || (trows != 1
  2505. || tcolumns != ssCompData.header.sense_node - 1)) {
  2506. logError(1, "%s production_test_data: ", tag);
  2507. logError(1, "parseProductionTestLimits ");
  2508. logError(1, "SS_TOTAL_IX_SENSE_ADJH_MAP_MAX ");
  2509. logError(1, "failed... ERROR %02X\n",
  2510. ERROR_PROD_TEST_DATA);
  2511. ret |= ERROR_PROD_TEST_DATA;
  2512. goto ERROR_LIMITS;
  2513. }
  2514. //check the values with thresholds
  2515. ret = checkLimitsMapAdjTotal(total_adjhor,
  2516. 1,
  2517. ssCompData.header.sense_node - 1,
  2518. thresholds_max);
  2519. if (ret != OK) {
  2520. logError(1, "%s production_test_data: ", tag);
  2521. logError(1, "checkLimitsMapAdj SS TOTAL ");
  2522. logError(1, "IX SENSE ADJH failed... ");
  2523. logError(1, "ERROR COUNT = %d\n", ret);
  2524. logError(0, "%s SS TOTAL IX SENSE ADJH ", tag);
  2525. logError(0, "TEST:.................FAIL\n\n");
  2526. count_fail += 1;
  2527. if (stop_on_fail)
  2528. goto ERROR;
  2529. } else {
  2530. logError(0, "%s SS TOTAL IX SENSE ADJH ", tag);
  2531. logError(0, "TEST:.................OK\n\n");
  2532. }
  2533. kfree(thresholds_max);
  2534. thresholds_max = NULL;
  2535. kfree(total_adjhor);
  2536. total_adjhor = NULL;
  2537. } else {
  2538. logError(0, "%s SS TOTAL IX SENSE ADJ TEST:.....", tag);
  2539. logError(0, "............SKIPPED\n");
  2540. }
  2541. kfree(total_ix);
  2542. total_ix = NULL;
  2543. } else {
  2544. logError(0, "%s SS TOTAL IX SENSE TEST:............", tag);
  2545. logError(0, ".....SKIPPED\n");
  2546. }
  2547. //************************ SS SENSE CX *******************************/
  2548. //SS CX1 FORCE TEST
  2549. logError(0, "%s SS CX1 FORCE TEST:\n", tag);
  2550. if (todo->SelfForceCx1 == 1) {
  2551. ret = parseProductionTestLimits(path_limits,
  2552. SS_CX1_FORCE_MIN_MAX,
  2553. &thresholds,
  2554. &trows,
  2555. &tcolumns);
  2556. if (ret < 0 || (trows != 1 || tcolumns != 2)) {
  2557. logError(1, "%s production_test_data: ", tag);
  2558. logError(1, "parseProductionTestLimits ");
  2559. logError(1, "SS_CX1_FORCE_MIN_MAX ");
  2560. logError(1, "failed... ERROR %02X\n",
  2561. ERROR_PROD_TEST_DATA);
  2562. ret |= ERROR_PROD_TEST_DATA;
  2563. goto ERROR_LIMITS;
  2564. }
  2565. //check the limits
  2566. container = (u16) ssCompData.f_cx1;
  2567. ret = checkLimitsMinMax(&container,
  2568. 1,
  2569. 1,
  2570. thresholds[0],
  2571. thresholds[1]);
  2572. if (ret != OK) {
  2573. logError(1, "%s production_test_data: ", tag);
  2574. logError(1, "checkLimitsMinMax SS CX1 FORCE TEST ");
  2575. logError(1, "failed... ERROR COUNT = %d\n", ret);
  2576. count_fail += 1;
  2577. if (stop_on_fail)
  2578. goto ERROR;
  2579. } else {
  2580. logError(0, "%s SS CX1 FORCE TEST:.............", tag);
  2581. logError(0, "....OK\n\n");
  2582. }
  2583. kfree(thresholds);
  2584. thresholds = NULL;
  2585. } else {
  2586. logError(0, "%s SS CX1 FORCE TEST:.................", tag);
  2587. logError(0, "SKIPPED\n\n");
  2588. }
  2589. //SS CX2 FORCE TEST
  2590. logError(0, "%s SS CX2 FORCE MIN MAX TEST:\n", tag);
  2591. if (todo->SelfForceCx2 == 1) {
  2592. //load the min thresholds
  2593. ret = parseProductionTestLimits(path_limits,
  2594. SS_CX2_FORCE_MAP_MIN,
  2595. &thresholds_min,
  2596. &trows,
  2597. &tcolumns);
  2598. if (ret < 0 || (trows != ssCompData.header.force_node
  2599. || tcolumns != 1)) {
  2600. logError(1, "%s production_test_data: ", tag);
  2601. logError(1, "SS_CX2_FORCE_MAP_MIN ");
  2602. logError(1, "failed... ERROR %02X\n",
  2603. ERROR_PROD_TEST_DATA);
  2604. ret |= ERROR_PROD_TEST_DATA;
  2605. goto ERROR_LIMITS;
  2606. }
  2607. //load the max thresholds
  2608. ret = parseProductionTestLimits(path_limits,
  2609. SS_CX2_FORCE_MAP_MAX,
  2610. &thresholds_max,
  2611. &trows,
  2612. &tcolumns);
  2613. if (ret < 0 || (trows != ssCompData.header.force_node
  2614. || tcolumns != 1)) {
  2615. logError(1, "%s production_test_data: ", tag);
  2616. logError(1, "parseProductionTestLimits ");
  2617. logError(1, "SS_CX2_FORCE_MAP_MAX ");
  2618. logError(1, "failed... ERROR %02X\n",
  2619. ERROR_PROD_TEST_DATA);
  2620. ret |= ERROR_PROD_TEST_DATA;
  2621. goto ERROR_LIMITS;
  2622. }
  2623. //check the values with thresholds
  2624. ret = checkLimitsMap(ssCompData.cx2_fm,
  2625. ssCompData.header.force_node,
  2626. 1,
  2627. thresholds_min,
  2628. thresholds_max);
  2629. if (ret != OK) {
  2630. logError(1, "%s production_test_data: ", tag);
  2631. logError(1, "%checkLimitsMap SS CX2 FORCE ");
  2632. logError(1, "%failed... ERROR COUNT = %d\n", ret);
  2633. logError(0, "%s SS CX2 FORCE MIN MAX TEST:.....", tag);
  2634. logError(0, "............FAIL\n\n");
  2635. count_fail += 1;
  2636. if (stop_on_fail)
  2637. goto ERROR;
  2638. } else {
  2639. logError(0, "%s SS CX2 FORCE MIN MAX TEST:......", tag);
  2640. logError(0, "...........OK\n\n");
  2641. }
  2642. kfree(thresholds_min);
  2643. thresholds_min = NULL;
  2644. kfree(thresholds_max);
  2645. thresholds_max = NULL;
  2646. } else {
  2647. logError(0, "%s SS CX2 FORCE MIN MAX TEST:..............", tag);
  2648. logError(0, "...SKIPPED\n");
  2649. }
  2650. logError(0, "%s SS CX2 FORCE ADJ TEST:\n", tag);
  2651. if (todo->SelfForceCx2Adj == 1) {
  2652. //SS CX2 FORCE ADJV TEST
  2653. logError(0, "%s SS CX2 FORCE ADJVERT TEST:\n", tag);
  2654. //comepute the ADJV for CX2 FORCE
  2655. ret = computeAdjVert(ssCompData.cx2_fm,
  2656. ssCompData.header.force_node,
  2657. 1,
  2658. &adjvert);
  2659. if (ret < 0) {
  2660. logError(1, "%s production_test_data: ", tag);
  2661. logError(1, "computeAdjVert SS CX2 FORCE ADJV ");
  2662. logError(1, "failed... ERROR %02X\n",
  2663. ERROR_PROD_TEST_DATA);
  2664. ret |= ERROR_PROD_TEST_DATA;
  2665. goto ERROR_LIMITS;
  2666. }
  2667. logError(0, "%s SS CX2 FORCE ADJV computed!\n", tag);
  2668. //load the max thresholds
  2669. ret = parseProductionTestLimits(path_limits,
  2670. SS_CX2_FORCE_ADJV_MAP_MAX,
  2671. &thresholds_max,
  2672. &trows,
  2673. &tcolumns);
  2674. if (ret < 0 || (trows != ssCompData.header.force_node - 1
  2675. || tcolumns != 1)) {
  2676. logError(1, "%s production_test_data: ", tag);
  2677. logError(1, "parseProductionTestLimits ");
  2678. logError(1, "SS_CX2_FORCE_ADJV_MAP_MAX ");
  2679. logError(1, "failed... ERROR %02X\n",
  2680. ERROR_PROD_TEST_DATA);
  2681. ret |= ERROR_PROD_TEST_DATA;
  2682. goto ERROR_LIMITS;
  2683. }
  2684. //check the values with thresholds
  2685. ret = checkLimitsMapAdj(adjvert,
  2686. ssCompData.header.force_node - 1,
  2687. 1,
  2688. thresholds_max);
  2689. if (ret != OK) {
  2690. logError(1, "%s production_test_data: ", tag);
  2691. logError(1, "checkLimitsMap SS IX2 FORCE ");
  2692. logError(1, "failed... ERROR COUNT = %d\n", ret);
  2693. logError(0, "%s SS CX2 FORCE ADJV TEST:......", tag);
  2694. logError(0, "...........FAIL\n\n");
  2695. count_fail += 1;
  2696. if (stop_on_fail)
  2697. goto ERROR;
  2698. } else {
  2699. logError(0, "%s SS CX2 FORCE ADJV TEST:.....", tag);
  2700. logError(0, "............OK\n\n");
  2701. }
  2702. kfree(thresholds_max);
  2703. thresholds_max = NULL;
  2704. kfree(adjvert);
  2705. adjvert = NULL;
  2706. } else {
  2707. logError(0, "%s SS CX2 FORCE ADJ TEST:.................", tag);
  2708. logError(0, "SKIPPED\n\n");
  2709. }
  2710. //SS TOTAL CX FORCE
  2711. logError(0, "%s SS TOTAL CX FORCE TEST:\n", tag);
  2712. if (todo->SelfForceCxTotal == 1 || todo->SelfForceCxTotalAdj == 1) {
  2713. ret = computeTotal(ssCompData.cx2_fm,
  2714. ssCompData.f_cx1,
  2715. ssCompData.header.force_node,
  2716. 1,
  2717. CX1_WEIGHT,
  2718. CX2_WEIGHT,
  2719. &total_cx);
  2720. if (ret < 0) {
  2721. logError(1, "%s production_test_data: ", tag);
  2722. logError(1, "computeTotal Cx Force failed... ");
  2723. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  2724. return (ret | ERROR_PROD_TEST_DATA);
  2725. }
  2726. logError(0, "%s SS TOTAL CX FORCE MIN MAX TEST:\n", tag);
  2727. //load the min thresholds
  2728. if (todo->SelfForceCxTotal == 1) {
  2729. ret = parseProductionTestLimits(path_limits,
  2730. SS_TOTAL_CX_FORCE_MAP_MIN,
  2731. &thresholds_min,
  2732. &trows,
  2733. &tcolumns);
  2734. if (ret < 0 || (trows != ssCompData.header.force_node
  2735. || tcolumns != 1)) {
  2736. logError(1, "%s production_test_data: ", tag);
  2737. logError(1, "parseProductionTestLimits ");
  2738. logError(1, "SS_TOTAL_CX_FORCE_MAP_MIN ");
  2739. logError(1, "failed... ERROR %02X\n",
  2740. ERROR_PROD_TEST_DATA);
  2741. ret |= ERROR_PROD_TEST_DATA;
  2742. goto ERROR_LIMITS;
  2743. }
  2744. //load the max thresholds
  2745. ret = parseProductionTestLimits(path_limits,
  2746. SS_TOTAL_CX_FORCE_MAP_MAX,
  2747. &thresholds_max,
  2748. &trows,
  2749. &tcolumns);
  2750. if (ret < 0 || (trows != ssCompData.header.force_node
  2751. || tcolumns != 1)) {
  2752. logError(1, "%s production_test_data: ", tag);
  2753. logError(1, "parseProductionTestLimits ");
  2754. logError(1, "SS_TOTAL_CX_FORCE_MAP_MAX ");
  2755. logError(1, "failed... ERROR %02X\n",
  2756. ERROR_PROD_TEST_DATA);
  2757. ret |= ERROR_PROD_TEST_DATA;
  2758. goto ERROR_LIMITS;
  2759. }
  2760. //check the values with thresholds
  2761. ret = checkLimitsMapTotal(total_cx,
  2762. ssCompData.header.force_node,
  2763. 1,
  2764. thresholds_min,
  2765. thresholds_max);
  2766. if (ret != OK) {
  2767. logError(1, "%s production_test_data: ", tag);
  2768. logError(1, "checkLimitsMap SS TOTAL FORCE ");
  2769. logError(1, "failed... ERROR COUNT = %d\n",
  2770. ret);
  2771. logError(0, "%s SS TOTAL FORCE MIN MAX ", tag);
  2772. logError(0, "TEST:.................FAIL\n\n");
  2773. count_fail += 1;
  2774. if (stop_on_fail)
  2775. goto ERROR;
  2776. } else {
  2777. logError(0, "%s SS TOTAL FORCE MIN MAX ", tag);
  2778. logError(0, "TEST:.................OK\n\n");
  2779. }
  2780. kfree(thresholds_min);
  2781. thresholds_min = NULL;
  2782. kfree(thresholds_max);
  2783. thresholds_max = NULL;
  2784. } else {
  2785. logError(0, "%s SS TOTAL CX FORCE MIN MAX TEST:", tag);
  2786. logError(0, ".................SKIPPED\n");
  2787. }
  2788. //SS TOTAL CX FORCE ADJV TEST
  2789. logError(0, "%s SS TOTAL CX FORCE ADJ TEST:\n", tag);
  2790. if (todo->SelfForceCxTotalAdj == 1) {
  2791. logError(0, "%s SS TOTAL CX FORCE ADJVERT ", tag);
  2792. logError(0, "TEST:\n");
  2793. //comepute the ADJV for CX2 FORCE
  2794. ret = computeAdjVertTotal(total_cx,
  2795. ssCompData.header.force_node,
  2796. 1,
  2797. &total_adjvert);
  2798. if (ret < 0) {
  2799. logError(1, "%s production_test_data: ", tag);
  2800. logError(1, "computeAdjVert SS TOTAL CX FORCE");
  2801. logError(1, " ADJV failed... ERROR %02X\n",
  2802. ERROR_PROD_TEST_DATA);
  2803. ret |= ERROR_PROD_TEST_DATA;
  2804. goto ERROR_LIMITS;
  2805. }
  2806. logError(0, "%s SS TOTAL CX FORCE ADJV computed!\n",
  2807. tag);
  2808. ret = parseProductionTestLimits(path_limits,
  2809. SS_TOTAL_CX_FORCE_ADJV_MAP_MAX,
  2810. &thresholds_max,
  2811. &trows,
  2812. &tcolumns); //load the max thresholds
  2813. if (ret < 0
  2814. || (trows != ssCompData.header.force_node - 1
  2815. || tcolumns != 1)) {
  2816. logError(1, "%s production_test_data: ", tag);
  2817. logError(1, "parseProductionTestLimits ");
  2818. logError(1, "SS_TOTAL_CX_FORCE_ADJV_MAP_MAX ");
  2819. logError(1, "failed... ERROR %02X\n",
  2820. ERROR_PROD_TEST_DATA);
  2821. ret |= ERROR_PROD_TEST_DATA;
  2822. goto ERROR_LIMITS;
  2823. }
  2824. //check the values with thresholds
  2825. ret = checkLimitsMapAdjTotal(total_adjvert,
  2826. ssCompData.header.force_node - 1,
  2827. 1,
  2828. thresholds_max);
  2829. if (ret != OK) {
  2830. logError(1, "%s production_test_data: ", tag);
  2831. logError(1, "checkLimitsMap SS TOTAL CX FORCE");
  2832. logError(1, " failed... ERROR COUNT = %d\n",
  2833. ret);
  2834. logError(0, "%s SS TOTAL CX FORCE ADJV ", tag);
  2835. logError(0, "TEST:.................FAIL\n\n");
  2836. count_fail += 1;
  2837. if (stop_on_fail)
  2838. goto ERROR;
  2839. } else {
  2840. logError(0, "%s SS TOTAL CX FORCE ADJV ", tag);
  2841. logError(0, "TEST:.................OK\n\n");
  2842. }
  2843. kfree(thresholds_max);
  2844. thresholds_max = NULL;
  2845. kfree(total_adjvert);
  2846. total_adjvert = NULL;
  2847. } else {
  2848. logError(0, "%s SS TOTAL CX FORCE ADJ TEST:......",
  2849. tag);
  2850. logError(0, "..........SKIPPED\n");
  2851. }
  2852. kfree(total_cx);
  2853. total_cx = NULL;
  2854. } else {
  2855. logError(0, "%s SS TOTAL CX FORCE TEST:.................", tag);
  2856. logError(0, "SKIPPED\n\n");
  2857. }
  2858. //**************** SS SENSE CX **************************************/
  2859. //SS CX1 SENSE TEST
  2860. logError(0, "%s SS CX1 SENSE TEST:\n", tag);
  2861. if (todo->SelfSenseCx1 == 1) {
  2862. ret = parseProductionTestLimits(path_limits,
  2863. SS_CX1_SENSE_MIN_MAX,
  2864. &thresholds,
  2865. &trows,
  2866. &tcolumns);
  2867. if (ret < 0 || (trows != 1 || tcolumns != 2)) {
  2868. logError(1, "%s production_test_data: ", tag);
  2869. logError(1, "parseProductionTestLimits ");
  2870. logError(1, "SS_CX1_SENSE_MIN_MAX failed");
  2871. logError(1, "... ERROR %02X\n", ERROR_PROD_TEST_DATA);
  2872. ret |= ERROR_PROD_TEST_DATA;
  2873. goto ERROR_LIMITS;
  2874. }
  2875. container = (u16) ssCompData.s_cx1;
  2876. //check the limits
  2877. ret = checkLimitsMinMax(&container,
  2878. 1,
  2879. 1,
  2880. thresholds[0],
  2881. thresholds[1]);
  2882. if (ret != OK) {
  2883. logError(1, "%s production_test_data: ", tag);
  2884. logError(1, "checkLimitsMinMax SS CX1 SENSE TEST ");
  2885. logError(1, "failed... ERROR COUNT = %d\n", ret);
  2886. count_fail += 1;
  2887. if (stop_on_fail)
  2888. goto ERROR;
  2889. } else {
  2890. logError(0, "%s SS CX1 SENSE TEST:..............", tag);
  2891. logError(0, "...OK\n\n");
  2892. }
  2893. kfree(thresholds);
  2894. thresholds = NULL;
  2895. } else {
  2896. logError(0, "%s SS CX1 SENSE TEST:.................", tag);
  2897. logError(0, "SKIPPED\n\n");
  2898. }
  2899. //SS CX2 SENSE TEST
  2900. logError(0, "%s SS CX2 SENSE MIN MAX TEST:\n", tag);
  2901. if (todo->SelfSenseCx2 == 1) {
  2902. //load the min thresholds
  2903. ret = parseProductionTestLimits(path_limits,
  2904. SS_CX2_SENSE_MAP_MIN,
  2905. &thresholds_min,
  2906. &trows,
  2907. &tcolumns);
  2908. if (ret < 0 || (trows != 1
  2909. || tcolumns != ssCompData.header.sense_node)) {
  2910. logError(1, "%s production_test_data: ", tag);
  2911. logError(1, "parseProductionTestLimits ");
  2912. logError(1, "SS_CX2_SENSE_MAP_MIN failed... ");
  2913. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  2914. ret |= ERROR_PROD_TEST_DATA;
  2915. goto ERROR_LIMITS;
  2916. }
  2917. //load the max thresholds
  2918. ret = parseProductionTestLimits(path_limits,
  2919. SS_CX2_SENSE_MAP_MAX,
  2920. &thresholds_max,
  2921. &trows,
  2922. &tcolumns);
  2923. if (ret < 0 || (trows != 1
  2924. || tcolumns != ssCompData.header.sense_node)) {
  2925. logError(1, "%s production_test_data: ", tag);
  2926. logError(1, "parseProductionTestLimits ");
  2927. logError(1, "SS_CX2_SENSE_MAP_MAX failed... ");
  2928. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  2929. ret |= ERROR_PROD_TEST_DATA;
  2930. goto ERROR_LIMITS;
  2931. }
  2932. //check the values with thresholds
  2933. ret = checkLimitsMap(ssCompData.cx2_sn,
  2934. 1,
  2935. ssCompData.header.sense_node,
  2936. thresholds_min,
  2937. thresholds_max);
  2938. if (ret != OK) {
  2939. logError(1, "%s production_test_data: ", tag);
  2940. logError(1, "checkLimitsMap SS CX2 SENSE failed... ");
  2941. logError(1, "ERROR COUNT = %d\n", ret);
  2942. logError(0, "%s SS CX2 SENSE MIN MAX TEST:......", tag);
  2943. logError(0, "...........FAIL\n\n");
  2944. count_fail += 1;
  2945. if (stop_on_fail)
  2946. goto ERROR;
  2947. } else {
  2948. logError(0, "%s SS CX2 SENSE MIN MAX TEST:", tag);
  2949. logError(0, ".................OK\n\n");
  2950. }
  2951. kfree(thresholds_min);
  2952. thresholds_min = NULL;
  2953. kfree(thresholds_max);
  2954. thresholds_max = NULL;
  2955. } else {
  2956. logError(0, "%s SS CX2 SENSE MIN MAX TEST:.........", tag);
  2957. logError(0, "........SKIPPED\n");
  2958. }
  2959. logError(0, "%s SS CX2 SENSE ADJ TEST:\n", tag);
  2960. if (todo->SelfSenseCx2Adj == 1) {
  2961. //SS CX2 SENSE ADJH TEST
  2962. logError(0, "%s SS CX2 SENSE ADJHORIZ TEST:\n", tag);
  2963. ret = computeAdjHoriz(ssCompData.cx2_sn,
  2964. 1,
  2965. ssCompData.header.sense_node,
  2966. &adjhor);
  2967. if (ret < 0) {
  2968. logError(1, "%s production_test_data: ", tag);
  2969. logError(1, "computeAdjHoriz SS CX2 SENSE ADJH ");
  2970. logError(1, "failed... ERROR %02X\n",
  2971. ERROR_PROD_TEST_DATA);
  2972. ret |= ERROR_PROD_TEST_DATA;
  2973. goto ERROR_LIMITS;
  2974. }
  2975. logError(0, "%s SS CX2 SENSE ADJH computed!\n", tag);
  2976. //load the max thresholds
  2977. ret = parseProductionTestLimits(path_limits,
  2978. SS_CX2_SENSE_ADJH_MAP_MAX,
  2979. &thresholds_max,
  2980. &trows,
  2981. &tcolumns);
  2982. if (ret < 0 || (trows != 1
  2983. || tcolumns != ssCompData.header.sense_node - 1)) {
  2984. logError(1, "%s production_test_data: ", tag);
  2985. logError(1, "parseProductionTestLimits ");
  2986. logError(1, "SS_IX2_SENSE_MAP_MAX failed... ");
  2987. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  2988. ret |= ERROR_PROD_TEST_DATA;
  2989. goto ERROR_LIMITS;
  2990. }
  2991. //check the values with thresholds
  2992. ret = checkLimitsMapAdj(adjhor,
  2993. 1,
  2994. ssCompData.header.sense_node - 1,
  2995. thresholds_max);
  2996. if (ret != OK) {
  2997. logError(1, "%s production_test_data: ", tag);
  2998. logError(1, "checkLimitsMapAdj SS CX2 SENSE ADJH ");
  2999. logError(1, "failed... ERROR COUNT = %d\n", ret);
  3000. logError(0, "%s SS CX2 SENSE ADJH TEST:.........", tag);
  3001. logError(0, "........FAIL\n\n");
  3002. count_fail += 1;
  3003. if (stop_on_fail)
  3004. goto ERROR;
  3005. } else {
  3006. logError(0, "%s SS CX2 SENSE ADJH TEST:.........", tag);
  3007. logError(0, "........OK\n");
  3008. }
  3009. kfree(thresholds_max);
  3010. thresholds_max = NULL;
  3011. kfree(adjhor);
  3012. adjhor = NULL;
  3013. } else {
  3014. logError(0, "%s SS CX2 SENSE ADJ TEST:.................", tag);
  3015. logError(0, "SKIPPED\n\n");
  3016. }
  3017. //SS TOTAL CX SENSE
  3018. logError(0, "%s SS TOTAL CX SENSE TEST:\n", tag);
  3019. if (todo->SelfSenseCxTotal == 1 || todo->SelfSenseCxTotalAdj == 1) {
  3020. ret = computeTotal(ssCompData.cx2_sn,
  3021. ssCompData.s_cx1,
  3022. 1,
  3023. ssCompData.header.sense_node,
  3024. CX1_WEIGHT,
  3025. CX2_WEIGHT,
  3026. &total_cx);
  3027. if (ret < 0) {
  3028. logError(1, "%s production_test_data: ", tag);
  3029. logError(1, "computeTotal Cx Sense failed... ");
  3030. logError(1, "ERROR %02X\n", ERROR_PROD_TEST_DATA);
  3031. ret |= ERROR_PROD_TEST_DATA;
  3032. goto ERROR_LIMITS;
  3033. }
  3034. logError(0, "%s SS TOTAL CX SENSE MIN MAX TEST:\n", tag);
  3035. //load the min thresholds
  3036. if (todo->SelfSenseCxTotal == 1) {
  3037. ret = parseProductionTestLimits(path_limits,
  3038. SS_TOTAL_CX_SENSE_MAP_MIN,
  3039. &thresholds_min,
  3040. &trows,
  3041. &tcolumns);
  3042. if (ret < 0 || (trows != 1
  3043. || tcolumns != ssCompData.header.sense_node)) {
  3044. logError(1, "%s production_test_data: ", tag);
  3045. logError(1, "parseProductionTestLimits ");
  3046. logError(1, "SS_TOTAL_CX_SENSE_MAP_MIN ");
  3047. logError(1, "failed... ERROR %02X\n",
  3048. ERROR_PROD_TEST_DATA);
  3049. ret |= ERROR_PROD_TEST_DATA;
  3050. goto ERROR_LIMITS;
  3051. }
  3052. //load the max thresholds
  3053. ret = parseProductionTestLimits(path_limits,
  3054. SS_TOTAL_CX_SENSE_MAP_MAX,
  3055. &thresholds_max,
  3056. &trows,
  3057. &tcolumns);
  3058. if (ret < 0 || (trows != 1
  3059. || tcolumns != ssCompData.header.sense_node)) {
  3060. logError(1, "%s production_test_data: ", tag);
  3061. logError(1, "parseProductionTestLimits ");
  3062. logError(1, "SS_TOTAL_CX_SENSE_MAP_MAX ");
  3063. logError(1, "failed... ERROR %02X\n",
  3064. ERROR_PROD_TEST_DATA);
  3065. ret |= ERROR_PROD_TEST_DATA;
  3066. goto ERROR_LIMITS;
  3067. }
  3068. //check the values with thresholds
  3069. ret = checkLimitsMapTotal(total_cx,
  3070. 1,
  3071. ssCompData.header.sense_node,
  3072. thresholds_min,
  3073. thresholds_max);
  3074. if (ret != OK) {
  3075. logError(1, "%s production_test_data: ", tag);
  3076. logError(1, "heckLimitsMap SS TOTAL CX SENSE ");
  3077. logError(1, "failed... ERROR COUNT = %d\n",
  3078. ret);
  3079. logError(0, "%s SS TOTAL CX SENSE MIN ", tag);
  3080. logError(0, "MAX TEST:.................");
  3081. logError(0, "FAIL\n\n");
  3082. count_fail += 1;
  3083. if (stop_on_fail)
  3084. goto ERROR;
  3085. } else {
  3086. logError(0, "%s SS TOTAL CX SENSE MIN ", tag);
  3087. logError(0, "MAX TEST:................OK\n\n");
  3088. }
  3089. kfree(thresholds_min);
  3090. thresholds_min = NULL;
  3091. kfree(thresholds_max);
  3092. thresholds_max = NULL;
  3093. } else {
  3094. logError(0, "%s SS TOTAL CX SENSE MIN MAX TEST:", tag);
  3095. logError(0, ".................SKIPPED\n");
  3096. }
  3097. //SS TOTAL IX SENSE ADJH TEST
  3098. logError(0, "%s SS TOTAL CX SENSE ADJ TEST:\n", tag);
  3099. if (todo->SelfSenseCxTotalAdj == 1) {
  3100. logError(0, "%s SS TOTAL CX SENSE ADJHORIZ TEST:\n",
  3101. tag);
  3102. ret = computeAdjHorizTotal(total_cx,
  3103. 1,
  3104. ssCompData.header.sense_node,
  3105. &total_adjhor);
  3106. if (ret < 0) {
  3107. logError(1, "%s production_test_data: ", tag);
  3108. logError(1, "computeAdjHoriz SS TOTAL CX ");
  3109. logError(1, "SENSE ADJH failed... ");
  3110. logError(1, "ERROR %02X\n",
  3111. ERROR_PROD_TEST_DATA);
  3112. ret |= ERROR_PROD_TEST_DATA;
  3113. goto ERROR_LIMITS;
  3114. }
  3115. logError(0, "%s SS TOTAL CX SENSE ADJ HORIZ ", tag);
  3116. logError(0, "computed!\n");
  3117. ret = parseProductionTestLimits(path_limits,
  3118. SS_TOTAL_CX_SENSE_ADJH_MAP_MAX,
  3119. &thresholds_max,
  3120. &trows,
  3121. &tcolumns); //load the max thresholds
  3122. if (ret < 0 || (trows != 1 ||
  3123. tcolumns != ssCompData.header.sense_node - 1)) {
  3124. logError(1, "%s production_test_data: ", tag);
  3125. logError(1, "parseProductionTestLimits ");
  3126. logError(1, "SS_TOTAL_CX_SENSE_ADJH_MAP_MAX ");
  3127. logError(1, "failed... ERROR %02X\n",
  3128. ERROR_PROD_TEST_DATA);
  3129. ret |= ERROR_PROD_TEST_DATA;
  3130. goto ERROR_LIMITS;
  3131. }
  3132. //check the values with thresholds
  3133. ret = checkLimitsMapAdjTotal(total_adjhor,
  3134. 1,
  3135. ssCompData.header.sense_node - 1,
  3136. thresholds_max);
  3137. if (ret != OK) {
  3138. logError(1, "%s production_test_data: ", tag);
  3139. logError(1, "checkLimitsMapAdj SS TOTAL ");
  3140. logError(1, "CX SENSE ADJH failed... ");
  3141. logError(1, "ERROR COUNT = %d\n", ret);
  3142. logError(0, "%s SS TOTAL CX SENSE ADJH ", tag);
  3143. logError(0, "TEST:...FAIL\n\n");
  3144. count_fail += 1;
  3145. if (stop_on_fail)
  3146. goto ERROR;
  3147. } else {
  3148. logError(0, "%s SS TOTAL CX SENSE ADJH TEST:",
  3149. tag);
  3150. logError(0, ".................OK\n\n");
  3151. }
  3152. kfree(thresholds_max);
  3153. thresholds_max = NULL;
  3154. kfree(total_adjhor);
  3155. total_adjhor = NULL;
  3156. } else {
  3157. logError(0, "%s SS TOTAL CX SENSE ADJ TEST:.", tag);
  3158. logError(0, "SKIPPED\n");
  3159. }
  3160. kfree(total_cx);
  3161. total_cx = NULL;
  3162. } else
  3163. logError(0, "%s SS TOTAL CX SENSE TEST:.....SKIPPED\n", tag);
  3164. ERROR:
  3165. logError(0, "%s\n", tag);
  3166. if (count_fail == 0) {
  3167. kfree(ssCompData.ix2_fm);
  3168. ssCompData.ix2_fm = NULL;
  3169. kfree(ssCompData.ix2_sn);
  3170. ssCompData.ix2_sn = NULL;
  3171. kfree(ssCompData.cx2_fm);
  3172. ssCompData.cx2_fm = NULL;
  3173. kfree(ssCompData.cx2_sn);
  3174. ssCompData.cx2_sn = NULL;
  3175. logError(0, "%s SS IX CX testes finished!........OK\n\n", tag);
  3176. ret = OK;
  3177. } else {
  3178. //print all kind of data in just one row for readability reason
  3179. print_frame_u8("SS Init Data Ix2_fm = ",
  3180. array1dTo2d_u8(ssCompData.ix2_fm,
  3181. ssCompData.header.force_node,
  3182. ssCompData.header.force_node),
  3183. 1,
  3184. ssCompData.header.force_node);
  3185. print_frame_u8("SS Init Data Cx2_fm = ",
  3186. array1dTo2d_u8(ssCompData.cx2_fm,
  3187. ssCompData.header.force_node,
  3188. ssCompData.header.force_node),
  3189. 1,
  3190. ssCompData.header.force_node);
  3191. print_frame_u8("SS Init Data Ix2_sn = ",
  3192. array1dTo2d_u8(ssCompData.ix2_sn,
  3193. ssCompData.header.sense_node,
  3194. ssCompData.header.sense_node),
  3195. 1,
  3196. ssCompData.header.sense_node);
  3197. print_frame_u8("SS Init Data Cx2_sn = ",
  3198. array1dTo2d_u8(ssCompData.cx2_sn,
  3199. ssCompData.header.sense_node,
  3200. ssCompData.header.sense_node),
  3201. 1,
  3202. ssCompData.header.sense_node);
  3203. logError(0, "%s SS IX CX testes finished!.................",
  3204. tag);
  3205. logError(0, "FAILED fails_count = %d\n\n", count_fail);
  3206. kfree(thresholds);
  3207. kfree(thresholds_min);
  3208. kfree(thresholds_max);
  3209. kfree(adjhor);
  3210. kfree(adjvert);
  3211. kfree(ix1_w);
  3212. kfree(ix2_w);
  3213. kfree(total_ix);
  3214. kfree(total_cx);
  3215. kfree(total_adjhor);
  3216. kfree(total_adjvert);
  3217. kfree(ssCompData.ix2_fm);
  3218. kfree(ssCompData.ix2_sn);
  3219. kfree(ssCompData.cx2_fm);
  3220. kfree(ssCompData.cx2_sn);
  3221. ret = (ERROR_TEST_CHECK_FAIL | ERROR_PROD_TEST_DATA);
  3222. }
  3223. return ret;
  3224. ERROR_LIMITS:
  3225. kfree(thresholds);
  3226. kfree(thresholds_min);
  3227. kfree(thresholds_max);
  3228. kfree(adjhor);
  3229. kfree(adjvert);
  3230. kfree(ix1_w);
  3231. kfree(ix2_w);
  3232. kfree(total_ix);
  3233. kfree(total_cx);
  3234. kfree(total_adjhor);
  3235. kfree(total_adjvert);
  3236. kfree(ssCompData.ix2_fm);
  3237. kfree(ssCompData.ix2_sn);
  3238. kfree(ssCompData.cx2_fm);
  3239. kfree(ssCompData.cx2_sn);
  3240. return ret;
  3241. }
  3242. int production_test_data(char *path_limits, int stop_on_fail,
  3243. struct TestToDo *todo)
  3244. {
  3245. int res = OK, ret;
  3246. if (todo == NULL) {
  3247. logError(0, "%s %s: ", tag, __func__);
  3248. logError(0, "No TestToDo specified!! ");
  3249. logError(0, "ERROR = %02X\n",
  3250. (ERROR_OP_NOT_ALLOW | ERROR_PROD_TEST_DATA));
  3251. return (ERROR_OP_NOT_ALLOW | ERROR_PROD_TEST_DATA);
  3252. }
  3253. logError(0, "%s DATA Production test is starting...\n", tag);
  3254. ret = production_test_ms_raw(path_limits, stop_on_fail, todo);
  3255. res |= ret;
  3256. if (ret < 0) {
  3257. logError(0, "%s %s: ", tag, __func__);
  3258. logError(0, "production_test_ms_raw failed... ");
  3259. logError(0, "ERROR = %02X\n", ret);
  3260. if (stop_on_fail == 1)
  3261. goto END;
  3262. }
  3263. ret = production_test_ms_cx(path_limits, stop_on_fail, todo);
  3264. res |= ret;
  3265. if (ret < 0) {
  3266. logError(0, "%s %s: ", tag, __func__);
  3267. logError(0, "production_test_ms_cx failed... ");
  3268. logError(0, "ERROR = %02X\n", ret);
  3269. if (stop_on_fail == 1)
  3270. goto END;
  3271. }
  3272. ret = production_test_ss_raw(path_limits, stop_on_fail, todo);
  3273. res |= ret;
  3274. if (ret < 0) {
  3275. logError(0, "%s %s: ", tag, __func__);
  3276. logError(0, "production_test_ss_raw failed... ");
  3277. logError(0, "ERROR = %02X\n", ret);
  3278. if (stop_on_fail == 1)
  3279. goto END;
  3280. }
  3281. ret = production_test_ss_ix_cx(path_limits, stop_on_fail, todo);
  3282. res |= ret;
  3283. if (ret < 0) {
  3284. logError(0, "%s %s: ", tag, __func__);
  3285. logError(0, "production_test_ss_ix_cx failed... ");
  3286. logError(0, "ERROR = %02X\n", ret);
  3287. if (stop_on_fail == 1)
  3288. goto END;
  3289. }
  3290. END:
  3291. if (res < OK)
  3292. logError(0, "%s DATA Production test failed!\n", tag);
  3293. else
  3294. logError(0, "%s DATA Production test finished!\n", tag);
  3295. return res;
  3296. }
  3297. int save_mp_flag(u32 signature)
  3298. {
  3299. int res = -1;
  3300. int i;
  3301. u8 cmd[6] = {FTS_CMD_WRITE_MP_FLAG, 0x00, 0x00, 0x00, 0x00, 0x00};
  3302. u32ToU8(signature, &cmd[2]);
  3303. logError(0, "%s Starting Saving Flag with signature = %08X ...\n",
  3304. tag, signature);
  3305. for (i = 0; i < SAVE_FLAG_RETRY && res < OK; i++) {
  3306. logError(0, "%s Attempt number %d to save mp flag !\n",
  3307. tag, i+1);
  3308. logError(0, "%s Command write flag sent...\n", tag);
  3309. res = fts_writeFwCmd(cmd, 6);
  3310. if (res >= OK)
  3311. res = save_cx_tuning();
  3312. }
  3313. if (res < OK) {
  3314. logError(1, "%s %s: ERROR %08X ...\n", tag, __func__, res);
  3315. } else {
  3316. logError(0, "%s Saving Flag DONE!\n", tag);
  3317. res = OK;
  3318. }
  3319. return res;
  3320. }
  3321. int parseProductionTestLimits(char *path, char *label,
  3322. int **data, int *row, int *column)
  3323. {
  3324. int find = 0;
  3325. char *token = NULL;
  3326. int i = 0;
  3327. int j = 0;
  3328. int z = 0;
  3329. char *line2 = NULL;
  3330. char line[800];
  3331. int fd = -1;
  3332. char *buf = NULL;
  3333. int n, size, pointer = 0, ret = OK;
  3334. char *data_file = NULL;
  3335. #ifndef LIMITS_H_FILE
  3336. const struct firmware *fw = NULL;
  3337. struct device *dev = NULL;
  3338. dev = getDev();
  3339. if (dev != NULL)
  3340. fd = request_firmware(&fw, path, dev);
  3341. #else
  3342. fd = 0;
  3343. #endif
  3344. if (fd != 0) {
  3345. logError(0, "%s %s: ERROR %02X\n",
  3346. tag, __func__, ERROR_FILE_NOT_FOUND);
  3347. return ERROR_FILE_NOT_FOUND;
  3348. }
  3349. #ifndef LIMITS_H_FILE
  3350. size = fw->size;
  3351. data_file = (char *)fw->data;
  3352. logError(0, "%s Start to reading %s...\n", tag, path);
  3353. #else
  3354. size = LIMITS_SIZE_NAME;
  3355. data_file = (char *)(LIMITS_ARRAY_NAME);
  3356. #endif
  3357. logError(0, "%s The size of the limits file is %d bytes\n", tag, size);
  3358. while (find == 0) {
  3359. //start to look for the wanted label
  3360. if (readLine(&data_file[pointer], line, size-pointer, &n) < 0) {
  3361. find = -1;
  3362. break;
  3363. }
  3364. pointer += n;
  3365. //each header row start with
  3366. // *ex. *label, n_row, n_colum
  3367. if (line[0] != '*')
  3368. continue;
  3369. line2 = kstrdup(line, GFP_KERNEL);
  3370. if (line2 == NULL) {
  3371. logError(1, "%s %s:kstrdup ERR %02X\n",
  3372. tag, __func__, ERROR_ALLOC);
  3373. ret = ERROR_ALLOC;
  3374. goto END;
  3375. }
  3376. buf = line2;
  3377. line2 += 1;
  3378. token = strsep(&line2, ",");
  3379. //if the row is the wanted one i
  3380. //retrieve rows and columns info
  3381. if (strcmp(token, label) == 0) {
  3382. find = 1;
  3383. token = strsep(&line2, ",");
  3384. if (token != NULL) {
  3385. ret = kstrtoint(token, 10, row);
  3386. if (ret != 0)
  3387. return -EINVAL;
  3388. logError(0, "%s Row = %d\n", tag, *row);
  3389. } else {
  3390. logError(1, "%s %s 1:ERROR %02X\n",
  3391. tag, __func__, ERROR_FILE_PARSE);
  3392. //release_firmware(fw);
  3393. //return ERROR_FILE_PARSE;
  3394. ret = ERROR_FILE_PARSE;
  3395. goto END;
  3396. }
  3397. token = strsep(&line2, ",");
  3398. if (token != NULL) {
  3399. ret = kstrtoint(token, 10, column);
  3400. if (ret != 0)
  3401. return -EINVAL;
  3402. logError(0, "%s Column = %d\n", tag, *column);
  3403. } else {
  3404. logError(1, "%s %s 2: ERROR %02X\n",
  3405. tag, __func__, ERROR_FILE_PARSE);
  3406. //release_firmware(fw);
  3407. //return ERROR_FILE_PARSE;
  3408. ret = ERROR_FILE_PARSE;
  3409. goto END;
  3410. }
  3411. kfree(buf);
  3412. buf = NULL;
  3413. //allocate memory for containing data
  3414. *data = (int *)kmalloc_array(((*row) * (*column)),
  3415. sizeof(int), GFP_KERNEL);
  3416. j = 0;
  3417. if (*data == NULL) {
  3418. logError(1, "%s %s: ERROR %02X\n",
  3419. tag, __func__, ERROR_ALLOC);
  3420. //release_firmware(fw);
  3421. //return ERROR_ALLOC;
  3422. ret = ERROR_ALLOC;
  3423. goto END;
  3424. }
  3425. //start to read the data
  3426. for (i = 0; i < *row; i++) {
  3427. //line = buf;
  3428. if (readLine(&data_file[pointer], line,
  3429. size-pointer, &n) < 0) {
  3430. logError(1, "%s %s : ERROR %02X\n",
  3431. tag, __func__, ERROR_FILE_READ);
  3432. //release_firmware(fw);
  3433. //return ERROR_FILE_READ
  3434. ret = ERROR_FILE_READ;
  3435. goto END;
  3436. }
  3437. pointer += n;
  3438. line2 = kstrdup(line, GFP_KERNEL);
  3439. if (line2 == NULL) {
  3440. logError(1, "%s %s: kstrdup ",
  3441. tag, __func__);
  3442. logError(1, "ERROR %02X\n",
  3443. ERROR_ALLOC);
  3444. ret = ERROR_ALLOC;
  3445. goto END;
  3446. }
  3447. buf = line2;
  3448. token = strsep(&line2, ",");
  3449. for (z = 0;
  3450. (z < *column) && (token != NULL); z++) {
  3451. ret = kstrtoint(token,
  3452. 10,
  3453. ((*data) + j));
  3454. if (ret != 0)
  3455. return -EINVAL;
  3456. j++;
  3457. token = strsep(&line2, ",");
  3458. }
  3459. kfree(buf);
  3460. buf = NULL;
  3461. }
  3462. //check that all the data are read
  3463. if (j == ((*row) * (*column))) {
  3464. logError(0, "%s READ DONE!\n", tag);
  3465. //release_firmware(fw);
  3466. //return OK;
  3467. ret = OK;
  3468. goto END;
  3469. }
  3470. logError(1, "%s %s 3:ERROR %02X\n",
  3471. tag, __func__, ERROR_FILE_PARSE);
  3472. //release_firmware(fw);
  3473. //return ERROR_FILE_PARSE;
  3474. ret = ERROR_FILE_PARSE;
  3475. goto END;
  3476. }
  3477. kfree(buf);
  3478. buf = NULL;
  3479. }
  3480. logError(1, "%s %s: ERROR %02X\n",
  3481. tag, __func__, ERROR_LABEL_NOT_FOUND);
  3482. ret = ERROR_LABEL_NOT_FOUND;
  3483. END:
  3484. kfree(buf);
  3485. #ifndef LIMITS_H_FILE
  3486. release_firmware(fw);
  3487. #endif
  3488. return ret;
  3489. }
  3490. int readLine(char *data, char *line, int size, int *n)
  3491. {
  3492. int i = 0;
  3493. if (size < 1)
  3494. return -EINVAL;
  3495. while (data[i] != '\n' && i < size) {
  3496. line[i] = data[i];
  3497. i++;
  3498. }
  3499. *n = i + 1;
  3500. line[i] = '\0';
  3501. return OK;
  3502. }